GRASS GIS 7 Programmer's Manual  7.5.svn(2017)-r71790
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
d_update.c
Go to the documentation of this file.
1 /*!
2  * \file db/dbmi_driver/d_update.c
3  *
4  * \brief DBMI Library (driver) - update statemets
5  *
6  * (C) 1999-2008 by the GRASS Development Team
7  *
8  * This program is free software under the GNU General Public
9  * License (>=v2). Read the file COPYING that comes with GRASS
10  * for details.
11  *
12  * \author Joel Jones (CERL/UIUC), Radim Blazek
13  */
14 
15 #include <grass/dbmi.h>
16 #include "macros.h"
17 #include "dbstubs.h"
18 
19 /*!
20  \brief ?
21 
22  \return DB_OK on success
23  \return DB_FAILED on failure
24 */
25 int db_d_update(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_update(cursor)) {
35  db_error("** not an update cursor **");
37  return DB_FAILED;
38  }
39  if (!db_test_cursor_any_column_flag(cursor)) {
40  db_error("** no columns bound in cursor for update **");
42  return DB_FAILED;
43  }
44  DB_RECV_TABLE_DATA(cursor->table);
45 
46  /* call the procedure */
47  stat = db_driver_update(cursor);
48 
49  /* send the return code */
50  if (stat != DB_OK) {
52  return DB_OK;
53  }
55 
56  /* no results */
57  return DB_OK;
58 }
dbAddress db_find_token(dbToken token)
Find token.
#define DB_RECV_TOKEN(x)
Definition: macros.h:99
int dbToken
Definition: dbmi.h:145
#define NULL
Definition: ccmath.h:32
int db_d_update(void)
?
Definition: d_update.c:25
#define DB_SEND_FAILURE()
Definition: macros.h:9
int(* db_driver_update)(dbCursor *)
#define DB_FAILED
Definition: dbmi.h:72
#define DB_RECV_TABLE_DATA(x)
Definition: macros.h:69
#define DB_SEND_SUCCESS()
Definition: macros.h:7
int db_test_cursor_any_column_flag(dbCursor *cursor)
Checks columns&#39; flag.
Definition: cursor.c:414
dbTable * table
Definition: dbmi.h:234
int db_test_cursor_type_update(dbCursor *cursor)
Check if cursor type is &#39;update&#39;.
Definition: cursor.c:159
void db_error(const char *s)
Report error message.
#define DB_OK
Definition: dbmi.h:71