GRASS Programmer's Manual
6.4.2(2012)
|
00001 00015 #include <stdlib.h> 00016 #include <grass/dbmi.h> 00017 #include "macros.h" 00018 #include "dbstubs.h" 00019 00026 int db_d_close_cursor(void) 00027 { 00028 dbCursor *cursor; 00029 dbToken token; 00030 int stat; 00031 00032 /* get the arg(s) */ 00033 DB_RECV_TOKEN(&token); 00034 cursor = (dbCursor *) db_find_token(token); 00035 if (cursor == NULL) { 00036 db_error("** invalid cursor **"); 00037 return DB_FAILED; 00038 } 00039 00040 /* call the procedure */ 00041 stat = db_driver_close_cursor(cursor); 00042 00043 /* get rid of the cursor */ 00044 db_drop_token(token); 00045 db_free_cursor(cursor); 00046 db__drop_cursor_from_driver_state(cursor); 00047 db_free(cursor); /* ?? */ 00048 00049 /* send the return code */ 00050 if (stat != DB_OK) { 00051 DB_SEND_FAILURE(); 00052 return DB_OK; 00053 } 00054 DB_SEND_SUCCESS(); 00055 00056 /* no results */ 00057 return DB_OK; 00058 }