[Libreoffice-commits] core.git: 2 commits - configure.ac connectivity/source include/connectivity

Lionel Elie Mamane lionel at mamane.lu
Fri Sep 26 06:38:08 PDT 2014


 configure.ac                                        |   20 +++++++++++++-----
 connectivity/source/commontools/TSkipDeletedSet.cxx |    8 +++----
 connectivity/source/drivers/calc/CTable.cxx         |    8 +++----
 connectivity/source/drivers/dbase/DTable.cxx        |    8 +++----
 connectivity/source/drivers/file/FResultSet.cxx     |   22 ++++++++++----------
 connectivity/source/drivers/flat/ETable.cxx         |   10 ++++-----
 connectivity/source/drivers/odbc/OResultSet.cxx     |   12 +++++-----
 connectivity/source/inc/TResultSetHelper.hxx        |    7 +++---
 connectivity/source/inc/odbc/OFunctiondefs.hxx      |    6 +++++
 connectivity/source/parse/sqlbison.y                |    2 -
 connectivity/source/parse/sqliterator.cxx           |    4 +--
 include/connectivity/IParseContext.hxx              |    5 ++--
 12 files changed, 65 insertions(+), 47 deletions(-)

New commits:
commit 314c469c93f0ac139f64f742d3fd89e587f42970
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date:   Tue Sep 16 12:25:29 2014 +0200

    try "Use system ODBC on MS Windows unless specifically overriden" again
    
    Now that Noel has a working pattch for system ODBC on MS Windows
    
    Change-Id: I11abb53486e45d9c7058c42011df41b5fad0fcde

diff --git a/configure.ac b/configure.ac
index a0b6ed5..823fcdd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1822,7 +1822,7 @@ AC_ARG_WITH(libbase-jar,
 AC_ARG_WITH(system-odbc,
     AS_HELP_STRING([--with-system-odbc],
         [Use the odbc headers already on system.]),,
-    [with_system_odbc="$with_system_headers"])
+    [with_system_odbc="auto"])
 
 AC_ARG_WITH(system-sane,
     AS_HELP_STRING([--with-system-sane],
@@ -8598,7 +8598,7 @@ dnl ===================================================================
 dnl Check for system odbc
 dnl ===================================================================
 AC_MSG_CHECKING([which odbc headers to use])
-if test "$with_system_odbc" = "yes" ; then
+if test "$with_system_odbc" = "yes" -o '(' "$with_system_headers" = "yes" -a "$with_system_odbc" = "auto" ')' -o '(' "$_os" = "WINNT" -a  "$with_system_odbc" != "no" ')'; then
     AC_MSG_RESULT([external])
     SYSTEM_ODBC_HEADERS=TRUE
 
commit ac10225762ce2c242d21126b5730b1d60f0150ed
Author: Noel Grandin <noel at peralex.com>
Date:   Thu Sep 18 10:04:20 2014 +0300

    implement --with-system-odbc on windows
    
    Change-Id: I1757b9ce74277b1c11533f41caeafaf9b88658ef

diff --git a/configure.ac b/configure.ac
index c4367d9..a0b6ed5 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 563d545..cd98dd3 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 b70a209..1d6db8d 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 7d3f500..d1d834f 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 08210b5..937773d 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 307f4ca..b9e3efe 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 5cda922..a407300 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 542c441..0bc4f91 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 db4f695..d241ddc 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 44f962e..4d8039d 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 7c4a178..99cb341 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 3b4001b..a012932 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


More information about the Libreoffice-commits mailing list