GRASS Programmer's Manual  6.4.2(2012)
 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 }