xdrvalue.c

Go to the documentation of this file.
00001 #include <grass/dbmi.h>
00002 #include "macros.h"
00003 
00004 int db__send_value(dbValue * value, int Ctype)
00005 {
00006     DB_SEND_CHAR(value->isNull);
00007     if (value->isNull)
00008         return DB_OK;
00009 
00010     switch (Ctype) {
00011     case DB_C_TYPE_INT:
00012         DB_SEND_INT(value->i);
00013         break;
00014     case DB_C_TYPE_DOUBLE:
00015         DB_SEND_DOUBLE(value->d);
00016         break;
00017     case DB_C_TYPE_STRING:
00018         DB_SEND_STRING(&value->s);
00019         break;
00020     case DB_C_TYPE_DATETIME:
00021         DB_SEND_DATETIME(&value->t);
00022         break;
00023     default:
00024         db_error("send data: invalid C-type");
00025         return DB_FAILED;
00026     }
00027     return DB_OK;
00028 }
00029 
00030 int db__recv_value(dbValue * value, int Ctype)
00031 {
00032     DB_RECV_CHAR(&value->isNull);
00033     if (value->isNull)
00034         return DB_OK;
00035 
00036     switch (Ctype) {
00037     case DB_C_TYPE_INT:
00038         DB_RECV_INT(&value->i);
00039         break;
00040     case DB_C_TYPE_DOUBLE:
00041         DB_RECV_DOUBLE(&value->d);
00042         break;
00043     case DB_C_TYPE_STRING:
00044         DB_RECV_STRING(&value->s);
00045         break;
00046     case DB_C_TYPE_DATETIME:
00047         DB_RECV_DATETIME(&value->t);
00048         break;
00049     default:
00050         db_error("send data: invalid C-type");
00051         return DB_FAILED;
00052     }
00053     return DB_OK;
00054 }

Generated on Sat Oct 24 03:24:24 2009 for GRASS Programmer's Manual by  doxygen 1.6.1