GRASS GIS 8 Programmer's Manual  8.5.0dev(2024)-d6dec75dd4
c_version.c
Go to the documentation of this file.
1 /*!
2  * \file db/dbmi_client/c_version.c
3  *
4  * \brief DBMI Library (client) - version info
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 
18 /*!
19  \brief Get version info
20 
21  Note: renamed from db_version to db_gversion to avoid name conflict
22  with Berkeley DB etc.
23 
24  \param driver db driver
25  \param[out] client_version client version
26  \param[out] driver_version driver version
27 
28  \return DB_OK on success
29  \return DB_FAILED on failure
30  */
31 int db_gversion(dbDriver *driver, dbString *client_version,
32  dbString *driver_version)
33 {
34  int ret_code;
35 
36  /* initialize the strings */
37  db_init_string(client_version);
38  db_init_string(driver_version);
39 
40  /* set client version from DB_VERSION */
41  db_set_string(client_version, DB_VERSION);
42 
43  /* start the procedure call */
44  db__set_protocol_fds(driver->send, driver->recv);
46 
47  /* no arguments */
48 
49  /* get the return code for the procedure call */
50  DB_RECV_RETURN_CODE(&ret_code);
51 
52  if (ret_code != DB_OK)
53  return ret_code; /* ret_code SHOULD == DB_FAILED */
54 
55  /* get the driver version */
56  DB_RECV_STRING(driver_version);
57 
58  return DB_OK;
59 }
int db_gversion(dbDriver *driver, dbString *client_version, dbString *driver_version)
Get version info.
Definition: c_version.c:31
#define DB_VERSION
Definition: dbmi.h:18
#define DB_PROC_VERSION
Definition: dbmi.h:27
#define DB_OK
Definition: dbmi.h:71
int db_set_string(dbString *, const char *)
Inserts string to dbString (enlarge string)
Definition: string.c:41
void db__set_protocol_fds(FILE *, FILE *)
?
void db_init_string(dbString *)
Initialize dbString.
Definition: string.c:25
#define DB_RECV_STRING(x)
Definition: macros.h:39
#define DB_START_PROCEDURE_CALL(x)
Definition: macros.h:2
#define DB_RECV_RETURN_CODE(x)
Definition: macros.h:7
Definition: driver.h:21