User: hr Date: 2006/10/24 08:15:03 Modified: dba/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
Log: INTEGRATION: CWS dba205c (1.73.14); FILE MERGED 2006/10/11 19:47:48 fs 1.73.14.2: #i10000# 2006/10/10 13:40:31 fs 1.73.14.1: during #i69227#: saveField: quote the field name, in case it contains a space File Changes: Directory: /dba/dbaccess/source/ui/querydesign/ =============================================== File [changed]: SelectionBrowseBox.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx?r1=1.74&r2=1.75 Delta lines: +9 -5 ------------------- --- SelectionBrowseBox.cxx 12 Oct 2006 13:43:07 -0000 1.74 +++ SelectionBrowseBox.cxx 24 Oct 2006 15:15:01 -0000 1.75 @@ -719,13 +719,21 @@ return bError; } + Reference<XConnection> xConnection( pController->getConnection() ); + Reference< XDatabaseMetaData > xMetaData; + if ( xConnection.is() ) + xMetaData = xConnection->getMetaData(); + OSL_ENSURE( xMetaData.is(), "OSelectionBrowseBox::saveField: invalid connection/meta data!" ); + if ( !xMetaData.is() ) + return sal_True; + ::rtl::OUString sErrorMsg; // second test if the name can be set as select columns in a pseudo statement // we have to look which entries we should quote ::rtl::OUString sSql; sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SELECT ")); - sSql += _sFieldName; + sSql += ::dbtools::quoteName( xMetaData->getIdentifierQuoteString(), _sFieldName ); sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" FROM x")); ::connectivity::OSQLParser& rParser( pController->getParser() ); @@ -745,10 +753,6 @@ } // travel through the select column parse node else { - Reference<XConnection> xConnection = pController->getConnection(); - if ( !xConnection.is() ) - return sal_True; - Reference<XDatabaseMetaData> xMetaData = xConnection->getMetaData(); ::comphelper::UStringMixEqual bCase(xMetaData->supportsMixedCaseQuotedIdentifiers()); OTableFieldDescRef aSelEntry = _pEntry; --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
