mirror of
				https://github.com/pocoproject/poco.git
				synced 2025-10-25 10:09:36 +02:00 
			
		
		
		
	few PostgreSQL fixes
This commit is contained in:
		 Alex Fabijanic
					Alex Fabijanic
				
			
				
					committed by
					
						 Günter Obiltschnig
						Günter Obiltschnig
					
				
			
			
				
	
			
			
			 Günter Obiltschnig
						Günter Obiltschnig
					
				
			
						parent
						
							6058f5dd23
						
					
				
				
					commit
					854bf4d79f
				
			| @@ -6,9 +6,38 @@ | |||||||
|  |  | ||||||
| include $(POCO_BASE)/build/rules/global | include $(POCO_BASE)/build/rules/global | ||||||
|  |  | ||||||
| INCLUDE += -I/usr/include/postgresql -I/usr/local/include/postgresql -I/usr/local/postgresql/include -I/opt/postgresql/include | ifeq (0, $(shell test -e /usr/include/postgresql; echo $$?)) | ||||||
|  | INCLUDE += -I/usr/include/postgresql | ||||||
|  | endif | ||||||
|  | ifeq (0, $(shell test -e /usr/local/include/postgresql; echo $$?)) | ||||||
|  | INCLUDE += -I/usr/local/include/postgresql | ||||||
|  | endif | ||||||
|  | ifeq (0, $(shell test -e /usr/local/postgresql/include; echo $$?)) | ||||||
|  | INCLUDE += -I/usr/local/postgresql/include | ||||||
|  | endif | ||||||
|  | ifeq (0, $(shell test -e /opt/postgresql/include; echo $$?)) | ||||||
|  | INCLUDE += -I/opt/postgresql/include | ||||||
|  | endif | ||||||
|  | ifeq (0, $(shell test -e /usr/local/opt/libpq/include; echo $$?)) | ||||||
|  | INCLUDE += -I/usr/local/opt/libpq/include | ||||||
|  | endif | ||||||
|  |  | ||||||
| SYSLIBS += -L/usr/lib$(LIB64SUFFIX)/postgresql -L/usr/local/lib$(LIB64SUFFIX)/postgresql -L/usr/local/postgresql/lib$(LIB64SUFFIX) -L/opt/postgresql/lib$(LIB64SUFFIX) -lpq | ifeq (0, $(shell test -e /usr/lib$(LIB64SUFFIX)/postgresql; echo $$?)) | ||||||
|  | SYSLIBS += -L/usr/lib$(LIB64SUFFIX)/postgresql | ||||||
|  | endif | ||||||
|  | ifeq (0, $(shell test -e /usr/local/lib$(LIB64SUFFIX)/postgresql; echo $$?)) | ||||||
|  | SYSLIBS += -L/usr/local/lib$(LIB64SUFFIX)/postgresql | ||||||
|  | endif | ||||||
|  | ifeq (0, $(shell test -e /usr/local/postgresql/lib$(LIB64SUFFIX); echo $$?)) | ||||||
|  | SYSLIBS += -L/usr/local/postgresql/lib$(LIB64SUFFIX) | ||||||
|  | endif | ||||||
|  | ifeq (0, $(shell test -e /opt/postgresql/lib$(LIB64SUFFIX); echo $$?)) | ||||||
|  | SYSLIBS += -L/opt/postgresql/lib$(LIB64SUFFIX) | ||||||
|  | endif | ||||||
|  | ifeq (0, $(shell test -e /opt/postgresql/lib$(LIB64SUFFIX); echo $$?)) | ||||||
|  | SYSLIBS += -L/opt/postgresql/lib$(LIB64SUFFIX) | ||||||
|  | endif | ||||||
|  | SYSLIBS += -lpq | ||||||
|  |  | ||||||
| objects = Extractor Binder SessionImpl Connector \ | objects = Extractor Binder SessionImpl Connector \ | ||||||
| 	PostgreSQLStatementImpl PostgreSQLException \ | 	PostgreSQLStatementImpl PostgreSQLException \ | ||||||
|   | |||||||
| @@ -213,11 +213,11 @@ public: | |||||||
|  |  | ||||||
| 	virtual void bind(std::size_t pos, const std::list<Time>& val, Direction dir = PD_IN); | 	virtual void bind(std::size_t pos, const std::list<Time>& val, Direction dir = PD_IN); | ||||||
|  |  | ||||||
| 	virtual void bind(std::size_t pos, const std::vector<NullData>& val, Direction dir = PD_IN, const std::type_info& bindType = typeid(void)); | 	virtual void bind(std::size_t pos, const std::vector<NullData>& val, Direction dir = PD_IN); | ||||||
|  |  | ||||||
| 	virtual void bind(std::size_t pos, const std::deque<NullData>& val, Direction dir = PD_IN, const std::type_info& bindType = typeid(void)); | 	virtual void bind(std::size_t pos, const std::deque<NullData>& val, Direction dir = PD_IN); | ||||||
|  |  | ||||||
| 	virtual void bind(std::size_t pos, const std::list<NullData>& val, Direction dir = PD_IN, const std::type_info& bindType = typeid(void)); | 	virtual void bind(std::size_t pos, const std::list<NullData>& val, Direction dir = PD_IN); | ||||||
|  |  | ||||||
| 	virtual void bind(std::size_t pos, const std::vector<std::string>& val, Direction dir = PD_IN); | 	virtual void bind(std::size_t pos, const std::vector<std::string>& val, Direction dir = PD_IN); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -632,19 +632,19 @@ void Binder::bind(std::size_t /*pos*/, const std::list<Poco::Data::Time>& /*val* | |||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| void Binder::bind(std::size_t /*pos*/, const std::vector<Poco::Data::NullData>& /*val*/, Direction /*dir*/, const std::type_info&) | void Binder::bind(std::size_t /*pos*/, const std::vector<Poco::Data::NullData>& /*val*/, Direction /*dir*/) | ||||||
| { | { | ||||||
| 	throw NotImplementedException(); | 	throw NotImplementedException(); | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| void Binder::bind(std::size_t /*pos*/, const std::deque<Poco::Data::NullData>& /*val*/, Direction /*dir*/, const std::type_info&) | void Binder::bind(std::size_t /*pos*/, const std::deque<Poco::Data::NullData>& /*val*/, Direction /*dir*/) | ||||||
| { | { | ||||||
| 	throw NotImplementedException(); | 	throw NotImplementedException(); | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| void Binder::bind(std::size_t /*pos*/, const std::list<Poco::Data::NullData>& /*val*/, Direction /*dir*/, const std::type_info&) | void Binder::bind(std::size_t /*pos*/, const std::list<Poco::Data::NullData>& /*val*/, Direction /*dir*/) | ||||||
| { | { | ||||||
| 	throw NotImplementedException(); | 	throw NotImplementedException(); | ||||||
| } | } | ||||||
|   | |||||||
| @@ -6,12 +6,40 @@ | |||||||
|  |  | ||||||
| include $(POCO_BASE)/build/rules/global | include $(POCO_BASE)/build/rules/global | ||||||
|  |  | ||||||
| INCLUDE += -I/usr/include/postgresql -I/usr/local/include/postgresql -I/usr/local/postgresql/include -I/opt/postgresql/include | ifeq (0, $(shell test -e /usr/include/postgresql; echo $$?)) | ||||||
|  | INCLUDE += -I/usr/include/postgresql | ||||||
|  | endif | ||||||
|  | ifeq (0, $(shell test -e /usr/local/include/postgresql; echo $$?)) | ||||||
|  | INCLUDE += -I/usr/local/include/postgresql | ||||||
|  | endif | ||||||
|  | ifeq (0, $(shell test -e /usr/local/postgresql/include; echo $$?)) | ||||||
|  | INCLUDE += -I/usr/local/postgresql/include | ||||||
|  | endif | ||||||
|  | ifeq (0, $(shell test -e /opt/postgresql/include; echo $$?)) | ||||||
|  | INCLUDE += -I/opt/postgresql/include | ||||||
|  | endif | ||||||
|  | ifeq (0, $(shell test -e /usr/local/opt/libpq/include; echo $$?)) | ||||||
|  | INCLUDE += -I/usr/local/opt/libpq/include | ||||||
|  | endif | ||||||
|  |  | ||||||
| SYSLIBS += -L/usr/lib$(LIB64SUFFIX)/postgresql -L/usr/local/lib$(LIB64SUFFIX)/postgresql -L/usr/local/postgresql/lib$(LIB64SUFFIX) -L/opt/postgresql/lib$(LIB64SUFFIX) -lpq | ifeq (0, $(shell test -e /usr/lib$(LIB64SUFFIX)/postgresql; echo $$?)) | ||||||
|  | SYSLIBS += -L/usr/lib$(LIB64SUFFIX)/postgresql | ||||||
|  | endif | ||||||
|  | ifeq (0, $(shell test -e /usr/local/lib$(LIB64SUFFIX)/postgresql; echo $$?)) | ||||||
|  | SYSLIBS += -L/usr/local/lib$(LIB64SUFFIX)/postgresql | ||||||
|  | endif | ||||||
|  | ifeq (0, $(shell test -e /usr/local/postgresql/lib$(LIB64SUFFIX); echo $$?)) | ||||||
|  | SYSLIBS += -L/usr/local/postgresql/lib$(LIB64SUFFIX) | ||||||
|  | endif | ||||||
|  | ifeq (0, $(shell test -e /opt/postgresql/lib$(LIB64SUFFIX); echo $$?)) | ||||||
|  | SYSLIBS += -L/opt/postgresql/lib$(LIB64SUFFIX) | ||||||
|  | endif | ||||||
|  | ifeq (0, $(shell test -e /opt/postgresql/lib$(LIB64SUFFIX); echo $$?)) | ||||||
|  | SYSLIBS += -L/opt/postgresql/lib$(LIB64SUFFIX) | ||||||
|  | endif | ||||||
|  |  | ||||||
| # Note: linking order is important, do not change it. | # Note: linking order is important, do not change it. | ||||||
| SYSLIBS += -lz -lpthread -ldl | SYSLIBS += -lpq -lz -lpthread -ldl | ||||||
|  |  | ||||||
| objects = PostgreSQLTestSuite Driver PostgreSQLTest SQLExecutor | objects = PostgreSQLTestSuite Driver PostgreSQLTest SQLExecutor | ||||||
|  |  | ||||||
|   | |||||||
| @@ -26,6 +26,7 @@ | |||||||
| #include "Poco/Data/DataException.h" | #include "Poco/Data/DataException.h" | ||||||
| #include <iostream> | #include <iostream> | ||||||
|  |  | ||||||
|  |  | ||||||
| using namespace Poco::Data; | using namespace Poco::Data; | ||||||
| using namespace Poco::Data::Keywords; | using namespace Poco::Data::Keywords; | ||||||
| using Poco::Data::PostgreSQL::ConnectionException; | using Poco::Data::PostgreSQL::ConnectionException; | ||||||
| @@ -39,45 +40,56 @@ using Poco::Tuple; | |||||||
| using Poco::NamedTuple; | using Poco::NamedTuple; | ||||||
| using Poco::Environment; | using Poco::Environment; | ||||||
|  |  | ||||||
|  |  | ||||||
| Poco::SharedPtr<Poco::Data::Session> PostgreSQLTest::_pSession = 0; | Poco::SharedPtr<Poco::Data::Session> PostgreSQLTest::_pSession = 0; | ||||||
| Poco::SharedPtr<SQLExecutor> PostgreSQLTest::_pExecutor = 0; | Poco::SharedPtr<SQLExecutor> PostgreSQLTest::_pExecutor = 0; | ||||||
|  |  | ||||||
|  |  | ||||||
| // | // | ||||||
| // Connection string | // Connection string | ||||||
| std::string PostgreSQLTest::_dbConnString; | std::string PostgreSQLTest::_dbConnString; | ||||||
|  |  | ||||||
|  |  | ||||||
| // | // | ||||||
| // Parameters for barebone-test | // Parameters for barebone-test | ||||||
| // | // | ||||||
| std::string PostgreSQLTest::getHost() { | std::string PostgreSQLTest::getHost() | ||||||
|  | { | ||||||
| 	return "localhost"; | 	return "localhost"; | ||||||
| } | } | ||||||
| std::string PostgreSQLTest::getPort() { |  | ||||||
|  |  | ||||||
|  | std::string PostgreSQLTest::getPort() | ||||||
|  | { | ||||||
| 	return "5432"; | 	return "5432"; | ||||||
| } | } | ||||||
| std::string PostgreSQLTest::getBase(){ |  | ||||||
|  |  | ||||||
|  | std::string PostgreSQLTest::getBase() | ||||||
|  | { | ||||||
| 	return "postgres"; | 	return "postgres"; | ||||||
| } | } | ||||||
| std::string PostgreSQLTest::getUser(){ |  | ||||||
|  |  | ||||||
|  | std::string PostgreSQLTest::getUser() | ||||||
|  | { | ||||||
| 	return "postgres"; | 	return "postgres"; | ||||||
| } | } | ||||||
| std::string PostgreSQLTest::getPass(){ |  | ||||||
|  |  | ||||||
|  | std::string PostgreSQLTest::getPass() | ||||||
|  | { | ||||||
| 	if (Environment::has("APPVEYOR")) | 	if (Environment::has("APPVEYOR")) | ||||||
| 	{ | 	{ | ||||||
| 		return "Password12!"; | 		return "Password12!"; | ||||||
| 	} | 	} | ||||||
| 	else if (Environment::has("JENKINS_HOME")) | 	else | ||||||
| 	{ | 	{ | ||||||
| 		return "postgres"; | 		return "postgres"; | ||||||
| 	} | 	} | ||||||
| 	else |  | ||||||
| 	{ |  | ||||||
| 		return "poco"; |  | ||||||
| 	} |  | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| PostgreSQLTest::PostgreSQLTest(const std::string& name): | PostgreSQLTest::PostgreSQLTest(const std::string& name): | ||||||
| 	CppUnit::TestCase(name) | 	CppUnit::TestCase(name) | ||||||
| { | { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user