From 83e8881a5ad2a0fdfcb1ad06adca3614b6c7e0e4 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 19 Sep 2003 14:05:28 +0500 Subject: SCRUM prepared statements in embedded library. some fixes after testing include/mysql.h: virtual method added libmysql/client_settings.h: declaration added libmysql/libmysql.c: implementation added mysql_fetch changed to work in both libraries libmysqld/lib_sql.cc: implementation added sql-common/client.c: added items in methods table sql/client_settings.h: decided to remove such defines - i placed single #ifdef in client.c --- libmysql/client_settings.h | 1 + libmysql/libmysql.c | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) (limited to 'libmysql') diff --git a/libmysql/client_settings.h b/libmysql/client_settings.h index 4fdbab08969..d0432503ee9 100644 --- a/libmysql/client_settings.h +++ b/libmysql/client_settings.h @@ -56,3 +56,4 @@ MYSQL_DATA *cli_read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields, uint fields); int STDCALL cli_stmt_execute(MYSQL_STMT *stmt); MYSQL_DATA *cli_read_binary_rows(MYSQL_STMT *stmt); +int STDCALL cli_unbuffered_fetch(MYSQL *mysql, char **row); diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index c3592844024..debe3e54679 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -2965,6 +2965,14 @@ static int stmt_fetch_row(MYSQL_STMT *stmt, uchar *row) return 0; } +int STDCALL cli_unbuffered_fetch(MYSQL *mysql, char **row) +{ + if (packet_error == net_safe_read(mysql)) + return 1; + + *row= (mysql->net.read_pos[0] == 254) ? NULL : (mysql->net.read_pos+1); + return 0; +} /* Fetch and return row data to bound buffers, if any @@ -2994,20 +3002,20 @@ int STDCALL mysql_fetch(MYSQL_STMT *stmt) } else /* un-buffered */ { - if (packet_error == net_safe_read(mysql)) + if((*mysql->methods->unbuffered_fetch)(mysql, ( char **)&row)) { set_stmt_errmsg(stmt, mysql->net.last_error, mysql->net.last_errno, mysql->net.sqlstate); DBUG_RETURN(1); } - if (mysql->net.read_pos[0] == 254) + if (!row) { mysql->status= MYSQL_STATUS_READY; stmt->current_row= 0; goto no_data; } - row= mysql->net.read_pos+1; - } + } + stmt->current_row= row; DBUG_RETURN(stmt_fetch_row(stmt, row)); -- cgit v1.2.1