diff options
Diffstat (limited to 'libmysql/libmysql.c')
-rw-r--r-- | libmysql/libmysql.c | 70 |
1 files changed, 10 insertions, 60 deletions
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 977657f8998..829ee09090e 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -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)))) @@ -2086,19 +2078,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); @@ -2144,19 +2123,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 +2245,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 +2814,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 +2984,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 +3023,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 +3041,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) |