summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrzej J.R. Hunt <andrzej@ahunt.org>2013-07-25 19:20:06 +0200
committerAndrzej J.R. Hunt <andrzej@ahunt.org>2013-07-25 19:41:20 +0200
commit89788d34ad79bb5a1fdfcbc2638c2ba12d2e835f (patch)
tree58390e9a9a48c20202441a2ccadee50555f31616
parentde0384045c20453a5468715cc364c31f14b2ae3e (diff)
Disable case insensitivity in findColumn (firebird-sdbc).
In theory it is possible to have case insensitive identifiers in firebird however these are only used with unquoted identifiers. Base by default always uses quoted identifiers, there doesn't seem to be any way of determining whether we are dealing with a case insensitive identifier when retrieving it from the database either. Change-Id: I4df0ab10c5a7c15ecde099e36978ac2e6c4ad0be
-rw-r--r--connectivity/source/drivers/firebird/FResultSet.cxx25
-rw-r--r--connectivity/source/drivers/firebird/FResultSet.hxx5
-rw-r--r--connectivity/source/drivers/firebird/FResultSetMetaData.cxx5
3 files changed, 22 insertions, 13 deletions
diff --git a/connectivity/source/drivers/firebird/FResultSet.cxx b/connectivity/source/drivers/firebird/FResultSet.cxx
index f72d528cf196..1fc3daf5c6a4 100644
--- a/connectivity/source/drivers/firebird/FResultSet.cxx
+++ b/connectivity/source/drivers/firebird/FResultSet.cxx
@@ -318,24 +318,25 @@ Any SAL_CALL OResultSet::queryInterface( const Type & rType ) throw(RuntimeExcep
return concatSequences(aTypes.getTypes(),OResultSet_BASE::getTypes());
}
-// -------------------------------------------------------------------------
-
-sal_Int32 SAL_CALL OResultSet::findColumn( const OUString& columnName ) throw(SQLException, RuntimeException)
+// ---- XColumnLocate ---------------------------------------------------------
+sal_Int32 SAL_CALL OResultSet::findColumn(const OUString& columnName)
+ throw(SQLException, RuntimeException)
{
-
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
- // find the first column with the name columnName
-
MutexGuard aGuard(m_pConnection->getMutex());
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
uno::Reference< XResultSetMetaData > xMeta = getMetaData();
sal_Int32 nLen = xMeta->getColumnCount();
- sal_Int32 i = 1;
- for(;i<=nLen;++i)
- if(xMeta->isCaseSensitive(i) ? columnName == xMeta->getColumnName(i) :
- columnName.equalsIgnoreAsciiCase(xMeta->getColumnName(i)))
+ sal_Int32 i;
+
+ for(i = 1; i<=nLen; ++i)
+ {
+ // We assume case sensitive, otherwise you'd have to test
+ // xMeta->isCaseSensitive and use qualsIgnoreAsciiCase as needed.
+ if (columnName == xMeta->getColumnName(i))
break;
+ }
+
return i;
}
// -------------------------------------------------------------------------
diff --git a/connectivity/source/drivers/firebird/FResultSet.hxx b/connectivity/source/drivers/firebird/FResultSet.hxx
index bae203fe09a3..e8e8a5ebc32d 100644
--- a/connectivity/source/drivers/firebird/FResultSet.hxx
+++ b/connectivity/source/drivers/firebird/FResultSet.hxx
@@ -296,7 +296,10 @@ namespace connectivity
::com::sun::star::uno::RuntimeException);
// XColumnLocate
- virtual sal_Int32 SAL_CALL findColumn( const ::rtl::OUString& columnName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL findColumn(const ::rtl::OUString& columnName)
+ throw(::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException);
+
// XRowLocate
virtual ::com::sun::star::uno::Any SAL_CALL getBookmark( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
virtual sal_Bool SAL_CALL moveToBookmark( const ::com::sun::star::uno::Any& bookmark ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
diff --git a/connectivity/source/drivers/firebird/FResultSetMetaData.cxx b/connectivity/source/drivers/firebird/FResultSetMetaData.cxx
index 578a08167464..e4dfcce46aa3 100644
--- a/connectivity/source/drivers/firebird/FResultSetMetaData.cxx
+++ b/connectivity/source/drivers/firebird/FResultSetMetaData.cxx
@@ -81,6 +81,11 @@ sal_Int32 SAL_CALL OResultSetMetaData::getColumnType(sal_Int32 column)
sal_Bool SAL_CALL OResultSetMetaData::isCaseSensitive(sal_Int32 column)
throw(SQLException, RuntimeException)
{
+ // Firebird is generally case sensitive when using quoted identifiers.
+ // IF THIS CHANGES make ResultSet::findColumn to be case-insenstive as needed.
+ // Generally names that are entirely UPPERCASE are case insensitive, however
+ // there remains some ambiguity if there is another mixed-case-named column
+ // of the same name. For safety always assume case insensitive.
(void) column;
return sal_False;
}