c_list_idx.c 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*!
  2. * \file db/dbmi_client/c_list_idx.c
  3. *
  4. * \brief DBMI Library (client) - list indexes
  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 List indexes
  18. \param driver db driver
  19. \param table_name table name
  20. \param[out] list list of db indexes
  21. \param[out] dbDriver number of items in the list
  22. \return DB_OK on success
  23. \return DB_FAILED on failure
  24. */
  25. int db_list_indexes(dbDriver * driver, dbString * table_name, dbIndex ** list,
  26. int *count)
  27. {
  28. int ret_code;
  29. /* start the procedure call */
  30. db__set_protocol_fds(driver->send, driver->recv);
  31. DB_START_PROCEDURE_CALL(DB_PROC_LIST_INDEXES);
  32. /* arguments */
  33. DB_SEND_STRING(table_name);
  34. /* get the return code for the procedure call */
  35. DB_RECV_RETURN_CODE(&ret_code);
  36. if (ret_code != DB_OK)
  37. return ret_code; /* ret_code SHOULD == DB_FAILED */
  38. /* results */
  39. DB_RECV_INDEX_ARRAY(list, count);
  40. return DB_OK;
  41. }