d_list_idx.c 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*!
  2. * \file db/dbmi_driver/d_list_idx.c
  3. *
  4. * \brief DBMI Library (driver) - 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 <stdlib.h>
  15. #include <grass/dbmi.h>
  16. #include "macros.h"
  17. #include "dbstubs.h"
  18. /*!
  19. \brief List indexes
  20. \return DB_OK on success
  21. \return DB_FAILED on failure
  22. */
  23. int db_d_list_indexes(void)
  24. {
  25. dbIndex *list;
  26. dbString table_name;
  27. int count;
  28. int stat;
  29. /* arg(s) */
  30. db_init_string(&table_name);
  31. DB_RECV_STRING(&table_name);
  32. /* call the procedure */
  33. stat = db_driver_list_indexes(&table_name, &list, &count);
  34. db_free_string(&table_name);
  35. /* send the return code */
  36. if (stat != DB_OK) {
  37. DB_SEND_FAILURE();
  38. return DB_OK;
  39. }
  40. DB_SEND_SUCCESS();
  41. /* send results */
  42. DB_SEND_INDEX_ARRAY(list, count);
  43. db_free_index_array(list, count);
  44. return DB_OK;
  45. }