GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
d_insert.c
Go to the documentation of this file.
1 
15 #include <grass/dbmi.h>
16 #include "macros.h"
17 #include "dbstubs.h"
18 
25 int db_d_insert(void)
26 {
27  dbToken token;
28  dbCursor *cursor;
29  int stat;
30 
31  /* get the arg(s) */
32  DB_RECV_TOKEN(&token);
33  cursor = (dbCursor *) db_find_token(token);
34  if (cursor == NULL || !db_test_cursor_type_insert(cursor)) {
35  db_error("** not an insert cursor **");
37  return DB_FAILED;
38  }
39  DB_RECV_TABLE_DATA(cursor->table);
40 
41  /* call the procedure */
42  stat = db_driver_insert(cursor);
43 
44  /* send the return code */
45  if (stat != DB_OK) {
47  return DB_OK;
48  }
50 
51  /* no results */
52  return DB_OK;
53 }
int(* db_driver_insert)()
dbAddress db_find_token(dbToken token)
int db_d_insert(void)
Insert new record into table.
Definition: d_insert.c:25
#define DB_RECV_TOKEN(x)
Definition: macros.h:99
void db_error(const char *s)
int stat
Definition: g3dcolor.c:369
int db_test_cursor_type_insert(dbCursor *cursor)
Definition: cursor.c:154
#define DB_SEND_FAILURE()
Definition: macros.h:9
return NULL
Definition: dbfopen.c:1394
#define DB_RECV_TABLE_DATA(x)
Definition: macros.h:69
#define DB_SEND_SUCCESS()
Definition: macros.h:7