00001 #include <grass/dbmi.h> 00002 #include "macros.h" 00003 00010 int 00011 db_get_num_rows ( dbCursor *cursor ) 00012 { 00013 int nrows, ret_code; 00014 00015 /* start the procedure call */ 00016 db__set_protocol_fds (cursor->driver->send, cursor->driver->recv); 00017 DB_START_PROCEDURE_CALL(DB_PROC_ROWS); 00018 00019 /* send the argument(s) to the procedure */ 00020 DB_SEND_TOKEN (&cursor->token); 00021 00022 /* get the return code for the procedure call */ 00023 DB_RECV_RETURN_CODE(&ret_code); 00024 00025 if (ret_code != DB_OK) 00026 return -1; 00027 00028 /* get the results */ 00029 DB_RECV_INT (&nrows); 00030 00031 return nrows; 00032 }