Products Support Documentation Download
sqltypes.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Raima Database Manager *
3  * *
4  * Copyright (c) 2010 Raima Inc. All rights reserved. *
5  * *
6  * Use of this software, whether in source code format, or in executable, *
7  * binary object code form, is governed by the Raima Inc. LICENSE *
8  * which is fully described in the LICENSE.TXT file, included within this *
9  * distribution of files. *
10  **************************************************************************/
11 
16 #if !defined(SQLTYPES_H_INCLUDED_)
17 #define SQLTYPES_H_INCLUDED_
18 
19 #if !defined(ODBCVER)
20 #define ODBCVER 0x0351
21 #endif
22 
23 #include "rdmtypes.h"
24 
25 #if defined(RDM_WINDOWS) && defined(RDM_ODBC_DRV)
26 #define WIN32_LEAN_AND_MEAN
27 #include <windows.h>
28 #endif
29 
30 #if defined(RDM_WINDOWS) && !defined(_WINDOWS_)
31 typedef void *HANDLE;
32 #define DECLARE_HANDLE(name) struct name##__{int unused;}; typedef struct name##__ *name
33 DECLARE_HANDLE(HWND);
34 DECLARE_HANDLE(HINSTANCE);
35 #define _WINDOWS_
36 #endif
37 
38 #define SQL_API EXTERNAL_FCN
39 #define SQL_API_PTR EXTERNAL_FCN_PTR
40 
41 #if !defined(BOOL)
42 #define BOOL int32_t
43 #endif /* BOOL */
44 
45 typedef signed char SCHAR;
46 typedef SCHAR SQLSCHAR;
47 typedef uint8_t SQLCHAR;
48 typedef int16_t SQLSMALLINT;
49 typedef uint16_t SQLUSMALLINT;
50 typedef int32_t SQLINTEGER;
51 typedef uint32_t SQLUINTEGER;
52 typedef double SQLDOUBLE;
53 typedef double SQLFLOAT;
54 typedef uint8_t SQLNUMERIC;
55 typedef float SQLREAL;
56 typedef uint8_t SQLTIME;
57 typedef uint8_t SQLTIMESTAMP;
58 typedef uint8_t SQLVARCHAR;
59 typedef void * SQLPOINTER;
71 typedef int16_t SQLRETURN;
72 typedef wchar_t SQLWCHAR;
73 
74 #if defined(RDM_DOXYGEN)
75 #elif defined(_UNICODE)
76 typedef SQLWCHAR SQLTCHAR;
77 #else
78 typedef SQLCHAR SQLTCHAR;
79 #endif
80 
81 #if defined(RDM_64BIT)
82 typedef int64_t SQLLEN;
83 typedef uint64_t SQLULEN;
84 typedef uint64_t SQLSETPOSIROW;
85 #else
86 #define SQLLEN SQLINTEGER
87 #define SQLULEN SQLUINTEGER
88 #define SQLSETPOSIROW SQLUSMALLINT
89 #endif
90 
91 typedef SQLULEN BOOKMARK;
92 
93 typedef const void * SQLHANDLE;
94 #if !defined(RDM_DOXYGEN)
95 typedef const void * SQLHENV;
96 typedef const void * SQLHDBC;
97 typedef const void * SQLHSTMT;
98 typedef const void * SQLHDESC;
99 
100 /* define our own HWND if windows.h is not included already */
101 #if !defined(_WINDOWS_) && !defined(UNDER_CE)
102 typedef const void * HWND;
103 #endif
104 #endif
105 
106 typedef HWND SQLHWND;
107 
108 #if 0
109 /* SQL portable types for C */
110 typedef unsigned char UCHAR;
111 typedef long int SDWORD;
112 typedef int16_t SWORD;
113 typedef unsigned long int UDWORD;
114 typedef uint16_t UWORD;
115 
116 typedef signed long SLONG;
117 typedef int16_t SSHORT;
118 typedef unsigned long ULONG;
119 typedef uint16_t USHORT;
120 typedef double SDOUBLE;
121 typedef double LDOUBLE;
122 typedef float SFLOAT;
123 
124 typedef void *PTR;
125 
126 typedef void *HENV;
127 typedef void *HDBC;
128 /*typedef void *HSTMT; */
129 #endif
130 
131 typedef int16_t RETCODE;
132 
133 /* ----------------------------------------------------------------------------
134  standard structs for working with date/time
135 */
136 #if !defined(__SQLDATE)
137 #define __SQLDATE
138 
139 typedef struct tagDATE_STRUCT {
143 } DATE_STRUCT;
144 
146 
147 typedef struct tagTIME_STRUCT {
151 } TIME_STRUCT;
152 
154 
155 typedef struct tagTIMESTAMP_STRUCT {
164 
166 
167 typedef enum {
181 } SQLINTERVAL;
182 
183 typedef struct tagSQL_YEAR_MONTH {
187 
188 typedef struct tagSQL_DAY_SECOND {
195 
196 typedef struct tagSQL_INTERVAL_STRUCT {
199  union {
202  } intval;
204 
205 #endif /* __SQLDATE */
206 
207 /* ----------------------------------------------------------------------------
208  internal representation of numeric data types
209 */
210 #define SQL_MAX_NUMERIC_LEN 16
211 typedef struct tagSQL_NUMERIC_STRUCT {
214  SQLCHAR sign; /* 1 if positive, 0 if negative */
217 
218 /* ----------------------------------------------------------------------------
219  BIGINT definitions
220 */
221 #define ODBCINT64 int64_t
222 #define ODBCUINT64 uint64_t
225 
226 /* ----------------------------------------------------------------------------
227  GUID definition
228 */
229 #if defined(GUID)
230 typedef GUID SQLGUID
231 #else
232 typedef struct tagSQLGUID {
233  uint32_t Data1;
234  uint16_t Data2;
235  uint16_t Data3;
236  uint8_t Data4[8];
237 } SQLGUID;
238 #endif /* GUID */
239 
240 /* ----------------------------------------------------------------------------
241  OBDC function-related definitions
242 */
243 #if !defined(RDM_DOXYGEN)
244 #if !defined(RDM_WINDOWS) || defined(RDM_ODBC_DRV)
245 #define RDBC_EXPORT
246 #else
247 #define RDBC_EXPORT RDM_EXPORT
248 #endif
249 #endif
250 
251 #endif /* SQLTYPES_H_INCLUDED_ */
252 
HWND SQLHWND
Definition: sqltypes.h:106
uint8_t SQLTIME
Definition: sqltypes.h:56
#define ODBCUINT64
Definition: sqltypes.h:222
SQLUSMALLINT second
Definition: sqltypes.h:161
SQLUINTEGER hour
Definition: sqltypes.h:190
uint16_t Data3
Definition: sqltypes.h:235
int32_t SQLINTEGER
Definition: sqltypes.h:50
SQLUSMALLINT second
Definition: sqltypes.h:150
#define ODBCINT64
Definition: sqltypes.h:221
SQLUSMALLINT hour
Definition: sqltypes.h:148
Header for the native RDM Runtime types.
uint8_t SQLVARCHAR
Definition: sqltypes.h:58
struct tagSQL_DAY_SECOND SQL_DAY_SECOND_STRUCT
TIMESTAMP_STRUCT SQL_TIMESTAMP_STRUCT
Definition: sqltypes.h:165
DATE_STRUCT SQL_DATE_STRUCT
Definition: sqltypes.h:145
SQL_YEAR_MONTH_STRUCT year_month
Definition: sqltypes.h:200
int16_t RETCODE
Definition: sqltypes.h:131
uint32_t Data1
Definition: sqltypes.h:233
int64_t SQLBIGINT
Definition: sqltypes.h:223
struct tagTIMESTAMP_STRUCT TIMESTAMP_STRUCT
float SQLREAL
Definition: sqltypes.h:55
uint32_t SQLUINTEGER
Definition: sqltypes.h:51
SQLUSMALLINT day
Definition: sqltypes.h:142
SQLSMALLINT interval_sign
Definition: sqltypes.h:198
SQLSMALLINT year
Definition: sqltypes.h:156
SQLUSMALLINT month
Definition: sqltypes.h:157
SQLUINTEGER year
Definition: sqltypes.h:184
double SQLFLOAT
Definition: sqltypes.h:53
uint8_t SQLTIMESTAMP
Definition: sqltypes.h:57
wchar_t SQLWCHAR
Definition: sqltypes.h:72
SQLUINTEGER minute
Definition: sqltypes.h:191
uint16_t Data2
Definition: sqltypes.h:234
struct tagTIME_STRUCT TIME_STRUCT
SQLINTERVAL
Definition: sqltypes.h:167
SCHAR SQLSCHAR
Definition: sqltypes.h:46
SQLUINTEGER fraction
Definition: sqltypes.h:193
SQLUSMALLINT month
Definition: sqltypes.h:141
int16_t SQLRETURN
SQL API Return Codes.
Definition: sqltypes.h:71
signed char SCHAR
Definition: sqltypes.h:45
SQLINTERVAL interval_type
Definition: sqltypes.h:197
SQLUSMALLINT minute
Definition: sqltypes.h:160
uint8_t SQLCHAR
Definition: sqltypes.h:47
const void * SQLHANDLE
Definition: sqltypes.h:93
struct tagSQL_INTERVAL_STRUCT SQL_INTERVAL_STRUCT
struct tagSQL_YEAR_MONTH SQL_YEAR_MONTH_STRUCT
void * SQLPOINTER
Definition: sqltypes.h:59
struct tagSQLGUID SQLGUID
SQLUINTEGER fraction
Definition: sqltypes.h:162
uint16_t SQLUSMALLINT
Definition: sqltypes.h:49
#define SQL_MAX_NUMERIC_LEN
Definition: sqltypes.h:210
#define SQLULEN
Definition: sqltypes.h:87
struct tagDATE_STRUCT DATE_STRUCT
SQLUSMALLINT minute
Definition: sqltypes.h:149
TIME_STRUCT SQL_TIME_STRUCT
Definition: sqltypes.h:153
struct tagSQL_NUMERIC_STRUCT SQL_NUMERIC_STRUCT
SQLUSMALLINT day
Definition: sqltypes.h:158
double SQLDOUBLE
Definition: sqltypes.h:52
#define SQLSETPOSIROW
Definition: sqltypes.h:88
SQLUSMALLINT hour
Definition: sqltypes.h:159
SQLSMALLINT year
Definition: sqltypes.h:140
SQL_DAY_SECOND_STRUCT day_second
Definition: sqltypes.h:201
uint64_t SQLUBIGINT
Definition: sqltypes.h:224
#define SQLLEN
Definition: sqltypes.h:86
SQLUINTEGER BOOKMARK
Definition: sqltypes.h:91
uint8_t SQLNUMERIC
Definition: sqltypes.h:54
int16_t SQLSMALLINT
Definition: sqltypes.h:48
SQLUINTEGER day
Definition: sqltypes.h:189
SQLUINTEGER second
Definition: sqltypes.h:192
SQLUINTEGER month
Definition: sqltypes.h:185