d_list_tabs.c 963 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*!
  2. * \file db/dbmi_driver/d_list_tabs.c
  3. *
  4. * \brief DBMI Library (driver) - list tables
  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. #include "dbstubs.h"
  17. /*!
  18. \brief List available tables for given connection
  19. \return DB_OK on success
  20. \return DB_FAILED on failure
  21. */
  22. int db_d_list_tables(void)
  23. {
  24. dbString *names;
  25. int count;
  26. int system;
  27. int stat;
  28. /* arg(s) */
  29. DB_RECV_INT(&system);
  30. /* call the procedure */
  31. stat = db_driver_list_tables(&names, &count, system);
  32. /* send the return code */
  33. if (stat != DB_OK) {
  34. DB_SEND_FAILURE();
  35. return DB_OK;
  36. }
  37. DB_SEND_SUCCESS();
  38. /* send results */
  39. DB_SEND_STRING_ARRAY(names, count);
  40. return DB_OK;
  41. }