User: kz      
Date: 2006/12/13 08:25:14

Modified:
   dba/connectivity/source/parse/sqlnode.cxx

Log:
 INTEGRATION: CWS dba22ui (1.45.32); FILE MERGED
 2006/12/05 09:46:56 fs 1.45.32.1: copying the fix for #i72252# from CWS dba22b 
to dba22ui - intended for the latter, but wrongly checked in into the former

File Changes:

Directory: /dba/connectivity/source/parse/
==========================================

File [changed]: sqlnode.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/connectivity/source/parse/sqlnode.cxx?r1=1.45&r2=1.46
Delta lines:  +29 -32
---------------------
--- sqlnode.cxx 24 Oct 2006 15:06:24 -0000      1.45
+++ sqlnode.cxx 13 Dec 2006 16:25:11 -0000      1.46
@@ -215,13 +215,12 @@
 //= SQLParseNodeParameter
 //=============================================================================
 //-----------------------------------------------------------------------------
-SQLParseNodeParameter::SQLParseNodeParameter( const ::rtl::OUString& 
_rIdentifierQuote, const ::rtl::OUString& _rCatalogSep,
+SQLParseNodeParameter::SQLParseNodeParameter( const Reference< XConnection >& 
_rxConnection,
                const Reference< XNumberFormatter >& _xFormatter, const 
Reference< XPropertySet >& _xField,
                const Locale& _rLocale, const IParseContext* _pContext,
-        bool _bIntl, bool _bQuote, sal_Char _cDecSep, bool _bPredicate, bool 
_bParseToSDBC, bool _bCaseSensistiveIdentCompare  )
+        bool _bIntl, bool _bQuote, sal_Char _cDecSep, bool _bPredicate, bool 
_bParseToSDBC )
     :rLocale(_rLocale)
-    ,aIdentifierQuote(_rIdentifierQuote)
-       ,aCatalogSeparator(_rCatalogSep)
+    ,aMetaData( _rxConnection )
     ,pParser( NULL )
     ,pSubQueryHistory( new QueryNameSet )
     ,xFormatter(_xFormatter)
@@ -232,7 +231,6 @@
        ,bInternational(_bIntl)
        ,bPredicate(_bPredicate)
     ,bParseToSDBCLevel( _bParseToSDBC )
-    ,bCaseSensistiveIdentCompare( _bCaseSensistiveIdentCompare )
 {
 }
 
