00001 00015 #include <grass/dbmi.h> 00016 #include "macros.h" 00017 #include "dbstubs.h" 00018 00025 int db_d_get_num_rows(void) 00026 { 00027 dbToken token; 00028 dbCursor *cursor; 00029 int nrows; 00030 00031 /* get the arg(s) */ 00032 DB_RECV_TOKEN(&token); 00033 cursor = (dbCursor *) db_find_token(token); 00034 00035 /* call the procedure */ 00036 nrows = db_driver_get_num_rows(cursor); 00037 00038 /* send the return code */ 00039 if (nrows < 0) { 00040 DB_SEND_FAILURE(); 00041 return DB_OK; 00042 } 00043 DB_SEND_SUCCESS(); 00044 00045 /* results */ 00046 DB_SEND_INT(nrows); 00047 return DB_OK; 00048 }