GRASS Programmer's Manual 6.4.1(2011)
|
00001 00015 #include <grass/dbmi.h> 00016 #include "macros.h" 00017 #include "dbstubs.h" 00018 00025 int db_d_insert(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_insert(cursor)) { 00035 db_error("** not an insert cursor **"); 00036 DB_SEND_FAILURE(); 00037 return DB_FAILED; 00038 } 00039 DB_RECV_TABLE_DATA(cursor->table); 00040 00041 /* call the procedure */ 00042 stat = db_driver_insert(cursor); 00043 00044 /* send the return code */ 00045 if (stat != DB_OK) { 00046 DB_SEND_FAILURE(); 00047 return DB_OK; 00048 } 00049 DB_SEND_SUCCESS(); 00050 00051 /* no results */ 00052 return DB_OK; 00053 }