From 13e8bf67fc63280f76023fab73c373f33e363bfc Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 18 Jun 2003 15:58:57 +0500 Subject: SCRUM including client code into embedded server code to guess what library to use added net_field_length moved to pack.c include/mysql.h: typedefinitions moved for suitability mysql_option.methods_to_use added include/mysql_com.h: net_store_length declaration libmysql/libmysql.c: net_store_length moved to sql-common/pack.c libmysqld/libmysqld.c: added code to guess whether to use remote or embedded connection sql-common/client.c: options checking added sql-common/pack.c: net_store_length implementation moved here sql/protocol.cc: net_store_length moved to sql-common/pack.c --- sql-common/pack.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'sql-common/pack.c') diff --git a/sql-common/pack.c b/sql-common/pack.c index 16cc13eddbd..43e0098bf29 100644 --- a/sql-common/pack.c +++ b/sql-common/pack.c @@ -96,3 +96,30 @@ void my_net_local_init(NET *net) net->max_packet_size= max(net_buffer_length, max_allowed_packet); } +char * +net_store_length(char *pkg, ulonglong length) +{ + uchar *packet=(uchar*) pkg; + if (length < LL(251)) + { + *packet=(uchar) length; + return (char*) packet+1; + } + /* 251 is reserved for NULL */ + if (length < LL(65536)) + { + *packet++=252; + int2store(packet,(uint) length); + return (char*) packet+2; + } + if (length < LL(16777216)) + { + *packet++=253; + int3store(packet,(ulong) length); + return (char*) packet+3; + } + *packet++=254; + int8store(packet,length); + return (char*) packet+8; +} + -- cgit v1.2.1