summaryrefslogtreecommitdiff
path: root/libmysql
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2004-12-31 00:50:30 +0200
committerunknown <monty@mysql.com>2004-12-31 00:50:30 +0200
commit12a215b0833d9aa688ba16fe56eb3411a83e7d4f (patch)
treed4dfebc9b9c93790a9be3f9e6807f3923a6b3d3e /libmysql
parentcdf70f2ede108267ce492abada82ca753f269e25 (diff)
parent2e8d13c73ec986dde580c9c840f421af4279611a (diff)
downloadmariadb-git-12a215b0833d9aa688ba16fe56eb3411a83e7d4f.tar.gz
Merge with global tree
BitKeeper/etc/logging_ok: auto-union client/mysqltest.c: Auto merged innobase/dict/dict0dict.c: Auto merged innobase/include/dict0dict.h: Auto merged libmysql/errmsg.c: Auto merged myisam/mi_open.c: Auto merged myisam/mi_write.c: Auto merged mysql-test/r/grant.result: Auto merged mysql-test/r/merge.result: Auto merged mysql-test/r/show_check.result: Auto merged mysql-test/t/derived.test: Auto merged mysql-test/t/merge.test: Auto merged mysql-test/t/show_check.test: Auto merged mysql-test/t/system_mysql_db_fix.test: Auto merged scripts/mysql_install_db.sh: Auto merged sql/ha_innodb.cc: Auto merged sql/handler.cc: Auto merged sql/item.cc: Auto merged sql/item_func.cc: Auto merged sql/mysql_priv.h: Auto merged sql/mysqld.cc: Auto merged sql/set_var.cc: Auto merged sql/sp.cc: Auto merged sql/sql_acl.cc: Auto merged sql/sql_base.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_lex.cc: Auto merged sql/sql_lex.h: Auto merged sql/sql_parse.cc: Auto merged sql/sql_select.cc: Auto merged sql/sql_show.cc: Auto merged sql/sql_yacc.yy: Auto merged sql/table.cc: Auto merged sql/table.h: Auto merged sql/tztime.h: Auto merged
Diffstat (limited to 'libmysql')
-rw-r--r--libmysql/errmsg.c12
-rw-r--r--libmysql/libmysql.c27
2 files changed, 25 insertions, 14 deletions
diff --git a/libmysql/errmsg.c b/libmysql/errmsg.c
index 73726e772e5..90ad3aefaca 100644
--- a/libmysql/errmsg.c
+++ b/libmysql/errmsg.c
@@ -78,7 +78,9 @@ const char *client_errors[]=
"Invalid connection handle",
"Connection using old (pre-4.1.1) authentication protocol refused (client option 'secure_auth' enabled)",
"Row retrieval was canceled by mysql_stmt_close() call",
- "Attempt to read column without prior row fetch"
+ "Attempt to read column without prior row fetch",
+ "Prepared statement contains no metadata",
+ ""
};
/* Start of code added by Roberto M. Serqueira - martinsc@uol.com.br - 05.24.2001 */
@@ -137,7 +139,9 @@ const char *client_errors[]=
"Invalid connection handle",
"Connection using old (pre-4.1.1) authentication protocol refused (client option 'secure_auth' enabled)",
"Row retrieval was canceled by mysql_stmt_close() call",
- "Attempt to read column without prior row fetch"
+ "Attempt to read column without prior row fetch",
+ "Prepared statement contains no metadata",
+ ""
};
#else /* ENGLISH */
@@ -194,7 +198,9 @@ const char *client_errors[]=
"Invalid connection handle",
"Connection using old (pre-4.1.1) authentication protocol refused (client option 'secure_auth' enabled)",
"Row retrieval was canceled by mysql_stmt_close() call",
- "Attempt to read column without prior row fetch"
+ "Attempt to read column without prior row fetch",
+ "Prepared statement contains no metadata",
+ ""
};
#endif
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c
index 5ddc3402c88..b791090346b 100644
--- a/libmysql/libmysql.c
+++ b/libmysql/libmysql.c
@@ -159,7 +159,7 @@ int STDCALL mysql_server_init(int argc __attribute__((unused)),
#endif
#ifdef EMBEDDED_LIBRARY
if (argc > -1)
- result= init_embedded_server(argc, argv, groups);
+ result= init_embedded_server(argc, argv, groups);
#endif
}
#ifdef THREAD
@@ -2167,12 +2167,12 @@ static void update_stmt_fields(MYSQL_STMT *stmt)
DESCRIPTION
This function should be used after mysql_stmt_execute().
You can safely check that prepared statement has a result set by calling
- mysql_stmt_num_fields(): if number of fields is not zero, you can call
+ mysql_stmt_field_count(): if number of fields is not zero, you can call
this function to get fields metadata.
Next steps you may want to make:
- find out number of columns in result set by calling
mysql_num_fields(res) (the same value is returned by
- mysql_stmt_num_fields)
+ mysql_stmt_field_count())
- fetch metadata for any column with mysql_fetch_field,
mysql_fetch_field_direct, mysql_fetch_fields, mysql_field_seek.
- free returned MYSQL_RES structure with mysql_free_result.
@@ -3877,8 +3877,8 @@ static void fetch_result_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
case MYSQL_TYPE_INT24: /* mediumint is sent as 4 bytes int */
case MYSQL_TYPE_LONG:
{
- long value= sint4korr(*row);
- longlong data= field_is_unsigned ? (longlong) (unsigned long) value :
+ int32 value= sint4korr(*row);
+ longlong data= field_is_unsigned ? (longlong) (uint32) value :
(longlong) value;
fetch_long_with_conversion(param, field, data, 0);
*row+= 4;
@@ -4336,11 +4336,10 @@ my_bool STDCALL mysql_stmt_bind_result(MYSQL_STMT *stmt, MYSQL_BIND *bind)
if (!bind_count)
{
- if ((int) stmt->state < (int) MYSQL_STMT_PREPARE_DONE)
- {
- set_stmt_error(stmt, CR_NO_PREPARE_STMT, unknown_sqlstate);
- }
- DBUG_RETURN(0);
+ int errorcode= (int) stmt->state < (int) MYSQL_STMT_PREPARE_DONE ?
+ CR_NO_PREPARE_STMT : CR_NO_STMT_METADATA;
+ set_stmt_error(stmt, errorcode, unknown_sqlstate);
+ DBUG_RETURN(1);
}
/*
@@ -4625,7 +4624,7 @@ static void stmt_update_metadata(MYSQL_STMT *stmt, MYSQL_ROWS *data)
row+= (stmt->field_count+9)/8; /* skip null bits */
bit= 4; /* first 2 bits are reserved */
- /* Go throw all fields and calculate metadata */
+ /* Go through all fields and calculate metadata */
for (bind= stmt->bind, end= bind + stmt->field_count, field= stmt->fields ;
bind < end ;
bind++, field++)
@@ -4760,6 +4759,12 @@ mysql_stmt_data_seek(MYSQL_STMT *stmt, my_ulonglong row)
for (; tmp && row; --row, tmp= tmp->next)
;
stmt->data_cursor= tmp;
+ if (!row && tmp)
+ {
+ /* Rewind the counter */
+ stmt->read_row_func= stmt_read_row_buffered;
+ stmt->state= MYSQL_STMT_EXECUTE_DONE;
+ }
DBUG_VOID_RETURN;
}