forked from FirebirdSQL/firebird-odbc-driver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
OdbcConvert.h
309 lines (272 loc) · 13.9 KB
/
OdbcConvert.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
/*
*
* The contents of this file are subject to the Initial
* Developer's Public License Version 1.0 (the "License");
* you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
* http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_idpl.
*
* Software distributed under the License is distributed on
* an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
* express or implied. See the License for the specific
* language governing rights and limitations under the License.
*
*
* The Original Code was created by Vladimir Tsvigun for IBPhoenix.
*
* Copyright (c) 2003 Vladimir Tsvigun
* All Rights Reserved.
*/
// OdbcConvert.h interface for the OdbcConvert class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(_OdbcConvert__INCLUDED_)
#define _OdbcConvert__INCLUDED_
#include "OdbcObject.h"
namespace OdbcJdbcLibrary {
struct shortTime
{
unsigned char hour;
unsigned char minute;
unsigned char second;
unsigned char hsecond;
};
struct shortDate
{
int year;
char day;
char month;
};
class DescRecord;
class OdbcConvert;
class OdbcStatement;
typedef int (OdbcConvert::*ADRESS_FUNCTION)(DescRecord * from, DescRecord * to);
class OdbcConvert
{
OdbcStatement *parentStmt;
bool bIdentity;
SQLLEN tempBindOffsetPtr;
SQLLEN *bindOffsetPtrTo;
SQLLEN *bindOffsetPtrIndTo;
SQLLEN *bindOffsetPtrFrom;
SQLLEN *bindOffsetPtrIndFrom;
public:
bool statusReturnData;
private:
signed int encode_sql_date(SQLUSMALLINT day, SQLUSMALLINT month, SQLSMALLINT year);
void decode_sql_date(signed int nday, SQLUSMALLINT &mday, SQLUSMALLINT &month, SQLSMALLINT &year);
signed int encode_sql_time(SQLUSMALLINT hour, SQLUSMALLINT minute, SQLUSMALLINT second);
void decode_sql_time(signed int ntime, SQLUSMALLINT &hour, SQLUSMALLINT &minute, SQLUSMALLINT &second);
void convertStringDateTimeToServerStringDateTime (char *& string, int &len);
void getFirstElementFromArrayString(char * string, char *& firstChar, int &len);
void setHeadSqlVar ( DescRecord * to );
public:
OdbcConvert(OdbcStatement * parent);
void setZeroColumn(DescRecord * to, int rowNumber);
void setBindOffsetPtrTo(SQLLEN *bindOffsetPtr, SQLLEN *bindOffsetPtrInd);
void setBindOffsetPtrFrom(SQLLEN *bindOffsetPtr, SQLLEN *bindOffsetPtrInd);
ADRESS_FUNCTION getAdressFunction(DescRecord * from, DescRecord * to);
inline SQLPOINTER getAdressBindDataFrom(char * pointer);
inline SQLLEN *getAdressBindIndFrom(char * pointer);
inline SQLPOINTER getAdressBindDataTo(char * pointer);
inline SQLLEN *getAdressBindIndTo(char * pointer);
public:
bool isIdentity(){ return bIdentity; }
SQLLEN &getBindOffsetPtrTo() { return *bindOffsetPtrTo; }
int notYetImplemented(DescRecord * from, DescRecord * to);
// Guid
int convGuidToString(DescRecord * from, DescRecord * to);
int convGuidToStringW(DescRecord * from, DescRecord * to);
// TinyInt
int convTinyIntToBoolean(DescRecord * from, DescRecord * to);
int convTinyIntToTinyInt(DescRecord * from, DescRecord * to);
int convTinyIntToShort(DescRecord * from, DescRecord * to);
int convTinyIntToLong(DescRecord * from, DescRecord * to);
int convTinyIntToFloat(DescRecord * from, DescRecord * to);
int convTinyIntToDouble(DescRecord * from, DescRecord * to);
int convTinyIntToBigint(DescRecord * from, DescRecord * to);
int convTinyIntToString(DescRecord * from, DescRecord * to);
int convTinyIntToStringW(DescRecord * from, DescRecord * to);
int convTinyIntToTagNumeric(DescRecord * from, DescRecord * to);
// Short
int convShortToBoolean(DescRecord * from, DescRecord * to);
int convShortToTinyInt(DescRecord * from, DescRecord * to);
int convShortToShort(DescRecord * from, DescRecord * to);
int convShortToLong(DescRecord * from, DescRecord * to);
int convShortToFloat(DescRecord * from, DescRecord * to);
int convShortToDouble(DescRecord * from, DescRecord * to);
int convShortToBigint(DescRecord * from, DescRecord * to);
int convShortToTinyIntWithScale(DescRecord * from, DescRecord * to);
int convShortToShortWithScale(DescRecord * from, DescRecord * to);
int convShortToLongWithScale(DescRecord * from, DescRecord * to);
int convShortToFloatWithScale(DescRecord * from, DescRecord * to);
int convShortToDoubleWithScale(DescRecord * from, DescRecord * to);
int convShortToBigintWithScale(DescRecord * from, DescRecord * to);
int convShortToString(DescRecord * from, DescRecord * to);
int convShortToStringW(DescRecord * from, DescRecord * to);
int convShortToTagNumeric(DescRecord * from, DescRecord * to);
// Long
int convLongToBoolean(DescRecord * from, DescRecord * to);
int convLongToTinyInt(DescRecord * from, DescRecord * to);
int convLongToShort(DescRecord * from, DescRecord * to);
int convLongToLong(DescRecord * from, DescRecord * to);
int convLongToFloat(DescRecord * from, DescRecord * to);
int convLongToDouble(DescRecord * from, DescRecord * to);
int convLongToBigint(DescRecord * from, DescRecord * to);
int convLongToLongWithScale(DescRecord * from, DescRecord * to);
int convLongToTinyIntWithScale(DescRecord * from, DescRecord * to);
int convLongToShortWithScale(DescRecord * from, DescRecord * to);
int convLongToFloatWithScale(DescRecord * from, DescRecord * to);
int convLongToDoubleWithScale(DescRecord * from, DescRecord * to);
int convLongToBigintWithScale(DescRecord * from, DescRecord * to);
int convLongToString(DescRecord * from, DescRecord * to);
int convLongToStringW(DescRecord * from, DescRecord * to);
int convLongToTagNumeric(DescRecord * from, DescRecord * to);
// Float
int convFloatToBoolean(DescRecord * from, DescRecord * to);
int convFloatToTinyInt(DescRecord * from, DescRecord * to);
int convFloatToShort(DescRecord * from, DescRecord * to);
int convFloatToLong(DescRecord * from, DescRecord * to);
int convFloatToFloat(DescRecord * from, DescRecord * to);
int convFloatToDouble(DescRecord * from, DescRecord * to);
int convFloatToBigint(DescRecord * from, DescRecord * to);
int convFloatToString(DescRecord * from, DescRecord * to);
int convFloatToStringW(DescRecord * from, DescRecord * to);
// Double
int convDoubleToBoolean(DescRecord * from, DescRecord * to);
int convDoubleToTinyInt(DescRecord * from, DescRecord * to);
int convDoubleToShort(DescRecord * from, DescRecord * to);
int convDoubleToLong(DescRecord * from, DescRecord * to);
int convDoubleToFloat(DescRecord * from, DescRecord * to);
int convDoubleToDouble(DescRecord * from, DescRecord * to);
int convDoubleToBigint(DescRecord * from, DescRecord * to);
int convDoubleToString(DescRecord * from, DescRecord * to);
int convDoubleToStringW(DescRecord * from, DescRecord * to);
int convDoubleToTagNumeric(DescRecord * from, DescRecord * to);
// Bigint
int convBigintToBoolean(DescRecord * from, DescRecord * to);
int convBigintToTinyInt(DescRecord * from, DescRecord * to);
int convBigintToShort(DescRecord * from, DescRecord * to);
int convBigintToLong(DescRecord * from, DescRecord * to);
int convBigintToFloat(DescRecord * from, DescRecord * to);
int convBigintToDouble(DescRecord * from, DescRecord * to);
int convBigintToFloatWithScale(DescRecord * from, DescRecord * to);
int convBigintToDoubleWithScale(DescRecord * from, DescRecord * to);
int convBigintToBigint(DescRecord * from, DescRecord * to);
int convBigintToBinary(DescRecord * from, DescRecord * to);
int convBigintToString(DescRecord * from, DescRecord * to);
int convBigintToStringW(DescRecord * from, DescRecord * to);
int convBigintToTagNumeric(DescRecord * from, DescRecord * to);
// Numeric, Decimal
int convNumericToBoolean(DescRecord * from, DescRecord * to);
int convNumericToTinyInt(DescRecord * from, DescRecord * to);
int convNumericToShort(DescRecord * from, DescRecord * to);
int convNumericToLong(DescRecord * from, DescRecord * to);
int convNumericToFloat(DescRecord * from, DescRecord * to);
int convNumericToDouble(DescRecord * from, DescRecord * to);
int convNumericToBigint(DescRecord * from, DescRecord * to);
int convNumericToTagNumeric(DescRecord * from, DescRecord * to);
// TagNumeric
int convTagNumericToTinyInt(DescRecord * from, DescRecord * to);
int convTagNumericToShort(DescRecord * from, DescRecord * to);
int convTagNumericToLong(DescRecord * from, DescRecord * to);
int convTagNumericToFloat(DescRecord * from, DescRecord * to);
int convTagNumericToDouble(DescRecord * from, DescRecord * to);
int convTagNumericToBigint(DescRecord * from, DescRecord * to);
// Date
int convDateToLong(DescRecord * from, DescRecord * to);
int convDateToFloat(DescRecord * from, DescRecord * to);
int convDateToDouble(DescRecord * from, DescRecord * to);
int convDateToBigint(DescRecord * from, DescRecord * to);
int convDateToTagDate(DescRecord * from, DescRecord * to);
int convDateToTagTimestamp(DescRecord * from, DescRecord * to);
int convDateToString(DescRecord * from, DescRecord * to);
int convDateToStringW(DescRecord * from, DescRecord * to);
int convDateToBinary(DescRecord * from, DescRecord * to);
int transferTagDateToDate(DescRecord * from, DescRecord * to);
int transferTagDateToDateTime(DescRecord * from, DescRecord * to);
// Time
int convTimeToLong(DescRecord * from, DescRecord * to);
int convTimeToFloat(DescRecord * from, DescRecord * to);
int convTimeToDouble(DescRecord * from, DescRecord * to);
int convTimeToBigint(DescRecord * from, DescRecord * to);
int convTimeToTagTime(DescRecord * from, DescRecord * to);
int convTimeToTagTimestamp(DescRecord * from, DescRecord * to);
int convTimeToString(DescRecord * from, DescRecord * to);
int convTimeToStringW(DescRecord * from, DescRecord * to);
int convTimeToBinary(DescRecord * from, DescRecord * to);
int transferTagTimeToTime(DescRecord * from, DescRecord * to);
int transferTagTimeToDateTime(DescRecord * from, DescRecord * to);
// DateTime
int convDateTimeToDouble(DescRecord * from, DescRecord * to);
int convDateTimeToBigint(DescRecord * from, DescRecord * to);
int convDateTimeToTagDate(DescRecord * from, DescRecord * to);
int convDateTimeToTagTime(DescRecord * from, DescRecord * to);
int convDateTimeToTagDateTime(DescRecord * from, DescRecord * to);
int convDateTimeToString(DescRecord * from, DescRecord * to);
int convDateTimeToStringW(DescRecord * from, DescRecord * to);
int convDateTimeToBinary(DescRecord * from, DescRecord * to);
int transferTagDateTimeToDate(DescRecord * from, DescRecord * to);
int transferTagDateTimeToTime(DescRecord * from, DescRecord * to);
int transferTagDateTimeToDateTime(DescRecord * from, DescRecord * to);
// Blob
int convBlobToTinyInt(DescRecord * from, DescRecord * to);
int convBlobToShort(DescRecord * from, DescRecord * to);
int convBlobToLong(DescRecord * from, DescRecord * to);
int convBlobToFloat(DescRecord * from, DescRecord * to);
int convBlobToDouble(DescRecord * from, DescRecord * to);
int convBlobToBigint(DescRecord * from, DescRecord * to);
int convBlobToBlob(DescRecord * from, DescRecord * to);
int convBlobToBinary(DescRecord * from, DescRecord * to);
int convBlobToString(DescRecord * from, DescRecord * to);
int convBlobToStringW(DescRecord * from, DescRecord * to);
int convStreamToBlob(DescRecord * from, DescRecord * to);
int convBinaryToBlob(DescRecord * from, DescRecord * to);
// Text
int convStringToLong(DescRecord * from, DescRecord * to);
int convStringToTinyInt(DescRecord * from, DescRecord * to);
int convStringToShort(DescRecord * from, DescRecord * to);
int convStringToFloat(DescRecord * from, DescRecord * to);
int convStringToDouble(DescRecord * from, DescRecord * to);
int convStringToBigint(DescRecord * from, DescRecord * to);
int convStringWToLong(DescRecord * from, DescRecord * to);
int convStringWToTinyInt(DescRecord * from, DescRecord * to);
int convStringWToShort(DescRecord * from, DescRecord * to);
int convStringWToFloat(DescRecord * from, DescRecord * to);
int convStringWToDouble(DescRecord * from, DescRecord * to);
int convStringWToBigint(DescRecord * from, DescRecord * to);
int convStringToString(DescRecord * from, DescRecord * to);
int convStringToStringW(DescRecord * from, DescRecord * to);
int convStringToVarString(DescRecord * from, DescRecord * to);
int convStringToBlob(DescRecord * from, DescRecord * to);
int convStringWToBlob(DescRecord * from, DescRecord * to);
int convStringToBinary(DescRecord * from, DescRecord * to);
int transferStringToTinyInt(DescRecord * from, DescRecord * to);
int transferStringToDateTime(DescRecord * from, DescRecord * to);
int transferStringWToDateTime(DescRecord * from, DescRecord * to);
int transferStringToAllowedType(DescRecord * from, DescRecord * to);
int transferStringWToAllowedType(DescRecord * from, DescRecord * to);
int transferArrayStringToAllowedType(DescRecord * from, DescRecord * to);
int transferBinaryStringToAllowedType(DescRecord * from, DescRecord * to);
int convStreamHexStringToBlob(DescRecord * from, DescRecord * to);
// Varying
int convVarStringToLong(DescRecord * from, DescRecord * to);
int convVarStringToTinyInt(DescRecord * from, DescRecord * to);
int convVarStringToShort(DescRecord * from, DescRecord * to);
int convVarStringToFloat(DescRecord * from, DescRecord * to);
int convVarStringToDouble(DescRecord * from, DescRecord * to);
int convVarStringToBigint(DescRecord * from, DescRecord * to);
int convVarStringWToLong(DescRecord * from, DescRecord * to);
int convVarStringWToTinyInt(DescRecord * from, DescRecord * to);
int convVarStringWToShort(DescRecord * from, DescRecord * to);
int convVarStringWToFloat(DescRecord * from, DescRecord * to);
int convVarStringWToDouble(DescRecord * from, DescRecord * to);
int convVarStringWToBigint(DescRecord * from, DescRecord * to);
int convVarStringToString(DescRecord * from, DescRecord * to);
int convVarStringToStringW(DescRecord * from, DescRecord * to);
int convVarStringSystemToString(DescRecord * from, DescRecord * to);
int convVarStringSystemToStringW(DescRecord * from, DescRecord * to);
int convVarStringToBinary(DescRecord * from, DescRecord * to);
};
}; // end namespace OdbcJdbcLibrary
#endif // !defined(_OdbcConvert__INCLUDED_)