summaryrefslogtreecommitdiff
path: root/libmysql
diff options
context:
space:
mode:
authorunknown <monty@mashka.mysql.fi>2003-01-04 15:17:16 +0200
committerunknown <monty@mashka.mysql.fi>2003-01-04 15:17:16 +0200
commit5281333e56624a598cdcf6d05358442700231b36 (patch)
treee7bb6542649b4462645d81fcac99546b763041a0 /libmysql
parent5fcd61bec6600a83e9ed9fba2ba380b8f5a66a35 (diff)
downloadmariadb-git-5281333e56624a598cdcf6d05358442700231b36.tar.gz
Added support for max_allowed_packet in option files read by mysql_option()
Extended max_allowed_packet for clients to 1G Fixed bug in sending compressed rows >= 16M Fix bug in skiping too long packets from clients. Added checking of wrong command number sent by client. include/mysql.h: Added max_allowed_packet as option parameter. include/mysql_com.h: Added COM_END to be able to check for wrong commands. libmysql/libmysql.c: Extended max_allowed_packet for clients to 1G Added support for max_allowed_packet in option files read by mysql_option() mysys/my_compress.c: Debugging output sql/net_pkg.cc: Fixed wrong handling of blobs >= 16M sql/net_serv.cc: Changed MAX_THREE_BYTES -> MAX_PACKET_LENGTH More DEBUG output and more comments Fixed bug in sending compressed rows >= 16M Optimized sending of big packets (fewer memcpy and compress data in bigger blocks) Fix bug in skiping too long packets from clients. (old code didn't always work for big packets) sql/sql_class.h: Changed type of variable sql/sql_parse.cc: Added checking of wrong command number sent by client. Changed handling of too big packets to make code safer tests/big_record.pl: E
Diffstat (limited to 'libmysql')
-rw-r--r--libmysql/libmysql.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c
index 49c110c738d..152177c0fbe 100644
--- a/libmysql/libmysql.c
+++ b/libmysql/libmysql.c
@@ -60,7 +60,7 @@ static my_bool mysql_client_init=0;
uint mysql_port=0;
my_string mysql_unix_port=0;
ulong net_buffer_length=8192;
-ulong max_allowed_packet=16*1024*1024L;
+ulong max_allowed_packet= 1024L*1024L*1024L;
ulong net_read_timeout= NET_READ_TIMEOUT;
ulong net_write_timeout= NET_WRITE_TIMEOUT;
@@ -713,8 +713,8 @@ static const char *default_options[]=
"character-sets-dir", "default-character-set", "interactive-timeout",
"connect-timeout", "local-infile", "disable-local-infile",
"replication-probe", "enable-reads-from-master", "repl-parse-query",
- "ssl-cipher",
- NullS
+ "ssl-cipher", "max-allowed-packet",
+ NullS
};
static TYPELIB option_types={array_elements(default_options)-1,
@@ -868,6 +868,9 @@ static void mysql_read_default_options(struct st_mysql_options *options,
case 25: /* repl-parse-query */
options->rpl_parse= 1;
break;
+ case 27:
+ options->max_allowed_packet= atoi(opt_arg);
+ break;
default:
DBUG_PRINT("warning",("unknown option: %s",option[0]));
}
@@ -1908,6 +1911,7 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
mysql->server_version,mysql->server_capabilities,
mysql->server_status, client_flag));
+ /* This needs to be changed as it's not useful with big packets */
int3store(buff+2,max_allowed_packet);
if (user && user[0])
strmake(buff+5,user,32); /* Max user name */
@@ -1935,6 +1939,8 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
goto error;
if (client_flag & CLIENT_COMPRESS) /* We will use compression */
net->compress=1;
+ if (mysql->options.max_allowed_packet)
+ net->max_packet_size= mysql->options.max_allowed_packet;
if (db && mysql_select_db(mysql,db))
goto error;
if (mysql->options.init_command)
@@ -2302,7 +2308,7 @@ mysql_real_query(MYSQL *mysql, const char *query, ulong length)
{
DBUG_ENTER("mysql_real_query");
DBUG_PRINT("enter",("handle: %lx",mysql));
- DBUG_PRINT("query",("Query = \"%s\"",query));
+ DBUG_PRINT("query",("Query = '%-.4096s'",query));
if (mysql_send_query(mysql,query,length))
DBUG_RETURN(-1);