GRASS Programmer's Manual
6.4.2(2012)
Main Page
Related Pages
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Pages
d_openupdate.c
Go to the documentation of this file.
1
15
#include <stdlib.h>
16
#include <grass/dbmi.h>
17
#include "
macros.h
"
18
#include "
dbstubs.h
"
19
26
int
db_d_open_update_cursor
(
void
)
27
{
28
dbCursor *cursor;
29
int
stat;
30
dbToken token;
31
dbString select;
32
dbString table_name;
33
int
mode;
34
35
/* get the arg(s) */
36
db_init_string
(&table_name);
37
db_init_string
(&select);
38
DB_RECV_STRING
(&table_name);
39
DB_RECV_STRING
(&select);
40
DB_RECV_INT
(&mode);
41
42
/* create a cursor */
43
cursor = (dbCursor *)
db_malloc
(
sizeof
(dbCursor));
44
if
(cursor ==
NULL
)
45
return
db_get_error_code
();
46
token =
db_new_token
((dbAddress) cursor);
47
if
(token < 0)
48
return
db_get_error_code
();
49
db_init_cursor
(cursor);
50
51
/* call the procedure */
52
stat =
db_driver_open_update_cursor
(&table_name, &select, cursor, mode);
53
db_free_string
(&table_name);
54
db_free_string
(&select);
55
56
/* send the return code */
57
if
(stat != DB_OK) {
58
DB_SEND_FAILURE
();
59
return
DB_OK;
60
}
61
DB_SEND_SUCCESS
();
62
63
/* mark this as an update cursor */
64
db_set_cursor_type_update
(cursor);
65
66
/* add this cursor to the cursors managed by the driver state */
67
db__add_cursor_to_driver_state
(cursor);
68
69
/* results */
70
DB_SEND_TOKEN
(&token);
71
DB_SEND_INT
(cursor->type);
72
DB_SEND_INT
(cursor->mode);
73
DB_SEND_TABLE_DEFINITION
(cursor->table);
74
return
DB_OK;
75
}
lib
db
dbmi_driver
d_openupdate.c
Generated on Wed Jun 6 2012 14:04:20 for GRASS Programmer's Manual by
1.8.1