listtab.c 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*****************************************************************************
  2. *
  3. * MODULE: DBF driver
  4. *
  5. * AUTHOR(S): Radim Blazek
  6. *
  7. * PURPOSE: Simple driver for reading and writing dbf files
  8. *
  9. * COPYRIGHT: (C) 2000 by the GRASS Development Team
  10. *
  11. * This program is free software under the GNU General Public
  12. * License (>=v2). Read the file COPYING that comes with GRASS
  13. * for details.
  14. *
  15. *****************************************************************************/
  16. #include <grass/dbmi.h>
  17. #include "globals.h"
  18. #include "proto.h"
  19. int db__driver_list_tables(dbString ** tlist, int *tcount, int system)
  20. {
  21. dbString *list;
  22. int i;
  23. *tlist = NULL;
  24. *tcount = 0;
  25. list = db_alloc_string_array(db.ntables);
  26. if (list == NULL && db.ntables > 0)
  27. return DB_FAILED;
  28. for (i = 0; i < db.ntables; i++) {
  29. if (db_set_string(&list[i], (char *)db.tables[i].name) != DB_OK) {
  30. return DB_FAILED;
  31. }
  32. }
  33. *tlist = list;
  34. *tcount = db.ntables;
  35. return DB_OK;
  36. }