c_drop_tab.c 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*!
  2. \file db/dbmi_client/c_drop_tab.c
  3. \brief DBMI Library (client) - drop table
  4. (C) 1999-2008, 2011 by the GRASS Development Team
  5. This program is free software under the GNU General Public
  6. License (>=v2). Read the file COPYING that comes with GRASS
  7. for details.
  8. \author Joel Jones (CERL/UIUC)
  9. \author Radim Blazek
  10. */
  11. #include <grass/dbmi.h>
  12. #include "macros.h"
  13. /*!
  14. \brief Drop table
  15. \param driver db driver
  16. \param name table name to be dropped
  17. \return DB_OK on success
  18. \return DB_FAILED on failure
  19. */
  20. int db_drop_table(dbDriver * driver, dbString * name)
  21. {
  22. int ret_code;
  23. /* start the procedure call */
  24. db__set_protocol_fds(driver->send, driver->recv);
  25. DB_START_PROCEDURE_CALL(DB_PROC_DROP_TABLE);
  26. /* send the argument(s) to the procedure */
  27. DB_SEND_STRING(name);
  28. /* get the return code for the procedure call */
  29. DB_RECV_RETURN_CODE(&ret_code);
  30. if (ret_code != DB_OK)
  31. return ret_code; /* ret_code SHOULD == DB_FAILED */
  32. /* no results */
  33. return DB_OK;
  34. }