|
|
1.1 parser 1: /** @file
2: Parser MySQL driver.
3:
1.48 moko 4: Copyright (c) 2001-2015 Art. Lebedev Studio (http://www.artlebedev.com)
1.1 parser 5:
1.7 paf 6: Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)
1.1 parser 7:
1.36 misha 8: 2001-07-30 using MySQL 3.23.22b
1.3 paf 9:
1.36 misha 10: 2001-11-06 numrows on "HP-UX istok1 B.11.00 A 9000/869 448594332 two-user license"
1.3 paf 11: 3.23.42 & 4.0.0.alfa never worked, both subst & .sl version returned 0
1.1 parser 12: */
13:
14: #include "config_includes.h"
15:
16: #include "pa_sql_driver.h"
17:
1.51 ! moko 18: volatile const char * IDENT_PARSER3MYSQL_C="$Id: parser3mysql.C,v 1.50 2017/06/24 20:29:24 moko Exp $" IDENT_PA_SQL_DRIVER_H;
1.40 moko 19:
1.1 parser 20: #define NO_CLIENT_LONG_LONG
21: #include "mysql.h"
22: #include "ltdl.h"
23:
24: #define MAX_STRING 0x400
25: #define MAX_NUMBER 20
26:
27: #if _MSC_VER
28: # define snprintf _snprintf
1.2 parser 29: # define strcasecmp _stricmp
1.1 parser 30: #endif
31:
1.35 misha 32: // for mysql < 4.1
1.36 misha 33: #if !defined(CLIENT_MULTI_RESULTS) || !defined(CLIENT_MULTI_STATEMENTS)
34: # define OLD_MYSQL_CLIENT 1
35: #endif
36:
1.35 misha 37: #ifndef CLIENT_MULTI_RESULTS
1.36 misha 38: # define CLIENT_MULTI_RESULTS (1UL << 17)
1.35 misha 39: #endif
1.36 misha 40:
1.35 misha 41: #ifndef CLIENT_MULTI_STATEMENTS
1.36 misha 42: # define CLIENT_MULTI_STATEMENTS (1UL << 16)
1.35 misha 43: #endif
44:
1.34 misha 45: static char *lsplit(char *string, char delim){
1.32 misha 46: if(string) {
1.34 misha 47: if(char *v=strchr(string, delim)){
1.1 parser 48: *v=0;
49: return v+1;
50: }
1.32 misha 51: }
52: return 0;
1.1 parser 53: }
54:
1.34 misha 55: static char *lsplit(char **string_ref, char delim){
1.32 misha 56: char *result=*string_ref;
1.2 parser 57: char *next=lsplit(*string_ref, delim);
1.32 misha 58: *string_ref=next;
59: return result;
1.2 parser 60: }
61:
1.34 misha 62: static char* rsplit(char* string, char delim){
63: if(string){
64: if(char* v=strrchr(string, delim)){
1.26 paf 65: *v=0;
66: return v+1;
67: }
1.32 misha 68: }
69: return NULL;
1.26 paf 70: }
71:
1.34 misha 72: static void toupper_str(char *out, const char *in, size_t size){
1.19 paf 73: while(size--)
74: *out++=(char)toupper(*in++);
75: }
76:
1.38 misha 77: inline static bool is_column_transcode_required(enum_field_types type) {
78: switch(type) {
79: case MYSQL_TYPE_NULL:
80:
1.45 moko 81: #ifdef FIELD_TYPE_NEWDECIMAL
82: case MYSQL_TYPE_NEWDECIMAL:
83: #endif
1.38 misha 84: case MYSQL_TYPE_DECIMAL:
85: case MYSQL_TYPE_FLOAT:
86: case MYSQL_TYPE_DOUBLE:
87:
88: case MYSQL_TYPE_TINY:
89: case MYSQL_TYPE_SHORT:
90: case MYSQL_TYPE_LONG:
91: case MYSQL_TYPE_LONGLONG:
92: case MYSQL_TYPE_INT24:
1.45 moko 93: #ifdef FIELD_TYPE_BIT
1.38 misha 94: case MYSQL_TYPE_BIT:
1.45 moko 95: #endif
1.38 misha 96:
97: case MYSQL_TYPE_DATE:
98: case MYSQL_TYPE_NEWDATE:
99: case MYSQL_TYPE_TIME:
100: case MYSQL_TYPE_DATETIME:
101: case MYSQL_TYPE_YEAR:
102: case MYSQL_TYPE_TIMESTAMP:
103:
104: case MYSQL_TYPE_BLOB:
105: case MYSQL_TYPE_TINY_BLOB:
106: case MYSQL_TYPE_MEDIUM_BLOB:
107: case MYSQL_TYPE_LONG_BLOB:
108: return false;
109: break;
1.49 moko 110: default:
111: return true;
1.38 misha 112: }
113: }
114:
115: inline static const char* strdup(SQL_Driver_services& services, char* str, size_t length) {
116: char *strm=(char*)services.malloc_atomic(length+1);
117: memcpy(strm, str, length);
118: strm[length]=0;
119: return (const char*)strm;
120: }
121:
1.14 paf 122: struct Connection {
1.16 paf 123: SQL_Driver_services* services;
1.15 paf 124:
1.14 paf 125: MYSQL* handle;
1.33 misha 126: const char* client_charset;
1.14 paf 127: bool autocommit;
128: };
129:
1.29 misha 130:
1.1 parser 131: /**
132: MySQL server driver
133: */
134: class MySQL_Driver : public SQL_Driver {
135: public:
136:
1.29 misha 137: MySQL_Driver() : SQL_Driver() {}
138:
1.1 parser 139: /// get api version
140: int api_version() { return SQL_DRIVER_API_VERSION; }
1.33 misha 141:
1.1 parser 142: /// initialize driver by loading sql dynamic link library
1.4 paf 143: const char *initialize(char *dlopen_file_spec) {
1.1 parser 144: return dlopen_file_spec?
145: dlink(dlopen_file_spec):"client library column is empty";
146: }
1.33 misha 147:
1.1 parser 148: /** connect
1.23 paf 149: @param url
1.2 parser 150: format: @b user:pass@host[:port]|[/unix/socket]/database?
1.47 moko 151: charset=value& // transcode by server with command 'SET NAMES value'
1.32 misha 152: ClientCharset=charset& // transcode by parser
1.2 parser 153: timeout=3&
1.32 misha 154: compress=0&
155: named_pipe=1&
1.33 misha 156: autocommit=1&
1.35 misha 157: multi_statements=0 // allows more then one statement in one query
158: old_client=1 // simulates 3.xx client. not compatible with multi_statements option
1.33 misha 159: 3.x, 4.0
160: only option for charset is cp1251_koi8.
161: 4.1+ accept not 'cp1251_koi8' but 'cp1251', 'utf8' and much more
162: it is usable for transcoding using sql server
1.1 parser 163: */
164: void connect(
1.33 misha 165: char *url,
166: SQL_Driver_services& services,
167: void **connection_ref ///< output: Connection*
168: ){
1.23 paf 169: char *user=url;
1.26 paf 170: char *s=rsplit(user, '@');
1.1 parser 171: char *host=0;
172: char *unix_socket=0;
173: if(s && s[0]=='[') { // unix socket
174: unix_socket=1+s;
175: s=lsplit(unix_socket, ']');
176: } else { // IP
177: host=s;
178: }
179: char *db=lsplit(s, '/');
180: char *pwd=lsplit(user, ':');
181: char *error_pos=0;
182: char *port_cstr=lsplit(host, ':');
183: int port=port_cstr?strtol(port_cstr, &error_pos, 0):0;
1.2 parser 184: char *options=lsplit(db, '?');
185:
1.33 misha 186: char *charset=0;
1.35 misha 187:
188: #ifdef OLD_MYSQL_CLIENT
189: int client_flag=0;
190: #else
1.34 misha 191: int client_flag=CLIENT_MULTI_RESULTS;
1.35 misha 192: #endif
1.1 parser 193:
1.33 misha 194: Connection& connection=*(Connection *)services.malloc(sizeof(Connection));
195: *connection_ref=&connection;
1.15 paf 196: connection.services=&services;
1.32 misha 197: connection.handle=mysql_init(NULL);
1.33 misha 198: connection.client_charset=0;
1.14 paf 199: connection.autocommit=true;
1.2 parser 200:
1.32 misha 201: while(options){
202: if(char *key=lsplit(&options, '&')){
203: if(*key){
204: if(char *value=lsplit(key, '=')){
1.33 misha 205: if(strcmp(key, "ClientCharset")==0){ // transcoding with parser
1.21 paf 206: toupper_str(value, value, strlen(value));
1.33 misha 207: connection.client_charset=value;
1.32 misha 208: } else if(strcasecmp(key, "charset")==0){ // transcoding with server
1.33 misha 209: charset=value;
1.32 misha 210: } else if(strcasecmp(key, "timeout")==0){
1.2 parser 211: unsigned int timeout=(unsigned int)atoi(value);
1.14 paf 212: if(mysql_options(connection.handle, MYSQL_OPT_CONNECT_TIMEOUT, (const char *)&timeout)!=0)
213: services._throw(mysql_error(connection.handle));
1.32 misha 214: } else if(strcasecmp(key, "compress")==0){
1.2 parser 215: if(atoi(value))
1.14 paf 216: if(mysql_options(connection.handle, MYSQL_OPT_COMPRESS, 0)!=0)
217: services._throw(mysql_error(connection.handle));
1.32 misha 218: } else if(strcasecmp(key, "named_pipe")==0){
1.2 parser 219: if(atoi(value))
1.33 misha 220: if(mysql_options(connection.handle, MYSQL_OPT_NAMED_PIPE, 0)!=0)
1.14 paf 221: services._throw(mysql_error(connection.handle));
1.39 misha 222: } else if(strcasecmp(key, "local_infile")==0){
223: if(atoi(value))
224: if(mysql_options(connection.handle, MYSQL_OPT_LOCAL_INFILE, 0)!=0)
225: services._throw(mysql_error(connection.handle));
1.32 misha 226: } else if(strcasecmp(key, "autocommit")==0){
1.31 misha 227: if(atoi(value)==0)
1.14 paf 228: connection.autocommit=false;
1.34 misha 229: } else if(strcasecmp(key, "multi_statements")==0){
1.35 misha 230: #ifdef OLD_MYSQL_CLIENT
231: services._throw("driver was built with old mysql includes so multi_statements option can't be used");
232: #else
1.34 misha 233: if(!(client_flag==CLIENT_MULTI_RESULTS || client_flag==CLIENT_MULTI_STATEMENTS))
234: services._throw("you can't specify together options old_client and multi_statements");
235: if(atoi(value)!=0)
236: client_flag=CLIENT_MULTI_STATEMENTS;
1.35 misha 237: #endif
1.34 misha 238: } else if(strcasecmp(key, "old_client")==0){
1.35 misha 239: #ifdef OLD_MYSQL_CLIENT
240: services._throw("driver was built with old mysql includes so old_client option can't be used");
241: #else
1.34 misha 242: if(!(client_flag==CLIENT_MULTI_RESULTS || client_flag==0))
243: services._throw("you can't specify together options old_client and multi_statements");
244: if(atoi(value)!=0)
245: client_flag=0;
1.35 misha 246: #endif
1.2 parser 247: } else
248: services._throw("unknown connect option" /*key*/);
249: } else
250: services._throw("connect option without =value" /*key*/);
251: }
252: }
253: }
254:
1.51 ! moko 255: if(!mysql_real_connect(connection.handle, host, user, pwd, db, port, unix_socket, client_flag)){
1.14 paf 256: services._throw(mysql_error(connection.handle));
1.33 misha 257: }
1.1 parser 258:
1.33 misha 259: if(charset){
1.47 moko 260: char statement[MAX_STRING+1]="SET NAMES ";
1.33 misha 261: strncat(statement, charset, MAX_STRING);
262: _exec(connection, statement);
1.1 parser 263: }
264:
1.14 paf 265: if(!connection.autocommit)
1.33 misha 266: _exec(connection, "SET AUTOCOMMIT=0");
1.1 parser 267: }
1.14 paf 268:
269: void disconnect(void *aconnection) {
270: Connection& connection=*static_cast<Connection*>(aconnection);
271: mysql_close(connection.handle);
1.17 paf 272: connection.handle=0;
1.1 parser 273: }
1.32 misha 274:
1.15 paf 275: void commit(void *aconnection) {
1.14 paf 276: Connection& connection=*static_cast<Connection*>(aconnection);
277: if(!connection.autocommit)
1.33 misha 278: _exec(connection, "COMMIT");
1.14 paf 279: }
1.32 misha 280:
1.15 paf 281: void rollback(void *aconnection) {
1.14 paf 282: Connection& connection=*static_cast<Connection*>(aconnection);
283: if(!connection.autocommit)
1.33 misha 284: _exec(connection, "ROLLBACK");
1.14 paf 285: }
286:
1.15 paf 287: bool ping(void *aconnection) {
1.14 paf 288: Connection& connection=*static_cast<Connection*>(aconnection);
289: return mysql_ping(connection.handle)==0;
1.1 parser 290: }
291:
1.37 moko 292: // charset here is services.request_charset(), not connection.client_charset
293: // thus we can't use the sql server quoting support
294: const char* quote(void *aconnection, const char *str, unsigned int length) {
295: const char* from;
296: const char* from_end=str+length;
297:
298: size_t quoted=0;
299:
300: for(from=str; from<from_end; from++){
301: switch (*from) {
302: case 0:
303: case '\n':
304: case '\r':
305: case '\032':
306: case '\\':
307: case '\'':
308: case '"':
309: quoted++;
310: }
311: }
312:
313: if(!quoted)
314: return str;
315:
1.15 paf 316: Connection& connection=*static_cast<Connection*>(aconnection);
1.37 moko 317: char *result=(char*)connection.services->malloc_atomic(length + quoted + 1);
318: char *to = result;
319:
320: for(from=str; from<from_end; from++){
321: char escape;
322: switch (*from) {
323: case 0:
324: escape= '0';
325: break;
326: case '\n':
327: escape= 'n';
328: break;
329: case '\r':
330: escape= 'r';
331: break;
332: case '\032':
333: escape= 'Z';
334: break;
335: case '\\':
336: case '\'':
337: case '"':
338: escape= *from;
339: break;
340: default:
341: *to++=*from;
342: continue;
343: }
344: *to++= '\\';
345: *to++= escape;
346: }
347:
348: *to=0;
1.13 paf 349: return result;
1.1 parser 350: }
1.33 misha 351:
1.24 paf 352: void query(void *aconnection,
1.33 misha 353: const char *astatement,
354: size_t placeholders_count, Placeholder* placeholders,
355: unsigned long offset, unsigned long limit,
356: SQL_Driver_query_event_handlers& handlers
357: ){
1.14 paf 358: Connection& connection=*static_cast<Connection*>(aconnection);
1.15 paf 359: SQL_Driver_services& services=*connection.services;
1.1 parser 360: MYSQL_RES *res=NULL;
1.24 paf 361:
362: if(placeholders_count>0)
363: services._throw("bind variables not supported (yet)");
1.1 parser 364:
1.33 misha 365: bool transcode_needed=_transcode_required(connection);
366:
1.38 misha 367: size_t statement_size=0;
368:
369: if(transcode_needed) {
370: statement_size=strlen(astatement);
371: // transcode query from $request:charset to ?ClientCharset
372: services.transcode(astatement, statement_size,
373: astatement, statement_size,
1.19 paf 374: services.request_charset(),
1.33 misha 375: connection.client_charset);
1.19 paf 376: }
377:
1.1 parser 378: const char *statement;
1.38 misha 379: if(offset || limit!=SQL_NO_LIMIT) {
380: if(!statement_size)
381: statement_size=strlen(astatement);
1.13 paf 382: char *statement_limited=(char *)services.malloc_atomic(
1.33 misha 383: statement_size+MAX_NUMBER*2+8/* LIMIT #,#*/+1);
1.1 parser 384: char *cur=statement_limited;
385: memcpy(cur, astatement, statement_size); cur+=statement_size;
1.33 misha 386: cur+=sprintf(cur, " LIMIT ");
1.1 parser 387: if(offset)
1.42 moko 388: cur+=snprintf(cur, MAX_NUMBER, "%lu,", offset);
1.33 misha 389: if(limit!=SQL_NO_LIMIT)
1.41 moko 390: cur+=snprintf(cur, MAX_NUMBER, "%lu", limit);
1.1 parser 391: statement=statement_limited;
392: } else
393: statement=astatement;
394:
1.14 paf 395: if(mysql_query(connection.handle, statement))
1.33 misha 396: _throw(connection, mysql_error(connection.handle));
1.38 misha 397: if(!(res=mysql_store_result(connection.handle)) && mysql_field_count(connection.handle))
1.33 misha 398: _throw(connection, mysql_error(connection.handle));
1.1 parser 399: if(!res) // empty result: insert|delete|update|...
400: return;
1.38 misha 401:
402: size_t column_count=mysql_num_fields(res);
1.1 parser 403: if(!column_count) // old client
1.14 paf 404: column_count=mysql_field_count(connection.handle);
1.1 parser 405:
1.33 misha 406: if(!column_count){
1.1 parser 407: mysql_free_result(res);
408: services._throw("result contains no columns");
409: }
1.38 misha 410:
1.9 paf 411: bool failed=false;
412: SQL_Error sql_error;
1.38 misha 413:
414: #define CHECK(afailed) \
415: if(afailed) { \
416: failed=true; \
1.9 paf 417: goto cleanup; \
418: }
419:
1.44 moko 420: #define DO_FETCH_FIELDS(transcode_column_name) { \
421: for(size_t i=0; i<column_count; i++) { \
422: if(MYSQL_FIELD *field = mysql_fetch_field(res)){ \
423: size_t length=field->name_length; \
424: const char* str=strdup(services, field->name, length); \
425: transcode_column_name \
426: CHECK(handlers.add_column(sql_error, str, length)); \
427: } else { \
428: /* seen broken client, that reported "44" column count for "select 2+2" */ \
429: column_count=i; \
430: break; \
431: } \
432: } \
433: }
434:
435: #define DO_FETCH_ROWS(transcode_cell_value) { \
436: while(MYSQL_ROW mysql_row=mysql_fetch_row(res)) { \
437: CHECK(handlers.add_row(sql_error)); \
438: unsigned long *lengths=mysql_fetch_lengths(res); \
439: for(size_t i=0; i<column_count; i++) { \
440: const char* str=0; \
441: size_t length=lengths[i]; \
442: if(length) { \
443: str=strdup(services, mysql_row[i], length); \
444: transcode_cell_value \
445: } \
446: CHECK(handlers.add_row_cell(sql_error, str, length)); \
447: } \
448: } \
1.38 misha 449: }
450:
451: bool* transcode_column=0;
452: if(transcode_needed) {
453: transcode_column = new bool[column_count];
454: DO_FETCH_FIELDS(
1.44 moko 455: transcode_column[i] = is_column_transcode_required(field->type);
1.38 misha 456: // transcode column's name from ?ClientCharset to $request:charset
457: services.transcode(str, length,
458: str, length,
459: connection.client_charset,
460: services.request_charset());
461: )
462: CHECK(handlers.before_rows(sql_error));
463: DO_FETCH_ROWS(
464: if(transcode_column[i])
465: // transcode cell's value from ?ClientCharset to $request:charset
1.19 paf 466: services.transcode(str, length,
467: str, length,
1.33 misha 468: connection.client_charset,
1.19 paf 469: services.request_charset());
1.38 misha 470: )
471: } else {
472: // without transcoding
473: DO_FETCH_FIELDS()
474: CHECK(handlers.before_rows(sql_error));
475: DO_FETCH_ROWS()
1.32 misha 476: }
1.9 paf 477: cleanup:
1.38 misha 478: if(transcode_column)
479: delete transcode_column;
1.1 parser 480: mysql_free_result(res);
1.9 paf 481: if(failed)
482: services._throw(sql_error);
1.1 parser 483: }
484:
1.33 misha 485: private:
486: void _exec(Connection& connection, const char* statement) {
487: if(mysql_query(connection.handle, statement))
488: _throw(connection, mysql_error(connection.handle));
489: (*mysql_store_result)(connection.handle); // throw out the result [don't need but must call]
490: }
491:
492: void _throw(Connection& connection, const char* aerr_msg) {
493: size_t length=strlen(aerr_msg);
494: if(length && _transcode_required(connection)) {
495: connection.services->transcode(aerr_msg, length,
496: aerr_msg, length,
497: connection.client_charset,
498: connection.services->request_charset());
499: }
500: connection.services->_throw(aerr_msg);
501: }
502:
503: bool _transcode_required(Connection& connection){
504: return (connection.client_charset && strcmp(connection.client_charset, connection.services->request_charset())!=0);
505: }
506:
1.1 parser 507: private: // mysql client library funcs
508:
1.33 misha 509: typedef MYSQL* (STDCALL *t_mysql_init)(MYSQL *); t_mysql_init mysql_init;
1.1 parser 510:
1.33 misha 511: typedef void (STDCALL *t_mysql_server_end)(); t_mysql_server_end mysql_server_end;
1.29 misha 512:
1.33 misha 513: typedef int (STDCALL *t_mysql_options)(MYSQL *mysql, enum mysql_option option, const char *arg); t_mysql_options mysql_options;
1.2 parser 514:
1.1 parser 515: typedef MYSQL_RES* (STDCALL *t_mysql_store_result)(MYSQL *); t_mysql_store_result mysql_store_result;
516:
517: typedef int (STDCALL *t_mysql_query)(MYSQL *, const char *q); t_mysql_query mysql_query;
518:
1.33 misha 519: typedef char* (STDCALL *t_mysql_error)(MYSQL *); t_mysql_error mysql_error;
1.1 parser 520: static char* STDCALL subst_mysql_error(MYSQL *mysql) { return (mysql)->net.last_error; }
521:
1.33 misha 522: typedef MYSQL* (STDCALL *t_mysql_real_connect)(MYSQL *, const char *host,
523: const char *user,
524: const char *passwd,
525: const char *db,
526: unsigned int port,
527: const char *unix_socket,
528: unsigned int clientflag); t_mysql_real_connect mysql_real_connect;
1.1 parser 529:
1.33 misha 530: typedef void (STDCALL *t_mysql_close)(MYSQL *); t_mysql_close mysql_close;
1.1 parser 531:
532: typedef int (STDCALL *t_mysql_ping)(MYSQL *); t_mysql_ping mysql_ping;
533:
534: typedef unsigned long (STDCALL *t_mysql_escape_string)(char *to,const char *from,
1.33 misha 535: unsigned long from_length); t_mysql_escape_string mysql_escape_string;
1.1 parser 536:
1.33 misha 537: typedef void (STDCALL *t_mysql_free_result)(MYSQL_RES *result); t_mysql_free_result mysql_free_result;
1.1 parser 538:
539: typedef unsigned long* (STDCALL *t_mysql_fetch_lengths)(MYSQL_RES *result); t_mysql_fetch_lengths mysql_fetch_lengths;
540:
541: typedef MYSQL_ROW (STDCALL *t_mysql_fetch_row)(MYSQL_RES *result); t_mysql_fetch_row mysql_fetch_row;
542:
1.44 moko 543: typedef MYSQL_FIELD* (STDCALL *t_mysql_fetch_field)(MYSQL_RES *result); t_mysql_fetch_field mysql_fetch_field;
1.1 parser 544:
1.33 misha 545: typedef unsigned int (STDCALL *t_mysql_num_fields)(MYSQL_RES *); t_mysql_num_fields mysql_num_fields;
546: typedef unsigned int (STDCALL *t_mysql_field_count)(MYSQL *); t_mysql_field_count mysql_field_count;
1.1 parser 547:
1.33 misha 548: static unsigned int STDCALL subst_mysql_num_fields(MYSQL_RES *res) { return res->field_count; }
549: static unsigned int STDCALL subst_mysql_field_count(MYSQL *mysql) { return mysql->field_count; }
1.1 parser 550:
551: private: // mysql client library funcs linking
552:
553: const char *dlink(const char *dlopen_file_spec) {
1.43 moko 554: if(lt_dlinit()){
555: if(const char* result=lt_dlerror())
556: return result;
557: return "can not prepare to dynamic loading";
558: }
1.25 paf 559:
1.33 misha 560: lt_dlhandle handle=lt_dlopen(dlopen_file_spec);
561:
562: if(!handle){
563: if(const char* result=lt_dlerror())
564: return result;
1.1 parser 565: return "can not open the dynamic link module";
1.25 paf 566: }
1.1 parser 567:
1.29 misha 568: #define GLINK(name) \
569: name=(t_##name)lt_dlsym(handle, #name);
570:
1.1 parser 571: #define DSLINK(name, action) \
1.29 misha 572: GLINK(name) \
1.1 parser 573: if(!name) \
574: action;
575:
576: #define DLINK(name) DSLINK(name, return "function " #name " was not found")
577: #define SLINK(name) DSLINK(name, name=subst_##name)
578:
579: DLINK(mysql_init);
1.29 misha 580: GLINK(mysql_server_end);
1.2 parser 581: DLINK(mysql_options);
1.1 parser 582: DLINK(mysql_store_result);
583: DLINK(mysql_query);
584: SLINK(mysql_error);
585: DLINK(mysql_real_connect);
586: DLINK(mysql_close);
587: DLINK(mysql_ping);
588: DLINK(mysql_escape_string);
589: DLINK(mysql_free_result);
590: DLINK(mysql_fetch_lengths);
591: DLINK(mysql_fetch_row);
1.44 moko 592: DLINK(mysql_fetch_field);
1.1 parser 593: SLINK(mysql_num_fields);
594: SLINK(mysql_field_count);
595: return 0;
596: }
597:
598: };
599:
600: extern "C" SQL_Driver *SQL_DRIVER_CREATE() {
1.29 misha 601: static MySQL_Driver Driver;
602: return &Driver;
1.1 parser 603: }