GRASS GIS 7 Programmer's Manual  7.9.dev(2021)-e5379bbd7
d_bindupdate.c
Go to the documentation of this file.
1 /*!
2  * \file db/dbmi_driver/d_bindupdate.c
3  *
4  * \brief DBMI Library (driver) - bind update
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 ADD
21 
22  \return DB_OK on success
23  \return DB_FAILED on failure
24  */
26 {
27  dbToken token;
28  dbCursor *cursor;
29  int stat;
30  int ncols;
31 
32  /* get the arg(s) */
33  DB_RECV_TOKEN(&token);
34  cursor = (dbCursor *) db_find_token(token);
35  if (cursor == NULL || !db_test_cursor_type_update(cursor)) {
36  db_error("** not an update cursor **");
38  return DB_FAILED;
39  }
40  DB_RECV_SHORT_ARRAY(&cursor->column_flags, &ncols);
41  if (!db_test_cursor_any_column_flag(cursor)) {
42  db_error("** no columns set in cursor for binding **");
44  return DB_FAILED;
45  }
46 
47  /* call the procedure */
48  stat = db_driver_bind_update(cursor);
49 
50  /* send the return code */
51  if (stat != DB_OK) {
53  return DB_OK;
54  }
56 
57  /* no results */
58  return DB_OK;
59 }
#define DB_RECV_TOKEN(x)
Definition: macros.h:99
int db_d_bind_update()
ADD.
Definition: d_bindupdate.c:25
int dbToken
Definition: dbmi.h:145
#define NULL
Definition: ccmath.h:32
int db_test_cursor_any_column_flag(dbCursor *)
Checks columns&#39; flag.
Definition: cursor.c:414
#define DB_SEND_FAILURE()
Definition: macros.h:9
short * column_flags
Definition: dbmi.h:235
void db_error(const char *)
Report error message.
dbAddress db_find_token(dbToken)
Find token.
#define DB_FAILED
Definition: dbmi.h:72
#define DB_RECV_SHORT_ARRAY(x, n)
Definition: macros.h:34
int(* db_driver_bind_update)(dbCursor *)
int db_test_cursor_type_update(dbCursor *)
Check if cursor type is &#39;update&#39;.
Definition: cursor.c:159
#define DB_SEND_SUCCESS()
Definition: macros.h:7
#define DB_OK
Definition: dbmi.h:71