GRASS GIS 7 Programmer's Manual  7.9.dev(2021)-e5379bbd7
xdrcolumn.c
Go to the documentation of this file.
1 /*!
2  \file lib/db/dbmi_base/xdrcolumn.c
3 
4  \brief DBMI Library (base) - external data representation (column)
5 
6  (C) 1999-2009, 2011 by the GRASS Development Team
7 
8  This program is free software under the GNU General Public License
9  (>=v2). Read the file COPYING that comes with GRASS for details.
10 
11  \author Joel Jones (CERL/UIUC), Radim Blazek, Brad Douglas, Markus Neteler
12  \author Doxygenized by Martin Landa <landa.martin gmail.com> (2011)
13 */
14 
15 #include <grass/dbmi.h>
16 #include "macros.h"
17 
18 /*!
19  \brief Send column definition
20 
21  \param column pointer to dbColumn
22 
23  \return DB_OK
24 */
26 {
27  DB_SEND_STRING(&column->columnName);
28  DB_SEND_STRING(&column->description);
29  DB_SEND_INT(column->sqlDataType);
30  DB_SEND_INT(column->hostDataType);
31  DB_SEND_INT(column->precision);
32  DB_SEND_INT(column->scale);
33  DB_SEND_INT(column->dataLen);
34  DB_SEND_INT(column->select);
35  DB_SEND_INT(column->update);
36  DB_SEND_CHAR(column->nullAllowed);
39  if (column->hasDefaultValue) {
41  }
42 
43  return DB_OK;
44 }
45 
46 /*!
47  \brief Receive column definition
48 
49  \param column pointer to dbColumn
50 
51  \return DB_OK
52 */
54 {
55  DB_RECV_STRING(&column->columnName);
56  DB_RECV_STRING(&column->description);
57  DB_RECV_INT(&column->sqlDataType);
58  DB_RECV_INT(&column->hostDataType);
59  DB_RECV_INT(&column->precision);
60  DB_RECV_INT(&column->scale);
61  DB_RECV_INT(&column->dataLen);
62  DB_RECV_INT(&column->select);
63  DB_RECV_INT(&column->update);
64  DB_RECV_CHAR(&column->nullAllowed);
65  DB_RECV_CHAR(&column->useDefaultValue);
66  DB_RECV_CHAR(&column->hasDefaultValue);
67  if (column->hasDefaultValue) {
69  }
70 
71  return DB_OK;
72 }
73 
74 /*!
75  \brief Send column value
76 
77  \param column pointer to dbColumn
78 
79  \return
80 */
82 {
83  return db__send_value(db_get_column_value(column),
85 }
86 
87 /*!
88  \brief Receive column value
89 
90  \param column pointer to dbColumn
91 
92  \return
93 */
95 {
96  return db__recv_value(db_get_column_value(column),
98 }
99 
100 /*!
101  \brief Send column default value
102 
103  \param column pointer to dbColumn
104 
105  \return
106 */
108 {
111 }
112 
113 /*!
114  \brief Receive column default value
115 
116  \param column pointer to dbColumn
117 
118  \return
119 */
121 {
124 }
dbValue * db_get_column_default_value(dbColumn *)
Returns column default value for given column structure.
int hostDataType
Definition: dbmi.h:207
#define DB_SEND_CHAR(x)
Definition: macros.h:23
dbValue * db_get_column_value(dbColumn *)
Returns column value for given column structure.
#define DB_SEND_INT(x)
Definition: macros.h:37
#define DB_RECV_INT(x)
Definition: macros.h:39
int db__recv_column_default_value(dbColumn *column)
Receive column default value.
Definition: xdrcolumn.c:120
dbString columnName
Definition: dbmi.h:204
char hasDefaultValue
Definition: dbmi.h:213
int scale
Definition: dbmi.h:211
#define DB_RECV_COLUMN_DEFAULT_VALUE(x)
Definition: macros.h:94
int select
Definition: dbmi.h:216
int db_get_column_sqltype(dbColumn *)
Returns column sqltype for column.
int db__recv_column_definition(dbColumn *column)
Receive column definition.
Definition: xdrcolumn.c:53
#define DB_RECV_CHAR(x)
Definition: macros.h:25
int db__recv_column_value(dbColumn *column)
Receive column value.
Definition: xdrcolumn.c:94
int db_sqltype_to_Ctype(int)
Get C data type based on given SQL data type.
Definition: sqlCtype.c:24
#define DB_SEND_STRING(x)
Definition: macros.h:12
dbString description
Definition: dbmi.h:205
int db__send_column_value(dbColumn *column)
Send column value.
Definition: xdrcolumn.c:81
int dataLen
Definition: dbmi.h:209
int db__recv_value(dbValue *, int)
Receive value.
Definition: xdrvalue.c:62
char useDefaultValue
Definition: dbmi.h:214
int precision
Definition: dbmi.h:210
#define DB_SEND_COLUMN_DEFAULT_VALUE(x)
Definition: macros.h:92
int db__send_value(dbValue *, int)
Send value.
Definition: xdrvalue.c:28
int update
Definition: dbmi.h:217
int db__send_column_definition(dbColumn *column)
Send column definition.
Definition: xdrcolumn.c:25
int sqlDataType
Definition: dbmi.h:206
int db__send_column_default_value(dbColumn *column)
Send column default value.
Definition: xdrcolumn.c:107
#define DB_RECV_STRING(x)
Definition: macros.h:18
char nullAllowed
Definition: dbmi.h:212
#define DB_OK
Definition: dbmi.h:71