-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsqlora_compat.c
More file actions
352 lines (308 loc) · 6.54 KB
/
Copy pathsqlora_compat.c
File metadata and controls
352 lines (308 loc) · 6.54 KB
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
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
/* $Id: sqlora_compat.c 180 2002-04-22 06:04:45Z kpoitschke $ */
/**
* @file sqlora_compat.c
* Compatibility functions for backward compatibility to version 1.
* These functions basically work without the dbh parameter. This means
* you can only use 1 database connection.
*
* @author Kai Poitschke
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#ifdef WANT_SQLORA1_COMPATIBILITY
#include "sqlora.h"
CONST char * sqlora_compatID="$Id: sqlora_compat.c 180 2002-04-22 06:04:45Z kpoitschke $";
#if defined(WIN32)
#define inline __inline
#endif
#if defined (__STDC__) || defined (_AIX) || \
(defined (__mips) && defined (_SYSTYPE_SVR4)) ||\
defined(WIN32) || defined(__cplusplus)\
# define AND ,
# define DEFUN(name, arglist, args) name(args)
# define DEFUN_VOID(name) name(void)
/*
* Macro to use instead of "void" for arguments that must have
* type "void *" in ANSI C; maps them to type "char *" in
* non-ANSI systems.
*/
# define VOID void
#else
# define AND ;
# define DEFUN(name, arglist, args) name arglist args;
# define DEFUN_VOID(name) name()
# define VOID char
#endif
#ifndef NULL
# define NULL 0
#endif
static int _dbh = -1;
/* ------------------------------------------------------------------------- */
/*
* sql_init
*/
int DEFUN_VOID(sql_init)
{
return(sqlo_init(0, 1, 256)); /* no threaded mode, 1K for stmt pointers */
}
/*
* sql_trace
*/
int DEFUN(sql_trace,(on), int on)
{
return(sqlo_trace(_dbh,on));
}
/*
* sql_geterror
*/
CONST char * DEFUN_VOID(sql_geterror) {
return(sqlo_geterror(_dbh));
}
/*
* sql_geterrcode
*/
int DEFUN_VOID(sql_geterrcode)
{
return(sqlo_geterrcode(_dbh));
}
/*
* sql_exists
*/
int DEFUN(sql_exists, (table, field, value, where),
CONST char * table AND
CONST char * field AND
CONST char * value AND
CONST char * where)
{
return(sqlo_exists(_dbh,table,field,value,where));
}
/*
* sql_count
*/
int DEFUN(sql_count, (table, field, value, where),
CONST char * table AND
CONST char * field AND
CONST char * value AND
CONST char * where)
{
return(sqlo_count(_dbh,table,field,value,where));
}
/*
* sql_run
*/
int DEFUN(sql_run,(stmt, argc, argv),
char CONST * stmt AND
int argc AND
char CONST ** argv)
{
return(sqlo_run(_dbh, stmt, argc, argv));
}
/*
* sql_open
*/
int DEFUN(sql_open,(stmt, argc, argv),
CONST char * stmt AND
int argc AND
CONST char ** argv)
{
return(sqlo_open(_dbh, stmt, argc, argv));
}
/*
* sql_reopen
*/
int DEFUN(sql_reopen,(sth, argc, argv),
int sth AND
int argc AND
CONST char ** argv)
{
return(sqlo_reopen(sth, argc, argv));
}
/*
* sql_fetch
*/
int DEFUN(sql_fetch, (sth), int sth)
{
return(sqlo_fetch(sth, 1));
}
char CONST ** DEFUN(sql_values,(sth, num, do_strip),
int sth AND
int * num AND
int do_strip)
{
return(sqlo_values(sth, num, do_strip));
}
/*
* sql_command
*/
char CONST * DEFUN(sql_command,(sth), int sth)
{
return(sqlo_command(sth));
}
/*
* sql_close
*/
int DEFUN(sql_close,(sth), int sth)
{
return(sqlo_close(sth));
}
/*
* sql_print
*/
int DEFUN(sql_print, (sth), int sth)
{
return(sqlo_print(sth));
}
/*
* sql_finish
*/
int DEFUN_VOID(sql_finish)
{
return(sqlo_finish(_dbh));
}
/*
* sql_getdatabase
*/
char CONST * DEFUN_VOID(sql_getdatabase)
{
return(sqlo_getdatabase(_dbh));
}
/*
* sql_prows
*/
int DEFUN(sql_prows,(sth), int sth)
{
return(sqlo_prows(sth));
}
/*
* sql_connect
*/
int DEFUN(sql_connect,(connect_str), CONST char * connect_str)
{
return(sqlo_connect(&_dbh, connect_str));
}
int DEFUN_VOID(sql_commit)
{
return(sqlo_commit(_dbh));
}
/*
* sql_rollback
*/
int DEFUN_VOID(sql_rollback)
{
return(sqlo_rollback(_dbh));
}
/*
* sql_exec
*/
int DEFUN(sql_exec,(stmt), CONST char * stmt)
{
return(sqlo_exec(_dbh, stmt));
}
/*
* sql_isopen
*/
int DEFUN(sql_isopen,(sth), int sth)
{
return(sqlo_isopen(sth));
}
/*
* sql_prepare
*/
int DEFUN(sql_prepare, (stmt), CONST char * stmt)
{
return(sqlo_prepare(_dbh, stmt));
}
/*
* sql_bind_by_name
*/
int DEFUN(sql_bind_by_name,(sth, name, param_type, param_addr, param_size,
ind_addr, is_array),
int sth AND
CONST char * name AND
int param_type AND
CONST void * param_addr AND
unsigned int param_size AND
short * ind_addr AND
int is_array)
{
return(sqlo_bind_by_name(sth, name, param_type, param_addr, param_size,
ind_addr, is_array));
}
/*
* sql_bind_by_pos
*/
int DEFUN(sql_bind_by_pos,(sth, position, param_type, param_addr, param_size,
ind_addr, is_array),
int sth AND
int position AND
int param_type AND
CONST void * param_addr AND
unsigned int param_size AND
short * ind_addr AND
int is_array)
{
return(sqlo_bind_by_pos(sth, position, param_type, param_addr, param_size,
ind_addr, is_array));
}
/*
* sql_define_by_pos
*/
int DEFUN(sql_define_by_pos,(sth, value_pos, value_type, value_addr,
value_size, ind_addr, rlen_addr,
is_array),
int sth AND
int value_pos AND
int value_type AND
CONST void * value_addr AND
unsigned int value_size AND
short * ind_addr AND
short * rlen_addr AND
int is_array)
{
return(sqlo_define_by_pos(sth, value_pos, value_type, value_addr, value_size,
ind_addr, rlen_addr, is_array));
}
/*
* sql_execute
*/
int DEFUN(sql_execute, (sth, iterations),
int sth AND
int iterations)
{
return(sqlo_execute(sth, iterations));
}
/*
* sql_ocol_names
*/
char CONST ** DEFUN(sql_ocol_names, (sth, num), int sth AND int * num)
{
return(sqlo_ocol_names(sth, num));
}
/*
* sql_ocol_name_lens
*/
int CONST * DEFUN(sql_ocol_name_lens, (sth, num), int sth AND int * num)
{
return(sqlo_ocol_name_lens(sth, num));
}
/*
* sql_value_lens
*/
unsigned short CONST * DEFUN(sql_value_lens, (sth, num), int sth AND int * num)
{
return(sqlo_value_lens(sth, num));
}
/*
* sql_ncols
*/
int DEFUN(sql_ncols, (sth, in), int sth AND int in)
{
return(sqlo_ncols(sth, in));
}
int DEFUN_VOID(sql_getdbh)
{
return _dbh;
}
#endif /* WANT_SQLORA1_COMPATIBILITY */
/* $Id: sqlora_compat.c 180 2002-04-22 06:04:45Z kpoitschke $ */