GRASS Programmer's Manual
6.4.2(2012)
|
00001 00015 #include <grass/dbmi.h> 00016 #include "macros.h" 00017 00028 int db_fetch(dbCursor * cursor, int position, int *more) 00029 { 00030 int ret_code; 00031 00032 /* start the procedure call */ 00033 db__set_protocol_fds(cursor->driver->send, cursor->driver->recv); 00034 DB_START_PROCEDURE_CALL(DB_PROC_FETCH); 00035 00036 /* send the argument(s) to the procedure */ 00037 DB_SEND_TOKEN(&cursor->token); 00038 DB_SEND_INT(position); 00039 00040 /* get the return code for the procedure call */ 00041 DB_RECV_RETURN_CODE(&ret_code); 00042 00043 if (ret_code != DB_OK) 00044 return ret_code; /* ret_code SHOULD == DB_FAILED */ 00045 00046 /* get the results */ 00047 DB_RECV_INT(more); 00048 if (*more) { 00049 DB_RECV_TABLE_DATA(cursor->table); 00050 } 00051 return DB_OK; 00052 }