User: rt Date: 05/06/27 01:24:40 Modified: /dba/connectivity/source/drivers/hsqldb/ HDriver.cxx
Log: 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 File Changes: Directory: /dba/connectivity/source/drivers/hsqldb/ =================================================== File [changed]: HDriver.cxx Url: http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/hsqldb/HDriver.cxx?r1=1.11&r2=1.12 Delta lines: +22 -2 -------------------- --- HDriver.cxx 6 Apr 2005 10:35:10 -0000 1.11 +++ HDriver.cxx 27 Jun 2005 08:24:37 -0000 1.12 @@ -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 @@ 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 @@ 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 @@ 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; --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
