Commit b79a921f authored by Will DeVries's avatar Will DeVries Committed by Sergei Petrunia

Pass C strings to get_table_oid.

parent 9d2d4036
...@@ -434,8 +434,9 @@ int ha_xpand::create(const char *name, TABLE *form, HA_CREATE_INFO *info) ...@@ -434,8 +434,9 @@ int ha_xpand::create(const char *name, TABLE *form, HA_CREATE_INFO *info)
return error_code; return error_code;
// Load the oid of the created table // Load the oid of the created table
error_code= trx->get_table_oid(norm_db, norm_table, &xpand_table_oid, error_code= trx->get_table_oid(norm_db.c_str(), strlen(norm_db.c_str()),
table_share); norm_table.c_str(), strlen(norm_table.c_str()),
&xpand_table_oid, table_share);
return error_code; return error_code;
} }
...@@ -558,7 +559,9 @@ int ha_xpand::open(const char *name, int mode, uint test_if_locked) ...@@ -558,7 +559,9 @@ int ha_xpand::open(const char *name, int mode, uint test_if_locked)
if ((error_code= normalize_tablename(name, &norm_db, &norm_table))) if ((error_code= normalize_tablename(name, &norm_db, &norm_table)))
DBUG_RETURN(error_code); DBUG_RETURN(error_code);
error_code= trx->get_table_oid(norm_db, norm_table, &xpand_table_oid, error_code= trx->get_table_oid(norm_db.c_str(), strlen(norm_db.c_str()),
norm_table.c_str(),
strlen(norm_table.c_str()), &xpand_table_oid,
table_share); table_share);
if (error_code) if (error_code)
DBUG_RETURN(error_code); DBUG_RETURN(error_code);
......
...@@ -1022,8 +1022,8 @@ int xpand_connection::populate_table_list(LEX_CSTRING *db, ...@@ -1022,8 +1022,8 @@ int xpand_connection::populate_table_list(LEX_CSTRING *db,
error code if an error occurred error code if an error occurred
*/ */
int xpand_connection::get_table_oid(const std::string &db, int xpand_connection::get_table_oid(const char *db, size_t db_len,
const std::string &name, const char *name, size_t name_len,
ulonglong *oid, ulonglong *oid,
TABLE_SHARE *share) TABLE_SHARE *share)
{ {
...@@ -1038,9 +1038,9 @@ int xpand_connection::get_table_oid(const std::string &db, ...@@ -1038,9 +1038,9 @@ int xpand_connection::get_table_oid(const std::string &db,
"from system.databases d " "from system.databases d "
" inner join ""system.relations r on d.db = r.db " " inner join ""system.relations r on d.db = r.db "
"where d.name = '"); "where d.name = '");
get_oid.append(db.c_str()); get_oid.append(db, db_len);
get_oid.append("' and r.name = '"); get_oid.append("' and r.name = '");
get_oid.append(name.c_str()); get_oid.append(name, name_len);
get_oid.append("'"); get_oid.append("'");
if (mysql_real_query(&xpand_net, get_oid.c_ptr(), get_oid.length())) { if (mysql_real_query(&xpand_net, get_oid.c_ptr(), get_oid.length())) {
...@@ -1094,6 +1094,12 @@ int xpand_connection::discover_table_details(LEX_CSTRING *db, LEX_CSTRING *name, ...@@ -1094,6 +1094,12 @@ int xpand_connection::discover_table_details(LEX_CSTRING *db, LEX_CSTRING *name,
MYSQL_RES *results_create = NULL; MYSQL_RES *results_create = NULL;
MYSQL_ROW row; MYSQL_ROW row;
String show; String show;
ulonglong oid;
if ((error_code = xpand_connection::get_table_oid(db->str, db->length,
name->str, name->length,
&oid, share)))
goto error;
/* get show create statement */ /* get show create statement */
show.append("show simple create table "); show.append("show simple create table ");
......
...@@ -110,8 +110,8 @@ class xpand_connection ...@@ -110,8 +110,8 @@ class xpand_connection
int scan_end(xpand_connection_cursor *scan); int scan_end(xpand_connection_cursor *scan);
int populate_table_list(LEX_CSTRING *db, handlerton::discovered_list *result); int populate_table_list(LEX_CSTRING *db, handlerton::discovered_list *result);
int get_table_oid(const std::string& db, const std::string &name, int get_table_oid(const char *db, size_t db_len, const char *name,
ulonglong *oid, TABLE_SHARE *share); size_t name_len, ulonglong *oid, TABLE_SHARE *share);
int discover_table_details(LEX_CSTRING *db, LEX_CSTRING *name, THD *thd, int discover_table_details(LEX_CSTRING *db, LEX_CSTRING *name, THD *thd,
TABLE_SHARE *share); TABLE_SHARE *share);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment