GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
c_openupdate.c
Go to the documentation of this file.
1 
15 #include <grass/dbmi.h>
16 #include "macros.h"
17 
31 int db_open_update_cursor(dbDriver * driver, dbString * table_name,
32  dbString * select, dbCursor * cursor, int mode)
33 {
34  int ret_code;
35 
36  db_init_cursor(cursor);
37  cursor->driver = driver;
38 
39  /* start the procedure call */
40  db__set_protocol_fds(driver->send, driver->recv);
41  DB_START_PROCEDURE_CALL(DB_PROC_OPEN_UPDATE_CURSOR);
42 
43  /* send the argument(s) to the procedure */
44  DB_SEND_STRING(table_name);
45  DB_SEND_STRING(select);
46  DB_SEND_INT(mode);
47 
48  /* get the return code for the procedure call */
49  DB_RECV_RETURN_CODE(&ret_code);
50 
51  if (ret_code != DB_OK)
52  return ret_code; /* ret_code SHOULD == DB_FAILED */
53 
54  /* get the results */
55  DB_RECV_TOKEN(&cursor->token);
56  DB_RECV_INT(&cursor->type);
57  DB_RECV_INT(&cursor->mode);
58  DB_RECV_TABLE_DEFINITION(&cursor->table);
60  return DB_OK;
61 }
struct driver * driver
Definition: driver/init.c:26
void db__set_protocol_fds(FILE *send, FILE *recv)
Definition: xdr.c:71
#define DB_SEND_INT(x)
Definition: macros.h:37
#define DB_RECV_INT(x)
Definition: macros.h:39
#define DB_RECV_TOKEN(x)
Definition: macros.h:99
int db_open_update_cursor(dbDriver *driver, dbString *table_name, dbString *select, dbCursor *cursor, int mode)
Open update cursor.
Definition: c_openupdate.c:31
void db_init_cursor(dbCursor *cursor)
Definition: cursor.c:10
#define DB_START_PROCEDURE_CALL(x)
Definition: macros.h:2
int db_alloc_cursor_column_flags(dbCursor *cursor)
Definition: cursor.c:254
#define DB_RECV_TABLE_DEFINITION(x)
Definition: macros.h:64
#define DB_RECV_RETURN_CODE(x)
Definition: macros.h:4
#define DB_SEND_STRING(x)
Definition: macros.h:12
Definition: driver.h:25
tuple mode
Definition: tools.py:1481