c_drop_col.c 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*!
  2. * \file db/dbmi_client/c_drop_col.c
  3. *
  4. * \brief DBMI Library (client) - drop column
  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 Drop column
  18. \param driver db driver
  19. \param tableName table name
  20. \param columnName column name to be dropped
  21. \return DB_OK on success
  22. \return DB_FAILED on failure
  23. */
  24. int db_drop_column(dbDriver * driver, dbString * tableName, dbString * columnName)
  25. {
  26. int ret_code;
  27. /* start the procedure call */
  28. db__set_protocol_fds(driver->send, driver->recv);
  29. DB_START_PROCEDURE_CALL(DB_PROC_DROP_COLUMN);
  30. /* send the argument(s) to the procedure */
  31. DB_SEND_STRING(tableName);
  32. DB_SEND_STRING(columnName);
  33. /* get the return code for the procedure call */
  34. DB_RECV_RETURN_CODE(&ret_code);
  35. if (ret_code != DB_OK)
  36. return ret_code; /* ret_code SHOULD == DB_FAILED */
  37. /* no results */
  38. return DB_OK;
  39. }