diff options
author | unknown <hf@deer.(none)> | 2003-06-18 15:58:57 +0500 |
---|---|---|
committer | unknown <hf@deer.(none)> | 2003-06-18 15:58:57 +0500 |
commit | 13e8bf67fc63280f76023fab73c373f33e363bfc (patch) | |
tree | f2de81966600f6bb3e831afc62a7ed1d9babbf42 /sql-common/pack.c | |
parent | 4c7431dc906cd5e5dba8515ec63107b590708898 (diff) | |
download | mariadb-git-13e8bf67fc63280f76023fab73c373f33e363bfc.tar.gz |
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
Diffstat (limited to 'sql-common/pack.c')
-rw-r--r-- | sql-common/pack.c | 27 |
1 files changed, 27 insertions, 0 deletions
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; +} + |