00001 #include <grass/dbmi.h> 00002 #include "macros.h" 00003 00010 db_open_update_cursor (dbDriver *driver, dbString *table_name, dbString *select, dbCursor *cursor, int mode) 00011 00012 { 00013 int ret_code; 00014 00015 db_init_cursor (cursor); 00016 cursor->driver = driver; 00017 00018 /* start the procedure call */ 00019 db__set_protocol_fds (driver->send, driver->recv); 00020 DB_START_PROCEDURE_CALL(DB_PROC_OPEN_UPDATE_CURSOR); 00021 00022 /* send the argument(s) to the procedure */ 00023 DB_SEND_STRING (table_name); 00024 DB_SEND_STRING (select); 00025 DB_SEND_INT (mode); 00026 00027 /* get the return code for the procedure call */ 00028 DB_RECV_RETURN_CODE(&ret_code); 00029 00030 if (ret_code != DB_OK) 00031 return ret_code; /* ret_code SHOULD == DB_FAILED */ 00032 00033 /* get the results */ 00034 DB_RECV_TOKEN(&cursor->token); 00035 DB_RECV_INT(&cursor->type); 00036 DB_RECV_INT(&cursor->mode); 00037 DB_RECV_TABLE_DEFINITION(&cursor->table); 00038 db_alloc_cursor_column_flags (cursor); 00039 return DB_OK; 00040 }