GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
c_version.c
Go to the documentation of this file.
1 
15 #include <grass/dbmi.h>
16 #include "macros.h"
17 
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);
45  DB_START_PROCEDURE_CALL(DB_PROC_VERSION);
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 }
void db__set_protocol_fds(FILE *send, FILE *recv)
Definition: xdr.c:71
#define DB_START_PROCEDURE_CALL(x)
Definition: macros.h:2
int db_gversion(dbDriver *driver, dbString *client_version, dbString *driver_version)
Get version info.
Definition: c_version.c:31
#define DB_RECV_RETURN_CODE(x)
Definition: macros.h:4
Definition: driver.h:25
int db_set_string(dbString *x, const char *s)
Definition: string.c:33
void db_init_string(dbString *x)
Definition: string.c:11
#define DB_RECV_STRING(x)
Definition: macros.h:18