1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00
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
This commit is contained in:
unknown
2003-09-19 14:05:28 +05:00
parent 4c63804846
commit 83e8881a5a
6 changed files with 46 additions and 16 deletions

View File

@ -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);

View File

@ -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));