00001 00015 #include <grass/dbmi.h> 00016 #include "macros.h" 00017 #include "dbstubs.h" 00018 00025 int db_d_update(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 if (!db_test_cursor_any_column_flag(cursor)) { 00040 db_error("** no columns bound in cursor for update **"); 00041 DB_SEND_FAILURE(); 00042 return DB_FAILED; 00043 } 00044 DB_RECV_TABLE_DATA(cursor->table); 00045 00046 /* call the procedure */ 00047 stat = db_driver_update(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 }