mirror of
https://github.com/MariaDB/server.git
synced 2025-06-13 13:01:51 +03:00
Merged some functions and removed some unused client functions.
Remember UNION for ALTER TABLE Added test for if we are supporting transactions. Don't allow REPLACE to replace a row when we have generated an auto_increment key Fixed bug when using BLOB keys Fixed bug in SET @variable=user. Docs/manual.texi: Added some examples and moved the Error access denied section to the error section. client/mysqltest.c: Changed to use the new mysql_send_query() include/mysql.h: Changed mysql_reap_query() to mysql_send_query(). libmysql/libmysql.c: Changed mysql_reap_query() to mysql_send_query() Merged some functions and removed some unused functions. mysql-test/r/bdb.result: New test case mysql-test/r/distinct.result: New test case mysql-test/r/key.result: New test case mysql-test/r/merge.result: New test case mysql-test/r/replace.result: New test case mysql-test/t/bdb.test: New test case mysql-test/t/key.test: New test case mysql-test/t/merge.test: New test case mysql-test/t/replace.test: New test case mysys/my_lock.c: Moved global lock variable to static sql-bench/test-insert.sh: Added test case for index-read only sql/field.h: Fixed that one can optimize ORDER BY with ISAM and GEMINI sql/ha_berkeley.cc: Added type casts needed for Windows sql/ha_innobase.cc: Removed reference to manual from comment. sql/ha_myisammrg.cc: Remember UNION for ALTER TABLE sql/ha_myisammrg.h: Remember UNION for ALTER TABLE sql/handler.cc: Added test for if we are supporting transactions. Don't allow REPLACE to replace a row when we have generated an auto_increment key. sql/handler.h: Remember UNION for ALTER TABLE sql/key.cc: Fixed bug when using BLOB keys sql/mysql_priv.h: Added new variables sql/mysqld.cc: Added new variables sql/opt_range.cc: Fixed problem with BLOB keys sql/opt_sum.cc: Fix for BLOB keys sql/sql_class.cc: Added test if we need to init/clean transaction variables sql/sql_insert.cc: Fix for REPLACE and auto_increment keys sql/sql_parse.cc: Fixed bug in max_user_connections sql/sql_select.cc: Fixed problem with key on BLOB sql/sql_yacc.yy: Fixed bug in SET @variable=user. sql/table.cc: Fixed problem with keys on BLOB
This commit is contained in:
@ -1700,87 +1700,30 @@ mysql_query(MYSQL *mysql, const char *query)
|
||||
return mysql_real_query(mysql,query, (uint) strlen(query));
|
||||
}
|
||||
|
||||
int STDCALL
|
||||
mysql_send_query(MYSQL* mysql, const char* query)
|
||||
{
|
||||
return mysql_real_send_query(mysql, query, strlen(query));
|
||||
}
|
||||
|
||||
/* send the query and return so we can do something else */
|
||||
/* needs to be followed by mysql_reap_query() when we want to
|
||||
finish processing it
|
||||
/*
|
||||
Send the query and return so we can do something else.
|
||||
Needs to be followed by mysql_read_query_result() when we want to
|
||||
finish processing it.
|
||||
*/
|
||||
int STDCALL
|
||||
mysql_real_send_query(MYSQL* mysql, const char* query, uint len)
|
||||
{
|
||||
return simple_command(mysql, COM_QUERY, query, len, 1);
|
||||
}
|
||||
|
||||
int STDCALL
|
||||
mysql_reap_query(MYSQL* mysql)
|
||||
mysql_send_query(MYSQL* mysql, const char* query, uint length)
|
||||
{
|
||||
return simple_command(mysql, COM_QUERY, query, length, 1);
|
||||
}
|
||||
|
||||
int STDCALL mysql_read_query_result(MYSQL *mysql)
|
||||
{
|
||||
uchar *pos;
|
||||
ulong field_count;
|
||||
MYSQL_DATA *fields;
|
||||
uint len;
|
||||
DBUG_ENTER("mysql_reap_query");
|
||||
DBUG_PRINT("enter",("handle: %lx",mysql));
|
||||
if((len = net_safe_read(mysql)) == packet_error)
|
||||
uint length;
|
||||
DBUG_ENTER("mysql_read_query_result");
|
||||
|
||||
if ((length = net_safe_read(mysql)) == packet_error)
|
||||
DBUG_RETURN(-1);
|
||||
free_old_query(mysql); /* Free old result */
|
||||
get_info:
|
||||
pos=(uchar*) mysql->net.read_pos;
|
||||
if ((field_count= net_field_length(&pos)) == 0)
|
||||
{
|
||||
mysql->affected_rows= net_field_length_ll(&pos);
|
||||
mysql->insert_id= net_field_length_ll(&pos);
|
||||
if (mysql->server_capabilities & CLIENT_TRANSACTIONS)
|
||||
{
|
||||
mysql->server_status=uint2korr(pos); pos+=2;
|
||||
}
|
||||
if (pos < mysql->net.read_pos+len && net_field_length(&pos))
|
||||
mysql->info=(char*) pos;
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
if (field_count == NULL_LENGTH) /* LOAD DATA LOCAL INFILE */
|
||||
{
|
||||
int error=send_file_to_server(mysql,(char*) pos);
|
||||
if ((len=net_safe_read(mysql)) == packet_error || error)
|
||||
DBUG_RETURN(-1);
|
||||
goto get_info; /* Get info packet */
|
||||
}
|
||||
if (!(mysql->server_status & SERVER_STATUS_AUTOCOMMIT))
|
||||
mysql->server_status|= SERVER_STATUS_IN_TRANS;
|
||||
|
||||
mysql->extra_info= net_field_length_ll(&pos); /* Maybe number of rec */
|
||||
if (!(fields=read_rows(mysql,(MYSQL_FIELD*) 0,5)))
|
||||
DBUG_RETURN(-1);
|
||||
if (!(mysql->fields=unpack_fields(fields,&mysql->field_alloc,
|
||||
(uint) field_count,0,
|
||||
(my_bool) test(mysql->server_capabilities &
|
||||
CLIENT_LONG_FLAG))))
|
||||
DBUG_RETURN(-1);
|
||||
mysql->status=MYSQL_STATUS_GET_RESULT;
|
||||
mysql->field_count=field_count;
|
||||
DBUG_RETURN(0);
|
||||
|
||||
}
|
||||
|
||||
int STDCALL
|
||||
mysql_real_query(MYSQL *mysql, const char *query, uint length)
|
||||
{
|
||||
uchar *pos;
|
||||
ulong field_count;
|
||||
MYSQL_DATA *fields;
|
||||
DBUG_ENTER("mysql_real_query");
|
||||
DBUG_PRINT("enter",("handle: %lx",mysql));
|
||||
DBUG_PRINT("query",("Query = \"%s\"",query));
|
||||
|
||||
if (simple_command(mysql,COM_QUERY,query,length,1) ||
|
||||
(length=net_safe_read(mysql)) == packet_error)
|
||||
DBUG_RETURN(-1);
|
||||
free_old_query(mysql); /* Free old result */
|
||||
get_info:
|
||||
get_info:
|
||||
pos=(uchar*) mysql->net.read_pos;
|
||||
if ((field_count= net_field_length(&pos)) == 0)
|
||||
{
|
||||
@ -1817,6 +1760,16 @@ mysql_real_query(MYSQL *mysql, const char *query, uint length)
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
int STDCALL
|
||||
mysql_real_query(MYSQL *mysql, const char *query, uint length)
|
||||
{
|
||||
DBUG_ENTER("mysql_real_query");
|
||||
DBUG_PRINT("enter",("handle: %lx",mysql));
|
||||
DBUG_PRINT("query",("Query = \"%s\"",query));
|
||||
if (simple_command(mysql,COM_QUERY,query,length,1))
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(mysql_read_query_result(mysql));
|
||||
}
|
||||
|
||||
static int
|
||||
send_file_to_server(MYSQL *mysql, const char *filename)
|
||||
|
Reference in New Issue
Block a user