00001 #include <grass/dbmi.h> 00002 #include "macros.h" 00003 #include "dbstubs.h" 00004 00011 int 00012 db_d_update() 00013 { 00014 dbToken token; 00015 dbCursor *cursor; 00016 int stat; 00017 00018 /* get the arg(s) */ 00019 DB_RECV_TOKEN(&token); 00020 cursor = (dbCursor *) db_find_token(token); 00021 if (cursor == NULL || !db_test_cursor_type_update(cursor)) 00022 { 00023 db_error ("** not an update cursor **"); 00024 DB_SEND_FAILURE(); 00025 return DB_FAILED; 00026 } 00027 if(!db_test_cursor_any_column_flag (cursor)) 00028 { 00029 db_error ("** no columns bound in cursor for update **"); 00030 DB_SEND_FAILURE(); 00031 return DB_FAILED; 00032 } 00033 DB_RECV_TABLE_DATA (cursor->table); 00034 00035 /* call the procedure */ 00036 stat = db_driver_update (cursor); 00037 00038 /* send the return code */ 00039 if (stat != DB_OK) 00040 { 00041 DB_SEND_FAILURE(); 00042 return DB_OK; 00043 } 00044 DB_SEND_SUCCESS(); 00045 00046 /* no results */ 00047 return DB_OK; 00048 }