Commit 548399f6 authored by Alexander Barkov's avatar Alexander Barkov

After-fix for Sergei's merge of the connect engine.

odbc_sqlite3 failed. Fixed.

modified:
  storage/connect/ha_connect.cc
  storage/connect/mysql-test/connect/r/odbc_sqlite3.result
  storage/connect/mysql-test/connect/t/odbc_sqlite3.test
parent f7e95c8e
...@@ -3582,6 +3582,8 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd, ...@@ -3582,6 +3582,8 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
// Some data sources do not count dec in length // Some data sources do not count dec in length
if (typ == TYPE_FLOAT) if (typ == TYPE_FLOAT)
len += (dec + 2); // To be safe len += (dec + 2); // To be safe
else
dec= 0;
} // endif ttp } // endif ttp
#endif // ODBC_SUPPORT #endif // ODBC_SUPPORT
...@@ -3637,6 +3639,24 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd, ...@@ -3637,6 +3639,24 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
b= HA_ERR_OUT_OF_MEM; b= HA_ERR_OUT_OF_MEM;
} }
if (create_info->connect_string.length) {
bool oom= false;
oom|= sql.append(' ');
oom|= sql.append("CONNECTION='");
oom|= sql.append_for_single_quote(create_info->connect_string.str,
create_info->connect_string.length);
oom|= sql.append('\'');
if (oom)
b= HA_ERR_OUT_OF_MEM;
}
if (create_info->default_table_charset) {
bool oom= false;
oom|= sql.append(' ');
oom|= sql.append("CHARSET=");
oom|= sql.append(create_info->default_table_charset->csname);
}
if (!b) if (!b)
b= table_s->init_from_sql_statement_string(thd, true, b= table_s->init_from_sql_statement_string(thd, true,
sql.ptr(), sql.length()); sql.ptr(), sql.length());
......
...@@ -2,7 +2,7 @@ Table Create Table ...@@ -2,7 +2,7 @@ Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`Description` varchar(128) NOT NULL, `Description` varchar(128) NOT NULL,
`Attributes` varchar(256) NOT NULL `Attributes` varchar(256) NOT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=ODBC `CATFUNC`=Drivers ) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`='ODBC' `CATFUNC`='Drivers'
SET NAMES utf8; SET NAMES utf8;
GRANT ALL PRIVILEGES ON *.* TO user@localhost; GRANT ALL PRIVILEGES ON *.* TO user@localhost;
REVOKE FILE ON *.* FROM user@localhost; REVOKE FILE ON *.* FROM user@localhost;
...@@ -18,12 +18,12 @@ ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ...@@ -18,12 +18,12 @@ ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
SELECT user(); SELECT user();
user() user()
root@localhost root@localhost
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CONNECTION='Driver=SQLite3 ODBC Driver;Database=MYSQL_TEST_DIR/suite/connect/std_data/test.sqlite3;NoWCHAR=yes' CHARSET=utf8 DATA_CHARSET=utf8;; CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CONNECTION='Driver=SQLite3 ODBC Driver;Database=MTR_SUITE_DIR/std_data/test.sqlite3;NoWCHAR=yes' CHARSET=utf8 DATA_CHARSET=utf8;;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` varchar(64) DEFAULT NULL `a` varchar(64) DEFAULT NULL
) ENGINE=CONNECT DEFAULT CHARSET=utf8 CONNECTION='Driver=SQLite3 ODBC Driver;Database=MYSQL_TEST_DIR/suite/connect/std_data/test.sqlite3;NoWCHAR=yes' `TABLE_TYPE`=ODBC `DATA_CHARSET`=utf8 ) ENGINE=CONNECT DEFAULT CHARSET=utf8 CONNECTION='Driver=SQLite3 ODBC Driver;Database=MTR_SUITE_DIR/std_data/test.sqlite3;NoWCHAR=yes' `TABLE_TYPE`='ODBC' `DATA_CHARSET`='utf8'
SELECT * FROM t1; SELECT * FROM t1;
a a
test1 test1
......
...@@ -61,9 +61,9 @@ SELECT user(); ...@@ -61,9 +61,9 @@ SELECT user();
# As we do not do any modifications in the database, this should be OK. # As we do not do any modifications in the database, this should be OK.
# #
let $Database=$MTR_SUITE_DIR/std_data/test.sqlite3; let $Database=$MTR_SUITE_DIR/std_data/test.sqlite3;
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR --replace_result $MTR_SUITE_DIR MTR_SUITE_DIR
--eval CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CONNECTION='Driver=SQLite3 ODBC Driver;Database=$Database;NoWCHAR=yes' CHARSET=utf8 DATA_CHARSET=utf8; --eval CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CONNECTION='Driver=SQLite3 ODBC Driver;Database=$Database;NoWCHAR=yes' CHARSET=utf8 DATA_CHARSET=utf8;
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR --replace_result $MTR_SUITE_DIR MTR_SUITE_DIR
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
SELECT * FROM t1; SELECT * FROM t1;
--connection user --connection user
......
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