Anonymous avatar Anonymous committed 5064e15

CWS-TOOLING: integrate CWS dba31i
2009-02-12 09:37:16 +0100 fs r267635 : merging the fix for #i98549# from CWS rptfix04 to CWS dba31i
2009-02-09 10:09:03 +0100 fs r267502 : #i98467#
2009-02-03 14:40:59 +0100 fs r267328 : #i97159# +checkParameterTypes
2009-02-03 14:40:32 +0100 fs r267327 : some more data / correct query 'all orders'
2009-02-03 14:16:56 +0100 fs r267321 : #i97159# properly determine column alias / table range for parameters in BETWEEN clauses
2009-02-03 12:39:40 +0100 oj r267313 : #i97159# check for column range in parameter
2009-02-03 10:17:29 +0100 fs r267300 : #i98247#
2009-02-02 12:21:18 +0100 oj r267258 : #i98724# subst corrected

Comments (0)

Files changed (9)

connectivity/inc/connectivity/IParseContext.hxx

 	//==========================================================================
 	//= IParseContext
 	//==========================================================================
-	class OOO_DLLPUBLIC_DBTOOLS IParseContext
+	class IParseContext
 	{
 	public:
 		enum	ErrorCode

connectivity/source/parse/sqliterator.cxx

 	traverseByColumnNames( pSelectNode, sal_False );
     return !hasErrors();
 }
+
+// -----------------------------------------------------------------------------
+namespace
+{
+    ::rtl::OUString lcl_generateParameterName( const OSQLParseNode& _rParentNode, const OSQLParseNode& _rParamNode )
+    {
+        ::rtl::OUString sColumnName( RTL_CONSTASCII_USTRINGPARAM( "param" ) );
+        const sal_Int32 nCount = (sal_Int32)_rParentNode.count();
+        for ( sal_Int32 i = 0; i < nCount; ++i )
+        {
+            if ( _rParentNode.getChild(i) == &_rParamNode )
+            {
+                sColumnName += ::rtl::OUString::valueOf( i+1 );
+                break;
+            }
+        }
+        return sColumnName;
+    }
+}
+
 // -----------------------------------------------------------------------------
 void OSQLParseTreeIterator::traverseParameters(const OSQLParseNode* _pNode)
 {
             sal_uInt32 nPos = 0;
             if ( pParent->getChild(nPos) == _pNode )
                 nPos = 2;
-            pParent->getChild(nPos)->parseNodeToStr( sColumnName, m_pImpl->m_xConnection, NULL, sal_False, sal_False );
+            const OSQLParseNode* pOther = pParent->getChild(nPos);
+            if ( SQL_ISRULE( pOther, column_ref ) )
+                getColumnRange( pOther, sColumnName, sTableRange, aColumnAlias);
+            else
+                pOther->parseNodeToStr( sColumnName, m_pImpl->m_xConnection, NULL, sal_False, sal_False );
         } // if ( SQL_ISRULE(pParent,comparison_predicate) ) // x = X
         else if ( SQL_ISRULE(pParent,like_predicate) )
         {
-            pParent->getChild(0)->parseNodeToStr( sColumnName, m_pImpl->m_xConnection, NULL, sal_False, sal_False );
+            const OSQLParseNode* pOther = pParent->getChild(0);
+            if ( SQL_ISRULE( pOther, column_ref ) )
+                getColumnRange( pOther, sColumnName, sTableRange, aColumnAlias);
+            else
+                pOther->parseNodeToStr( sColumnName, m_pImpl->m_xConnection, NULL, sal_False, sal_False );
         }
         else if ( SQL_ISRULE(pParent,between_predicate) )
         {
-            sal_Int32 nPos = 2;
-            if ( pParent->getChild(3) == _pNode )
-                nPos = 1;
-            pParent->getChild(0)->parseNodeToStr( sColumnName, m_pImpl->m_xConnection, NULL, sal_False, sal_False );
-            sColumnName += ::rtl::OUString::valueOf(nPos);
+            const OSQLParseNode* pOther = pParent->getChild(0);
+            if ( SQL_ISRULE( pOther, column_ref ) )
+                getColumnRange( pOther, sColumnName, sTableRange, aColumnAlias);
+            else
+            {
+                pOther->parseNodeToStr( sColumnName, m_pImpl->m_xConnection, NULL, sal_False, sal_False );
+                lcl_generateParameterName( *pParent, *_pNode );
+            }
         }
         else if ( pParent->getNodeType() == SQL_NODE_COMMALISTRULE )
         {
-            const sal_Int32 nParamCount = (sal_Int32)pParent->count();
-            for (sal_Int32 i = 0; i < nParamCount; ++i)
-            {
-                if ( pParent->getChild(i) == _pNode )
-                {
-                    static const ::rtl::OUString s_sParam(RTL_CONSTASCII_USTRINGPARAM("param"));
-                    sColumnName = s_sParam;
-                    sColumnName += ::rtl::OUString::valueOf(i+1);
-                    break;
-                }
-            }
+            lcl_generateParameterName( *pParent, *_pNode );
         }
     }
     traverseParameter( _pNode, pParent, sColumnName, sTableRange, aColumnAlias );

