1
0
mirror of https://github.com/MariaDB/server.git synced 2026-01-06 05:22:24 +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

@@ -77,7 +77,7 @@ Long data handling:
#define STMT_QUERY_LOG_LENGTH 8192
extern int yyparse(void *thd);
static String null_string("NULL", 4, default_charset_info);
String null_string("NULL", 4, default_charset_info);
/*
Find prepared statement in thd
@@ -353,7 +353,7 @@ static void setup_param_str(Item_param *param, uchar **pos)
*pos+= len;
}
static void setup_param_functions(Item_param *param, uchar param_type)
void setup_param_functions(Item_param *param, uchar param_type)
{
switch (param_type) {
case FIELD_TYPE_TINY:
@@ -399,6 +399,7 @@ static void setup_param_functions(Item_param *param, uchar param_type)
}
}
#ifndef EMBEDDED_LIBRARY
/*
Update the parameter markers by reading data from client packet
and if binary/update log is set, generate the valid query.
@@ -484,11 +485,7 @@ static bool setup_params_data(PREP_STMT *stmt)
Item_param *param;
DBUG_ENTER("setup_params_data");
#ifndef EMBEDDED_LIBRARY
uchar *pos=(uchar*) thd->net.read_pos+1+MYSQL_STMT_HEADER; //skip header
#else
uchar *pos= 0; //just to compile TODO code for embedded case
#endif
uchar *read_pos= pos+(stmt->param_count+7) / 8; //skip null bits
if (*read_pos++) //types supplied / first execute
@@ -508,6 +505,8 @@ static bool setup_params_data(PREP_STMT *stmt)
DBUG_RETURN(0);
}
#endif /*!EMBEDDED_LIBRARY*/
/*
Validate the following information for INSERT statement:
- field existance
@@ -792,10 +791,18 @@ static bool init_param_items(PREP_STMT *stmt)
if (mysql_bin_log.is_open() || mysql_update_log.is_open())
{
stmt->log_full_query= 1;
#ifndef EMBEDDED_LIBRARY
stmt->setup_params= insert_params_withlog;
#else
stmt->setup_params_data= setup_params_data_withlog;
#endif
}
else
#ifndef EMBEDDED_LIBRARY
stmt->setup_params= insert_params; // not fully qualified query
#else
stmt->setup_params_data= setup_params_data;
#endif
if (!stmt->param_count)
stmt->param= (Item_param **)0;
@@ -949,8 +956,13 @@ void mysql_stmt_execute(THD *thd, char *packet)
}
init_stmt_execute(stmt);
#ifndef EMBEDDED_LIBRARY
if (stmt->param_count && setup_params_data(stmt))
DBUG_VOID_RETURN;
#else
if (stmt->param_count && (*stmt->setup_params_data)(stmt))
DBUG_VOID_RETURN;
#endif
if (!(specialflag & SPECIAL_NO_PRIOR))
my_pthread_setprio(pthread_self(),QUERY_PRIOR);