mirror of
https://github.com/MariaDB/server.git
synced 2025-01-27 09:14:17 +01:00
SCRUM
prepared statements in embedded library include/mysql_com.h: to make net_flush() working in expressions libmysqld/lib_sql.cc: some bugs fixed libmysqld/libmysqld.c: we already have the define in client_settings.h sql/protocol.cc: net_store_data should work that way in Protocol_prep (embedded server) sql/protocol.h: definition for net_store_data sql/sql_prepare.cc: now it works in embedded library
This commit is contained in:
parent
d1e3e9f38f
commit
4535f6897f
6 changed files with 15 additions and 9 deletions
|
@ -245,7 +245,7 @@ my_bool net_realloc(NET *net, unsigned long length);
|
||||||
#ifndef EMBEDDED_LIBRARY /* To be removed by HF */
|
#ifndef EMBEDDED_LIBRARY /* To be removed by HF */
|
||||||
my_bool net_flush(NET *net);
|
my_bool net_flush(NET *net);
|
||||||
#else
|
#else
|
||||||
#define net_flush(A)
|
#define net_flush(A) ((my_bool)0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
my_bool my_net_write(NET *net,const char *packet,unsigned long len);
|
my_bool my_net_write(NET *net,const char *packet,unsigned long len);
|
||||||
|
|
|
@ -80,6 +80,12 @@ emb_advanced_command(MYSQL *mysql, enum enum_server_command command,
|
||||||
client). So we have to call free_old_query here
|
client). So we have to call free_old_query here
|
||||||
*/
|
*/
|
||||||
free_old_query(mysql);
|
free_old_query(mysql);
|
||||||
|
if (!arg)
|
||||||
|
{
|
||||||
|
arg= header;
|
||||||
|
arg_length= header_length;
|
||||||
|
}
|
||||||
|
|
||||||
result= dispatch_command(command, thd, (char *) arg, arg_length + 1);
|
result= dispatch_command(command, thd, (char *) arg, arg_length + 1);
|
||||||
|
|
||||||
if (!skip_check)
|
if (!skip_check)
|
||||||
|
@ -136,6 +142,7 @@ static my_bool STDCALL emb_read_prepare_result(MYSQL *mysql, MYSQL_STMT *stmt)
|
||||||
|
|
||||||
stmt->fields= mysql->fields;
|
stmt->fields= mysql->fields;
|
||||||
stmt->mem_root= mysql->field_alloc;
|
stmt->mem_root= mysql->field_alloc;
|
||||||
|
mysql->fields= NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -550,7 +557,7 @@ bool Protocol_prep::write()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
cur->data= (MYSQL_ROW)(((char *)cur) + sizeof(MYSQL_ROWS));
|
cur->data= (MYSQL_ROW)(((char *)cur) + sizeof(MYSQL_ROWS));
|
||||||
memcpy(cur->data, packet->ptr(), packet->length());
|
memcpy(cur->data, packet->ptr()+1, packet->length()-1);
|
||||||
|
|
||||||
*data->prev_ptr= cur;
|
*data->prev_ptr= cur;
|
||||||
data->prev_ptr= &cur->next;
|
data->prev_ptr= &cur->next;
|
||||||
|
@ -674,7 +681,7 @@ bool setup_params_data(st_prep_stmt *stmt)
|
||||||
setup_param_functions(param, client_param->buffer_type);
|
setup_param_functions(param, client_param->buffer_type);
|
||||||
if (!param->long_data_supplied)
|
if (!param->long_data_supplied)
|
||||||
{
|
{
|
||||||
if (client_param->is_null)
|
if (*client_param->is_null)
|
||||||
param->maybe_null= param->null_value= 1;
|
param->maybe_null= param->null_value= 1;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -712,7 +719,7 @@ bool setup_params_data_withlog(st_prep_stmt *stmt)
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (client_param->is_null)
|
if (*client_param->is_null)
|
||||||
{
|
{
|
||||||
param->maybe_null= param->null_value= 1;
|
param->maybe_null= param->null_value= 1;
|
||||||
res= &null_string;
|
res= &null_string;
|
||||||
|
|
|
@ -47,8 +47,6 @@
|
||||||
#define INADDR_NONE -1
|
#define INADDR_NONE -1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define CLIENT_CAPABILITIES (CLIENT_LONG_PASSWORD | CLIENT_LONG_FLAG | CLIENT_TRANSACTIONS | CLIENT_PROTOCOL_41)
|
|
||||||
|
|
||||||
#if defined(MSDOS) || defined(__WIN__)
|
#if defined(MSDOS) || defined(__WIN__)
|
||||||
#define ERRNO WSAGetLastError()
|
#define ERRNO WSAGetLastError()
|
||||||
#define perror(A)
|
#define perror(A)
|
||||||
|
|
|
@ -28,6 +28,9 @@
|
||||||
|
|
||||||
#ifndef EMBEDDED_LIBRARY
|
#ifndef EMBEDDED_LIBRARY
|
||||||
bool Protocol::net_store_data(const char *from, uint length)
|
bool Protocol::net_store_data(const char *from, uint length)
|
||||||
|
#else
|
||||||
|
bool Protocol_prep::net_store_data(const char *from, uint length)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
ulong packet_length=packet->length();
|
ulong packet_length=packet->length();
|
||||||
/*
|
/*
|
||||||
|
@ -43,7 +46,6 @@ bool Protocol::net_store_data(const char *from, uint length)
|
||||||
packet->length((uint) (to+length-packet->ptr()));
|
packet->length((uint) (to+length-packet->ptr()));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* Send a error string to client */
|
/* Send a error string to client */
|
||||||
|
|
|
@ -127,6 +127,7 @@ public:
|
||||||
virtual void prepare_for_resend();
|
virtual void prepare_for_resend();
|
||||||
#ifdef EMBEDDED_LIBRARY
|
#ifdef EMBEDDED_LIBRARY
|
||||||
virtual bool write();
|
virtual bool write();
|
||||||
|
bool net_store_data(const char *from, uint length);
|
||||||
#endif
|
#endif
|
||||||
virtual bool store_null();
|
virtual bool store_null();
|
||||||
virtual bool store_tiny(longlong from);
|
virtual bool store_tiny(longlong from);
|
||||||
|
|
|
@ -666,13 +666,11 @@ static bool mysql_test_select_fields(PREP_STMT *stmt, TABLE_LIST *tables,
|
||||||
wild_num, conds, og_num, order, group, having, proc,
|
wild_num, conds, og_num, order, group, having, proc,
|
||||||
select_lex, unit, 0))
|
select_lex, unit, 0))
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
#ifndef EMBEDDED_LIBRARY
|
|
||||||
if (send_prep_stmt(stmt, fields.elements) ||
|
if (send_prep_stmt(stmt, fields.elements) ||
|
||||||
thd->protocol_simple.send_fields(&fields, 0) ||
|
thd->protocol_simple.send_fields(&fields, 0) ||
|
||||||
net_flush(&thd->net) ||
|
net_flush(&thd->net) ||
|
||||||
send_item_params(stmt))
|
send_item_params(stmt))
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
#endif
|
|
||||||
join->cleanup();
|
join->cleanup();
|
||||||
}
|
}
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
|
|
Loading…
Add table
Reference in a new issue