00001 #include <stdlib.h> 00002 #include <grass/dbmi.h> 00003 #include "macros.h" 00004 #include "dbstubs.h" 00005 00012 int 00013 db_d_close_cursor() 00014 { 00015 dbCursor *cursor; 00016 dbToken token; 00017 int stat; 00018 00019 /* get the arg(s) */ 00020 DB_RECV_TOKEN(&token); 00021 cursor = (dbCursor *) db_find_token(token); 00022 if (cursor == NULL) 00023 { 00024 db_error ("** invalid cursor **"); 00025 return DB_FAILED; 00026 } 00027 00028 /* call the procedure */ 00029 stat = db_driver_close_cursor (cursor); 00030 00031 /* get rid of the cursor */ 00032 db_drop_token (token); 00033 db_free_cursor (cursor); 00034 db__drop_cursor_from_driver_state(cursor); 00035 free (cursor); 00036 00037 /* send the return code */ 00038 if (stat != DB_OK) 00039 { 00040 DB_SEND_FAILURE(); 00041 return DB_OK; 00042 } 00043 DB_SEND_SUCCESS(); 00044 00045 /* no results */ 00046 return DB_OK; 00047 }