GRASS 8 Programmer's Manual 8.6.0dev(2026)-1d1e47ad9d
Loading...
Searching...
No Matches
sqlCtype.c
Go to the documentation of this file.
1/*!
2 \file lib/db/dbmi_base/sqlCtype.c
3
4 \brief DBMI Library (base) - SQL data type to C data type
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 Get C data type based on given SQL data type
19
20 \param sqltype SQL data type
21
22 \return related C data type
23 */
25{
26 switch (sqltype) {
28 return DB_C_TYPE_INT;
30 return DB_C_TYPE_INT;
32 return DB_C_TYPE_DOUBLE;
34 return DB_C_TYPE_DOUBLE;
36 return DB_C_TYPE_INT;
37 }
38
39 switch (sqltype & ~DB_DATETIME_MASK) {
44 return DB_C_TYPE_DATETIME;
45 }
46
47 return DB_C_TYPE_STRING;
48}
Main header of GRASS DataBase Management Interface.
#define DB_SQL_TYPE_TIME
Definition dbmi.h:89
#define DB_SQL_TYPE_INTEGER
Definition dbmi.h:83
#define DB_SQL_TYPE_SMALLINT
Definition dbmi.h:82
#define DB_DATETIME_MASK
Definition dbmi.h:104
#define DB_SQL_TYPE_INTERVAL
Definition dbmi.h:91
#define DB_C_TYPE_INT
Definition dbmi.h:108
#define DB_SQL_TYPE_REAL
Definition dbmi.h:84
#define DB_SQL_TYPE_DOUBLE_PRECISION
Definition dbmi.h:85
#define DB_C_TYPE_STRING
Definition dbmi.h:107
#define DB_SQL_TYPE_DATE
Definition dbmi.h:88
#define DB_C_TYPE_DOUBLE
Definition dbmi.h:109
#define DB_SQL_TYPE_SERIAL
Definition dbmi.h:94
#define DB_C_TYPE_DATETIME
Definition dbmi.h:110
#define DB_SQL_TYPE_TIMESTAMP
Definition dbmi.h:90
int db_sqltype_to_Ctype(int sqltype)
Get C data type based on given SQL data type.
Definition sqlCtype.c:24