mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
client/mysqltest.c
added send/reap/dirty_close include/mysql.h mysql_send_query()/mysql_reap_query() libmysql/libmysql.c mysql_send_query()/mysql_reap_query() mysys/my_vsnprintf.c fixed critical bug that codedumped when connection aborted sql/sql_parse.cc 0 mysql-test/r/dirty-close.result New BitKeeper file ``mysql-test/r/dirty-close.result'' mysql-test/t/dirty-close.test New BitKeeper file ``mysql-test/t/dirty-close.test''
This commit is contained in:
@ -1708,6 +1708,71 @@ 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
|
||||
*/
|
||||
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)
|
||||
{
|
||||
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)
|
||||
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)
|
||||
|
Reference in New Issue
Block a user