GRASS GIS 8 Programmer's Manual  8.5.0dev(2024)-d6dec75dd4
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  */
44  dbColumn *column)
45 {
46  dbValue *value;
47  int sqltype;
48 
49  sqltype = db_get_column_sqltype(column);
50  value = db_get_column_default_value(column);
51  return db_convert_Cstring_to_value(Cstring, sqltype, value);
52 }
53 
54 /*!
55  \brief ?
56 
57  \param column pointer to dbColumn
58  \param string pointer to dbString
59 
60  \return ?
61  */
63 {
64  int sqltype;
65  dbValue *value;
66 
67  sqltype = db_get_column_sqltype(column);
68  value = db_get_column_value(column);
69  return db_convert_value_to_string(value, sqltype, string);
70 }
71 
72 /*!
73  \brief ?
74 
75  \param column pointer to dbColumn
76  \param string pointer to dbString
77 
78  \return ?
79  */
81  dbString *string)
82 {
83  int sqltype;
84  dbValue *value;
85 
86  sqltype = db_get_column_sqltype(column);
87  value = db_get_column_default_value(column);
88  return db_convert_value_to_string(value, sqltype, string);
89 }
int db_convert_Cstring_to_column_value(const char *Cstring, dbColumn *column)
?
Definition: columnfmt.c:25
int db_convert_Cstring_to_column_default_value(const char *Cstring, dbColumn *column)
?
Definition: columnfmt.c:43
int db_convert_column_default_value_to_string(dbColumn *column, dbString *string)
?
Definition: columnfmt.c:80
int db_convert_column_value_to_string(dbColumn *column, dbString *string)
?
Definition: columnfmt.c:62
dbValue * db_get_column_value(dbColumn *)
Returns column value for given column structure.
int db_convert_value_to_string(dbValue *, int, dbString *)
Convert value to string.
Definition: valuefmt.c:68
int db_get_column_sqltype(dbColumn *)
Returns column sqltype for column.
int db_convert_Cstring_to_value(const char *, int, dbValue *)
Convert string to value.
Definition: valuefmt.c:31
dbValue * db_get_column_default_value(dbColumn *)
Returns column default value for given column structure.