GRASS GIS 7 Programmer's Manual  7.9.dev(2021)-e5379bbd7
columnfmt.c
Go to the documentation of this file.
1 /*!
2  \file lib/db/dbmi_base/columnfmt.c
3 
4  \brief DBMI Library (base) - columns formatting
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
12  \author Doxygenized by Martin Landa <landa.martin gmail.com> (2011)
13 */
14 
15 #include <grass/dbmi.h>
16 
17 /*!
18  \brief ?
19 
20  \param Cstring string buffer
21  \param column pointer to dbColumn
22 
23  \return ?
24 */
25 int db_convert_Cstring_to_column_value(const char *Cstring, dbColumn *column)
26 {
27  dbValue *value;
28  int sqltype;
29 
30  sqltype = db_get_column_sqltype(column);
31  value = db_get_column_value(column);
32  return db_convert_Cstring_to_value(Cstring, sqltype, value);
33 }
34 
35 /*!
36  \brief ?
37 
38  \param Cstring string buffer
39  \param column pointer to dbColumn
40 
41  \return ?
42 */
43 int db_convert_Cstring_to_column_default_value(const char *Cstring, dbColumn *column)
44 {
45  dbValue *value;
46  int sqltype;
47 
48  sqltype = db_get_column_sqltype(column);
49  value = db_get_column_default_value(column);
50  return db_convert_Cstring_to_value(Cstring, sqltype, value);
51 }
52 
53 /*!
54  \brief ?
55 
56  \param column pointer to dbColumn
57  \param string pointer to dbString
58 
59  \return ?
60 */
62 {
63  int sqltype;
64  dbValue *value;
65 
66  sqltype = db_get_column_sqltype(column);
67  value = db_get_column_value(column);
68  return db_convert_value_to_string(value, sqltype, string);
69 }
70 
71 /*!
72  \brief ?
73 
74  \param column pointer to dbColumn
75  \param string pointer to dbString
76 
77  \return ?
78 */
80 {
81  int sqltype;
82  dbValue *value;
83 
84  sqltype = db_get_column_sqltype(column);
85  value = db_get_column_default_value(column);
86  return db_convert_value_to_string(value, sqltype, string);
87 }
dbValue * db_get_column_default_value(dbColumn *)
Returns column default value for given column structure.
int db_convert_Cstring_to_column_value(const char *Cstring, dbColumn *column)
?
Definition: columnfmt.c:25
dbValue * db_get_column_value(dbColumn *)
Returns column value for given column structure.
int db_convert_Cstring_to_value(const char *, int, dbValue *)
Convert string to value.
Definition: valuefmt.c:31
int db_convert_Cstring_to_column_default_value(const char *Cstring, dbColumn *column)
?
Definition: columnfmt.c:43
int db_convert_column_value_to_string(dbColumn *column, dbString *string)
?
Definition: columnfmt.c:61
int db_get_column_sqltype(dbColumn *)
Returns column sqltype for column.
int db_convert_column_default_value_to_string(dbColumn *column, dbString *string)
?
Definition: columnfmt.c:79
int db_convert_value_to_string(dbValue *, int, dbString *)
Convert value to string.
Definition: valuefmt.c:67