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