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 */
db_gversion(dbDriver * driver,dbString * client_version,dbString * driver_version)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 }
60