summaryrefslogtreecommitdiff
path: root/sql-common
diff options
context:
space:
mode:
authorunknown <hf@deer.(none)>2003-06-18 15:58:57 +0500
committerunknown <hf@deer.(none)>2003-06-18 15:58:57 +0500
commit13e8bf67fc63280f76023fab73c373f33e363bfc (patch)
treef2de81966600f6bb3e831afc62a7ed1d9babbf42 /sql-common
parent4c7431dc906cd5e5dba8515ec63107b590708898 (diff)
downloadmariadb-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')
-rw-r--r--sql-common/client.c5
-rw-r--r--sql-common/pack.c27
2 files changed, 32 insertions, 0 deletions
diff --git a/sql-common/client.c b/sql-common/client.c
index 7d82ff0d209..8a6f3ed1e3d 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -1303,6 +1303,7 @@ mysql_init(MYSQL *mysql)
#ifdef HAVE_SMEM
mysql->options.shared_memory_base_name= (char*) def_shared_memory_base_name;
#endif
+ mysql->options.methods_to_use= MYSQL_OPT_GUESS_CONNECTION;
return mysql;
}
@@ -2512,6 +2513,10 @@ mysql_options(MYSQL *mysql,enum mysql_option option, const char *arg)
my_free(mysql->options.shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR));
mysql->options.shared_memory_base_name=my_strdup(arg,MYF(MY_WME));
#endif
+ case MYSQL_OPT_USE_REMOTE_CONNECTION:
+ case MYSQL_OPT_USE_EMBEDDED_CONNECTION:
+ case MYSQL_OPT_GUESS_CONNECTION:
+ mysql->options.methods_to_use= option;
break;
default:
DBUG_RETURN(1);
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;
+}
+