dbaccess/qa/complex/dbaccess/CRMDatabase.java

                 new HsqlColumnDescriptor( "ShipDate", "DATE" ) } );
         m_database.createTable( table, true );
 
+        m_database.executeSQL( "INSERT INTO \"orders\" (\"ID\", \"CustomerID\", \"OrderDate\") VALUES(1, 1, {D '2009-01-01'})" );
+        m_database.executeSQL( "INSERT INTO \"orders\" VALUES(2, 2, {D '2009-01-01'}, {D '2009-01-23'})" );
+
         table = new HsqlTableDescriptor( "orders_details",
             new HsqlColumnDescriptor[] {
                 new HsqlColumnDescriptor( "OrderID", "INTEGER", HsqlColumnDescriptor.PRIMARY, "orders", "ID" ),
                 new HsqlColumnDescriptor( "Quantity", "INTEGER" ) } );
         m_database.createTable( table, true );
 
+        m_database.executeSQL( "INSERT INTO \"orders_details\" VALUES(1, 1, 100)" );
+        m_database.executeSQL( "INSERT INTO \"orders_details\" VALUES(1, 2, 100)" );
+        m_database.executeSQL( "INSERT INTO \"orders_details\" VALUES(2, 2, 2000)" );
+        m_database.executeSQL( "INSERT INTO \"orders_details\" VALUES(2, 3, 2000)" );
+        m_database.executeSQL( "INSERT INTO \"orders_details\" VALUES(2, 4, 2000)" );
+
         // since we created the tables by directly executing the SQL statements, we need to refresh
         // the tables container
         XTablesSupplier suppTables = (XTablesSupplier)UnoRuntime.queryInterface(
     {
         m_database.getDataSource().createQuery(
             "all orders",
-            "SELECT \"Orders\".\"ID\" AS \"Order No.\", " +
-                    "\"Customers\".\"Name\" AS \"Customer Name\", " +
-                    "\"Orders\".\"OrderDate\", " +
-                    "\"Orders\".\"ShipDate\", " +
+            "SELECT \"orders\".\"ID\" AS \"Order No.\", " +
+                    "\"customers\".\"Name\" AS \"Customer Name\", " +
+                    "\"orders\".\"OrderDate\" AS \"Order Date\", " +
+                    "\"orders\".\"ShipDate\" AS \"Ship Date\", " +
                     "\"orders_details\".\"Quantity\", " +
-                    "\"Products\".\"Name\" AS \"Product Name\" " +
+                    "\"products\".\"Name\" AS \"Product Name\" " +
             "FROM \"orders_details\" AS \"orders_details\", " +
-                  "\"Orders\" AS \"Orders\", " +
-                  "\"Products\" AS \"Products\", " +
-                  "\"Customers\" AS \"Customers\" " +
-            "WHERE  ( \"orders_details\".\"OrderID\" = \"Orders\".\"ID\" " +
-                 "AND \"orders_details\".\"ProductID\" = \"Products\".\"ID\" " +
-                 "AND \"Orders\".\"CustomerID\" = \"Customers\".\"ID\" )"
+                  "\"orders\" AS \"orders\", " +
+                  "\"products\" AS \"products\", " +
+                  "\"customers\" AS \"customers\" " +
+            "WHERE  ( \"orders_details\".\"OrderID\" = \"orders\".\"ID\" " +
+                 "AND \"orders_details\".\"ProductID\" = \"products\".\"ID\" " +
+                 "AND \"orders\".\"CustomerID\" = \"customers\".\"ID\" )"
         );
 
         m_database.getDataSource().createQuery(

dbaccess/qa/complex/dbaccess/Parser.java

  ************************************************************************/
 package complex.dbaccess;
 
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.sdb.XParametersSupplier;
 import com.sun.star.sdb.XSingleSelectQueryComposer;
+import com.sun.star.sdbc.DataType;
 import com.sun.star.sdbc.SQLException;
 import com.sun.star.uno.Exception;
+import com.sun.star.uno.UnoRuntime;
 
 public class Parser extends CRMBasedTestCase
 {
     public String[] getTestMethodNames()
     {
         return new String[] {
-            "checkJoinSyntax"
+            "checkJoinSyntax",
+            "checkParameterTypes"
         };
     }
 
             "test is bogus!", caughtExpected );
     }
 
+    // --------------------------------------------------------------------------------------------------------
+    private void impl_checkParameters( final String _statement, final String[] _expectedParameterNames, final int[] _expectedParameterTypes, String _context ) throws Exception
+    {
+        XSingleSelectQueryComposer composer = createQueryComposer();
+        composer.setQuery( _statement );
+
+        assureEquals( "checkParameterTypes: internal error", _expectedParameterNames.length, _expectedParameterTypes.length );
+
+        XParametersSupplier paramSupp = (XParametersSupplier)UnoRuntime.queryInterface(
+            XParametersSupplier.class, composer );
+        XIndexAccess parameters = paramSupp.getParameters();
+
+        assureEquals( "(ctx: " + _context + ") unexpected parameter count", _expectedParameterNames.length, parameters.getCount() );
+        for ( int i=0; i<parameters.getCount(); ++i )
+        {
+            XPropertySet parameter = (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class,
+                parameters.getByIndex(i) );
+
+            String name = (String)parameter.getPropertyValue( "Name" );
+            assureEquals( "(ctx: " + _context + ") unexpected parameter name for parameter number " + ( i + 1 ), _expectedParameterNames[i], name );
+
+            int type = ((Integer)parameter.getPropertyValue( "Type" )).intValue();
+            assureEquals( "(ctx: " + _context + ") unexpected data type for parameter number " + ( i + 1 ), _expectedParameterTypes[i], type );
+        }
+    }
+
+    // --------------------------------------------------------------------------------------------------------
+    /** verifies that the parser properly recognizes the types of parameters
+     */
+    public void checkParameterTypes() throws Exception
+    {
+        impl_checkParameters(
+            "SELECT * FROM \"all orders\" " +
+            "WHERE ( \"Order Date\" >= :order_date ) " +
+            "  AND (    ( \"Customer Name\" LIKE :customer ) " +
+            "      OR   ( \"Product Name\" LIKE ? ) " +
+            "      )",
+            new String[] { "order_date", "customer", "Product Name" },
+            new int[] { DataType.DATE, DataType.VARCHAR, DataType.VARCHAR },
+            ">= && LIKE"
+        );
+
+        impl_checkParameters(
+            "SELECT * FROM \"categories\" " +
+            "WHERE \"ID\" BETWEEN :id_lo AND :id_hi",
+            new String[] { "id_lo", "id_hi" },
+            new int[] { DataType.INTEGER, DataType.INTEGER },
+            "BETWEEN"
+        );
+
+        impl_checkParameters(
+            "SELECT CONCAT( :prefix, CONCAT( \"Name\", :suffix ) ) FROM \"customers\"",
+            new String[] { "prefix", "suffix" },
+            new int[] { DataType.VARCHAR, DataType.VARCHAR },
+            "CONCAT"
+        );
+    }
 }

dbaccess/source/filter/xml/xmlExport.cxx

 #include <com/sun/star/awt/FontDescriptor.hpp>
 #endif
 #include <svtools/filenotation.hxx>
+#include <svtools/pathoptions.hxx>
 #include <tools/diagnose_ex.h>
 
 namespace dbaxml
         {
             SvXMLElementExport aDatabaseDescription(*this,XML_NAMESPACE_DB, XML_DATABASE_DESCRIPTION, sal_True, sal_True);
             {
-                ::svt::OFileNotation aTransformer( m_aTypeCollection.cutPrefix(sValue) );
-                AddAttribute(XML_NAMESPACE_XLINK,XML_HREF,GetRelativeReference(aTransformer.get( ::svt::OFileNotation::N_URL )));
+                SvtPathOptions aPathOptions;
+                const String sOrigUrl = m_aTypeCollection.cutPrefix(sValue);
+			    String sFileName = aPathOptions.SubstituteVariable(sOrigUrl);
+                if ( sOrigUrl == sFileName )
+                {
+                    ::svt::OFileNotation aTransformer( sFileName );
+                    AddAttribute(XML_NAMESPACE_XLINK,XML_HREF,GetRelativeReference(aTransformer.get( ::svt::OFileNotation::N_URL )));
+                } // if ( sOrigUrl == sFileName )
+                else
+                    AddAttribute(XML_NAMESPACE_XLINK,XML_HREF,sOrigUrl);
                 AddAttribute(XML_NAMESPACE_DB,XML_MEDIA_TYPE,m_aTypeCollection.getMediaType(eType));
                 try
                 {

dbaccess/source/filter/xml/xmlFileBasedDatabase.cxx

 #endif
 #include <comphelper/sequence.hxx>
 #include <svtools/filenotation.hxx>
+#include <svtools/pathoptions.hxx>
 #include "dsntypes.hxx"
 namespace dbaxml
 {
 		{
 			case XML_TOK_DB_HREF:
                 {
-                    sLocation = ::svt::OFileNotation(rImport.GetAbsoluteReference(sValue)).get( ::svt::OFileNotation::N_SYSTEM );
+                    SvtPathOptions aPathOptions;
+                    rtl::OUString sFileName = aPathOptions.SubstituteVariable(sValue);
+                    if ( sValue == sFileName )
+                    {
+                        sLocation = ::svt::OFileNotation(rImport.GetAbsoluteReference(sValue)).get( ::svt::OFileNotation::N_SYSTEM );
+                    }
+
                     if ( sLocation.getLength() == 0 )
                         sLocation = sValue;
                 }

sfx2/source/notify/eventsupplier.cxx

 #define	UNO_QUERY			::com::sun::star::uno::UNO_QUERY
 
 namespace css = ::com::sun::star;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::beans::PropertyValue;
 
 //--------------------------------------------------------------------------------------------------------
 	//  --- XNameReplace ---
 {
 	::osl::MutexGuard aGuard( maMutex );
 
-    bool bReset = !rElement.hasValue();
 	// find the event in the list and replace the data
 	long nCount	= maEventNames.getLength();
 	for ( long i=0; i<nCount; i++ )
 	{
 		if ( maEventNames[i] == aName )
 		{
+            Sequence< PropertyValue > aProperties;
 			// check for correct type of the element
-            if ( bReset || ::getCppuType( (const SEQUENCE < PROPERTYVALUE > *)0 ) == rElement.getValueType() )
-			{
-				// create Configuration at first, creation might call this method also and that would overwrite everything
-				// we might have stored before!
-                USHORT nID = (USHORT) SfxEventConfiguration::GetEventId_Impl( aName );
-                if ( nID )
-				{
-				    // pConfig becomes the owner of the new SvxMacro
-                    if ( mpObjShell && !mpObjShell->IsLoading() )
-                        mpObjShell->SetModified( TRUE );
-		            
-                    if ( bReset )
-                    {
-                        maEventData[i] = ANY();
-                    }
-                    else
-                    {
-					    ANY aValue;
-				        BlowUpMacro( rElement, aValue, mpObjShell );
-
-		                SEQUENCE < PROPERTYVALUE > aProperties;
-		                if ( aValue >>= aProperties )
-                        {
-                            ::rtl::OUString aType;
-                            if (( aProperties[0].Name.compareToAscii( PROP_EVENT_TYPE ) == 0 ) &&
-                                ( aProperties[0].Value >>= aType ) &&
-                                  aType.getLength() == 0 )
-                            {
-                                // An empty event type means no binding. Therefore reset data
-                                // to reflect that state.
-                                maEventData[i] = ANY();
-                            }
-                            else
-                                maEventData[i] = aValue;
-                        }
-                    }
-				}
-			}
-			else
+            if ( rElement.hasValue() && !( rElement >>= aProperties ) )
 				throw ILLEGALARGUMENTEXCEPTION();
 
+            // create Configuration at first, creation might call this method also and that would overwrite everything
+			// we might have stored before!
+            USHORT nID = (USHORT) SfxEventConfiguration::GetEventId_Impl( aName );
+            OSL_ENSURE( nID, "SfxEvents_Impl::replaceByName: no ID for the given event!" );
+            if ( !nID )
+                // throw?
+                return;
+
+            if ( mpObjShell && !mpObjShell->IsLoading() )
+                mpObjShell->SetModified( TRUE );
+
+            if ( aProperties.getLength() )
+            {
+                // "normalize" the macro descriptor
+			    ANY aValue;
+		        BlowUpMacro( rElement, aValue, mpObjShell );
+                aValue >>= aProperties;
+
+                ::rtl::OUString sType;
+                if  (   ( aProperties.getLength() == 1 )
+                    &&  ( aProperties[0].Name.compareToAscii( PROP_EVENT_TYPE ) == 0 )
+                    &&  ( aProperties[0].Value >>= sType )
+                    &&  ( sType.getLength() == 0 )
+                    )
+                {
+                    // An empty event type means no binding. Therefore reset data
+                    // to reflect that state.
+                    // (that's for compatibility only. Nowadays, the Tools/Customize dialog should
+                    // set an empty sequence to indicate the request for resetting the assignment.)
+                    aProperties.realloc( 0 );
+                }
+            }
+
+            if ( aProperties.getLength() )
+            {
+                maEventData[i] = makeAny( aProperties );
+            }
+            else
+            {
+                maEventData[i].clear();
+            }
 			return;
 		}
 	}

solenv/config/sdev300.ini

 			BMP_WRITES_FLAG TRUE
 			BTARGET 1
 			BUILD_SPECIAL TRUE
-			BUILD_TYPE SO OOo EXT BINFILTER BITSTREAM_VERA_FONTS BSH CURL DICTIONARIES HSQLDB HUNSPELL JPEG LIBXML2 LIBXMLSEC LPSOLVE MOZ NEON TWAIN PYTHON ZLIB SANE UNIXODBC X11_EXTENSIONS LIBWPD EPM QADEVOOO ODK MSFONTEXTRACT MATHMLDTD BOOST EXPAT CRASHREP BERKELEYDB LIBXSLT SUN AGG GTK ICU SYSTRAY_GTK JAVAINSTALLER2 VIGRA OPENSSL JFREEREPORT APACHE_COMMONS TOMCAT REPORTDESIGN SDEXT SWEXT XPDF LUCENE REDLAND SAXON WRITER2LATEX
+			BUILD_TYPE SO OOo EXT BINFILTER BITSTREAM_VERA_FONTS BSH CURL DICTIONARIES HSQLDB HUNSPELL JPEG LIBXML2 LIBXMLSEC LPSOLVE MOZ NEON TWAIN PYTHON ZLIB SANE UNIXODBC X11_EXTENSIONS LIBWPD EPM QADEVOOO ODK MSFONTEXTRACT MATHMLDTD BOOST EXPAT CRASHREP BERKELEYDB LIBXSLT SUN AGG GTK ICU SYSTRAY_GTK JAVAINSTALLER2 VIGRA OPENSSL JFREEREPORT APACHE_COMMONS TOMCAT REPORTBUILDER SDEXT SWEXT XPDF LUCENE REDLAND SAXON WRITER2LATEX
 			common_build TRUE
 			COMMON_OUTDIR common
 			CONFIG_PROJECT config_office
 			ENABLE_MEDIAWIKI YES
 			ENABLE_MINIMIZER YES
 			ENABLE_RANDR TRUE
-			ENABLE_REPORTDESIGN YES
+			ENABLE_REPORTBUILDER YES
 			ENABLE_SVCTAGS YES
 			ENABLE_VBA YES
 			ISERVER iserver.germany.sun.com

solenv/config/ssolar.cmn

         ENABLE_PASF
         ENABLE_RANDR
         ENABLE_REPORTBUILDER
-        ENABLE_REPORTDESIGN
         ENABLE_SVCTAGS
 		ENABLE_VBA
 		FORCE2ARCHIVE
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.