summaryrefslogtreecommitdiff
path: root/libmysqld
diff options
context:
space:
mode:
authorDavi Arnaut <Davi.Arnaut@Sun.COM>2009-08-04 17:43:17 -0300
committerDavi Arnaut <Davi.Arnaut@Sun.COM>2009-08-04 17:43:17 -0300
commitc1433ba201f6532aeb36b6ac2cf6718f2665aaa3 (patch)
tree75640ea51cafe29f635a40a5168e0657fddeadea /libmysqld
parentdc15e3d7112ea00e043b91f14fea83e21588fbfb (diff)
parentba7d1a514be8aef81362eb5a7b9054b4667dbbac (diff)
downloadmariadb-git-c1433ba201f6532aeb36b6ac2cf6718f2665aaa3.tar.gz
Merge from mysql-5.1-bugteam.
Diffstat (limited to 'libmysqld')
-rw-r--r--libmysqld/Makefile.am2
-rw-r--r--libmysqld/emb_qcache.h2
-rw-r--r--libmysqld/lib_sql.cc46
3 files changed, 34 insertions, 16 deletions
diff --git a/libmysqld/Makefile.am b/libmysqld/Makefile.am
index ef2fab2da6d..a9bd8d9e17c 100644
--- a/libmysqld/Makefile.am
+++ b/libmysqld/Makefile.am
@@ -26,7 +26,7 @@ pkgplugindir = $(pkglibdir)/plugin
EXTRA_DIST = libmysqld.def CMakeLists.txt
DEFS = -DEMBEDDED_LIBRARY -DMYSQL_SERVER \
-DDEFAULT_MYSQL_HOME="\"$(MYSQLBASEdir)\"" \
- -DDATADIR="\"$(MYSQLDATAdir)\"" \
+ -DMYSQL_DATADIR="\"$(MYSQLDATAdir)\"" \
-DSHAREDIR="\"$(MYSQLSHAREdir)\"" \
-DPLUGINDIR="\"$(pkgplugindir)\""
INCLUDES= -I$(top_builddir)/include -I$(top_srcdir)/include \
diff --git a/libmysqld/emb_qcache.h b/libmysqld/emb_qcache.h
index 67413739f2c..ecf91487667 100644
--- a/libmysqld/emb_qcache.h
+++ b/libmysqld/emb_qcache.h
@@ -79,4 +79,4 @@ public:
uint emb_count_querycache_size(THD *thd);
int emb_load_querycache_result(THD *thd, Querycache_stream *src);
void emb_store_querycache_result(Querycache_stream *dst, THD* thd);
-void net_send_eof(THD *thd, uint server_status, uint total_warn_count);
+bool net_send_eof(THD *thd, uint server_status, uint total_warn_count);
diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc
index d644c45a66a..d4a200c07b2 100644
--- a/libmysqld/lib_sql.cc
+++ b/libmysqld/lib_sql.cc
@@ -803,11 +803,11 @@ MYSQL_DATA *THD::alloc_new_dataset()
*/
static
-void
+bool
write_eof_packet(THD *thd, uint server_status, uint total_warn_count)
{
if (!thd->mysql) // bootstrap file handling
- return;
+ return FALSE;
/*
The following test should never be true, but it's better to do it
because if 'is_fatal_error' is set the server is not going to execute
@@ -822,6 +822,7 @@ write_eof_packet(THD *thd, uint server_status, uint total_warn_count)
*/
thd->cur_data->embedded_info->warning_count=
(thd->spcont ? 0 : min(total_warn_count, 65535));
+ return FALSE;
}
@@ -1032,31 +1033,34 @@ bool Protocol_binary::write()
@sa Server implementation of net_send_ok in protocol.cc for
description of the arguments.
- @return The function does not return errors.
+ @return
+ @retval TRUE An error occurred
+ @retval FALSE Success
*/
-void
+bool
net_send_ok(THD *thd,
uint server_status, uint total_warn_count,
ha_rows affected_rows, ulonglong id, const char *message)
{
DBUG_ENTER("emb_net_send_ok");
MYSQL_DATA *data;
+ bool error;
MYSQL *mysql= thd->mysql;
if (!mysql) // bootstrap file handling
- DBUG_VOID_RETURN;
+ DBUG_RETURN(FALSE);
if (!(data= thd->alloc_new_dataset()))
- return;
+ return TRUE;
data->embedded_info->affected_rows= affected_rows;
data->embedded_info->insert_id= id;
if (message)
strmake(data->embedded_info->info, message,
sizeof(data->embedded_info->info)-1);
- write_eof_packet(thd, server_status, total_warn_count);
+ error= write_eof_packet(thd, server_status, total_warn_count);
thd->cur_data= 0;
- DBUG_VOID_RETURN;
+ DBUG_RETURN(error);
}
@@ -1065,27 +1069,41 @@ net_send_ok(THD *thd,
@sa net_send_ok
- @return This function does not return errors.
+ @return
+ @retval TRUE An error occurred
+ @retval FALSE Success
*/
-void
+bool
net_send_eof(THD *thd, uint server_status, uint total_warn_count)
{
- write_eof_packet(thd, server_status, total_warn_count);
+ bool error= write_eof_packet(thd, server_status, total_warn_count);
thd->cur_data= 0;
+ return error;
}
-void net_send_error_packet(THD *thd, uint sql_errno, const char *err)
+bool net_send_error_packet(THD *thd, uint sql_errno, const char *err)
{
- MYSQL_DATA *data= thd->cur_data ? thd->cur_data : thd->alloc_new_dataset();
- struct embedded_query_result *ei= data->embedded_info;
+ MYSQL_DATA *data= thd->cur_data;
+ struct embedded_query_result *ei;
+ if (!thd->mysql) // bootstrap file handling
+ {
+ fprintf(stderr, "ERROR: %d %s\n", sql_errno, err);
+ return TRUE;
+ }
+
+ if (!data)
+ data= thd->alloc_new_dataset();
+
+ ei= data->embedded_info;
ei->last_errno= sql_errno;
strmake(ei->info, err, sizeof(ei->info)-1);
strmov(ei->sqlstate, mysql_errno_to_sqlstate(sql_errno));
ei->server_status= thd->server_status;
thd->cur_data= 0;
+ return FALSE;
}