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