c_version.c 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. #include <grass/dbmi.h>
  15. #include "macros.h"
  16. /*!
  17. \brief Get version info
  18. Note: renamed from db_version to db_gversion to avoid name conflict
  19. with Berkeley DB etc.
  20. \param driver db driver
  21. \param[out] client_version client version
  22. \param[out] driver_version driver version
  23. \return DB_OK on success
  24. \return DB_FAILED on failure
  25. */
  26. int db_gversion(dbDriver * driver, dbString * client_version,
  27. dbString * driver_version)
  28. {
  29. int ret_code;
  30. /* initialize the strings */
  31. db_init_string(client_version);
  32. db_init_string(driver_version);
  33. /* set client version from DB_VERSION */
  34. db_set_string(client_version, DB_VERSION);
  35. /* start the procedure call */
  36. db__set_protocol_fds(driver->send, driver->recv);
  37. DB_START_PROCEDURE_CALL(DB_PROC_VERSION);
  38. /* no arguments */
  39. /* get the return code for the procedure call */
  40. DB_RECV_RETURN_CODE(&ret_code);
  41. if (ret_code != DB_OK)
  42. return ret_code; /* ret_code SHOULD == DB_FAILED */
  43. /* get the driver version */
  44. DB_RECV_STRING(driver_version);
  45. return DB_OK;
  46. }