1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00
prepared statements in embedded library


include/mysql.h:
  Another 'virtual' method
libmysql/client_settings.h:
  client implementation declared
libmysql/libmysql.c:
  mysql_execute edited to work with embedded implementation
libmysqld/lib_sql.cc:
  one error fixed (we do need parameter's buffer in embedded library)
  embedded recordset transfer methods implementations added
sql-common/client.c:
  method added to the table
sql/client_settings.h:
  no prepared statements in mimiclient
sql/mysql_priv.h:
  these functions became global
sql/protocol.cc:
  the stub added
sql/protocol.h:
  had to change Protocol's interface for embedded library
sql/sql_class.h:
  i changed this only for embedded case, but i think it's better to do the
  same for remote server also
sql/sql_prepare.cc:
  parts of code #ifndef-ed
This commit is contained in:
unknown
2003-09-17 20:48:53 +05:00
parent 11d36fa831
commit 194f6725d4
11 changed files with 191 additions and 29 deletions

View File

@ -55,3 +55,4 @@ my_bool STDCALL cli_read_prepare_result(MYSQL *mysql, MYSQL_STMT *stmt);
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);

View File

@ -1601,15 +1601,6 @@ my_bool STDCALL cli_read_prepare_result(MYSQL *mysql, MYSQL_STMT *stmt)
}
stmt->field_count= (uint) field_count;
stmt->param_count= (ulong) param_count;
if (!(stmt->params= (MYSQL_BIND *) alloc_root(&stmt->mem_root,
sizeof(MYSQL_BIND)*
(stmt->param_count +
stmt->field_count))))
{
set_stmt_error(stmt, CR_OUT_OF_MEMORY, unknown_sqlstate);
DBUG_RETURN(1);
}
stmt->bind= stmt->params + stmt->param_count;
DBUG_RETURN(0);
}
@ -1660,6 +1651,15 @@ mysql_prepare(MYSQL *mysql, const char *query, ulong length)
DBUG_RETURN(0);
}
if (!(stmt->params= (MYSQL_BIND *) alloc_root(&stmt->mem_root,
sizeof(MYSQL_BIND)*
(stmt->param_count +
stmt->field_count))))
{
set_stmt_error(stmt, CR_OUT_OF_MEMORY, unknown_sqlstate);
DBUG_RETURN(0);
}
stmt->bind= stmt->params + stmt->param_count;
stmt->state= MY_ST_PREPARE;
stmt->mysql= mysql;
mysql->stmts= list_add(mysql->stmts, &stmt->list);
@ -3080,7 +3080,7 @@ no_data:
Read all rows of data from server (binary format)
*/
static MYSQL_DATA *read_binary_rows(MYSQL_STMT *stmt)
MYSQL_DATA *cli_read_binary_rows(MYSQL_STMT *stmt)
{
ulong pkt_len;
uchar *cp;
@ -3176,7 +3176,7 @@ int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt)
}
result->methods= mysql->methods;
stmt->result_buffered= 1;
if (!(result->data= read_binary_rows(stmt)))
if (!(result->data= (*stmt->mysql->methods->read_binary_rows)(stmt)))
{
my_free((gptr) result,MYF(0));
DBUG_RETURN(0);