From 08ef4dbf321b8bc10a1e44f25a39c6ca9e24ad37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnter=20Obiltschnig?= Date: Thu, 17 Jun 2021 14:21:22 +0200 Subject: [PATCH] #3317: Data::MySQL MySQL headers and library search paths --- Data/MySQL/Makefile | 5 +- Data/MySQL/MySQL.make | 40 +++++++++ Data/MySQL/include/Poco/Data/MySQL/Binder.h | 4 +- .../include/Poco/Data/MySQL/MySQLException.h | 2 +- .../include/Poco/Data/MySQL/ResultMetadata.h | 4 +- .../include/Poco/Data/MySQL/SessionHandle.h | 2 +- .../Poco/Data/MySQL/StatementExecutor.h | 4 +- Data/MySQL/include/Poco/Data/MySQL/Utility.h | 2 +- Data/MySQL/src/Connector.cpp | 4 +- Data/MySQL/src/MySQLException.cpp | 2 +- Data/MySQL/src/StatementExecutor.cpp | 6 +- Data/MySQL/src/Utility.cpp | 2 +- Data/MySQL/testsuite/Makefile | 4 +- Data/MySQL/testsuite/src/MySQLTest.cpp | 2 + Data/MySQL/testsuite/src/MySQLTestSuite.cpp | 1 + Data/MySQL/testsuite/src/SQLExecutor.cpp | 86 +++++++++---------- configure | 18 ++++ 17 files changed, 125 insertions(+), 63 deletions(-) create mode 100644 Data/MySQL/MySQL.make diff --git a/Data/MySQL/Makefile b/Data/MySQL/Makefile index 611cae0f7..915f387b7 100644 --- a/Data/MySQL/Makefile +++ b/Data/MySQL/Makefile @@ -6,8 +6,9 @@ include $(POCO_BASE)/build/rules/global -SYSLIBS += -L/usr/local/lib -L/usr/local/lib$(LIB64SUFFIX)/mysql -L/usr/lib$(LIB64SUFFIX)/mysql -L/usr/mysql/lib$(LIB64SUFFIX) -L/usr/mysql/lib$(LIB64SUFFIX)/mysql -L/usr/local/mysql/lib$(LIB64SUFFIX) -L/usr/local/opt/mysql-client/lib -lmysqlclient -INCLUDE += -I/usr/local/include/mysql/ -I/usr/include/mysql/ -I/usr/mysql/include/mysql -I/usr/local/mysql/include -I/usr/local/opt/mysql-client/include/mysql +include MySQL.make + +SYSLIBS += -lmysqlclient SYSFLAGS += -DTHREADSAFE -DNO_TCL objects = Binder Extractor SessionImpl Connector \ diff --git a/Data/MySQL/MySQL.make b/Data/MySQL/MySQL.make new file mode 100644 index 000000000..07770d603 --- /dev/null +++ b/Data/MySQL/MySQL.make @@ -0,0 +1,40 @@ +# +# MySQL.make +# +# Makefile fragment for finding MySQL library +# + +ifndef POCO_MYSQL_INCLUDE +ifeq (0, $(shell test -d /usr/local/include/mysql; echo $$?)) +POCO_MYSQL_INCLUDE = /usr/local/include +else +ifeq (0, $(shell test -d /usr/local/opt/mysql-client; echo $$?)) +POCO_MYSQL_INCLUDE = /usr/local/opt/mysql-client/include +else +ifeq (0, $(shell test -d /usr/local/opt/mysql; echo $$?)) +POCO_MYSQL_INCLUDE = /usr/local/opt/mysql/include +endif +endif +endif +endif + +ifndef POCO_MYSQL_LIB +ifeq (0, $(shell test -d /usr/local/include/mysql; echo $$?)) +POCO_MYSQL_LIB = /usr/local/lib +else +ifeq (0, $(shell test -d /usr/local/opt/mysql-client/lib; echo $$?)) +POCO_MYSQL_INCLUDE = /usr/local/opt/mysql-client/lib +else +ifeq (0, $(shell test -d /usr/local/opt/mysql/lib; echo $$?)) +POCO_MYSQL_INCLUDE = /usr/local/opt/mysql/lib +endif +endif +endif +endif + +ifdef POCO_MYSQL_INCLUDE +INCLUDE += -I$(POCO_MYSQL_INCLUDE) +endif +ifdef POCO_MYSQL_LIB +SYSLIBS += -L$(POCO_MYSQL_LIB) +endif diff --git a/Data/MySQL/include/Poco/Data/MySQL/Binder.h b/Data/MySQL/include/Poco/Data/MySQL/Binder.h index 0c11698b5..3f379c981 100644 --- a/Data/MySQL/include/Poco/Data/MySQL/Binder.h +++ b/Data/MySQL/include/Poco/Data/MySQL/Binder.h @@ -22,7 +22,7 @@ #include "Poco/Data/AbstractBinder.h" #include "Poco/Data/LOB.h" #include "Poco/Data/MySQL/MySQLException.h" -#include +#include namespace Poco { @@ -72,7 +72,7 @@ public: virtual void bind(std::size_t pos, const unsigned long& val, Direction dir = PD_IN); /// Binds an unsigned long. -#endif +#endif virtual void bind(std::size_t pos, const bool& val, Direction dir); /// Binds a boolean. diff --git a/Data/MySQL/include/Poco/Data/MySQL/MySQLException.h b/Data/MySQL/include/Poco/Data/MySQL/MySQLException.h index 9a0a754e7..67692df3a 100644 --- a/Data/MySQL/include/Poco/Data/MySQL/MySQLException.h +++ b/Data/MySQL/include/Poco/Data/MySQL/MySQLException.h @@ -20,9 +20,9 @@ #include "Poco/Data/MySQL/MySQL.h" #include "Poco/Data/DataException.h" +#include #include #include -#include namespace Poco { diff --git a/Data/MySQL/include/Poco/Data/MySQL/ResultMetadata.h b/Data/MySQL/include/Poco/Data/MySQL/ResultMetadata.h index 79273f001..3a45387bc 100644 --- a/Data/MySQL/include/Poco/Data/MySQL/ResultMetadata.h +++ b/Data/MySQL/include/Poco/Data/MySQL/ResultMetadata.h @@ -18,9 +18,9 @@ #define Data_MySQL_ResultMetadata_INCLUDED -#include -#include #include "Poco/Data/MetaColumn.h" +#include +#include #if LIBMYSQL_VERSION_ID >= 80000 diff --git a/Data/MySQL/include/Poco/Data/MySQL/SessionHandle.h b/Data/MySQL/include/Poco/Data/MySQL/SessionHandle.h index 3417a6cf6..4f65ae5c0 100644 --- a/Data/MySQL/include/Poco/Data/MySQL/SessionHandle.h +++ b/Data/MySQL/include/Poco/Data/MySQL/SessionHandle.h @@ -18,8 +18,8 @@ #define Data_MySQL_SessionHandle_INCLUDED -#include #include "Poco/Data/MySQL/MySQLException.h" +#include namespace Poco { diff --git a/Data/MySQL/include/Poco/Data/MySQL/StatementExecutor.h b/Data/MySQL/include/Poco/Data/MySQL/StatementExecutor.h index 871cb4adb..6767b68bd 100644 --- a/Data/MySQL/include/Poco/Data/MySQL/StatementExecutor.h +++ b/Data/MySQL/include/Poco/Data/MySQL/StatementExecutor.h @@ -18,8 +18,8 @@ #define Data_MySQL_StatementHandle_INCLUDED -#include #include "Poco/Data/MySQL/MySQLException.h" +#include namespace Poco { @@ -66,7 +66,7 @@ public: /// Fetches the column. int getAffectedRowCount() const; - + operator MYSQL_STMT* (); /// Cast operator to native handle type. diff --git a/Data/MySQL/include/Poco/Data/MySQL/Utility.h b/Data/MySQL/include/Poco/Data/MySQL/Utility.h index 4fba2c91c..79c13c394 100644 --- a/Data/MySQL/include/Poco/Data/MySQL/Utility.h +++ b/Data/MySQL/include/Poco/Data/MySQL/Utility.h @@ -20,7 +20,7 @@ #include "Poco/Data/MySQL/MySQL.h" #include "Poco/Data/Session.h" -#include +#include namespace Poco { diff --git a/Data/MySQL/src/Connector.cpp b/Data/MySQL/src/Connector.cpp index 5062bad04..b90abab09 100644 --- a/Data/MySQL/src/Connector.cpp +++ b/Data/MySQL/src/Connector.cpp @@ -16,7 +16,7 @@ #include "Poco/Data/MySQL/SessionImpl.h" #include "Poco/Data/SessionFactory.h" #include "Poco/Exception.h" -#include +#include namespace Poco { @@ -46,7 +46,7 @@ const std::string& Connector::name() const Poco::AutoPtr Connector::createSession(const std::string& connectionString, std::size_t timeout) { - return Poco::AutoPtr(new SessionImpl(connectionString, timeout)); + return Poco::AutoPtr(new SessionImpl(connectionString, timeout)); } diff --git a/Data/MySQL/src/MySQLException.cpp b/Data/MySQL/src/MySQLException.cpp index 68dc2f9f8..c74ef5a00 100644 --- a/Data/MySQL/src/MySQLException.cpp +++ b/Data/MySQL/src/MySQLException.cpp @@ -13,7 +13,7 @@ #include "Poco/Data/MySQL/MySQLException.h" -#include +#include #include diff --git a/Data/MySQL/src/StatementExecutor.cpp b/Data/MySQL/src/StatementExecutor.cpp index f97243054..b7e8dbcd8 100644 --- a/Data/MySQL/src/StatementExecutor.cpp +++ b/Data/MySQL/src/StatementExecutor.cpp @@ -12,9 +12,9 @@ // -#include #include "Poco/Data/MySQL/StatementExecutor.h" #include "Poco/Format.h" +#include namespace Poco { @@ -52,7 +52,7 @@ void StatementExecutor::prepare(const std::string& query) _state = STMT_COMPILED; return; } - + int rc = mysql_stmt_prepare(_pHandle, query.c_str(), static_cast(query.length())); if (rc != 0) { @@ -119,7 +119,7 @@ bool StatementExecutor::fetch() int res = mysql_stmt_fetch(_pHandle); // we have specified zero buffers for BLOBs, so DATA_TRUNCATED is normal in this case - if ((res != 0) && (res != MYSQL_NO_DATA) && (res != MYSQL_DATA_TRUNCATED)) + if ((res != 0) && (res != MYSQL_NO_DATA) && (res != MYSQL_DATA_TRUNCATED)) throw StatementException("mysql_stmt_fetch error", _pHandle, _query); return (res == 0) || (res == MYSQL_DATA_TRUNCATED); diff --git a/Data/MySQL/src/Utility.cpp b/Data/MySQL/src/Utility.cpp index b711901ce..84e5cfca7 100644 --- a/Data/MySQL/src/Utility.cpp +++ b/Data/MySQL/src/Utility.cpp @@ -15,7 +15,7 @@ #include "Poco/Data/MySQL/Utility.h" -#include +#include namespace Poco { diff --git a/Data/MySQL/testsuite/Makefile b/Data/MySQL/testsuite/Makefile index 4edd7b576..440722fc8 100644 --- a/Data/MySQL/testsuite/Makefile +++ b/Data/MySQL/testsuite/Makefile @@ -6,10 +6,10 @@ include $(POCO_BASE)/build/rules/global -INCLUDE += -I./../include -I/usr/local/include/mysql -I/usr/include/mysql/ -I/usr/mysql/include/mysql -I/usr/local/mysql/include -I/usr/local/opt/mysql-client/include/mysql +include $(POCO_BASE)/Data/MySQL/MySQL.make # Note: linking order is important, do not change it. -SYSLIBS += -L/usr/local/lib -L/usr/local/lib$(LIB64SUFFIX)/mysql -L/usr/lib$(LIB64SUFFIX)/mysql -L/usr/mysql/lib$(LIB64SUFFIX) -L/usr/mysql/lib$(LIB64SUFFIX)/mysql -L/usr/local/mysql/lib$(LIB64SUFFIX) -L/usr/local/opt/mysql-client/lib -lmysqlclient -lz -lpthread -ldl +SYSLIBS += -lmysqlclient -lz -lpthread -ldl objects = MySQLTestSuite Driver MySQLTest SQLExecutor diff --git a/Data/MySQL/testsuite/src/MySQLTest.cpp b/Data/MySQL/testsuite/src/MySQLTest.cpp index 087d13bdb..26b0fa67f 100644 --- a/Data/MySQL/testsuite/src/MySQLTest.cpp +++ b/Data/MySQL/testsuite/src/MySQLTest.cpp @@ -45,7 +45,9 @@ Poco::SharedPtr MySQLTest::_pExecutor = 0; #define MYSQL_USER "pocotest" #define MYSQL_PWD "pocotest" #define MYSQL_HOST "127.0.0.1" +#ifndef MYSQL_PORT #define MYSQL_PORT 3306 +#endif #define MYSQL_DB "pocotest" // diff --git a/Data/MySQL/testsuite/src/MySQLTestSuite.cpp b/Data/MySQL/testsuite/src/MySQLTestSuite.cpp index 8d9041bcd..69e690d5a 100644 --- a/Data/MySQL/testsuite/src/MySQLTestSuite.cpp +++ b/Data/MySQL/testsuite/src/MySQLTestSuite.cpp @@ -11,6 +11,7 @@ #include "MySQLTestSuite.h" #include "MySQLTest.h" + CppUnit::Test* MySQLTestSuite::suite() { CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("MySQLTestSuite"); diff --git a/Data/MySQL/testsuite/src/SQLExecutor.cpp b/Data/MySQL/testsuite/src/SQLExecutor.cpp index a0484068b..da7ac2f4b 100644 --- a/Data/MySQL/testsuite/src/SQLExecutor.cpp +++ b/Data/MySQL/testsuite/src/SQLExecutor.cpp @@ -27,9 +27,9 @@ #ifdef _WIN32 #include -#endif +#endif -#include +#include #include #include @@ -141,7 +141,7 @@ private: } } // namespace Poco::Data -SQLExecutor::SQLExecutor(const std::string& name, Poco::Data::Session* pSession): +SQLExecutor::SQLExecutor(const std::string& name, Poco::Data::Session* pSession): CppUnit::TestCase(name), _pSession(pSession) { @@ -161,22 +161,22 @@ void SQLExecutor::bareboneMySQLTest(const char* host, const char* user, const ch MYSQL* tmp = mysql_real_connect(hsession, host, user, pwd, db, port, 0, 0); assertTrue (tmp == hsession); - + MYSQL_STMT* hstmt = mysql_stmt_init(hsession); assertTrue (hstmt != 0); - + std::string sql = "DROP TABLE Test"; mysql_real_query(hsession, sql.c_str(), static_cast(sql.length())); - + sql = tableCreateString; - rc = mysql_stmt_prepare(hstmt, sql.c_str(), static_cast(sql.length())); + rc = mysql_stmt_prepare(hstmt, sql.c_str(), static_cast(sql.length())); assertTrue (rc == 0); rc = mysql_stmt_execute(hstmt); assertTrue (rc == 0); sql = "INSERT INTO Test VALUES (?,?,?,?,?)"; - rc = mysql_stmt_prepare(hstmt, sql.c_str(), static_cast(sql.length())); + rc = mysql_stmt_prepare(hstmt, sql.c_str(), static_cast(sql.length())); assertTrue (rc == 0); std::string str[3] = { "111", "222", "333" }; @@ -219,7 +219,7 @@ void SQLExecutor::bareboneMySQLTest(const char* host, const char* user, const ch fifth = 0.0f; MYSQL_BIND bind_result[5] = {{0}}; - + bind_result[0].buffer = chr[0]; bind_result[0].buffer_length = sizeof(chr[0]); bind_result[0].buffer_type = MYSQL_TYPE_STRING; @@ -279,15 +279,15 @@ void SQLExecutor::simpleAccess() std::string result; count = 0; - try - { + try + { Statement stmt(*_pSession); - stmt << "INSERT INTO Person VALUES (?,?,?,?)", use(lastName), use(firstName), use(address), use(age);//, now; + stmt << "INSERT INTO Person VALUES (?,?,?,?)", use(lastName), use(firstName), use(address), use(age);//, now; stmt.execute(); } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - + try { *_pSession << "SELECT COUNT(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } @@ -549,7 +549,7 @@ void SQLExecutor::insertSingleBulkVec() { std::string funct = "insertSingleBulkVec()"; std::vector data; - + for (int x = 0; x < 100; ++x) data.push_back(x); @@ -938,7 +938,7 @@ void SQLExecutor::multiMapComplex() people.insert(std::make_pair("LN1", p1)); people.insert(std::make_pair("LN1", p1)); people.insert(std::make_pair("LN2", p2)); - + try { *_pSession << "INSERT INTO Person VALUES (?,?,?,?)", use(people), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } @@ -1000,7 +1000,7 @@ void SQLExecutor::selectIntoSingleStep() catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } assertTrue (count == 2); Person result; - Statement stmt = (*_pSession << "SELECT * FROM Person", into(result), limit(1)); + Statement stmt = (*_pSession << "SELECT * FROM Person", into(result), limit(1)); stmt.execute(); assertTrue (result == p1); assertTrue (!stmt.done()); @@ -1264,7 +1264,7 @@ void SQLExecutor::dateTime() std::string firstName("Simpson"); std::string address("Springfield"); DateTime birthday(1980, 4, 1, 5, 45, 12, 354, 879); - + int count = 0; try { *_pSession << "INSERT INTO Person VALUES (?,?,?,?)", use(lastName), use(firstName), use(address), use(birthday), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } @@ -1273,14 +1273,14 @@ void SQLExecutor::dateTime() catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } assertTrue (count == 1); - + DateTime bd; assertTrue (bd != birthday); try { *_pSession << "SELECT Birthday FROM Person", into(bd), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } assertTrue (bd == birthday); - + std::cout << std::endl << RecordSet(*_pSession, "SELECT * FROM Person"); } @@ -1292,7 +1292,7 @@ void SQLExecutor::date() std::string firstName("Simpson"); std::string address("Springfield"); Date birthday(1980, 4, 1); - + int count = 0; try { *_pSession << "INSERT INTO Person VALUES (?,?,?,?)", use(lastName), use(firstName), use(address), use(birthday), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } @@ -1301,14 +1301,14 @@ void SQLExecutor::date() catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } assertTrue (count == 1); - + Date bd; assertTrue (bd != birthday); try { *_pSession << "SELECT Birthday FROM Person", into(bd), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } assertTrue (bd == birthday); - + std::cout << std::endl << RecordSet(*_pSession, "SELECT * FROM Person"); } @@ -1320,7 +1320,7 @@ void SQLExecutor::time() std::string firstName("Simpson"); std::string address("Springfield"); Time birthday(1, 2, 3); - + int count = 0; try { *_pSession << "INSERT INTO Person VALUES (?,?,?,?)", use(lastName), use(firstName), use(address), use(birthday), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } @@ -1329,14 +1329,14 @@ void SQLExecutor::time() catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } assertTrue (count == 1); - + Time bd; assertTrue (bd != birthday); try { *_pSession << "SELECT Birthday FROM Person", into(bd), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } assertTrue (bd == birthday); - + std::cout << std::endl << RecordSet(*_pSession, "SELECT * FROM Person"); } @@ -1436,7 +1436,7 @@ void SQLExecutor::tupleVector() typedef Tuple TupleType; std::string funct = "tupleVector()"; TupleType t(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19); - Tuple + Tuple t10(10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29); TupleType t100(100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119); std::vector v; @@ -1475,8 +1475,8 @@ void SQLExecutor::internalExtraction() catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - try - { + try + { Statement stmt = (*_pSession << "SELECT * FROM Vectors", now); RecordSet rset(stmt); @@ -1523,7 +1523,7 @@ void SQLExecutor::internalExtraction() assertTrue ("5" == s); i = rset.value("str0", 2); assertTrue (5 == i); - + const Column& col = rset.column(0); Column::Iterator it = col.begin(); Column::Iterator end = col.end(); @@ -1563,7 +1563,7 @@ void SQLExecutor::internalExtraction() try { rset.value(0,0); fail ("must fail"); } catch (BadCastException&) { } - + stmt = (*_pSession << "DELETE FROM Vectors", now); rset = stmt; @@ -1579,10 +1579,10 @@ void SQLExecutor::internalExtraction() void SQLExecutor::doNull() { std::string funct = "null()"; - - *_pSession << "INSERT INTO Vectors VALUES (?, ?, ?)", - use(Poco::Data::Keywords::null), - use(Poco::Data::Keywords::null), + + *_pSession << "INSERT INTO Vectors VALUES (?, ?, ?)", + use(Poco::Data::Keywords::null), + use(Poco::Data::Keywords::null), use(Poco::Data::Keywords::null), now; int count = 0; @@ -1615,19 +1615,19 @@ void SQLExecutor::doNull() void SQLExecutor::setTransactionIsolation(Session& session, Poco::UInt32 ti) -{ +{ if (session.hasTransactionIsolation(ti)) { std::string funct = "setTransactionIsolation()"; - try + try { Transaction t(session, false); t.setIsolation(ti); - + assertTrue (ti == t.getIsolation()); assertTrue (t.isIsolation(ti)); - + assertTrue (ti == session.getTransactionIsolation()); assertTrue (session.isTransactionIsolation(ti)); } @@ -1789,11 +1789,11 @@ void SQLExecutor::transaction(const std::string& connect) Transaction trans((*_pSession)); assertTrue (trans.isActive()); assertTrue (_pSession->isTransaction()); - + try { (*_pSession) << "INSERT INTO Person VALUES (?,?,?,?)", use(lastNames), use(firstNames), use(addresses), use(ages), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - + assertTrue (_pSession->isTransaction()); assertTrue (trans.isActive()); @@ -1885,7 +1885,7 @@ void SQLExecutor::transaction(const std::string& connect) assertTrue (0 == count); trans.execute(sql); - + local << "SELECT COUNT(*) FROM Person", into(locCount), now; assertTrue (2 == locCount); @@ -1921,9 +1921,9 @@ void SQLExecutor::reconnect() assertTrue (_pSession->isConnected()); _pSession->close(); assertTrue (!_pSession->isConnected()); - try + try { - (*_pSession) << "SELECT LastName FROM Person", into(result), now; + (*_pSession) << "SELECT LastName FROM Person", into(result), now; fail ("must fail"); } catch(NotConnectedException&){ } diff --git a/configure b/configure index 73d98043b..9085f0c9c 100755 --- a/configure +++ b/configure @@ -102,6 +102,12 @@ Options: --odbc-include= Specify the directory where ODBC header files are located. + --mysql-lib= + Specify the directory where MySQL library is located. + + --mysql-include= + Specify the directory where MySQL header files are located. + --cflags= Pass additional flags to compiler. Example: --cflags=-wall @@ -178,6 +184,12 @@ while [ $# -ge 1 ]; do --odbc-include=*) odbcinclude="`echo ${1} | awk '{print substr($0,16)}'`" ;; + --mysql-lib=*) + mysqllib="`echo ${1} | awk '{print substr($0,13)}'`" ;; + + --mysql-include=*) + mysqlinclude="`echo ${1} | awk '{print substr($0,17)}'`" ;; + --cflags=*) flags="$flags `echo ${1} | awk '{print substr($0,10)}'`" ;; @@ -315,6 +327,12 @@ fi if [ -n "$odbcinclude" ] ; then echo "POCO_ODBC_INCLUDE = $odbcinclude" >>$build/config.make fi +if [ -n "$mysqllib" ] ; then + echo "POCO_MYSQL_LIB = $mysqllib" >>$build/config.make +fi +if [ -n "$mysqlinclude" ] ; then + echo "POCO_MYSQL_INCLUDE = $mysqlinclude" >>$build/config.make +fi if [ -n "$unbundled" ] ; then echo "POCO_UNBUNDLED = 1" >>$build/config.make fi