d_create_idx.c 988 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*!
  2. * \file db/dbmi_driver/d_create_idx.c
  3. *
  4. * \brief DBMI Library (driver) - create index
  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 Create index
  20. \return DB_OK on success
  21. \return DB_FAILED on failure
  22. */
  23. int db_d_create_index(void)
  24. {
  25. dbIndex index;
  26. int stat;
  27. /* get the arg(s) */
  28. db_init_index(&index);
  29. DB_RECV_INDEX(&index);
  30. /* call the procedure */
  31. stat = db_driver_create_index(&index);
  32. /* send the return code */
  33. if (stat != DB_OK) {
  34. db_free_index(&index);
  35. DB_SEND_FAILURE();
  36. return DB_OK;
  37. }
  38. DB_SEND_SUCCESS();
  39. /* send results */
  40. DB_SEND_STRING(&index.indexName);
  41. db_free_index(&index);
  42. return DB_OK;
  43. }