--- parser3/src/sql/mysql/Attic/parser3mysql.C 2001/04/17 15:13:42 1.13.2.4 +++ parser3/src/sql/mysql/Attic/parser3mysql.C 2001/04/17 19:00:51 1.14 @@ -5,7 +5,7 @@ Author: Alexander Petrosyan (http://design.ru/paf) - $Id: parser3mysql.C,v 1.13.2.4 2001/04/17 15:13:42 paf Exp $ + $Id: parser3mysql.C,v 1.14 2001/04/17 19:00:51 paf Exp $ */ #include "config_includes.h" @@ -144,6 +144,9 @@ public: } *column_count=mysql_num_fields(res); + if(!*column_count) // old client + *column_count=mysql_field_count(mysql); + *columns=(Cell *)services->malloc(sizeof(Cell)*(*column_count)); *row_count=(unsigned long)mysql_num_rows(res); @@ -175,23 +178,14 @@ public: private: // mysql client library funcs -#ifndef STDCALL -# if !defined(WIN32) -# define STDCALL -# else -# define STDCALL __stdcall -# endif -#endif - typedef MYSQL* (STDCALL *t_mysql_init)(MYSQL *); t_mysql_init mysql_init; + typedef MYSQL_RES* (STDCALL *t_mysql_store_result)(MYSQL *); t_mysql_store_result mysql_store_result; + typedef int (STDCALL *t_mysql_query)(MYSQL *, const char *q); t_mysql_query mysql_query; + typedef char * (STDCALL *t_mysql_error)(MYSQL *); t_mysql_error mysql_error; -#ifndef mysql_error - static char* STDCALL subst_mysql_error(MYSQL *mysql) { - return (mysql)->net.last_error; - } -#endif + static char* STDCALL subst_mysql_error(MYSQL *mysql) { return (mysql)->net.last_error; } typedef MYSQL* (STDCALL *t_mysql_real_connect)(MYSQL *, const char *host, const char *user, @@ -202,32 +196,28 @@ private: // mysql client library funcs unsigned int clientflag); t_mysql_real_connect mysql_real_connect; typedef void (STDCALL *t_mysql_close)(MYSQL *); t_mysql_close mysql_close; + typedef int (STDCALL *t_mysql_ping)(MYSQL *); t_mysql_ping mysql_ping; + typedef unsigned long (STDCALL *t_mysql_escape_string)(char *to,const char *from, unsigned long from_length); t_mysql_escape_string mysql_escape_string; + typedef void (STDCALL *t_mysql_free_result)(MYSQL_RES *result); t_mysql_free_result mysql_free_result; + typedef unsigned long* (STDCALL *t_mysql_fetch_lengths)(MYSQL_RES *result); t_mysql_fetch_lengths mysql_fetch_lengths; + typedef MYSQL_ROW (STDCALL *t_mysql_fetch_row)(MYSQL_RES *result); t_mysql_fetch_row mysql_fetch_row; + typedef MYSQL_FIELD* (STDCALL *t_mysql_fetch_field)(MYSQL_RES *result); t_mysql_fetch_field mysql_fetch_field; + typedef my_ulonglong (STDCALL *t_mysql_num_rows)(MYSQL_RES *); t_mysql_num_rows mysql_num_rows; -#ifndef mysql_num_rows - static my_ulonglong STDCALL subst_mysql_num_rows(MYSQL_RES *res) { - return res->row_count; - } -#endif + static my_ulonglong STDCALL subst_mysql_num_rows(MYSQL_RES *res) { return res->row_count; } + typedef unsigned int (STDCALL *t_mysql_num_fields)(MYSQL_RES *); t_mysql_num_fields mysql_num_fields; -#ifndef mysql_num_fields - static unsigned int STDCALL subst_mysql_num_fields(MYSQL_RES *res) { - return res->field_count; - } -#endif + static unsigned int STDCALL subst_mysql_num_fields(MYSQL_RES *res) { return res->field_count; } typedef unsigned int (STDCALL *t_mysql_field_count)(MYSQL *); t_mysql_field_count mysql_field_count; -#ifndef mysql_field_count - static unsigned int STDCALL subst_mysql_field_count(MYSQL *mysql) { - return mysql->field_count; - } -#endif + static unsigned int STDCALL subst_mysql_field_count(MYSQL *mysql) { return mysql->field_count; } private: // mysql client library funcs linking