diff options
author | Rüdiger Timm <rt@openoffice.org> | 2005-06-27 07:24:37 +0000 |
---|---|---|
committer | Rüdiger Timm <rt@openoffice.org> | 2005-06-27 07:24:37 +0000 |
commit | bd897bae5ed17c85dacc773299f904e69d2a52e2 (patch) | |
tree | cc7b7a04b5fa37a82abf461e1d919ef642067fa0 /connectivity | |
parent | 3fe722d7b7d84103236ccd0fda2d27952328f6ec (diff) |
INTEGRATION: CWS hslqdb3 (1.11.22); FILE MERGED
2005/06/21 14:13:48 fs 1.11.22.3: #i45749# since 1.8.0 RC12, HSQLDB requires the 'default_schema=true' parameter to switch to schema-less mode
2005/06/21 10:47:43 fs 1.11.22.2: #i45749# new HSQLDB version prefers INFORMATION_SCHEMA.SYSTEM_SESSIONS over pure table name
2005/05/27 08:11:51 oj 1.11.22.1: #i45749# fix for read-only storage
Diffstat (limited to 'connectivity')
-rw-r--r-- | connectivity/source/drivers/hsqldb/HDriver.cxx | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/connectivity/source/drivers/hsqldb/HDriver.cxx b/connectivity/source/drivers/hsqldb/HDriver.cxx index 276791abe834..597090ff0a9b 100644 --- a/connectivity/source/drivers/hsqldb/HDriver.cxx +++ b/connectivity/source/drivers/hsqldb/HDriver.cxx @@ -2,9 +2,9 @@ * * $RCSfile: HDriver.cxx,v $ * - * $Revision: 1.11 $ + * $Revision: 1.12 $ * - * last change: $Author: hr $ $Date: 2005-04-06 10:35:10 $ + * last change: $Author: rt $ $Date: 2005-06-27 08:24:37 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -81,6 +81,9 @@ #ifndef _COM_SUN_STAR_EMBED_XTRANSACTIONBROADCASTER_HPP_ #include <com/sun/star/embed/XTransactionBroadcaster.hpp> #endif +#ifndef _COM_SUN_STAR_EMBED_ELEMENTMODES_HPP_ +#include <com/sun/star/embed/ElementModes.hpp> +#endif #ifndef CONNECTIVITY_CONNECTION_HXX #include "TConnection.hxx" #endif @@ -242,7 +245,7 @@ namespace connectivity bool bIsNewDatabase = !xStorage->hasElements(); - Sequence< PropertyValue > aConvertedProperties(8); + Sequence< PropertyValue > aConvertedProperties(9); sal_Int32 nPos = 0; aConvertedProperties[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("storage_key")); ::rtl::OUString sConnPartURL = sSystemPath.copy(0,nIndex); @@ -263,6 +266,23 @@ namespace connectivity aConvertedProperties[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IgnoreDriverPrivileges")); aConvertedProperties[nPos++].Value <<= sal_True; + // don't want to expose HSQLDB's schema capabilities which exist since 1.8.0RC10 + aConvertedProperties[nPos].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "default_schema" ) ); + aConvertedProperties[nPos++].Value <<= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("true")); + + Reference<XPropertySet> xProp(xStorage,UNO_QUERY); + if ( xProp.is() ) + { + sal_Int32 nMode = 0; + xProp->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OpenMode"))) >>= nMode; + if ( (nMode & ElementModes::WRITE) != ElementModes::WRITE ) + { + aConvertedProperties.realloc(nPos+1); + aConvertedProperties[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("readonly")); + aConvertedProperties[nPos++].Value <<= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("true")); + } + } + ::rtl::OUString sConnectURL(RTL_CONSTASCII_USTRINGPARAM("jdbc:hsqldb:")); sConnectURL += sConnPartURL; @@ -473,7 +493,7 @@ namespace connectivity Reference<XStatement> xStmt = _xConnection->createStatement(); if ( xStmt.is() ) { - Reference<XResultSet> xRes(xStmt->executeQuery(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SELECT COUNT(*) FROM SYSTEM_SESSIONS WHERE USER_NAME ='SA'"))),UNO_QUERY); + Reference<XResultSet> xRes(xStmt->executeQuery(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SELECT COUNT(*) FROM INFORMATION_SCHEMA.SYSTEM_SESSIONS WHERE USER_NAME ='SA'"))),UNO_QUERY); Reference<XRow> xRow(xRes,UNO_QUERY); if ( xRow.is() && xRes->next() ) bLastOne = xRow->getInt(1) == 1; |