d_delete.c

Go to the documentation of this file.
00001 
00015 #include <grass/dbmi.h>
00016 #include "macros.h"
00017 #include "dbstubs.h"
00018 
00025 int db_d_delete(void)
00026 {
00027     dbToken token;
00028     dbCursor *cursor;
00029     int stat;
00030 
00031     /* get the arg(s) */
00032     DB_RECV_TOKEN(&token);
00033     cursor = (dbCursor *) db_find_token(token);
00034     if (cursor == NULL || !db_test_cursor_type_update(cursor)) {
00035         db_error("** not an update cursor **");
00036         DB_SEND_FAILURE();
00037         return DB_FAILED;
00038     }
00039 
00040     /* call the procedure */
00041     stat = db_driver_delete(cursor);
00042 
00043     /* send the return code */
00044     if (stat != DB_OK) {
00045         DB_SEND_FAILURE();
00046         return DB_OK;
00047     }
00048     DB_SEND_SUCCESS();
00049 
00050     /* no results */
00051     return DB_OK;
00052 }