summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIsaac Ackerman <isaac.ackerman@mariadb.com>2020-03-05 01:09:50 +0000
committerSergei Petrunia <psergey@askmonty.org>2020-03-10 11:22:33 +0300
commitf2994aafca770f6efbd5aa6a524d426dfdbeab98 (patch)
treeefdd42aaa34c940ea8e5514bac3c1be46424e1a8
parent8587915744aa6dde28619e402cd4321e30a12203 (diff)
downloadmariadb-git-f2994aafca770f6efbd5aa6a524d426dfdbeab98.tar.gz
Added character set results, minor cleanup
-rw-r--r--storage/xpand/ha_xpand.cc6
-rw-r--r--storage/xpand/xpand_connection.cc33
-rw-r--r--storage/xpand/xpand_connection.h3
3 files changed, 21 insertions, 21 deletions
diff --git a/storage/xpand/ha_xpand.cc b/storage/xpand/ha_xpand.cc
index e9d38c123fc..9b09ec7af95 100644
--- a/storage/xpand/ha_xpand.cc
+++ b/storage/xpand/ha_xpand.cc
@@ -344,7 +344,7 @@ xpand_connection *get_trx(THD *thd, int *error_code)
xpand_connection *trx;
if (!(trx = (xpand_connection *)thd_get_ha_data(thd, xpand_hton)))
{
- if (!(trx = new xpand_connection(thd))) {
+ if (!(trx = new xpand_connection())) {
*error_code = HA_ERR_OUT_OF_MEM;
return NULL;
}
@@ -1441,7 +1441,7 @@ static int xpand_discover_table_names(handlerton *hton, LEX_CSTRING *db,
MY_DIR *dir,
handlerton::discovered_list *result)
{
- xpand_connection *xpand_net = new xpand_connection(NULL);
+ xpand_connection *xpand_net = new xpand_connection();
int error_code = xpand_net->connect();
if (error_code)
goto err;
@@ -1455,7 +1455,7 @@ err:
int xpand_discover_table(handlerton *hton, THD *thd, TABLE_SHARE *share)
{
- xpand_connection *xpand_net = new xpand_connection(NULL);
+ xpand_connection *xpand_net = new xpand_connection();
int error_code = xpand_net->connect();
if (error_code)
goto err;
diff --git a/storage/xpand/xpand_connection.cc b/storage/xpand/xpand_connection.cc
index 95ec565f306..4c7b5582362 100644
--- a/storage/xpand/xpand_connection.cc
+++ b/storage/xpand/xpand_connection.cc
@@ -12,11 +12,7 @@ Copyright (c) 2019, 2020, MariaDB Corporation.
#include "sql_class.h"
#include "my_pthread.h"
#include "tztime.h"
-
-//#include "errmsg.h"
-//name conflicts on macro ER with sql_class.h
-#define CR_CONNECTION_ERROR 2002
-#define CR_CONN_HOST_ERROR 2003
+#include "errmsg.h"
extern int xpand_connect_timeout;
extern int xpand_read_timeout;
@@ -65,6 +61,9 @@ enum xpand_trans_state {
XPAND_TRANS_ROLLBACK_STMT = 4,
XPAND_TRANS_NONE = 32,
};
+const int XPAND_TRANS_STARTS_STMT = (XPAND_TRANS_NEW_STMT |
+ XPAND_TRANS_REQUESTED |
+ XPAND_TRANS_ROLLBACK_STMT);
enum xpand_trans_post_flags {
XPAND_TRANS_AUTOCOMMIT = 8,
@@ -89,8 +88,8 @@ enum xpand_commands {
/****************************************************************************
** Class xpand_connection
****************************************************************************/
-xpand_connection::xpand_connection(THD *parent_thd)
- : session(parent_thd), command_buffer(NULL), command_buffer_length(0), command_length(0),
+xpand_connection::xpand_connection()
+ : command_buffer(NULL), command_buffer_length(0), command_length(0),
trans_state(XPAND_TRANS_NONE), trans_flags(XPAND_TRANS_NO_POST_FLAGS)
{
DBUG_ENTER("xpand_connection::xpand_connection");
@@ -213,10 +212,12 @@ int xpand_connection::connect_direct(char *host)
int xpand_connection::add_status_vars()
{
DBUG_ENTER("xpand_connection::add_status_vars");
- assert(session);
+
+ if (!(trans_state & XPAND_TRANS_STARTS_STMT))
+ DBUG_RETURN(add_command_operand_uchar(0));
int error_code = 0;
- system_variables vars = session->variables;
+ system_variables vars = current_thd->variables;
if ((error_code = add_command_operand_uchar(1)))
DBUG_RETURN(error_code);
//sql mode
@@ -227,7 +228,9 @@ int xpand_connection::add_status_vars()
DBUG_RETURN(error_code);
if ((error_code = add_command_operand_ushort(vars.auto_increment_offset)))
DBUG_RETURN(error_code);
- //character set and collation
+ //character sets and collations
+ if ((error_code = add_command_operand_ushort(vars.character_set_results->number)))
+ DBUG_RETURN(error_code);
if ((error_code = add_command_operand_ushort(vars.character_set_client->number)))
DBUG_RETURN(error_code);
if ((error_code = add_command_operand_ushort(vars.collation_connection->number)))
@@ -235,8 +238,8 @@ int xpand_connection::add_status_vars()
if ((error_code = add_command_operand_ushort(vars.collation_server->number)))
DBUG_RETURN(error_code);
//timezone and time names
- String tzone; //convert to utf8
- vars.time_zone->get_name()->print(&tzone, get_charset(33,0));
+ String tzone;
+ vars.time_zone->get_name()->print(&tzone, system_charset_info);
if ((error_code = add_command_operand_str((const uchar*)tzone.ptr(),tzone.length())))
DBUG_RETURN(error_code);
if ((error_code = add_command_operand_ushort(vars.lc_time_names->number)))
@@ -260,10 +263,8 @@ int xpand_connection::begin_command(uchar command)
if ((error_code = add_command_operand_uchar(trans_state | trans_flags)))
return error_code;
- if (trans_state & XPAND_TRANS_NEW_STMT ||
- trans_state & XPAND_TRANS_REQUESTED)
- if ((error_code = add_status_vars()))
- return error_code;
+ if ((error_code = add_status_vars()))
+ return error_code;
return error_code;
}
diff --git a/storage/xpand/xpand_connection.h b/storage/xpand/xpand_connection.h
index df725e1c361..523cab0df97 100644
--- a/storage/xpand/xpand_connection.h
+++ b/storage/xpand/xpand_connection.h
@@ -36,7 +36,6 @@ class xpand_connection_cursor;
class xpand_connection
{
private:
- THD *session;
MYSQL xpand_net;
uchar *command_buffer;
size_t command_buffer_length;
@@ -47,7 +46,7 @@ private:
int allocate_cursor(MYSQL *xpand_net, ulong buffer_size,
xpand_connection_cursor **scan);
public:
- xpand_connection(THD *parent_thd);
+ xpand_connection();
~xpand_connection();
inline bool is_connected()