1
0
mirror of https://github.com/mariadb-corporation/mariadb-connector-c.git synced 2025-08-08 14:02:17 +03:00

removed ma_errmsg from mysql.h

This commit is contained in:
Georg Richter
2016-11-16 17:27:59 +01:00
parent 3378c0d8b7
commit a499722377
4 changed files with 94 additions and 101 deletions

View File

@@ -60,7 +60,6 @@ typedef int my_socket;
#include "mariadb_version.h" #include "mariadb_version.h"
#include "ma_list.h" #include "ma_list.h"
#include "mariadb_ctype.h" #include "mariadb_ctype.h"
#include "ma_errmsg.h"
#ifndef ST_MA_USED_MEM_DEFINED #ifndef ST_MA_USED_MEM_DEFINED
#define ST_MA_USED_MEM_DEFINED #define ST_MA_USED_MEM_DEFINED

View File

@@ -16,11 +16,11 @@
MA 02111-1307, USA */ MA 02111-1307, USA */
/* Write and read of logical packets to/from socket /* Write and read of logical packets to/from socket
** Writes are cached into net_buffer_length big packets. ** Writes are cached into net_buffer_length big packets.
** Read packets are reallocated dynamicly when reading big packets. ** Read packets are reallocated dynamicly when reading big packets.
** Each logical packet has the following pre-info: ** Each logical packet has the following pre-info:
** 3 byte length & 1 byte package-number. ** 3 byte length & 1 byte package-number.
*/ */
#include <ma_global.h> #include <ma_global.h>
@@ -43,7 +43,7 @@
/* net_buffer_length and max_allowed_packet are defined in mysql.h /* net_buffer_length and max_allowed_packet are defined in mysql.h
See bug conc-57 See bug conc-57
*/ */
#undef net_buffer_length #undef net_buffer_length
#undef max_allowed_packet #undef max_allowed_packet
@@ -68,15 +68,15 @@ ulong net_buffer_length= 8192; /* Default length. Enlarged if necessary */
/* /*
** Give error if a too big packet is found ** Give error if a too big packet is found
** The server can change this with the -O switch, but because the client ** The server can change this with the -O switch, but because the client
** can't normally do this the client should have a bigger max-buffer. ** can't normally do this the client should have a bigger max-buffer.
*/ */
static int ma_net_write_buff(NET *net,const char *packet, size_t len); static int ma_net_write_buff(NET *net,const char *packet, size_t len);
/* Init with packet info */ /* Init with packet info */
int ma_net_init(NET *net, MARIADB_PVIO* pvio) int ma_net_init(NET *net, MARIADB_PVIO* pvio)
{ {
@@ -176,18 +176,17 @@ int ma_net_flush(NET *net)
} }
/***************************************************************************** /*****************************************************************************
** Write something to server/client buffer ** Write something to server/client buffer
*****************************************************************************/ *****************************************************************************/
/* /*
** Write a logical packet with packet header ** Write a logical packet with packet header
** Format: Packet length (3 bytes), packet number(1 byte) ** Format: Packet length (3 bytes), packet number(1 byte)
** When compression is used a 3 byte compression length is added ** When compression is used a 3 byte compression length is added
** NOTE: If compression is used the original package is destroyed! ** NOTE: If compression is used the original package is destroyed!
*/ */
int int ma_net_write(NET *net, const uchar *packet, size_t len)
ma_net_write(NET *net, const uchar *packet, size_t len)
{ {
uchar buff[NET_HEADER_SIZE]; uchar buff[NET_HEADER_SIZE];
while (len >= MAX_PACKET_LENGTH) while (len >= MAX_PACKET_LENGTH)
@@ -210,8 +209,7 @@ ma_net_write(NET *net, const uchar *packet, size_t len)
return 0; return 0;
} }
int int ma_net_write_command(NET *net, uchar command,
ma_net_write_command(NET *net, uchar command,
const char *packet, size_t len, const char *packet, size_t len,
my_bool disable_flush) my_bool disable_flush)
{ {
@@ -251,8 +249,7 @@ ma_net_write_command(NET *net, uchar command,
} }
static int static int ma_net_write_buff(NET *net,const char *packet, size_t len)
ma_net_write_buff(NET *net,const char *packet, size_t len)
{ {
size_t left_length; size_t left_length;
@@ -299,8 +296,7 @@ unsigned char *mysql_net_store_length(unsigned char *packet, size_t length);
/* Read and write using timeouts */ /* Read and write using timeouts */
int int ma_net_real_write(NET *net, const char *packet, size_t len)
ma_net_real_write(NET *net,const char *packet,size_t len)
{ {
ssize_t length; ssize_t length;
char *pos,*end; char *pos,*end;
@@ -357,10 +353,9 @@ ma_net_real_write(NET *net,const char *packet,size_t len)
} }
/***************************************************************************** /*****************************************************************************
** Read something from server/clinet ** Read something from server/clinet
*****************************************************************************/ *****************************************************************************/
static ulong static ulong ma_real_read(NET *net, size_t *complen)
ma_real_read(NET *net, size_t *complen)
{ {
uchar *pos; uchar *pos;
ssize_t length; ssize_t length;
@@ -387,6 +382,7 @@ ma_real_read(NET *net, size_t *complen)
remain -= (ulong) length; remain -= (ulong) length;
pos+= (ulong) length; pos+= (ulong) length;
} }
if (i == 0) if (i == 0)
{ /* First parts is packet length */ { /* First parts is packet length */
ulong helping; ulong helping;
@@ -460,7 +456,7 @@ ulong ma_net_read(NET *net)
compressed protocol: compressed protocol:
-------------------------------------- --------------------------------------
packet_lengt h 3 packet_length 3
sequence_id 1 sequence_id 1
uncompressed_length 3 uncompressed_length 3
-------------------------------------- --------------------------------------
@@ -585,6 +581,7 @@ int net_add_multi_command(NET *net, uchar command, const uchar *packet,
{ {
return(1); return(1);
} }
/* don't increase packet number */
net->compress_pkt_nr= net->pkt_nr= 0; net->compress_pkt_nr= net->pkt_nr= 0;
return ma_net_write_command(net, command, (const char *)packet, length, 1); return ma_net_write_command(net, command, (const char *)packet, length, 1);
} }

View File

@@ -193,7 +193,7 @@ restart:
my_set_error(mysql, net->last_errno == ER_NET_PACKET_TOO_LARGE ? my_set_error(mysql, net->last_errno == ER_NET_PACKET_TOO_LARGE ?
CR_NET_PACKET_TOO_LARGE: CR_NET_PACKET_TOO_LARGE:
CR_SERVER_LOST, CR_SERVER_LOST,
SQLSTATE_UNKNOWN, 0); SQLSTATE_UNKNOWN, 0, errno);
return(packet_error); return(packet_error);
} }
if (net->read_pos[0] == 255) if (net->read_pos[0] == 255)

View File

@@ -129,12 +129,9 @@ static int bulk1(MYSQL *mysql)
mysql_free_result(res); mysql_free_result(res);
FAIL_IF(intval != array_size - 1, "Expected max value 1024"); FAIL_IF(intval != array_size - 1, "Expected max value 1024");
/*
rc= mysql_query(mysql, "DROP TABLE IF EXISTS bulk1"); rc= mysql_query(mysql, "DROP TABLE IF EXISTS bulk1");
check_mysql_rc(rc, mysql); check_mysql_rc(rc, mysql);
*/
return OK; return OK;
} }
static int bulk2(MYSQL *mysql) static int bulk2(MYSQL *mysql)