mirror of
https://github.com/MariaDB/server.git
synced 2025-06-16 11:21:15 +03:00
Merge mysql.com:/home/pem/work/mysql-4.1
into mysql.com:/home/pem/work/mysql-5.0-merge
This commit is contained in:
@ -1653,14 +1653,6 @@ mysql_prepare(MYSQL *mysql, const char *query, ulong length)
|
||||
DBUG_ENTER("mysql_prepare");
|
||||
DBUG_ASSERT(mysql != 0);
|
||||
|
||||
#ifdef CHECK_EXTRA_ARGUMENTS
|
||||
if (!query)
|
||||
{
|
||||
set_mysql_error(mysql, CR_NULL_POINTER, unknown_sqlstate);
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!(stmt= (MYSQL_STMT *) my_malloc(sizeof(MYSQL_STMT),
|
||||
MYF(MY_WME | MY_ZEROFILL))) ||
|
||||
!(stmt->query= my_strdup_with_length((byte *) query, length, MYF(0))))
|
||||
@ -2018,6 +2010,7 @@ static my_bool execute(MYSQL_STMT * stmt, char *packet, ulong length)
|
||||
set_stmt_errmsg(stmt, net->last_error, net->last_errno, net->sqlstate);
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
stmt->affected_rows= mysql->affected_rows;
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
@ -2086,19 +2079,6 @@ int STDCALL mysql_execute(MYSQL_STMT *stmt)
|
||||
{
|
||||
DBUG_ENTER("mysql_execute");
|
||||
|
||||
if (stmt->state == MY_ST_UNKNOWN)
|
||||
{
|
||||
set_stmt_error(stmt, CR_NO_PREPARE_STMT, unknown_sqlstate);
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
#ifdef CHECK_EXTRA_ARGUMENTS
|
||||
if (stmt->param_count && !stmt->param_buffers)
|
||||
{
|
||||
/* Parameters exists, but no bound buffers */
|
||||
set_stmt_error(stmt, CR_NOT_ALL_PARAMS_BOUND, unknown_sqlstate);
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
#endif
|
||||
if ((*stmt->mysql->methods->stmt_execute)(stmt))
|
||||
DBUG_RETURN(1);
|
||||
|
||||
@ -2127,7 +2107,7 @@ ulong STDCALL mysql_param_count(MYSQL_STMT * stmt)
|
||||
|
||||
my_ulonglong STDCALL mysql_stmt_affected_rows(MYSQL_STMT *stmt)
|
||||
{
|
||||
return stmt->mysql->last_used_con->affected_rows;
|
||||
return stmt->affected_rows;
|
||||
}
|
||||
|
||||
|
||||
@ -2144,19 +2124,6 @@ my_bool STDCALL mysql_bind_param(MYSQL_STMT *stmt, MYSQL_BIND * bind)
|
||||
MYSQL_BIND *param, *end;
|
||||
DBUG_ENTER("mysql_bind_param");
|
||||
|
||||
#ifdef CHECK_EXTRA_ARGUMENTS
|
||||
if (stmt->state == MY_ST_UNKNOWN)
|
||||
{
|
||||
set_stmt_error(stmt, CR_NO_PREPARE_STMT, unknown_sqlstate);
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
if (!stmt->param_count)
|
||||
{
|
||||
set_stmt_error(stmt, CR_NO_PARAMETERS_EXISTS, unknown_sqlstate);
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Allocated on prepare */
|
||||
memcpy((char*) stmt->params, (char*) bind,
|
||||
sizeof(MYSQL_BIND) * stmt->param_count);
|
||||
@ -2279,11 +2246,6 @@ mysql_send_long_data(MYSQL_STMT *stmt, uint param_number,
|
||||
DBUG_PRINT("enter",("param no : %d, data : %lx, length : %ld",
|
||||
param_number, data, length));
|
||||
|
||||
if (param_number >= stmt->param_count)
|
||||
{
|
||||
set_stmt_error(stmt, CR_INVALID_PARAMETER_NO, unknown_sqlstate);
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
param= stmt->params+param_number;
|
||||
if (param->buffer_type < MYSQL_TYPE_TINY_BLOB ||
|
||||
param->buffer_type > MYSQL_TYPE_STRING)
|
||||
@ -2853,18 +2815,6 @@ my_bool STDCALL mysql_bind_result(MYSQL_STMT *stmt, MYSQL_BIND *bind)
|
||||
DBUG_ENTER("mysql_bind_result");
|
||||
DBUG_ASSERT(stmt != 0);
|
||||
|
||||
#ifdef CHECK_EXTRA_ARGUMENTS
|
||||
if (stmt->state == MY_ST_UNKNOWN)
|
||||
{
|
||||
set_stmt_error(stmt, CR_NO_PREPARE_STMT, unknown_sqlstate);
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
if (!bind)
|
||||
{
|
||||
set_stmt_error(stmt, CR_NULL_POINTER, unknown_sqlstate);
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
#endif
|
||||
if (!(bind_count= stmt->field_count) &&
|
||||
!(bind_count= alloc_stmt_fields(stmt)))
|
||||
DBUG_RETURN(0);
|
||||
@ -3035,6 +2985,15 @@ int STDCALL mysql_fetch(MYSQL_STMT *stmt)
|
||||
}
|
||||
else /* un-buffered */
|
||||
{
|
||||
if (mysql->status != MYSQL_STATUS_GET_RESULT)
|
||||
{
|
||||
if (!stmt->field_count)
|
||||
goto no_data;
|
||||
|
||||
set_stmt_error(stmt, CR_COMMANDS_OUT_OF_SYNC, unknown_sqlstate);
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
|
||||
if((*mysql->methods->unbuffered_fetch)(mysql, ( char **)&row))
|
||||
{
|
||||
set_stmt_errmsg(stmt, mysql->net.last_error, mysql->net.last_errno,
|
||||
@ -3065,7 +3024,7 @@ no_data:
|
||||
mysql_fetch_column()
|
||||
stmt Prepared statement handler
|
||||
bind Where data should be placed. Should be filled in as
|
||||
when calling mysql_bind_param()
|
||||
when calling mysql_bind_result()
|
||||
column Column to fetch (first column is 0)
|
||||
ulong offset Offset in result data (to fetch blob in pieces)
|
||||
This is normally 0
|
||||
@ -3083,14 +3042,6 @@ int STDCALL mysql_fetch_column(MYSQL_STMT *stmt, MYSQL_BIND *bind,
|
||||
if (!stmt->current_row)
|
||||
goto no_data;
|
||||
|
||||
#ifdef CHECK_EXTRA_ARGUMENTS
|
||||
if (column >= stmt->field_count)
|
||||
{
|
||||
set_stmt_errmsg(stmt, "Invalid column descriptor",1, unknown_sqlstate);
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (param->null_field)
|
||||
{
|
||||
if (bind->is_null)
|
||||
@ -3224,6 +3175,7 @@ int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt)
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
mysql->affected_rows= result->row_count= result->data->rows;
|
||||
stmt->affected_rows= result->row_count;
|
||||
result->data_cursor= result->data->data;
|
||||
result->fields= stmt->fields;
|
||||
result->field_count= stmt->field_count;
|
||||
@ -3511,7 +3463,6 @@ my_bool STDCALL mysql_more_results(MYSQL *mysql)
|
||||
/*
|
||||
Reads and returns the next query results
|
||||
*/
|
||||
|
||||
int STDCALL mysql_next_result(MYSQL *mysql)
|
||||
{
|
||||
DBUG_ENTER("mysql_next_result");
|
||||
@ -3530,8 +3481,8 @@ int STDCALL mysql_next_result(MYSQL *mysql)
|
||||
mysql->affected_rows= ~(my_ulonglong) 0;
|
||||
|
||||
if (mysql->last_used_con->server_status & SERVER_MORE_RESULTS_EXISTS)
|
||||
DBUG_RETURN((*mysql->methods->read_query_result)(mysql));
|
||||
|
||||
DBUG_RETURN((*mysql->methods->next_result)(mysql));
|
||||
|
||||
DBUG_RETURN(-1); /* No more results */
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user