From bd897bae5ed17c85dacc773299f904e69d2a52e2 Mon Sep 17 00:00:00 2001 From: RĂ¼diger Timm Date: Mon, 27 Jun 2005 07:24:37 +0000 Subject: 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 --- connectivity/source/drivers/hsqldb/HDriver.cxx | 28 ++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'connectivity') 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 #endif +#ifndef _COM_SUN_STAR_EMBED_ELEMENTMODES_HPP_ +#include +#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 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 xStmt = _xConnection->createStatement(); if ( xStmt.is() ) { - Reference xRes(xStmt->executeQuery(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SELECT COUNT(*) FROM SYSTEM_SESSIONS WHERE USER_NAME ='SA'"))),UNO_QUERY); + Reference xRes(xStmt->executeQuery(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SELECT COUNT(*) FROM INFORMATION_SCHEMA.SYSTEM_SESSIONS WHERE USER_NAME ='SA'"))),UNO_QUERY); Reference xRow(xRes,UNO_QUERY); if ( xRow.is() && xRes->next() ) bLastOne = xRow->getInt(1) == 1; -- cgit