00001 #include <grass/dbmi.h> 00002 #include "macros.h" 00003 00010 db_open_select_cursor (dbDriver *driver, 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_SELECT_CURSOR); 00021 00022 /* send the argument(s) to the procedure */ 00023 DB_SEND_STRING (select); 00024 DB_SEND_INT (mode); 00025 00026 /* get the return code for the procedure call */ 00027 DB_RECV_RETURN_CODE(&ret_code); 00028 00029 if (ret_code != DB_OK) 00030 return ret_code; /* ret_code SHOULD == DB_FAILED */ 00031 00032 /* get the results */ 00033 DB_RECV_TOKEN(&cursor->token); 00034 DB_RECV_INT(&cursor->type); 00035 DB_RECV_INT(&cursor->mode); 00036 DB_RECV_TABLE_DEFINITION(&cursor->table); 00037 return DB_OK; 00038 }