ret_codes.c

Go to the documentation of this file.
00001 #include <stdlib.h>
00002 #include <grass/dbmi.h>
00003 #include "macros.h"
00004 
00005 int
00006 db__send_success()
00007 {
00008     DB_SEND_INT (DB_OK);
00009     return DB_OK;
00010 }
00011 
00012 int
00013 db__send_failure()
00014 {
00015     DB_SEND_INT (DB_FAILED);
00016     DB_SEND_C_STRING (db_get_error_msg());
00017     return DB_OK;
00018 }
00019 
00020 int
00021 db__recv_return_code  (int *ret_code)
00022 
00023 {
00024     dbString err_msg;
00025 
00026 /* get the return code first */
00027     DB_RECV_INT (ret_code);
00028 
00029 /* if OK, we're done here */
00030     if (*ret_code == DB_OK)
00031         return DB_OK;
00032 
00033 /* should be DB_FAILED */
00034     if (*ret_code != DB_FAILED)
00035     {
00036         db_protocol_error();
00037         return DB_PROTOCOL_ERR;
00038     }
00039 /* get error message from driver */
00040     db_init_string (&err_msg);
00041     DB_RECV_STRING (&err_msg);
00042 
00043     db_error(db_get_string(&err_msg));
00044     db_free_string (&err_msg);
00045 
00046     return DB_OK;
00047 }

Generated on Sun Apr 6 17:31:38 2008 for GRASS by  doxygen 1.5.5