Kaydet (Commit) 5677e3f2 authored tarafından Michael Stahl's avatar Michael Stahl

fix strings more in 1da3af5f

Change-Id: I7d4cf698721fcf972bf35babb6d53369719eed18
üst 5f3dacae
...@@ -337,19 +337,21 @@ ODsnTypeCollection::TypeIterator ODsnTypeCollection::end() const ...@@ -337,19 +337,21 @@ ODsnTypeCollection::TypeIterator ODsnTypeCollection::end() const
DATASOURCE_TYPE ODsnTypeCollection::determineType(const OUString& _rDsn) const DATASOURCE_TYPE ODsnTypeCollection::determineType(const OUString& _rDsn) const
{ {
OUString sDsn(comphelper::string::stripEnd(_rDsn, '*')); OUString sDsn(comphelper::string::stripEnd(_rDsn, '*'));
sal_uInt16 nSeparator = sDsn.indexOf((sal_Unicode)':'); sal_Int32 nSeparator = sDsn.indexOf(static_cast<sal_Unicode>(':'));
if (STRING_NOTFOUND == nSeparator) if (-1 == nSeparator)
{ {
// there should be at least one such separator // there should be at least one such separator
OSL_FAIL("ODsnTypeCollection::implDetermineType : missing the colon !"); OSL_FAIL("ODsnTypeCollection::implDetermineType : missing the colon !");
return DST_UNKNOWN; return DST_UNKNOWN;
} }
// find first : // find first :
sal_uInt16 nOracleSeparator = sDsn.indexOf((sal_Unicode)':', nSeparator + 1); sal_Int32 nOracleSeparator =
if ( nOracleSeparator != STRING_NOTFOUND ) sDsn.indexOf(static_cast<sal_Unicode>(':'), nSeparator + 1);
if (-1 != nOracleSeparator)
{ {
nOracleSeparator = sDsn.indexOf((sal_Unicode)':', nOracleSeparator + 1); nOracleSeparator =
if (nOracleSeparator != STRING_NOTFOUND && sDsn.equalsIgnoreAsciiCaseAsciiL("jdbc:oracle:thin", nOracleSeparator)) sDsn.indexOf(static_cast<sal_Unicode>(':'), nOracleSeparator + 1);
if (-1 != nOracleSeparator && sDsn.equalsIgnoreAsciiCaseAsciiL("jdbc:oracle:thin", nOracleSeparator))
return DST_ORACLE_JDBC; return DST_ORACLE_JDBC;
} }
...@@ -360,8 +362,8 @@ DATASOURCE_TYPE ODsnTypeCollection::determineType(const OUString& _rDsn) const ...@@ -360,8 +362,8 @@ DATASOURCE_TYPE ODsnTypeCollection::determineType(const OUString& _rDsn) const
return DST_EMBEDDED_HSQLDB; return DST_EMBEDDED_HSQLDB;
// find second : // find second :
nSeparator = sDsn.indexOf((sal_Unicode)':', nSeparator + 1); nSeparator = sDsn.indexOf(static_cast<sal_Unicode>(':'), nSeparator + 1);
if (STRING_NOTFOUND == nSeparator) if (-1 == nSeparator)
{ {
// at the moment only jdbc is allowed to have just one separator // at the moment only jdbc is allowed to have just one separator
OSL_FAIL("ODsnTypeCollection::implDetermineType : missing the second colon !"); OSL_FAIL("ODsnTypeCollection::implDetermineType : missing the second colon !");
...@@ -370,11 +372,11 @@ DATASOURCE_TYPE ODsnTypeCollection::determineType(const OUString& _rDsn) const ...@@ -370,11 +372,11 @@ DATASOURCE_TYPE ODsnTypeCollection::determineType(const OUString& _rDsn) const
if (sDsn.equalsIgnoreAsciiCaseAsciiL("sdbc:ado:", nSeparator)) if (sDsn.equalsIgnoreAsciiCaseAsciiL("sdbc:ado:", nSeparator))
{ {
nSeparator = sDsn.indexOf((sal_Unicode)':', nSeparator + 1); nSeparator = sDsn.indexOf(static_cast<sal_Unicode>(':'), nSeparator + 1);
if (STRING_NOTFOUND != nSeparator && sDsn.equalsIgnoreAsciiCaseAsciiL("sdbc:ado:access", nSeparator) ) if (-1 != nSeparator && sDsn.equalsIgnoreAsciiCaseAsciiL("sdbc:ado:access", nSeparator) )
{ {
nSeparator = sDsn.indexOf((sal_Unicode)';', nSeparator + 1); nSeparator = sDsn.indexOf(static_cast<sal_Unicode>(';'), nSeparator + 1);
if (STRING_NOTFOUND != nSeparator && sDsn.equalsIgnoreAsciiCaseAsciiL("sdbc:ado:access:Provider=Microsoft.ACE.OLEDB.12.0", nSeparator) ) if (-1 != nSeparator && sDsn.equalsIgnoreAsciiCaseAsciiL("sdbc:ado:access:Provider=Microsoft.ACE.OLEDB.12.0", nSeparator) )
return DST_MSACCESS_2007; return DST_MSACCESS_2007;
return DST_MSACCESS; return DST_MSACCESS;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment