mirror of
https://github.com/pocoproject/poco.git
synced 2025-04-16 15:01:15 +02:00
OSX compile g++/clang Data,ODBC,SQLite
This commit is contained in:
parent
32c5b6b998
commit
f7bd6a8fec
@ -5,62 +5,13 @@
|
|||||||
#
|
#
|
||||||
# Makefile for Poco ODBC
|
# Makefile for Poco ODBC
|
||||||
#
|
#
|
||||||
# For Unicode support, add following to COMMONFLAGS:
|
|
||||||
#
|
|
||||||
# -DUNICODE
|
|
||||||
#
|
|
||||||
# Unicode is supported only for UnixODBC
|
|
||||||
#
|
|
||||||
|
|
||||||
include $(POCO_BASE)/build/rules/global
|
include $(POCO_BASE)/build/rules/global
|
||||||
|
|
||||||
ifeq ($(LINKMODE),STATIC)
|
include ODBC.make
|
||||||
LIBLINKEXT = $(STATICLIBLINKEXT)
|
|
||||||
else
|
|
||||||
LIBLINKEXT = $(SHAREDLIBLINKEXT)
|
|
||||||
endif
|
|
||||||
|
|
||||||
INCLUDE += $(POCO_ODBC_INCLUDE)
|
|
||||||
SYSLIBS += $(POCO_ODBC_LIBRARY)
|
|
||||||
|
|
||||||
ifeq ($(POCO_CONFIG),MinGW)
|
|
||||||
# -DODBCVER=0x0300: SQLHandle declaration issue
|
|
||||||
# -DNOMINMAX : MIN/MAX macros defined in windows conflict with libstdc++
|
|
||||||
CXXFLAGS += -DODBCVER=0x0300 -DNOMINMAX
|
|
||||||
else ifeq ($(POCO_CONFIG),CYGWIN)
|
|
||||||
# -DODBCVER=0x0300: SQLHandle declaration issue
|
|
||||||
# -DNOMINMAX : MIN/MAX macros defined in windows conflict with libstdc++
|
|
||||||
CXXFLAGS += -DODBCVER=0x0300 -DNOMINMAX
|
|
||||||
# CYGWIN platform has its own ODBC library in /lib/w32api
|
|
||||||
SYSLIBS += -L/lib/w32api -lodbc32 -lodbccp32
|
|
||||||
else
|
|
||||||
ifeq (0, $(shell test -e $(POCO_ODBC_LIBRARY)/libodbc$(LIBLINKEXT); echo $$?))
|
|
||||||
SYSLIBS += -lodbc -lodbcinst
|
|
||||||
COMMONFLAGS += -DPOCO_UNIXODBC
|
|
||||||
else
|
|
||||||
ifeq (0, $(shell test -h $(POCO_ODBC_LIBRARY)/libodbc$(LIBLINKEXT); echo $$?))
|
|
||||||
SYSLIBS += -lodbc -lodbcinst
|
|
||||||
COMMONFLAGS += -DPOCO_UNIXODBC
|
|
||||||
else
|
|
||||||
ifeq (0, $(shell test -e $(POCO_ODBC_LIBRARY)/libiodbc$(LIBLINKEXT); echo $$?))
|
|
||||||
SYSLIBS += -liodbc -liodbcinst
|
|
||||||
COMMONFLAGS += -DPOCO_IODBC -I/usr/include/iodbc
|
|
||||||
else
|
|
||||||
ifeq (0, $(shell test -h $(POCO_ODBC_LIBRARY)/libiodbc$(LIBLINKEXT); echo $$?))
|
|
||||||
SYSLIBS += -liodbc -liodbcinst -I/usr/include/iodbc
|
|
||||||
COMMONFLAGS += -DPOCO_IODBC
|
|
||||||
else
|
|
||||||
ifndef (POCO_NO_ODBC)
|
|
||||||
$(warning No ODBC library found. Please install unixODBC or iODBC.)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
objects = Binder ConnectionHandle Connector EnvironmentHandle \
|
objects = Binder ConnectionHandle Connector EnvironmentHandle \
|
||||||
Extractor ODBCMetaColumn ODBCException ODBCStatementImpl \
|
Extractor ODBCException ODBCMetaColumn ODBCStatementImpl \
|
||||||
Parameter Preparator SessionImpl TypeInfo Unicode Utility
|
Parameter Preparator SessionImpl TypeInfo Unicode Utility
|
||||||
|
|
||||||
target = PocoDataODBC
|
target = PocoDataODBC
|
||||||
|
50
Data/ODBC/ODBC.make
Normal file
50
Data/ODBC/ODBC.make
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
#
|
||||||
|
# ODBC.make
|
||||||
|
#
|
||||||
|
# $Id: //poco/1.4/Data/ODBC/ODBC.make#1 $
|
||||||
|
#
|
||||||
|
# Makefile fragment for finding ODBC library
|
||||||
|
#
|
||||||
|
|
||||||
|
ifndef ODBCINCDIR
|
||||||
|
ODBCINCDIR = /usr/include
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifndef ODBCLIBDIR
|
||||||
|
ifeq (0, $(shell test -d /usr/lib/$(OSARCH)-linux-gnu; echo $$?))
|
||||||
|
ODBCLIBDIR = /usr/lib/$(OSARCH)-linux-gnu
|
||||||
|
else ifeq (0, $(shell test -d /usr/lib64; echo $$?))
|
||||||
|
ODBCLIBDIR = /usr/lib64
|
||||||
|
else
|
||||||
|
ODBCLIBDIR = /usr/lib
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(LINKMODE),STATIC)
|
||||||
|
LIBLINKEXT = .a
|
||||||
|
else
|
||||||
|
LIBLINKEXT = $(SHAREDLIBLINKEXT)
|
||||||
|
endif
|
||||||
|
|
||||||
|
INCLUDE += -I$(ODBCINCDIR)
|
||||||
|
SYSLIBS += -L$(ODBCLIBDIR)
|
||||||
|
|
||||||
|
ifeq ($(POCO_CONFIG),MinGW)
|
||||||
|
# -DODBCVER=0x0300: SQLHandle declaration issue
|
||||||
|
# -DNOMINMAX : MIN/MAX macros defined in windows conflict with libstdc++
|
||||||
|
CXXFLAGS += -DODBCVER=0x0300 -DNOMINMAX
|
||||||
|
else ifeq ($(POCO_CONFIG),CYGWIN)
|
||||||
|
# -DODBCVER=0x0300: SQLHandle declaration issue
|
||||||
|
# -DNOMINMAX : MIN/MAX macros defined in windows conflict with libstdc++
|
||||||
|
CXXFLAGS += -DODBCVER=0x0300 -DNOMINMAX
|
||||||
|
# CYGWIN platform has its own ODBC library in /lib/w32api
|
||||||
|
SYSLIBS += -L/lib/w32api -lodbc32 -lodbccp32
|
||||||
|
else ifeq (0, $(shell test -e $(ODBCLIBDIR)/libodbc$(LIBLINKEXT); echo $$?))
|
||||||
|
SYSLIBS += -lodbc -lodbcinst
|
||||||
|
COMMONFLAGS += -DPOCO_UNIXODBC
|
||||||
|
else ifeq (0, $(shell test -e $(ODBCLIBDIR)/libiodbc$(LIBLINKEXT); echo $$?))
|
||||||
|
SYSLIBS += -liodbc -liodbcinst
|
||||||
|
COMMONFLAGS += -DPOCO_IODBC -I/usr/include/iodbc
|
||||||
|
else
|
||||||
|
$(error No ODBC library found. Please install unixODBC or iODBC or specify ODBCLIBDIR and try again)
|
||||||
|
endif
|
@ -277,8 +277,8 @@ void ODBCStatementImpl::clear()
|
|||||||
//(returned by 3.x drivers when cursor is not opened)
|
//(returned by 3.x drivers when cursor is not opened)
|
||||||
for (int i = 0; i < diagnostics.count(); ++i)
|
for (int i = 0; i < diagnostics.count(); ++i)
|
||||||
{
|
{
|
||||||
if (ignoreError =
|
if ((ignoreError =
|
||||||
(INVALID_CURSOR_STATE == std::string(diagnostics.sqlState(i))))
|
(INVALID_CURSOR_STATE == std::string(diagnostics.sqlState(i)))))
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# Makefile
|
# Makefile
|
||||||
#
|
#
|
||||||
# $Id: //poco/Main/Data/ODBC/testsuite/Makefile#1 $
|
# $Id: //poco/1.4/Data/ODBC/testsuite/Makefile#4 $
|
||||||
#
|
#
|
||||||
# Makefile for Poco SQLite testsuite
|
# Makefile for Poco SQLite testsuite
|
||||||
#
|
#
|
||||||
@ -14,50 +14,7 @@
|
|||||||
|
|
||||||
include $(POCO_BASE)/build/rules/global
|
include $(POCO_BASE)/build/rules/global
|
||||||
|
|
||||||
ifeq ($(LINKMODE),STATIC)
|
include $(POCO_BASE)/Data/ODBC/ODBC.make
|
||||||
LIBLINKEXT = $(STATICLIBLINKEXT)
|
|
||||||
else
|
|
||||||
LIBLINKEXT = $(SHAREDLIBLINKEXT)
|
|
||||||
endif
|
|
||||||
|
|
||||||
INCLUDE += $(POCO_ODBC_INCLUDE)
|
|
||||||
SYSLIBS += $(POCO_ODBC_LIBRARY)
|
|
||||||
|
|
||||||
ifeq ($(POCO_CONFIG),MinGW)
|
|
||||||
# -DODBCVER=0x0300: SQLHandle declaration issue
|
|
||||||
# -DNOMINMAX : MIN/MAX macros defined in windows conflict with libstdc++
|
|
||||||
CXXFLAGS += -DODBCVER=0x0300 -DNOMINMAX
|
|
||||||
else ifeq ($(POCO_CONFIG),CYGWIN)
|
|
||||||
# -DODBCVER=0x0300: SQLHandle declaration issue
|
|
||||||
# -DNOMINMAX : MIN/MAX macros defined in windows conflict with libstdc++
|
|
||||||
CXXFLAGS += -DODBCVER=0x0300 -DNOMINMAX
|
|
||||||
# CYGWIN platform has its own ODBC library in /lib/w32api
|
|
||||||
SYSLIBS += -L/lib/w32api -lodbc32 -lodbccp32
|
|
||||||
else
|
|
||||||
ifeq (0, $(shell test -e $(POCO_ODBC_LIBRARY)/libodbc$(LIBLINKEXT); echo $$?))
|
|
||||||
SYSLIBS += -lodbc -lodbcinst
|
|
||||||
COMMONFLAGS += -DPOCO_UNIXODBC
|
|
||||||
else
|
|
||||||
ifeq (0, $(shell test -h $(POCO_ODBC_LIBRARY)/libodbc$(LIBLINKEXT); echo $$?))
|
|
||||||
SYSLIBS += -lodbc -lodbcinst
|
|
||||||
COMMONFLAGS += -DPOCO_UNIXODBC
|
|
||||||
else
|
|
||||||
ifeq (0, $(shell test -e $(POCO_ODBC_LIBRARY)/libiodbc$(LIBLINKEXT); echo $$?))
|
|
||||||
SYSLIBS += -liodbc -liodbcinst
|
|
||||||
COMMONFLAGS += -DPOCO_IODBC -I/usr/include/iodbc
|
|
||||||
else
|
|
||||||
ifeq (0, $(shell test -h $(POCO_ODBC_LIBRARY)/libiodbc$(LIBLINKEXT); echo $$?))
|
|
||||||
SYSLIBS += -liodbc -liodbcinst -I/usr/include/iodbc
|
|
||||||
COMMONFLAGS += -DPOCO_IODBC
|
|
||||||
else
|
|
||||||
ifndef (POCO_NO_ODBC)
|
|
||||||
$(warning No ODBC library found. Please install unixODBC or iODBC.)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
##################################################################################################
|
##################################################################################################
|
||||||
# Note: #
|
# Note: #
|
||||||
@ -68,6 +25,7 @@ SYSLIBS += -lltdl -ldl
|
|||||||
objects = ODBCTestSuite Driver \
|
objects = ODBCTestSuite Driver \
|
||||||
ODBCDB2Test ODBCMySQLTest ODBCOracleTest ODBCPostgreSQLTest \
|
ODBCDB2Test ODBCMySQLTest ODBCOracleTest ODBCPostgreSQLTest \
|
||||||
ODBCSQLiteTest ODBCSQLServerTest ODBCTest SQLExecutor
|
ODBCSQLiteTest ODBCSQLServerTest ODBCTest SQLExecutor
|
||||||
|
|
||||||
ifeq ($(POCO_CONFIG),MinGW)
|
ifeq ($(POCO_CONFIG),MinGW)
|
||||||
objects += ODBCAccessTest
|
objects += ODBCAccessTest
|
||||||
endif
|
endif
|
||||||
|
@ -607,7 +607,7 @@ void ODBCDB2Test::recreateLogTable()
|
|||||||
|
|
||||||
CppUnit::Test* ODBCDB2Test::suite()
|
CppUnit::Test* ODBCDB2Test::suite()
|
||||||
{
|
{
|
||||||
if (_pSession = init(_driver, _dsn, _uid, _pwd, _connectString))
|
if ((_pSession = init(_driver, _dsn, _uid, _pwd, _connectString)))
|
||||||
{
|
{
|
||||||
std::cout << "*** Connected to [" << _driver << "] test database." << std::endl;
|
std::cout << "*** Connected to [" << _driver << "] test database." << std::endl;
|
||||||
|
|
||||||
|
@ -436,7 +436,7 @@ void ODBCMySQLTest::recreateLogTable()
|
|||||||
|
|
||||||
CppUnit::Test* ODBCMySQLTest::suite()
|
CppUnit::Test* ODBCMySQLTest::suite()
|
||||||
{
|
{
|
||||||
if (_pSession = init(_driver, _dsn, _uid, _pwd, _connectString))
|
if ((_pSession = init(_driver, _dsn, _uid, _pwd, _connectString)))
|
||||||
{
|
{
|
||||||
std::cout << "*** Connected to [" << _driver << "] test database." << std::endl;
|
std::cout << "*** Connected to [" << _driver << "] test database." << std::endl;
|
||||||
|
|
||||||
|
@ -856,7 +856,7 @@ void ODBCOracleTest::recreateLogTable()
|
|||||||
|
|
||||||
CppUnit::Test* ODBCOracleTest::suite()
|
CppUnit::Test* ODBCOracleTest::suite()
|
||||||
{
|
{
|
||||||
if (_pSession = init(_driver, _dsn, _uid, _pwd, _connectString))
|
if ((_pSession = init(_driver, _dsn, _uid, _pwd, _connectString)))
|
||||||
{
|
{
|
||||||
std::cout << "*** Connected to [" << _driver << "] test database." << std::endl;
|
std::cout << "*** Connected to [" << _driver << "] test database." << std::endl;
|
||||||
|
|
||||||
|
@ -571,7 +571,7 @@ void ODBCPostgreSQLTest::recreateLogTable()
|
|||||||
|
|
||||||
CppUnit::Test* ODBCPostgreSQLTest::suite()
|
CppUnit::Test* ODBCPostgreSQLTest::suite()
|
||||||
{
|
{
|
||||||
if (_pSession = init(_driver, _dsn, _uid, _pwd, _connectString))
|
if ((_pSession = init(_driver, _dsn, _uid, _pwd, _connectString)))
|
||||||
{
|
{
|
||||||
std::cout << "*** Connected to [" << _driver << "] test database." << std::endl;
|
std::cout << "*** Connected to [" << _driver << "] test database." << std::endl;
|
||||||
|
|
||||||
|
@ -46,6 +46,8 @@
|
|||||||
#include "Poco/Data/MetaColumn.h"
|
#include "Poco/Data/MetaColumn.h"
|
||||||
#include "Poco/Data/DataException.h"
|
#include "Poco/Data/DataException.h"
|
||||||
#include "Poco/Data/Constants.h"
|
#include "Poco/Data/Constants.h"
|
||||||
|
#include "Poco/Data/Date.h"
|
||||||
|
#include "Poco/Data/Time.h"
|
||||||
#include "Poco/Any.h"
|
#include "Poco/Any.h"
|
||||||
#include "Poco/DynamicAny.h"
|
#include "Poco/DynamicAny.h"
|
||||||
#include "sqlite3.h"
|
#include "sqlite3.h"
|
||||||
|
Binary file not shown.
Binary file not shown.
@ -356,9 +356,10 @@ void SQLiteTest::testInMemory()
|
|||||||
assert (result == tableName);
|
assert (result == tableName);
|
||||||
|
|
||||||
tmp << "INSERT INTO PERSON VALUES(:ln, :fn, :ad, :age)", use(lastName), use(firstName), use(address), use(age), now;
|
tmp << "INSERT INTO PERSON VALUES(:ln, :fn, :ad, :age)", use(lastName), use(firstName), use(address), use(age), now;
|
||||||
|
|
||||||
// load db from file to memory
|
// load db from file to memory
|
||||||
Session mem (Poco::Data::SQLite::Connector::KEY, ":memory:");
|
Session mem (Poco::Data::SQLite::Connector::KEY, ":memory:");
|
||||||
|
sqlite3* p = 0; Any a = p; // ??? clang generated code fails to AnyCast without these
|
||||||
sqlite3* pMemHandle = AnyCast<sqlite3*>(mem.getProperty("handle"));
|
sqlite3* pMemHandle = AnyCast<sqlite3*>(mem.getProperty("handle"));
|
||||||
assert (Poco::Data::SQLite::Utility::fileToMemory(pMemHandle, "dummy.db"));
|
assert (Poco::Data::SQLite::Utility::fileToMemory(pMemHandle, "dummy.db"));
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ protected:
|
|||||||
typename BaseType::int_type readFromDevice()
|
typename BaseType::int_type readFromDevice()
|
||||||
{
|
{
|
||||||
if (_it != _lob.end())
|
if (_it != _lob.end())
|
||||||
return charToInt(*_it++);
|
return BaseType::charToInt(*_it++);
|
||||||
else
|
else
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user