diff options
author | Lionel Elie Mamane <lionel@mamane.lu> | 2013-03-17 11:54:38 +0100 |
---|---|---|
committer | Lionel Elie Mamane <lionel@mamane.lu> | 2013-03-17 11:55:26 +0100 |
commit | 7014a569ccd86f14386aeebc7a7279a3b4b3289b (patch) | |
tree | 29d21fe9f634e0d01c8662f85619a8b665e3a15a /dbaccess | |
parent | e1430b23879a40843fa8d9be1c79b607684f713e (diff) |
fix breakage introduced by String->OUString migration
Change-Id: Ia509d23306e71b978247705daa9c9559adbae195
Diffstat (limited to 'dbaccess')
-rw-r--r-- | dbaccess/source/core/misc/dsntypes.cxx | 48 | ||||
-rw-r--r-- | dbaccess/source/ui/dlg/ConnectionHelper.cxx | 2 |
2 files changed, 22 insertions, 28 deletions
diff --git a/dbaccess/source/core/misc/dsntypes.cxx b/dbaccess/source/core/misc/dsntypes.cxx index e9c48e2b81d0..77814e5e1f19 100644 --- a/dbaccess/source/core/misc/dsntypes.cxx +++ b/dbaccess/source/core/misc/dsntypes.cxx @@ -103,10 +103,12 @@ OUString ODsnTypeCollection::cutPrefix(const OUString& _sURL) const WildCard aWildCard(*aIter); if ( sOldPattern.getLength() < aIter->getLength() && aWildCard.Matches(_sURL) ) { - if ( aIter->getLength() < sURL.getLength() ) - sRet = sURL.copy(sURL.match(*aIter)); - else - sRet = sURL.copy(aIter->match(sURL)); + // This relies on the fact that all patterns are of the form + // foo* + // that is, the very concept of "prefix" applies. + OUString prefix(comphelper::string::stripEnd(*aIter, '*')); + OSL_ENSURE(prefix.getLength() <= sURL.getLength(), "How can A match B when A shorter than B?"); + sRet = sURL.copy(prefix.getLength()); sOldPattern = *aIter; } } @@ -127,11 +129,11 @@ OUString ODsnTypeCollection::getPrefix(const OUString& _sURL) const WildCard aWildCard(*aIter); if ( sOldPattern.getLength() < aIter->getLength() && aWildCard.Matches(sURL) ) { - if ( aIter->getLength() < sURL.getLength() ) - sRet = aIter->copy(0,sURL.match(*aIter)); - else - sRet = sURL.copy(0,aIter->match(sURL)); - sRet = comphelper::string::stripEnd(sRet, '*'); + // This relies on the fact that all patterns are of the form + // foo* + // that is, the very concept of "prefix" applies. + sRet = comphelper::string::stripEnd(*aIter, '*'); + OSL_ENSURE(sRet.getLength() <= sURL.getLength(), "How can A match B when A shorter than B?"); sOldPattern = *aIter; } } @@ -344,21 +346,15 @@ DATASOURCE_TYPE ODsnTypeCollection::determineType(const OUString& _rDsn) const OSL_FAIL("ODsnTypeCollection::implDetermineType : missing the colon !"); return DST_UNKNOWN; } + // find first : - sal_Int32 nOracleSeparator = - sDsn.indexOf(static_cast<sal_Unicode>(':'), nSeparator + 1); - if (-1 != nOracleSeparator) - { - nOracleSeparator = - sDsn.indexOf(static_cast<sal_Unicode>(':'), nOracleSeparator + 1); - if (-1 != nOracleSeparator && sDsn.equalsIgnoreAsciiCaseAsciiL("jdbc:oracle:thin", nOracleSeparator)) - return DST_ORACLE_JDBC; - } + if (sDsn.startsWithIgnoreAsciiCase("jdbc:oracle:thin:")) + return DST_ORACLE_JDBC; - if (sDsn.equalsIgnoreAsciiCaseAsciiL("jdbc", nSeparator)) + if (sDsn.startsWithIgnoreAsciiCase("jdbc:")) return DST_JDBC; - if (sDsn.equalsIgnoreAsciiCaseAsciiL("sdbc:embedded:hsqldb", sDsn.getLength())) + if (sDsn.equalsIgnoreAsciiCase("sdbc:embedded:hsqldb")) return DST_EMBEDDED_HSQLDB; // find second : @@ -370,16 +366,14 @@ DATASOURCE_TYPE ODsnTypeCollection::determineType(const OUString& _rDsn) const return DST_UNKNOWN; } - if (sDsn.equalsIgnoreAsciiCaseAsciiL("sdbc:ado:", nSeparator)) + if (sDsn.startsWithIgnoreAsciiCase("sdbc:ado:")) { - nSeparator = sDsn.indexOf(static_cast<sal_Unicode>(':'), nSeparator + 1); - if (-1 != nSeparator && sDsn.equalsIgnoreAsciiCaseAsciiL("sdbc:ado:access", nSeparator) ) + if (sDsn.startsWithIgnoreAsciiCase("sdbc:ado:access")) { - nSeparator = sDsn.indexOf(static_cast<sal_Unicode>(';'), nSeparator + 1); - if (-1 != nSeparator && sDsn.equalsIgnoreAsciiCaseAsciiL("sdbc:ado:access:Provider=Microsoft.ACE.OLEDB.12.0", nSeparator) ) + if (sDsn.equalsIgnoreAsciiCase("sdbc:ado:access:Provider=Microsoft.ACE.OLEDB.12.0;")) return DST_MSACCESS_2007; - - return DST_MSACCESS; + else + return DST_MSACCESS; } return DST_ADO; } diff --git a/dbaccess/source/ui/dlg/ConnectionHelper.cxx b/dbaccess/source/ui/dlg/ConnectionHelper.cxx index 9dad8a6b0304..b51ecc0211c1 100644 --- a/dbaccess/source/ui/dlg/ConnectionHelper.cxx +++ b/dbaccess/source/ui/dlg/ConnectionHelper.cxx @@ -339,7 +339,7 @@ DBG_NAME(OConnectionHelper) //------------------------------------------------------------------------- void OConnectionHelper::impl_setURL( const String& _rURL, sal_Bool _bPrefix ) { - String sURL( _rURL ); + String sURL( comphelper::string::stripEnd(_rURL, '*') ); OSL_ENSURE( m_pCollection, "OConnectionHelper::impl_setURL: have no interpreter for the URLs!" ); if ( m_pCollection && sURL.Len() ) |