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_openselect.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_select_cursor
(
void
)
27
{
28
dbCursor *cursor;
29
int
stat;
30
dbToken token;
31
dbString select;
32
int
mode;
33
34
/* get the arg(s) */
35
db_init_string
(&select);
36
DB_RECV_STRING
(&select);
37
DB_RECV_INT
(&mode);
38
39
/* create a cursor */
40
cursor = (dbCursor *)
db_malloc
(
sizeof
(dbCursor));
41
if
(cursor ==
NULL
)
42
return
db_get_error_code
();
43
token =
db_new_token
((dbAddress) cursor);
44
if
(token < 0)
45
return
db_get_error_code
();
46
db_init_cursor
(cursor);
47
48
/* call the procedure */
49
stat =
db_driver_open_select_cursor
(&select, cursor, mode);
50
db_free_string
(&select);
51
52
/* send the return code */
53
if
(stat != DB_OK) {
54
DB_SEND_FAILURE
();
55
return
DB_OK;
56
}
57
DB_SEND_SUCCESS
();
58
59
/* mark this as a readonly cursor */
60
db_set_cursor_type_readonly
(cursor);
61
62
/* add this cursor to the cursors managed by the driver state */
63
db__add_cursor_to_driver_state
(cursor);
64
65
/* results */
66
DB_SEND_TOKEN
(&token);
67
DB_SEND_INT
(cursor->type);
68
DB_SEND_INT
(cursor->mode);
69
DB_SEND_TABLE_DEFINITION
(cursor->table);
70
return
DB_OK;
71
}
lib
db
dbmi_driver
d_openselect.c
Generated on Sun Mar 16 2014 05:07:43 for GRASS Programmer's Manual by
1.8.1.2