mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
Merge
This commit is contained in:
@ -316,11 +316,11 @@ HANDLE create_named_pipe(NET *net, uint connect_timeout, char **arg_host,
|
||||
** or packet is an error message
|
||||
*****************************************************************************/
|
||||
|
||||
uint
|
||||
ulong
|
||||
net_safe_read(MYSQL *mysql)
|
||||
{
|
||||
NET *net= &mysql->net;
|
||||
uint len=0;
|
||||
ulong len=0;
|
||||
init_sigpipe_variables
|
||||
|
||||
/* Don't give sigpipe errors if the client doesn't want them */
|
||||
@ -338,7 +338,7 @@ net_safe_read(MYSQL *mysql)
|
||||
CR_NET_PACKET_TOO_LARGE:
|
||||
CR_SERVER_LOST);
|
||||
strmov(net->last_error,ER(net->last_errno));
|
||||
return(packet_error);
|
||||
return (packet_error);
|
||||
}
|
||||
if (net->read_pos[0] == 255)
|
||||
{
|
||||
@ -349,7 +349,7 @@ net_safe_read(MYSQL *mysql)
|
||||
pos+=2;
|
||||
len-=2;
|
||||
(void) strmake(net->last_error,(char*) pos,
|
||||
min(len,sizeof(net->last_error)-1));
|
||||
min((uint) len,(uint) sizeof(net->last_error)-1));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -440,7 +440,7 @@ static void free_rows(MYSQL_DATA *cur)
|
||||
|
||||
int
|
||||
simple_command(MYSQL *mysql,enum enum_server_command command, const char *arg,
|
||||
uint length, my_bool skipp_check)
|
||||
ulong length, my_bool skipp_check)
|
||||
{
|
||||
NET *net= &mysql->net;
|
||||
int result= -1;
|
||||
@ -671,8 +671,8 @@ mysql_free_result(MYSQL_RES *result)
|
||||
DBUG_PRINT("warning",("Not all rows in set were read; Ignoring rows"));
|
||||
for (;;)
|
||||
{
|
||||
uint pkt_len;
|
||||
if ((pkt_len=(uint) net_safe_read(result->handle)) == packet_error)
|
||||
ulong pkt_len;
|
||||
if ((pkt_len=net_safe_read(result->handle)) == packet_error)
|
||||
break;
|
||||
if (pkt_len == 1 && result->handle->net.read_pos[0] == 254)
|
||||
break; /* End of data */
|
||||
@ -866,7 +866,8 @@ unpack_fields(MYSQL_DATA *data,MEM_ROOT *alloc,uint fields,
|
||||
MYSQL_FIELD *field,*result;
|
||||
DBUG_ENTER("unpack_fields");
|
||||
|
||||
field=result=(MYSQL_FIELD*) alloc_root(alloc,sizeof(MYSQL_FIELD)*fields);
|
||||
field=result=(MYSQL_FIELD*) alloc_root(alloc,
|
||||
(uint) sizeof(MYSQL_FIELD)*fields);
|
||||
if (!result)
|
||||
DBUG_RETURN(0);
|
||||
|
||||
@ -913,7 +914,7 @@ static MYSQL_DATA *read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields,
|
||||
NET *net = &mysql->net;
|
||||
DBUG_ENTER("read_rows");
|
||||
|
||||
if ((pkt_len=(uint) net_safe_read(mysql)) == packet_error)
|
||||
if ((pkt_len= net_safe_read(mysql)) == packet_error)
|
||||
DBUG_RETURN(0);
|
||||
if (!(result=(MYSQL_DATA*) my_malloc(sizeof(MYSQL_DATA),
|
||||
MYF(MY_WME | MY_ZEROFILL))))
|
||||
@ -1020,7 +1021,7 @@ read_one_row(MYSQL *mysql,uint fields,MYSQL_ROW row, ulong *lengths)
|
||||
|
||||
/* perform query on master */
|
||||
int STDCALL mysql_master_query(MYSQL *mysql, const char *q,
|
||||
unsigned int length)
|
||||
unsigned long length)
|
||||
{
|
||||
if (mysql_master_send_query(mysql, q, length))
|
||||
return 1;
|
||||
@ -1028,7 +1029,7 @@ int STDCALL mysql_master_query(MYSQL *mysql, const char *q,
|
||||
}
|
||||
|
||||
int STDCALL mysql_master_send_query(MYSQL *mysql, const char *q,
|
||||
unsigned int length)
|
||||
unsigned long length)
|
||||
{
|
||||
MYSQL*master = mysql->master;
|
||||
if (!length)
|
||||
@ -1042,7 +1043,7 @@ int STDCALL mysql_master_send_query(MYSQL *mysql, const char *q,
|
||||
|
||||
/* perform query on slave */
|
||||
int STDCALL mysql_slave_query(MYSQL *mysql, const char *q,
|
||||
unsigned int length)
|
||||
unsigned long length)
|
||||
{
|
||||
if (mysql_slave_send_query(mysql, q, length))
|
||||
return 1;
|
||||
@ -1050,7 +1051,7 @@ int STDCALL mysql_slave_query(MYSQL *mysql, const char *q,
|
||||
}
|
||||
|
||||
int STDCALL mysql_slave_send_query(MYSQL *mysql, const char *q,
|
||||
unsigned int length)
|
||||
unsigned long length)
|
||||
{
|
||||
MYSQL* last_used_slave, *slave_to_use = 0;
|
||||
|
||||
@ -1271,7 +1272,7 @@ STDCALL mysql_rpl_query_type(const char* q, int len)
|
||||
case 'c': /* create or check */
|
||||
return tolower(q[1]) == 'h' ? MYSQL_RPL_ADMIN : MYSQL_RPL_MASTER ;
|
||||
case 's': /* select or show */
|
||||
return tolower(q[1] == 'h') ? MYSQL_RPL_ADMIN : MYSQL_RPL_SLAVE;
|
||||
return tolower(q[1]) == 'h' ? MYSQL_RPL_ADMIN : MYSQL_RPL_SLAVE;
|
||||
case 'f': /* flush */
|
||||
case 'r': /* repair */
|
||||
case 'g': /* grant */
|
||||
@ -1280,8 +1281,7 @@ STDCALL mysql_rpl_query_type(const char* q, int len)
|
||||
return MYSQL_RPL_SLAVE;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return MYSQL_RPL_MASTER; /* By default, send to master */
|
||||
}
|
||||
|
||||
|
||||
@ -1829,7 +1829,7 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
|
||||
mysql->db=my_strdup(db,MYF(MY_WME));
|
||||
db=0;
|
||||
}
|
||||
if (my_net_write(net,buff,(uint) (end-buff)) || net_flush(net) ||
|
||||
if (my_net_write(net,buff,(ulong) (end-buff)) || net_flush(net) ||
|
||||
net_safe_read(mysql) == packet_error)
|
||||
goto error;
|
||||
if (client_flag & CLIENT_COMPRESS) /* We will use compression */
|
||||
@ -1935,7 +1935,7 @@ my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user,
|
||||
pos=scramble(pos, mysql->scramble_buff, passwd,
|
||||
(my_bool) (mysql->protocol_version == 9));
|
||||
pos=strmov(pos+1,db ? db : "");
|
||||
if (simple_command(mysql,COM_CHANGE_USER, buff,(uint) (pos-buff),0))
|
||||
if (simple_command(mysql,COM_CHANGE_USER, buff,(ulong) (pos-buff),0))
|
||||
DBUG_RETURN(1);
|
||||
|
||||
my_free(mysql->user,MYF(MY_ALLOW_ZERO_PTR));
|
||||
@ -1960,7 +1960,7 @@ mysql_select_db(MYSQL *mysql, const char *db)
|
||||
DBUG_ENTER("mysql_select_db");
|
||||
DBUG_PRINT("enter",("db: '%s'",db));
|
||||
|
||||
if ((error=simple_command(mysql,COM_INIT_DB,db,(uint) strlen(db),0)))
|
||||
if ((error=simple_command(mysql,COM_INIT_DB,db,(ulong) strlen(db),0)))
|
||||
DBUG_RETURN(error);
|
||||
my_free(mysql->db,MYF(MY_ALLOW_ZERO_PTR));
|
||||
mysql->db=my_strdup(db,MYF(MY_WME));
|
||||
@ -2111,7 +2111,7 @@ STDCALL mysql_add_slave(MYSQL* mysql, const char* host,
|
||||
*/
|
||||
|
||||
int STDCALL
|
||||
mysql_send_query(MYSQL* mysql, const char* query, uint length)
|
||||
mysql_send_query(MYSQL* mysql, const char* query, ulong length)
|
||||
{
|
||||
if (mysql->options.rpl_parse && mysql->rpl_pivot)
|
||||
{
|
||||
@ -2179,13 +2179,13 @@ get_info:
|
||||
CLIENT_LONG_FLAG))))
|
||||
DBUG_RETURN(-1);
|
||||
mysql->status=MYSQL_STATUS_GET_RESULT;
|
||||
mysql->field_count=field_count;
|
||||
mysql->field_count= (uint) field_count;
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
|
||||
int STDCALL
|
||||
mysql_real_query(MYSQL *mysql, const char *query, uint length)
|
||||
mysql_real_query(MYSQL *mysql, const char *query, ulong length)
|
||||
{
|
||||
DBUG_ENTER("mysql_real_query");
|
||||
DBUG_PRINT("enter",("handle: %lx",mysql));
|
||||
@ -2276,8 +2276,9 @@ mysql_store_result(MYSQL *mysql)
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
mysql->status=MYSQL_STATUS_READY; /* server is ready */
|
||||
if (!(result=(MYSQL_RES*) my_malloc(sizeof(MYSQL_RES)+
|
||||
sizeof(ulong)*mysql->field_count,
|
||||
if (!(result=(MYSQL_RES*) my_malloc((uint) (sizeof(MYSQL_RES)+
|
||||
sizeof(ulong) *
|
||||
mysql->field_count),
|
||||
MYF(MY_WME | MY_ZEROFILL))))
|
||||
{
|
||||
mysql->net.last_errno=CR_OUT_OF_MEMORY;
|
||||
@ -2433,7 +2434,7 @@ mysql_fetch_lengths(MYSQL_RES *res)
|
||||
continue;
|
||||
}
|
||||
if (start) /* Found end of prev string */
|
||||
*prev_length= (uint) (*column-start-1);
|
||||
*prev_length= (ulong) (*column-start-1);
|
||||
start= *column;
|
||||
prev_length=lengths;
|
||||
}
|
||||
@ -2534,7 +2535,7 @@ mysql_list_fields(MYSQL *mysql, const char *table, const char *wild)
|
||||
LINT_INIT(query);
|
||||
|
||||
end=strmake(strmake(buff, table,128)+1,wild ? wild : "",128);
|
||||
if (simple_command(mysql,COM_FIELD_LIST,buff,(uint) (end-buff),1) ||
|
||||
if (simple_command(mysql,COM_FIELD_LIST,buff,(ulong) (end-buff),1) ||
|
||||
!(query = read_rows(mysql,(MYSQL_FIELD*) 0,6)))
|
||||
DBUG_RETURN(NULL);
|
||||
|
||||
@ -2590,7 +2591,7 @@ mysql_create_db(MYSQL *mysql, const char *db)
|
||||
{
|
||||
DBUG_ENTER("mysql_createdb");
|
||||
DBUG_PRINT("enter",("db: %s",db));
|
||||
DBUG_RETURN(simple_command(mysql,COM_CREATE_DB,db, (uint) strlen(db),0));
|
||||
DBUG_RETURN(simple_command(mysql,COM_CREATE_DB,db, (ulong) strlen(db),0));
|
||||
}
|
||||
|
||||
|
||||
@ -2599,7 +2600,7 @@ mysql_drop_db(MYSQL *mysql, const char *db)
|
||||
{
|
||||
DBUG_ENTER("mysql_drop_db");
|
||||
DBUG_PRINT("enter",("db: %s",db));
|
||||
DBUG_RETURN(simple_command(mysql,COM_DROP_DB,db,(uint) strlen(db),0));
|
||||
DBUG_RETURN(simple_command(mysql,COM_DROP_DB,db,(ulong) strlen(db),0));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user