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
xdrvalue.c
Go to the documentation of this file.
1
#include <grass/dbmi.h>
2
#include "
macros.h
"
3
4
int
db__send_value
(dbValue * value,
int
Ctype)
5
{
6
DB_SEND_CHAR
(value->isNull);
7
if
(value->isNull)
8
return
DB_OK;
9
10
switch
(Ctype) {
11
case
DB_C_TYPE_INT:
12
DB_SEND_INT
(value->i);
13
break
;
14
case
DB_C_TYPE_DOUBLE:
15
DB_SEND_DOUBLE
(value->d);
16
break
;
17
case
DB_C_TYPE_STRING:
18
DB_SEND_STRING
(&value->s);
19
break
;
20
case
DB_C_TYPE_DATETIME:
21
DB_SEND_DATETIME
(&value->t);
22
break
;
23
default
:
24
db_error
(
"send data: invalid C-type"
);
25
return
DB_FAILED;
26
}
27
return
DB_OK;
28
}
29
30
int
db__recv_value
(dbValue * value,
int
Ctype)
31
{
32
DB_RECV_CHAR
(&value->isNull);
33
if
(value->isNull)
34
return
DB_OK;
35
36
switch
(Ctype) {
37
case
DB_C_TYPE_INT:
38
DB_RECV_INT
(&value->i);
39
break
;
40
case
DB_C_TYPE_DOUBLE:
41
DB_RECV_DOUBLE
(&value->d);
42
break
;
43
case
DB_C_TYPE_STRING:
44
DB_RECV_STRING
(&value->s);
45
break
;
46
case
DB_C_TYPE_DATETIME:
47
DB_RECV_DATETIME
(&value->t);
48
break
;
49
default
:
50
db_error
(
"send data: invalid C-type"
);
51
return
DB_FAILED;
52
}
53
return
DB_OK;
54
}
lib
db
dbmi_base
xdrvalue.c
Generated on Wed Jun 6 2012 14:04:30 for GRASS Programmer's Manual by
1.8.1