d_priv.c 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*!
  2. * \file db/dbmi_driver/d_priv.c
  3. *
  4. * \brief DBMI Library (driver) - privileges management
  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 Grant privileges on table
  20. \return DB_OK on success
  21. \return DB_FAILED on failure
  22. */
  23. int db_d_grant_on_table(void)
  24. {
  25. dbString tableName;
  26. int priv, to;
  27. int stat;
  28. db_init_string(&tableName);
  29. /* get the arg(s) */
  30. DB_RECV_STRING(&tableName);
  31. DB_RECV_INT(&priv);
  32. DB_RECV_INT(&to);
  33. /* call the procedure */
  34. stat = db_driver_grant_on_table(&tableName, priv, to);
  35. db_free_string(&tableName);
  36. /* send the return code */
  37. if (stat != DB_OK) {
  38. DB_SEND_FAILURE();
  39. return DB_OK;
  40. }
  41. DB_SEND_SUCCESS();
  42. /* no results */
  43. return DB_OK;
  44. }