00001 #include <grass/dbmi.h> 00002 #include "macros.h" 00003 #include "dbstubs.h" 00004 00011 int 00012 db_d_insert() 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_insert(cursor)) 00022 { 00023 db_error ("** not an insert cursor **"); 00024 DB_SEND_FAILURE(); 00025 return DB_FAILED; 00026 } 00027 DB_RECV_TABLE_DATA (cursor->table); 00028 00029 /* call the procedure */ 00030 stat = db_driver_insert (cursor); 00031 00032 /* send the return code */ 00033 if (stat != DB_OK) 00034 { 00035 DB_SEND_FAILURE(); 00036 return DB_OK; 00037 } 00038 DB_SEND_SUCCESS(); 00039 00040 /* no results */ 00041 return DB_OK; 00042 }