c_createdb.c 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*!
  2. * \file db/dbmi_client/c_createdb.c
  3. *
  4. * \brief DBMI Library (client) - create database
  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 Create database
  18. \param driver db driver
  19. \param handle handle
  20. \return DB_OK on success
  21. \return DB_FAILED on failure
  22. */
  23. int db_create_database(dbDriver * driver, dbHandle * handle)
  24. {
  25. int ret_code;
  26. /* start the procedure call */
  27. db__set_protocol_fds(driver->send, driver->recv);
  28. DB_START_PROCEDURE_CALL(DB_PROC_CREATE_DATABASE);
  29. /* send the arguments to the procedure */
  30. DB_SEND_HANDLE(handle);
  31. /* get the return code for the procedure call */
  32. DB_RECV_RETURN_CODE(&ret_code);
  33. if (ret_code != DB_OK)
  34. return ret_code; /* ret_code SHOULD == DB_FAILED */
  35. /* no results */
  36. return DB_OK;
  37. }