summaryrefslogtreecommitdiff
path: root/libmysqld/libmysqld.c
diff options
context:
space:
mode:
authorunknown <hf@deer.(none)>2003-07-18 16:26:35 +0500
committerunknown <hf@deer.(none)>2003-07-18 16:26:35 +0500
commitd17b3e967d517ad290eec9cd0d59dd47f4887e08 (patch)
treef1de729b4db0054d2ad06f1d4e3913b941563f60 /libmysqld/libmysqld.c
parentbf3af8eeac3dba6af359805e82ad5c1b26d4834e (diff)
downloadmariadb-git-d17b3e967d517ad290eec9cd0d59dd47f4887e08.tar.gz
SCRUM
Including client code into embedded library fixes libmysql/libmysql.c: We should call this way libmysqld/lib_sql.cc: Necessary initializations added libmysqld/libmysqld.c: mysql_close can't be "virtual" mysqltest.c calls mysql_close before mysql_connect sql-common/client.c: We have to redo fetch_lengths to count lengths looking at '\0' in string. It works slower, but is correct for both client and embedded libraries
Diffstat (limited to 'libmysqld/libmysqld.c')
-rw-r--r--libmysqld/libmysqld.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/libmysqld/libmysqld.c b/libmysqld/libmysqld.c
index 0a096a88889..b6278ab3c0b 100644
--- a/libmysqld/libmysqld.c
+++ b/libmysqld/libmysqld.c
@@ -72,6 +72,8 @@ cli_mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
const char *passwd, const char *db,
uint port, const char *unix_socket,ulong client_flag);
+void STDCALL cli_mysql_close(MYSQL *mysql);
+
#ifdef HAVE_GETPWUID
struct passwd *getpwuid(uid_t);
char* getlogin(void);
@@ -166,14 +168,12 @@ static inline int mysql_init_charset(MYSQL *mysql)
** before calling mysql_real_connect !
*/
-static void STDCALL emb_mysql_close(MYSQL *mysql);
static my_bool STDCALL emb_mysql_read_query_result(MYSQL *mysql);
static MYSQL_RES * STDCALL emb_mysql_store_result(MYSQL *mysql);
static MYSQL_RES * STDCALL emb_mysql_use_result(MYSQL *mysql);
static MYSQL_METHODS embedded_methods=
{
- emb_mysql_close,
emb_mysql_read_query_result,
emb_advanced_command,
emb_mysql_store_result,
@@ -276,9 +276,15 @@ error:
** If handle is alloced by mysql connect free it.
*************************************************************************/
-static void STDCALL emb_mysql_close(MYSQL *mysql)
+void STDCALL mysql_close(MYSQL *mysql)
{
DBUG_ENTER("mysql_close");
+ if (mysql->methods != &embedded_methods)
+ {
+ cli_mysql_close(mysql);
+ DBUG_VOID_RETURN;
+ }
+
if (mysql) /* Some simple safety */
{
my_free(mysql->options.user,MYF(MY_ALLOW_ZERO_PTR));