summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2014-09-18 10:04:20 +0300
committerLionel Elie Mamane <lionel@mamane.lu>2014-09-26 15:37:27 +0200
commitac10225762ce2c242d21126b5730b1d60f0150ed (patch)
tree6b66847a4ff1cfccc4c7656e0509f57da3c3c440
parent4e26b915687acbfab5ebc260d8a7a434761721bd (diff)
implement --with-system-odbc on windows
Change-Id: I1757b9ce74277b1c11533f41caeafaf9b88658ef
-rw-r--r--configure.ac16
-rw-r--r--connectivity/source/commontools/TSkipDeletedSet.cxx8
-rw-r--r--connectivity/source/drivers/calc/CTable.cxx8
-rw-r--r--connectivity/source/drivers/dbase/DTable.cxx8
-rw-r--r--connectivity/source/drivers/file/FResultSet.cxx22
-rw-r--r--connectivity/source/drivers/flat/ETable.cxx10
-rw-r--r--connectivity/source/drivers/odbc/OResultSet.cxx12
-rw-r--r--connectivity/source/inc/TResultSetHelper.hxx7
-rw-r--r--connectivity/source/inc/odbc/OFunctiondefs.hxx6
-rw-r--r--connectivity/source/parse/sqlbison.y2
-rw-r--r--connectivity/source/parse/sqliterator.cxx4
-rw-r--r--include/connectivity/IParseContext.hxx5
12 files changed, 63 insertions, 45 deletions
diff --git a/configure.ac b/configure.ac
index c4367d9c1dd7..a0b6ed5ff9a0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2783,7 +2783,6 @@ if test $_os = Darwin; then
;;
esac
- # If no CC and CXX environment vars, try to guess where the compiler is
LIBTOOL=libtool
INSTALL_NAME_TOOL=install_name_tool
if test -z "$save_CC"; then
@@ -8603,8 +8602,19 @@ if test "$with_system_odbc" = "yes" ; then
AC_MSG_RESULT([external])
SYSTEM_ODBC_HEADERS=TRUE
- AC_CHECK_HEADER(sqlext.h, [],
- [AC_MSG_ERROR(odbc not found. install odbc)], [])
+ if test "$build_os" = "cygwin"; then
+ save_CPPFLAGS=$CPPFLAGS
+ find_winsdk
+ PathFormat "$winsdktest"
+ CPPFLAGS="$CPPFLAGS -I$formatted_path/include/um -I$formatted_path/include -I$formatted_path/include/shared"
+ AC_CHECK_HEADER(sqlext.h, [],
+ [AC_MSG_ERROR(odbc not found. install odbc)],
+ [#include <windows.h>])
+ CPPFLAGS=$save_CPPFLAGS
+ else
+ AC_CHECK_HEADER(sqlext.h, [],
+ [AC_MSG_ERROR(odbc not found. install odbc)],[])
+ fi
elif test "$enable_database_connectivity" != yes; then
AC_MSG_RESULT([none])
else
diff --git a/connectivity/source/commontools/TSkipDeletedSet.cxx b/connectivity/source/commontools/TSkipDeletedSet.cxx
index 563d54555aa1..cd98dd3153fc 100644
--- a/connectivity/source/commontools/TSkipDeletedSet.cxx
+++ b/connectivity/source/commontools/TSkipDeletedSet.cxx
@@ -45,7 +45,7 @@ bool OSkipDeletedSet::skipDeleted(IResultSetHelper::Movement _eCursorPosition, s
switch (_eCursorPosition)
{
- case IResultSetHelper::ABSOLUTE:
+ case IResultSetHelper::ABSOLUTE1:
return moveAbsolute(_nOffset,_bRetrieveData);
case IResultSetHelper::FIRST: // set the movement when positioning failed
eDelPosition = IResultSetHelper::NEXT;
@@ -55,7 +55,7 @@ bool OSkipDeletedSet::skipDeleted(IResultSetHelper::Movement _eCursorPosition, s
eDelPosition = IResultSetHelper::PRIOR; // last row is invalid so position before
nDelOffset = 1;
break;
- case IResultSetHelper::RELATIVE:
+ case IResultSetHelper::RELATIVE1:
eDelPosition = (_nOffset >= 0) ? IResultSetHelper::NEXT : IResultSetHelper::PRIOR;
break;
default:
@@ -107,7 +107,7 @@ bool OSkipDeletedSet::skipDeleted(IResultSetHelper::Movement _eCursorPosition, s
}
return bDataFound;
}
- else if (_eCursorPosition != IResultSetHelper::RELATIVE)
+ else if (_eCursorPosition != IResultSetHelper::RELATIVE1)
{
bDataFound = m_pHelper->move(_eCursorPosition, _nOffset, _bRetrieveData);
bDone = bDataFound && (m_bDeletedVisible || !m_pHelper->isRowDeleted());
@@ -129,7 +129,7 @@ bool OSkipDeletedSet::skipDeleted(IResultSetHelper::Movement _eCursorPosition, s
while (bDataFound && !bDone) // Iterate until we are at the valid set
{
bDataFound = m_pHelper->move(eDelPosition, 1, _bRetrieveData);
- if (_eCursorPosition != IResultSetHelper::RELATIVE)
+ if (_eCursorPosition != IResultSetHelper::RELATIVE1)
bDone = bDataFound && (m_bDeletedVisible || !m_pHelper->isRowDeleted());
else if (bDataFound && (m_bDeletedVisible || !m_pHelper->isRowDeleted()))
{
diff --git a/connectivity/source/drivers/calc/CTable.cxx b/connectivity/source/drivers/calc/CTable.cxx
index b70a209f8001..1d6db8d1d625 100644
--- a/connectivity/source/drivers/calc/CTable.cxx
+++ b/connectivity/source/drivers/calc/CTable.cxx
@@ -739,11 +739,11 @@ bool OCalcTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int32 n
case IResultSetHelper::LAST:
m_nFilePos = nNumberOfRecords;
break;
- case IResultSetHelper::RELATIVE:
+ case IResultSetHelper::RELATIVE1:
m_nFilePos = (((sal_Int32)m_nFilePos) + nOffset < 0) ? 0L
: (sal_uInt32)(((sal_Int32)m_nFilePos) + nOffset);
break;
- case IResultSetHelper::ABSOLUTE:
+ case IResultSetHelper::ABSOLUTE1:
case IResultSetHelper::BOOKMARK:
m_nFilePos = (sal_uInt32)nOffset;
break;
@@ -769,8 +769,8 @@ Error:
break;
case IResultSetHelper::LAST:
case IResultSetHelper::NEXT:
- case IResultSetHelper::ABSOLUTE:
- case IResultSetHelper::RELATIVE:
+ case IResultSetHelper::ABSOLUTE1:
+ case IResultSetHelper::RELATIVE1:
if (nOffset > 0)
m_nFilePos = nNumberOfRecords + 1;
else if (nOffset < 0)
diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx
index 7d3f500b72bd..d1d834f2bbe3 100644
--- a/connectivity/source/drivers/dbase/DTable.cxx
+++ b/connectivity/source/drivers/dbase/DTable.cxx
@@ -2607,11 +2607,11 @@ bool ODbaseTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int32
case IResultSetHelper::LAST:
m_nFilePos = nNumberOfRecords;
break;
- case IResultSetHelper::RELATIVE:
+ case IResultSetHelper::RELATIVE1:
m_nFilePos = (((sal_Int32)m_nFilePos) + nOffset < 0) ? 0L
: (sal_uInt32)(((sal_Int32)m_nFilePos) + nOffset);
break;
- case IResultSetHelper::ABSOLUTE:
+ case IResultSetHelper::ABSOLUTE1:
case IResultSetHelper::BOOKMARK:
m_nFilePos = (sal_uInt32)nOffset;
break;
@@ -2653,8 +2653,8 @@ Error:
break;
case IResultSetHelper::LAST:
case IResultSetHelper::NEXT:
- case IResultSetHelper::ABSOLUTE:
- case IResultSetHelper::RELATIVE:
+ case IResultSetHelper::ABSOLUTE1:
+ case IResultSetHelper::RELATIVE1:
if (nOffset > 0)
m_nFilePos = nNumberOfRecords + 1;
else if (nOffset < 0)
diff --git a/connectivity/source/drivers/file/FResultSet.cxx b/connectivity/source/drivers/file/FResultSet.cxx
index 08210b592603..937773d53cef 100644
--- a/connectivity/source/drivers/file/FResultSet.cxx
+++ b/connectivity/source/drivers/file/FResultSet.cxx
@@ -434,14 +434,14 @@ sal_Bool SAL_CALL OResultSet::absolute( sal_Int32 row ) throw(SQLException, Runt
{
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
- return m_pTable ? m_aSkipDeletedSet.skipDeleted(IResultSetHelper::ABSOLUTE,row,true) : sal_False;
+ return m_pTable ? m_aSkipDeletedSet.skipDeleted(IResultSetHelper::ABSOLUTE1,row,true) : sal_False;
}
sal_Bool SAL_CALL OResultSet::relative( sal_Int32 row ) throw(SQLException, RuntimeException, std::exception)
{
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
- return m_pTable ? m_aSkipDeletedSet.skipDeleted(IResultSetHelper::RELATIVE,row,true) : sal_False;
+ return m_pTable ? m_aSkipDeletedSet.skipDeleted(IResultSetHelper::RELATIVE1,row,true) : sal_False;
}
sal_Bool SAL_CALL OResultSet::previous( ) throw(SQLException, RuntimeException, std::exception)
@@ -867,7 +867,7 @@ again:
}
else if (eCursorPosition == IResultSetHelper::FIRST ||
eCursorPosition == IResultSetHelper::NEXT ||
- eCursorPosition == IResultSetHelper::ABSOLUTE)
+ eCursorPosition == IResultSetHelper::ABSOLUTE1)
{
eCursorPosition = IResultSetHelper::NEXT;
nOffset = 1;
@@ -878,7 +878,7 @@ again:
eCursorPosition = IResultSetHelper::PRIOR;
nOffset = 1;
}
- else if (eCursorPosition == IResultSetHelper::RELATIVE)
+ else if (eCursorPosition == IResultSetHelper::RELATIVE1)
{
eCursorPosition = (nOffset >= 0) ? IResultSetHelper::NEXT : IResultSetHelper::PRIOR;
}
@@ -974,10 +974,10 @@ bool OResultSet::Move(IResultSetHelper::Movement eCursorPosition, sal_Int32 nOff
case IResultSetHelper::LAST:
m_nRowPos = m_pFileSet->get().size() - 1;
break;
- case IResultSetHelper::RELATIVE:
+ case IResultSetHelper::RELATIVE1:
m_nRowPos += nOffset;
break;
- case IResultSetHelper::ABSOLUTE:
+ case IResultSetHelper::ABSOLUTE1:
case IResultSetHelper::BOOKMARK:
if ( m_nRowPos == (nOffset -1) )
return true;
@@ -1014,7 +1014,7 @@ bool OResultSet::Move(IResultSetHelper::Movement eCursorPosition, sal_Int32 nOff
// set first on the last known row
if (m_pFileSet->get().empty())
{
- m_pTable->seekRow(IResultSetHelper::ABSOLUTE, 0, m_nFilePos);
+ m_pTable->seekRow(IResultSetHelper::ABSOLUTE1, 0, m_nFilePos);
}
else
{
@@ -1084,10 +1084,10 @@ bool OResultSet::Move(IResultSetHelper::Movement eCursorPosition, sal_Int32 nOff
case IResultSetHelper::LAST:
m_nRowPos = 0;
break;
- case IResultSetHelper::RELATIVE:
+ case IResultSetHelper::RELATIVE1:
m_nRowPos += nOffset;
break;
- case IResultSetHelper::ABSOLUTE:
+ case IResultSetHelper::ABSOLUTE1:
case IResultSetHelper::BOOKMARK:
m_nRowPos = nOffset - 1;
break;
@@ -1135,8 +1135,8 @@ Error:
break;
case IResultSetHelper::LAST:
case IResultSetHelper::NEXT:
- case IResultSetHelper::ABSOLUTE:
- case IResultSetHelper::RELATIVE:
+ case IResultSetHelper::ABSOLUTE1:
+ case IResultSetHelper::RELATIVE1:
if (nOffset > 0)
m_nRowPos = m_pFileSet.is() ? (sal_Int32)m_pFileSet->get().size() : -1;
else if (nOffset < 0)
diff --git a/connectivity/source/drivers/flat/ETable.cxx b/connectivity/source/drivers/flat/ETable.cxx
index 307f4cae4cfa..b9e3efee1ecc 100644
--- a/connectivity/source/drivers/flat/ETable.cxx
+++ b/connectivity/source/drivers/flat/ETable.cxx
@@ -826,17 +826,17 @@ bool OFlatTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int32 n
while(seekRow(IResultSetHelper::NEXT, 1, nCurPos)) ; // run through after last row
}
// m_nMaxRowCount can still be zero, but now it means there a genuinely zero rows in the table
- return seekRow(IResultSetHelper::ABSOLUTE, m_nMaxRowCount, nCurPos);
+ return seekRow(IResultSetHelper::ABSOLUTE1, m_nMaxRowCount, nCurPos);
break;
- case IResultSetHelper::RELATIVE:
+ case IResultSetHelper::RELATIVE1:
{
const sal_Int32 nNewRowPos = m_nRowPos + nOffset;
if (nNewRowPos < 0)
return false;
// ABSOLUTE will take care of case nNewRowPos > nMaxRowCount
- return seekRow(IResultSetHelper::ABSOLUTE, nNewRowPos, nCurPos);
+ return seekRow(IResultSetHelper::ABSOLUTE1, nNewRowPos, nCurPos);
}
- case IResultSetHelper::ABSOLUTE:
+ case IResultSetHelper::ABSOLUTE1:
{
if(nOffset < 0)
{
@@ -850,7 +850,7 @@ bool OFlatTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int32 n
}
if(nOffset < 0)
{
- seekRow(IResultSetHelper::ABSOLUTE, 0, nCurPos);
+ seekRow(IResultSetHelper::ABSOLUTE1, 0, nCurPos);
return false;
}
if(m_nMaxRowCount && nOffset > m_nMaxRowCount)
diff --git a/connectivity/source/drivers/odbc/OResultSet.cxx b/connectivity/source/drivers/odbc/OResultSet.cxx
index 5cda9222694f..a4073000bd76 100644
--- a/connectivity/source/drivers/odbc/OResultSet.cxx
+++ b/connectivity/source/drivers/odbc/OResultSet.cxx
@@ -744,12 +744,12 @@ sal_Bool SAL_CALL OResultSet::last( ) throw(SQLException, RuntimeException, std
sal_Bool SAL_CALL OResultSet::absolute( sal_Int32 row ) throw(SQLException, RuntimeException, std::exception)
{
- return moveImpl(IResultSetHelper::ABSOLUTE,row,true);
+ return moveImpl(IResultSetHelper::ABSOLUTE1,row,true);
}
sal_Bool SAL_CALL OResultSet::relative( sal_Int32 row ) throw(SQLException, RuntimeException, std::exception)
{
- return moveImpl(IResultSetHelper::RELATIVE,row,true);
+ return moveImpl(IResultSetHelper::RELATIVE1,row,true);
}
sal_Bool SAL_CALL OResultSet::previous( ) throw(SQLException, RuntimeException, std::exception)
@@ -1669,10 +1669,10 @@ bool OResultSet::move(IResultSetHelper::Movement _eCursorPosition, sal_Int32 _nO
case IResultSetHelper::LAST:
nFetchOrientation = SQL_FETCH_LAST;
break;
- case IResultSetHelper::RELATIVE:
+ case IResultSetHelper::RELATIVE1:
nFetchOrientation = SQL_FETCH_RELATIVE;
break;
- case IResultSetHelper::ABSOLUTE:
+ case IResultSetHelper::ABSOLUTE1:
nFetchOrientation = SQL_FETCH_ABSOLUTE;
break;
case IResultSetHelper::BOOKMARK: // special case here because we are only called with position numbers
@@ -1721,10 +1721,10 @@ bool OResultSet::move(IResultSetHelper::Movement _eCursorPosition, sal_Int32 _nO
case IResultSetHelper::LAST:
m_bEOF = true;
break;
- case IResultSetHelper::RELATIVE:
+ case IResultSetHelper::RELATIVE1:
m_nRowPos += _nOffset;
break;
- case IResultSetHelper::ABSOLUTE:
+ case IResultSetHelper::ABSOLUTE1:
case IResultSetHelper::BOOKMARK: // special case here because we are only called with position numbers
m_nRowPos = _nOffset;
break;
diff --git a/connectivity/source/inc/TResultSetHelper.hxx b/connectivity/source/inc/TResultSetHelper.hxx
index 542c441e2480..0bc4f914983b 100644
--- a/connectivity/source/inc/TResultSetHelper.hxx
+++ b/connectivity/source/inc/TResultSetHelper.hxx
@@ -34,9 +34,10 @@ namespace connectivity
PRIOR,
FIRST,
LAST,
- RELATIVE,
- ABSOLUTE,
- BOOKMARK
+ // Named like this to avoid conflict with a #define in the Windows system ODBC headers.
+ RELATIVE1,
+ ABSOLUTE1,
+ BOOKMARK,
};
public:
virtual bool move(Movement _eCursorPosition, sal_Int32 _nOffset, bool _bRetrieveData) = 0;
diff --git a/connectivity/source/inc/odbc/OFunctiondefs.hxx b/connectivity/source/inc/odbc/OFunctiondefs.hxx
index db4f69535912..d241ddcc209c 100644
--- a/connectivity/source/inc/odbc/OFunctiondefs.hxx
+++ b/connectivity/source/inc/odbc/OFunctiondefs.hxx
@@ -29,8 +29,14 @@
#endif
// just to go with calling convention of windows
+#if SYSTEM_ODBC_HEADERS
+#include <windows.h>
+#define SQL_API __stdcall
+#include <sqlext.h>
+#else
#define SQL_API __stdcall
#include <odbc/sqlext.h>
+#endif
#undef SQL_API
#define SQL_API __stdcall
diff --git a/connectivity/source/parse/sqlbison.y b/connectivity/source/parse/sqlbison.y
index 44f962e52205..4d8039da219b 100644
--- a/connectivity/source/parse/sqlbison.y
+++ b/connectivity/source/parse/sqlbison.y
@@ -4329,7 +4329,7 @@ OUString OParseContext::getErrorMessage(ErrorCode _eCode) const
case ERROR_INVALID_INT_COMPARE: aMsg = "The field can not be compared with a number."; break;
case ERROR_INVALID_DATE_COMPARE: aMsg = "The field can not be compared with a date."; break;
case ERROR_INVALID_REAL_COMPARE: aMsg = "The field can not be compared with a floating point number."; break;
- case ERROR_INVALID_TABLE: aMsg = "The database does not contain a table named \"#\"."; break;
+ case ERROR_INVALID_TABLE1: aMsg = "The database does not contain a table named \"#\"."; break;
case ERROR_INVALID_TABLE_OR_QUERY: aMsg = "The database does contain neither a table nor a query named \"#\"."; break;
case ERROR_INVALID_COLUMN: aMsg = "The column \"#1\" is unknown in the table \"#2\"."; break;
case ERROR_INVALID_TABLE_EXIST: aMsg = "The database already contains a table or view with name \"#\"."; break;
diff --git a/connectivity/source/parse/sqliterator.cxx b/connectivity/source/parse/sqliterator.cxx
index 7c4a1784600c..99cb3416a897 100644
--- a/connectivity/source/parse/sqliterator.cxx
+++ b/connectivity/source/parse/sqliterator.cxx
@@ -416,13 +416,13 @@ OSQLTable OSQLParseTreeIterator::impl_locateRecordSource( const OUString& _rComp
// m_xQueryContainer would not have been set), so emit a better error message
impl_appendError( IParseContext::ERROR_INVALID_TABLE_OR_QUERY, &sName );
else
- impl_appendError( IParseContext::ERROR_INVALID_TABLE, &sName );
+ impl_appendError( IParseContext::ERROR_INVALID_TABLE1, &sName );
}
}
}
catch(Exception&)
{
- impl_appendError( IParseContext::ERROR_INVALID_TABLE, &sComposedName );
+ impl_appendError( IParseContext::ERROR_INVALID_TABLE1, &sComposedName );
}
return aReturn;
diff --git a/include/connectivity/IParseContext.hxx b/include/connectivity/IParseContext.hxx
index 3b4001b9eb96..a012932a0fab 100644
--- a/include/connectivity/IParseContext.hxx
+++ b/include/connectivity/IParseContext.hxx
@@ -43,11 +43,12 @@ namespace connectivity
ERROR_INVALID_INT_COMPARE, // "The field can not be compared with a number."
ERROR_INVALID_DATE_COMPARE, // "The field can not be compared with a date."
ERROR_INVALID_REAL_COMPARE, // "The field can not be compared with a floating point number."
- ERROR_INVALID_TABLE, // "The database does not contain a table named \"#\"."
+ ERROR_INVALID_TABLE1, // "The database does not contain a table named \"#\"."
+ // Named like this to avoid conflict with a #define in the Windows system ODBC headers.
ERROR_INVALID_TABLE_OR_QUERY, // "The database does contain neither a table nor a query named \"#\"."
ERROR_INVALID_COLUMN, // "The column \"#1\" is unknown in the table \"#2\"."
ERROR_INVALID_TABLE_EXIST, // "The database already contains a table or view with name \"#\"."
- ERROR_INVALID_QUERY_EXIST // "The database already contains a query with name \"#\".";
+ ERROR_INVALID_QUERY_EXIST, // "The database already contains a query with name \"#\".";
};
enum InternationalKeyCode