Commit c14de0f5 authored by venu@myvenu.com's avatar venu@myvenu.com

1. Portability fixups for Connector/ODBC 3.52 & DBD

    (Addition of mysql_fetch_column & mysql_stmt_free_result)
 2. Windows build fixups for libmysqld, mysqlbinlog and mysqldemb
parent 99ceb8fd
...@@ -87,6 +87,10 @@ LINK32=link.exe ...@@ -87,6 +87,10 @@ LINK32=link.exe
# Name "libmysqld - Win32 Debug" # Name "libmysqld - Win32 Debug"
# Begin Source File # Begin Source File
SOURCE=.\client.c
# End Source File
# Begin Source File
SOURCE=..\sql\derror.cpp SOURCE=..\sql\derror.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
...@@ -176,6 +180,10 @@ SOURCE=..\sql\item_func.cpp ...@@ -176,6 +180,10 @@ SOURCE=..\sql\item_func.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\item_geofunc.cpp
# End Source File
# Begin Source File
SOURCE=.\item_row.cpp SOURCE=.\item_row.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
...@@ -248,6 +256,10 @@ SOURCE=..\sql\opt_sum.cpp ...@@ -248,6 +256,10 @@ SOURCE=..\sql\opt_sum.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\libmysql\pack.c
# End Source File
# Begin Source File
SOURCE=..\libmysql\password.c SOURCE=..\libmysql\password.c
# End Source File # End Source File
# Begin Source File # Begin Source File
......
...@@ -88,6 +88,10 @@ LINK32=link.exe ...@@ -88,6 +88,10 @@ LINK32=link.exe
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File # Begin Source File
SOURCE=..\mysys\mf_tempdir.c
# End Source File
# Begin Source File
SOURCE=..\client\mysqlbinlog.cpp SOURCE=..\client\mysqlbinlog.cpp
# End Source File # End Source File
# End Group # End Group
......
...@@ -84,10 +84,6 @@ LIB32=xilink6.exe -lib ...@@ -84,10 +84,6 @@ LIB32=xilink6.exe -lib
# Name "mysqldemb - Win32 Debug" # Name "mysqldemb - Win32 Debug"
# Begin Source File # Begin Source File
SOURCE=..\sql\convert.cpp
# End Source File
# Begin Source File
SOURCE=..\sql\derror.cpp SOURCE=..\sql\derror.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
...@@ -220,10 +216,6 @@ SOURCE=..\sql\mf_iocache.cpp ...@@ -220,10 +216,6 @@ SOURCE=..\sql\mf_iocache.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\sql\mini_client.cpp
# End Source File
# Begin Source File
SOURCE=..\sql\net_serv.cpp SOURCE=..\sql\net_serv.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
......
...@@ -566,6 +566,7 @@ unsigned long STDCALL mysql_param_count(MYSQL_STMT * stmt); ...@@ -566,6 +566,7 @@ unsigned long STDCALL mysql_param_count(MYSQL_STMT * stmt);
my_bool STDCALL mysql_bind_param(MYSQL_STMT * stmt, MYSQL_BIND * bnd); my_bool STDCALL mysql_bind_param(MYSQL_STMT * stmt, MYSQL_BIND * bnd);
my_bool STDCALL mysql_bind_result(MYSQL_STMT * stmt, MYSQL_BIND * bnd); my_bool STDCALL mysql_bind_result(MYSQL_STMT * stmt, MYSQL_BIND * bnd);
my_bool STDCALL mysql_stmt_close(MYSQL_STMT * stmt); my_bool STDCALL mysql_stmt_close(MYSQL_STMT * stmt);
my_bool STDCALL mysql_stmt_free_result(MYSQL_STMT *stmt);
unsigned int STDCALL mysql_stmt_errno(MYSQL_STMT * stmt); unsigned int STDCALL mysql_stmt_errno(MYSQL_STMT * stmt);
const char *STDCALL mysql_stmt_error(MYSQL_STMT * stmt); const char *STDCALL mysql_stmt_error(MYSQL_STMT * stmt);
const char *STDCALL mysql_stmt_sqlstate(MYSQL_STMT * stmt); const char *STDCALL mysql_stmt_sqlstate(MYSQL_STMT * stmt);
......
...@@ -1581,7 +1581,7 @@ static my_bool read_prepare_result(MYSQL *mysql, MYSQL_STMT *stmt) ...@@ -1581,7 +1581,7 @@ static my_bool read_prepare_result(MYSQL *mysql, MYSQL_STMT *stmt)
mysql->server_status|= SERVER_STATUS_IN_TRANS; mysql->server_status|= SERVER_STATUS_IN_TRANS;
mysql->extra_info= net_field_length_ll(&pos); mysql->extra_info= net_field_length_ll(&pos);
if (!(fields_data= read_rows(mysql, (MYSQL_FIELD*) 0, 9))) if (!(fields_data= read_rows(mysql, (MYSQL_FIELD*) 0, 7)))
DBUG_RETURN(1); DBUG_RETURN(1);
if (!(stmt->fields= unpack_fields(fields_data,&stmt->mem_root, if (!(stmt->fields= unpack_fields(fields_data,&stmt->mem_root,
field_count,0, field_count,0,
...@@ -1921,7 +1921,7 @@ static void store_param_datetime(NET *net, MYSQL_BIND *param) ...@@ -1921,7 +1921,7 @@ static void store_param_datetime(NET *net, MYSQL_BIND *param)
static void store_param_str(NET *net, MYSQL_BIND *param) static void store_param_str(NET *net, MYSQL_BIND *param)
{ {
ulong length= min(*param->length, param->buffer_length); ulong length= param->length ? *param->length : param->buffer_length;
char *to= (char *) net_store_length((char *) net->write_pos, length); char *to= (char *) net_store_length((char *) net->write_pos, length);
memcpy(to, param->buffer, length); memcpy(to, param->buffer, length);
net->write_pos= (uchar*) to+length; net->write_pos= (uchar*) to+length;
...@@ -2442,7 +2442,7 @@ static void send_data_long(MYSQL_BIND *param, longlong value) ...@@ -2442,7 +2442,7 @@ static void send_data_long(MYSQL_BIND *param, longlong value)
} }
default: default:
{ {
char tmp[NAME_LEN]; char tmp[12];
uint length= (uint)(longlong10_to_str(value,(char *)tmp,10)-tmp); uint length= (uint)(longlong10_to_str(value,(char *)tmp,10)-tmp);
ulong copy_length= min((ulong)length-param->offset, param->buffer_length); ulong copy_length= min((ulong)length-param->offset, param->buffer_length);
memcpy(buffer, (char *)tmp+param->offset, copy_length); memcpy(buffer, (char *)tmp+param->offset, copy_length);
...@@ -2489,7 +2489,7 @@ static void send_data_double(MYSQL_BIND *param, double value) ...@@ -2489,7 +2489,7 @@ static void send_data_double(MYSQL_BIND *param, double value)
} }
default: default:
{ {
char tmp[NAME_LEN]; char tmp[12];
uint length= my_sprintf(tmp,(tmp,"%g",value)); uint length= my_sprintf(tmp,(tmp,"%g",value));
ulong copy_length= min((ulong)length-param->offset, param->buffer_length); ulong copy_length= min((ulong)length-param->offset, param->buffer_length);
memcpy(buffer, (char *)tmp+param->offset, copy_length); memcpy(buffer, (char *)tmp+param->offset, copy_length);
...@@ -2996,12 +2996,11 @@ int STDCALL mysql_fetch(MYSQL_STMT *stmt) ...@@ -2996,12 +2996,11 @@ int STDCALL mysql_fetch(MYSQL_STMT *stmt)
if (!res->data_cursor) if (!res->data_cursor)
{ {
res->current_row= 0; stmt->current_row= 0;
goto no_data; goto no_data;
} }
row= (uchar *)res->data_cursor->data; row= (uchar *)res->data_cursor->data;
res->data_cursor= res->data_cursor->next; res->data_cursor= res->data_cursor->next;
res->current_row= (MYSQL_ROW)row;
} }
else /* un-buffered */ else /* un-buffered */
{ {
...@@ -3018,8 +3017,8 @@ int STDCALL mysql_fetch(MYSQL_STMT *stmt) ...@@ -3018,8 +3017,8 @@ int STDCALL mysql_fetch(MYSQL_STMT *stmt)
goto no_data; goto no_data;
} }
row= mysql->net.read_pos+1; row= mysql->net.read_pos+1;
stmt->current_row= row; }
} stmt->current_row= row;
DBUG_RETURN(stmt_fetch_row(stmt, row)); DBUG_RETURN(stmt_fetch_row(stmt, row));
no_data: no_data:
...@@ -3040,12 +3039,7 @@ int STDCALL mysql_fetch_column(MYSQL_STMT *stmt, MYSQL_BIND *bind, ...@@ -3040,12 +3039,7 @@ int STDCALL mysql_fetch_column(MYSQL_STMT *stmt, MYSQL_BIND *bind,
DBUG_ENTER("mysql_fetch_column"); DBUG_ENTER("mysql_fetch_column");
if (stmt->result_buffered) if (!(row= stmt->current_row))
{
if (!stmt->result || !(row= (uchar *)stmt->result->current_row))
goto no_data;
}
else if (!(row= stmt->current_row))
goto no_data; goto no_data;
#ifdef CHECK_EXTRA_ARGUMENTS #ifdef CHECK_EXTRA_ARGUMENTS
...@@ -3343,18 +3337,15 @@ my_ulonglong STDCALL mysql_stmt_num_rows(MYSQL_STMT *stmt) ...@@ -3343,18 +3337,15 @@ my_ulonglong STDCALL mysql_stmt_num_rows(MYSQL_STMT *stmt)
0 ok 0 ok
1 error 1 error
*/ */
my_bool stmt_close(MYSQL_STMT *stmt, my_bool skip_list)
{ my_bool STDCALL mysql_stmt_free_result(MYSQL_STMT *stmt)
{
MYSQL *mysql; MYSQL *mysql;
DBUG_ENTER("mysql_stmt_close"); DBUG_ENTER("mysql_stmt_close");
DBUG_ASSERT(stmt != 0); DBUG_ASSERT(stmt != 0);
if (!(mysql= stmt->mysql)) mysql= stmt->mysql;
{
my_free((gptr) stmt, MYF(MY_WME));
DBUG_RETURN(0);
}
if (mysql->status != MYSQL_STATUS_READY) if (mysql->status != MYSQL_STATUS_READY)
{ {
/* Clear the current execution status */ /* Clear the current execution status */
...@@ -3369,6 +3360,23 @@ my_bool stmt_close(MYSQL_STMT *stmt, my_bool skip_list) ...@@ -3369,6 +3360,23 @@ my_bool stmt_close(MYSQL_STMT *stmt, my_bool skip_list)
} }
mysql->status= MYSQL_STATUS_READY; mysql->status= MYSQL_STATUS_READY;
} }
mysql_free_result(stmt->result);
DBUG_RETURN(0);
}
my_bool stmt_close(MYSQL_STMT *stmt, my_bool skip_list)
{
MYSQL *mysql;
DBUG_ENTER("mysql_stmt_close");
DBUG_ASSERT(stmt != 0);
if (!(mysql= stmt->mysql))
{
my_free((gptr) stmt, MYF(MY_WME));
DBUG_RETURN(0);
}
mysql_stmt_free_result(stmt);
if (stmt->state == MY_ST_PREPARE || stmt->state == MY_ST_EXECUTE) if (stmt->state == MY_ST_PREPARE || stmt->state == MY_ST_EXECUTE)
{ {
char buff[4]; char buff[4];
...@@ -3381,7 +3389,6 @@ my_bool stmt_close(MYSQL_STMT *stmt, my_bool skip_list) ...@@ -3381,7 +3389,6 @@ my_bool stmt_close(MYSQL_STMT *stmt, my_bool skip_list)
DBUG_RETURN(1); DBUG_RETURN(1);
} }
} }
mysql_free_result(stmt->result);
stmt->field_count= 0; stmt->field_count= 0;
free_root(&stmt->mem_root, MYF(0)); free_root(&stmt->mem_root, MYF(0));
if (!skip_list) if (!skip_list)
......
...@@ -115,6 +115,7 @@ EXPORTS ...@@ -115,6 +115,7 @@ EXPORTS
mysql_param_result mysql_param_result
mysql_prepare_result mysql_prepare_result
mysql_stmt_close mysql_stmt_close
mysql_stmt_free_result
mysql_stmt_error mysql_stmt_error
mysql_stmt_errno mysql_stmt_errno
mysql_fetch mysql_fetch
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment