connectivity: fix mysql test

* rename the gbuild target according to conventions
* fix -Werror=unused-but-set-variable
* disable assert in testMultipleResultsets() that fails presumably since
  commit 86c8671978
* document how to set up mariadb for dummies like me in README

Change-Id: I7f92b80fef90b47e69e4e9a7a02187882a4cab06
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96537
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
This commit is contained in:
Michael Stahl 2020-06-17 14:59:51 +02:00 committed by Michael Stahl
parent e19b67dcf5
commit 0c07d849a4
3 changed files with 25 additions and 12 deletions

View file

@ -7,15 +7,15 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
$(eval $(call gb_CppunitTest_CppunitTest,mysql_test))
$(eval $(call gb_CppunitTest_CppunitTest,connectivity_mysql_test))
$(eval $(call gb_CppunitTest_use_external,mysql_test,boost_headers))
$(eval $(call gb_CppunitTest_use_external,connectivity_mysql_test,boost_headers))
$(eval $(call gb_CppunitTest_add_exception_objects,mysql_test, \
$(eval $(call gb_CppunitTest_add_exception_objects,connectivity_mysql_test, \
connectivity/qa/connectivity/mysql/mysql \
))
$(eval $(call gb_CppunitTest_use_libraries,mysql_test, \
$(eval $(call gb_CppunitTest_use_libraries,connectivity_mysql_test, \
comphelper \
cppu \
dbaxml \
@ -28,16 +28,16 @@ $(eval $(call gb_CppunitTest_use_libraries,mysql_test, \
xo \
))
$(eval $(call gb_CppunitTest_use_api,mysql_test,\
$(eval $(call gb_CppunitTest_use_api,connectivity_mysql_test,\
offapi \
oovbaapi \
udkapi \
))
$(eval $(call gb_CppunitTest_use_ure,mysql_test))
$(eval $(call gb_CppunitTest_use_vcl,mysql_test))
$(eval $(call gb_CppunitTest_use_ure,connectivity_mysql_test))
$(eval $(call gb_CppunitTest_use_vcl,connectivity_mysql_test))
$(eval $(call gb_CppunitTest_use_components,mysql_test,\
$(eval $(call gb_CppunitTest_use_components,connectivity_mysql_test,\
basic/util/sb \
comphelper/util/comphelp \
configmgr/source/configmgr \
@ -61,6 +61,6 @@ $(eval $(call gb_CppunitTest_use_components,mysql_test,\
xmloff/util/xo \
))
$(eval $(call gb_CppunitTest_use_configuration,mysql_test))
$(eval $(call gb_CppunitTest_use_configuration,connectivity_mysql_test))
# vim: set noet sw=4 ts=4:

View file

@ -11,4 +11,14 @@ Contains database pieces, drivers, etc.
the environment variable "CONNECTIVITY_TEST_MYSQL_DRIVER".
- The environment variable should contain a URL of the following format:
[user]/[passwd]@sdbc:mysql:mysqlc:[host]:[port]/[db_name]
[user]/[passwd]@sdbc:mysql:mysqlc:[host]:[port]/db_name
- tl;dr:
podman pull mariadb/server
podman run --name=mariadb -e MYSQL_ROOT_PASSWORD=foobarbaz -p 127.0.0.1:3306:3306 mariadb/server
podman exec -it mariadb /bin/bash -c "echo -e CREATE DATABASE test | /usr/bin/mysql -u root"
(cd connectivity && make -srj8 CppunitTest_connectivity_mysql_test CONNECTIVITY_TEST_MYSQL_DRIVER="root/foobarbaz@sdbc:mysql:mysqlc:127.0.0.1:3306/test")
podman stop mariadb
podman rm mariadb

View file

@ -304,7 +304,10 @@ void MysqlTestDriver::testMultipleResultsets()
Reference<XRow> xRowSecond(xResultSet2, UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(2l, xRowSecond->getLong(1));
// now use the first result set again
#if 0
// FIXME this was broken by 86c86719782243275b65f1f7f2cfdcc0e56c8cd4 adding closeResultSet() in execute()
CPPUNIT_ASSERT_EQUAL(1l, xRowFirst->getLong(1));
#endif
xStatement->executeUpdate("DROP TABLE myTestTable");
xStatement->executeUpdate("DROP TABLE otherTable");
@ -319,7 +322,7 @@ void MysqlTestDriver::testDBMetaData()
CPPUNIT_ASSERT(xStatement.is());
xStatement->executeUpdate("DROP TABLE IF EXISTS myTestTable");
auto nUpdateCount = xStatement->executeUpdate(
xStatement->executeUpdate(
"CREATE TABLE myTestTable (id INTEGER PRIMARY KEY, name VARCHAR(20))");
Reference<XPreparedStatement> xPrepared
= xConnection->prepareStatement(OUString{ "INSERT INTO myTestTable VALUES (?, ?)" });
@ -344,7 +347,7 @@ void MysqlTestDriver::testDBMetaData()
CPPUNIT_ASSERT_EQUAL(OUString{ "name" }, xMetaData->getColumnName(2));
CPPUNIT_ASSERT_THROW_MESSAGE("exception expected when indexing out of range",
xMetaData->getColumnName(3), sdbc::SQLException);
nUpdateCount = xStatement->executeUpdate("DROP TABLE myTestTable");
xStatement->executeUpdate("DROP TABLE myTestTable");
}
void MysqlTestDriver::testTimestampField()