GRASS Programmer's Manual
6.4.2(2012)
Main Page
Related Pages
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Pages
ret_codes.c
Go to the documentation of this file.
1
#include <stdlib.h>
2
#include <grass/dbmi.h>
3
#include "
macros.h
"
4
5
int
db__send_success
()
6
{
7
DB_SEND_INT
(DB_OK);
8
return
DB_OK;
9
}
10
11
int
db__send_failure
()
12
{
13
DB_SEND_INT
(DB_FAILED);
14
DB_SEND_C_STRING
(
db_get_error_msg
());
15
return
DB_OK;
16
}
17
18
int
db__recv_return_code
(
int
*ret_code)
19
{
20
dbString err_msg;
21
22
/* get the return code first */
23
DB_RECV_INT
(ret_code);
24
25
/* if OK, we're done here */
26
if
(*ret_code == DB_OK)
27
return
DB_OK;
28
29
/* should be DB_FAILED */
30
if
(*ret_code != DB_FAILED) {
31
db_protocol_error
();
32
return
DB_PROTOCOL_ERR;
33
}
34
/* get error message from driver */
35
db_init_string
(&err_msg);
36
DB_RECV_STRING
(&err_msg);
37
38
db_error
(
db_get_string
(&err_msg));
39
db_free_string
(&err_msg);
40
41
return
DB_OK;
42
}
lib
db
dbmi_base
ret_codes.c
Generated on Sun Mar 16 2014 05:07:48 for GRASS Programmer's Manual by
1.8.1.2