@@ -283,21 +281,21 @@
 
 //-----------------------------------------------------------------------------
 void OSQLParseNode::parseNodeToStr(::rtl::OUString& rString,
-                                                                  const 
Reference< XDatabaseMetaData > & xMeta,
+                                                                  const 
Reference< XConnection >& _rxConnection,
                                                                   const 
IParseContext* pContext,
                                                                   sal_Bool 
_bIntl,
                                                                   sal_Bool 
_bQuote) const
 {
 
        parseNodeToStr(
-               rString, xMeta, Reference< XNumberFormatter >(),  Reference< 
XPropertySet >(),
+               rString, _rxConnection, NULL, NULL,
                pContext ? pContext->getPreferredLocale() : 
OParseContext::getDefaultLocale(),
                pContext, _bIntl, _bQuote, '.', false, false );
 }
 
 //-----------------------------------------------------------------------------
 void OSQLParseNode::parseNodeToPredicateStr(::rtl::OUString& rString,
-                                                                               
          const Reference< XDatabaseMetaData > & xMeta,
+                                                                               
          const Reference< XConnection >& _rxConnection,
                                                                                
          const Reference< XNumberFormatter > & xFormatter,
                                                                                
          const ::com::sun::star::lang::Locale& rIntl,
                                                                                
          sal_Char _cDec,
@@ -307,12 +305,12 @@
        OSL_ENSURE(xFormatter.is(), "OSQLParseNode::parseNodeToPredicateStr:: 
no formatter!");
 
        if (xFormatter.is())
-               parseNodeToStr(rString, xMeta, xFormatter, Reference< 
XPropertySet >(), rIntl, pContext, sal_True, sal_True, _cDec, true, false);
+               parseNodeToStr(rString, _rxConnection, xFormatter, NULL, rIntl, 
pContext, sal_True, sal_True, _cDec, true, false);
 }
 
 //-----------------------------------------------------------------------------
 void OSQLParseNode::parseNodeToPredicateStr(::rtl::OUString& rString,
-                                                                               
          const Reference< XDatabaseMetaData > & xMeta,
+                                                                               
          const Reference< XConnection > & _rxConnection,
                                                                                
          const Reference< XNumberFormatter > & xFormatter,
                                                                                
          const Reference< XPropertySet > & _xField,
                                                                                
          const ::com::sun::star::lang::Locale& rIntl,
@@ -323,12 +321,12 @@
        OSL_ENSURE(xFormatter.is(), "OSQLParseNode::parseNodeToPredicateStr:: 
no formatter!");
 
        if (xFormatter.is())
-               parseNodeToStr(rString, xMeta, xFormatter, _xField, rIntl, 
pContext, true, true, _cDec, true, false);
+               parseNodeToStr( rString, _rxConnection, xFormatter, _xField, 
rIntl, pContext, true, true, _cDec, true, false );
 }
 
 //-----------------------------------------------------------------------------
 void OSQLParseNode::parseNodeToStr(::rtl::OUString& rString,
-                                         const Reference< XDatabaseMetaData > 
& xMeta,
+                                         const Reference< XConnection > & 
_rxConnection,
                                          const Reference< XNumberFormatter > & 
xFormatter,
                                          const Reference< XPropertySet > & 
_xField,
                                          const ::com::sun::star::lang::Locale& 
rIntl,
@@ -340,20 +338,16 @@
                       bool _bSubstitute) const
 {
 
-       OSL_ENSURE(xMeta.is(), "OSQLParseNode::parseNodeToStr:: no meta data!");
+       OSL_ENSURE( _rxConnection.is(), "OSQLParseNode::parseNodeToStr: invalid 
connection!" );
 
-       if (xMeta.is())
+       if ( _rxConnection.is() )
        {
-               ::rtl::OUString 
aIdentifierQuote(xMeta->getIdentifierQuoteString());
-               ::rtl::OUString aCatalogSeparator(xMeta->getCatalogSeparator());
-
         try
         {
                    OSQLParseNode::impl_parseNodeToString_throw( rString,
                            SQLParseNodeParameter(
-                    aIdentifierQuote, aCatalogSeparator, xFormatter, _xField, 
rIntl, pContext,
-                    _bIntl, _bQuote, _cDecSep, _bPredicate, _bSubstitute,
-                    xMeta->storesMixedCaseQuotedIdentifiers()
+                    _rxConnection, xFormatter, _xField, rIntl, pContext,
+                    _bIntl, _bQuote, _cDecSep, _bPredicate, _bSubstitute
                 ) );
         }
         catch( const SQLException& )
@@ -371,14 +365,10 @@
     OSQLParser& _rParser, ::com::sun::star::sdbc::SQLException* _pErrorHolder 
) const
 {
     OSL_PRECOND( _rxConnection.is(), 
"OSQLParseNode::parseNodeToExecutableStatement: invalid connection!" );
-    Reference< XDatabaseMetaData > xMeta( _rxConnection->getMetaData() );
-
-    SQLParseNodeParameter aParseParam( xMeta->getIdentifierQuoteString(), 
xMeta->getCatalogSeparator(),
-        NULL, NULL, OParseContext::getDefaultLocale(), NULL, false, true, '.', 
false, true,
-        xMeta->storesMixedCaseQuotedIdentifiers() );
+    SQLParseNodeParameter aParseParam( _rxConnection,
+        NULL, NULL, OParseContext::getDefaultLocale(), NULL, false, true, '.', 
false, true );
 
-    DatabaseMetaData aMeta( _rxConnection );
-    if ( aMeta.supportsSubqueriesInFrom() )
+    if ( aParseParam.aMetaData.supportsSubqueriesInFrom() )
     {
         Reference< XQueriesSupplier > xSuppQueries( _rxConnection, UNO_QUERY );
         OSL_ENSURE( xSuppQueries.is(), 
"OSQLParseNode::parseNodeToExecutableStatement: cannot substitute everything 
without a QueriesSupplier!" );
@@ -506,6 +496,7 @@
         break;
 
     case as:
+        if ( rParam.aMetaData.generateASBeforeCorrelationName() )
         rString += ::rtl::OUString::createFromAscii( " AS" );
         bHandled = true;
         break;
@@ -718,7 +709,8 @@
         {
             rString += ::rtl::OUString::createFromAscii( " AS " );
             if ( rParam.bQuote )
-                rString += SetQuotation( sTableOrQueryName, 
rParam.aIdentifierQuote, rParam.aIdentifierQuote );
+                rString += SetQuotation( sTableOrQueryName,
+                    rParam.aMetaData.getIdentifierQuoteString(), 
rParam.aMetaData.getIdentifierQuoteString() );
         }
 
         // don't forget to remove the query name from the history, else 
multiple inclusions
@@ -2439,7 +2431,9 @@
                     case ' ' :
                     case '.' : break;
                     default  :
-                        if (!rParam.aCatalogSeparator.getLength() || 
rString.getStr()[rString.getLength()-1] != rParam.aCatalogSeparator.toChar())
+                        if  (   
!rParam.aMetaData.getCatalogSeparator().getLength()
+                            ||  rString.getStr()[ rString.getLength()-1 ] != 
rParam.aMetaData.getCatalogSeparator().toChar()
+                            )
                             rString += ::rtl::OUString::createFromAscii(" "); 
break;
                 }
             }
@@ -2452,7 +2446,8 @@
                     rString+= ::rtl::OUString::createFromAscii("]");
                 }
                 else
-                    rString += SetQuotation(m_aNodeValue, 
rParam.aIdentifierQuote, rParam.aIdentifierQuote);
+                    rString += SetQuotation(m_aNodeValue,
+                        rParam.aMetaData.getIdentifierQuoteString(), 
rParam.aMetaData.getIdentifierQuoteString() );
             }
             else
                 rString += m_aNodeValue;
@@ -2485,7 +2480,9 @@
                     case ' ' :
                     case '.' : break;
                     default  :
-                        if (!rParam.aCatalogSeparator.getLength() || 
rString.getStr()[rString.getLength()-1] != rParam.aCatalogSeparator.toChar())
+                        if  (   
!rParam.aMetaData.getCatalogSeparator().getLength()
+                            ||  rString.getStr()[ rString.getLength()-1 ] != 
rParam.aMetaData.getCatalogSeparator().toChar()
+                            )
                             rString += ::rtl::OUString::createFromAscii(" "); 
break;
                 }
             }




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to