summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathias Bauer <mba@openoffice.org>2009-09-09 11:45:13 +0200
committerMathias Bauer <mba@openoffice.org>2009-09-09 11:45:13 +0200
commit7ff5554bceddb816903b641d274e13f121f3c75e (patch)
tree4fc3653adb51da1a3cfb6a6d122d22cf10ba7999
parent419fa1df08feb265c9e777f8054ff4deca296912 (diff)
parent752941d76c608a475db454b0010a315d86bfc748 (diff)
merge commit to DEV300_m57
-rw-r--r--dbaccess/qa/complex/dbaccess/ApplicationController.java129
-rw-r--r--dbaccess/qa/complex/dbaccess/Beamer.java194
-rw-r--r--dbaccess/qa/complex/dbaccess/CRMBasedTestCase.java4
-rw-r--r--dbaccess/qa/complex/dbaccess/CRMDatabase.java59
-rw-r--r--dbaccess/qa/complex/dbaccess/CopyTableInterActionHandler.java (renamed from dbaccess/source/ui/dlg/AdabasStatDlg.hrc)27
-rw-r--r--dbaccess/qa/complex/dbaccess/CopyTableWizard.java239
-rw-r--r--dbaccess/qa/complex/dbaccess/DataSource.java55
-rw-r--r--dbaccess/qa/complex/dbaccess/DatabaseApplication.java104
-rw-r--r--dbaccess/qa/complex/dbaccess/DatabaseDocument.java698
-rw-r--r--dbaccess/qa/complex/dbaccess/FileHelper.java1
-rw-r--r--dbaccess/qa/complex/dbaccess/Parser.java71
-rw-r--r--dbaccess/qa/complex/dbaccess/PropertyBag.java45
-rw-r--r--dbaccess/qa/complex/dbaccess/Query.java24
-rw-r--r--dbaccess/qa/complex/dbaccess/QueryInQuery.java21
-rw-r--r--dbaccess/qa/complex/dbaccess/RowSet.java846
-rw-r--r--dbaccess/qa/complex/dbaccess/RowSetEventListener.java14
-rwxr-xr-xdbaccess/qa/complex/dbaccess/SingleSelectQueryComposer.java373
-rw-r--r--dbaccess/qa/complex/dbaccess/TestCase.java8
-rw-r--r--dbaccess/qa/complex/dbaccess/UISettings.java11
-rw-r--r--dbaccess/qa/complex/dbaccess/dbaccess.sce2
-rw-r--r--dbaccess/source/core/api/BookmarkSet.cxx6
-rw-r--r--dbaccess/source/core/api/CacheSet.cxx105
-rw-r--r--dbaccess/source/core/api/CacheSet.hxx9
-rw-r--r--dbaccess/source/core/api/KeySet.cxx260
-rw-r--r--dbaccess/source/core/api/KeySet.hxx4
-rw-r--r--dbaccess/source/core/api/RowSet.cxx17
-rw-r--r--dbaccess/source/core/api/RowSet.hxx1
-rw-r--r--dbaccess/source/core/api/RowSetBase.cxx6
-rw-r--r--dbaccess/source/core/api/RowSetCache.cxx242
-rw-r--r--dbaccess/source/core/api/RowSetCache.hxx4
-rw-r--r--dbaccess/source/core/api/SingleSelectQueryComposer.cxx131
-rw-r--r--dbaccess/source/core/api/resultset.cxx2422
-rw-r--r--dbaccess/source/core/api/statement.cxx51
-rw-r--r--dbaccess/source/core/dataaccess/ModelImpl.cxx3
-rw-r--r--dbaccess/source/core/dataaccess/connection.cxx6
-rw-r--r--dbaccess/source/core/dataaccess/databasecontext.cxx5
-rw-r--r--dbaccess/source/core/dataaccess/databasedocument.cxx3
-rw-r--r--dbaccess/source/core/inc/SingleSelectQueryComposer.hxx4
-rw-r--r--dbaccess/source/core/inc/core_resource.hrc3
-rw-r--r--dbaccess/source/core/inc/statement.hxx16
-rw-r--r--dbaccess/source/core/misc/dsntypes.cxx767
-rw-r--r--dbaccess/source/core/resource/strings.src200
-rw-r--r--dbaccess/source/ext/macromigration/makefile.mk1
-rw-r--r--dbaccess/source/filter/xml/makefile.mk2
-rw-r--r--dbaccess/source/filter/xml/xmlExport.cxx28
-rw-r--r--dbaccess/source/filter/xml/xmlFileBasedDatabase.cxx3
-rw-r--r--dbaccess/source/filter/xml/xmlfilter.cxx174
-rw-r--r--dbaccess/source/inc/dbustrings.hrc1
-rw-r--r--dbaccess/source/inc/dsntypes.hxx90
-rw-r--r--dbaccess/source/sdbtools/resource/sdbt_strings.src2
-rw-r--r--dbaccess/source/shared/dbustrings.cxx1
-rw-r--r--dbaccess/source/ui/app/AppController.cxx54
-rw-r--r--dbaccess/source/ui/app/AppControllerDnD.cxx72
-rw-r--r--dbaccess/source/ui/browser/brwctrlr.cxx84
-rw-r--r--dbaccess/source/ui/browser/dbexchange.cxx18
-rw-r--r--dbaccess/source/ui/browser/dsEntriesNoExp.cxx4
-rw-r--r--dbaccess/source/ui/browser/sbagrid.cxx38
-rw-r--r--dbaccess/source/ui/browser/sbagrid.src4
-rw-r--r--dbaccess/source/ui/browser/unodatbr.cxx121
-rw-r--r--dbaccess/source/ui/control/FieldDescControl.cxx3
-rw-r--r--dbaccess/source/ui/control/RelationControl.cxx11
-rw-r--r--dbaccess/source/ui/control/curledit.cxx13
-rw-r--r--dbaccess/source/ui/control/dbtreelistbox.cxx41
-rw-r--r--dbaccess/source/ui/control/toolboxcontroller.cxx3
-rw-r--r--dbaccess/source/ui/dlg/AdabasStatDlg.cxx208
-rw-r--r--dbaccess/source/ui/dlg/AdabasStatDlg.src64
-rw-r--r--dbaccess/source/ui/dlg/ConnectionHelper.cxx67
-rw-r--r--dbaccess/source/ui/dlg/ConnectionHelper.hxx4
-rw-r--r--dbaccess/source/ui/dlg/ConnectionPage.cxx32
-rw-r--r--dbaccess/source/ui/dlg/ConnectionPage.hxx2
-rw-r--r--dbaccess/source/ui/dlg/ConnectionPageSetup.cxx24
-rw-r--r--dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx63
-rw-r--r--dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx1
-rw-r--r--dbaccess/source/ui/dlg/DbAdminImpl.cxx85
-rw-r--r--dbaccess/source/ui/dlg/DbAdminImpl.hxx12
-rw-r--r--dbaccess/source/ui/dlg/DriverSettings.cxx101
-rw-r--r--dbaccess/source/ui/dlg/DriverSettings.hxx2
-rw-r--r--dbaccess/source/ui/dlg/UserAdminDlg.cxx2
-rw-r--r--dbaccess/source/ui/dlg/adminpages.cxx4
-rw-r--r--dbaccess/source/ui/dlg/adminpages.hxx2
-rw-r--r--dbaccess/source/ui/dlg/advancedsettings.cxx8
-rw-r--r--dbaccess/source/ui/dlg/datasourceui.cxx6
-rw-r--r--dbaccess/source/ui/dlg/datasourceui.hxx1
-rw-r--r--dbaccess/source/ui/dlg/dbadmin.cxx14
-rw-r--r--dbaccess/source/ui/dlg/dbwiz.cxx38
-rw-r--r--dbaccess/source/ui/dlg/dbwizsetup.cxx391
-rw-r--r--dbaccess/source/ui/dlg/detailpages.cxx18
-rw-r--r--dbaccess/source/ui/dlg/detailpages.hxx2
-rw-r--r--dbaccess/source/ui/dlg/dsselect.cxx6
-rw-r--r--dbaccess/source/ui/dlg/dsselect.hxx2
-rw-r--r--dbaccess/source/ui/dlg/generalpage.cxx175
-rw-r--r--dbaccess/source/ui/dlg/generalpage.hxx18
-rw-r--r--dbaccess/source/ui/dlg/indexdialog.cxx3
-rw-r--r--dbaccess/source/ui/dlg/makefile.mk4
-rw-r--r--dbaccess/source/ui/dlg/odbcconfig.cxx4
-rw-r--r--dbaccess/source/ui/dlg/queryfilter.cxx13
-rw-r--r--dbaccess/source/ui/dlg/sqlmessage.cxx9
-rw-r--r--dbaccess/source/ui/inc/AdabasStatDlg.hxx99
-rw-r--r--dbaccess/source/ui/inc/IItemSetHelper.hxx2
-rw-r--r--dbaccess/source/ui/inc/IUpdateHelper.hxx7
-rw-r--r--dbaccess/source/ui/inc/TableController.hxx2
-rw-r--r--dbaccess/source/ui/inc/TableFieldDescription.hxx5
-rw-r--r--dbaccess/source/ui/inc/TokenWriter.hxx2
-rw-r--r--dbaccess/source/ui/inc/UserAdminDlg.hxx2
-rw-r--r--dbaccess/source/ui/inc/WCPage.hxx10
-rw-r--r--dbaccess/source/ui/inc/WCopyTable.hxx3
-rw-r--r--dbaccess/source/ui/inc/advancedsettingsdlg.hxx4
-rw-r--r--dbaccess/source/ui/inc/brwctrlr.hxx13
-rw-r--r--dbaccess/source/ui/inc/curledit.hxx7
-rw-r--r--dbaccess/source/ui/inc/dbadmin.hxx2
-rw-r--r--dbaccess/source/ui/inc/dbexchange.hxx5
-rw-r--r--dbaccess/source/ui/inc/dbu_misc.hrc5
-rw-r--r--dbaccess/source/ui/inc/dbu_resource.hrc2
-rw-r--r--dbaccess/source/ui/inc/dbwiz.hxx6
-rw-r--r--dbaccess/source/ui/inc/dbwizsetup.hxx12
-rw-r--r--dbaccess/source/ui/inc/dsmeta.hxx7
-rw-r--r--dbaccess/source/ui/inc/sbagrid.hxx7
-rw-r--r--dbaccess/source/ui/inc/unodatbr.hxx1
-rw-r--r--dbaccess/source/ui/misc/DExport.cxx48
-rw-r--r--dbaccess/source/ui/misc/RowSetDrop.cxx3
-rw-r--r--dbaccess/source/ui/misc/RtfReader.cxx7
-rw-r--r--dbaccess/source/ui/misc/TokenWriter.cxx148
-rw-r--r--dbaccess/source/ui/misc/UITools.cxx3
-rw-r--r--dbaccess/source/ui/misc/UpdateHelperImpl.hxx27
-rw-r--r--dbaccess/source/ui/misc/WCPage.cxx11
-rw-r--r--dbaccess/source/ui/misc/WColumnSelect.cxx3
-rw-r--r--dbaccess/source/ui/misc/WCopyTable.cxx13
-rw-r--r--dbaccess/source/ui/misc/WNameMatch.cxx11
-rw-r--r--dbaccess/source/ui/misc/WTypeSelect.cxx3
-rw-r--r--dbaccess/source/ui/misc/WizardPages.hrc1
-rw-r--r--dbaccess/source/ui/misc/WizardPages.src23
-rw-r--r--dbaccess/source/ui/misc/dbumiscres.src6
-rw-r--r--dbaccess/source/ui/misc/dsmeta.cxx235
-rw-r--r--dbaccess/source/ui/misc/indexcollection.cxx12
-rw-r--r--dbaccess/source/ui/misc/linkeddocuments.cxx3
-rw-r--r--dbaccess/source/ui/misc/uiservices.cxx2
-rw-r--r--dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx5
-rw-r--r--dbaccess/source/ui/querydesign/JoinController.cxx3
-rw-r--r--dbaccess/source/ui/querydesign/JoinExchange.cxx3
-rw-r--r--dbaccess/source/ui/querydesign/JoinTableView.cxx41
-rw-r--r--dbaccess/source/ui/querydesign/QueryDesignView.cxx236
-rw-r--r--dbaccess/source/ui/querydesign/QueryTabWinUndoAct.cxx3
-rw-r--r--dbaccess/source/ui/querydesign/QueryTableView.cxx36
-rw-r--r--dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx64
-rw-r--r--dbaccess/source/ui/querydesign/TableConnection.cxx12
-rw-r--r--dbaccess/source/ui/querydesign/TableConnectionData.cxx8
-rw-r--r--dbaccess/source/ui/querydesign/TableWindowAccess.cxx8
-rw-r--r--dbaccess/source/ui/querydesign/query.src48
-rw-r--r--dbaccess/source/ui/querydesign/querycontroller.cxx7
-rw-r--r--dbaccess/source/ui/relationdesign/RTableConnection.cxx3
-rw-r--r--dbaccess/source/ui/relationdesign/RTableConnectionData.cxx12
-rw-r--r--dbaccess/source/ui/relationdesign/RelationController.cxx5
-rw-r--r--dbaccess/source/ui/relationdesign/RelationTableView.cxx3
-rw-r--r--dbaccess/source/ui/relationdesign/relation.src2
-rw-r--r--dbaccess/source/ui/tabledesign/FieldDescriptions.cxx12
-rw-r--r--dbaccess/source/ui/tabledesign/TEditControl.cxx23
-rw-r--r--dbaccess/source/ui/tabledesign/TableController.cxx25
-rw-r--r--dbaccess/source/ui/tabledesign/TableRowExchange.cxx3
-rw-r--r--dbaccess/source/ui/tabledesign/TableUndo.cxx9
-rw-r--r--dbaccess/source/ui/uno/copytablewizard.cxx32
-rw-r--r--dbaccess/source/ui/uno/makefile.mk8
-rw-r--r--dbaccess/source/ui/uno/unoadmin.cxx3
-rw-r--r--dbaccess/util/makefile.mk1
-rw-r--r--reportdesign/inc/RptObject.hxx6
-rw-r--r--reportdesign/inc/rptui_slotid.hrc3
-rw-r--r--reportdesign/source/core/sdr/RptObject.cxx27
-rw-r--r--reportdesign/source/filter/xml/xmlExport.cxx7
-rw-r--r--reportdesign/source/ui/dlg/AddField.cxx2
-rw-r--r--reportdesign/source/ui/dlg/Formula.cxx5
-rw-r--r--reportdesign/source/ui/dlg/Navigator.cxx10
-rw-r--r--reportdesign/source/ui/inc/FixedTextColor.hxx4
-rw-r--r--reportdesign/source/ui/inc/FormattedFieldBeautifier.hxx4
-rw-r--r--reportdesign/source/ui/inc/Formula.hxx1
-rw-r--r--reportdesign/source/ui/inc/IReportControllerObserver.hxx3
-rw-r--r--reportdesign/source/ui/inc/Navigator.hxx1
-rw-r--r--reportdesign/source/ui/inc/ReportController.hxx6
-rw-r--r--reportdesign/source/ui/inc/SectionWindow.hxx3
-rw-r--r--reportdesign/source/ui/inc/StartMarker.hxx1
-rw-r--r--reportdesign/source/ui/report/DesignView.cxx8
-rw-r--r--reportdesign/source/ui/report/ReportController.cxx35
-rw-r--r--reportdesign/source/ui/report/ScrollHelper.cxx2
-rw-r--r--reportdesign/source/ui/report/SectionWindow.cxx16
-rw-r--r--reportdesign/source/ui/report/StartMarker.cxx18
-rw-r--r--reportdesign/uiconfig/dbreport/accelerator/de-DE/default.xml2
-rw-r--r--reportdesign/uiconfig/dbreport/accelerator/en-GB/default.xml2
-rw-r--r--reportdesign/uiconfig/dbreport/accelerator/en-US/default.xml2
-rw-r--r--reportdesign/util/makefile.mk4
187 files changed, 5812 insertions, 5080 deletions
diff --git a/dbaccess/qa/complex/dbaccess/ApplicationController.java b/dbaccess/qa/complex/dbaccess/ApplicationController.java
index 41bf379f7a91..c3661ef7ffee 100644
--- a/dbaccess/qa/complex/dbaccess/ApplicationController.java
+++ b/dbaccess/qa/complex/dbaccess/ApplicationController.java
@@ -27,7 +27,6 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-
package complex.dbaccess;
import com.sun.star.beans.PropertyValue;
@@ -56,9 +55,10 @@ import java.io.IOException;
*/
public class ApplicationController extends complexlib.ComplexTestCase
{
- private HsqlDatabase m_database;
+
+ private HsqlDatabase m_database;
private XOfficeDatabaseDocument m_databaseDocument;
- private XDatabaseDocumentUI m_documentUI;
+ private XDatabaseDocumentUI m_documentUI;
public ApplicationController()
{
@@ -66,11 +66,29 @@ public class ApplicationController extends complexlib.ComplexTestCase
}
// --------------------------------------------------------------------------------------------------------
+ protected final XComponentContext getComponentContext()
+ {
+ XComponentContext context = null;
+ try
+ {
+ final XPropertySet orbProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, getORB());
+ context = (XComponentContext) UnoRuntime.queryInterface(XComponentContext.class,
+ orbProps.getPropertyValue("DefaultContext"));
+ }
+ catch (Exception ex)
+ {
+ failed("could not retrieve the ComponentContext");
+ }
+ return context;
+ }
+ // --------------------------------------------------------------------------------------------------------
+
public String[] getTestMethodNames()
{
- return new String[] {
- "checkSaveAs"
- };
+ return new String[]
+ {
+ "checkSaveAs"
+ };
}
// --------------------------------------------------------------------------------------------------------
@@ -82,30 +100,13 @@ public class ApplicationController extends complexlib.ComplexTestCase
// --------------------------------------------------------------------------------------------------------
protected final XMultiServiceFactory getORB()
{
- return (XMultiServiceFactory)param.getMSF();
- }
-
- // --------------------------------------------------------------------------------------------------------
- protected final XComponentContext getComponentContext()
- {
- XComponentContext context = null;
- try
- {
- XPropertySet orbProps = (XPropertySet) UnoRuntime.queryInterface( XPropertySet.class, getORB() );
- context = (XComponentContext)UnoRuntime.queryInterface( XComponentContext.class,
- orbProps.getPropertyValue( "DefaultContext" ) );
- }
- catch ( Exception ex )
- {
- failed( "could not retrieve the ComponentContext" );
- }
- return context;
+ return (XMultiServiceFactory) param.getMSF();
}
// --------------------------------------------------------------------------------------------------------
private void impl_closeDocument()
{
- if ( m_database != null )
+ if (m_database != null)
{
m_database.close();
m_database = null;
@@ -115,36 +116,36 @@ public class ApplicationController extends complexlib.ComplexTestCase
}
// --------------------------------------------------------------------------------------------------------
- private void impl_switchToDocument( String _documentURL ) throws java.lang.Exception
+ private void impl_switchToDocument(String _documentURL) throws java.lang.Exception
{
// close previous database document
impl_closeDocument();
// create/load the new database document
- m_database = ( _documentURL == null )
- ? new HsqlDatabase( getORB() )
- : new HsqlDatabase( getORB(), _documentURL );
+ m_database = (_documentURL == null)
+ ? new HsqlDatabase(getORB())
+ : new HsqlDatabase(getORB(), _documentURL);
m_databaseDocument = m_database.getDatabaseDocument();
// load it into a frame
- Object object = getORB().createInstance( "com.sun.star.frame.Desktop" );
- XComponentLoader xComponentLoader = (XComponentLoader)UnoRuntime.queryInterface( XComponentLoader.class, object );
- XComponent loadedComponent = xComponentLoader.loadComponentFromURL( m_database.getDocumentURL(), "_blank", FrameSearchFlag.ALL, new PropertyValue[0] );
+ final Object object = getORB().createInstance("com.sun.star.frame.Desktop");
+ final XComponentLoader xComponentLoader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, object);
+ final XComponent loadedComponent = xComponentLoader.loadComponentFromURL(m_database.getDocumentURL(), "_blank", FrameSearchFlag.ALL, new PropertyValue[0]);
- assure( "too many document instances!",
- UnoRuntime.areSame( loadedComponent, m_databaseDocument ) );
+ assure("too many document instances!",
+ UnoRuntime.areSame(loadedComponent, m_databaseDocument));
// get the controller, which provides access to various UI operations
- XModel docModel = (XModel)UnoRuntime.queryInterface( XModel.class,
- loadedComponent );
- m_documentUI = (XDatabaseDocumentUI)UnoRuntime.queryInterface( XDatabaseDocumentUI.class,
- docModel.getCurrentController() );
+ final XModel docModel = (XModel) UnoRuntime.queryInterface(XModel.class,
+ loadedComponent);
+ m_documentUI = (XDatabaseDocumentUI) UnoRuntime.queryInterface(XDatabaseDocumentUI.class,
+ docModel.getCurrentController());
}
// --------------------------------------------------------------------------------------------------------
public void before() throws Exception, java.lang.Exception
{
- impl_switchToDocument( null );
+ impl_switchToDocument(null);
}
// --------------------------------------------------------------------------------------------------------
@@ -152,52 +153,54 @@ public class ApplicationController extends complexlib.ComplexTestCase
{
impl_closeDocument();
}
-
// --------------------------------------------------------------------------------------------------------
+
public void checkSaveAs() throws Exception, IOException, java.lang.Exception
{
// issue 93737 describes the problem that when you save-as a database document, and do changes to it,
// then those changes are saved in the old document, actually
- String oldDocumentURL = m_database.getDocumentURL();
+ final String oldDocumentURL = m_database.getDocumentURL();
- File documentFile = java.io.File.createTempFile( getTestObjectName(), ".odb" );
+ final File documentFile = java.io.File.createTempFile(getTestObjectName(), ".odb");
documentFile.deleteOnExit();
- String newDocumentURL = URLHelper.getFileURLFromSystemPath( documentFile.getAbsoluteFile() );
+ final String newDocumentURL = URLHelper.getFileURLFromSystemPath(documentFile.getAbsoluteFile());
// store the doc in a new location
- XStorable storeDoc = (XStorable)UnoRuntime.queryInterface( XStorable.class,
- m_databaseDocument );
- storeDoc.storeAsURL( newDocumentURL, new PropertyValue[] {} );
+ final XStorable storeDoc = (XStorable) UnoRuntime.queryInterface(XStorable.class,
+ m_databaseDocument);
+ storeDoc.storeAsURL(newDocumentURL, new PropertyValue[]
+ {
+ });
// connect
m_documentUI.connect();
- assure( "could not connect to " + m_database.getDocumentURL(), m_documentUI.isConnected() );
+ assure("could not connect to " + m_database.getDocumentURL(), m_documentUI.isConnected());
// create a table in the database
- m_database.createTable( new HsqlTableDescriptor( "abc", new HsqlColumnDescriptor[] {
- new HsqlColumnDescriptor( "a", "VARCHAR(50)" ),
- new HsqlColumnDescriptor( "b", "VARCHAR(50)" ),
- new HsqlColumnDescriptor( "c", "VARCHAR(50)" )
- }
- ) );
+ m_database.createTable(new HsqlTableDescriptor("abc", new HsqlColumnDescriptor[]
+ {
+ new HsqlColumnDescriptor("a", "VARCHAR(50)"),
+ new HsqlColumnDescriptor("b", "VARCHAR(50)"),
+ new HsqlColumnDescriptor("c", "VARCHAR(50)")
+ }));
// load the old document, and verify there is *no* table therein
- impl_switchToDocument( oldDocumentURL );
+ impl_switchToDocument(oldDocumentURL);
m_documentUI.connect();
- assure( "could not connect to " + m_database.getDocumentURL(), m_documentUI.isConnected() );
- XTablesSupplier suppTables = (XTablesSupplier)UnoRuntime.queryInterface( XTablesSupplier.class,
- m_documentUI.getActiveConnection() );
+ assure("could not connect to " + m_database.getDocumentURL(), m_documentUI.isConnected());
+ XTablesSupplier suppTables = (XTablesSupplier) UnoRuntime.queryInterface(XTablesSupplier.class,
+ m_documentUI.getActiveConnection());
XNameAccess tables = suppTables.getTables();
- assure( "the table was created in the wrong database", !tables.hasByName( "abc" ) );
+ assure("the table was created in the wrong database", !tables.hasByName("abc"));
// load the new document, and verify there *is* a table therein
- impl_switchToDocument( newDocumentURL );
+ impl_switchToDocument(newDocumentURL);
m_documentUI.connect();
- assure( "could not connect to " + m_database.getDocumentURL(), m_documentUI.isConnected() );
+ assure("could not connect to " + m_database.getDocumentURL(), m_documentUI.isConnected());
- suppTables = (XTablesSupplier)UnoRuntime.queryInterface( XTablesSupplier.class,
- m_documentUI.getActiveConnection() );
+ suppTables = (XTablesSupplier) UnoRuntime.queryInterface(XTablesSupplier.class,
+ m_documentUI.getActiveConnection());
tables = suppTables.getTables();
- assure( "the newly created table has not been written", tables.hasByName( "abc" ) );
+ assure("the newly created table has not been written", tables.hasByName("abc"));
}
}
diff --git a/dbaccess/qa/complex/dbaccess/Beamer.java b/dbaccess/qa/complex/dbaccess/Beamer.java
new file mode 100644
index 000000000000..e24d6211cb1f
--- /dev/null
+++ b/dbaccess/qa/complex/dbaccess/Beamer.java
@@ -0,0 +1,194 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: Beamer.java,v $
+ * $Revision: 1.1.2.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package complex.dbaccess;
+
+import com.sun.star.beans.PropertyState;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XEnumeration;
+import com.sun.star.container.XEnumerationAccess;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.frame.FrameSearchFlag;
+import com.sun.star.frame.XComponentLoader;
+import com.sun.star.frame.XController;
+import com.sun.star.frame.XDispatch;
+import com.sun.star.frame.XDispatchProvider;
+import com.sun.star.frame.XFrame;
+import com.sun.star.frame.XModel;
+import com.sun.star.frame.XStorable;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sdb.CommandType;
+import com.sun.star.sdb.XDocumentDataSource;
+import com.sun.star.sdb.XOfficeDatabaseDocument;
+import com.sun.star.sdb.application.XDatabaseDocumentUI;
+import com.sun.star.sdbcx.XTablesSupplier;
+import com.sun.star.uno.Exception;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XComponentContext;
+import com.sun.star.uno.XNamingService;
+import com.sun.star.util.URL;
+import com.sun.star.util.XCloseable;
+import com.sun.star.util.XURLTransformer;
+import com.sun.star.view.XSelectionSupplier;
+import connectivity.tools.DataSource;
+import connectivity.tools.HsqlColumnDescriptor;
+import connectivity.tools.HsqlDatabase;
+import connectivity.tools.HsqlTableDescriptor;
+import helper.URLHelper;
+import java.io.File;
+import java.io.IOException;
+import util.UITools;
+
+/** complex test case for Base's application UI
+ */
+public class Beamer extends complexlib.ComplexTestCase
+{
+
+ private XModel docModel;
+
+ public Beamer()
+ {
+ super();
+ }
+
+ // --------------------------------------------------------------------------------------------------------
+ protected final XComponentContext getComponentContext()
+ {
+ XComponentContext context = null;
+ try
+ {
+ final XPropertySet orbProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, getORB());
+ context = (XComponentContext) UnoRuntime.queryInterface(XComponentContext.class,
+ orbProps.getPropertyValue("DefaultContext"));
+ }
+ catch (Exception ex)
+ {
+ failed("could not retrieve the ComponentContext");
+ }
+ return context;
+ }
+ // --------------------------------------------------------------------------------------------------------
+
+ public String[] getTestMethodNames()
+ {
+ return new String[]
+ {
+ "testBeamer"
+ };
+ }
+
+ // --------------------------------------------------------------------------------------------------------
+ public String getTestObjectName()
+ {
+ return getClass().getName();
+ }
+
+ // --------------------------------------------------------------------------------------------------------
+ protected final XMultiServiceFactory getORB()
+ {
+ return (XMultiServiceFactory) param.getMSF();
+ }
+
+ // --------------------------------------------------------------------------------------------------------
+ private void impl_closeDocument()
+ {
+ }
+
+ // --------------------------------------------------------------------------------------------------------
+ public void before() throws Exception, java.lang.Exception
+ {
+ // load it into a frame
+ final Object object = getORB().createInstance("com.sun.star.frame.Desktop");
+ final XComponentLoader xComponentLoader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, object);
+ final XComponent loadedComponent = xComponentLoader.loadComponentFromURL("private:factory/swriter", "_blank", 0, new PropertyValue[0]);
+ // get the controller, which provides access to various UI operations
+ docModel = (XModel) UnoRuntime.queryInterface(XModel.class, loadedComponent);
+ }
+
+ // --------------------------------------------------------------------------------------------------------
+ public void after()
+ {
+ }
+ // --------------------------------------------------------------------------------------------------------
+
+ public void testBeamer() throws Exception, IOException, java.lang.Exception
+ {
+ final XController controller = docModel.getCurrentController();
+ final XFrame frame = controller.getFrame();
+ final XDispatchProvider dispatchP = (XDispatchProvider) UnoRuntime.queryInterface(XDispatchProvider.class, frame);
+ URL command = new URL();
+ // command.Complete = ".component:DB/DataSourceBrowser";
+ command.Complete = ".uno:ViewDataSourceBrowser";
+
+ Object instance = getORB().createInstance("com.sun.star.util.URLTransformer");
+ XURLTransformer atrans = (XURLTransformer) UnoRuntime.queryInterface(XURLTransformer.class, instance);
+ com.sun.star.util.URL[] aURLA = new com.sun.star.util.URL[1];
+ aURLA[0] = command;
+ atrans.parseStrict(aURLA);
+ command = aURLA[0];
+
+ final XDispatch dispatch = dispatchP.queryDispatch(command, "_self", FrameSearchFlag.AUTO);
+ assure(dispatch != null);
+ dispatch.dispatch(command, new PropertyValue[0]);
+
+ final PropertyValue[] props = new PropertyValue[]
+ {
+ new PropertyValue("DataSourceName", 0, "Bibliography", PropertyState.DIRECT_VALUE),
+ new PropertyValue("CommandType", 0, Integer.valueOf(CommandType.TABLE), PropertyState.DIRECT_VALUE),
+ new PropertyValue("Command", 0, "biblio", PropertyState.DIRECT_VALUE)
+ };
+
+ final XFrame beamer = frame.findFrame("_beamer", 0);
+ assure(beamer != null);
+ final XEnumerationAccess evtBc = (XEnumerationAccess) UnoRuntime.queryInterface(XEnumerationAccess.class, getORB().createInstance("com.sun.star.frame.GlobalEventBroadcaster"));
+ XEnumeration enumeration = evtBc.createEnumeration();
+ int count = -1;
+ while (enumeration.hasMoreElements())
+ {
+ enumeration.nextElement();
+ ++count;
+ }
+ final XSelectionSupplier selSup = (XSelectionSupplier)UnoRuntime.queryInterface(XSelectionSupplier.class, beamer.getController());
+ selSup.select(props);
+ final com.sun.star.util.XCloseable close = (com.sun.star.util.XCloseable)UnoRuntime.queryInterface(com.sun.star.util.XCloseable.class, frame);
+ close.close(false);
+
+ enumeration = evtBc.createEnumeration();
+ int count2 = 0;
+ while (enumeration.hasMoreElements())
+ {
+ enumeration.nextElement();
+ ++count2;
+ }
+
+ assure("count1 = " + count + " count2 = " + count2, count == count2);
+ }
+}
diff --git a/dbaccess/qa/complex/dbaccess/CRMBasedTestCase.java b/dbaccess/qa/complex/dbaccess/CRMBasedTestCase.java
index edcb62579aac..eccb48647bae 100644
--- a/dbaccess/qa/complex/dbaccess/CRMBasedTestCase.java
+++ b/dbaccess/qa/complex/dbaccess/CRMBasedTestCase.java
@@ -54,12 +54,14 @@ public abstract class CRMBasedTestCase extends TestCase
}
// --------------------------------------------------------------------------------------------------------
+ @Override
public void before()
{
createTestCase();
}
// --------------------------------------------------------------------------------------------------------
+ @Override
public void after()
{
try
@@ -78,7 +80,7 @@ public abstract class CRMBasedTestCase extends TestCase
*/
protected final XSingleSelectQueryComposer createQueryComposer() throws com.sun.star.uno.Exception
{
- XMultiServiceFactory connectionFactory = (XMultiServiceFactory)UnoRuntime.queryInterface(
+ final XMultiServiceFactory connectionFactory = (XMultiServiceFactory)UnoRuntime.queryInterface(
XMultiServiceFactory.class, m_database.getConnection() );
return (XSingleSelectQueryComposer)UnoRuntime.queryInterface(
XSingleSelectQueryComposer.class, connectionFactory.createInstance( "com.sun.star.sdb.SingleSelectQueryComposer" ) );
diff --git a/dbaccess/qa/complex/dbaccess/CRMDatabase.java b/dbaccess/qa/complex/dbaccess/CRMDatabase.java
index ca28c1c769e7..77e2dcf6b2e2 100644
--- a/dbaccess/qa/complex/dbaccess/CRMDatabase.java
+++ b/dbaccess/qa/complex/dbaccess/CRMDatabase.java
@@ -51,10 +51,12 @@ import connectivity.tools.QueryDefinition;
*/
public class CRMDatabase
{
- private XMultiServiceFactory m_orb;
- private HsqlDatabase m_database;
- private DataSource m_dataSource;
- private XConnection m_connection;
+ private static final String INTEGER = "INTEGER";
+ private static final String VARCHAR50 = "VARCHAR(50)";
+ private final XMultiServiceFactory m_orb;
+ private final HsqlDatabase m_database;
+ private final DataSource m_dataSource;
+ private final XConnection m_connection;
/** constructs the CRM database
*/
@@ -97,8 +99,8 @@ public class CRMDatabase
{
HsqlTableDescriptor table = new HsqlTableDescriptor( "categories",
new HsqlColumnDescriptor[] {
- new HsqlColumnDescriptor( "ID", "INTEGER", HsqlColumnDescriptor.PRIMARY ),
- new HsqlColumnDescriptor( "Name", "VARCHAR(50)" ),
+ new HsqlColumnDescriptor( "ID",INTEGER, HsqlColumnDescriptor.PRIMARY ),
+ new HsqlColumnDescriptor( "Name",VARCHAR50),
new HsqlColumnDescriptor( "Description", "VARCHAR(1024)" ),
new HsqlColumnDescriptor( "Image", "LONGVARBINARY" ) } );
m_database.createTable( table, true );
@@ -108,9 +110,9 @@ public class CRMDatabase
table = new HsqlTableDescriptor( "products",
new HsqlColumnDescriptor[] {
- new HsqlColumnDescriptor( "ID", "INTEGER", HsqlColumnDescriptor.PRIMARY ),
- new HsqlColumnDescriptor( "Name", "VARCHAR(50)" ),
- new HsqlColumnDescriptor( "CategoryID", "INTEGER", HsqlColumnDescriptor.REQUIRED, "categories", "ID" ) } );
+ new HsqlColumnDescriptor( "ID",INTEGER, HsqlColumnDescriptor.PRIMARY ),
+ new HsqlColumnDescriptor( "Name",VARCHAR50),
+ new HsqlColumnDescriptor( "CategoryID",INTEGER, HsqlColumnDescriptor.REQUIRED, "categories", "ID" ) } );
m_database.createTable( table, true );
m_database.executeSQL( "INSERT INTO \"products\" VALUES ( 1, 'Oranges', 1 )" );
@@ -120,22 +122,23 @@ public class CRMDatabase
table = new HsqlTableDescriptor( "customers",
new HsqlColumnDescriptor[] {
- new HsqlColumnDescriptor( "ID", "INTEGER", HsqlColumnDescriptor.PRIMARY ),
- new HsqlColumnDescriptor( "Name", "VARCHAR(50)" ),
- new HsqlColumnDescriptor( "Address", "VARCHAR(50)" ),
- new HsqlColumnDescriptor( "City", "VARCHAR(50)" ),
- new HsqlColumnDescriptor( "Postal", "VARCHAR(50)" ) } );
+ new HsqlColumnDescriptor( "ID",INTEGER, HsqlColumnDescriptor.PRIMARY ),
+ new HsqlColumnDescriptor( "Name",VARCHAR50),
+ new HsqlColumnDescriptor( "Address",VARCHAR50),
+ new HsqlColumnDescriptor( "City",VARCHAR50),
+ new HsqlColumnDescriptor( "Postal",VARCHAR50),
+ new HsqlColumnDescriptor( "Comment","LONGVARCHAR")} );
m_database.createTable( table, true );
- m_database.executeSQL( "INSERT INTO \"customers\" VALUES(1,'Food, Inc.','Down Under','Melbourne','509') " );
- m_database.executeSQL( "INSERT INTO \"customers\" VALUES(2,'Simply Delicious','Down Under','Melbourne','518') " );
- m_database.executeSQL( "INSERT INTO \"customers\" VALUES(3,'Pure Health','10 Fish St.','San Francisco','94107') " );
- m_database.executeSQL( "INSERT INTO \"customers\" VALUES(4,'Milk And More','Arlington Road 21','Dublin','31021') " );
+ m_database.executeSQL( "INSERT INTO \"customers\" VALUES(1,'Food, Inc.','Down Under','Melbourne','509','Prefered') " );
+ m_database.executeSQL( "INSERT INTO \"customers\" VALUES(2,'Simply Delicious','Down Under','Melbourne','518',null) " );
+ m_database.executeSQL( "INSERT INTO \"customers\" VALUES(3,'Pure Health','10 Fish St.','San Francisco','94107',null) " );
+ m_database.executeSQL( "INSERT INTO \"customers\" VALUES(4,'Milk And More','Arlington Road 21','Dublin','31021','Good one.') " );
table = new HsqlTableDescriptor( "orders",
new HsqlColumnDescriptor[] {
- new HsqlColumnDescriptor( "ID", "INTEGER", HsqlColumnDescriptor.PRIMARY ),
- new HsqlColumnDescriptor( "CustomerID", "INTEGER", HsqlColumnDescriptor.REQUIRED, "customers", "ID" ),
+ new HsqlColumnDescriptor( "ID",INTEGER, HsqlColumnDescriptor.PRIMARY ),
+ new HsqlColumnDescriptor( "CustomerID",INTEGER, HsqlColumnDescriptor.REQUIRED, "customers", "ID" ),
new HsqlColumnDescriptor( "OrderDate", "DATE" ),
new HsqlColumnDescriptor( "ShipDate", "DATE" ) } );
m_database.createTable( table, true );
@@ -145,9 +148,9 @@ public class CRMDatabase
table = new HsqlTableDescriptor( "orders_details",
new HsqlColumnDescriptor[] {
- new HsqlColumnDescriptor( "OrderID", "INTEGER", HsqlColumnDescriptor.PRIMARY, "orders", "ID" ),
- new HsqlColumnDescriptor( "ProductID", "INTEGER", HsqlColumnDescriptor.PRIMARY, "products", "ID" ),
- new HsqlColumnDescriptor( "Quantity", "INTEGER" ) } );
+ new HsqlColumnDescriptor( "OrderID",INTEGER, HsqlColumnDescriptor.PRIMARY, "orders", "ID" ),
+ new HsqlColumnDescriptor( "ProductID",INTEGER, HsqlColumnDescriptor.PRIMARY, "products", "ID" ),
+ new HsqlColumnDescriptor( "Quantity",INTEGER) } );
m_database.createTable( table, true );
m_database.executeSQL( "INSERT INTO \"orders_details\" VALUES(1, 1, 100)" );
@@ -158,9 +161,9 @@ public class CRMDatabase
// since we created the tables by directly executing the SQL statements, we need to refresh
// the tables container
- XTablesSupplier suppTables = (XTablesSupplier)UnoRuntime.queryInterface(
+ final XTablesSupplier suppTables = (XTablesSupplier)UnoRuntime.queryInterface(
XTablesSupplier.class, m_connection );
- XRefreshable refreshTables = (XRefreshable)UnoRuntime.queryInterface(
+ final XRefreshable refreshTables = (XRefreshable)UnoRuntime.queryInterface(
XRefreshable.class, suppTables.getTables() );
refreshTables.refresh();
}
@@ -169,11 +172,11 @@ public class CRMDatabase
private void validateUnparseable()
{
// The "unparseable" query should be indeed be unparseable by OOo (though a valid HSQL query)
- XSingleSelectQueryComposer composer = null;
- QueryDefinition unparseableQuery = null;
+ XSingleSelectQueryComposer composer;
+ QueryDefinition unparseableQuery;
try
{
- XMultiServiceFactory factory = (XMultiServiceFactory)UnoRuntime.queryInterface(
+ final XMultiServiceFactory factory = (XMultiServiceFactory)UnoRuntime.queryInterface(
XMultiServiceFactory.class, m_database.defaultConnection() );
composer = (XSingleSelectQueryComposer)UnoRuntime.queryInterface(
XSingleSelectQueryComposer.class, factory.createInstance( "com.sun.star.sdb.SingleSelectQueryComposer" ) );
diff --git a/dbaccess/source/ui/dlg/AdabasStatDlg.hrc b/dbaccess/qa/complex/dbaccess/CopyTableInterActionHandler.java
index 07151f981ab5..977ddd059eb5 100644
--- a/dbaccess/source/ui/dlg/AdabasStatDlg.hrc
+++ b/dbaccess/qa/complex/dbaccess/CopyTableInterActionHandler.java
@@ -6,7 +6,7 @@
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: AdabasStatDlg.hrc,v $
+ * $RCSfile: RowSetEventListener.java,v $
* $Revision: 1.4 $
*
* This file is part of OpenOffice.org.
@@ -27,10 +27,27 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-#ifndef DBAUI_ADABASSTATDLG_HRC
-#define DBAUI_ADABASSTATDLG_HRC
+package complex.dbaccess;
-#define STR_PAGETITLE_ADABAS_STATISTIC 1
+import com.sun.star.lib.uno.helper.WeakBase;
+import com.sun.star.task.XInteractionHandler;
+import com.sun.star.task.XInteractionRequest;
+/**
+ *
+ * @author oj93728
+ */
+class CopyTableInterActionHandler extends WeakBase
+ implements XInteractionHandler
+{
+ private final CopyTableWizard test;
+ public CopyTableInterActionHandler(CopyTableWizard testCase)
+ {
+ test = testCase;
+ }
-#endif // DBAUI_ADABASSTATDLG_HRC
+ public void handle(XInteractionRequest xRequest)
+ {
+ test.assure(xRequest.toString());
+ }
+}
diff --git a/dbaccess/qa/complex/dbaccess/CopyTableWizard.java b/dbaccess/qa/complex/dbaccess/CopyTableWizard.java
new file mode 100644
index 000000000000..9a9f8bd3731e
--- /dev/null
+++ b/dbaccess/qa/complex/dbaccess/CopyTableWizard.java
@@ -0,0 +1,239 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: CopyTableWizard.java,v $
+ * $Revision: 1.1.2.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package complex.dbaccess;
+
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.awt.XExtendedToolkit;
+import com.sun.star.awt.XWindow;
+import com.sun.star.beans.Optional;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.sdb.CommandType;
+import com.sun.star.sdb.application.XCopyTableWizard;
+import com.sun.star.sdb.DataAccessDescriptorFactory;
+import com.sun.star.sdbc.XConnection;
+import com.sun.star.sdbcx.XTablesSupplier;
+import com.sun.star.task.XInteractionHandler;
+import com.sun.star.uno.Exception;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XComponentContext;
+import connectivity.tools.DbaseDatabase;
+import java.io.IOException;
+import util.UITools;
+
+/** complex test case for Base's application UI
+ */
+public class CopyTableWizard extends CRMBasedTestCase
+{
+
+ private DatabaseApplication source;
+ private DatabaseApplication dest;
+
+ public CopyTableWizard()
+ {
+ super();
+ }
+
+ // --------------------------------------------------------------------------------------------------------
+ public String[] getTestMethodNames()
+ {
+ return new String[]
+ {
+ "copyTable", "copyTableDbase"
+ };
+ }
+
+ // --------------------------------------------------------------------------------------------------------
+ @Override
+ public String getTestObjectName()
+ {
+ return getClass().getName();
+ }
+// --------------------------------------------------------------------------------------------------------
+ // --------------------------------------------------------------------------------------------------------
+
+ @Override
+ public void after()
+ {
+ dest.store();
+ super.after();
+ }
+
+ @Override
+ public void before()
+ {
+ try
+ {
+ createTestCase();
+ source = new DatabaseApplication(this.m_database.getDatabase());
+ dest = new DatabaseApplication(new DbaseDatabase(getORB()));
+ }
+ catch (java.lang.Exception ex)
+ {
+ assure(false);
+ }
+ }
+ // --------------------------------------------------------------------------------------------------------
+
+
+
+ class CopyThread implements Runnable
+ {
+
+ final XCopyTableWizard copyWizard;
+
+ public CopyThread(final XCopyTableWizard copyWizard)
+ {
+ this.copyWizard = copyWizard;
+ }
+
+ public void run()
+ {
+ copyWizard.execute();
+ }
+ }
+
+ private XWindow getActiveWindow()
+ {
+ Object toolKit = null;
+ try
+ {
+ toolKit = getORB().createInstance("com.sun.star.awt.Toolkit");
+ }
+ catch (com.sun.star.uno.Exception e)
+ {
+ return null;
+ }
+
+ XExtendedToolkit tk = (XExtendedToolkit) UnoRuntime.queryInterface(XExtendedToolkit.class, toolKit);
+ Object atw = tk.getActiveTopWindow();
+ return (XWindow) UnoRuntime.queryInterface(XWindow.class, atw);
+ }
+
+ public void copyTable() throws Exception, IOException, java.lang.Exception
+ {
+ copyTable(source,source);
+ }
+
+ public void copyTableDbase() throws Exception, IOException, java.lang.Exception
+ {
+ copyTable(source,dest);
+ }
+ public void copyTable(final DatabaseApplication sourceDb,final DatabaseApplication destDb) throws Exception, IOException, java.lang.Exception
+ {
+ final XConnection destConnection = destDb.getDocumentUI().getActiveConnection();
+
+ final XConnection sourceConnection = sourceDb.getDocumentUI().getActiveConnection();
+ final XTablesSupplier suppTables = (XTablesSupplier) UnoRuntime.queryInterface(XTablesSupplier.class, sourceConnection);
+ final XNameAccess tables = suppTables.getTables();
+
+ final String[] names = tables.getElementNames();
+ for (int i = 0; i < names.length; i++)
+ {
+ copyTable(names[i], sourceConnection, destConnection);
+ }
+ }
+
+ public void assure(final String message)
+ {
+ assure(message, false);
+ }
+
+ private void copyTable(final String tableName, final XConnection sourceConnection, final XConnection destConnection) throws Exception, IOException, java.lang.Exception
+ {
+
+ final XInteractionHandler interAction = new CopyTableInterActionHandler(this);
+ final XComponentContext context = getComponentContext();
+ final XPropertySet sourceDescriptor = DataAccessDescriptorFactory.get(context).createDataAccessDescriptor();
+ sourceDescriptor.setPropertyValue("CommandType", CommandType.TABLE);
+ sourceDescriptor.setPropertyValue("Command", tableName);
+ sourceDescriptor.setPropertyValue("ActiveConnection", sourceConnection);
+
+ final XPropertySet destDescriptor = DataAccessDescriptorFactory.get(context).createDataAccessDescriptor();
+ destDescriptor.setPropertyValue("ActiveConnection", destConnection);
+
+ final XCopyTableWizard copyWizard = com.sun.star.sdb.application.CopyTableWizard.createWithInteractionHandler(context, sourceDescriptor, destDescriptor, interAction);
+ copyWizard.setOperation((short) 0); // com.sun.star.sdb.application.CopyDefinitionAndData
+ Optional<String> auto = new Optional<String>();
+
+ auto.IsPresent = destConnection.getMetaData().supportsCoreSQLGrammar();
+ if (auto.IsPresent)
+ {
+ auto.Value = "ID_test";
+ }
+ copyWizard.setCreatePrimaryKey(auto);
+ Thread thread = new Thread(new CopyThread(copyWizard));
+ thread.start();
+ sleep();
+
+ try
+ {
+ final XWindow dialog = getActiveWindow();
+ final UITools uiTools = new UITools(getORB(), dialog);
+ final XAccessible root = uiTools.getRoot();
+ final XAccessibleContext accContext = root.getAccessibleContext();
+ final int count = accContext.getAccessibleChildCount();
+ String buttonName = "Create";
+ final XAccessibleContext childContext = accContext.getAccessibleChild(count - 3).getAccessibleContext();
+ final String name = childContext.getAccessibleName();
+ if (name != null && !"".equals(name))
+ {
+ buttonName = name;
+ }
+ try
+ {
+ uiTools.clickButton(buttonName);
+ }
+ catch (java.lang.Exception exception)
+ {
+ exception.printStackTrace();
+ }
+ }
+ catch (com.sun.star.lang.IndexOutOfBoundsException indexOutOfBoundsException)
+ {
+ }
+ sleep();
+
+ thread.join();
+ }
+
+ private void sleep()
+ {
+ try
+ {
+ Thread.sleep(500);
+ }
+ catch (java.lang.InterruptedException e)
+ {
+ }
+ }
+ // --------------------------------------------------------------------------------------------------------
+}
diff --git a/dbaccess/qa/complex/dbaccess/DataSource.java b/dbaccess/qa/complex/dbaccess/DataSource.java
index cb19a1f85d53..29c9d2f2cdd7 100644
--- a/dbaccess/qa/complex/dbaccess/DataSource.java
+++ b/dbaccess/qa/complex/dbaccess/DataSource.java
@@ -30,21 +30,27 @@
package complex.dbaccess;
import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.Exception;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.XNamingService;
+import complexlib.ComplexTestCase;
+import connectivity.tools.HsqlDatabase;
+import java.util.logging.Level;
+import java.util.logging.Logger;
-public class DataSource extends complexlib.ComplexTestCase {
+public class DataSource extends ComplexTestCase
+{
- connectivity.tools.HsqlDatabase m_database;
- connectivity.tools.DataSource m_dataSource;
+ HsqlDatabase m_database;
+ connectivity.tools.DataSource m_dataSource;
// --------------------------------------------------------------------------------------------------------
public String[] getTestMethodNames()
{
return new String[]
- {
- "testRegistrationName"
- };
+ {
+ "testRegistrationName"
+ };
}
// --------------------------------------------------------------------------------------------------------
@@ -58,52 +64,49 @@ public class DataSource extends complexlib.ComplexTestCase {
{
try
{
- if ( m_database == null )
+ if (m_database == null)
{
- CRMDatabase database = new CRMDatabase( getFactory() );
+ final CRMDatabase database = new CRMDatabase(getFactory());
m_database = database.getDatabase();
m_dataSource = m_database.getDataSource();
}
}
- catch( Exception e )
+ catch (Exception e)
+ {
+ failed("could not create the test case, error message:\n" + e.getMessage());
+ }
+ catch (java.lang.Exception e)
{
- failed( "could not create the test case, error message:\n" + e.getMessage() );
+ failed("could not create the test case, error message:\n" + e.getMessage());
}
}
// --------------------------------------------------------------------------------------------------------
private XMultiServiceFactory getFactory()
{
- return (XMultiServiceFactory)param.getMSF();
+ return (XMultiServiceFactory) param.getMSF();
}
// --------------------------------------------------------------------------------------------------------
public void testRegistrationName()
{
- createTestCase();
-
try
{
+ createTestCase();
// 1. check the existing "Bibliography" data source whether it has the proper name
String dataSourceName = "Bibliography";
- connectivity.tools.DataSource bibliography = new connectivity.tools.DataSource( getFactory(), dataSourceName );
- assureEquals( "pre-registered database has a wrong name!",
- dataSourceName, bibliography.getName() );
-
+ final connectivity.tools.DataSource bibliography = new connectivity.tools.DataSource(getFactory(), dataSourceName);
+ assureEquals("pre-registered database has a wrong name!", dataSourceName, bibliography.getName());
// 2. register a newly created data source, and verify it has the proper name
dataSourceName = "someDataSource";
-
- XNamingService dataSourceRegistrations = (XNamingService)UnoRuntime.queryInterface(
- XNamingService.class, getFactory().createInstance("com.sun.star.sdb.DatabaseContext"));
+ final XNamingService dataSourceRegistrations = (XNamingService) UnoRuntime.queryInterface(
+ XNamingService.class, getFactory().createInstance("com.sun.star.sdb.DatabaseContext"));
dataSourceRegistrations.registerObject("someDataSource", m_dataSource.getXDataSource());
-
- assureEquals( "registration name of a newly registered data source is wrong",
- dataSourceName, m_dataSource.getName() );
+ assureEquals("registration name of a newly registered data source is wrong", dataSourceName, m_dataSource.getName());
}
- catch ( AssureException e ) { throw e; }
- catch ( Exception e )
+ catch (Exception ex)
{
- failed( "caught an unexpected exception: " + e.getMessage() );
+ Logger.getLogger(DataSource.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
diff --git a/dbaccess/qa/complex/dbaccess/DatabaseApplication.java b/dbaccess/qa/complex/dbaccess/DatabaseApplication.java
new file mode 100644
index 000000000000..139582bc1953
--- /dev/null
+++ b/dbaccess/qa/complex/dbaccess/DatabaseApplication.java
@@ -0,0 +1,104 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: RowSetEventListener.java,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package complex.dbaccess;
+
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.frame.FrameSearchFlag;
+import com.sun.star.frame.XComponentLoader;
+import com.sun.star.frame.XModel;
+import com.sun.star.frame.XStorable;
+import com.sun.star.lang.XComponent;
+import com.sun.star.sdb.XOfficeDatabaseDocument;
+import com.sun.star.sdb.application.XDatabaseDocumentUI;
+import com.sun.star.uno.Exception;
+import com.sun.star.uno.UnoRuntime;
+import connectivity.tools.DatabaseAccess;
+
+/**
+ *
+ * @author oj93728
+ */
+public class DatabaseApplication
+{
+
+ private final XOfficeDatabaseDocument databaseDocument;
+ private final XDatabaseDocumentUI documentUI;
+ private final DatabaseAccess db;
+
+ public DatabaseApplication(final DatabaseAccess _db) throws Exception
+ {
+ db = _db;
+ databaseDocument = db.getDatabaseDocument();
+
+ // load it into a frame
+ final Object object = db.getORB().createInstance("com.sun.star.frame.Desktop");
+ final XComponentLoader xComponentLoader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, object);
+ final XComponent loadedComponent = xComponentLoader.loadComponentFromURL(db.getDocumentURL(), "_blank", FrameSearchFlag.ALL, new PropertyValue[0]);
+
+ // get the controller, which provides access to various UI operations
+ final XModel docModel = (XModel) UnoRuntime.queryInterface(XModel.class,
+ loadedComponent);
+ documentUI = (XDatabaseDocumentUI) UnoRuntime.queryInterface(XDatabaseDocumentUI.class,
+ docModel.getCurrentController());
+ documentUI.connect();
+ }
+
+ public XOfficeDatabaseDocument getDatabaseDocument()
+ {
+ return databaseDocument;
+ }
+
+ public XDatabaseDocumentUI getDocumentUI()
+ {
+ return documentUI;
+ }
+
+ public DatabaseAccess getDb()
+ {
+ return db;
+ }
+
+ public void store()
+ {
+ // store the doc in a new location
+ try
+ {
+ final XStorable storeDoc = (XStorable) UnoRuntime.queryInterface(XStorable.class,
+ databaseDocument);
+ if (storeDoc != null)
+ {
+ storeDoc.store();
+ }
+ }
+ catch (com.sun.star.io.IOException iOException)
+ {
+ }
+ }
+}
diff --git a/dbaccess/qa/complex/dbaccess/DatabaseDocument.java b/dbaccess/qa/complex/dbaccess/DatabaseDocument.java
index 09f7871dbbbb..3b00de883319 100644
--- a/dbaccess/qa/complex/dbaccess/DatabaseDocument.java
+++ b/dbaccess/qa/complex/dbaccess/DatabaseDocument.java
@@ -48,7 +48,6 @@ import com.sun.star.document.XDocumentEventBroadcaster;
import com.sun.star.document.XDocumentEventListener;
import com.sun.star.document.XEmbeddedScripts;
import com.sun.star.document.XEventsSupplier;
-import com.sun.star.document.XScriptInvocationContext;
import com.sun.star.frame.DoubleInitializationException;
import com.sun.star.lang.XComponent;
import com.sun.star.frame.XComponentLoader;
@@ -79,24 +78,25 @@ import com.sun.star.util.XChangesBatch;
import com.sun.star.util.XCloseable;
import com.sun.star.util.XModifiable;
import com.sun.star.util.XURLTransformer;
-import connectivity.tools.*;
import java.io.IOException;
import java.util.Iterator;
-import java.util.Vector;
+import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
public class DatabaseDocument extends TestCase implements com.sun.star.document.XDocumentEventListener
{
- private XComponent m_callbackFactory = null;
- private Vector m_documentEvents = new Vector();
- private Vector m_globalEvents = new Vector();
+ private static final String ONLOAD = "OnLoad";
+ private static final String _BLANK = "_blank";
+ private XComponent m_callbackFactory = null;
+ private final ArrayList m_documentEvents = new ArrayList();
+ private final ArrayList m_globalEvents = new ArrayList();
// for those states, see testDocumentEvents
- private static short STATE_NOT_STARTED = 0;
- private static short STATE_LOADING_DOC = 1;
- private static short STATE_MACRO_EXEC_APPROVED = 2;
- private static short STATE_ON_LOAD_RECEIVED = 3;
+ private static short STATE_NOT_STARTED = 0;
+ private static short STATE_LOADING_DOC = 1;
+ private static short STATE_MACRO_EXEC_APPROVED = 2;
+ private static short STATE_ON_LOAD_RECEIVED = 3;
private short m_loadDocState = STATE_NOT_STARTED;
// ========================================================================================================
@@ -105,21 +105,22 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document.
*/
private class CallbackComponent implements XDocumentEventListener, XTypeProvider
{
- public void documentEventOccured( DocumentEvent _event )
+
+ public void documentEventOccured(DocumentEvent _event)
{
- onDocumentEvent( _event );
+ onDocumentEvent(_event);
}
- public void disposing( com.sun.star.lang.EventObject _Event )
+ public void disposing(com.sun.star.lang.EventObject _Event)
{
// not interested in
}
public Type[] getTypes()
{
- Class interfaces[] = getClass().getInterfaces();
+ final Class interfaces[] = getClass().getInterfaces();
Type types[] = new Type[interfaces.length];
- for(int i = 0; i < interfaces.length; ++ i)
+ for (int i = 0; i < interfaces.length; ++i)
{
types[i] = new Type(interfaces[i]);
}
@@ -143,16 +144,17 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document.
*/
private class CallbackComponentFactory implements XSingleComponentFactory, XServiceInfo, XComponent
{
- private Vector m_eventListeners = new Vector();
- public Object createInstanceWithContext( XComponentContext _context ) throws Exception
+ private final ArrayList m_eventListeners = new ArrayList();
+
+ public Object createInstanceWithContext(XComponentContext _context) throws Exception
{
return new CallbackComponent();
}
- public Object createInstanceWithArgumentsAndContext( Object[] arg0, XComponentContext _context ) throws Exception
+ public Object createInstanceWithArgumentsAndContext(Object[] arg0, XComponentContext _context) throws Exception
{
- return createInstanceWithContext( _context );
+ return createInstanceWithContext(_context);
}
public String getImplementationName()
@@ -160,76 +162,82 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document.
return "org.openoffice.complex.dbaccess.CallbackComponent";
}
- public boolean supportsService( String _service )
+ public boolean supportsService(String _service)
{
- return _service.equals( getCallbackComponentServiceName() );
+ return _service.equals(getCallbackComponentServiceName());
}
public String[] getSupportedServiceNames()
{
- return new String[] { getCallbackComponentServiceName() };
+ return new String[]
+ {
+ getCallbackComponentServiceName()
+ };
}
public void dispose()
{
- EventObject event = new EventObject( this );
+ final EventObject event = new EventObject(this);
- Vector eventListenersCopy = (Vector)m_eventListeners.clone();
- Iterator iter = eventListenersCopy.iterator();
- while ( iter.hasNext() )
+ final ArrayList eventListenersCopy = (ArrayList) m_eventListeners.clone();
+ final Iterator iter = eventListenersCopy.iterator();
+ while (iter.hasNext())
{
- ((XEventListener)iter.next()).disposing( event );
+ ((XEventListener) iter.next()).disposing(event);
}
}
- public void addEventListener( XEventListener _listener )
+ public void addEventListener(XEventListener _listener)
{
- if ( _listener != null )
- m_eventListeners.add( _listener );
+ if (_listener != null)
+ {
+ m_eventListeners.add(_listener);
+ }
}
- public void removeEventListener( XEventListener _listener )
+ public void removeEventListener(XEventListener _listener)
{
- m_eventListeners.remove( _listener );
+ m_eventListeners.remove(_listener);
}
};
// ========================================================================================================
private class MacroExecutionApprove implements XInteractionHandler
{
+
private XInteractionHandler m_defaultHandler = null;
- MacroExecutionApprove( XMultiServiceFactory _factory )
+ MacroExecutionApprove(XMultiServiceFactory _factory)
{
try
{
- m_defaultHandler = (XInteractionHandler)UnoRuntime.queryInterface( XInteractionHandler.class,
- _factory.createInstance( "com.sun.star.sdb.InteractionHandler" ) );
+ m_defaultHandler = (XInteractionHandler) UnoRuntime.queryInterface(XInteractionHandler.class,
+ _factory.createInstance("com.sun.star.sdb.InteractionHandler"));
}
- catch ( Exception ex )
+ catch (Exception ex)
{
- Logger.getLogger( DatabaseDocument.class.getName() ).log( Level.SEVERE, null, ex );
+ Logger.getLogger(DatabaseDocument.class.getName()).log(Level.SEVERE, null, ex);
}
}
- public void handle( XInteractionRequest _request )
+ public void handle(XInteractionRequest _request)
{
- Object request = _request.getRequest();
- if ( !( request instanceof DocumentMacroConfirmationRequest ) && ( m_defaultHandler != null ) )
+ final Object request = _request.getRequest();
+ if (!(request instanceof DocumentMacroConfirmationRequest) && (m_defaultHandler != null))
{
- m_defaultHandler.handle( _request );
+ m_defaultHandler.handle(_request);
return;
}
- assureEquals( "interaction handleer called in wrong state", STATE_LOADING_DOC, m_loadDocState );
+ assureEquals("interaction handleer called in wrong state", STATE_LOADING_DOC, m_loadDocState);
// auto-approve
- XInteractionContinuation continuations[] = _request.getContinuations();
- for ( int i=0; i<continuations.length; ++i )
+ final XInteractionContinuation continuations[] = _request.getContinuations();
+ for (int i = 0; i < continuations.length; ++i)
{
- XInteractionApprove approve = (XInteractionApprove)UnoRuntime.queryInterface( XInteractionApprove.class,
- continuations[i] );
- if ( approve != null )
+ final XInteractionApprove approve = (XInteractionApprove) UnoRuntime.queryInterface(XInteractionApprove.class,
+ continuations[i]);
+ if (approve != null)
{
approve.select();
m_loadDocState = STATE_MACRO_EXEC_APPROVED;
@@ -244,11 +252,11 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document.
public String[] getTestMethodNames()
{
return new String[]
- {
- "testLoadable",
- "testDocumentEvents",
- "testGlobalEvents"
- };
+ {
+ "testLoadable",
+ "testDocumentEvents",
+ "testGlobalEvents"
+ };
}
// --------------------------------------------------------------------------------------------------------
@@ -266,21 +274,21 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document.
// at our service factory, insert a new factory for our CallbackComponent
// this will allow the Basic code in our test documents to call back into this test case
// here, by just instantiating this service
- XSet globalFactory = (XSet)UnoRuntime.queryInterface(
- XSet.class, getORB() );
+ final XSet globalFactory = (XSet) UnoRuntime.queryInterface(
+ XSet.class, getORB());
m_callbackFactory = new CallbackComponentFactory();
- globalFactory.insert( m_callbackFactory );
+ globalFactory.insert(m_callbackFactory);
// register ourself as listener at the global event broadcaster
- XDocumentEventBroadcaster broadcaster = (XDocumentEventBroadcaster)UnoRuntime.queryInterface(
- XDocumentEventBroadcaster.class, getORB().createInstance( "com.sun.star.frame.GlobalEventBroadcaster" ) );
- broadcaster.addDocumentEventListener( this );
+ final XDocumentEventBroadcaster broadcaster = (XDocumentEventBroadcaster) UnoRuntime.queryInterface(
+ XDocumentEventBroadcaster.class, getORB().createInstance("com.sun.star.frame.GlobalEventBroadcaster"));
+ broadcaster.addDocumentEventListener(this);
}
- catch( Exception e )
+ catch (Exception e)
{
- System.err.println( "could not create the test case, error message:\n" + e.getMessage() );
- e.printStackTrace( System.err );
- failed( "failed to create the test case" );
+ log.println("could not create the test case, error message:\n" + e.getMessage());
+ e.printStackTrace(System.err);
+ failed("failed to create the test case");
}
}
@@ -296,25 +304,26 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document.
m_callbackFactory.dispose();
// revoke ourself as listener at the global event broadcaster
- XDocumentEventBroadcaster broadcaster = (XDocumentEventBroadcaster) UnoRuntime.queryInterface(
- XDocumentEventBroadcaster.class, getORB().createInstance( "com.sun.star.frame.GlobalEventBroadcaster" ) );
- broadcaster.removeDocumentEventListener( this );
+ final XDocumentEventBroadcaster broadcaster = (XDocumentEventBroadcaster) UnoRuntime.queryInterface(
+ XDocumentEventBroadcaster.class, getORB().createInstance("com.sun.star.frame.GlobalEventBroadcaster"));
+ broadcaster.removeDocumentEventListener(this);
}
- catch ( Exception e )
+ catch (Exception e)
{
- System.err.println( "could not close the test case, error message:\n" + e.getMessage() );
- e.printStackTrace( System.err );
- failed( "failed to close the test case" );
+ log.println("could not create the test case, error message:\n" + e.getMessage());
+ e.printStackTrace(System.err);
+ failed("failed to close the test case");
}
}
// --------------------------------------------------------------------------------------------------------
- private class UnoMethodDescriptor
+ private static class UnoMethodDescriptor
{
- public Class unoInterfaceClass = null;
- public String methodName = null;
- public UnoMethodDescriptor( Class _class, String _method )
+ public Class unoInterfaceClass = null;
+ public String methodName = null;
+
+ public UnoMethodDescriptor(Class _class, String _method)
{
unoInterfaceClass = _class;
methodName = _method;
@@ -322,21 +331,22 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document.
}
// --------------------------------------------------------------------------------------------------------
- private void impl_checkDocumentInitState( Object _document, boolean _isInitialized )
+ private void impl_checkDocumentInitState(Object _document, boolean _isInitialized)
{
// things you cannot do with an uninitialized document:
- UnoMethodDescriptor[] unsupportedMethods = new UnoMethodDescriptor[] {
- new UnoMethodDescriptor( XStorable.class, "store" ),
- new UnoMethodDescriptor( XFormDocumentsSupplier.class, "getFormDocuments" ),
- new UnoMethodDescriptor( XReportDocumentsSupplier.class, "getReportDocuments" ),
- new UnoMethodDescriptor( XScriptProviderSupplier.class, "getScriptProvider" ),
- new UnoMethodDescriptor( XEventsSupplier.class, "getEvents" ),
- new UnoMethodDescriptor( XTitle.class, "getTitle" ),
- new UnoMethodDescriptor( XModel2.class, "getControllers" )
- // (there's much more than this, but we cannot list all methods here, can we ...)
+ final UnoMethodDescriptor[] unsupportedMethods = new UnoMethodDescriptor[]
+ {
+ new UnoMethodDescriptor(XStorable.class, "store"),
+ new UnoMethodDescriptor(XFormDocumentsSupplier.class, "getFormDocuments"),
+ new UnoMethodDescriptor(XReportDocumentsSupplier.class, "getReportDocuments"),
+ new UnoMethodDescriptor(XScriptProviderSupplier.class, "getScriptProvider"),
+ new UnoMethodDescriptor(XEventsSupplier.class, "getEvents"),
+ new UnoMethodDescriptor(XTitle.class, "getTitle"),
+ new UnoMethodDescriptor(XModel2.class, "getControllers")
+ // (there's much more than this, but we cannot list all methods here, can we ...)
};
- for ( int i=0; i<unsupportedMethods.length; ++i)
+ for (int i = 0; i < unsupportedMethods.length; ++i)
{
assureException( _document, unsupportedMethods[i].unoInterfaceClass,
unsupportedMethods[i].methodName, new Object[]{}, _isInitialized ? null : NotInitializedException.class );
@@ -344,59 +354,59 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document.
}
// --------------------------------------------------------------------------------------------------------
- private XModel impl_createDocument( ) throws Exception
+ private XModel impl_createDocument() throws Exception
{
- XModel databaseDoc = (XModel)UnoRuntime.queryInterface( XModel.class,
- getORB().createInstance( "com.sun.star.sdb.OfficeDatabaseDocument" ) );
+ final XModel databaseDoc = (XModel) UnoRuntime.queryInterface(XModel.class,
+ getORB().createInstance("com.sun.star.sdb.OfficeDatabaseDocument"));
// should not be initialized here - we did neither initNew nor load nor storeAsURL it
- impl_checkDocumentInitState( databaseDoc, false );
+ impl_checkDocumentInitState(databaseDoc, false);
return databaseDoc;
}
// --------------------------------------------------------------------------------------------------------
- private void impl_closeDocument( XModel _databaseDoc ) throws CloseVetoException, IOException, Exception
+ private void impl_closeDocument(XModel _databaseDoc) throws CloseVetoException, IOException, Exception
{
- XCloseable closeDoc = (XCloseable)UnoRuntime.queryInterface( XCloseable.class,
- _databaseDoc );
- closeDoc.close( true );
+ final XCloseable closeDoc = (XCloseable) UnoRuntime.queryInterface(XCloseable.class,
+ _databaseDoc);
+ closeDoc.close(true);
}
// --------------------------------------------------------------------------------------------------------
private XModel impl_createEmptyEmbeddedHSQLDocument() throws Exception, IOException
{
- XModel databaseDoc = (XModel)UnoRuntime.queryInterface( XModel.class,
- getORB().createInstance( "com.sun.star.sdb.OfficeDatabaseDocument" ) );
- XStorable storeDoc = (XStorable)UnoRuntime.queryInterface( XStorable.class, databaseDoc );
+ final XModel databaseDoc = (XModel) UnoRuntime.queryInterface(XModel.class,
+ getORB().createInstance("com.sun.star.sdb.OfficeDatabaseDocument"));
+ final XStorable storeDoc = (XStorable) UnoRuntime.queryInterface(XStorable.class, databaseDoc);
// verify the document rejects API calls which require it to be initialized
- impl_checkDocumentInitState( databaseDoc, false );
+ impl_checkDocumentInitState(databaseDoc, false);
// though the document is not initialized, you can ask for the location, the URL, and the args
- String location = storeDoc.getLocation();
- String url = databaseDoc.getURL();
- PropertyValue[] args = databaseDoc.getArgs();
+ final String location = storeDoc.getLocation();
+ final String url = databaseDoc.getURL();
+ final PropertyValue[] args = databaseDoc.getArgs();
// they should be all empty at this time
- assureEquals( "location is expected to be empty here", "", location );
- assureEquals( "URL is expected to be empty here", "", url );
- assureEquals( "Args are expected to be empty here", 0, args.length );
+ assureEquals("location is expected to be empty here", "", location);
+ assureEquals("URL is expected to be empty here", "", url);
+ assureEquals("Args are expected to be empty here", 0, args.length);
// and, you should be able to set properties at the data source
- XOfficeDatabaseDocument dataSourceAccess = (XOfficeDatabaseDocument)UnoRuntime.queryInterface(
- XOfficeDatabaseDocument.class, databaseDoc );
- XPropertySet dsProperties = (XPropertySet)UnoRuntime.queryInterface(
- XPropertySet.class, dataSourceAccess.getDataSource() );
- dsProperties.setPropertyValue( "URL", "sdbc:embedded:hsqldb" );
+ final XOfficeDatabaseDocument dataSourceAccess = (XOfficeDatabaseDocument) UnoRuntime.queryInterface(
+ XOfficeDatabaseDocument.class, databaseDoc);
+ final XPropertySet dsProperties = (XPropertySet) UnoRuntime.queryInterface(
+ XPropertySet.class, dataSourceAccess.getDataSource());
+ dsProperties.setPropertyValue("URL", "sdbc:embedded:hsqldb");
- String documentURL = createTempFileURL();
- storeDoc.storeAsURL( documentURL, new PropertyValue[0] );
+ final String documentURL = createTempFileURL();
+ storeDoc.storeAsURL(documentURL, new PropertyValue[0]);
// now that the document is stored, ...
// ... its URL should be correct
- assureEquals( "wrong URL after storing the document", documentURL, databaseDoc.getURL() );
+ assureEquals("wrong URL after storing the document", documentURL, databaseDoc.getURL());
// ... it should be initialized
- impl_checkDocumentInitState( databaseDoc, true );
+ impl_checkDocumentInitState(databaseDoc, true);
return databaseDoc;
}
@@ -416,16 +426,19 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document.
// ....................................................................
// 2. XLoadable::load
- databaseDoc = (XModel)UnoRuntime.queryInterface( XModel.class,
- getORB().createInstance( "com.sun.star.sdb.OfficeDatabaseDocument" ) );
- documentURL = copyToTempFile( documentURL );
+ databaseDoc = (XModel) UnoRuntime.queryInterface(XModel.class,
+ getORB().createInstance("com.sun.star.sdb.OfficeDatabaseDocument"));
+ documentURL = copyToTempFile(documentURL);
// load the doc, and verify it's initialized then, and has the proper URL
- XLoadable loadDoc = (XLoadable)UnoRuntime.queryInterface( XLoadable.class, databaseDoc );
- loadDoc.load( new PropertyValue[] { new PropertyValue( "URL", 0, documentURL, PropertyState.DIRECT_VALUE ) } );
- databaseDoc.attachResource( documentURL, new PropertyValue[0] );
+ XLoadable loadDoc = (XLoadable) UnoRuntime.queryInterface(XLoadable.class, databaseDoc);
+ loadDoc.load(new PropertyValue[]
+ {
+ new PropertyValue("URL", 0, documentURL, PropertyState.DIRECT_VALUE)
+ });
+ databaseDoc.attachResource(documentURL, new PropertyValue[0]);
- assureEquals( "wrong URL after loading the document", documentURL, databaseDoc.getURL() );
- impl_checkDocumentInitState( databaseDoc, true );
+ assureEquals("wrong URL after loading the document", documentURL, databaseDoc.getURL());
+ impl_checkDocumentInitState(databaseDoc, true);
// and while we are here ... initilizing the same document again should not be possible
assureException( databaseDoc, XLoadable.class, "initNew", new Object[0],
@@ -435,12 +448,12 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document.
// ....................................................................
// 3. XLoadable::initNew
- impl_closeDocument( databaseDoc );
+ impl_closeDocument(databaseDoc);
databaseDoc = impl_createDocument();
- loadDoc = (XLoadable)UnoRuntime.queryInterface( XLoadable.class, databaseDoc );
+ loadDoc = (XLoadable) UnoRuntime.queryInterface(XLoadable.class, databaseDoc);
loadDoc.initNew();
- assureEquals( "wrong URL after initializing the document", "", databaseDoc.getURL() );
- impl_checkDocumentInitState( databaseDoc, true );
+ assureEquals("wrong URL after initializing the document", "", databaseDoc.getURL());
+ impl_checkDocumentInitState(databaseDoc, true);
// same as above - initializing the document a second time must fail
assureException( databaseDoc, XLoadable.class, "initNew", new Object[0],
@@ -452,38 +465,41 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document.
// --------------------------------------------------------------------------------------------------------
private PropertyValue[] impl_getDefaultLoadArgs()
{
- return new PropertyValue[] {
- new PropertyValue( "PickListEntry", 0, false, PropertyState.DIRECT_VALUE )
- };
+ return new PropertyValue[]
+ {
+ new PropertyValue("PickListEntry", 0, false, PropertyState.DIRECT_VALUE)
+ };
}
// --------------------------------------------------------------------------------------------------------
private PropertyValue[] impl_getMacroExecLoadArgs()
{
- return new PropertyValue[] {
- new PropertyValue( "PickListEntry", 0, false, PropertyState.DIRECT_VALUE ),
- new PropertyValue( "MacroExecutionMode", 0, com.sun.star.document.MacroExecMode.USE_CONFIG, PropertyState.DIRECT_VALUE ),
- new PropertyValue( "InteractionHandler", 0, new MacroExecutionApprove(( getORB() )), PropertyState.DIRECT_VALUE )
- };
+ return new PropertyValue[]
+ {
+ new PropertyValue("PickListEntry", 0, false, PropertyState.DIRECT_VALUE),
+ new PropertyValue("MacroExecutionMode", 0, com.sun.star.document.MacroExecMode.USE_CONFIG, PropertyState.DIRECT_VALUE),
+ new PropertyValue("InteractionHandler", 0, new MacroExecutionApprove(getORB()), PropertyState.DIRECT_VALUE)
+ };
}
// --------------------------------------------------------------------------------------------------------
- private int impl_setMacroSecurityLevel( int _level ) throws Exception
+ private int impl_setMacroSecurityLevel(int _level) throws Exception
{
- XMultiServiceFactory configProvider = (XMultiServiceFactory)UnoRuntime.queryInterface( XMultiServiceFactory.class,
- getORB().createInstance( "com.sun.star.configuration.ConfigurationProvider" ) );
+ final XMultiServiceFactory configProvider = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class,
+ getORB().createInstance("com.sun.star.configuration.ConfigurationProvider"));
- PropertyValue[] args = new PropertyValue[] {
- new PropertyValue( "nodepath", 0, "/org.openoffice.Office.Common/Security/Scripting", PropertyState.DIRECT_VALUE )
+ final PropertyValue[] args = new PropertyValue[]
+ {
+ new PropertyValue("nodepath", 0, "/org.openoffice.Office.Common/Security/Scripting", PropertyState.DIRECT_VALUE)
};
- XPropertySet securitySettings = (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class,
- configProvider.createInstanceWithArguments( "com.sun.star.configuration.ConfigurationUpdateAccess", args ) );
- int oldValue = ((Integer)securitySettings.getPropertyValue( "MacroSecurityLevel" )).intValue();
- securitySettings.setPropertyValue( "MacroSecurityLevel", new Integer( _level ) );
+ final XPropertySet securitySettings = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,
+ configProvider.createInstanceWithArguments("com.sun.star.configuration.ConfigurationUpdateAccess", args));
+ final int oldValue = ((Integer) securitySettings.getPropertyValue("MacroSecurityLevel")).intValue();
+ securitySettings.setPropertyValue("MacroSecurityLevel", Integer.valueOf(_level));
- XChangesBatch committer = (XChangesBatch)UnoRuntime.queryInterface( XChangesBatch.class,
- securitySettings );
+ final XChangesBatch committer = (XChangesBatch) UnoRuntime.queryInterface(XChangesBatch.class,
+ securitySettings);
committer.commitChanges();
return oldValue;
@@ -496,50 +512,50 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document.
XModel databaseDoc = impl_createEmptyEmbeddedHSQLDocument();
// create Basic library/module therein
- XEmbeddedScripts embeddedScripts = (XEmbeddedScripts) UnoRuntime.queryInterface( XEmbeddedScripts.class,
- databaseDoc );
- XStorageBasedLibraryContainer basicLibs = embeddedScripts.getBasicLibraries();
- XNameContainer newLib = basicLibs.createLibrary( "EventHandlers" );
- String eventHandlerCode =
- "Option Explicit\n" +
- "\n" +
- "Sub OnLoad\n" +
- " Dim oCallback as Object\n" +
- " oCallback = createUnoService( \"" + getCallbackComponentServiceName() + "\" )\n" +
- "\n" +
- " ' as long as the Document is not passed to the Basic callbacks, we need to create\n" +
- " ' one ourself\n" +
- " Dim oEvent as new com.sun.star.document.DocumentEvent\n" +
- " oEvent.EventName = \"OnLoad\"\n" +
- " oEvent.Source = ThisComponent\n" +
- "\n" +
- " oCallback.documentEventOccured( oEvent )\n" +
- "End Sub\n";
- newLib.insertByName( "all", eventHandlerCode );
+ final XEmbeddedScripts embeddedScripts = (XEmbeddedScripts) UnoRuntime.queryInterface(XEmbeddedScripts.class,
+ databaseDoc);
+ final XStorageBasedLibraryContainer basicLibs = embeddedScripts.getBasicLibraries();
+ final XNameContainer newLib = basicLibs.createLibrary("EventHandlers");
+ final String eventHandlerCode =
+ "Option Explicit\n" +
+ "\n" +
+ "Sub OnLoad\n" +
+ " Dim oCallback as Object\n" +
+ " oCallback = createUnoService( \"" + getCallbackComponentServiceName() + "\" )\n" +
+ "\n" +
+ " ' as long as the Document is not passed to the Basic callbacks, we need to create\n" +
+ " ' one ourself\n" +
+ " Dim oEvent as new com.sun.star.document.DocumentEvent\n" +
+ " oEvent.EventName = \"OnLoad\"\n" +
+ " oEvent.Source = ThisComponent\n" +
+ "\n" +
+ " oCallback.documentEventOccured( oEvent )\n" +
+ "End Sub\n";
+ newLib.insertByName("all", eventHandlerCode);
// bind the macro to the OnLoad event
- String macroURI = "vnd.sun.star.script:EventHandlers.all.OnLoad?language=Basic&location=document";
- XEventsSupplier eventsSupplier = (XEventsSupplier)UnoRuntime.queryInterface( XEventsSupplier.class,
- databaseDoc );
- eventsSupplier.getEvents().replaceByName( "OnLoad", new PropertyValue[] {
- new PropertyValue( "EventType", 0, "Script", PropertyState.DIRECT_VALUE ),
- new PropertyValue( "Script", 0, macroURI, PropertyState.DIRECT_VALUE )
- } );
+ final String macroURI = "vnd.sun.star.script:EventHandlers.all.OnLoad?language=Basic&location=document";
+ final XEventsSupplier eventsSupplier = (XEventsSupplier) UnoRuntime.queryInterface(XEventsSupplier.class,
+ databaseDoc);
+ eventsSupplier.getEvents().replaceByName(ONLOAD, new PropertyValue[]
+ {
+ new PropertyValue("EventType", 0, "Script", PropertyState.DIRECT_VALUE),
+ new PropertyValue("Script", 0, macroURI, PropertyState.DIRECT_VALUE)
+ });
// store the document, and close it
- String documentURL = databaseDoc.getURL();
- documentURL = FileHelper.getOOoCompatibleFileURL( documentURL );
- XStorable storeDoc = (XStorable) UnoRuntime.queryInterface( XStorable.class,
- databaseDoc );
+ final String documentURL = FileHelper.getOOoCompatibleFileURL(databaseDoc.getURL());
+ final XStorable storeDoc = (XStorable) UnoRuntime.queryInterface(XStorable.class,
+ databaseDoc);
storeDoc.store();
- impl_closeDocument( databaseDoc );
+ impl_closeDocument(databaseDoc);
// ensure the macro security configuration is "ask the user for document macro execution"
- int oldSecurityLevel = impl_setMacroSecurityLevel( 1 );
+ final int oldSecurityLevel = impl_setMacroSecurityLevel(1);
// load it, again
- XComponentLoader loader = (XComponentLoader)UnoRuntime.queryInterface( XComponentLoader.class,
- getORB().createInstance( "com.sun.star.frame.Desktop" ) );
+ final XComponentLoader loader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class,
+ getORB().createInstance("com.sun.star.frame.Desktop"));
m_loadDocState = STATE_LOADING_DOC;
// expected order of states is:
@@ -551,296 +567,342 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document.
// here) is called before the OnLoad notification is received - since the latter happens from within
// a Basic macro which is bound to the OnLoad event of the document.
- String context = "OnLoad";
- impl_startObservingEvents( context );
- databaseDoc = (XModel)UnoRuntime.queryInterface( XModel.class,
- loader.loadComponentFromURL( documentURL, "_blank", 0, impl_getMacroExecLoadArgs() ) );
- impl_stopObservingEvents( m_documentEvents, new String[] { "OnLoad" }, context );
+ final String context = ONLOAD;
+ impl_startObservingEvents(context);
+ databaseDoc = (XModel) UnoRuntime.queryInterface(XModel.class,
+ loader.loadComponentFromURL(documentURL, _BLANK, 0, impl_getMacroExecLoadArgs()));
+ impl_stopObservingEvents(m_documentEvents, new String[]
+ {
+ ONLOAD
+ }, context);
- assureEquals( "our provided interaction handler was not called", STATE_ON_LOAD_RECEIVED, m_loadDocState );
+ assureEquals("our provided interaction handler was not called", STATE_ON_LOAD_RECEIVED, m_loadDocState);
// restore macro security level
- impl_setMacroSecurityLevel( oldSecurityLevel );
+ impl_setMacroSecurityLevel(oldSecurityLevel);
// close the document
- impl_closeDocument( databaseDoc );
+ impl_closeDocument(databaseDoc);
}
// --------------------------------------------------------------------------------------------------------
public void testGlobalEvents() throws Exception, IOException
{
XModel databaseDoc = impl_createEmptyEmbeddedHSQLDocument();
- XStorable storeDoc = (XStorable) UnoRuntime.queryInterface( XStorable.class,
- databaseDoc );
+ final XStorable storeDoc = (XStorable) UnoRuntime.queryInterface(XStorable.class,
+ databaseDoc);
- String oldURL = null, newURL = null, context = null;
+ String context, newURL;
// XStorable.store
- oldURL = databaseDoc.getURL();
+ final String oldURL = databaseDoc.getURL();
context = "store";
- impl_startObservingEvents( context );
+ impl_startObservingEvents(context);
storeDoc.store();
- assureEquals( "store is not expected to change the document URL", databaseDoc.getURL(), oldURL );
- impl_stopObservingEvents( m_globalEvents, new String[] { "OnSave", "OnSaveDone" }, context );
+ assureEquals("store is not expected to change the document URL", databaseDoc.getURL(), oldURL);
+ impl_stopObservingEvents(m_globalEvents, new String[]
+ {
+ "OnSave", "OnSaveDone"
+ }, context);
// XStorable.storeToURL
context = "storeToURL";
- impl_startObservingEvents( context );
- storeDoc.storeToURL( createTempFileURL(), new PropertyValue[0] );
- assureEquals( "storetoURL is not expected to change the document URL", databaseDoc.getURL(), oldURL );
- impl_stopObservingEvents( m_globalEvents, new String[] { "OnSaveTo", "OnSaveToDone" }, context );
+ impl_startObservingEvents(context);
+ storeDoc.storeToURL(createTempFileURL(), new PropertyValue[0]);
+ assureEquals("storetoURL is not expected to change the document URL", databaseDoc.getURL(), oldURL);
+ impl_stopObservingEvents(m_globalEvents, new String[]
+ {
+ "OnSaveTo", "OnSaveToDone"
+ }, context);
// XStorable.storeAsURL
newURL = createTempFileURL();
context = "storeAsURL";
- impl_startObservingEvents( context );
- storeDoc.storeAsURL( newURL, new PropertyValue[0] );
- assureEquals( "storeAsURL is expected to change the document URL", databaseDoc.getURL(), newURL );
- impl_stopObservingEvents( m_globalEvents, new String[] { "OnSaveAs", "OnSaveAsDone" }, context );
+ impl_startObservingEvents(context);
+ storeDoc.storeAsURL(newURL, new PropertyValue[0]);
+ assureEquals("storeAsURL is expected to change the document URL", databaseDoc.getURL(), newURL);
+ impl_stopObservingEvents(m_globalEvents, new String[]
+ {
+ "OnSaveAs", "OnSaveAsDone"
+ }, context);
// XModifiable.setModified
- XModifiable modifyDoc = (XModifiable) UnoRuntime.queryInterface( XModifiable.class,
- databaseDoc );
+ final XModifiable modifyDoc = (XModifiable) UnoRuntime.queryInterface(XModifiable.class,
+ databaseDoc);
context = "setModified";
- impl_startObservingEvents( context );
- modifyDoc.setModified( true );
- assureEquals( "setModified didn't work", modifyDoc.isModified(), true );
- impl_stopObservingEvents( m_globalEvents, new String[] { "OnModifyChanged" }, context );
+ impl_startObservingEvents(context);
+ modifyDoc.setModified(true);
+ assureEquals("setModified didn't work", modifyDoc.isModified(), true);
+ impl_stopObservingEvents(m_globalEvents, new String[]
+ {
+ "OnModifyChanged"
+ }, context);
// XStorable.store, with implicit reset of the "Modified" flag
context = "store (2)";
- impl_startObservingEvents( context );
+ impl_startObservingEvents(context);
storeDoc.store();
- assureEquals( "'store' should implicitly reset the modified flag", modifyDoc.isModified(), false );
- impl_stopObservingEvents( m_globalEvents, new String[] { "OnSave", "OnSaveDone", "OnModifyChanged" }, context );
+ assureEquals("'store' should implicitly reset the modified flag", modifyDoc.isModified(), false);
+ impl_stopObservingEvents(m_globalEvents, new String[]
+ {
+ "OnSave", "OnSaveDone", "OnModifyChanged"
+ }, context);
// XComponentLoader.loadComponentFromURL
- newURL = copyToTempFile( databaseDoc.getURL() );
- XComponentLoader loader = (XComponentLoader)UnoRuntime.queryInterface( XComponentLoader.class,
- getORB().createInstance( "com.sun.star.frame.Desktop" ) );
+ newURL = copyToTempFile(databaseDoc.getURL());
+ final XComponentLoader loader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class,
+ getORB().createInstance("com.sun.star.frame.Desktop"));
context = "loadComponentFromURL";
- impl_startObservingEvents( context );
- databaseDoc = (XModel) UnoRuntime.queryInterface( XModel.class,
- loader.loadComponentFromURL( newURL, "_blank", 0, impl_getDefaultLoadArgs() ) );
- impl_stopObservingEvents( m_globalEvents,
- new String[] { "OnLoadFinished", "OnViewCreated", "OnFocus", "OnLoad" }, context );
+ impl_startObservingEvents(context);
+ databaseDoc = (XModel) UnoRuntime.queryInterface(XModel.class,
+ loader.loadComponentFromURL(newURL, _BLANK, 0, impl_getDefaultLoadArgs()));
+ impl_stopObservingEvents(m_globalEvents,
+ new String[]
+ {
+ "OnLoadFinished", "OnViewCreated", "OnFocus", ONLOAD
+ }, context);
// closing a document by API
- XCloseable closeDoc = (XCloseable) UnoRuntime.queryInterface( XCloseable.class,
- databaseDoc );
+ final XCloseable closeDoc = (XCloseable) UnoRuntime.queryInterface(XCloseable.class,
+ databaseDoc);
context = "close (API)";
- impl_startObservingEvents( context );
- closeDoc.close( true );
- impl_stopObservingEvents( m_globalEvents,
- new String[] { "OnPrepareUnload", "OnViewClosed", "OnUnload" }, context );
+ impl_startObservingEvents(context);
+ closeDoc.close(true);
+ impl_stopObservingEvents(m_globalEvents,
+ new String[]
+ {
+ "OnPrepareUnload", "OnViewClosed", "OnUnload"
+ }, context);
// closing a document via UI
context = "close (UI)";
- impl_startObservingEvents( "prepare for '" + context + "'" );
- databaseDoc = (XModel)UnoRuntime.queryInterface( XModel.class,
- loader.loadComponentFromURL( newURL, "_blank", 0, impl_getDefaultLoadArgs() ) );
- impl_waitForEvent( m_globalEvents, "OnLoad", 5000 );
- // wait for all events to arrive - OnLoad should be the last one
-
- XDispatchProvider dispatchProvider = (XDispatchProvider) UnoRuntime.queryInterface( XDispatchProvider.class,
- databaseDoc.getCurrentController().getFrame() );
- URL url = impl_getURL( ".uno:CloseDoc" );
- XDispatch dispatcher = dispatchProvider.queryDispatch( url, "", 0 );
- impl_startObservingEvents( context );
- dispatcher.dispatch( url, new PropertyValue[0] );
- impl_stopObservingEvents( m_globalEvents,
- new String[] { "OnPrepareViewClosing", "OnViewClosed", "OnPrepareUnload", "OnUnload" }, context );
+ impl_startObservingEvents("prepare for '" + context + "'");
+ databaseDoc = (XModel) UnoRuntime.queryInterface(XModel.class,
+ loader.loadComponentFromURL(newURL, _BLANK, 0, impl_getDefaultLoadArgs()));
+ impl_waitForEvent(m_globalEvents, ONLOAD, 5000);
+ // wait for all events to arrive - OnLoad should be the last one
+
+ final XDispatchProvider dispatchProvider = (XDispatchProvider) UnoRuntime.queryInterface(XDispatchProvider.class,
+ databaseDoc.getCurrentController().getFrame());
+ final URL url = impl_getURL(".uno:CloseDoc");
+ final XDispatch dispatcher = dispatchProvider.queryDispatch(url, "", 0);
+ impl_startObservingEvents(context);
+ dispatcher.dispatch(url, new PropertyValue[0]);
+ impl_stopObservingEvents(m_globalEvents,
+ new String[]
+ {
+ "OnPrepareViewClosing", "OnViewClosed", "OnPrepareUnload", "OnUnload"
+ }, context);
// creating a new document
databaseDoc = impl_createDocument();
- XLoadable loadDoc = (XLoadable) UnoRuntime.queryInterface( XLoadable.class,
- databaseDoc );
+ final XLoadable loadDoc = (XLoadable) UnoRuntime.queryInterface(XLoadable.class,
+ databaseDoc);
context = "initNew";
- impl_startObservingEvents( context );
+ impl_startObservingEvents(context);
loadDoc.initNew();
- impl_stopObservingEvents( m_globalEvents, new String[] { "OnCreate" }, context );
+ impl_stopObservingEvents(m_globalEvents, new String[]
+ {
+ "OnCreate"
+ }, context);
- impl_startObservingEvents( context + " (cleanup)" );
- impl_closeDocument( databaseDoc );
- impl_waitForEvent( m_globalEvents, "OnUnload", 5000 );
+ impl_startObservingEvents(context + " (cleanup)");
+ impl_closeDocument(databaseDoc);
+ impl_waitForEvent(m_globalEvents, "OnUnload", 5000);
// focus changes
context = "activation";
// for this, load a database document ...
- impl_startObservingEvents( "prepare for '" + context + "'" );
- databaseDoc = (XModel)UnoRuntime.queryInterface( XModel.class,
- loader.loadComponentFromURL( newURL, "_blank", 0, impl_getDefaultLoadArgs() ) );
- int previousOnLoadEventPos = impl_waitForEvent( m_globalEvents, "OnLoad", 5000 );
+ impl_startObservingEvents("prepare for '" + context + "'");
+ databaseDoc = (XModel) UnoRuntime.queryInterface(XModel.class,
+ loader.loadComponentFromURL(newURL, _BLANK, 0, impl_getDefaultLoadArgs()));
+ final int previousOnLoadEventPos = impl_waitForEvent(m_globalEvents, ONLOAD, 5000);
// ... and another document ...
- String otherURL = copyToTempFile( databaseDoc.getURL() );
- XModel otherDoc = (XModel)UnoRuntime.queryInterface( XModel.class,
- loader.loadComponentFromURL( otherURL, "_blank", 0, impl_getDefaultLoadArgs() ) );
- impl_waitForEvent( m_globalEvents, "OnLoad", 5000, previousOnLoadEventPos + 1 );
- impl_raise( otherDoc );
+ final String otherURL = copyToTempFile(databaseDoc.getURL());
+ final XModel otherDoc = (XModel) UnoRuntime.queryInterface(XModel.class,
+ loader.loadComponentFromURL(otherURL, _BLANK, 0, impl_getDefaultLoadArgs()));
+ impl_waitForEvent(m_globalEvents, ONLOAD, 5000, previousOnLoadEventPos + 1);
+ impl_raise(otherDoc);
// ... and switch between the two
- impl_startObservingEvents( context );
- impl_raise( databaseDoc );
- impl_stopObservingEvents( m_globalEvents, new String[] { "OnUnfocus", "OnFocus" }, context );
+ impl_startObservingEvents(context);
+ impl_raise(databaseDoc);
+ impl_stopObservingEvents(m_globalEvents, new String[]
+ {
+ "OnUnfocus", "OnFocus"
+ }, context);
// cleanup
- impl_startObservingEvents( "cleanup after '" + context + "'" );
- impl_closeDocument( databaseDoc );
- impl_closeDocument( otherDoc );
+ impl_startObservingEvents("cleanup after '" + context + "'");
+ impl_closeDocument(databaseDoc);
+ impl_closeDocument(otherDoc);
}
// --------------------------------------------------------------------------------------------------------
- private URL impl_getURL( String _completeURL ) throws Exception
+ private URL impl_getURL(String _completeURL) throws Exception
{
- URL[] url = { new URL() };
+ final URL[] url =
+ {
+ new URL()
+ };
url[0].Complete = _completeURL;
- XURLTransformer urlTransformer = (XURLTransformer) UnoRuntime.queryInterface( XURLTransformer.class,
- getORB().createInstance( "com.sun.star.util.URLTransformer" ) );
- urlTransformer.parseStrict( url );
+ final XURLTransformer urlTransformer = (XURLTransformer) UnoRuntime.queryInterface(XURLTransformer.class,
+ getORB().createInstance("com.sun.star.util.URLTransformer"));
+ urlTransformer.parseStrict(url);
return url[0];
}
// --------------------------------------------------------------------------------------------------------
- private void impl_raise( XModel _document )
+ private void impl_raise(XModel _document)
{
- XFrame frame = _document.getCurrentController().getFrame();
- XTopWindow topWindow = (XTopWindow) UnoRuntime.queryInterface( XTopWindow.class,
- frame.getContainerWindow() );
+ final XFrame frame = _document.getCurrentController().getFrame();
+ final XTopWindow topWindow = (XTopWindow) UnoRuntime.queryInterface(XTopWindow.class,
+ frame.getContainerWindow());
topWindow.toFront();
}
// --------------------------------------------------------------------------------------------------------
- private void impl_startObservingEvents( String _context )
+ private void impl_startObservingEvents(String _context)
{
- log.println( " " + _context );
- synchronized ( m_documentEvents )
+ log.println(" " + _context);
+ synchronized (m_documentEvents)
{
m_documentEvents.clear();
}
- synchronized ( m_globalEvents )
+ synchronized (m_globalEvents)
{
m_globalEvents.clear();
}
}
// --------------------------------------------------------------------------------------------------------
- private void impl_stopObservingEvents( Vector _actualEvents, String[] _expectedEvents, String _context )
+ private void impl_stopObservingEvents(ArrayList _actualEvents, String[] _expectedEvents, String _context)
{
- synchronized ( _actualEvents )
+ synchronized (_actualEvents)
{
int actualEventCount = _actualEvents.size();
- while ( actualEventCount < _expectedEvents.length )
+ while (actualEventCount < _expectedEvents.length)
{
// well, it's possible not all events already arrived, yet - finally, some of them
// are notified asynchronously
// So, wait a few seconds.
try
{
- _actualEvents.wait( 5000 );
+ _actualEvents.wait(5000);
+ }
+ catch (InterruptedException ex)
+ {
}
- catch ( InterruptedException ex ) { }
- if ( actualEventCount == _actualEvents.size() )
- // the above wait was left because of the timeout, *not* because an event
- // arrived. Okay, we won't wait any longer, this is a failure.
+ if (actualEventCount == _actualEvents.size())
+ // the above wait was left because of the timeout, *not* because an event
+ // arrived. Okay, we won't wait any longer, this is a failure.
+ {
break;
+ }
actualEventCount = _actualEvents.size();
}
- assureEquals( "wrong event count for '" + _context + "'",
- _expectedEvents.length, _actualEvents.size() );
+ assureEquals("wrong event count for '" + _context + "'",
+ _expectedEvents.length, _actualEvents.size());
- for ( int i=0; i<_expectedEvents.length; ++i )
+ for (int i = 0; i < _expectedEvents.length; ++i)
{
- assureEquals( "wrong event at positon " + ( i + 1 ) + " for '" + _context + "'",
- _expectedEvents[i], _actualEvents.get(i) );
+ assureEquals("wrong event at positon " + (i + 1) + " for '" + _context + "'",
+ _expectedEvents[i], _actualEvents.get(i));
}
}
}
// --------------------------------------------------------------------------------------------------------
- int impl_waitForEvent( Vector _eventQueue, String _expectedEvent, int _maxMilliseconds )
+ int impl_waitForEvent(ArrayList _eventQueue, String _expectedEvent, int _maxMilliseconds)
{
- return impl_waitForEvent( _eventQueue, _expectedEvent, _maxMilliseconds, 0 );
+ return impl_waitForEvent(_eventQueue, _expectedEvent, _maxMilliseconds, 0);
}
// --------------------------------------------------------------------------------------------------------
- int impl_waitForEvent( Vector _eventQueue, String _expectedEvent, int _maxMilliseconds, int _firstQueueElementToCheck )
+ int impl_waitForEvent(ArrayList _eventQueue, String _expectedEvent, int _maxMilliseconds, int _firstQueueElementToCheck)
{
- synchronized ( _eventQueue )
+ synchronized (_eventQueue)
{
int waitedMilliseconds = 0;
- while ( waitedMilliseconds < _maxMilliseconds )
+ while (waitedMilliseconds < _maxMilliseconds)
{
- for ( int i=_firstQueueElementToCheck; i<_eventQueue.size(); ++i )
+ for (int i = _firstQueueElementToCheck; i < _eventQueue.size(); ++i)
{
- if ( _expectedEvent.equals( _eventQueue.get(i) ) )
- // found the event in the queue
+ if (_expectedEvent.equals(_eventQueue.get(i)))
+ // found the event in the queue
+ {
return i;
+ }
}
// wait a little, perhaps the event will still arrive
try
{
- _eventQueue.wait( 500 );
+ _eventQueue.wait(500);
waitedMilliseconds += 500;
}
- catch ( InterruptedException e ) { }
+ catch (InterruptedException e)
+ {
+ }
}
}
- failed( "expected event '" + _expectedEvent + "' did not arrive after " + _maxMilliseconds + " milliseconds" );
+ failed("expected event '" + _expectedEvent + "' did not arrive after " + _maxMilliseconds + " milliseconds");
return -1;
}
// --------------------------------------------------------------------------------------------------------
- void onDocumentEvent( DocumentEvent _Event )
+ void onDocumentEvent(DocumentEvent _Event)
{
- if ( _Event.EventName.equals( "OnTitleChanged" ) )
- // OnTitleChanged events are notified too often. This is known, and accepted.
- // (the deeper reason is that it's diffult to determine, in the DatabaseDocument implementatin,
- // when the title actually changed. In particular, when we do a saveAsURL, and then ask for a
- // title *before* the TitleHelper got the document's OnSaveAsDone event, then the wrong (old)
- // title is obtained.
+ if ("OnTitleChanged".equals(_Event.EventName))
+ // OnTitleChanged events are notified too often. This is known, and accepted.
+ // (the deeper reason is that it's diffult to determine, in the DatabaseDocument implementatin,
+ // when the title actually changed. In particular, when we do a saveAsURL, and then ask for a
+ // title *before* the TitleHelper got the document's OnSaveAsDone event, then the wrong (old)
+ // title is obtained.
+ {
return;
+ }
- if ( ( _Event.EventName.equals( "OnLoad" ) )
- && ( m_loadDocState != STATE_NOT_STARTED )
- )
+ if ((_Event.EventName.equals(ONLOAD)) && (m_loadDocState != STATE_NOT_STARTED))
{
- assureEquals( "OnLoad event must come *after* invocation of the interaction handler / user!",
- m_loadDocState, STATE_MACRO_EXEC_APPROVED );
+ assureEquals("OnLoad event must come *after* invocation of the interaction handler / user!",
+ m_loadDocState, STATE_MACRO_EXEC_APPROVED);
m_loadDocState = STATE_ON_LOAD_RECEIVED;
}
- synchronized ( m_documentEvents )
+ synchronized (m_documentEvents)
{
- m_documentEvents.add( _Event.EventName );
+ m_documentEvents.add(_Event.EventName);
m_documentEvents.notifyAll();
}
- log.println( " document event: " + _Event.EventName );
+ log.println(" document event: " + _Event.EventName);
}
// --------------------------------------------------------------------------------------------------------
- public void documentEventOccured( DocumentEvent _Event )
+ public void documentEventOccured(DocumentEvent _Event)
{
- if ( _Event.EventName.equals( "OnTitleChanged" ) )
- // ignore. See onDocumentEvent for a justification
+ if ("OnTitleChanged".equals(_Event.EventName))
+ // ignore. See onDocumentEvent for a justification
+ {
return;
+ }
- synchronized ( m_globalEvents )
+ synchronized (m_globalEvents)
{
- m_globalEvents.add( _Event.EventName );
+ m_globalEvents.add(_Event.EventName);
m_globalEvents.notifyAll();
}
- log.println( " global event: " + _Event.EventName );
+ log.println(" global event: " + _Event.EventName);
}
// --------------------------------------------------------------------------------------------------------
- public void disposing( EventObject _Event )
+ public void disposing(EventObject _Event)
{
// not interested in
}
diff --git a/dbaccess/qa/complex/dbaccess/FileHelper.java b/dbaccess/qa/complex/dbaccess/FileHelper.java
index fbe5f330b24d..12e041cdc7be 100644
--- a/dbaccess/qa/complex/dbaccess/FileHelper.java
+++ b/dbaccess/qa/complex/dbaccess/FileHelper.java
@@ -32,6 +32,7 @@ package complex.dbaccess;
public class FileHelper
{
+ private FileHelper(){}
static public String getOOoCompatibleFileURL( String _javaFileURL )
{
String returnURL = _javaFileURL;
diff --git a/dbaccess/qa/complex/dbaccess/Parser.java b/dbaccess/qa/complex/dbaccess/Parser.java
index a4305c031e1b..9067963cf184 100644
--- a/dbaccess/qa/complex/dbaccess/Parser.java
+++ b/dbaccess/qa/complex/dbaccess/Parser.java
@@ -31,7 +31,6 @@ 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;
@@ -46,7 +45,8 @@ public class Parser extends CRMBasedTestCase
{
return new String[] {
"checkJoinSyntax",
- "checkParameterTypes"
+ "checkParameterTypes",
+ "checkWhere",
};
}
@@ -71,12 +71,48 @@ public class Parser extends CRMBasedTestCase
}
}
+ public void checkWhere() throws Exception
+ {
+ final XSingleSelectQueryComposer composer = createQueryComposer();
+ final String SELECT = "SELECT \"products\".\"Name\" FROM \"products\" WHERE ";
+ final String[] queries = new String[]
+ {
+ "\"ID\" in ( 1,2,3,4)"
+ ,"not ( \"ID\" in ( 1,2,3,4))"
+ ,"(1 = 1) is true"
+ ,"(1 = 1) is not false"
+ ,"(1 = 1) is not null"
+ ,"not ( (1 = 1) is not null)"
+ ,"'a' like 'a%'"
+ ,"not ( 'a' like 'a%')"
+ ,"'a' not like 'a%'"
+ ,"1 between 0 and 2"
+ ,"not ( 1 between 0 and 2 )"
+ ,"1 not between 3 and 4"
+ ,"1 not between ( select \"ID\" from \"categories\") and ( select \"ID\" from \"categories\")"
+ ,"1 = 1"
+ ,"0 < 1"
+ ,"not(0 < 1)"
+ ,"1 > 0"
+ ,"not(1 > 0)"
+ ,"1 <> 0"
+ ,"(1 <> 0 and 'a' = 'a' and 'c' = 'd') or (1 = 1 and 2 = 2 and 3 = 4)"
+ ,"not ( 1 <> 0 )"
+ ,"\"CategoryID\" in ( select \"ID\" from \"categories\")"
+ ,"not (\"CategoryID\" in ( select \"ID\" from \"categories\"))"
+ ,"\"CategoryID\" not in ( select \"ID\" from \"categories\")"
+ };
+ for (int i = 0; i < queries.length; i++)
+ {
+ composer.setQuery( SELECT + queries[i]);
+ }
+ }
// --------------------------------------------------------------------------------------------------------
/** verifies that aliases for inner queries work as expected
*/
public void checkJoinSyntax() throws Exception
{
- XSingleSelectQueryComposer composer = createQueryComposer();
+ final XSingleSelectQueryComposer composer = createQueryComposer();
// feed the composer with some statements. If any of those cannot be parsed, the composer
// will throw an exception - which is a regression then
@@ -85,6 +121,21 @@ public class Parser extends CRMBasedTestCase
"\"products\".\"Name\" " +
"FROM \"products\" RIGHT OUTER JOIN \"categories\" AS \"categories\" ON \"products\".\"CategoryID\" = \"categories\".\"ID\"" );
+ composer.setQuery(
+ "SELECT \"categories\".\"Name\", " +
+ "\"products\".\"Name\" " +
+ "FROM \"products\" LEFT OUTER JOIN \"categories\" AS \"categories\" ON \"products\".\"CategoryID\" = \"categories\".\"ID\"" );
+
+ composer.setQuery(
+ "SELECT \"categories\".\"Name\", " +
+ "\"products\".\"Name\" " +
+ "FROM \"products\" CROSS JOIN \"categories\" AS \"categories\"" );
+
+ composer.setQuery(
+ "SELECT \"categories\".\"Name\", " +
+ "\"products\".\"Name\" " +
+ "FROM \"products\" INNER JOIN \"categories\" AS \"categories\" ON \"products\".\"CategoryID\" = \"categories\".\"ID\"" );
+
// just to be sure the composer *really* parses upon setting the query: feed it with
// an unparseable statement
boolean caughtExpected = false;
@@ -101,27 +152,27 @@ public class Parser extends CRMBasedTestCase
}
// --------------------------------------------------------------------------------------------------------
- private void impl_checkParameters( final String _statement, final String[] _expectedParameterNames, final int[] _expectedParameterTypes, String _context ) throws Exception
+ private void impl_checkParameters( final String _statement, final String[] _expectedParameterNames, final int[] _expectedParameterTypes,final String _context ) throws Exception
{
- XSingleSelectQueryComposer composer = createQueryComposer();
+ final XSingleSelectQueryComposer composer = createQueryComposer();
composer.setQuery( _statement );
assureEquals( "checkParameterTypes: internal error", _expectedParameterNames.length, _expectedParameterTypes.length );
- XParametersSupplier paramSupp = (XParametersSupplier)UnoRuntime.queryInterface(
+ final XParametersSupplier paramSupp = (XParametersSupplier)UnoRuntime.queryInterface(
XParametersSupplier.class, composer );
- XIndexAccess parameters = paramSupp.getParameters();
+ final 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,
+ final XPropertySet parameter = (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class,
parameters.getByIndex(i) );
- String name = (String)parameter.getPropertyValue( "Name" );
+ final 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();
+ final int type = ((Integer)parameter.getPropertyValue( "Type" )).intValue();
assureEquals( "(ctx: " + _context + ") unexpected data type for parameter number " + ( i + 1 ), _expectedParameterTypes[i], type );
}
}
diff --git a/dbaccess/qa/complex/dbaccess/PropertyBag.java b/dbaccess/qa/complex/dbaccess/PropertyBag.java
index 5f1747fd94bc..b308465a129f 100644
--- a/dbaccess/qa/complex/dbaccess/PropertyBag.java
+++ b/dbaccess/qa/complex/dbaccess/PropertyBag.java
@@ -39,10 +39,11 @@ import com.sun.star.beans.*;
public class PropertyBag extends ComplexTestCase
{
+ private static final String VALUE = "Value";
private XPropertyContainer m_bag;
private XPropertySet m_set;
private XPropertyAccess m_access;
- private XMultiServiceFactory m_orb;
+ private XMultiServiceFactory m_orb = null;
public String[] getTestMethodNames()
{
@@ -73,7 +74,7 @@ public class PropertyBag extends ComplexTestCase
boolean caughtExpected = false;
try
{
- m_bag.addProperty( "", PropertyAttribute.BOUND, new Integer( 3 ) );
+ m_bag.addProperty( "", PropertyAttribute.BOUND, Integer.valueOf( 3 ) );
}
catch(com.sun.star.lang.IllegalArgumentException e) { caughtExpected = true; }
catch(com.sun.star.uno.Exception e) { }
@@ -84,8 +85,8 @@ public class PropertyBag extends ComplexTestCase
caughtExpected = false;
try
{
- m_bag.addProperty( "Value", PropertyAttribute.BOUND, new String( "" ) );
- m_bag.addProperty( "Value", PropertyAttribute.BOUND, new String( "" ) );
+ m_bag.addProperty( VALUE, PropertyAttribute.BOUND, "" );
+ m_bag.addProperty( VALUE, PropertyAttribute.BOUND, "" );
}
catch(com.sun.star.beans.PropertyExistException e) { caughtExpected = true; }
catch(com.sun.star.uno.Exception e) { }
@@ -97,7 +98,7 @@ public class PropertyBag extends ComplexTestCase
caughtExpected = false;
try
{
- m_bag.removeProperty( "Value" );
+ m_bag.removeProperty( VALUE);
}
catch(com.sun.star.beans.NotRemoveableException e) { caughtExpected = true; }
catch(com.sun.star.uno.Exception e) { }
@@ -119,8 +120,8 @@ public class PropertyBag extends ComplexTestCase
try
{
final String testValue = "someArbitraryValue";
- m_set.setPropertyValue( "Value", testValue );
- String currentValue = (String)m_set.getPropertyValue( "Value" );
+ m_set.setPropertyValue( VALUE , testValue);
+ final String currentValue = (String)m_set.getPropertyValue( VALUE);
if ( !currentValue.equals( testValue ) )
failed( "set property is not remembered" );
}
@@ -133,7 +134,7 @@ public class PropertyBag extends ComplexTestCase
caughtExpected = false;
try
{
- m_set.setPropertyValue( "Value", new Integer( 3 ) );
+ m_set.setPropertyValue( VALUE, Integer.valueOf( 3 ) );
}
catch(com.sun.star.lang.IllegalArgumentException e) { caughtExpected = true; }
catch(com.sun.star.uno.Exception e) { }
@@ -150,16 +151,16 @@ public class PropertyBag extends ComplexTestCase
// XPropertyAccess.setPropertyValues
final PropertyValue expectedValues[] =
{
- new PropertyValue( "BoolValue", -1, new Boolean( false ), PropertyState.DIRECT_VALUE ),
+ new PropertyValue( "BoolValue", -1, Boolean.FALSE, PropertyState.DIRECT_VALUE ),
new PropertyValue( "StringValue", -1, "some text", PropertyState.DIRECT_VALUE ),
- new PropertyValue( "IntegerValue", -1, new Integer( 3 ), PropertyState.DIRECT_VALUE ),
+ new PropertyValue( "IntegerValue", -1, Integer.valueOf( 3 ), PropertyState.DIRECT_VALUE ),
new PropertyValue( "InterfaceValue", -1, m_bag, PropertyState.DIRECT_VALUE )
};
m_access.setPropertyValues( expectedValues );
for ( int i=0; i<expectedValues.length; ++i )
{
- Object value = m_set.getPropertyValue( expectedValues[i].Name );
+ final Object value = m_set.getPropertyValue( expectedValues[i].Name );
if ( !value.equals( expectedValues[i].Value ) )
{
log.println( "property name : " + expectedValues[i].Name );
@@ -171,11 +172,11 @@ public class PropertyBag extends ComplexTestCase
// ---------------------------------
// XPropertyAccess.getPropertyValues
- PropertyValue currentValues[] = m_access.getPropertyValues();
+ final PropertyValue currentValues[] = m_access.getPropertyValues();
for ( int i=0; i<currentValues.length; ++i )
{
- String name = currentValues[i].Name;
- Object value = currentValues[i].Value;
+ final String name = currentValues[i].Name;
+ final Object value = currentValues[i].Value;
for ( int j=0; j<expectedValues.length; ++j )
{
if ( expectedValues[j].Name.equals( name ) )
@@ -201,9 +202,9 @@ public class PropertyBag extends ComplexTestCase
log.println( "checking proper dynamic of the set" );
createStandardBag( false );
- PropertyValue props[] =
+ final PropertyValue props[] =
{
- new PropertyValue( "BoolValue", -1, new Boolean( false ), PropertyState.DIRECT_VALUE),
+ new PropertyValue( "BoolValue", -1, Boolean.FALSE, PropertyState.DIRECT_VALUE),
new PropertyValue( "StringValue", -1, "test", PropertyState.DIRECT_VALUE ),
new PropertyValue( "SomeOtherStringValue", -1, "string value", PropertyState.DIRECT_VALUE )
};
@@ -228,7 +229,7 @@ public class PropertyBag extends ComplexTestCase
failed( "property bag failed to implicitly add unknown properties" );
// see whether this property was really added, and not just ignored
- PropertyValue newlyAdded = props[ props.length - 1 ];
+ final PropertyValue newlyAdded = props[ props.length - 1 ];
try
{
if ( !m_set.getPropertyValue( newlyAdded.Name ).equals( newlyAdded.Value ) )
@@ -262,7 +263,7 @@ public class PropertyBag extends ComplexTestCase
{
m_bag = null;
- Object initArgs[] = { new NamedValue( "AutomaticAddition", new Boolean( allowLazyAdding ) ) };
+ final Object initArgs[] = { new NamedValue( "AutomaticAddition", Boolean.valueOf( allowLazyAdding ) ) };
final String serviceName = "com.sun.star.beans.PropertyBag";
m_bag = (XPropertyContainer)UnoRuntime.queryInterface( XPropertyContainer.class,
@@ -273,11 +274,11 @@ public class PropertyBag extends ComplexTestCase
m_set = (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class, m_bag );
m_access = (XPropertyAccess)UnoRuntime.queryInterface( XPropertyAccess.class, m_bag );
- Object properties[][] =
+ final Object properties[][] =
{
- { "BoolValue", new Boolean( true ) },
- { "StringValue", new String( "" ) },
- { "IntegerValue", new Integer( 3 ) },
+ { "BoolValue", Boolean.TRUE },
+ { "StringValue", "" },
+ { "IntegerValue", Integer.valueOf( 3 ) },
{ "InterfaceValue", (XInterface)m_bag }
};
for ( int i=0; i<properties.length; ++i )
diff --git a/dbaccess/qa/complex/dbaccess/Query.java b/dbaccess/qa/complex/dbaccess/Query.java
index d64e1a7c972e..684df2b65a25 100644
--- a/dbaccess/qa/complex/dbaccess/Query.java
+++ b/dbaccess/qa/complex/dbaccess/Query.java
@@ -41,7 +41,6 @@ import com.sun.star.uno.UnoRuntime;
public class Query extends complexlib.ComplexTestCase {
connectivity.tools.HsqlDatabase m_database;
- connectivity.tools.DataSource m_dataSource;
// --------------------------------------------------------------------------------------------------------
public String[] getTestMethodNames() {
@@ -63,14 +62,13 @@ public class Query extends complexlib.ComplexTestCase {
{
if ( m_database == null )
{
- CRMDatabase database = new CRMDatabase( getFactory() );
+ final CRMDatabase database = new CRMDatabase( getFactory() );
m_database = database.getDatabase();
- m_dataSource = m_database.getDataSource();
}
}
catch( Exception e )
{
- System.err.println( "could not create the test case, error message:\n" + e.getMessage() );
+ log.println( "could not create the test case, error message:\n" + e.getMessage() );
e.printStackTrace( System.err );
assure( "failed to created the test case", false );
}
@@ -89,25 +87,25 @@ public class Query extends complexlib.ComplexTestCase {
try
{
- XQueriesSupplier suppQueries = (XQueriesSupplier)UnoRuntime.queryInterface(
+ final XQueriesSupplier suppQueries = (XQueriesSupplier)UnoRuntime.queryInterface(
XQueriesSupplier.class, m_database.defaultConnection());
- XNameAccess queries = suppQueries.getQueries();
+ final XNameAccess queries = suppQueries.getQueries();
- String[] queryNames = new String[] { "parseable", "parseable native", "unparseable" };
- String[][] expectedColumnNames = new String[][] {
- new String[] { "ID", "Name", "Address", "City", "Postal" },
+ final String[] queryNames = new String[] { "parseable", "parseable native", "unparseable" };
+ final String[][] expectedColumnNames = new String[][] {
+ new String[] { "ID", "Name", "Address", "City", "Postal","Comment" },
new String[] { "TABLE_CATALOG", "TABLE_SCHEMA", "TABLE_NAME", "VIEW_DEFINITION", "CHECK_OPTION", "IS_UPDATABLE", "VALID" },
new String[] { "ID_VARCHAR" }
};
for ( int i = 0; i < queryNames.length; ++i )
{
- XPropertySet query = (XPropertySet)UnoRuntime.queryInterface(
+ final XPropertySet query = (XPropertySet)UnoRuntime.queryInterface(
XPropertySet.class, queries.getByName( queryNames[i] ) );
- XColumnsSupplier suppCols = (XColumnsSupplier)UnoRuntime.queryInterface(
+ final XColumnsSupplier suppCols = (XColumnsSupplier)UnoRuntime.queryInterface(
XColumnsSupplier.class, query);
- XIndexAccess columns = (XIndexAccess)UnoRuntime.queryInterface(
+ final XIndexAccess columns = (XIndexAccess)UnoRuntime.queryInterface(
XIndexAccess.class, suppCols.getColumns());
// check whether the columns supplied by the query match what we expected
@@ -115,7 +113,7 @@ public class Query extends complexlib.ComplexTestCase {
columns.getCount() == expectedColumnNames[i].length );
for ( int col = 0; col < columns.getCount(); ++col )
{
- XNamed columnName = (XNamed)UnoRuntime.queryInterface(
+ final XNamed columnName = (XNamed)UnoRuntime.queryInterface(
XNamed.class, columns.getByIndex(col) );
assure( "column no. " + col + " of query \"" + queryNames[i] + "\" not matching",
columnName.getName().equals( expectedColumnNames[i][col] ) );
diff --git a/dbaccess/qa/complex/dbaccess/QueryInQuery.java b/dbaccess/qa/complex/dbaccess/QueryInQuery.java
index b06d57d05c59..15e82d7d1bfb 100644
--- a/dbaccess/qa/complex/dbaccess/QueryInQuery.java
+++ b/dbaccess/qa/complex/dbaccess/QueryInQuery.java
@@ -32,7 +32,6 @@ package complex.dbaccess;
import com.sun.star.container.ElementExistException;
import com.sun.star.lang.IllegalArgumentException;
import com.sun.star.lang.WrappedTargetException;
-import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.sdb.CommandType;
import com.sun.star.sdbc.SQLException;
import connectivity.tools.HsqlColumnDescriptor;
@@ -43,6 +42,7 @@ import com.sun.star.sdbc.XResultSet;
public class QueryInQuery extends CRMBasedTestCase
{
+ private static final String QUERY_PRODUCTS = "query products";
// --------------------------------------------------------------------------------------------------------
public String[] getTestMethodNames()
{
@@ -67,7 +67,7 @@ public class QueryInQuery extends CRMBasedTestCase
try
{
super.createTestCase();
- m_database.getDatabase().getDataSource().createQuery( "query products", "SELECT * FROM \"products\"" );
+ m_database.getDatabase().getDataSource().createQuery( QUERY_PRODUCTS,"SELECT * FROM \"products\"");
}
catch ( Exception e )
{
@@ -79,10 +79,10 @@ public class QueryInQuery extends CRMBasedTestCase
// --------------------------------------------------------------------------------------------------------
private void verifyEqualRowSetContent( int _outerCommandType, String _outerCommand, int _innerCommandType, String _innerCommand ) throws SQLException
{
- RowSet outerRowSet = m_database.getDatabase().createRowSet( _outerCommandType, _outerCommand );
+ final RowSet outerRowSet = m_database.getDatabase().createRowSet( _outerCommandType, _outerCommand );
outerRowSet.execute();
- RowSet innerRowSet = m_database.getDatabase().createRowSet( _innerCommandType, _innerCommand );
+ final RowSet innerRowSet = m_database.getDatabase().createRowSet( _innerCommandType, _innerCommand );
innerRowSet.execute();
outerRowSet.last();
@@ -110,7 +110,7 @@ public class QueryInQuery extends CRMBasedTestCase
{
verifyEqualRowSetContent(
CommandType.COMMAND, "SELECT * FROM \"query products\"",
- CommandType.QUERY, "query products" );
+ CommandType.QUERY,QUERY_PRODUCTS);
}
// --------------------------------------------------------------------------------------------------------
@@ -123,7 +123,7 @@ public class QueryInQuery extends CRMBasedTestCase
CommandType.COMMAND, "SELECT \"ID\" FROM \"products\"" );
verifyEqualRowSetContent(
CommandType.COMMAND, "SELECT \"PROD\".* FROM \"query products\" AS \"PROD\"",
- CommandType.QUERY, "query products" );
+ CommandType.QUERY,QUERY_PRODUCTS);
}
// --------------------------------------------------------------------------------------------------------
@@ -144,7 +144,7 @@ public class QueryInQuery extends CRMBasedTestCase
caughtExpected );
// create a table with a name which is used by a query
- HsqlTableDescriptor table = new HsqlTableDescriptor( "query products",
+ final HsqlTableDescriptor table = new HsqlTableDescriptor( QUERY_PRODUCTS,
new HsqlColumnDescriptor[] {
new HsqlColumnDescriptor( "ID", "INTEGER" ),
new HsqlColumnDescriptor( "Name", "VARCHAR(50)" ) } );
@@ -169,7 +169,7 @@ public class QueryInQuery extends CRMBasedTestCase
m_database.getDatabase().getDataSource().createQuery( "orders level 3", "SELECT * FROM \"orders level 2\"" );
m_database.getDatabase().getDataSource().createQuery( "orders level 0", "SELECT * FROM \"orders level 3\"" );
- RowSet rowSet = m_database.getDatabase().createRowSet( CommandType.QUERY, "orders level 0" );
+ final RowSet rowSet = m_database.getDatabase().createRowSet( CommandType.QUERY, "orders level 0" );
boolean caughtExpected = false;
try { rowSet.execute(); }
@@ -183,8 +183,9 @@ public class QueryInQuery extends CRMBasedTestCase
{
try
{
- XStatement statement = m_database.getConnection().createStatement();
- XResultSet resultSet = statement.executeQuery( "SELECT * FROM \"query products\"" );
+ final XStatement statement = m_database.getConnection().createStatement();
+ final XResultSet resultSet = statement.executeQuery( "SELECT * FROM \"query products\"" );
+ assure( "Result Set is null", resultSet != null );
}
catch( SQLException e )
{
diff --git a/dbaccess/qa/complex/dbaccess/RowSet.java b/dbaccess/qa/complex/dbaccess/RowSet.java
index 8e0161187c3e..d9145d7aaee8 100644
--- a/dbaccess/qa/complex/dbaccess/RowSet.java
+++ b/dbaccess/qa/complex/dbaccess/RowSet.java
@@ -29,102 +29,128 @@
************************************************************************/
package complex.dbaccess;
+import com.sun.star.beans.PropertyVetoException;
+import com.sun.star.beans.UnknownPropertyException;
+import com.sun.star.beans.XPropertySet;
import com.sun.star.container.XIndexAccess;
-import com.sun.star.uno.UnoRuntime;
-import com.sun.star.beans.*;
-import com.sun.star.lang.*;
-import com.sun.star.sdbcx.*;
-import com.sun.star.sdbc.*;
-import com.sun.star.sdb.*;
+import com.sun.star.lang.WrappedTargetException;
+import com.sun.star.lang.XComponent;
import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sdb.CommandType;
+import com.sun.star.sdb.XParametersSupplier;
+import com.sun.star.sdb.XResultSetAccess;
+import com.sun.star.sdb.XRowSetApproveBroadcaster;
+import com.sun.star.sdbc.SQLException;
+import com.sun.star.sdbc.XConnection;
+import com.sun.star.sdbc.XParameters;
+import com.sun.star.sdbc.XPreparedStatement;
+import com.sun.star.sdbc.XResultSet;
+import com.sun.star.sdbc.XResultSetUpdate;
+import com.sun.star.sdbc.XRow;
+import com.sun.star.sdbc.XRowSet;
+import com.sun.star.sdbc.XRowUpdate;
+import com.sun.star.sdbcx.XColumnsSupplier;
+import com.sun.star.sdbcx.XDeleteRows;
+import com.sun.star.sdbcx.XRowLocate;
+import com.sun.star.sdbcx.XTablesSupplier;
+import com.sun.star.uno.UnoRuntime;
import com.sun.star.util.XRefreshable;
-import connectivity.tools.HsqlDatabase;
-
import complexlib.ComplexTestCase;
-import complexlib.Assurance.AssureException;
-
+import connectivity.tools.DataSource;
+import connectivity.tools.HsqlDatabase;
+import java.lang.reflect.Method;
+import java.util.Random;
-public class RowSet extends ComplexTestCase {
+public class RowSet extends ComplexTestCase
+{
static final int MAX_TABLE_ROWS = 100;
static final int MAX_FETCH_ROWS = 10;
-
- HsqlDatabase m_database;
- connectivity.tools.DataSource
- m_dataSource;
- XRowSet m_rowSet;
- XResultSet m_resultSet;
- XResultSetUpdate m_resultSetUpdate;
- XRow m_row;
- XRowLocate m_rowLocate;
- XPropertySet m_rowSetProperties;
+ private static final String NEXT = "next";
+ private static final String TEST21 = "Test21";
+ HsqlDatabase m_database;
+ DataSource m_dataSource;
+ XRowSet m_rowSet;
+ XResultSet m_resultSet;
+ XResultSetUpdate m_resultSetUpdate;
+ XRow m_row;
+ XRowLocate m_rowLocate;
+ XPropertySet m_rowSetProperties;
XParametersSupplier m_paramsSupplier;
// --------------------------------------------------------------------------------------------------------
class ResultSetMovementStress implements Runnable
{
- XResultSet m_resultSet;
- XRow m_row;
- int m_id;
- public ResultSetMovementStress(XResultSet _resultSet,int _id) throws java.lang.Exception {
+
+ XResultSet m_resultSet;
+ XRow m_row;
+ int m_id;
+
+ public ResultSetMovementStress(XResultSet _resultSet, int _id) throws java.lang.Exception
+ {
m_resultSet = _resultSet;
- m_row = (XRow)UnoRuntime.queryInterface(XRow.class,m_resultSet);
+ m_row = (XRow) UnoRuntime.queryInterface(XRow.class, m_resultSet);
m_id = _id;
}
+
public void run()
{
try
{
m_resultSet.beforeFirst();
- for ( int i = 0; m_resultSet.next(); ++i )
+ for (int i = 0; m_resultSet.next(); ++i)
{
int pos = m_resultSet.getRow();
- int val = m_row.getInt(1);
+ // final int val = m_row.getInt(1);
// log.println("Clone Move(" + m_id +") before i: " + (i+1) + " Pos: " + pos + " Val: " + val);
- testPosition( m_resultSet, m_row, i + 1, "clone move(" + m_id +")" );
+ testPosition(m_resultSet, m_row, i + 1, "clone move(" + m_id + ")");
// val = m_row.getInt(1);
// log.println("Clone Move(" + m_id +") after i: " + (i+1) + " Pos: " + pos + " Val: " + val);
int pos2 = m_resultSet.getRow();
- assure("ResultSetMovementStress wrong position: " + i + " Pos1: " + pos + " Pos2: " + pos2,pos == pos2);
+ assure("ResultSetMovementStress wrong position: " + i + " Pos1: " + pos + " Pos2: " + pos2, pos == pos2);
}
- }catch(AssureException e){
- }catch(Exception e){
- assure("ResultSetMovementStress(" + m_id + ") failed: " + e,false);
+ }
+ catch (Exception e)
+ {
+ assure("ResultSetMovementStress(" + m_id + ") failed: " + e, false);
}
}
}
// --------------------------------------------------------------------------------------------------------
- public String[] getTestMethodNames() {
+
+ public String[] getTestMethodNames()
+ {
return new String[]
- {
- "testRowSet",
- "testRowSetEvents",
- "testDeleteBehavior",
- "testCloneMovesPlusDeletions",
- "testCloneMovesPlusInsertions",
- "testParameters"
- };
+ {
+ "testRowSet",
+ "testRowSetEvents",
+ "testDeleteBehavior",
+ "testCloneMovesPlusDeletions",
+ "testCloneMovesPlusInsertions",
+ "testParameters"
+ };
}
// --------------------------------------------------------------------------------------------------------
- public String getTestObjectName() {
+ public String getTestObjectName()
+ {
return "RowSet";
}
// --------------------------------------------------------------------------------------------------------
- private void createTestCase( boolean _defaultRowSet )
+ private void createTestCase(boolean _defaultRowSet)
{
- if ( m_database == null )
+ if (m_database == null)
{
try
{
- CRMDatabase database = new CRMDatabase( getFactory() );
+ final CRMDatabase database = new CRMDatabase(getFactory());
m_database = database.getDatabase();
m_dataSource = m_database.getDataSource();
}
- catch(Exception e)
+ catch (Exception e)
{
- assure( "could not create the embedded HSQL database: " + e.getMessage(), false );
+ assure("could not create the embedded HSQL database: " + e.getMessage(), false);
}
}
@@ -132,20 +158,21 @@ public class RowSet extends ComplexTestCase {
{
createStruture();
}
- catch( SQLException e )
+ catch (SQLException e)
{
- assure( "could not connect to the database/table structure, error message:\n" + e.getMessage(), false );
+ assure("could not connect to the database/table structure, error message:\n" + e.getMessage(), false);
}
- if ( _defaultRowSet )
- createRowSet( "TEST1", CommandType.TABLE, true, true );
+ if (_defaultRowSet)
+ {
+ createRowSet("TEST1", CommandType.TABLE, true, true);
+ }
}
-
// --------------------------------------------------------------------------------------------------------
private XMultiServiceFactory getFactory()
{
- return (XMultiServiceFactory)param.getMSF();
+ return (XMultiServiceFactory) param.getMSF();
}
// --------------------------------------------------------------------------------------------------------
@@ -157,9 +184,9 @@ public class RowSet extends ComplexTestCase {
* @param execute
* determines whether the RowSet should be executed
*/
- private void createRowSet( String command, int commandType, boolean execute )
+ private void createRowSet(String command, int commandType, boolean execute)
{
- createRowSet( command, commandType, execute, false );
+ createRowSet(command, commandType, execute, false);
}
// --------------------------------------------------------------------------------------------------------
@@ -173,50 +200,55 @@ public class RowSet extends ComplexTestCase {
* @param execute
* determines whether the RowSet should be executed
*/
- private void createRowSet( String command, int commandType, boolean execute, boolean limitFetchSize )
+ private void createRowSet(String command, int commandType, boolean execute, boolean limitFetchSize)
{
try
{
- m_rowSet = (XRowSet)UnoRuntime.queryInterface(XRowSet.class,
- getFactory().createInstance("com.sun.star.sdb.RowSet"));
- XPropertySet rowSetProperties = (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class, m_rowSet );
- rowSetProperties.setPropertyValue( "Command", command );
- rowSetProperties.setPropertyValue( "CommandType", new Integer( commandType ) );
- rowSetProperties.setPropertyValue( "ActiveConnection",m_database.defaultConnection() );
- if ( limitFetchSize )
- rowSetProperties.setPropertyValue( "FetchSize", new Integer( MAX_FETCH_ROWS ) );
-
- m_resultSet = (XResultSet)UnoRuntime.queryInterface( XResultSet.class, m_rowSet );
- m_resultSetUpdate = (XResultSetUpdate)UnoRuntime.queryInterface( XResultSetUpdate.class, m_rowSet );
- m_row = (XRow)UnoRuntime.queryInterface( XRow.class, m_rowSet );
- m_rowLocate = (XRowLocate)UnoRuntime.queryInterface( XRowLocate.class, m_resultSet );
- m_rowSetProperties = (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class, m_rowSet );
- m_paramsSupplier = (XParametersSupplier)UnoRuntime.queryInterface( XParametersSupplier.class, m_rowSet );
-
- if ( execute )
+ m_rowSet = (XRowSet) UnoRuntime.queryInterface(XRowSet.class,
+ getFactory().createInstance("com.sun.star.sdb.RowSet"));
+ final XPropertySet rowSetProperties = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, m_rowSet);
+ rowSetProperties.setPropertyValue("Command", command);
+ rowSetProperties.setPropertyValue("CommandType", Integer.valueOf(commandType));
+ rowSetProperties.setPropertyValue("ActiveConnection", m_database.defaultConnection());
+ if (limitFetchSize)
+ {
+ rowSetProperties.setPropertyValue("FetchSize", Integer.valueOf(MAX_FETCH_ROWS));
+ }
+
+ m_resultSet = (XResultSet) UnoRuntime.queryInterface(XResultSet.class, m_rowSet);
+ m_resultSetUpdate = (XResultSetUpdate) UnoRuntime.queryInterface(XResultSetUpdate.class, m_rowSet);
+ m_row = (XRow) UnoRuntime.queryInterface(XRow.class, m_rowSet);
+ m_rowLocate = (XRowLocate) UnoRuntime.queryInterface(XRowLocate.class, m_resultSet);
+ m_rowSetProperties = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, m_rowSet);
+ m_paramsSupplier = (XParametersSupplier) UnoRuntime.queryInterface(XParametersSupplier.class, m_rowSet);
+
+ if (execute)
+ {
m_rowSet.execute();
+ }
}
- catch ( java.lang.Exception e )
+ catch (Exception e)
{
- assure( "caught an exception while creating the RowSet. Type:\n" + e.getClass().toString() + "\nMessage:\n" + e.getMessage(), false );
+ assure("caught an exception while creating the RowSet. Type:\n" + e.getClass().toString() + "\nMessage:\n" + e.getMessage(), false);
}
}
// --------------------------------------------------------------------------------------------------------
- public void testRowSet() throws java.lang.Exception {
+ public void testRowSet() throws java.lang.Exception
+ {
log.println("testing testRowSet");
- createTestCase( true );
+ createTestCase(true);
// sequential postioning
m_resultSet.beforeFirst();
- testSequentialPositining(m_resultSet,m_row);
+ testSequentialPositining(m_resultSet, m_row);
// absolute positioning
- testAbsolutePositioning(m_resultSet,m_row);
+ testAbsolutePositioning(m_resultSet, m_row);
// 3rd test
- test3(createClone(),m_resultSet);
+ test3(createClone(), m_resultSet);
// 4th test
test4(m_resultSet);
@@ -227,201 +259,213 @@ public class RowSet extends ComplexTestCase {
// --------------------------------------------------------------------------------------------------------
XResultSet createClone() throws SQLException
{
- XResultSetAccess rowAcc = (XResultSetAccess)UnoRuntime.queryInterface( XResultSetAccess.class, m_rowSet );
+ final XResultSetAccess rowAcc = (XResultSetAccess) UnoRuntime.queryInterface(XResultSetAccess.class, m_rowSet);
return rowAcc.createResultSet();
}
// --------------------------------------------------------------------------------------------------------
void createStruture() throws SQLException
{
- m_database.executeSQL( "DROP TABLE \"TEST1\" IF EXISTS" );
- m_database.executeSQL( "CREATE TABLE \"TEST1\" (\"ID\" integer not null primary key, \"col2\" varchar(50) )" );
-
- XConnection connection = m_database.defaultConnection();
- XPreparedStatement prep = connection.prepareStatement("INSERT INTO \"TEST1\" values (?,?)");
- XParameters para = (XParameters)UnoRuntime.queryInterface(XParameters.class,prep);
- for(int i=1 ; i <= MAX_TABLE_ROWS ; ++i){
- para.setInt(1, i );
+ m_database.executeSQL("DROP TABLE \"TEST1\" IF EXISTS");
+ m_database.executeSQL("CREATE TABLE \"TEST1\" (\"ID\" integer not null primary key, \"col2\" varchar(50) )");
+
+ final XConnection connection = m_database.defaultConnection();
+ final XPreparedStatement prep = connection.prepareStatement("INSERT INTO \"TEST1\" values (?,?)");
+ final XParameters para = (XParameters) UnoRuntime.queryInterface(XParameters.class, prep);
+ for (int i = 1; i <= MAX_TABLE_ROWS; ++i)
+ {
+ para.setInt(1, i);
para.setString(2, "Test" + i);
prep.executeUpdate();
}
- XTablesSupplier suppTables = (XTablesSupplier)UnoRuntime.queryInterface( XTablesSupplier.class, connection );
- XRefreshable refresh = (XRefreshable)UnoRuntime.queryInterface( XRefreshable.class, suppTables.getTables() );
+ final XTablesSupplier suppTables = (XTablesSupplier) UnoRuntime.queryInterface(XTablesSupplier.class, connection);
+ final XRefreshable refresh = (XRefreshable) UnoRuntime.queryInterface(XRefreshable.class, suppTables.getTables());
refresh.refresh();
}
// --------------------------------------------------------------------------------------------------------
- void testPosition(XResultSet m_resultSet,XRow m_row,int expectedValue,String location) throws SQLException
+ void testPosition(XResultSet m_resultSet, XRow m_row, int expectedValue, String location) throws SQLException
{
- int val = m_row.getInt(1);
- int pos = m_resultSet.getRow();
- assure( location + ": value/position do not match: " + pos + " (pos) != " + val + " (val)", val == pos );
- assure( location + ": value/position are not as expected: " + val + " (val) != " + expectedValue + " (expected)", val == expectedValue );
+ final int val = m_row.getInt(1);
+ final int pos = m_resultSet.getRow();
+ assure(location + ": value/position do not match: " + pos + " (pos) != " + val + " (val)", val == pos);
+ assure(location + ": value/position are not as expected: " + val + " (val) != " + expectedValue + " (expected)", val == expectedValue);
}
// --------------------------------------------------------------------------------------------------------
- void testSequentialPositining(XResultSet _resultSet,XRow _row)
+ void testSequentialPositining(XResultSet _resultSet, XRow _row)
{
try
{
// 1st test
- int i=1;
- while(_resultSet.next())
+ int i = 1;
+ while (_resultSet.next())
{
- testPosition( _resultSet, _row, i, "testSequentialPositining" );
+ testPosition(_resultSet, _row, i, "testSequentialPositining");
++i;
}
}
- catch(AssureException e)
- {
- }
- catch(Exception e)
+ catch (Exception e)
{
- assure("testSequentialPositining failed: " + e,false);
+ assure("testSequentialPositining failed: " + e, false);
}
}
// --------------------------------------------------------------------------------------------------------
- void testAbsolutePositioning(XResultSet _resultSet,XRow _row){
- try{
- for(int i = 1 ; i <= MAX_FETCH_ROWS ; ++i){
- int calcPos = (MAX_TABLE_ROWS % i) + 1;
- assure( "testAbsolutePositioning failed", _resultSet.absolute(calcPos) );
- testPosition( _resultSet, _row, calcPos, "testAbsolutePositioning" );
+ void testAbsolutePositioning(XResultSet _resultSet, XRow _row)
+ {
+ try
+ {
+ for (int i = 1; i <= MAX_FETCH_ROWS; ++i)
+ {
+ final int calcPos = (MAX_TABLE_ROWS % i) + 1;
+ assure("testAbsolutePositioning failed", _resultSet.absolute(calcPos));
+ testPosition(_resultSet, _row, calcPos, "testAbsolutePositioning");
}
- }catch(AssureException e){
- }catch(Exception e){
- assure("testAbsolutePositioning failed: " + e,false);
- }
+ }
+ catch (Exception e)
+ {
+ assure("testAbsolutePositioning failed: " + e, false);
+ }
}
// --------------------------------------------------------------------------------------------------------
- void test3(XResultSet clone,XResultSet _resultSet){
- try{
- XRow _row = (XRow)UnoRuntime.queryInterface(XRow.class,_resultSet);
- XRow cloneRow = (XRow)UnoRuntime.queryInterface(XRow.class,clone);
- for(int i = 1 ; i <= MAX_FETCH_ROWS ; ++i){
- int calcPos = (MAX_TABLE_ROWS % i) + 1;
- if ( clone.absolute(calcPos) )
+ void test3(XResultSet clone, XResultSet _resultSet)
+ {
+ try
+ {
+ final XRow _row = (XRow) UnoRuntime.queryInterface(XRow.class, _resultSet);
+ final XRow cloneRow = (XRow) UnoRuntime.queryInterface(XRow.class, clone);
+ for (int i = 1; i <= MAX_FETCH_ROWS; ++i)
+ {
+ final int calcPos = (MAX_TABLE_ROWS % i) + 1;
+ if (clone.absolute(calcPos))
{
- testPosition( clone, cloneRow, calcPos, "test3" );
- testAbsolutePositioning(_resultSet,_row);
- testAbsolutePositioning(clone,cloneRow);
+ testPosition(clone, cloneRow, calcPos, "test3");
+ testAbsolutePositioning(_resultSet, _row);
+ testAbsolutePositioning(clone, cloneRow);
}
}
- }catch(AssureException e){
- }catch(Exception e){
- assure("test3 failed: " + e,false);
- }
+ }
+ catch (Exception e)
+ {
+ assure("test3 failed: " + e, false);
+ }
}
// --------------------------------------------------------------------------------------------------------
- void test4(XResultSet _resultSet){
- try{
- XRow _row = (XRow)UnoRuntime.queryInterface(XRow.class,_resultSet);
+ void test4(XResultSet _resultSet)
+ {
+ try
+ {
+ final XRow _row = (XRow) UnoRuntime.queryInterface(XRow.class, _resultSet);
_resultSet.beforeFirst();
- for(int i = 1 ; i <= MAX_TABLE_ROWS ; ++i){
+ for (int i = 1; i <= MAX_TABLE_ROWS; ++i)
+ {
_resultSet.next();
- XResultSet clone = createClone();
- XRow cloneRow = (XRow)UnoRuntime.queryInterface(XRow.class,clone);
- int calcPos = MAX_TABLE_ROWS - 1;
- if ( calcPos != 0 && clone.absolute(calcPos) )
+ final XResultSet clone = createClone();
+ final XRow cloneRow = (XRow) UnoRuntime.queryInterface(XRow.class, clone);
+ final int calcPos = MAX_TABLE_ROWS - 1;
+ if (calcPos != 0 && clone.absolute(calcPos))
{
- testPosition( clone, cloneRow, calcPos, "test4: clone" );
- testPosition( _resultSet, _row, i, "test4: rowset" );
+ testPosition(clone, cloneRow, calcPos, "test4: clone");
+ testPosition(_resultSet, _row, i, "test4: rowset");
}
}
- }catch(AssureException e){
- }catch(Exception e){
- assure("test4 failed: " + e,false);
- }
+ }
+ catch (Exception e)
+ {
+ assure("test4 failed: " + e, false);
+ }
}
// --------------------------------------------------------------------------------------------------------
- void testConcurrentAccess(XResultSet _resultSet)
- {
+ void testConcurrentAccess(XResultSet _resultSet)
+ {
log.println("testing Thread");
try
{
- XRow _row = (XRow)UnoRuntime.queryInterface(XRow.class,_resultSet);
+ // final XRow _row = (XRow)UnoRuntime.queryInterface(XRow.class,_resultSet);
_resultSet.beforeFirst();
final int numberOfThreads = 10;
- Thread threads[] = new Thread[numberOfThreads];
- for ( int i=0; i<numberOfThreads; ++i )
+ final Thread threads[] = new Thread[numberOfThreads];
+ for (int i = 0; i < numberOfThreads; ++i)
{
- threads[i] = new Thread( new ResultSetMovementStress( createClone(), i ) );
- System.out.println( "starting thread " + String.valueOf(i+1) + " of " + String.valueOf( numberOfThreads ) );
+ threads[i] = new Thread(new ResultSetMovementStress(createClone(), i));
+ log.println("starting thread " + (i + 1) + " of " + (numberOfThreads));
threads[i].start();
}
- for ( int i=0; i<numberOfThreads; ++i )
+ for (int i = 0; i < numberOfThreads; ++i)
+ {
threads[i].join();
+ }
}
- catch(AssureException e)
- {
- }
- catch(Exception e)
+ catch (Exception e)
{
- e.printStackTrace();
- assure("testConcurrentAccess failed: " + e,false);
+ assure("testConcurrentAccess failed: " + e, false);
}
}
// --------------------------------------------------------------------------------------------------------
- public void testRowSetEvents() throws java.lang.Exception {
+
+ public void testRowSetEvents() throws java.lang.Exception
+ {
log.println("testing RowSet Events");
- createTestCase( true );
+ createTestCase(true);
// first we create our RowSet object
- RowSetEventListener pRow = new RowSetEventListener(this);
+ final RowSetEventListener pRow = new RowSetEventListener();
- XColumnsSupplier colSup = (XColumnsSupplier)UnoRuntime.queryInterface(XColumnsSupplier.class,m_rowSet);
- XPropertySet col = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,colSup.getColumns().getByName("ID"));
+ final XColumnsSupplier colSup = (XColumnsSupplier) UnoRuntime.queryInterface(XColumnsSupplier.class, m_rowSet);
+ final XPropertySet col = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, colSup.getColumns().getByName("ID"));
col.addPropertyChangeListener("Value", pRow);
m_rowSetProperties.addPropertyChangeListener("IsModified", pRow);
m_rowSetProperties.addPropertyChangeListener("IsNew", pRow);
m_rowSetProperties.addPropertyChangeListener("IsRowCountFinal", pRow);
m_rowSetProperties.addPropertyChangeListener("RowCount", pRow);
- XRowSetApproveBroadcaster xApBroad = (XRowSetApproveBroadcaster)UnoRuntime.queryInterface(XRowSetApproveBroadcaster.class,m_resultSet);
+ final XRowSetApproveBroadcaster xApBroad = (XRowSetApproveBroadcaster) UnoRuntime.queryInterface(XRowSetApproveBroadcaster.class, m_resultSet);
xApBroad.addRowSetApproveListener(pRow);
m_rowSet.addRowSetListener(pRow);
// do some movements to check if we got all notifications
- Class cResSet = java.lang.Class.forName("com.sun.star.sdbc.XResultSet");
- boolean moves[] = new boolean[9];
- for( int i = 0; i < moves.length; ++i)
+ final Class cResSet = Class.forName("com.sun.star.sdbc.XResultSet");
+ final boolean moves[] = new boolean[9];
+ for (int i = 0; i < moves.length; ++i)
+ {
moves[i] = false;
+ }
moves[RowSetEventListener.APPROVE_CURSOR_MOVE] = true;
moves[RowSetEventListener.COLUMN_VALUE] = true;
moves[RowSetEventListener.CURSOR_MOVED] = true;
moves[RowSetEventListener.IS_ROW_COUNT_FINAL] = true;
moves[RowSetEventListener.ROW_COUNT] = true;
- testCursorMove(m_resultSet,cResSet.getMethod("afterLast",(Class[])null),pRow,moves,null);
+ testCursorMove(m_resultSet, cResSet.getMethod("afterLast", (Class[]) null), pRow, moves, null);
moves[RowSetEventListener.IS_ROW_COUNT_FINAL] = false;
moves[RowSetEventListener.ROW_COUNT] = false;
- testCursorMove(m_resultSet,cResSet.getMethod("next",(Class[])null),pRow,moves,null);
- testCursorMove(m_resultSet,cResSet.getMethod("next",(Class[])null),pRow,moves,null);
- testCursorMove(m_resultSet,cResSet.getMethod("next",(Class[])null),pRow,moves,null);
- testCursorMove(m_resultSet,cResSet.getMethod("last",(Class[])null),pRow,moves,null);
- testCursorMove(m_resultSet,cResSet.getMethod("next",(Class[])null),pRow,moves,null);
- testCursorMove(m_resultSet,cResSet.getMethod("first",(Class[])null),pRow,moves,null);
- testCursorMove(m_resultSet,cResSet.getMethod("previous",(Class[])null),pRow,moves,null);
- testCursorMove(m_resultSet,cResSet.getMethod("next",(Class[])null),pRow,moves,null);
+ testCursorMove(m_resultSet, cResSet.getMethod(NEXT, (Class[]) null), pRow, moves, null);
+ testCursorMove(m_resultSet, cResSet.getMethod(NEXT, (Class[]) null), pRow, moves, null);
+ testCursorMove(m_resultSet, cResSet.getMethod(NEXT, (Class[]) null), pRow, moves, null);
+ testCursorMove(m_resultSet, cResSet.getMethod("last", (Class[]) null), pRow, moves, null);
+ testCursorMove(m_resultSet, cResSet.getMethod(NEXT, (Class[]) null), pRow, moves, null);
+ testCursorMove(m_resultSet, cResSet.getMethod("first", (Class[]) null), pRow, moves, null);
+ testCursorMove(m_resultSet, cResSet.getMethod("previous", (Class[]) null), pRow, moves, null);
+ testCursorMove(m_resultSet, cResSet.getMethod(NEXT, (Class[]) null), pRow, moves, null);
moves[RowSetEventListener.IS_MODIFIED] = true;
- XRowUpdate updRow = (XRowUpdate)UnoRuntime.queryInterface(XRowUpdate.class,m_resultSet);
- updRow.updateString(2,"Test21");
- testCursorMove(m_resultSet,cResSet.getMethod("next",(Class[])null),pRow,moves,null);
+ final XRowUpdate updRow = (XRowUpdate) UnoRuntime.queryInterface(XRowUpdate.class, m_resultSet);
+ updRow.updateString(2, TEST21);
+ testCursorMove(m_resultSet, cResSet.getMethod(NEXT, (Class[]) null), pRow, moves, null);
moves[RowSetEventListener.IS_MODIFIED] = false;
- Class cupd = java.lang.Class.forName("com.sun.star.sdbc.XResultSetUpdate");
- XResultSetUpdate upd = (XResultSetUpdate)UnoRuntime.queryInterface(XResultSetUpdate.class,m_resultSet);
- testCursorMove(upd,cupd.getMethod("moveToInsertRow",(Class[])null),pRow,moves,null);
+ final Class cupd = Class.forName("com.sun.star.sdbc.XResultSetUpdate");
+ final XResultSetUpdate upd = (XResultSetUpdate) UnoRuntime.queryInterface(XResultSetUpdate.class, m_resultSet);
+ testCursorMove(upd, cupd.getMethod("moveToInsertRow", (Class[]) null), pRow, moves, null);
updRow.updateInt(1, MAX_TABLE_ROWS + 2);
updRow.updateString(2, "HHHH");
@@ -432,108 +476,110 @@ public class RowSet extends ComplexTestCase {
moves[RowSetEventListener.ROW_COUNT] = true;
moves[RowSetEventListener.APPROVE_ROW_CHANGE] = true;
moves[RowSetEventListener.ROW_CHANGED] = true;
- testCursorMove(upd,cupd.getMethod("insertRow",(Class[])null),pRow,moves,null);
+ testCursorMove(upd, cupd.getMethod("insertRow", (Class[]) null), pRow, moves, null);
moves[RowSetEventListener.IS_NEW] = false;
moves[RowSetEventListener.ROW_COUNT] = false;
m_resultSet.first();
updRow.updateInt(1, MAX_TABLE_ROWS + 3);
updRow.updateString(2, "__");
- testCursorMove(upd,cupd.getMethod("updateRow",(Class[])null),pRow,moves,null);
+ testCursorMove(upd, cupd.getMethod("updateRow", (Class[]) null), pRow, moves, null);
moves[RowSetEventListener.IS_NEW] = true;
moves[RowSetEventListener.ROW_COUNT] = true;
m_resultSet.first();
- testCursorMove(upd,cupd.getMethod("deleteRow",(Class[])null),pRow,moves,null);
+ testCursorMove(upd, cupd.getMethod("deleteRow", (Class[]) null), pRow, moves, null);
moves[RowSetEventListener.IS_NEW] = false;
moves[RowSetEventListener.COLUMN_VALUE] = true;
moves[RowSetEventListener.ROW_COUNT] = false;
m_resultSet.first();
- updRow.updateString(2,"Test21");
- testCursorMove(m_resultSet,cResSet.getMethod("refreshRow",(Class[])null),pRow,moves,null);
+ updRow.updateString(2, TEST21);
+ testCursorMove(m_resultSet, cResSet.getMethod("refreshRow", (Class[]) null), pRow, moves, null);
m_resultSet.first();
- updRow.updateString(2,"Test21");
- testCursorMove(upd,cupd.getMethod("cancelRowUpdates",(Class[])null),pRow,moves,null);
+ updRow.updateString(2, TEST21);
+ testCursorMove(upd, cupd.getMethod("cancelRowUpdates", (Class[]) null), pRow, moves, null);
- for( int i = 0; i < moves.length; ++i)
+ for (int i = 0; i < moves.length; ++i)
+ {
moves[i] = false;
+ }
moves[RowSetEventListener.APPROVE_CURSOR_MOVE] = true;
moves[RowSetEventListener.COLUMN_VALUE] = true;
moves[RowSetEventListener.CURSOR_MOVED] = true;
- Class cloc = java.lang.Class.forName("com.sun.star.sdbcx.XRowLocate");
+ final Class cloc = Class.forName("com.sun.star.sdbcx.XRowLocate");
m_resultSet.first();
- Object bookmark = m_rowLocate.getBookmark();
+ final Object bookmark = m_rowLocate.getBookmark();
m_resultSet.next();
- Object temp[] = new Object[1];
+ final Object temp[] = new Object[1];
temp[0] = bookmark;
Class ctemp[] = new Class[1];
ctemp[0] = Object.class;
- testCursorMove(m_rowLocate,cloc.getMethod("moveToBookmark",ctemp),pRow,moves,temp);
+ testCursorMove(m_rowLocate, cloc.getMethod("moveToBookmark", ctemp), pRow, moves, temp);
- Object temp2[] = new Object[2];
+ final Object temp2[] = new Object[2];
temp2[0] = bookmark;
- temp2[1] = new Integer(1);
- Class ctemp2[] = new Class[2];
+ temp2[1] = Integer.valueOf(1);
+ final Class ctemp2[] = new Class[2];
ctemp2[0] = Object.class;
ctemp2[1] = int.class;
- testCursorMove(m_rowLocate,cloc.getMethod("moveRelativeToBookmark",ctemp2),pRow,moves,temp2);
+ testCursorMove(m_rowLocate, cloc.getMethod("moveRelativeToBookmark", ctemp2), pRow, moves, temp2);
- for( int i = 0; i < moves.length; ++i)
+ for (int i = 0; i < moves.length; ++i)
+ {
moves[i] = false;
+ }
moves[RowSetEventListener.APPROVE_ROW_CHANGE] = true;
moves[RowSetEventListener.ROW_CHANGED] = true;
moves[RowSetEventListener.ROW_COUNT] = true;
- Class cdelRows = java.lang.Class.forName("com.sun.star.sdbcx.XDeleteRows");
+ final Class cdelRows = Class.forName("com.sun.star.sdbcx.XDeleteRows");
ctemp[0] = Object[].class;
- XDeleteRows delRows = (XDeleteRows)UnoRuntime.queryInterface(XDeleteRows.class,m_resultSet);
- Object bookmarks[] = new Object[5];
+ final XDeleteRows delRows = (XDeleteRows) UnoRuntime.queryInterface(XDeleteRows.class, m_resultSet);
+ final Object bookmarks[] = new Object[5];
m_resultSet.first();
- for ( int i = 0; i < bookmarks.length ; ++i ){
+ for (int i = 0; i < bookmarks.length; ++i)
+ {
m_resultSet.next();
bookmarks[i] = m_rowLocate.getBookmark();
}
temp[0] = bookmarks;
- testCursorMove(delRows,cdelRows.getMethod("deleteRows",ctemp),pRow,moves,temp);
+ testCursorMove(delRows, cdelRows.getMethod("deleteRows", ctemp), pRow, moves, temp);
// now destroy the RowSet
- XComponent xComp = (XComponent)UnoRuntime.queryInterface(XComponent.class,m_resultSet);
+ final XComponent xComp = (XComponent) UnoRuntime.queryInterface(XComponent.class, m_resultSet);
xComp.dispose();
}
// --------------------------------------------------------------------------------------------------------
- private void testCursorMove(Object res
- ,java.lang.reflect.Method _method
- , RowSetEventListener _evt
- , boolean _must[]
- , Object args[]) throws java.lang.Exception {
+ private void testCursorMove(Object res, Method _method, RowSetEventListener _evt, boolean _must[], Object args[]) throws java.lang.Exception
+ {
_evt.clearCalling();
- _method.invoke(res,args);
+ _method.invoke(res, args);
log.println("testing events for " + _method.getName());
- int calling[] = _evt.getCalling();
+ final int calling[] = _evt.getCalling();
int pos = 1;
- assure("Callings are not in the correct order for APPROVE_CURSOR_MOVE " ,
- ( !_must[RowSetEventListener.APPROVE_CURSOR_MOVE] || calling[RowSetEventListener.APPROVE_CURSOR_MOVE] == -1) || calling[RowSetEventListener.APPROVE_CURSOR_MOVE] == pos++ );
- assure("Callings are not in the correct order for APPROVE_ROW_CHANGE" ,
- ( !_must[ RowSetEventListener.APPROVE_ROW_CHANGE] || calling[RowSetEventListener.APPROVE_ROW_CHANGE] == -1) || calling[RowSetEventListener.APPROVE_ROW_CHANGE] == pos++);
- assure("Callings are not in the correct order for COLUMN_VALUE" ,
- ( !_must[RowSetEventListener.COLUMN_VALUE] || calling[RowSetEventListener.COLUMN_VALUE] == -1) || calling[RowSetEventListener.COLUMN_VALUE] == pos++);
- assure("Callings are not in the correct order for CURSOR_MOVED" ,
- ( !_must[RowSetEventListener.CURSOR_MOVED] || calling[RowSetEventListener.CURSOR_MOVED] == -1) || calling[RowSetEventListener.CURSOR_MOVED] == pos++);
- assure("Callings are not in the correct order for ROW_CHANGED" ,
- ( !_must[ RowSetEventListener.ROW_CHANGED] || calling[RowSetEventListener.ROW_CHANGED] == -1) || calling[RowSetEventListener.ROW_CHANGED] == pos++);
- assure("Callings are not in the correct order for IS_MODIFIED" ,
- ( !_must[ RowSetEventListener.IS_MODIFIED] || calling[RowSetEventListener.IS_MODIFIED] == -1) || calling[RowSetEventListener.IS_MODIFIED] == pos++);
- assure("Callings are not in the correct order for IS_NEW" ,
- ( !_must[ RowSetEventListener.IS_NEW] || calling[RowSetEventListener.IS_NEW] == -1) || calling[RowSetEventListener.IS_NEW] == pos++);
- assure("Callings are not in the correct order for ROW_COUNT" ,
- ( !_must[ RowSetEventListener.ROW_COUNT] || calling[RowSetEventListener.ROW_COUNT] == -1) || calling[RowSetEventListener.ROW_COUNT] == pos++);
- assure("Callings are not in the correct order for IS_ROW_COUNT_FINAL" ,
- ( !_must[ RowSetEventListener.IS_ROW_COUNT_FINAL] || calling[RowSetEventListener.IS_ROW_COUNT_FINAL] == -1) || calling[RowSetEventListener.IS_ROW_COUNT_FINAL] == pos++);
+ assure("Callings are not in the correct order for APPROVE_CURSOR_MOVE ",
+ (!_must[RowSetEventListener.APPROVE_CURSOR_MOVE] || calling[RowSetEventListener.APPROVE_CURSOR_MOVE] == -1) || calling[RowSetEventListener.APPROVE_CURSOR_MOVE] == pos++);
+ assure("Callings are not in the correct order for APPROVE_ROW_CHANGE",
+ (!_must[RowSetEventListener.APPROVE_ROW_CHANGE] || calling[RowSetEventListener.APPROVE_ROW_CHANGE] == -1) || calling[RowSetEventListener.APPROVE_ROW_CHANGE] == pos++);
+ assure("Callings are not in the correct order for COLUMN_VALUE",
+ (!_must[RowSetEventListener.COLUMN_VALUE] || calling[RowSetEventListener.COLUMN_VALUE] == -1) || calling[RowSetEventListener.COLUMN_VALUE] == pos++);
+ assure("Callings are not in the correct order for CURSOR_MOVED",
+ (!_must[RowSetEventListener.CURSOR_MOVED] || calling[RowSetEventListener.CURSOR_MOVED] == -1) || calling[RowSetEventListener.CURSOR_MOVED] == pos++);
+ assure("Callings are not in the correct order for ROW_CHANGED",
+ (!_must[RowSetEventListener.ROW_CHANGED] || calling[RowSetEventListener.ROW_CHANGED] == -1) || calling[RowSetEventListener.ROW_CHANGED] == pos++);
+ assure("Callings are not in the correct order for IS_MODIFIED",
+ (!_must[RowSetEventListener.IS_MODIFIED] || calling[RowSetEventListener.IS_MODIFIED] == -1) || calling[RowSetEventListener.IS_MODIFIED] == pos++);
+ assure("Callings are not in the correct order for IS_NEW",
+ (!_must[RowSetEventListener.IS_NEW] || calling[RowSetEventListener.IS_NEW] == -1) || calling[RowSetEventListener.IS_NEW] == pos++);
+ assure("Callings are not in the correct order for ROW_COUNT",
+ (!_must[RowSetEventListener.ROW_COUNT] || calling[RowSetEventListener.ROW_COUNT] == -1) || calling[RowSetEventListener.ROW_COUNT] == pos++);
+ assure("Callings are not in the correct order for IS_ROW_COUNT_FINAL",
+ (!_must[RowSetEventListener.IS_ROW_COUNT_FINAL] || calling[RowSetEventListener.IS_ROW_COUNT_FINAL] == -1) || calling[RowSetEventListener.IS_ROW_COUNT_FINAL] == pos);
_evt.clearCalling();
}
@@ -543,7 +589,7 @@ public class RowSet extends ComplexTestCase {
*/
private int currentRowCount() throws UnknownPropertyException, WrappedTargetException
{
- Integer rowCount = (Integer)m_rowSetProperties.getPropertyValue( "RowCount" );
+ final Integer rowCount = (Integer) m_rowSetProperties.getPropertyValue("RowCount");
return rowCount.intValue();
}
@@ -552,9 +598,9 @@ public class RowSet extends ComplexTestCase {
*/
private int positionRandom() throws SQLException, UnknownPropertyException, WrappedTargetException
{
- int position = (new java.util.Random()).nextInt( currentRowCount() - 2 ) + 2;
- assure( "sub task failed: could not position to row no. " + (new Integer( position )).toString(),
- m_resultSet.absolute( position ) );
+ final int position = (new Random()).nextInt(currentRowCount() - 2) + 2;
+ assure("sub task failed: could not position to row no. " + (Integer.valueOf(position)).toString(),
+ m_resultSet.absolute(position));
return m_resultSet.getRow();
}
@@ -568,16 +614,16 @@ public class RowSet extends ComplexTestCase {
private int deleteRandom() throws SQLException, UnknownPropertyException, WrappedTargetException
{
// check if the current position and the row count in the result set is changed by a deletion (it should not)
- int positionBefore = positionRandom();
- int rowCountBefore = currentRowCount();
+ final int positionBefore = positionRandom();
+ final int rowCountBefore = currentRowCount();
m_resultSetUpdate.deleteRow();
- int positionAfter = m_resultSet.getRow();
- int rowCountAfter = currentRowCount();
- assure( "position changed during |deleteRow| (it should not)", positionAfter == positionBefore );
- assure( "row count changed with a |deleteRow| (it should not)", rowCountBefore == rowCountAfter );
- assure( "RowSet does not report the current row as deleted after |deleteRow|", m_resultSet.rowDeleted() );
+ final int positionAfter = m_resultSet.getRow();
+ final int rowCountAfter = currentRowCount();
+ assure("position changed during |deleteRow| (it should not)", positionAfter == positionBefore);
+ assure("row count changed with a |deleteRow| (it should not)", rowCountBefore == rowCountAfter);
+ assure("RowSet does not report the current row as deleted after |deleteRow|", m_resultSet.rowDeleted());
return positionBefore;
}
@@ -585,11 +631,11 @@ public class RowSet extends ComplexTestCase {
// --------------------------------------------------------------------------------------------------------
public void testDeleteBehavior() throws Exception
{
- createTestCase( true );
+ createTestCase(true);
// ensure that all records are known
m_resultSet.last();
- int initialRowCount = currentRowCount();
+ final int initialRowCount = currentRowCount();
// delete a random row
int deletedRow = deleteRandom();
@@ -597,92 +643,119 @@ public class RowSet extends ComplexTestCase {
// .....................................................................................................
// asking for the bookmark of a deleted row should fail
boolean caughtException = false;
- try { m_rowLocate.getBookmark(); }
- catch ( SQLException e ) { caughtException = true; }
- assure( "asking for the bookmark of a deleted row should throw an exception", caughtException );
+ try
+ {
+ m_rowLocate.getBookmark();
+ }
+ catch (SQLException e)
+ {
+ caughtException = true;
+ }
+ assure("asking for the bookmark of a deleted row should throw an exception", caughtException);
// .....................................................................................................
// isXXX methods should return |false| on a deleted row
- assure( "one of the isFoo failed after |deleteRow|", !m_resultSet.isBeforeFirst() && !m_resultSet.isAfterLast() && !m_resultSet.isFirst() && !m_resultSet.isLast() );
- // note that we can assume that isFirst / isLast also return |false|, since deleteRandom did
- // not position on the first or last record, but inbetween
+ assure("one of the isFoo failed after |deleteRow|", !m_resultSet.isBeforeFirst() && !m_resultSet.isAfterLast() && !m_resultSet.isFirst() && !m_resultSet.isLast());
+ // note that we can assume that isFirst / isLast also return |false|, since deleteRandom did
+ // not position on the first or last record, but inbetween
// .....................................................................................................
// check if moving away from this row in either direction yields the expected results
- assure( "|previous| after |deleteRow| failed", m_resultSet.previous() );
- int positionPrevious = m_resultSet.getRow();
- assure( "position after |previous| after |deleteRow| is not as expected", positionPrevious == deletedRow - 1 );
+ assure("|previous| after |deleteRow| failed", m_resultSet.previous());
+ final int positionPrevious = m_resultSet.getRow();
+ assure("position after |previous| after |deleteRow| is not as expected", positionPrevious == deletedRow - 1);
deletedRow = deleteRandom();
- assure( "|next| after |deleteRow| failed", m_resultSet.next() );
- int positionAfter = m_resultSet.getRow();
- assure( "position after |next| after |deleteRow| is not as expected", positionAfter == deletedRow );
- // since the deleted record "vanishs" as soon as the cursor is moved away from it, the absolute position does
- // not change with a |next| call here
+ assure("|next| after |deleteRow| failed", m_resultSet.next());
+ final int positionAfter = m_resultSet.getRow();
+ assure("position after |next| after |deleteRow| is not as expected", positionAfter == deletedRow);
+ // since the deleted record "vanishs" as soon as the cursor is moved away from it, the absolute position does
+ // not change with a |next| call here
// .....................................................................................................
// check if the deleted rows really vanished after moving away from them
- assure( "row count did not change as expected after two deletions", initialRowCount - 2 == currentRowCount() );
+ assure("row count did not change as expected after two deletions", initialRowCount - 2 == currentRowCount());
// .....................................................................................................
// check if the deleted row vanishes after moving to the insertion row
- int rowCountBefore = currentRowCount();
- int deletedPos = deleteRandom();
+ final int rowCountBefore = currentRowCount();
+ final int deletedPos = deleteRandom();
m_resultSetUpdate.moveToInsertRow();
- assure( "moving to the insertion row immediately after |deleteRow| does not adjust the row count", rowCountBefore == currentRowCount() + 1 );
+ assure("moving to the insertion row immediately after |deleteRow| does not adjust the row count", rowCountBefore == currentRowCount() + 1);
m_resultSetUpdate.moveToCurrentRow();
- assure( "|moveToCurrentRow| after |deleteRow| + |moveToInsertRow| results in unexpected position",
- ( m_resultSet.getRow() == deletedPos ) && !m_resultSet.rowDeleted() );
+ assure("|moveToCurrentRow| after |deleteRow| + |moveToInsertRow| results in unexpected position",
+ (m_resultSet.getRow() == deletedPos) && !m_resultSet.rowDeleted());
// the same, but this time with deleting the first row (which is not covered by deleteRandom)
m_resultSet.last();
m_resultSetUpdate.deleteRow();
m_resultSetUpdate.moveToInsertRow();
m_resultSetUpdate.moveToCurrentRow();
- assure( "|last| + |deleteRow| + |moveToInsertRow| + |moveToCurrentRow| results in wrong state", m_resultSet.isAfterLast() );
+ assure("|last| + |deleteRow| + |moveToInsertRow| + |moveToCurrentRow| results in wrong state", m_resultSet.isAfterLast());
// .....................................................................................................
// check if deleting a deleted row fails as expected
deleteRandom();
caughtException = false;
- try { m_resultSetUpdate.deleteRow(); }
- catch( SQLException e ) { caughtException = true; }
- assure( "deleting a deleted row succeeded - it shouldn't", caughtException );
+ try
+ {
+ m_resultSetUpdate.deleteRow();
+ }
+ catch (SQLException e)
+ {
+ caughtException = true;
+ }
+ assure("deleting a deleted row succeeded - it shouldn't", caughtException);
// .....................................................................................................
// check if deleteRows fails if it contains the bookmark of a previously-deleted row
m_resultSet.first();
- Object firstBookmark = m_rowLocate.getBookmark();
+ final Object firstBookmark = m_rowLocate.getBookmark();
positionRandom();
- Object deleteBookmark = m_rowLocate.getBookmark();
+ final Object deleteBookmark = m_rowLocate.getBookmark();
m_resultSetUpdate.deleteRow();
- XDeleteRows multiDelete = (XDeleteRows)UnoRuntime.queryInterface( XDeleteRows.class, m_resultSet );
- int[] deleteSuccess = multiDelete.deleteRows(new Object[]{firstBookmark, deleteBookmark});
- assure( "XDeleteRows::deleteRows with the bookmark of an already-deleted row failed",
- ( deleteSuccess.length == 2 ) && ( deleteSuccess[0] != 0 ) && ( deleteSuccess[1] == 0 ) );
+ final XDeleteRows multiDelete = (XDeleteRows) UnoRuntime.queryInterface(XDeleteRows.class, m_resultSet);
+ final int[] deleteSuccess = multiDelete.deleteRows(new Object[]
+ {
+ firstBookmark, deleteBookmark
+ });
+ assure("XDeleteRows::deleteRows with the bookmark of an already-deleted row failed",
+ (deleteSuccess.length == 2) && (deleteSuccess[0] != 0) && (deleteSuccess[1] == 0));
// .....................................................................................................
// check if refreshing a deleted row fails as expected
deleteRandom();
caughtException = false;
- try { m_resultSet.refreshRow(); }
- catch( SQLException e ) { caughtException = true; }
- assure( "refreshing a deleted row succeeded - it shouldn't", caughtException );
+ try
+ {
+ m_resultSet.refreshRow();
+ }
+ catch (SQLException e)
+ {
+ caughtException = true;
+ }
+ assure("refreshing a deleted row succeeded - it shouldn't", caughtException);
// .....................................................................................................
// rowUpdated/rowDeleted
deleteRandom();
- assure( "rowDeleted and/or rowUpdated are wrong on a deleted row", !m_resultSet.rowUpdated() && !m_resultSet.rowInserted() );
+ assure("rowDeleted and/or rowUpdated are wrong on a deleted row", !m_resultSet.rowUpdated() && !m_resultSet.rowInserted());
// .....................................................................................................
// updating values in a deleted row should fail
deleteRandom();
- XRowUpdate rowUpdated = (XRowUpdate)UnoRuntime.queryInterface( XRowUpdate.class, m_resultSet );
+ final XRowUpdate rowUpdated = (XRowUpdate) UnoRuntime.queryInterface(XRowUpdate.class, m_resultSet);
caughtException = false;
- try { rowUpdated.updateString( 2, "Test21" ); }
- catch( SQLException e ) { caughtException = true; }
- assure( "updating values in a deleted row should not succeed", caughtException );
+ try
+ {
+ rowUpdated.updateString(2, TEST21);
+ }
+ catch (SQLException e)
+ {
+ caughtException = true;
+ }
+ assure("updating values in a deleted row should not succeed", caughtException);
}
// --------------------------------------------------------------------------------------------------------
@@ -691,67 +764,66 @@ public class RowSet extends ComplexTestCase {
*/
public void testCloneMovesPlusDeletions() throws SQLException, UnknownPropertyException, WrappedTargetException
{
- createTestCase( true );
+ createTestCase(true);
// ensure that all records are known
m_resultSet.last();
- XResultSet clone = createClone();
- XRowLocate cloneRowLocate = (XRowLocate)UnoRuntime.queryInterface( XRowLocate.class, clone );
+ final XResultSet clone = createClone();
+ final XRowLocate cloneRowLocate = (XRowLocate) UnoRuntime.queryInterface(XRowLocate.class, clone);
positionRandom();
// .....................................................................................................
// move the clone to the same record as the RowSet, and delete this record
- cloneRowLocate.moveToBookmark( m_rowLocate.getBookmark() );
- int clonePosition = clone.getRow();
+ cloneRowLocate.moveToBookmark(m_rowLocate.getBookmark());
+ final int clonePosition = clone.getRow();
m_resultSetUpdate.deleteRow();
- assure( "clone doesn't know that its current row has been deleted via the RowSet", clone.rowDeleted() );
- assure( "clone's position changed somehow during deletion", clonePosition == clone.getRow() );
+ assure("clone doesn't know that its current row has been deleted via the RowSet", clone.rowDeleted());
+ assure("clone's position changed somehow during deletion", clonePosition == clone.getRow());
// .....................................................................................................
// move the row set away from the deleted record. This should still not touch the state of the clone
m_resultSet.previous();
- assure( "clone doesn't know (anymore) that its current row has been deleted via the RowSet", clone.rowDeleted() );
- assure( "clone's position changed somehow during deletion and RowSet-movement", clonePosition == clone.getRow() );
+ assure("clone doesn't know (anymore) that its current row has been deleted via the RowSet", clone.rowDeleted());
+ assure("clone's position changed somehow during deletion and RowSet-movement", clonePosition == clone.getRow());
// .....................................................................................................
// move the clone away from the deleted record
clone.next();
- assure( "clone still assumes that its row is deleted - but we already moved it", !clone.rowDeleted() );
+ assure("clone still assumes that its row is deleted - but we already moved it", !clone.rowDeleted());
// .....................................................................................................
// check whether deleting the extremes (first / last) work
m_resultSet.first();
- cloneRowLocate.moveToBookmark( m_rowLocate.getBookmark() );
+ cloneRowLocate.moveToBookmark(m_rowLocate.getBookmark());
m_resultSetUpdate.deleteRow();
clone.previous();
- assure( "deleting the first record left the clone in a strange state (after |previous|)", clone.isBeforeFirst() );
+ assure("deleting the first record left the clone in a strange state (after |previous|)", clone.isBeforeFirst());
clone.next();
- assure( "deleting the first record left the clone in a strange state (after |previous| + |next|)", clone.isFirst() );
+ assure("deleting the first record left the clone in a strange state (after |previous| + |next|)", clone.isFirst());
m_resultSet.last();
- cloneRowLocate.moveToBookmark( m_rowLocate.getBookmark() );
+ cloneRowLocate.moveToBookmark(m_rowLocate.getBookmark());
m_resultSetUpdate.deleteRow();
clone.next();
- assure( "deleting the last record left the clone in a strange state (after |next|)", clone.isAfterLast() );
+ assure("deleting the last record left the clone in a strange state (after |next|)", clone.isAfterLast());
clone.previous();
- assure( "deleting the first record left the clone in a strange state (after |next| + |previous|)", clone.isLast() );
+ assure("deleting the first record left the clone in a strange state (after |next| + |previous|)", clone.isLast());
// .....................................................................................................
// check whether movements of the clone interfere with movements of the RowSet, if the latter is on a deleted row
- int positionBefore = positionRandom();
+ final int positionBefore = positionRandom();
m_resultSetUpdate.deleteRow();
- assure( "|deleteRow|, but no |rowDeleted| (this should have been found much earlier!)", m_resultSet.rowDeleted() );
+ assure("|deleteRow|, but no |rowDeleted| (this should have been found much earlier!)", m_resultSet.rowDeleted());
clone.beforeFirst();
- while ( clone.next() )
- ;
- assure( "row set forgot that the current row is deleted", m_resultSet.rowDeleted() );
+ while (clone.next());
+ assure("row set forgot that the current row is deleted", m_resultSet.rowDeleted());
- assure( "moving to the next record after |deleteRow| and clone moves failed", m_resultSet.next() );
- assure( "wrong position after |deleteRow| and clone movement", !m_resultSet.isAfterLast() && !m_resultSet.isBeforeFirst() );
- assure( "wrong absolute position after |deleteRow| and clone movement", m_resultSet.getRow() == positionBefore );
+ assure("moving to the next record after |deleteRow| and clone moves failed", m_resultSet.next());
+ assure("wrong position after |deleteRow| and clone movement", !m_resultSet.isAfterLast() && !m_resultSet.isBeforeFirst());
+ assure("wrong absolute position after |deleteRow| and clone movement", m_resultSet.getRow() == positionBefore);
}
// --------------------------------------------------------------------------------------------------------
@@ -760,99 +832,102 @@ public class RowSet extends ComplexTestCase {
*/
public void testCloneMovesPlusInsertions() throws SQLException, UnknownPropertyException, WrappedTargetException, PropertyVetoException, com.sun.star.lang.IllegalArgumentException
{
- createTestCase( true );
+ createTestCase(true);
// ensure that all records are known
- m_rowSetProperties.setPropertyValue( "FetchSize", new Integer( 10 ) );
+ m_rowSetProperties.setPropertyValue("FetchSize", Integer.valueOf(10));
- XResultSet clone = createClone();
- XRow cloneRow = (XRow)UnoRuntime.queryInterface( XRow.class, clone );
+ final XResultSet clone = createClone();
+ final XRow cloneRow = (XRow) UnoRuntime.queryInterface(XRow.class, clone);
// .....................................................................................................
// first check the basic scenario without the |moveToInsertRow| |moveToCurrentRow|, to ensure that
// really those are broken, if at all
m_resultSet.last();
clone.first();
- clone.absolute( 11 );
+ clone.absolute(11);
clone.first();
- int rowValue1 = m_row.getInt(1);
- int rowPos = m_resultSet.getRow();
- int rowValue2 = m_row.getInt(1);
- assure( "repeated query for the same column value delivers different values (" + rowValue1 + " and " + rowValue2 + ") on row: " + rowPos,
- rowValue1 == rowValue2 );
+ final int rowValue1 = m_row.getInt(1);
+ final int rowPos = m_resultSet.getRow();
+ final int rowValue2 = m_row.getInt(1);
+ assure("repeated query for the same column value delivers different values (" + rowValue1 + " and " + rowValue2 + ") on row: " + rowPos,
+ rowValue1 == rowValue2);
- testPosition( clone, cloneRow, 1, "mixed clone/rowset move: clone check" );
- testPosition( m_resultSet, m_row, MAX_TABLE_ROWS, "mixed clone/rowset move: rowset check" );
+ testPosition(clone, cloneRow, 1, "mixed clone/rowset move: clone check");
+ testPosition(m_resultSet, m_row, MAX_TABLE_ROWS, "mixed clone/rowset move: rowset check");
// .....................................................................................................
// now the complete scenario
m_resultSet.last();
m_resultSetUpdate.moveToInsertRow();
clone.first();
- clone.absolute( 11 );
+ clone.absolute(11);
clone.first();
m_resultSetUpdate.moveToCurrentRow();
- testPosition( clone, cloneRow, 1, "mixed clone/rowset move/insertion: clone check" );
- testPosition( m_resultSet, m_row, 100, "mixed clone/rowset move/insertion: rowset check" );
+ testPosition(clone, cloneRow, 1, "mixed clone/rowset move/insertion: clone check");
+ testPosition(m_resultSet, m_row, 100, "mixed clone/rowset move/insertion: rowset check");
}
// --------------------------------------------------------------------------------------------------------
private void testTableParameters()
{
// for a row set simply based on a table, there should be not parameters at all
- createRowSet( "products", CommandType.TABLE, false );
+ createRowSet("products", CommandType.TABLE, false);
try
{
- verifyParameters( new String[] {}, "testTableParameters" );
+ verifyParameters(new String[]
+ {
+ }, "testTableParameters");
}
- catch( AssureException e ) { throw e; }
- catch( Exception e )
+ catch (Exception e)
{
- assure( "testing the parameters of a table failed" + e.getMessage(), false );
+ assure("testing the parameters of a table failed" + e.getMessage(), false);
}
}
// --------------------------------------------------------------------------------------------------------
+
private void testParametersAfterNormalExecute()
{
try
{
- createRowSet( "SELECT * FROM \"customers\"", CommandType.COMMAND, true );
- m_rowSetProperties.setPropertyValue( "Command", "SELECT * FROM \"customers\" WHERE \"City\" = :city");
- XParameters rowsetParams = (XParameters)UnoRuntime.queryInterface( XParameters.class,
- m_rowSet );
- rowsetParams.setString( 1, "London" );
+ createRowSet("SELECT * FROM \"customers\"", CommandType.COMMAND, true);
+ m_rowSetProperties.setPropertyValue("Command", "SELECT * FROM \"customers\" WHERE \"City\" = :city");
+ final XParameters rowsetParams = (XParameters) UnoRuntime.queryInterface(XParameters.class,
+ m_rowSet);
+ rowsetParams.setString(1, "London");
m_rowSet.execute();
}
- catch( AssureException e ) { throw e; }
- catch( Exception e )
+ catch (Exception e)
{
- assure( "testing the parameters of a table failed" + e.getMessage(), false );
+ assure("testing the parameters of a table failed" + e.getMessage(), false);
}
}
// --------------------------------------------------------------------------------------------------------
- private void verifyParameters( String[] _paramNames, String _context ) throws com.sun.star.uno.Exception
+ private void verifyParameters(String[] _paramNames, String _context) throws com.sun.star.uno.Exception
{
- XIndexAccess params = m_paramsSupplier.getParameters();
- int expected = _paramNames.length;
- int found = params != null ? params.getCount() : 0;
+ final XIndexAccess params = m_paramsSupplier.getParameters();
+ final int expected = _paramNames.length;
+ final int found = params != null ? params.getCount() : 0;
- assure( "wrong number of parameters (expected: " + expected + ", found: " + found + ") in " + _context,
- found == expected );
+ assure("wrong number of parameters (expected: " + expected + ", found: " + found + ") in " + _context,
+ found == expected);
- if ( found == 0 )
+ if (found == 0)
+ {
return;
+ }
- for ( int i=0; i<expected; ++i )
+ for (int i = 0; i < expected; ++i)
{
- XPropertySet parameter = (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class,
- params.getByIndex(i) );
+ final XPropertySet parameter = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,
+ params.getByIndex(i));
- String expectedName = _paramNames[i];
- String foundName = (String)parameter.getPropertyValue( "Name" );
- assure( "wrong parameter name (expected: " + expectedName + ", found: " + foundName + ") in" + _context,
- expectedName.equals( foundName ) );
+ final String expectedName = _paramNames[i];
+ final String foundName = (String) parameter.getPropertyValue("Name");
+ assure("wrong parameter name (expected: " + expectedName + ", found: " + foundName + ") in" + _context,
+ expectedName.equals(foundName));
}
}
@@ -863,14 +938,16 @@ public class RowSet extends ComplexTestCase {
{
// for a row set based on a parametrized query, those parameters should be properly
// recognized
- m_dataSource.createQuery( "products like", "SELECT * FROM \"products\" WHERE \"Name\" LIKE :product_name" );
- createRowSet( "products like", CommandType.QUERY, false );
- verifyParameters( new String[] { "product_name" }, "testParametrizedQuery" );
+ m_dataSource.createQuery("products like", "SELECT * FROM \"products\" WHERE \"Name\" LIKE :product_name");
+ createRowSet("products like", CommandType.QUERY, false);
+ verifyParameters(new String[]
+ {
+ "product_name"
+ }, "testParametrizedQuery");
}
- catch( AssureException e ) { throw e; }
- catch( Exception e )
+ catch (Exception e)
{
- assure( "testing the parameters of a parametrized query failed" + e.getMessage(), false );
+ assure("testing the parameters of a parametrized query failed" + e.getMessage(), false);
}
}
@@ -879,38 +956,37 @@ public class RowSet extends ComplexTestCase {
{
try
{
- createRowSet( "products like", CommandType.QUERY, false );
+ createRowSet("products like", CommandType.QUERY, false);
// let's fill in a parameter value via XParameters, and see whether it is respected by the parameters container
- XParameters rowsetParams = (XParameters)UnoRuntime.queryInterface( XParameters.class,
- m_rowSet );
- rowsetParams.setString( 1, "Apples" );
+ final XParameters rowsetParams = (XParameters) UnoRuntime.queryInterface(XParameters.class,
+ m_rowSet);
+ rowsetParams.setString(1, "Apples");
XIndexAccess params = m_paramsSupplier.getParameters();
- XPropertySet firstParam = (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class, params.getByIndex(0) );
- Object firstParamValue = firstParam.getPropertyValue( "Value" );
+ XPropertySet firstParam = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, params.getByIndex(0));
+ Object firstParamValue = firstParam.getPropertyValue("Value");
- assure( "XParameters and the parameters container do not properly interact",
- firstParamValue.equals( "Apples" ) );
+ assure("XParameters and the parameters container do not properly interact",
+ "Apples".equals(firstParamValue));
// let's see whether this also survices an execute of the row set
- rowsetParams.setString( 1, "Oranges" );
+ rowsetParams.setString(1, "Oranges");
m_rowSet.execute();
{
// TODO: the following would not be necessary if the parameters container would *survive*
// the execution of the row set. It currently doesn't (though the values it represents do).
// It would be nice, but not strictly necessary, if it would.
params = m_paramsSupplier.getParameters();
- firstParam = (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class, params.getByIndex(0) );
+ firstParam = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, params.getByIndex(0));
}
- firstParamValue = firstParam.getPropertyValue( "Value" );
- assure( "XParameters and the parameters container do not properly interact, after the row set has been executed",
- firstParamValue.equals( "Oranges" ) );
+ firstParamValue = firstParam.getPropertyValue("Value");
+ assure("XParameters and the parameters container do not properly interact, after the row set has been executed",
+ "Oranges".equals(firstParamValue));
}
- catch( AssureException e ) { throw e; }
- catch( Exception e )
+ catch (Exception e)
{
- assure( "could not text the relationship between XParameters and XParametersSupplier" + e.getMessage(), false );
+ assure("could not text the relationship between XParameters and XParametersSupplier" + e.getMessage(), false);
}
}
@@ -919,19 +995,23 @@ public class RowSet extends ComplexTestCase {
{
try
{
- createRowSet( "SELECT * FROM \"customers\"", CommandType.COMMAND, false );
- m_rowSetProperties.setPropertyValue( "Filter", "\"City\" = :city" );
-
- m_rowSetProperties.setPropertyValue( "ApplyFilter", new Boolean( true ) );
- verifyParameters( new String[] { "city" }, "testParametersInFilter" );
-
- m_rowSetProperties.setPropertyValue( "ApplyFilter", new Boolean( false ) );
- verifyParameters( new String[] {}, "testParametersInFilter" );
+ createRowSet("SELECT * FROM \"customers\"", CommandType.COMMAND, false);
+ m_rowSetProperties.setPropertyValue("Filter", "\"City\" = :city");
+
+ m_rowSetProperties.setPropertyValue("ApplyFilter", Boolean.TRUE);
+ verifyParameters(new String[]
+ {
+ "city"
+ }, "testParametersInFilter");
+
+ m_rowSetProperties.setPropertyValue("ApplyFilter", Boolean.FALSE);
+ verifyParameters(new String[]
+ {
+ }, "testParametersInFilter");
}
- catch( AssureException e ) { throw e; }
- catch( Exception e )
+ catch (Exception e)
{
- assure( "testing the parameters within a WHERE clause failed" + e.getMessage(), false );
+ assure("testing the parameters within a WHERE clause failed" + e.getMessage(), false);
}
}
@@ -940,8 +1020,8 @@ public class RowSet extends ComplexTestCase {
*/
public void testParameters()
{
- createTestCase( false );
- // use an own RowSet instance, not the one which is also used for the other cases
+ createTestCase(false);
+ // use an own RowSet instance, not the one which is also used for the other cases
testTableParameters();
testParametrizedQuery();
@@ -950,6 +1030,6 @@ public class RowSet extends ComplexTestCase {
testParametersAfterNormalExecute();
testParametersInteraction();
- }
+ }
}
diff --git a/dbaccess/qa/complex/dbaccess/RowSetEventListener.java b/dbaccess/qa/complex/dbaccess/RowSetEventListener.java
index 774947ecc2dc..91c742321534 100644
--- a/dbaccess/qa/complex/dbaccess/RowSetEventListener.java
+++ b/dbaccess/qa/complex/dbaccess/RowSetEventListener.java
@@ -48,12 +48,10 @@ public class RowSetEventListener implements XRowSetApproveListener,XRowSetListen
public static final int ROW_COUNT = 7;
public static final int IS_ROW_COUNT_FINAL = 8;
- RowSet rowset;
int callPos = 1;
int calling [];
- RowSetEventListener(RowSet _rowset){
- rowset = _rowset;
+ RowSetEventListener(){
calling = new int [9];
clearCalling();
}
@@ -100,15 +98,15 @@ public class RowSetEventListener implements XRowSetApproveListener,XRowSetListen
}
public void propertyChange(com.sun.star.beans.PropertyChangeEvent propertyChangeEvent) {
- if ( propertyChangeEvent.PropertyName.equals("Value") ){
+ if ( "Value".equals(propertyChangeEvent.PropertyName) ){
calling[COLUMN_VALUE] = callPos++;
- } else if ( propertyChangeEvent.PropertyName.equals("IsModified") ){
+ } else if ( "IsModified".equals(propertyChangeEvent.PropertyName) ){
calling[IS_MODIFIED] = callPos++;
- } else if ( propertyChangeEvent.PropertyName.equals("IsNew") ){
+ } else if ( "IsNew".equals(propertyChangeEvent.PropertyName) ){
calling[IS_NEW] = callPos++;
- } else if ( propertyChangeEvent.PropertyName.equals("RowCount") ){
+ } else if ( "RowCount".equals(propertyChangeEvent.PropertyName) ){
calling[ROW_COUNT] = callPos++;
- } else if ( propertyChangeEvent.PropertyName.equals("IsRowCountFinal") ){
+ } else if ( "IsRowCountFinal".equals(propertyChangeEvent.PropertyName) ){
calling[IS_ROW_COUNT_FINAL] = callPos++;
}
}
diff --git a/dbaccess/qa/complex/dbaccess/SingleSelectQueryComposer.java b/dbaccess/qa/complex/dbaccess/SingleSelectQueryComposer.java
index c73ce6496c88..7b0aed460dc8 100755
--- a/dbaccess/qa/complex/dbaccess/SingleSelectQueryComposer.java
+++ b/dbaccess/qa/complex/dbaccess/SingleSelectQueryComposer.java
@@ -32,36 +32,35 @@ package complex.dbaccess;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.beans.*;
import com.sun.star.sdbcx.*;
-import com.sun.star.sdbc.*;
import com.sun.star.sdb.*;
import com.sun.star.container.*;
-import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sdbc.DataType;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
-import java.util.logging.Level;
-import java.util.logging.Logger;
public class SingleSelectQueryComposer extends CRMBasedTestCase
{
- private XSingleSelectQueryComposer m_composer;
- private final String complexFilter = "( \"ID\" = 1 AND \"Postal\" = '4' )" +
- " OR ( \"ID\" = 2 AND \"Postal\" = '5' )" +
- " OR ( \"ID\" = '3' AND \"Postal\" = '6' AND \"Address\" = '7' )" +
- " OR ( \"Address\" = '8' )" +
- " OR ( \"Postal\" = '9' )";
- private final String innerProductsQuery = "products (inner)";
+ private XSingleSelectQueryComposer m_composer = null;
+ private final static String COMPLEXFILTER = "( \"ID\" = 1 AND \"Postal\" = '4' )" +
+ " OR ( \"ID\" = 2 AND \"Postal\" = '5' )" +
+ " OR ( \"ID\" = '3' AND \"Postal\" = '6' AND \"Address\" = '7' )" +
+ " OR ( \"Address\" = '8' )" +
+ " OR ( \"Postal\" = '9' )";
+ private final static String INNERPRODUCTSQUERY = "products (inner)";
// --------------------------------------------------------------------------------------------------------
public String[] getTestMethodNames()
{
- return new String[] {
- "testAttributes",
- "testSubQueries",
- "testParameters",
- "testDisjunctiveNormalForm"
- };
+ return new String[]
+ {
+ "testAttributes",
+ "testSubQueries",
+ "testParameters",
+ "testDisjunctiveNormalForm",
+ "testConditionByColumn"
+ };
}
// --------------------------------------------------------------------------------------------------------
@@ -73,7 +72,7 @@ public class SingleSelectQueryComposer extends CRMBasedTestCase
// --------------------------------------------------------------------------------------------------------
private void createQueries() throws Exception
{
- m_database.getDatabase().getDataSource().createQuery( innerProductsQuery, "SELECT * FROM \"products\"" );
+ m_database.getDatabase().getDataSource().createQuery(INNERPRODUCTSQUERY, "SELECT * FROM \"products\"");
}
// --------------------------------------------------------------------------------------------------------
@@ -88,32 +87,48 @@ public class SingleSelectQueryComposer extends CRMBasedTestCase
m_composer = createQueryComposer();
}
- catch ( Exception e )
+ catch (Exception e)
{
- assure( "caught an exception (" + e.getMessage() + ") while creating the test case", false );
+ assure("caught an exception (" + e.getMessage() + ") while creating the test case", false);
}
}
// --------------------------------------------------------------------------------------------------------
- private void checkAttributeAccess( String _attributeName, String _attributeValue )
+ private void checkAttributeAccess(String _attributeName, String _attributeValue)
{
- log.println( "setting " + _attributeName + " to " + _attributeValue );
+ log.println("setting " + _attributeName + " to " + _attributeValue);
String realValue = null;
try
{
- Class composerClass = m_composer.getClass();
- Method attributeGetter = composerClass.getMethod( "get" + _attributeName, new Class[] {} );
- Method attributeSetter = composerClass.getMethod( "set" + _attributeName, new Class[] { String.class } );
-
- attributeSetter.invoke( m_composer, new Object[] { _attributeValue } );
- realValue = (String)attributeGetter.invoke( m_composer, new Object[] {} );
+ final Class composerClass = m_composer.getClass();
+ final Method attributeGetter = composerClass.getMethod("get" + _attributeName, new Class[]
+ {
+ });
+ final Method attributeSetter = composerClass.getMethod("set" + _attributeName, new Class[]
+ {
+ String.class
+ });
+
+ attributeSetter.invoke(m_composer, new Object[]
+ {
+ _attributeValue
+ });
+ realValue = (String) attributeGetter.invoke(m_composer, new Object[]
+ {
+ });
+ }
+ catch (NoSuchMethodException e)
+ {
+ }
+ catch (IllegalAccessException e)
+ {
+ }
+ catch (InvocationTargetException e)
+ {
}
- catch ( NoSuchMethodException e ) { }
- catch ( IllegalAccessException e ) { }
- catch ( InvocationTargetException e ) { }
- assure( "set/get" + _attributeName + " not working as expected (set: " + _attributeValue + ", get: " + ( realValue != null ? realValue : "null" ) + ")",
- realValue.equals( _attributeValue ) );
- log.println( " (results in " + (String)m_composer.getQuery() + ")" );
+ assure("set/get" + _attributeName + " not working as expected (set: " + _attributeValue + ", get: " + (realValue != null ? realValue : "null") + ")",
+ realValue.equals(_attributeValue));
+ log.println(" (results in " + (String) m_composer.getQuery() + ")");
}
/** tests accessing attributes of the composer (order, filter, group by, having)
@@ -124,48 +139,47 @@ public class SingleSelectQueryComposer extends CRMBasedTestCase
try
{
- log.println("check setQuery");
- final String simpleQuery = "SELECT * FROM \"customers\"";
- m_composer.setQuery( simpleQuery );
- assure( "set/getQuery inconsistent", m_composer.getQuery().equals( simpleQuery ) );
-
- checkAttributeAccess( "Filter", "\"Name\" = 'oranges'" );
- checkAttributeAccess( "Group", "\"City\"" );
- checkAttributeAccess( "Order", "\"Address\"" );
- checkAttributeAccess( "HavingClause", "\"ID\" <> 4" );
-
- XIndexAccess orderColumns = m_composer.getOrderColumns();
- assure( "Order columns doesn't exist: \"Address\"",
- orderColumns != null && orderColumns.getCount() == 1 && orderColumns.getByIndex(0) != null );
-
- XIndexAccess groupColumns = m_composer.getGroupColumns();
- assure( "Group columns doesn't exist: \"City\"",
- groupColumns != null && groupColumns.getCount() == 1 && groupColumns.getByIndex(0) != null );
-
- // XColumnsSupplier
- XColumnsSupplier xSelectColumns = (XColumnsSupplier)
- UnoRuntime.queryInterface(XColumnsSupplier.class,m_composer);
- assure( "no select columns, or wrong number of select columns",
- xSelectColumns != null && xSelectColumns.getColumns() != null && xSelectColumns.getColumns().getElementNames().length == 5 );
-
- // structured filter
- m_composer.setQuery("SELECT \"ID\", \"Postal\", \"Address\" FROM \"customers\"");
- m_composer.setFilter(complexFilter);
- PropertyValue[][] aStructuredFilter = m_composer.getStructuredFilter();
- m_composer.setFilter("");
- m_composer.setStructuredFilter(aStructuredFilter);
- assure("Structured Filter not identical" , m_composer.getFilter().equals(complexFilter));
-
- // structured having clause
- m_composer.setHavingClause(complexFilter);
- PropertyValue[][] aStructuredHaving = m_composer.getStructuredHavingClause();
- m_composer.setHavingClause("");
- m_composer.setStructuredHavingClause(aStructuredHaving);
- assure("Structured Having Clause not identical" , m_composer.getHavingClause().equals(complexFilter));
- }
- catch(Exception e)
+ log.println("check setQuery");
+ final String simpleQuery = "SELECT * FROM \"customers\"";
+ m_composer.setQuery(simpleQuery);
+ assure("set/getQuery inconsistent", m_composer.getQuery().equals(simpleQuery));
+
+ checkAttributeAccess("Filter", "\"Name\" = 'oranges'");
+ checkAttributeAccess("Group", "\"City\"");
+ checkAttributeAccess("Order", "\"Address\"");
+ checkAttributeAccess("HavingClause", "\"ID\" <> 4");
+
+ final XIndexAccess orderColumns = m_composer.getOrderColumns();
+ assure("Order columns doesn't exist: \"Address\"",
+ orderColumns != null && orderColumns.getCount() == 1 && orderColumns.getByIndex(0) != null);
+
+ final XIndexAccess groupColumns = m_composer.getGroupColumns();
+ assure("Group columns doesn't exist: \"City\"",
+ groupColumns != null && groupColumns.getCount() == 1 && groupColumns.getByIndex(0) != null);
+
+ // XColumnsSupplier
+ final XColumnsSupplier xSelectColumns = (XColumnsSupplier) UnoRuntime.queryInterface(XColumnsSupplier.class, m_composer);
+ assure("no select columns, or wrong number of select columns",
+ xSelectColumns != null && xSelectColumns.getColumns() != null && xSelectColumns.getColumns().getElementNames().length == 6);
+
+ // structured filter
+ m_composer.setQuery("SELECT \"ID\", \"Postal\", \"Address\" FROM \"customers\"");
+ m_composer.setFilter(COMPLEXFILTER);
+ final PropertyValue[][] aStructuredFilter = m_composer.getStructuredFilter();
+ m_composer.setFilter("");
+ m_composer.setStructuredFilter(aStructuredFilter);
+ assure("Structured Filter not identical", m_composer.getFilter().equals(COMPLEXFILTER));
+
+ // structured having clause
+ m_composer.setHavingClause(COMPLEXFILTER);
+ final PropertyValue[][] aStructuredHaving = m_composer.getStructuredHavingClause();
+ m_composer.setHavingClause("");
+ m_composer.setStructuredHavingClause(aStructuredHaving);
+ assure("Structured Having Clause not identical", m_composer.getHavingClause().equals(COMPLEXFILTER));
+ }
+ catch (Exception e)
{
- assure("Exception caught: " + e,false);
+ assure("Exception caught: " + e, false);
}
}
@@ -173,18 +187,17 @@ public class SingleSelectQueryComposer extends CRMBasedTestCase
*/
public void testSubQueries() throws Exception
{
- m_composer.setQuery( "SELECT * from \"" + innerProductsQuery + "\"" );
- final XTablesSupplier suppTables = (XTablesSupplier)UnoRuntime.queryInterface(
- XTablesSupplier.class, m_composer );
+ m_composer.setQuery("SELECT * from \"" + INNERPRODUCTSQUERY + "\"");
+ final XTablesSupplier suppTables = (XTablesSupplier) UnoRuntime.queryInterface(
+ XTablesSupplier.class, m_composer);
final XNameAccess tables = suppTables.getTables();
- assure( "a simple SELECT * FROM <query> could not be parsed",
- tables != null && tables.hasByName( innerProductsQuery ) );
+ assure("a simple SELECT * FROM <query> could not be parsed",
+ tables != null && tables.hasByName(INNERPRODUCTSQUERY));
- final String sInnerCommand = m_database.getDatabase().getDataSource().getQueryDefinition( innerProductsQuery ).getCommand();
+ final String sInnerCommand = m_database.getDatabase().getDataSource().getQueryDefinition(INNERPRODUCTSQUERY).getCommand();
final String sExecutableQuery = m_composer.getQueryWithSubstitution();
- assure( "simple query containing a sub query improperly parsed to SDBC level statement: \n1. " + sExecutableQuery
- + "\n2. " + "SELECT * FROM ( " + sInnerCommand + " ) AS \"" + innerProductsQuery + "\"",
- sExecutableQuery.equals( "SELECT * FROM ( " + sInnerCommand + " ) AS \"" + innerProductsQuery + "\"") );
+ assure("simple query containing a sub query improperly parsed to SDBC level statement: \n1. " + sExecutableQuery + "\n2. " + "SELECT * FROM ( " + sInnerCommand + " ) AS \"" + INNERPRODUCTSQUERY + "\"",
+ sExecutableQuery.equals("SELECT * FROM ( " + sInnerCommand + " ) AS \"" + INNERPRODUCTSQUERY + "\""));
}
/** tests the XParametersSupplier functionality
@@ -194,60 +207,95 @@ public class SingleSelectQueryComposer extends CRMBasedTestCase
try
{
// "orders for customers" is a query with a named parameter (based on another query)
- m_database.getDatabase().getDataSource().createQuery( "orders for customer", "SELECT * FROM \"all orders\" WHERE \"Customer Name\" LIKE :cname" );
+ m_database.getDatabase().getDataSource().createQuery("orders for customer", "SELECT * FROM \"all orders\" WHERE \"Customer Name\" LIKE :cname");
// "orders for customer and product" is query based on "orders for customers", adding an additional,
// anonymous parameter
- m_database.getDatabase().getDataSource().createQuery( "orders for customer and product", "SELECT * FROM \"orders for customer\" WHERE \"Product Name\" LIKE ?" );
+ m_database.getDatabase().getDataSource().createQuery("orders for customer and product", "SELECT * FROM \"orders for customer\" WHERE \"Product Name\" LIKE ?");
- m_composer.setQuery( m_database.getDatabase().getDataSource().getQueryDefinition( "orders for customer and product" ).getCommand() );
- XParametersSupplier suppParams = (XParametersSupplier)UnoRuntime.queryInterface(
- XParametersSupplier.class, m_composer );
- XIndexAccess parameters = suppParams.getParameters();
+ m_composer.setQuery(m_database.getDatabase().getDataSource().getQueryDefinition("orders for customer and product").getCommand());
+ final XParametersSupplier suppParams = (XParametersSupplier) UnoRuntime.queryInterface(
+ XParametersSupplier.class, m_composer);
+ final XIndexAccess parameters = suppParams.getParameters();
- String expectedParamNames[] = {
+ final String expectedParamNames[] =
+ {
"cname",
"Product Name"
};
- int paramCount = parameters.getCount();
- assure( "composer did find wrong number of parameters in the nested queries.",
- paramCount == expectedParamNames.length );
+ final int paramCount = parameters.getCount();
+ assure("composer did find wrong number of parameters in the nested queries.",
+ paramCount == expectedParamNames.length);
- for ( int i = 0; i < paramCount; ++i )
+ for (int i = 0; i < paramCount; ++i)
{
- XPropertySet parameter = (XPropertySet)UnoRuntime.queryInterface(
- XPropertySet.class, parameters.getByIndex(i) );
- String paramName = (String)parameter.getPropertyValue( "Name" );
- assure( "wrong parameter name at position " + ( i + 1 ) + " (expected: " + expectedParamNames[i] + ", found: " + paramName + ")",
- paramName.equals( expectedParamNames[i] ) );
+ final XPropertySet parameter = (XPropertySet) UnoRuntime.queryInterface(
+ XPropertySet.class, parameters.getByIndex(i));
+ final String paramName = (String) parameter.getPropertyValue("Name");
+ assure("wrong parameter name at position " + (i + 1) + " (expected: " + expectedParamNames[i] + ", found: " + paramName + ")",
+ paramName.equals(expectedParamNames[i]));
}
}
- catch( Exception e )
+ catch (Exception e)
{
- assure( "caught an exception: " + e, false );
+ assure("caught an exception: " + e, false);
}
}
- private void impl_testDisjunctiveNormalForm( String _query, PropertyValue[][] _expectedDNF )
+ public void testConditionByColumn()
{
- try { m_composer.setQuery( _query ); }
- catch ( Exception e )
+ try
+ {
+ m_composer.setQuery("SELECT * FROM \"customers\"");
+
+ final Object initArgs[] =
+ {
+ new NamedValue("AutomaticAddition", Boolean.valueOf(true))
+ };
+ final String serviceName = "com.sun.star.beans.PropertyBag";
+ final XPropertyContainer filter = (XPropertyContainer) UnoRuntime.queryInterface(XPropertyContainer.class,
+ getORB().createInstanceWithArguments(serviceName, initArgs));
+ filter.addProperty("Name", PropertyAttribute.MAYBEVOID, "Comment");
+ filter.addProperty("RealName", PropertyAttribute.MAYBEVOID, "Comment");
+ filter.addProperty("TableName", PropertyAttribute.MAYBEVOID, "customers");
+ filter.addProperty("Value", PropertyAttribute.MAYBEVOID, "Good one.");
+ filter.addProperty("Type", PropertyAttribute.MAYBEVOID, Integer.valueOf(DataType.LONGVARCHAR));
+ final XPropertySet column = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,filter);
+
+ m_composer.appendFilterByColumn(column, true);
+ assure("At least one row should exist",m_database.getConnection().createStatement().executeQuery(m_composer.getQuery()).next());
+
+ }
+ catch (Exception e)
+ {
+ // this is an error: the query is expected to be parseable
+ assure("caught an exception: " + e, false);
+ }
+ }
+
+ private void impl_testDisjunctiveNormalForm(String _query, PropertyValue[][] _expectedDNF)
+ {
+ try
+ {
+ m_composer.setQuery(_query);
+ }
+ catch (Exception e)
{
// this is an error: the query is expected to be parseable
- assure( "caught an exception: " + e, false );
+ assure("caught an exception: " + e, false);
}
- PropertyValue[][] disjunctiveNormalForm = m_composer.getStructuredFilter();
+ final PropertyValue[][] disjunctiveNormalForm = m_composer.getStructuredFilter();
- assureEquals( "DNF: wrong number of rows", _expectedDNF.length, disjunctiveNormalForm.length );
- for ( int i=0; i<_expectedDNF.length; ++i )
+ assureEquals("DNF: wrong number of rows", _expectedDNF.length, disjunctiveNormalForm.length);
+ for (int i = 0; i < _expectedDNF.length; ++i)
{
- assureEquals( "DNF: wrong number of columns in row " + i, _expectedDNF[i].length, disjunctiveNormalForm[i].length );
- for ( int j=0; j<_expectedDNF[i].length; ++j )
+ assureEquals("DNF: wrong number of columns in row " + i, _expectedDNF[i].length, disjunctiveNormalForm[i].length);
+ for (int j = 0; j < _expectedDNF[i].length; ++j)
{
- assureEquals( "DNF: wrong content in column " + j + ", row " + i,
- _expectedDNF[i][j].Name, disjunctiveNormalForm[i][j].Name );
+ assureEquals("DNF: wrong content in column " + j + ", row " + i,
+ _expectedDNF[i][j].Name, disjunctiveNormalForm[i][j].Name);
}
}
}
@@ -259,56 +307,61 @@ public class SingleSelectQueryComposer extends CRMBasedTestCase
{
// a simple case: WHERE clause simply is a combination of predicates knitted with AND
String query =
- "SELECT \"customers\".\"Name\", " +
- "\"customers\".\"Address\", " +
- "\"customers\".\"City\", " +
- "\"customers\".\"Postal\", " +
- "\"products\".\"Name\" " +
- "FROM \"orders\", \"customers\", \"orders_details\", \"products\" " +
- "WHERE ( \"orders\".\"CustomerID\" = \"customers\".\"ID\" " +
- "AND \"orders_details\".\"OrderID\" = \"orders\".\"ID\" " +
- "AND \"orders_details\".\"ProductID\" = \"products\".\"ID\" " +
- ") ";
-
- impl_testDisjunctiveNormalForm( query, new PropertyValue[][] {
- new PropertyValue[] {
- new PropertyValue( "CustomerID", SQLFilterOperator.EQUAL, "\"customers\".\"ID\"", PropertyState.DIRECT_VALUE ),
- new PropertyValue( "OrderID", SQLFilterOperator.EQUAL, "\"orders\".\"ID\"", PropertyState.DIRECT_VALUE ),
- new PropertyValue( "ProductID", SQLFilterOperator.EQUAL, "\"products\".\"ID\"", PropertyState.DIRECT_VALUE )
- } }
- );
+ "SELECT \"customers\".\"Name\", " +
+ "\"customers\".\"Address\", " +
+ "\"customers\".\"City\", " +
+ "\"customers\".\"Postal\", " +
+ "\"products\".\"Name\" " +
+ "FROM \"orders\", \"customers\", \"orders_details\", \"products\" " +
+ "WHERE ( \"orders\".\"CustomerID\" = \"customers\".\"ID\" " +
+ "AND \"orders_details\".\"OrderID\" = \"orders\".\"ID\" " +
+ "AND \"orders_details\".\"ProductID\" = \"products\".\"ID\" " +
+ ") ";
+
+ impl_testDisjunctiveNormalForm(query, new PropertyValue[][]
+ {
+ new PropertyValue[]
+ {
+ new PropertyValue("CustomerID", SQLFilterOperator.EQUAL, "\"customers\".\"ID\"", PropertyState.DIRECT_VALUE),
+ new PropertyValue("OrderID", SQLFilterOperator.EQUAL, "\"orders\".\"ID\"", PropertyState.DIRECT_VALUE),
+ new PropertyValue("ProductID", SQLFilterOperator.EQUAL, "\"products\".\"ID\"", PropertyState.DIRECT_VALUE)
+ }
+ });
// somewhat more challenging: One of the conjunction terms is a disjunction itself
query =
- "SELECT \"customers\".\"Name\", " +
- "\"customers\".\"Address\", " +
- "\"customers\".\"City\", " +
- "\"customers\".\"Postal\", " +
- "\"products\".\"Name\" " +
- "FROM \"orders\", \"customers\", \"orders_details\", \"products\" " +
- "WHERE ( \"orders\".\"CustomerID\" = \"customers\".\"ID\" " +
- "AND \"orders_details\".\"OrderID\" = \"orders\".\"ID\" " +
- "AND \"orders_details\".\"ProductID\" = \"products\".\"ID\" " +
- ") " +
- "AND " +
- "( \"products\".\"Name\" = 'Apples' " +
- "OR \"products\".\"ID\" = 2 " +
- ")";
-
- impl_testDisjunctiveNormalForm( query, new PropertyValue[][] {
- new PropertyValue[] {
- new PropertyValue( "CustomerID", SQLFilterOperator.EQUAL, "\"customers\".\"ID\"", PropertyState.DIRECT_VALUE ),
- new PropertyValue( "OrderID", SQLFilterOperator.EQUAL, "\"orders\".\"ID\"", PropertyState.DIRECT_VALUE ),
- new PropertyValue( "ProductID", SQLFilterOperator.EQUAL, "\"products\".\"ID\"", PropertyState.DIRECT_VALUE ),
- new PropertyValue( "Name", SQLFilterOperator.EQUAL, "Apples", PropertyState.DIRECT_VALUE )
- },
- new PropertyValue[] {
- new PropertyValue( "CustomerID", SQLFilterOperator.EQUAL, "\"customers\".\"ID\"", PropertyState.DIRECT_VALUE ),
- new PropertyValue( "OrderID", SQLFilterOperator.EQUAL, "\"orders\".\"ID\"", PropertyState.DIRECT_VALUE ),
- new PropertyValue( "ProductID", SQLFilterOperator.EQUAL, "\"products\".\"ID\"", PropertyState.DIRECT_VALUE ),
- new PropertyValue( "ID", SQLFilterOperator.EQUAL, new Integer(2), PropertyState.DIRECT_VALUE )
- } }
- );
+ "SELECT \"customers\".\"Name\", " +
+ "\"customers\".\"Address\", " +
+ "\"customers\".\"City\", " +
+ "\"customers\".\"Postal\", " +
+ "\"products\".\"Name\" " +
+ "FROM \"orders\", \"customers\", \"orders_details\", \"products\" " +
+ "WHERE ( \"orders\".\"CustomerID\" = \"customers\".\"ID\" " +
+ "AND \"orders_details\".\"OrderID\" = \"orders\".\"ID\" " +
+ "AND \"orders_details\".\"ProductID\" = \"products\".\"ID\" " +
+ ") " +
+ "AND " +
+ "( \"products\".\"Name\" = 'Apples' " +
+ "OR \"products\".\"ID\" = 2 " +
+ ")";
+
+ impl_testDisjunctiveNormalForm(query, new PropertyValue[][]
+ {
+ new PropertyValue[]
+ {
+ new PropertyValue("CustomerID", SQLFilterOperator.EQUAL, "\"customers\".\"ID\"", PropertyState.DIRECT_VALUE),
+ new PropertyValue("OrderID", SQLFilterOperator.EQUAL, "\"orders\".\"ID\"", PropertyState.DIRECT_VALUE),
+ new PropertyValue("ProductID", SQLFilterOperator.EQUAL, "\"products\".\"ID\"", PropertyState.DIRECT_VALUE),
+ new PropertyValue("Name", SQLFilterOperator.EQUAL, "Apples", PropertyState.DIRECT_VALUE)
+ },
+ new PropertyValue[]
+ {
+ new PropertyValue("CustomerID", SQLFilterOperator.EQUAL, "\"customers\".\"ID\"", PropertyState.DIRECT_VALUE),
+ new PropertyValue("OrderID", SQLFilterOperator.EQUAL, "\"orders\".\"ID\"", PropertyState.DIRECT_VALUE),
+ new PropertyValue("ProductID", SQLFilterOperator.EQUAL, "\"products\".\"ID\"", PropertyState.DIRECT_VALUE),
+ new PropertyValue("ID", SQLFilterOperator.EQUAL, Integer.valueOf(2), PropertyState.DIRECT_VALUE)
+ }
+ });
}
}
diff --git a/dbaccess/qa/complex/dbaccess/TestCase.java b/dbaccess/qa/complex/dbaccess/TestCase.java
index fddf055b011e..89b1f9ede56b 100644
--- a/dbaccess/qa/complex/dbaccess/TestCase.java
+++ b/dbaccess/qa/complex/dbaccess/TestCase.java
@@ -55,7 +55,7 @@ public abstract class TestCase extends complexlib.ComplexTestCase
XComponentContext context = null;
try
{
- XPropertySet orbProps = (XPropertySet) UnoRuntime.queryInterface( XPropertySet.class, getORB() );
+ final XPropertySet orbProps = (XPropertySet) UnoRuntime.queryInterface( XPropertySet.class, getORB() );
context = (XComponentContext)UnoRuntime.queryInterface( XComponentContext.class,
orbProps.getPropertyValue( "DefaultContext" ) );
}
@@ -84,9 +84,9 @@ public abstract class TestCase extends complexlib.ComplexTestCase
*/
protected final String createTempFileURL() throws IOException
{
- File documentFile = java.io.File.createTempFile( getTestObjectName(), ".odb" );
+ final File documentFile = java.io.File.createTempFile( getTestObjectName(), ".odb" );
documentFile.deleteOnExit();
- return documentFile.getAbsoluteFile().toURL().toString();
+ return documentFile.getAbsoluteFile().toURI().toURL().toString();
}
// --------------------------------------------------------------------------------------------------------
@@ -97,7 +97,7 @@ public abstract class TestCase extends complexlib.ComplexTestCase
*/
protected final String copyToTempFile( String _sourceURL ) throws IOException
{
- String targetURL = createTempFileURL();
+ final String targetURL = createTempFileURL();
try
{
FileTools.copyFile( new File( new URI( _sourceURL ) ), new File( new URI( targetURL ) ) );
diff --git a/dbaccess/qa/complex/dbaccess/UISettings.java b/dbaccess/qa/complex/dbaccess/UISettings.java
index a755b39aa63c..23fe10618810 100644
--- a/dbaccess/qa/complex/dbaccess/UISettings.java
+++ b/dbaccess/qa/complex/dbaccess/UISettings.java
@@ -39,9 +39,6 @@ import com.sun.star.lang.XComponent;
import com.sun.star.sdb.application.XDatabaseDocumentUI;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.util.XCloseable;
-import helper.URLHelper;
-import java.io.File;
-import java.net.URI;
public class UISettings extends TestCase
{
@@ -64,11 +61,11 @@ public class UISettings extends TestCase
*/
public void checkTableFormattingPersistence() throws java.lang.Exception
{
- CRMDatabase database = new CRMDatabase( getORB() );
+ final CRMDatabase database = new CRMDatabase( getORB() );
// load the document
String docURL = database.getDatabase().getDocumentURL();
- XComponentLoader loader = (XComponentLoader)UnoRuntime.queryInterface( XComponentLoader.class,
+ final XComponentLoader loader = (XComponentLoader)UnoRuntime.queryInterface( XComponentLoader.class,
getORB().createInstance( "com.sun.star.frame.Desktop" ) );
XModel doc = (XModel)UnoRuntime.queryInterface( XModel.class,
loader.loadComponentFromURL( docURL, "_blank", 0, new PropertyValue[] {} ) );
@@ -87,7 +84,7 @@ public class UISettings extends TestCase
// change the table's formatting
tableControlModel.setPropertyValue( "FontName", "Andale Sans UI" );
- tableControlModel.setPropertyValue( "FontHeight", new Float( 20 ) );
+ tableControlModel.setPropertyValue( "FontHeight", Float.valueOf( 20 ) );
tableControlModel.setPropertyValue( "FontSlant", FontSlant.ITALIC );
// close the table
@@ -126,7 +123,7 @@ public class UISettings extends TestCase
// close the doc
docUI.closeSubComponents();
- XCloseable closeDoc = (XCloseable)UnoRuntime.queryInterface( XCloseable.class,
+ final XCloseable closeDoc = (XCloseable)UnoRuntime.queryInterface( XCloseable.class,
doc );
closeDoc.close( true );
}
diff --git a/dbaccess/qa/complex/dbaccess/dbaccess.sce b/dbaccess/qa/complex/dbaccess/dbaccess.sce
index 9b17f0cd9f84..c5fa408ff273 100644
--- a/dbaccess/qa/complex/dbaccess/dbaccess.sce
+++ b/dbaccess/qa/complex/dbaccess/dbaccess.sce
@@ -7,4 +7,6 @@
-o complex.dbaccess.DataSource
-o complex.dbaccess.Parser
-o complex.dbaccess.ApplicationController
+-o complex.dbaccess.CopyTableWizard
-o complex.dbaccess.UISettings
+-o complex.dbaccess.Beamer
diff --git a/dbaccess/source/core/api/BookmarkSet.cxx b/dbaccess/source/core/api/BookmarkSet.cxx
index f04638724957..63d287df08bd 100644
--- a/dbaccess/source/core/api/BookmarkSet.cxx
+++ b/dbaccess/source/core/api/BookmarkSet.cxx
@@ -129,7 +129,8 @@ void SAL_CALL OBookmarkSet::insertRow( const ORowSetRow& _rInsertRow,const conne
{
xUpd->moveToInsertRow();
sal_Int32 i = 1;
- for(connectivity::ORowVector< ORowSetValue > ::Vector::iterator aIter = _rInsertRow->get().begin()+1;aIter != _rInsertRow->get().end();++aIter,++i)
+ connectivity::ORowVector< ORowSetValue > ::Vector::iterator aEnd = _rInsertRow->get().end();
+ for(connectivity::ORowVector< ORowSetValue > ::Vector::iterator aIter = _rInsertRow->get().begin()+1;aIter != aEnd;++aIter,++i)
{
aIter->setSigned(m_aSignedFlags[i-1]);
updateColumn(i,xUpdRow,*aIter);
@@ -151,7 +152,8 @@ void SAL_CALL OBookmarkSet::updateRow(const ORowSetRow& _rInsertRow ,const ORowS
sal_Int32 i = 1;
connectivity::ORowVector< ORowSetValue > ::Vector::const_iterator aOrgIter = _rOrginalRow->get().begin()+1;
- for(connectivity::ORowVector< ORowSetValue > ::Vector::iterator aIter = _rInsertRow->get().begin()+1;aIter != _rInsertRow->get().end();++aIter,++i,++aOrgIter)
+ connectivity::ORowVector< ORowSetValue > ::Vector::iterator aEnd = _rInsertRow->get().end();
+ for(connectivity::ORowVector< ORowSetValue > ::Vector::iterator aIter = _rInsertRow->get().begin()+1;aIter != aEnd;++aIter,++i,++aOrgIter)
{
aIter->setSigned(aOrgIter->isSigned());
updateColumn(i,xUpdRow,*aIter);
diff --git a/dbaccess/source/core/api/CacheSet.cxx b/dbaccess/source/core/api/CacheSet.cxx
index ce21ca9402df..bbb080a52238 100644
--- a/dbaccess/source/core/api/CacheSet.cxx
+++ b/dbaccess/source/core/api/CacheSet.cxx
@@ -88,6 +88,7 @@
#ifndef _TOOLS_DEBUG_HXX
#include <tools/debug.hxx>
#endif
+#include <rtl/ustrbuf.hxx>
#include <rtl/logfile.hxx>
using namespace comphelper;
@@ -205,36 +206,37 @@ void OCacheSet::fillTableName(const Reference<XPropertySet>& _xTable) throw(SQL
void SAL_CALL OCacheSet::insertRow( const ORowSetRow& _rInsertRow,const connectivity::OSQLTable& _xTable ) throw(SQLException, RuntimeException)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::insertRow" );
- ::rtl::OUString aSql(::rtl::OUString::createFromAscii("INSERT INTO "));
+ ::rtl::OUStringBuffer aSql(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("INSERT INTO ")));
Reference<XPropertySet> xSet(_xTable,UNO_QUERY);
fillTableName(xSet);
- aSql += m_aComposedTableName;
- aSql += ::rtl::OUString::createFromAscii(" ( ");
+ aSql.append(m_aComposedTableName);
+ aSql.append(::rtl::OUString::createFromAscii(" ( "));
// set values and column names
- ::rtl::OUString aValues = ::rtl::OUString::createFromAscii(" VALUES ( ");
- static ::rtl::OUString aPara = ::rtl::OUString::createFromAscii("?,");
+ ::rtl::OUStringBuffer aValues = ::rtl::OUString::createFromAscii(" VALUES ( ");
+ static ::rtl::OUString aPara(RTL_CONSTASCII_USTRINGPARAM("?,"));
::rtl::OUString aQuote = getIdentifierQuoteString();
- static ::rtl::OUString aComma = ::rtl::OUString::createFromAscii(",");
+ static ::rtl::OUString aComma(RTL_CONSTASCII_USTRINGPARAM(","));
sal_Int32 i = 1;
ORowVector< ORowSetValue >::Vector::const_iterator aIter = _rInsertRow->get().begin()+1;
- for(; aIter != _rInsertRow->get().end();++aIter)
+ connectivity::ORowVector< ORowSetValue > ::Vector::iterator aEnd = _rInsertRow->get().end();
+ for(; aIter != aEnd;++aIter)
{
- aSql += ::dbtools::quoteName( aQuote,m_xSetMetaData->getColumnName(i++));
- aSql += aComma;
- aValues += aPara;
+ aSql.append(::dbtools::quoteName( aQuote,m_xSetMetaData->getColumnName(i++)));
+ aSql.append(aComma);
+ aValues.append(aPara);
}
- aSql = aSql.replaceAt(aSql.getLength()-1,1,::rtl::OUString::createFromAscii(")"));
- aValues = aValues.replaceAt(aValues.getLength()-1,1,::rtl::OUString::createFromAscii(")"));
+ aSql.setCharAt(aSql.getLength()-1,')');
+ aValues.setCharAt(aValues.getLength()-1,')');
- aSql += aValues;
+ aSql.append(aValues.makeStringAndClear());
// now create end execute the prepared statement
{
- Reference< XPreparedStatement > xPrep(m_xConnection->prepareStatement(aSql));
+ Reference< XPreparedStatement > xPrep(m_xConnection->prepareStatement(aSql.makeStringAndClear()));
Reference< XParameters > xParameter(xPrep,UNO_QUERY);
i = 1;
- for(aIter = _rInsertRow->get().begin()+1; aIter != _rInsertRow->get().end();++aIter,++i)
+ for(aIter = _rInsertRow->get().begin()+1; aIter != aEnd;++aIter,++i)
{
if(aIter->isNull())
xParameter->setNull(i,aIter->getTypeKind());
@@ -265,8 +267,8 @@ void SAL_CALL OCacheSet::insertRow( const ORowSetRow& _rInsertRow,const connecti
// -------------------------------------------------------------------------
void OCacheSet::fillParameters( const ORowSetRow& _rRow
,const connectivity::OSQLTable& _xTable
- ,::rtl::OUString& _sCondition
- ,::rtl::OUString& _sParameter
+ ,::rtl::OUStringBuffer& _sCondition
+ ,::rtl::OUStringBuffer& _sParameter
,::std::list< sal_Int32>& _rOrgValues)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::fillParameters" );
@@ -330,6 +332,9 @@ void OCacheSet::fillParameters( const ORowSetRow& _rRow
sal_Int32 nCheckCount = 1; // index for the orginal values
sal_Int32 i = 1;
+
+ ::rtl::OUString sIsNull(RTL_CONSTASCII_USTRINGPARAM(" IS NULL"));
+ ::rtl::OUString sParam(RTL_CONSTASCII_USTRINGPARAM(" = ?"));
ORowVector< ORowSetValue >::Vector::const_iterator aIter = _rRow->get().begin()+1;
ORowVector< ORowSetValue >::Vector::const_iterator aEnd = _rRow->get().end()+1;
for(; aIter != aEnd;++aIter,++nCheckCount,++i)
@@ -337,34 +342,35 @@ void OCacheSet::fillParameters( const ORowSetRow& _rRow
aColumnName = m_xSetMetaData->getColumnName(i);
if(xKeyColumns.is() && xKeyColumns->hasByName(aColumnName))
{
- _sCondition += ::dbtools::quoteName( aQuote,aColumnName);
+ _sCondition.append(::dbtools::quoteName( aQuote,aColumnName));
if(aIter->isNull())
- _sCondition += ::rtl::OUString::createFromAscii(" IS NULL");
+ _sCondition.append(sIsNull);
else
- _sCondition += ::rtl::OUString::createFromAscii(" = ?");
- _sCondition += aAnd;
+ _sCondition.append(sParam);
+ _sCondition.append(aAnd);
_rOrgValues.push_back(nCheckCount);
- }
+ } // if(xKeyColumns.is() && xKeyColumns->hasByName(aColumnName))
+ ::std::vector< Reference<XNameAccess> >::const_iterator aIndexEnd = aAllIndexColumns.end();
for( ::std::vector< Reference<XNameAccess> >::const_iterator aIndexIter = aAllIndexColumns.begin();
- aIndexIter != aAllIndexColumns.end();++aIndexIter)
+ aIndexIter != aIndexEnd;++aIndexIter)
{
if((*aIndexIter)->hasByName(aColumnName))
{
- _sCondition += ::dbtools::quoteName( aQuote,aColumnName);
+ _sCondition.append(::dbtools::quoteName( aQuote,aColumnName));
if(aIter->isNull())
- _sCondition += ::rtl::OUString::createFromAscii(" IS NULL");
+ _sCondition.append(sIsNull);
else
- _sCondition += ::rtl::OUString::createFromAscii(" = ?");
- _sCondition += aAnd;
+ _sCondition.append(sParam);
+ _sCondition.append(aAnd);
_rOrgValues.push_back(nCheckCount);
break;
}
}
if(aIter->isModified())
{
- _sParameter += ::dbtools::quoteName( aQuote,aColumnName);
- _sParameter += aPara;
+ _sParameter.append(::dbtools::quoteName( aQuote,aColumnName));
+ _sParameter.append(aPara);
}
}
}
@@ -375,39 +381,41 @@ void SAL_CALL OCacheSet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetR
Reference<XPropertySet> xSet(_xTable,UNO_QUERY);
fillTableName(xSet);
- ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("UPDATE ");
- aSql += m_aComposedTableName;
- aSql += ::rtl::OUString::createFromAscii(" SET ");
+ ::rtl::OUStringBuffer aSql = ::rtl::OUString::createFromAscii("UPDATE ");
+ aSql.append(m_aComposedTableName);
+ aSql.append(::rtl::OUString::createFromAscii(" SET "));
// list all cloumns that should be set
- ::rtl::OUString aCondition;
+ ::rtl::OUStringBuffer aCondition;
::std::list< sal_Int32> aOrgValues;
fillParameters(_rInsertRow,_xTable,aCondition,aSql,aOrgValues);
- aSql = aSql.replaceAt(aSql.getLength()-1,1,::rtl::OUString::createFromAscii(" "));
+ aSql.setCharAt(aSql.getLength()-1,' ');
if ( aCondition.getLength() )
{
- aCondition = aCondition.replaceAt(aCondition.getLength()-5,5,::rtl::OUString::createFromAscii(" "));
+ aCondition.setLength(aCondition.getLength()-5);
- aSql += ::rtl::OUString::createFromAscii(" WHERE ");
- aSql += aCondition;
+ aSql.append(::rtl::OUString::createFromAscii(" WHERE "));
+ aSql.append(aCondition.makeStringAndClear());
}
else
::dbtools::throwSQLException(
DBACORE_RESSTRING( RID_STR_NO_UPDATE_MISSING_CONDITION ), SQL_GENERAL_ERROR, *this );
// now create end execute the prepared statement
- Reference< XPreparedStatement > xPrep(m_xConnection->prepareStatement(aSql));
+ Reference< XPreparedStatement > xPrep(m_xConnection->prepareStatement(aSql.makeStringAndClear()));
Reference< XParameters > xParameter(xPrep,UNO_QUERY);
sal_Int32 i = 1;
- for(ORowVector< ORowSetValue >::Vector::const_iterator aIter = _rInsertRow->get().begin()+1; aIter != _rInsertRow->get().end();++aIter)
+ connectivity::ORowVector< ORowSetValue > ::Vector::iterator aEnd = _rInsertRow->get().end();
+ for(ORowVector< ORowSetValue >::Vector::const_iterator aIter = _rInsertRow->get().begin()+1; aIter != aEnd;++aIter)
{
if(aIter->isModified())
{
setParameter(i,xParameter,*aIter,m_xSetMetaData->getColumnType(i),m_xSetMetaData->getScale(i));
++i;
}
- }
- for(::std::list< sal_Int32>::const_iterator aOrgValue = aOrgValues.begin(); aOrgValue != aOrgValues.end();++aOrgValue,++i)
+ } // for(ORowVector< ORowSetValue >::Vector::const_iterator aIter = _rInsertRow->get().begin()+1; aIter != aEnd;++aIter)
+ ::std::list< sal_Int32>::const_iterator aOrgValueEnd = aOrgValues.end();
+ for(::std::list< sal_Int32>::const_iterator aOrgValue = aOrgValues.begin(); aOrgValue != aOrgValueEnd;++aOrgValue,++i)
{
setParameter(i,xParameter,(_rOrginalRow->get())[*aOrgValue],m_xSetMetaData->getColumnType(i),m_xSetMetaData->getScale(i));
}
@@ -421,9 +429,9 @@ void SAL_CALL OCacheSet::deleteRow(const ORowSetRow& _rDeleteRow ,const connecti
Reference<XPropertySet> xSet(_xTable,UNO_QUERY);
fillTableName(xSet);
- ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("DELETE FROM ");
- aSql += m_aComposedTableName;
- aSql += ::rtl::OUString::createFromAscii(" WHERE ");
+ ::rtl::OUStringBuffer aSql = ::rtl::OUString::createFromAscii("DELETE FROM ");
+ aSql.append(m_aComposedTableName);
+ aSql.append(::rtl::OUString::createFromAscii(" WHERE "));
// list all cloumns that should be set
::rtl::OUString aQuote = getIdentifierQuoteString();
@@ -480,17 +488,18 @@ void SAL_CALL OCacheSet::deleteRow(const ORowSetRow& _rDeleteRow ,const connecti
}
}
- ::rtl::OUString aColumnName;
+ ::rtl::OUStringBuffer aColumnName;
::std::list< sal_Int32> aOrgValues;
fillParameters(_rDeleteRow,_xTable,aSql,aColumnName,aOrgValues);
- aSql = aSql.replaceAt(aSql.getLength()-5,5,::rtl::OUString::createFromAscii(" "));
+ aSql.setLength(aSql.getLength()-5);
// now create end execute the prepared statement
- Reference< XPreparedStatement > xPrep(m_xConnection->prepareStatement(aSql));
+ Reference< XPreparedStatement > xPrep(m_xConnection->prepareStatement(aSql.makeStringAndClear()));
Reference< XParameters > xParameter(xPrep,UNO_QUERY);
sal_Int32 i = 1;
- for(::std::list< sal_Int32>::const_iterator j = aOrgValues.begin(); j != aOrgValues.end();++j,++i)
+ ::std::list< sal_Int32>::const_iterator aOrgValueEnd = aOrgValues.end();
+ for(::std::list< sal_Int32>::const_iterator j = aOrgValues.begin(); j != aOrgValueEnd;++j,++i)
{
setParameter(i,xParameter,(_rDeleteRow->get())[*j],m_xSetMetaData->getColumnType(i),m_xSetMetaData->getScale(i));
}
diff --git a/dbaccess/source/core/api/CacheSet.hxx b/dbaccess/source/core/api/CacheSet.hxx
index 6299c0fe2dad..057c843fe871 100644
--- a/dbaccess/source/core/api/CacheSet.hxx
+++ b/dbaccess/source/core/api/CacheSet.hxx
@@ -65,7 +65,10 @@
#endif
#include <list>
-
+namespace rtl
+{
+ class OUStringBuffer;
+}
namespace com{ namespace sun { namespace star{namespace sdbc{ class XParameters; } } } }
namespace dbaccess
@@ -98,8 +101,8 @@ namespace dbaccess
);
void fillParameters( const ORowSetRow& _rRow
,const connectivity::OSQLTable& _xTable
- ,::rtl::OUString& _sCondition
- ,::rtl::OUString& _sParameter
+ ,::rtl::OUStringBuffer& _sCondition
+ ,::rtl::OUStringBuffer& _sParameter
,::std::list< sal_Int32>& _rOrgValues);
void fillTableName(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xTable) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
diff --git a/dbaccess/source/core/api/KeySet.cxx b/dbaccess/source/core/api/KeySet.cxx
index 105443902b45..9cc2c6172cf4 100644
--- a/dbaccess/source/core/api/KeySet.cxx
+++ b/dbaccess/source/core/api/KeySet.cxx
@@ -157,8 +157,10 @@ DBG_NAME(OKeySet)
OKeySet::OKeySet(const connectivity::OSQLTable& _xTable,
const Reference< XIndexAccess>& _xTableKeys,
const ::rtl::OUString& _rUpdateTableName, // this can be the alias or the full qualified name
- const Reference< XSingleSelectQueryAnalyzer >& _xComposer)
- :m_pKeyColumnNames(NULL)
+ const Reference< XSingleSelectQueryAnalyzer >& _xComposer,
+ const ORowSetValueVector& _aParameterValueForCache)
+ :m_aParameterValueForCache(_aParameterValueForCache)
+ ,m_pKeyColumnNames(NULL)
,m_pColumnNames(NULL)
,m_pForeignColumnNames(NULL)
,m_xTable(_xTable)
@@ -213,7 +215,8 @@ void OKeySet::construct(const Reference< XResultSet>& _xDriverSet)
::dbaccess::getColumnPositions(xSup->getColumns(),xSourceColumns,m_sUpdateTableName,(*m_pColumnNames));
SelectColumnsMetaData::const_iterator aPosIter = (*m_pKeyColumnNames).begin();
- for(;aPosIter != (*m_pKeyColumnNames).end();++aPosIter)
+ SelectColumnsMetaData::const_iterator aPosEnd = (*m_pKeyColumnNames).end();
+ for(;aPosIter != aPosEnd;++aPosIter)
{
if(xSourceColumns->hasByName(aPosIter->first))
{
@@ -234,7 +237,7 @@ void OKeySet::construct(const Reference< XResultSet>& _xDriverSet)
Reference<XDatabaseMetaData> xMetaData = m_xConnection->getMetaData();
::rtl::OUString aQuote = getIdentifierQuoteString();
- ::rtl::OUString aFilter;
+ ::rtl::OUStringBuffer aFilter;
::rtl::OUString sCatalog,sSchema,sTable;
Reference<XPropertySet> xTableProp(m_xTable,UNO_QUERY);
@@ -252,16 +255,16 @@ void OKeySet::construct(const Reference< XResultSet>& _xDriverSet)
static ::rtl::OUString s_sDot(RTL_CONSTASCII_USTRINGPARAM("."));
static ::rtl::OUString s_sParam(RTL_CONSTASCII_USTRINGPARAM(" = ?"));
// create the where clause
- SelectColumnsMetaData::const_iterator aIter;
- for(aIter = (*m_pKeyColumnNames).begin();aIter != (*m_pKeyColumnNames).end();)
+ aPosEnd = (*m_pKeyColumnNames).end();
+ for(aPosIter = (*m_pKeyColumnNames).begin();aPosIter != aPosEnd;)
{
- aFilter += sComposedName;
- aFilter += s_sDot;
- aFilter += ::dbtools::quoteName( aQuote,aIter->first);
- aFilter += s_sParam;
- ++aIter;
- if(aIter != (*m_pKeyColumnNames).end())
- aFilter += aAnd;
+ aFilter.append(sComposedName);
+ aFilter.append(s_sDot);
+ aFilter.append(::dbtools::quoteName( aQuote,aPosIter->first));
+ aFilter.append(s_sParam);
+ ++aPosIter;
+ if(aPosIter != aPosEnd)
+ aFilter.append(aAnd);
}
Reference< XMultiServiceFactory > xFactory(m_xConnection, UNO_QUERY_THROW);
@@ -293,18 +296,23 @@ void OKeySet::construct(const Reference< XResultSet>& _xDriverSet)
// look for columns not in the source columns to use them as filter as well
if ( !xSourceColumns->hasByName(*pSelectColumnName) )
{
- aFilter += s_sDot;
- aFilter += ::dbtools::quoteName( aQuote,*pSelectColumnName);
- aFilter += s_sParam;
+ aFilter.append(s_sDot);
+ aFilter.append(::dbtools::quoteName( aQuote,*pSelectColumnName));
+ aFilter.append(s_sParam);
if ( (pSelectColumnName+1) != pSelectColumnEnd )
- aFilter += aAnd;
+ aFilter.append(aAnd);
}
}
break;
}
}
+ } // if ( aSeq.getLength() > 1 ) // special handling for join
+ const ::rtl::OUString sOldFilter = xAnalyzer->getFilter();
+ if ( sOldFilter.getLength() )
+ {
+ aFilter = sOldFilter + aAnd + aFilter.makeStringAndClear();
}
- xAnalyzer->setFilter(aFilter);
+ xAnalyzer->setFilter(aFilter.makeStringAndClear());
m_xStatement = m_xConnection->prepareStatement(xAnalyzer->getQueryWithSubstitution());
::comphelper::disposeComponent(xAnalyzer);
}
@@ -368,12 +376,12 @@ Sequence< sal_Int32 > SAL_CALL OKeySet::deleteRows( const Sequence< Any >& rows
Reference<XPropertySet> xSet(_xTable,UNO_QUERY);
fillTableName(xSet);
- ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("DELETE FROM ");
- aSql += m_aComposedTableName;
- aSql += ::rtl::OUString::createFromAscii(" WHERE ");
+ ::rtl::OUStringBuffer aSql = ::rtl::OUString::createFromAscii("DELETE FROM ");
+ aSql.append(m_aComposedTableName);
+ aSql.append(::rtl::OUString::createFromAscii(" WHERE "));
// list all cloumns that should be set
- ::rtl::OUString aQuote = getIdentifierQuoteString();
+ const ::rtl::OUString aQuote = getIdentifierQuoteString();
static ::rtl::OUString aAnd = ::rtl::OUString::createFromAscii(" AND ");
static ::rtl::OUString aOr = ::rtl::OUString::createFromAscii(" OR ");
static ::rtl::OUString aEqual = ::rtl::OUString::createFromAscii(" = ?");
@@ -383,16 +391,18 @@ Sequence< sal_Int32 > SAL_CALL OKeySet::deleteRows( const Sequence< Any >& rows
// first the keys
Reference<XNameAccess> xKeyColumns = getKeyColumns();
- ::rtl::OUString aCondition = ::rtl::OUString::createFromAscii("( ");
+ ::rtl::OUStringBuffer aCondition = ::rtl::OUString::createFromAscii("( ");
SelectColumnsMetaData::const_iterator aIter = (*m_pKeyColumnNames).begin();
- for(;aIter != (*m_pKeyColumnNames).end();++aIter)
+ SelectColumnsMetaData::const_iterator aPosEnd = (*m_pKeyColumnNames).end();
+ for(;aIter != aPosEnd;++aIter)
{
- aCondition += ::dbtools::quoteName( aQuote,aIter->first);
- aCondition += aEqual;
- aCondition += aAnd;
+ aCondition.append(::dbtools::quoteName( aQuote,aIter->first));
+ aCondition.append(aEqual);
+ aCondition.append(aAnd);
}
- aCondition = aCondition.replaceAt(aCondition.getLength()-5,5,::rtl::OUString::createFromAscii(" )"));
+ aCondition.setLength(aCondition.getLength()-5);
+ const ::rtl::OUString sCon( aCondition.makeStringAndClear() );
const Any* pBegin = rows.getConstArray();
const Any* pEnd = pBegin + rows.getLength();
@@ -400,14 +410,14 @@ Sequence< sal_Int32 > SAL_CALL OKeySet::deleteRows( const Sequence< Any >& rows
Sequence< Any > aKeys;
for(;pBegin != pEnd;++pBegin)
{
- aSql += aCondition;
- aSql += aOr;
+ aSql.append(sCon);
+ aSql.append(aOr);
}
- aSql = aSql.replaceAt(aSql.getLength()-3,3,::rtl::OUString::createFromAscii(" "));
+ aSql.setLength(aSql.getLength()-3);
// now create end execute the prepared statement
- Reference< XPreparedStatement > xPrep(m_xConnection->prepareStatement(aSql));
+ Reference< XPreparedStatement > xPrep(m_xConnection->prepareStatement(aSql.makeStringAndClear()));
Reference< XParameters > xParameter(xPrep,UNO_QUERY);
pBegin = rows.getConstArray();
@@ -418,8 +428,9 @@ Sequence< sal_Int32 > SAL_CALL OKeySet::deleteRows( const Sequence< Any >& rows
if(m_aKeyIter != m_aKeyMap.end())
{
connectivity::ORowVector< ORowSetValue >::Vector::iterator aKeyIter = m_aKeyIter->second.first->get().begin();
+ connectivity::ORowVector< ORowSetValue >::Vector::iterator aKeyEnd = m_aKeyIter->second.first->get().end();
SelectColumnsMetaData::const_iterator aPosIter = (*m_pKeyColumnNames).begin();
- for(sal_uInt16 j = 0;aKeyIter != m_aKeyIter->second.first->get().end();++aKeyIter,++j,++aPosIter)
+ for(sal_uInt16 j = 0;aKeyIter != aKeyEnd;++aKeyIter,++j,++aPosIter)
{
setParameter(i++,xParameter,*aKeyIter,aPosIter->second.nType,aPosIter->second.nScale);
}
@@ -453,13 +464,15 @@ void SAL_CALL OKeySet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow
Reference<XPropertySet> xSet(_xTable,UNO_QUERY);
fillTableName(xSet);
- ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("UPDATE ");
- aSql += m_aComposedTableName;
- aSql += ::rtl::OUString::createFromAscii(" SET ");
+ ::rtl::OUStringBuffer aSql = ::rtl::OUString::createFromAscii("UPDATE ");
+ aSql.append(m_aComposedTableName);
+ aSql.append(::rtl::OUString::createFromAscii(" SET "));
// list all cloumns that should be set
static ::rtl::OUString aPara = ::rtl::OUString::createFromAscii(" = ?,");
::rtl::OUString aQuote = getIdentifierQuoteString();
static ::rtl::OUString aAnd = ::rtl::OUString::createFromAscii(" AND ");
+ ::rtl::OUString sIsNull(RTL_CONSTASCII_USTRINGPARAM(" IS NULL"));
+ ::rtl::OUString sParam(RTL_CONSTASCII_USTRINGPARAM(" = ?"));
// use keys and indexes for excat postioning
// first the keys
@@ -476,91 +489,90 @@ void SAL_CALL OKeySet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow
lcl_fillIndexColumns(xIndexes,aAllIndexColumns);
::rtl::OUString aColumnName;
- ::rtl::OUString aCondition,sKeyCondition,sIndexCondition,sSetValues;
+ ::rtl::OUStringBuffer sKeyCondition,sIndexCondition;
::std::vector<sal_Int32> aIndexColumnPositions;
+ const sal_Int32 nOldLength = aSql.getLength();
sal_Int32 i = 1;
// here we build the condition part for the update statement
SelectColumnsMetaData::const_iterator aIter = m_pColumnNames->begin();
- for(;aIter != m_pColumnNames->end();++aIter,++i)
+ SelectColumnsMetaData::const_iterator aEnd = m_pColumnNames->end();
+ for(;aIter != aEnd;++aIter,++i)
{
if(xKeyColumns.is() && xKeyColumns->hasByName(aIter->first))
{
- sKeyCondition += ::dbtools::quoteName( aQuote,aIter->first);
+ sKeyCondition.append(::dbtools::quoteName( aQuote,aIter->first));
if((_rOrginalRow->get())[aIter->second.nPosition].isNull())
- sKeyCondition += ::rtl::OUString::createFromAscii(" IS NULL");
+ sKeyCondition.append(sIsNull);
else
- sKeyCondition += ::rtl::OUString::createFromAscii(" = ?");
- sKeyCondition += aAnd;
+ sKeyCondition.append(sParam);
+ sKeyCondition.append(aAnd);
}
else
{
+ ::std::vector< Reference<XNameAccess> >::const_iterator aIndexEnd = aAllIndexColumns.end();
for( ::std::vector< Reference<XNameAccess> >::const_iterator aIndexIter = aAllIndexColumns.begin();
- aIndexIter != aAllIndexColumns.end();++aIndexIter)
+ aIndexIter != aIndexEnd;++aIndexIter)
{
if((*aIndexIter)->hasByName(aIter->first))
{
- sIndexCondition += ::dbtools::quoteName( aQuote,aIter->first);
+ sIndexCondition.append(::dbtools::quoteName( aQuote,aIter->first));
if((_rOrginalRow->get())[aIter->second.nPosition].isNull())
- sIndexCondition += ::rtl::OUString::createFromAscii(" IS NULL");
+ sIndexCondition.append(sIsNull);
else
{
- sIndexCondition += ::rtl::OUString::createFromAscii(" = ?");
+ sIndexCondition.append(sParam);
aIndexColumnPositions.push_back(aIter->second.nPosition);
}
- sIndexCondition += aAnd;
+ sIndexCondition.append(aAnd);
break;
}
}
}
if((_rInsertRow->get())[aIter->second.nPosition].isModified())
{
- sSetValues += ::dbtools::quoteName( aQuote,aIter->first);
- sSetValues += aPara;
+ aSql.append(::dbtools::quoteName( aQuote,aIter->first));
+ aSql.append(aPara);
}
}
- if(sSetValues.getLength())
+ if( aSql.getLength() != nOldLength )
{
- sSetValues = sSetValues.replaceAt(sSetValues.getLength()-1,1,::rtl::OUString::createFromAscii(" "));
- aSql += sSetValues;
+ aSql.setLength(aSql.getLength()-1);
}
else
::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_VALUE_CHANGED ), SQL_GENERAL_ERROR, m_xConnection );
if(sKeyCondition.getLength() || sIndexCondition.getLength())
{
+ aSql.append(::rtl::OUString::createFromAscii(" WHERE "));
if(sKeyCondition.getLength() && sIndexCondition.getLength())
{
- aCondition = sKeyCondition;
- aCondition += sIndexCondition;
+ aSql.append(sKeyCondition.makeStringAndClear());
+ aSql.append(sIndexCondition.makeStringAndClear());
}
else if(sKeyCondition.getLength())
{
- aCondition = sKeyCondition;
+ aSql.append(sKeyCondition.makeStringAndClear());
}
else if(sIndexCondition.getLength())
{
- aCondition = sIndexCondition;
+ aSql.append(sIndexCondition.makeStringAndClear());
}
-
- aCondition = aCondition.replaceAt(aCondition.getLength()-5,5,::rtl::OUString::createFromAscii(" "));
-
- aSql += ::rtl::OUString::createFromAscii(" WHERE ");
- aSql += aCondition;
+ aSql.setLength(aSql.getLength()-5); // remove the last AND
}
else
::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_CONDITION_FOR_PK ), SQL_GENERAL_ERROR, m_xConnection );
// now create end execute the prepared statement
- Reference< XPreparedStatement > xPrep(m_xConnection->prepareStatement(aSql));
+ Reference< XPreparedStatement > xPrep(m_xConnection->prepareStatement(aSql.makeStringAndClear()));
Reference< XParameters > xParameter(xPrep,UNO_QUERY);
i = 1;
// first the set values
aIter = m_pColumnNames->begin();
sal_uInt16 j = 0;
- for(;aIter != m_pColumnNames->end();++aIter,++j)
+ for(;aIter != aEnd;++aIter,++j)
{
sal_Int32 nPos = aIter->second.nPosition;
if((_rInsertRow->get())[nPos].isModified())
@@ -571,16 +583,18 @@ void SAL_CALL OKeySet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow
}
// and then the values of the where condition
aIter = (*m_pKeyColumnNames).begin();
+ aEnd = (*m_pKeyColumnNames).end();
j = 0;
- for(;aIter != (*m_pKeyColumnNames).end();++aIter,++i,++j)
+ for(;aIter != aEnd;++aIter,++i,++j)
{
setParameter(i,xParameter,(_rOrginalRow->get())[aIter->second.nPosition],aIter->second.nType,aIter->second.nScale);
}
// now we have to set the index values
::std::vector<sal_Int32>::iterator aIdxColIter = aIndexColumnPositions.begin();
+ ::std::vector<sal_Int32>::iterator aIdxColEnd = aIndexColumnPositions.end();
j = 0;
- for(;aIdxColIter != aIndexColumnPositions.end();++aIdxColIter,++i,++j)
+ for(;aIdxColIter != aIdxColEnd;++aIdxColIter,++i,++j)
{
setParameter(i,xParameter,(_rOrginalRow->get())[*aIdxColIter],(_rOrginalRow->get())[*aIdxColIter].getTypeKind(),aIter->second.nScale);
}
@@ -600,46 +614,46 @@ void SAL_CALL OKeySet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow
void SAL_CALL OKeySet::insertRow( const ORowSetRow& _rInsertRow,const connectivity::OSQLTable& _xTable ) throw(SQLException, RuntimeException)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::insertRow" );
- ::rtl::OUString aSql(::rtl::OUString::createFromAscii("INSERT INTO "));
+ ::rtl::OUStringBuffer aSql(::rtl::OUString::createFromAscii("INSERT INTO "));
Reference<XPropertySet> xSet(_xTable,UNO_QUERY);
fillTableName(xSet);
- aSql += m_aComposedTableName;
- aSql += ::rtl::OUString::createFromAscii(" ( ");
+ aSql.append(m_aComposedTableName);
+ aSql.append(::rtl::OUString::createFromAscii(" ( "));
// set values and column names
- ::rtl::OUString aValues(RTL_CONSTASCII_USTRINGPARAM(" VALUES ( "));
+ ::rtl::OUStringBuffer aValues(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" VALUES ( ")));
static ::rtl::OUString aPara(RTL_CONSTASCII_USTRINGPARAM("?,"));
::rtl::OUString aQuote = getIdentifierQuoteString();
static ::rtl::OUString aComma(RTL_CONSTASCII_USTRINGPARAM(","));
SelectColumnsMetaData::const_iterator aIter = m_pColumnNames->begin();
+ SelectColumnsMetaData::const_iterator aEnd = m_pColumnNames->end();
sal_Int32 j = 1;
sal_Bool bModified = sal_False;
- for(;aIter != m_pColumnNames->end();++aIter,++j)
+ for(;aIter != aEnd;++aIter,++j)
{
if((_rInsertRow->get())[aIter->second.nPosition].isModified())
{
- aSql += ::dbtools::quoteName( aQuote,aIter->first);
- aSql += aComma;
- aValues += aPara;
+ aSql.append(::dbtools::quoteName( aQuote,aIter->first));
+ aSql.append(aComma);
+ aValues.append(aPara);
bModified = sal_True;
}
}
if ( !bModified )
::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_VALUE_CHANGED ), SQL_GENERAL_ERROR, m_xConnection );
- aSql = aSql.replaceAt(aSql.getLength()-1,1,::rtl::OUString::createFromAscii(")"));
- aValues = aValues.replaceAt(aValues.getLength()-1,1,::rtl::OUString::createFromAscii(")"));
-
- aSql += aValues;
+ aSql.setCharAt(aSql.getLength()-1,')');
+ aValues.setCharAt(aValues.getLength()-1,')');
+ aSql.append(aValues.makeStringAndClear());
// now create,fill and execute the prepared statement
- Reference< XPreparedStatement > xPrep(m_xConnection->prepareStatement(aSql));
+ Reference< XPreparedStatement > xPrep(m_xConnection->prepareStatement(aSql.makeStringAndClear()));
Reference< XParameters > xParameter(xPrep,UNO_QUERY);
- SelectColumnsMetaData::const_iterator aPosIter = m_pColumnNames->begin();
- for(sal_Int32 i = 1;aPosIter != m_pColumnNames->end();++aPosIter)
+ aIter = m_pColumnNames->begin();
+ for(sal_Int32 i = 1;aIter != aEnd;++aIter)
{
- sal_Int32 nPos = aPosIter->second.nPosition;
+ const sal_Int32 nPos = aIter->second.nPosition;
if((_rInsertRow->get())[nPos].isModified())
{
if((_rInsertRow->get())[nPos].isNull())
@@ -647,7 +661,7 @@ void SAL_CALL OKeySet::insertRow( const ORowSetRow& _rInsertRow,const connectivi
else
{
(_rInsertRow->get())[nPos].setSigned(m_aSignedFlags[nPos-1]);
- setParameter(i++,xParameter,(_rInsertRow->get())[nPos],aPosIter->second.nType,aPosIter->second.nScale);
+ setParameter(i++,xParameter,(_rInsertRow->get())[nPos],aIter->second.nType,aIter->second.nScale);
}
}
}
@@ -657,11 +671,11 @@ void SAL_CALL OKeySet::insertRow( const ORowSetRow& _rInsertRow,const connectivi
if ( m_bInserted )
{
// first insert the default values into the insertrow
- SelectColumnsMetaData::const_iterator defaultIter = m_pColumnNames->begin();
- for(;defaultIter != m_pColumnNames->end();++defaultIter)
+ aIter = m_pColumnNames->begin();
+ for(;aIter != aEnd;++aIter)
{
- if ( !(_rInsertRow->get())[defaultIter->second.nPosition].isModified() )
- (_rInsertRow->get())[defaultIter->second.nPosition] = defaultIter->second.sDefaultValue;
+ if ( !(_rInsertRow->get())[aIter->second.nPosition].isModified() )
+ (_rInsertRow->get())[aIter->second.nPosition] = aIter->second.sDefaultValue;
}
try
{
@@ -701,17 +715,21 @@ void SAL_CALL OKeySet::insertRow( const ORowSetRow& _rInsertRow,const connectivi
if ( !bAutoValuesFetched && m_bInserted )
{
// first check if all key column values were set
- ::rtl::OUString sQuote = getIdentifierQuoteString();
+ const ::rtl::OUString sMax(RTL_CONSTASCII_USTRINGPARAM(" MAX("));
+ const ::rtl::OUString sMaxEnd(RTL_CONSTASCII_USTRINGPARAM("),"));
+ const ::rtl::OUString sQuote = getIdentifierQuoteString();
::rtl::OUString sMaxStmt;
+ aEnd = m_pKeyColumnNames->end();
::std::vector< ::rtl::OUString >::iterator aAutoIter = m_aAutoColumns.begin();
- for (;aAutoIter != m_aAutoColumns.end(); ++aAutoIter)
+ ::std::vector< ::rtl::OUString >::iterator aAutoEnd = m_aAutoColumns.end();
+ for (;aAutoIter != aAutoEnd; ++aAutoIter)
{
// we will only fetch values which are keycolumns
- if ( m_pKeyColumnNames->find(*aAutoIter) != m_pKeyColumnNames->end() )
+ if ( m_pKeyColumnNames->find(*aAutoIter) != aEnd )
{
- sMaxStmt += ::rtl::OUString::createFromAscii(" MAX(");
+ sMaxStmt += sMax;
sMaxStmt += ::dbtools::quoteName( sQuote,*aAutoIter);
- sMaxStmt += ::rtl::OUString::createFromAscii("),");
+ sMaxStmt += sMaxEnd;
}
}
@@ -731,12 +749,11 @@ void SAL_CALL OKeySet::insertRow( const ORowSetRow& _rInsertRow,const connectivi
if(xRow.is() && xRes->next())
{
aAutoIter = m_aAutoColumns.begin();
- ::std::vector< ::rtl::OUString >::iterator aAutoEnd = m_aAutoColumns.end();
for (sal_Int32 i=1;aAutoIter != aAutoEnd; ++aAutoIter,++i)
{
// we will only fetch values which are keycolumns
SelectColumnsMetaData::iterator aFind = m_pKeyColumnNames->find(*aAutoIter);
- if(aFind != m_pKeyColumnNames->end())
+ if ( aFind != aEnd )
(_rInsertRow->get())[aFind->second.nPosition].fill(i,aFind->second.nType,aFind->second.bNullable,xRow);
}
}
@@ -780,9 +797,9 @@ void SAL_CALL OKeySet::deleteRow(const ORowSetRow& _rDeleteRow,const connectivit
Reference<XPropertySet> xSet(_xTable,UNO_QUERY);
fillTableName(xSet);
- ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("DELETE FROM ");
- aSql += m_aComposedTableName;
- aSql += ::rtl::OUString::createFromAscii(" WHERE ");
+ ::rtl::OUStringBuffer aSql = ::rtl::OUString::createFromAscii("DELETE FROM ");
+ aSql.append(m_aComposedTableName);
+ aSql.append(::rtl::OUString::createFromAscii(" WHERE "));
// list all cloumns that should be set
::rtl::OUString aQuote = getIdentifierQuoteString();
@@ -800,64 +817,69 @@ void SAL_CALL OKeySet::deleteRow(const ORowSetRow& _rDeleteRow,const connectivit
::std::vector< Reference<XNameAccess> > aAllIndexColumns;
lcl_fillIndexColumns(xIndexes,aAllIndexColumns);
- ::rtl::OUString aColumnName,sIndexCondition;
+ ::rtl::OUString aColumnName;
+ ::rtl::OUStringBuffer sIndexCondition;
::std::vector<sal_Int32> aIndexColumnPositions;
SelectColumnsMetaData::const_iterator aIter = m_pColumnNames->begin();
+ SelectColumnsMetaData::const_iterator aEnd = m_pColumnNames->end();
sal_Int32 i = 1;
- for(i = 1;aIter != m_pColumnNames->end();++aIter,++i)
+ for(i = 1;aIter != aEnd;++aIter,++i)
{
if(xKeyColumns.is() && xKeyColumns->hasByName(aIter->first))
{
- aSql += ::dbtools::quoteName( aQuote,aIter->first);
+ aSql.append(::dbtools::quoteName( aQuote,aIter->first));
if((_rDeleteRow->get())[aIter->second.nPosition].isNull())
{
OSL_ENSURE(0,"can a primary key be null");
- aSql += ::rtl::OUString::createFromAscii(" IS NULL");
+ aSql.append(::rtl::OUString::createFromAscii(" IS NULL"));
}
else
- aSql += ::rtl::OUString::createFromAscii(" = ?");
- aSql += aAnd;
+ aSql.append(::rtl::OUString::createFromAscii(" = ?"));
+ aSql.append(aAnd);
}
else
{
+ ::std::vector< Reference<XNameAccess> >::const_iterator aIndexEnd = aAllIndexColumns.end();
for( ::std::vector< Reference<XNameAccess> >::const_iterator aIndexIter = aAllIndexColumns.begin();
- aIndexIter != aAllIndexColumns.end();++aIndexIter)
+ aIndexIter != aIndexEnd;++aIndexIter)
{
if((*aIndexIter)->hasByName(aIter->first))
{
- sIndexCondition += ::dbtools::quoteName( aQuote,aIter->first);
+ sIndexCondition.append(::dbtools::quoteName( aQuote,aIter->first));
if((_rDeleteRow->get())[aIter->second.nPosition].isNull())
- sIndexCondition += ::rtl::OUString::createFromAscii(" IS NULL");
+ sIndexCondition.append(::rtl::OUString::createFromAscii(" IS NULL"));
else
{
- sIndexCondition += ::rtl::OUString::createFromAscii(" = ?");
+ sIndexCondition.append(::rtl::OUString::createFromAscii(" = ?"));
aIndexColumnPositions.push_back(aIter->second.nPosition);
}
- sIndexCondition += aAnd;
+ sIndexCondition.append(aAnd);
break;
}
}
}
}
- aSql += sIndexCondition;
- aSql = aSql.replaceAt(aSql.getLength()-5,5,::rtl::OUString::createFromAscii(" "));
+ aSql.append(sIndexCondition.makeStringAndClear());
+ aSql.setLength(aSql.getLength()-5);
// now create end execute the prepared statement
- Reference< XPreparedStatement > xPrep(m_xConnection->prepareStatement(aSql));
+ Reference< XPreparedStatement > xPrep(m_xConnection->prepareStatement(aSql.makeStringAndClear()));
Reference< XParameters > xParameter(xPrep,UNO_QUERY);
aIter = (*m_pKeyColumnNames).begin();
+ aEnd = (*m_pKeyColumnNames).end();
i = 1;
- for(;aIter != (*m_pKeyColumnNames).end();++aIter,++i)
+ for(;aIter != aEnd;++aIter,++i)
{
setParameter(i,xParameter,(_rDeleteRow->get())[aIter->second.nPosition],aIter->second.nType,aIter->second.nScale);
}
// now we have to set the index values
::std::vector<sal_Int32>::iterator aIdxColIter = aIndexColumnPositions.begin();
- for(;aIdxColIter != aIndexColumnPositions.end();++aIdxColIter,++i)
+ ::std::vector<sal_Int32>::iterator aIdxColEnd = aIndexColumnPositions.end();
+ for(;aIdxColIter != aIdxColEnd;++aIdxColIter,++i)
{
setParameter(i,xParameter,(_rDeleteRow->get())[*aIdxColIter],(_rDeleteRow->get())[*aIdxColIter].getTypeKind(),aIter->second.nScale);
}
@@ -1109,12 +1131,20 @@ void SAL_CALL OKeySet::refreshRow() throw(SQLException, RuntimeException)
OSL_ENSURE(xParameter.is(),"No Parameter interface!");
xParameter->clearParameters();
sal_Int32 nPos=1;
+ connectivity::ORowVector< ORowSetValue >::Vector::const_iterator aParaIter = m_aParameterValueForCache.get().begin();
+ connectivity::ORowVector< ORowSetValue >::Vector::const_iterator aParaEnd = m_aParameterValueForCache.get().end();
+ for(++aParaIter;aParaIter != aParaEnd;++aParaIter,++nPos)
+ {
+ ::dbtools::setObjectWithInfo( xParameter, nPos, aParaIter->makeAny(), aParaIter->getTypeKind() );
+ }
connectivity::ORowVector< ORowSetValue >::Vector::const_iterator aIter = m_aKeyIter->second.first->get().begin();
SelectColumnsMetaData::const_iterator aPosIter = (*m_pKeyColumnNames).begin();
- for(;aPosIter != (*m_pKeyColumnNames).end();++aPosIter,++aIter,++nPos)
+ SelectColumnsMetaData::const_iterator aPosEnd = (*m_pKeyColumnNames).end();
+ for(;aPosIter != aPosEnd;++aPosIter,++aIter,++nPos)
setParameter(nPos,xParameter,*aIter,aPosIter->second.nType,aPosIter->second.nScale);
aPosIter = (*m_pForeignColumnNames).begin();
- for(;aPosIter != (*m_pForeignColumnNames).end();++aPosIter,++aIter,++nPos)
+ aPosEnd = (*m_pForeignColumnNames).end();
+ for(;aPosIter != aPosEnd;++aPosIter,++aIter,++nPos)
setParameter(nPos,xParameter,*aIter,aPosIter->second.nType,aPosIter->second.nScale);
m_xSet = m_xStatement->executeQuery();
@@ -1146,7 +1176,7 @@ sal_Bool OKeySet::fetchRow()
}
// now fetch the values from the missing columns from other tables
aPosIter = (*m_pForeignColumnNames).begin();
- aPosEnd = (*m_pForeignColumnNames).end();
+ aPosEnd = (*m_pForeignColumnNames).end();
for(;aPosIter != aPosEnd;++aPosIter,++aIter)
{
const SelectColumnDescription& rColDesc = aPosIter->second;
diff --git a/dbaccess/source/core/api/KeySet.hxx b/dbaccess/source/core/api/KeySet.hxx
index c930d1fe2b2e..4193f60506d1 100644
--- a/dbaccess/source/core/api/KeySet.hxx
+++ b/dbaccess/source/core/api/KeySet.hxx
@@ -97,6 +97,7 @@ namespace dbaccess
::std::vector< ::rtl::OUString > m_aAutoColumns; // contains all columns which are autoincrement ones
+ ORowSetValueVector m_aParameterValueForCache;
SelectColumnsMetaData* m_pKeyColumnNames; // contains all key column names
SelectColumnsMetaData* m_pColumnNames; // contains all column names
SelectColumnsMetaData* m_pForeignColumnNames; // contains all column names of the rest
@@ -139,7 +140,8 @@ namespace dbaccess
OKeySet(const connectivity::OSQLTable& _xTable,
const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& _xTableKeys,
const ::rtl::OUString& _rUpdateTableName,
- const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryAnalyzer >& _xComposer);
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryAnalyzer >& _xComposer,
+ const ORowSetValueVector& _aParameterValueForCache);
// late ctor which can throw exceptions
virtual void construct(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _xDriverSet);
diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx
index 1ec43f2dd5c0..8f84d073f83e 100644
--- a/dbaccess/source/core/api/RowSet.cxx
+++ b/dbaccess/source/core/api/RowSet.cxx
@@ -657,7 +657,8 @@ void ORowSet::freeResources( bool _bComplete )
MutexGuard aGuard(m_aMutex);
// free all clones
- for (connectivity::OWeakRefArray::iterator i = m_aClones.begin(); m_aClones.end() != i; i++)
+ connectivity::OWeakRefArray::iterator aEnd = m_aClones.end();
+ for (connectivity::OWeakRefArray::iterator i = m_aClones.begin(); aEnd != i; i++)
{
Reference< XComponent > xComp(i->get(), UNO_QUERY);
if (xComp.is())
@@ -1715,13 +1716,14 @@ Reference< XResultSet > ORowSet::impl_prepareAndExecute_throw()
// this exception doesn't matter here because when we catch an exception
// then the driver doesn't support this feature
}
-
+ m_aParameterValueForCache.get().resize(1);
Reference< XParameters > xParam( m_xStatement, UNO_QUERY_THROW );
size_t nParamCount( m_pParameters.is() ? m_pParameters->size() : m_aPrematureParamValues.get().size() );
for ( size_t i=1; i<=nParamCount; ++i )
{
ORowSetValue& rParamValue( getParameterStorage( (sal_Int32)i ) );
::dbtools::setObjectWithInfo( xParam, i, rParamValue.makeAny(), rParamValue.getTypeKind() );
+ m_aParameterValueForCache.get().push_back(rParamValue);
}
xResultSet = m_xStatement->executeQuery();
@@ -1863,7 +1865,7 @@ void ORowSet::execute_NoApprove_NoNewConn(ResettableMutexGuard& _rClearForNotifi
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "frank.schoenheit@sun.com", "ORowSet::execute_NoApprove_NoNewConn: creating cache" );
- m_pCache = new ORowSetCache( xResultSet, m_xComposer.get(), m_aContext, aComposedUpdateTableName, m_bModified, m_bNew );
+ m_pCache = new ORowSetCache( xResultSet, m_xComposer.get(), m_aContext, aComposedUpdateTableName, m_bModified, m_bNew,m_aParameterValueForCache );
if ( m_nResultSetConcurrency == ResultSetConcurrency::READ_ONLY )
{
m_nPrivileges = Privilege::SELECT;
@@ -2152,7 +2154,8 @@ void ORowSet::notifyRowSetAndClonesRowDelete( const Any& _rBookmark )
// notify ourself
onDeleteRow( _rBookmark );
// notify the clones
- for (connectivity::OWeakRefArray::iterator i = m_aClones.begin(); m_aClones.end() != i; i++)
+ connectivity::OWeakRefArray::iterator aEnd = m_aClones.end();
+ for (connectivity::OWeakRefArray::iterator i = m_aClones.begin(); aEnd != i; i++)
{
Reference< XUnoTunnel > xTunnel(i->get(),UNO_QUERY);
if(xTunnel.is())
@@ -2169,7 +2172,8 @@ void ORowSet::notifyRowSetAndClonesRowDeleted( const Any& _rBookmark, sal_Int32
// notify ourself
onDeletedRow( _rBookmark, _nPos );
// notify the clones
- for (connectivity::OWeakRefArray::iterator i = m_aClones.begin(); m_aClones.end() != i; i++)
+ connectivity::OWeakRefArray::iterator aEnd = m_aClones.end();
+ for (connectivity::OWeakRefArray::iterator i = m_aClones.begin(); aEnd != i; i++)
{
Reference< XUnoTunnel > xTunnel(i->get(),UNO_QUERY);
if(xTunnel.is())
@@ -2822,7 +2826,6 @@ ORowSetClone::ORowSetClone( const ::comphelper::ComponentContext& _rContext, ORo
rParent.m_pColumns->getByName(*pIter) >>= xColumn;
if(xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_DESCRIPTION))
aDescription = comphelper::getString(xColumn->getPropertyValue(PROPERTY_DESCRIPTION));
-
ORowSetColumn* pColumn = new ORowSetColumn( rParent.getMetaData(),
this,
i,
@@ -2856,7 +2859,7 @@ ORowSetClone::ORowSetClone( const ::comphelper::ComponentContext& _rContext, ORo
// sdb.RowSet Properties
// registerProperty(PROPERTY_CURSORNAME, PROPERTY_ID_CURSORNAME, PropertyAttribute::READONLY, &m_aDataSourceName, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL)));
-
+ registerMayBeVoidProperty(PROPERTY_ACTIVE_CONNECTION,PROPERTY_ID_ACTIVE_CONNECTION, PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, &rParent.m_aActiveConnection, ::getCppuType(reinterpret_cast< Reference< XConnection >* >(NULL)));
registerProperty(PROPERTY_RESULTSETCONCURRENCY, PROPERTY_ID_RESULTSETCONCURRENCY, PropertyAttribute::READONLY, &m_nResultSetConcurrency,::getCppuType(reinterpret_cast< sal_Int32*>(NULL)));
registerProperty(PROPERTY_RESULTSETTYPE, PROPERTY_ID_RESULTSETTYPE, PropertyAttribute::READONLY, &m_nResultSetType, ::getCppuType(reinterpret_cast< sal_Int32*>(NULL)));
registerProperty(PROPERTY_FETCHDIRECTION, PROPERTY_ID_FETCHDIRECTION, PropertyAttribute::TRANSIENT, &m_nFetchDirection, ::getCppuType(reinterpret_cast< sal_Int32*>(NULL)));
diff --git a/dbaccess/source/core/api/RowSet.hxx b/dbaccess/source/core/api/RowSet.hxx
index 90a0ad9c7928..25fa3a3415f6 100644
--- a/dbaccess/source/core/api/RowSet.hxx
+++ b/dbaccess/source/core/api/RowSet.hxx
@@ -133,6 +133,7 @@ namespace dbaccess
(since we have not been executed, yet)
*/
ORowSetValueVector m_aPrematureParamValues;
+ ORowSetValueVector m_aParameterValueForCache;
::std::bit_vector m_aParametersSet;
::cppu::OInterfaceContainerHelper m_aRowsetListeners;
diff --git a/dbaccess/source/core/api/RowSetBase.cxx b/dbaccess/source/core/api/RowSetBase.cxx
index ebcb8ca38d8e..a8894bcf5f1b 100644
--- a/dbaccess/source/core/api/RowSetBase.cxx
+++ b/dbaccess/source/core/api/RowSetBase.cxx
@@ -226,7 +226,10 @@ void SAL_CALL ORowSetBase::disposing(void)
m_pColumns->disposing();
}
if ( m_pCache )
+ {
m_pCache->deregisterOldRow(m_aOldRow);
+ m_pCache->deleteIterator(this);
+ }
m_pCache = NULL;
}
// -------------------------------------------------------------------------
@@ -1322,7 +1325,8 @@ void ORowSetBase::firePropertyChange(const ORowSetRow& _rOldRow)
sal_Int32 i=0;
try
{
- for(TDataColumns::iterator aIter = m_aDataColumns.begin();aIter != m_aDataColumns.end();++aIter,++i) // #104278# OJ ++i inserted
+ TDataColumns::iterator aEnd = m_aDataColumns.end();
+ for(TDataColumns::iterator aIter = m_aDataColumns.begin();aIter != aEnd;++aIter,++i) // #104278# OJ ++i inserted
(*aIter)->fireValueChange(_rOldRow.isValid() ? (_rOldRow->get())[i+1] : ::connectivity::ORowSetValue());
}
catch(Exception&)
diff --git a/dbaccess/source/core/api/RowSetCache.cxx b/dbaccess/source/core/api/RowSetCache.cxx
index 46f80a6ab372..a96de4b9fbe1 100644
--- a/dbaccess/source/core/api/RowSetCache.cxx
+++ b/dbaccess/source/core/api/RowSetCache.cxx
@@ -31,36 +31,89 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_dbaccess.hxx"
+#ifndef _COMPHELPER_SEQSTREAM_HXX
#include <comphelper/seqstream.hxx>
+#endif
+#ifndef _COMPHELPER_UNO3_HXX_
#include <comphelper/uno3.hxx>
+#endif
+#ifndef _COMPHELPER_EXTRACT_HXX_
#include <comphelper/extract.hxx>
+#endif
+#ifndef _COM_SUN_STAR_SDBCX_XKEYSSUPPLIER_HPP_
#include <com/sun/star/sdbcx/XKeysSupplier.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBCX_XTABLESSUPPLIER_HPP_
#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBCX_KEYTYPE_HPP_
#include <com/sun/star/sdbcx/KeyType.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_RESULTSETCONCURRENCY_HPP_
#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_
#include <com/sun/star/sdbc/ColumnValue.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBCX_XCOLUMNSSUPPLIER_HPP_
#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBCX_PRIVILEGE_HPP_
#include <com/sun/star/sdbcx/Privilege.hpp>
+#endif
+#ifndef _DBACORE_DATACOLUMN_HXX_
#include "CRowSetDataColumn.hxx"
+#endif
+#ifndef DBACCESS_CORE_API_CROWSETCOLUMN_HXX
#include "CRowSetColumn.hxx"
+#endif
+#ifndef DBACCESS_CORE_API_ROWSETBASE_HXX
#include "RowSetBase.hxx"
+#endif
+#ifndef _DBHELPER_DBEXCEPTION_HXX_
#include <connectivity/dbexception.hxx>
+#endif
+#ifndef _CONNECTIVITY_SQLPARSE_HXX
#include <connectivity/sqlparse.hxx>
+#endif
+#ifndef _CONNECTIVITY_SQLNODE_HXX
#include <connectivity/sqlnode.hxx>
+#endif
+#ifndef _CONNECTIVITY_PARSE_SQLITERATOR_HXX_
#include <connectivity/sqliterator.hxx>
+#endif
+#ifndef _COMPHELPER_PROPERTY_HXX_
#include <comphelper/property.hxx>
+#endif
+#ifndef _COM_SUN_STAR_SDBCX_COMPAREBOOKMARK_HPP_
#include <com/sun/star/sdbcx/CompareBookmark.hpp>
+#endif
+#ifndef _TOOLS_DEBUG_HXX
#include <tools/debug.hxx>
+#endif
#include <algorithm>
+#ifndef DBACCESS_CORE_API_ROWSETCACHE_HXX
#include "RowSetCache.hxx"
+#endif
+#ifndef _DBA_CORE_RESOURCE_HXX_
#include "core_resource.hxx"
+#endif
+#ifndef _DBA_CORE_RESOURCE_HRC_
#include "core_resource.hrc"
+#endif
+#ifndef DBACCESS_CORE_API_BOOKMARKSET_HXX
#include "BookmarkSet.hxx"
+#endif
+#ifndef DBACCESS_CORE_API_STATICSET_HXX
#include "StaticSet.hxx"
+#endif
+#ifndef DBACCESS_CORE_API_KEYSET_HXX
#include "KeySet.hxx"
+#endif
+#ifndef DBACCESS_SHARED_DBASTRINGS_HRC
#include "dbastrings.hrc"
-#include <rtl/logfile.hxx>
+#endif
using namespace dbaccess;
using namespace dbtools;
@@ -84,7 +137,8 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs,
const ::comphelper::ComponentContext& _rContext,
const ::rtl::OUString& _rUpdateTableName,
sal_Bool& _bModified,
- sal_Bool& _bNew)
+ sal_Bool& _bNew,
+ const ORowSetValueVector& _aParameterValueForCache)
:m_xSet(_xRs)
,m_xMetaData(Reference< XResultSetMetaDataSupplier >(_xRs,UNO_QUERY)->getMetaData())
,m_aContext( _rContext )
@@ -105,7 +159,6 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs,
,m_bModified(_bModified)
,m_bNew(_bNew)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::ORowSetCache" );
DBG_CTOR(ORowSetCache,NULL);
// check if all keys of the updateable table are fetched
@@ -194,18 +247,41 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs,
}
Reference< XPropertySet> xProp(_xRs,UNO_QUERY);
- sal_Bool bBookmarkable = xProp->getPropertySetInfo()->hasPropertyByName(PROPERTY_ISBOOKMARKABLE) &&
- any2bool(xProp->getPropertyValue(PROPERTY_ISBOOKMARKABLE)) && Reference< XRowLocate >(_xRs, UNO_QUERY).is();
- sal_Bool bNeedKeySet = !bBookmarkable;
+ sal_Bool bNeedKeySet = !(xProp->getPropertySetInfo()->hasPropertyByName(PROPERTY_ISBOOKMARKABLE) &&
+ any2bool(xProp->getPropertyValue(PROPERTY_ISBOOKMARKABLE)) && Reference< XRowLocate >(_xRs, UNO_QUERY).is() );
bNeedKeySet = bNeedKeySet || (xProp->getPropertySetInfo()->hasPropertyByName(PROPERTY_RESULTSETCONCURRENCY) &&
::comphelper::getINT32(xProp->getPropertyValue(PROPERTY_RESULTSETCONCURRENCY)) == ResultSetConcurrency::READ_ONLY);
// first check if resultset is bookmarkable
- if ( !bNeedKeySet )
+ if(!bNeedKeySet)
{
- bNeedKeySet = impl_createBookmarkSet_nothrow(_xRs);
+ try
+ {
+ m_pCacheSet = new OBookmarkSet();
+ m_xCacheSet = m_pCacheSet;
+ m_pCacheSet->construct(_xRs);
+
+ // check privileges
+ m_nPrivileges = Privilege::SELECT;
+ if(Reference<XResultSetUpdate>(_xRs,UNO_QUERY).is()) // this interface is optional so we have to check it
+ {
+ Reference<XPropertySet> xTable(m_aUpdateTable,UNO_QUERY);
+ if(xTable.is() && xTable->getPropertySetInfo()->hasPropertyByName(PROPERTY_PRIVILEGES))
+ {
+ m_nPrivileges = 0;
+ xTable->getPropertyValue(PROPERTY_PRIVILEGES) >>= m_nPrivileges;
+ if(!m_nPrivileges)
+ m_nPrivileges = Privilege::SELECT;
+ }
+ }
+ }
+ catch(const SQLException&)
+ {
+ bNeedKeySet = sal_True;
+ }
+
}
- if ( bNeedKeySet )
+ if(bNeedKeySet)
{
// need to check if we could handle this select clause
bAllKeysFound = bAllKeysFound && (nTablesCount == 1 || checkJoin(xConnection,_xAnalyzer,aUpdateTableName));
@@ -213,16 +289,11 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs,
// || !(comphelper::hasProperty(PROPERTY_CANUPDATEINSERTEDROWS,xProp) && any2bool(xProp->getPropertyValue(PROPERTY_CANUPDATEINSERTEDROWS)))
// oj removed because keyset uses only the next// || (xProp->getPropertySetInfo()->hasPropertyByName(PROPERTY_RESULTSETTYPE) && comphelper::getINT32(xProp->getPropertyValue(PROPERTY_RESULTSETTYPE)) == ResultSetType::FORWARD_ONLY)
- if ( !bAllKeysFound )
+ if(!bAllKeysFound )
{
- if ( bBookmarkable )
- impl_createBookmarkSet_nothrow(_xRs);
- else
- {
- m_pCacheSet = new OStaticSet();
- m_xCacheSet = m_pCacheSet;
- m_pCacheSet->construct(_xRs);
- }
+ m_pCacheSet = new OStaticSet();
+ m_xCacheSet = m_pCacheSet;
+ m_pCacheSet->construct(_xRs);
m_nPrivileges = Privilege::SELECT;
}
else
@@ -258,7 +329,7 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs,
}
}
- OKeySet* pKeySet = new OKeySet(m_aUpdateTable,xUpdateTableKeys,aUpdateTableName ,_xAnalyzer);
+ OKeySet* pKeySet = new OKeySet(m_aUpdateTable,xUpdateTableKeys,aUpdateTableName ,_xAnalyzer,_aParameterValueForCache);
try
{
m_pCacheSet = pKeySet;
@@ -298,6 +369,7 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs,
::comphelper::getINT32(xProp->getPropertyValue(PROPERTY_RESULTSETCONCURRENCY)) == ResultSetConcurrency::READ_ONLY)
m_nPrivileges = Privilege::SELECT;
}
+
// -------------------------------------------------------------------------
ORowSetCache::~ORowSetCache()
{
@@ -320,40 +392,10 @@ ORowSetCache::~ORowSetCache()
DBG_DTOR(ORowSetCache,NULL);
}
-// -----------------------------------------------------------------------------
-sal_Bool ORowSetCache::impl_createBookmarkSet_nothrow(const Reference< XResultSet >& _xRs)
-{
- sal_Bool bRet = sal_False;
- try
- {
- m_pCacheSet = new OBookmarkSet();
- m_xCacheSet = m_pCacheSet;
- m_pCacheSet->construct(_xRs);
- // check privileges
- m_nPrivileges = Privilege::SELECT;
- if(Reference<XResultSetUpdate>(_xRs,UNO_QUERY).is()) // this interface is optional so we have to check it
- {
- Reference<XPropertySet> xTable(m_aUpdateTable,UNO_QUERY);
- if(xTable.is() && xTable->getPropertySetInfo()->hasPropertyByName(PROPERTY_PRIVILEGES))
- {
- m_nPrivileges = 0;
- xTable->getPropertyValue(PROPERTY_PRIVILEGES) >>= m_nPrivileges;
- if(!m_nPrivileges)
- m_nPrivileges = Privilege::SELECT;
- }
- }
- }
- catch(const SQLException&)
- {
- bRet = sal_True;
- }
- return bRet;
-}
// -------------------------------------------------------------------------
void ORowSetCache::setMaxRowSize(sal_Int32 _nSize)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::setMaxRowSize" );
if(_nSize == m_nFetchSize)
return;
@@ -375,7 +417,8 @@ void ORowSetCache::setMaxRowSize(sal_Int32 _nSize)
::std::map<sal_Int32,sal_Bool> aCacheIterToChange;
// first get the positions where they stand now
ORowSetCacheMap::iterator aCacheIter = m_aCacheIterators.begin();
- for(;aCacheIter != m_aCacheIterators.end();++aCacheIter)
+ ORowSetCacheMap::iterator aCacheEnd = m_aCacheIterators.end();
+ for(;aCacheIter != aCacheEnd;++aCacheIter)
{
aCacheIterToChange[aCacheIter->first] = sal_False;
if ( !aCacheIter->second.pRowSet->isInsertRow()
@@ -425,14 +468,12 @@ void ORowSetCache::setMaxRowSize(sal_Int32 _nSize)
// XResultSetMetaDataSupplier
Reference< XResultSetMetaData > ORowSetCache::getMetaData( )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::getMetaData" );
return m_xMetaData;
}
// -------------------------------------------------------------------------
// ::com::sun::star::sdbcx::XRowLocate
Any ORowSetCache::getBookmark( )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::getBookmark" );
if(m_bAfterLast)
throwFunctionSequenceException(m_xSet.get());
@@ -457,7 +498,6 @@ Any ORowSetCache::getBookmark( )
// -------------------------------------------------------------------------
sal_Bool ORowSetCache::moveToBookmark( const Any& bookmark )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::moveToBookmark" );
if ( m_pCacheSet->moveToBookmark(bookmark) )
{
m_bBeforeFirst = sal_False;
@@ -488,7 +528,6 @@ sal_Bool ORowSetCache::moveToBookmark( const Any& bookmark )
// -------------------------------------------------------------------------
sal_Bool ORowSetCache::moveRelativeToBookmark( const Any& bookmark, sal_Int32 rows )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::moveRelativeToBookmark" );
sal_Bool bRet( moveToBookmark( bookmark ) );
if ( bRet )
{
@@ -504,20 +543,17 @@ sal_Bool ORowSetCache::moveRelativeToBookmark( const Any& bookmark, sal_Int32 ro
// -------------------------------------------------------------------------
sal_Int32 ORowSetCache::compareBookmarks( const Any& _first, const Any& _second )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::compareBookmarks" );
return (!_first.hasValue() || !_second.hasValue()) ? CompareBookmark::NOT_COMPARABLE : m_pCacheSet->compareBookmarks(_first,_second);
}
// -------------------------------------------------------------------------
sal_Bool ORowSetCache::hasOrderedBookmarks( )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::hasOrderedBookmarks" );
return m_pCacheSet->hasOrderedBookmarks();
}
// -------------------------------------------------------------------------
sal_Int32 ORowSetCache::hashBookmark( const Any& bookmark )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::hashBookmark" );
return m_pCacheSet->hashBookmark(bookmark);
}
@@ -526,7 +562,6 @@ sal_Int32 ORowSetCache::hashBookmark( const Any& bookmark )
// -----------------------------------------------------------------------------
void ORowSetCache::updateValue(sal_Int32 columnIndex,const ORowSetValue& x)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::updateValue" );
checkUpdateConditions(columnIndex);
@@ -537,7 +572,6 @@ void ORowSetCache::updateValue(sal_Int32 columnIndex,const ORowSetValue& x)
// -------------------------------------------------------------------------
void ORowSetCache::updateBinaryStream( sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::updateBinaryStream" );
checkUpdateConditions(columnIndex);
@@ -549,7 +583,6 @@ void ORowSetCache::updateBinaryStream( sal_Int32 columnIndex, const Reference< :
// -------------------------------------------------------------------------
void ORowSetCache::updateCharacterStream( sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::updateCharacterStream" );
checkUpdateConditions(columnIndex);
@@ -562,7 +595,6 @@ void ORowSetCache::updateCharacterStream( sal_Int32 columnIndex, const Reference
// -------------------------------------------------------------------------
void ORowSetCache::updateObject( sal_Int32 columnIndex, const Any& x )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::updateObject" );
checkUpdateConditions(columnIndex);
@@ -573,7 +605,6 @@ void ORowSetCache::updateObject( sal_Int32 columnIndex, const Any& x )
// -------------------------------------------------------------------------
void ORowSetCache::updateNumericObject( sal_Int32 columnIndex, const Any& x, sal_Int32 /*scale*/ )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::updateNumericObject" );
checkUpdateConditions(columnIndex);
@@ -585,7 +616,6 @@ void ORowSetCache::updateNumericObject( sal_Int32 columnIndex, const Any& x, sal
// XResultSet
sal_Bool ORowSetCache::next( )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::next" );
if(!isAfterLast())
@@ -610,7 +640,6 @@ sal_Bool ORowSetCache::next( )
// -------------------------------------------------------------------------
sal_Bool ORowSetCache::isBeforeFirst( )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::isBeforeFirst" );
// return !m_nPosition;
return m_bBeforeFirst;
@@ -618,21 +647,18 @@ sal_Bool ORowSetCache::isBeforeFirst( )
// -------------------------------------------------------------------------
sal_Bool ORowSetCache::isAfterLast( )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::isAfterLast" );
return m_bAfterLast;
}
// -------------------------------------------------------------------------
sal_Bool ORowSetCache::isFirst( )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::isFirst" );
return m_nPosition == 1; // ask resultset for
}
// -------------------------------------------------------------------------
sal_Bool ORowSetCache::isLast( )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::isLast" );
// return m_bRowCountFinal ? (m_nPosition==m_nRowCount) : m_pCacheSet->isLast();
return m_nPosition == m_nRowCount;
@@ -640,7 +666,6 @@ sal_Bool ORowSetCache::isLast( )
// -------------------------------------------------------------------------
sal_Bool ORowSetCache::beforeFirst( )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::beforeFirst" );
if(!m_bBeforeFirst)
@@ -657,7 +682,6 @@ sal_Bool ORowSetCache::beforeFirst( )
// -------------------------------------------------------------------------
sal_Bool ORowSetCache::afterLast( )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::afterLast" );
if(!m_bAfterLast)
@@ -681,12 +705,10 @@ sal_Bool ORowSetCache::afterLast( )
// -------------------------------------------------------------------------
sal_Bool ORowSetCache::fillMatrix(sal_Int32& _nNewStartPos,sal_Int32 _nNewEndPos)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::fillMatrix" );
OSL_ENSURE(_nNewStartPos != _nNewEndPos,"ORowSetCache::fillMatrix: StartPos and EndPos can not be equal!");
// fill the whole window with new data
ORowSetMatrix::iterator aIter = m_pMatrix->begin();
sal_Bool bCheck = m_pCacheSet->absolute(_nNewStartPos); // -1 no need to
- const sal_Int32 nColumnCount = m_xMetaData->getColumnCount();
sal_Int32 i=_nNewStartPos;
for(;i<_nNewEndPos;++i,++aIter)
@@ -694,7 +716,7 @@ sal_Bool ORowSetCache::fillMatrix(sal_Int32& _nNewStartPos,sal_Int32 _nNewEndPos
if(bCheck)
{
if(!aIter->isValid())
- *aIter = new ORowSetValueVector(nColumnCount);
+ *aIter = new ORowSetValueVector(m_xMetaData->getColumnCount());
m_pCacheSet->fillValueRow(*aIter,i);
}
else
@@ -711,22 +733,23 @@ sal_Bool ORowSetCache::fillMatrix(sal_Int32& _nNewStartPos,sal_Int32 _nNewEndPos
if(m_nRowCount > m_nFetchSize)
{
ORowSetMatrix::iterator aEnd = aIter;
+ ORowSetMatrix::iterator aRealEnd = m_pMatrix->end();
sal_Int32 nPos = m_nRowCount - m_nFetchSize + 1;
_nNewStartPos = nPos;
bCheck = m_pCacheSet->absolute(_nNewStartPos);
- for(;bCheck && aIter != m_pMatrix->end();++aIter)
+ for(;bCheck && aIter != aRealEnd;++aIter)
{
if(bCheck)
{
if(!aIter->isValid())
- *aIter = new ORowSetValueVector(nColumnCount);
+ *aIter = new ORowSetValueVector(m_xMetaData->getColumnCount());
m_pCacheSet->fillValueRow(*aIter,nPos++);
}
bCheck = m_pCacheSet->next();
}
if(aIter != aEnd)
- ::std::rotate(m_pMatrix->begin(),aEnd,m_pMatrix->end());
+ ::std::rotate(m_pMatrix->begin(),aEnd,aRealEnd);
}
break;
}
@@ -752,7 +775,6 @@ sal_Bool ORowSetCache::fillMatrix(sal_Int32& _nNewStartPos,sal_Int32 _nNewEndPos
// -------------------------------------------------------------------------
sal_Bool ORowSetCache::moveWindow()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::moveWindow" );
sal_Bool bRet = sal_True;
@@ -803,7 +825,8 @@ sal_Bool ORowSetCache::moveWindow()
ptrdiff_t nNewDist = aEnd - m_pMatrix->begin();
ptrdiff_t nOffSet = m_pMatrix->end() - aEnd;
ORowSetCacheMap::iterator aCacheIter = m_aCacheIterators.begin();
- for(;aCacheIter != m_aCacheIterators.end();++aCacheIter)
+ ORowSetCacheMap::iterator aCacheEnd = m_aCacheIterators.end();
+ for(;aCacheIter != aCacheEnd;++aCacheIter)
{
if ( !aCacheIter->second.pRowSet->isInsertRow()
&& aCacheIter->second.aIterator != m_pMatrix->end() && !m_bModified )
@@ -990,7 +1013,6 @@ sal_Bool ORowSetCache::moveWindow()
// -------------------------------------------------------------------------
sal_Bool ORowSetCache::first( )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::first" );
// first move to the first row
// then check if the cache window is at the begining
// when not postionize the window and fill it with data
@@ -1016,7 +1038,6 @@ sal_Bool ORowSetCache::first( )
// -------------------------------------------------------------------------
sal_Bool ORowSetCache::last( )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::last" );
sal_Bool bRet = m_pCacheSet->last();
if(bRet)
{
@@ -1056,13 +1077,11 @@ sal_Bool ORowSetCache::last( )
// -------------------------------------------------------------------------
sal_Int32 ORowSetCache::getRow( )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::getRow" );
return (isBeforeFirst() || isAfterLast()) ? 0 : m_nPosition;
}
// -------------------------------------------------------------------------
sal_Bool ORowSetCache::absolute( sal_Int32 row )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::absolute" );
if(!row )
throw SQLException(DBACORE_RESSTRING(RID_STR_NO_ABS_ZERO),NULL,SQLSTATE_GENERAL,1000,Any() );
@@ -1116,7 +1135,6 @@ sal_Bool ORowSetCache::absolute( sal_Int32 row )
// -------------------------------------------------------------------------
sal_Bool ORowSetCache::relative( sal_Int32 rows )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::relative" );
sal_Bool bErg = sal_True;
if(rows)
{
@@ -1145,7 +1163,6 @@ sal_Bool ORowSetCache::relative( sal_Int32 rows )
// -------------------------------------------------------------------------
sal_Bool ORowSetCache::previous( )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::previous" );
sal_Bool bRet = sal_False;
if(!isBeforeFirst())
{
@@ -1177,7 +1194,6 @@ sal_Bool ORowSetCache::previous( )
// -------------------------------------------------------------------------
void ORowSetCache::refreshRow( )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::refreshRow" );
if(isAfterLast())
throw SQLException(DBACORE_RESSTRING(RID_STR_NO_REFESH_AFTERLAST),NULL,SQLSTATE_GENERAL,1000,Any() );
OSL_ENSURE(m_aMatrixIter != m_pMatrix->end(),"refreshRow() called for invalid row!");
@@ -1191,20 +1207,17 @@ void ORowSetCache::refreshRow( )
// -------------------------------------------------------------------------
sal_Bool ORowSetCache::rowUpdated( )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::rowUpdated" );
return m_pCacheSet->rowUpdated();
}
// -------------------------------------------------------------------------
sal_Bool ORowSetCache::rowInserted( )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::rowInserted" );
return m_pCacheSet->rowInserted();
}
// -------------------------------------------------------------------------
// XResultSetUpdate
sal_Bool ORowSetCache::insertRow( )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::insertRow" );
if ( !m_bNew || !m_aInsertRow->isValid() )
throw SQLException(DBACORE_RESSTRING(RID_STR_NO_MOVETOINSERTROW_CALLED),NULL,SQLSTATE_GENERAL,1000,Any() );
@@ -1228,7 +1241,6 @@ sal_Bool ORowSetCache::insertRow( )
// -------------------------------------------------------------------------
void ORowSetCache::resetInsertRow(sal_Bool _bClearInsertRow)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::resetInsertRow" );
if ( _bClearInsertRow )
clearInsertRow();
m_bNew = sal_False;
@@ -1237,7 +1249,6 @@ void ORowSetCache::resetInsertRow(sal_Bool _bClearInsertRow)
// -------------------------------------------------------------------------
void ORowSetCache::cancelRowModification()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::cancelRowModification" );
// clear the insertrow references -> implies that the current row of the rowset changes as well
ORowSetCacheMap::iterator aCacheIter = m_aCacheIterators.begin();
ORowSetCacheMap::iterator aCacheEnd = m_aCacheIterators.end();
@@ -1251,7 +1262,6 @@ void ORowSetCache::cancelRowModification()
// -------------------------------------------------------------------------
void ORowSetCache::updateRow( ORowSetMatrix::iterator& _rUpdateRow )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::updateRow" );
if(isAfterLast() || isBeforeFirst())
throw SQLException(DBACORE_RESSTRING(RID_STR_NO_UPDATEROW),NULL,SQLSTATE_GENERAL,1000,Any() );
@@ -1275,7 +1285,6 @@ void ORowSetCache::updateRow( ORowSetMatrix::iterator& _rUpdateRow )
// -------------------------------------------------------------------------
bool ORowSetCache::deleteRow( )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::deleteRow" );
if(isAfterLast() || isBeforeFirst())
throw SQLException(DBACORE_RESSTRING(RID_STR_NO_DELETEROW),NULL,SQLSTATE_GENERAL,1000,Any() );
@@ -1291,7 +1300,8 @@ bool ORowSetCache::deleteRow( )
// (*m_pMatrix)[(m_nPosition - m_nStartPos)] = NULL; // set the deleted row to NULL
- for(++aPos;aPos != m_pMatrix->end() && aPos->isValid();++aPos)
+ ORowSetMatrix::iterator aEnd = m_pMatrix->end();
+ for(++aPos;aPos != aEnd && aPos->isValid();++aPos)
{
*(aPos-1) = *aPos;
(*aPos) = NULL;
@@ -1304,7 +1314,6 @@ bool ORowSetCache::deleteRow( )
// -------------------------------------------------------------------------
void ORowSetCache::cancelRowUpdates( )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::cancelRowUpdates" );
m_bNew = m_bModified = sal_False;
if(!m_nPosition)
{
@@ -1323,7 +1332,6 @@ void ORowSetCache::cancelRowUpdates( )
// -------------------------------------------------------------------------
void ORowSetCache::moveToInsertRow( )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::moveToInsertRow" );
m_bNew = sal_True;
m_bUpdated = m_bAfterLast = sal_False;
@@ -1333,7 +1341,8 @@ void ORowSetCache::moveToInsertRow( )
// we don't unbound the bookmark column
ORowSetValueVector::Vector::iterator aIter = (*m_aInsertRow)->get().begin()+1;
- for(;aIter != (*m_aInsertRow)->get().end();++aIter)
+ ORowSetValueVector::Vector::iterator aEnd = (*m_aInsertRow)->get().end();
+ for(;aIter != aEnd;++aIter)
{
aIter->setBound(sal_False);
aIter->setModified(sal_False);
@@ -1343,7 +1352,6 @@ void ORowSetCache::moveToInsertRow( )
// -------------------------------------------------------------------------
ORowSetCacheIterator ORowSetCache::createIterator(ORowSetBase* _pRowSet)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::createIterator" );
ORowSetCacheIterator_Helper aHelper;
aHelper.aIterator = m_pMatrix->end();
@@ -1351,14 +1359,29 @@ ORowSetCacheIterator ORowSetCache::createIterator(ORowSetBase* _pRowSet)
return ORowSetCacheIterator(m_aCacheIterators.insert(m_aCacheIterators.begin(),ORowSetCacheMap::value_type(m_aCacheIterators.size()+1,aHelper)),this,_pRowSet);
}
// -----------------------------------------------------------------------------
+void ORowSetCache::deleteIterator(const ORowSetBase* _pRowSet)
+{
+ ORowSetCacheMap::iterator aCacheIter = m_aCacheIterators.begin();
+ for(;aCacheIter != m_aCacheIterators.end();)
+ {
+ if ( aCacheIter->second.pRowSet == _pRowSet )
+ {
+ m_aCacheIterators.erase(aCacheIter);
+ aCacheIter = m_aCacheIterators.begin();
+ } // if ( aCacheIter->second.pRowSet == _pRowSet )
+ else
+ ++aCacheIter;
+ }
+}
+// -----------------------------------------------------------------------------
void ORowSetCache::rotateCacheIterator(ORowSetMatrix::difference_type _nDist)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::rotateCacheIterator" );
if(_nDist)
{
// now correct the iterator in our iterator vector
ORowSetCacheMap::iterator aCacheIter = m_aCacheIterators.begin();
- for(;aCacheIter != m_aCacheIterators.end();++aCacheIter)
+ ORowSetCacheMap::iterator aCacheEnd = m_aCacheIterators.end();
+ for(;aCacheIter != aCacheEnd;++aCacheIter)
{
if ( !aCacheIter->second.pRowSet->isInsertRow()
&& aCacheIter->second.aIterator != m_pMatrix->end() && !m_bModified )
@@ -1382,7 +1405,6 @@ void ORowSetCache::rotateCacheIterator(ORowSetMatrix::difference_type _nDist)
// -------------------------------------------------------------------------
void ORowSetCache::setUpdateIterator(const ORowSetMatrix::iterator& _rOriginalRow)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::setUpdateIterator" );
m_aInsertRow = m_pInsertMatrix->begin();
if(!m_aInsertRow->isValid())
*m_aInsertRow = new ORowSetValueVector(m_xMetaData->getColumnCount());
@@ -1390,13 +1412,13 @@ void ORowSetCache::setUpdateIterator(const ORowSetMatrix::iterator& _rOriginalRo
(*(*m_aInsertRow)) = (*(*_rOriginalRow));
// we don't unbound the bookmark column
ORowSetValueVector::Vector::iterator aIter = (*m_aInsertRow)->get().begin();
- for(;aIter != (*m_aInsertRow)->get().end();++aIter)
+ ORowSetValueVector::Vector::iterator aEnd = (*m_aInsertRow)->get().end();
+ for(;aIter != aEnd;++aIter)
aIter->setModified(sal_False);
}
// -----------------------------------------------------------------------------
void ORowSetCache::checkPositionFlags()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::checkPositionFlags" );
if(m_bRowCountFinal)
{
m_bAfterLast = m_nPosition > m_nRowCount;
@@ -1407,14 +1429,12 @@ void ORowSetCache::checkPositionFlags()
// -----------------------------------------------------------------------------
void ORowSetCache::checkUpdateConditions(sal_Int32 columnIndex)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::checkUpdateConditions" );
if(m_bAfterLast || columnIndex >= (sal_Int32)(*m_aInsertRow)->get().size())
throwFunctionSequenceException(m_xSet.get());
}
//------------------------------------------------------------------------------
sal_Bool ORowSetCache::checkInnerJoin(const ::connectivity::OSQLParseNode *pNode,const Reference< XConnection>& _xConnection,const ::rtl::OUString& _sUpdateTableName)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::checkInnerJoin" );
sal_Bool bOk = sal_False;
if (pNode->count() == 3 && // Ausdruck is geklammert
SQL_ISPUNCTUATION(pNode->getChild(0),"(") &&
@@ -1456,7 +1476,6 @@ sal_Bool ORowSetCache::checkJoin(const Reference< XConnection>& _xConnection,
const Reference< XSingleSelectQueryAnalyzer >& _xAnalyzer,
const ::rtl::OUString& _sUpdateTableName )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::checkJoin" );
sal_Bool bOk = sal_False;
::rtl::OUString sSql = _xAnalyzer->getQuery();
::rtl::OUString sErrorMsg;
@@ -1515,7 +1534,6 @@ sal_Bool ORowSetCache::checkJoin(const Reference< XConnection>& _xConnection,
// -----------------------------------------------------------------------------
void ORowSetCache::clearInsertRow()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::clearInsertRow" );
// we don't unbound the bookmark column
if ( m_aInsertRow != m_pInsertMatrix->end() && m_aInsertRow->isValid() )
{
@@ -1532,7 +1550,6 @@ void ORowSetCache::clearInsertRow()
// -----------------------------------------------------------------------------
ORowSetMatrix::iterator ORowSetCache::calcPosition() const
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::calcPosition" );
sal_Int32 nValue = (m_nPosition - m_nStartPos) - 1;
CHECK_MATRIX_POS(nValue);
return ( nValue < 0 || nValue >= static_cast<sal_Int32>(m_pMatrix->size()) ) ? m_pMatrix->end() : (m_pMatrix->begin() + nValue);
@@ -1541,7 +1558,6 @@ ORowSetMatrix::iterator ORowSetCache::calcPosition() const
TORowSetOldRowHelperRef ORowSetCache::registerOldRow()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::registerOldRow" );
TORowSetOldRowHelperRef pRef = new ORowSetOldRowHelper(ORowSetRow());
m_aOldRows.push_back(pRef);
return pRef;
@@ -1549,8 +1565,8 @@ TORowSetOldRowHelperRef ORowSetCache::registerOldRow()
// -----------------------------------------------------------------------------
void ORowSetCache::deregisterOldRow(const TORowSetOldRowHelperRef& _rRow)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::deregisterOldRow" );
- for (TOldRowSetRows::iterator aOldRowIter = m_aOldRows.begin(); aOldRowIter != m_aOldRows.end(); ++aOldRowIter)
+ TOldRowSetRows::iterator aOldRowEnd = m_aOldRows.end();
+ for (TOldRowSetRows::iterator aOldRowIter = m_aOldRows.begin(); aOldRowIter != aOldRowEnd; ++aOldRowIter)
{
if ( aOldRowIter->getBodyPtr() == _rRow.getBodyPtr() )
{
@@ -1563,8 +1579,8 @@ void ORowSetCache::deregisterOldRow(const TORowSetOldRowHelperRef& _rRow)
// -----------------------------------------------------------------------------
sal_Bool ORowSetCache::reFillMatrix(sal_Int32 _nNewStartPos,sal_Int32 _nNewEndPos)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::reFillMatrix" );
- for (TOldRowSetRows::iterator aOldRowIter = m_aOldRows.begin(); aOldRowIter != m_aOldRows.end(); ++aOldRowIter)
+ TOldRowSetRows::iterator aOldRowEnd = m_aOldRows.end();
+ for (TOldRowSetRows::iterator aOldRowIter = m_aOldRows.begin(); aOldRowIter != aOldRowEnd; ++aOldRowIter)
{
if ( aOldRowIter->isValid() && aOldRowIter->getBody().getRow().isValid() )
aOldRowIter->getBody().setRow(new ORowSetValueVector(aOldRowIter->getBody().getRow().getBody()) );
@@ -1578,7 +1594,6 @@ sal_Bool ORowSetCache::reFillMatrix(sal_Int32 _nNewStartPos,sal_Int32 _nNewEndPo
// -----------------------------------------------------------------------------
sal_Bool ORowSetCache::fill(ORowSetMatrix::iterator& _aIter,const ORowSetMatrix::iterator& _aEnd,sal_Int32& _nPos,sal_Bool _bCheck)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetCache::fill" );
sal_Int32 nColumnCount = m_xMetaData->getColumnCount();
for(; _bCheck && _aIter != _aEnd;)
{
@@ -1586,7 +1601,8 @@ sal_Bool ORowSetCache::fill(ORowSetMatrix::iterator& _aIter,const ORowSetMatrix:
*_aIter = new ORowSetValueVector(nColumnCount);
else
{
- for (TOldRowSetRows::iterator aOldRowIter = m_aOldRows.begin(); aOldRowIter != m_aOldRows.end(); ++aOldRowIter)
+ TOldRowSetRows::iterator aOldRowEnd = m_aOldRows.end();
+ for (TOldRowSetRows::iterator aOldRowIter = m_aOldRows.begin(); aOldRowIter != aOldRowEnd; ++aOldRowIter)
{
if ( aOldRowIter->getBody().getRow().isEqualBody(*_aIter) )
*_aIter = new ORowSetValueVector(nColumnCount);
diff --git a/dbaccess/source/core/api/RowSetCache.hxx b/dbaccess/source/core/api/RowSetCache.hxx
index f89a1cd82caa..0576aa68ac02 100644
--- a/dbaccess/source/core/api/RowSetCache.hxx
+++ b/dbaccess/source/core/api/RowSetCache.hxx
@@ -194,13 +194,15 @@ namespace dbaccess
const ::comphelper::ComponentContext& _rContext,
const ::rtl::OUString& _rUpdateTableName,
sal_Bool& _bModified,
- sal_Bool& _bNew);
+ sal_Bool& _bNew,
+ const ORowSetValueVector& _aParameterValueForCache);
~ORowSetCache();
// called from the rowset when a updateXXX was called for the first time
void setUpdateIterator(const ORowSetMatrix::iterator& _rOriginalRow);
ORowSetCacheIterator createIterator(ORowSetBase* _pRowSet);
+ void deleteIterator(const ORowSetBase* _pRowSet);
// sets the size of the matrix
void setMaxRowSize(sal_Int32 _nSize);
diff --git a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
index 4583dd3dfabf..548b99fd565a 100644
--- a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
+++ b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
@@ -262,7 +262,8 @@ OSingleSelectQueryComposer::~OSingleSelectQueryComposer()
delete *aColIter;
::std::vector<OPrivateTables*>::iterator aTabIter = m_aTablesCollection.begin();
- for(;aTabIter != m_aTablesCollection.end();++aTabIter)
+ ::std::vector<OPrivateTables*>::iterator aTabEnd = m_aTablesCollection.end();
+ for(;aTabIter != aTabEnd;++aTabIter)
delete *aTabIter;
}
// -------------------------------------------------------------------------
@@ -572,14 +573,19 @@ void OSingleSelectQueryComposer::setSingleAdditiveClause( SQLPart _ePart, const
*pComposer, getKeyword( _ePart ) );
// construct the complete statement
- ::rtl::OUString aSql(m_aPureSelectSQL);
+ ::rtl::OUStringBuffer aSql(m_aPureSelectSQL);
for ( SQLPart eLoopParts = Where; eLoopParts != SQLPartCount; incSQLPart( eLoopParts ) )
- aSql += aClauses[ eLoopParts ];
+ aSql.append(aClauses[ eLoopParts ]);
// set the query
- setQuery_Impl(aSql);
- // parameters may also have changed
- clearParametersCollection();
+ setQuery_Impl(aSql.makeStringAndClear());
+
+ // clear column collections which (might) have changed
+ clearColumns( ParameterColumns );
+ if ( _ePart == Order )
+ clearColumns( OrderColumns );
+ if ( _ePart == Group )
+ clearColumns( GroupByColumns );
// also, since the "additive filter" change, we need to rebuild our "additive" statement
aSql = m_aPureSelectSQL;
@@ -590,10 +596,10 @@ void OSingleSelectQueryComposer::setSingleAdditiveClause( SQLPart _ePart, const
aClauses[ _ePart ] = getComposedClause( ::rtl::OUString(), _rClause, *pComposer, getKeyword( _ePart ) );
// and parse it, so that m_aAdditiveIterator is up to date
for ( SQLPart eLoopParts = Where; eLoopParts != SQLPartCount; incSQLPart( eLoopParts ) )
- aSql += aClauses[ eLoopParts ];
+ aSql.append(aClauses[ eLoopParts ]);
try
{
- parseAndCheck_throwError( m_aSqlParser, aSql, m_aAdditiveIterator, *this );
+ parseAndCheck_throwError( m_aSqlParser, aSql.makeStringAndClear(), m_aAdditiveIterator, *this );
}
catch( const Exception& e )
{
@@ -642,7 +648,8 @@ Reference< XNameAccess > SAL_CALL OSingleSelectQueryComposer::getTables( ) thro
{
const OSQLTables& aTables = m_aSqlIterator.getTables();
::std::vector< ::rtl::OUString> aNames;
- for(OSQLTables::const_iterator aIter = aTables.begin(); aIter != aTables.end();++aIter)
+ OSQLTables::const_iterator aEnd = aTables.end();
+ for(OSQLTables::const_iterator aIter = aTables.begin(); aIter != aEnd;++aIter)
aNames.push_back(aIter->first);
m_pTables = new OPrivateTables(aTables,m_xMetaData->supportsMixedCaseQuotedIdentifiers(),*this,m_aMutex,aNames);
@@ -674,26 +681,42 @@ Reference< XNameAccess > SAL_CALL OSingleSelectQueryComposer::getColumns( ) thr
bCase = m_xMetaData->supportsMixedCaseQuotedIdentifiers();
aSelectColumns = m_aSqlIterator.getSelectColumns();
- ::rtl::OUString sSql = m_aPureSelectSQL;
- sSql += STR_WHERE;
- sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" 0 = 1 "));
- ::rtl::OUString sGroupBy = getSQLPart(Group,m_aSqlIterator,sal_True);
+ ::rtl::OUStringBuffer aSQL;
+ aSQL.append( m_aPureSelectSQL );
+ aSQL.append( STR_WHERE );
+
+ // preserve the original WHERE clause
+ // #i102234# / 2009-06-02 / frank.schoenheit@sun.com
+ ::rtl::OUString sOriginalWhereClause = getSQLPart( Where, m_aSqlIterator, sal_False );
+ if ( sOriginalWhereClause.getLength() )
+ {
+ aSQL.appendAscii( " ( 0 = 1 ) AND ( " );
+ aSQL.append( sOriginalWhereClause );
+ aSQL.appendAscii( " ) " );
+ }
+ else
+ {
+ aSQL.appendAscii( " ( 0 = 1 ) " );
+ }
+
+ ::rtl::OUString sGroupBy = getSQLPart( Group, m_aSqlIterator, sal_True );
if ( sGroupBy.getLength() )
- sSql += sGroupBy;
+ aSQL.append( sGroupBy );
+ ::rtl::OUString sSQL( aSQL.makeStringAndClear() );
// normalize the statement so that it doesn't contain any application-level features anymore
::rtl::OUString sError;
- const ::std::auto_ptr< OSQLParseNode > pStatementTree( m_aSqlParser.parseTree( sError, sSql, false ) );
+ const ::std::auto_ptr< OSQLParseNode > pStatementTree( m_aSqlParser.parseTree( sError, sSQL, false ) );
DBG_ASSERT( pStatementTree.get(), "OSingleSelectQueryComposer::getColumns: could not parse the column retrieval statement!" );
if ( pStatementTree.get() )
- if ( !pStatementTree->parseNodeToExecutableStatement( sSql, m_xConnection, m_aSqlParser, NULL ) )
+ if ( !pStatementTree->parseNodeToExecutableStatement( sSQL, m_xConnection, m_aSqlParser, NULL ) )
break;
Reference< XResultSetMetaData > xResultSetMeta;
Reference< XResultSetMetaDataSupplier > xResMetaDataSup;
try
{
- xPreparedStatement.set( m_xConnection->prepareStatement( sSql ), UNO_QUERY_THROW );
+ xPreparedStatement.set( m_xConnection->prepareStatement( sSQL ), UNO_QUERY_THROW );
xResMetaDataSup.set( xPreparedStatement, UNO_QUERY_THROW );
xResultSetMeta.set( xResMetaDataSup->getMetaData(), UNO_QUERY_THROW );
}
@@ -705,7 +728,7 @@ Reference< XNameAccess > SAL_CALL OSingleSelectQueryComposer::getColumns( ) thr
Reference< XPropertySet > xStatementProps( xStatement, UNO_QUERY_THROW );
try { xStatementProps->setPropertyValue( PROPERTY_ESCAPE_PROCESSING, makeAny( sal_False ) ); }
catch ( const Exception& ) { DBG_UNHANDLED_EXCEPTION(); }
- xResMetaDataSup.set( xStatement->executeQuery( sSql ), UNO_QUERY_THROW );
+ xResMetaDataSup.set( xStatement->executeQuery( sSQL ), UNO_QUERY_THROW );
xResultSetMeta.set( xResMetaDataSup->getMetaData(), UNO_QUERY_THROW );
}
@@ -1232,7 +1255,8 @@ Reference< XIndexAccess > SAL_CALL OSingleSelectQueryComposer::getParameters( )
{
::vos::ORef< OSQLColumns> aCols = m_aSqlIterator.getParameters();
::std::vector< ::rtl::OUString> aNames;
- for(OSQLColumns::Vector::const_iterator aIter = aCols->get().begin(); aIter != aCols->get().end();++aIter)
+ OSQLColumns::Vector::const_iterator aEnd = aCols->get().end();
+ for(OSQLColumns::Vector::const_iterator aIter = aCols->get().begin(); aIter != aEnd;++aIter)
aNames.push_back(getString((*aIter)->getPropertyValue(PROPERTY_NAME)));
m_aCurrentColumns[ParameterColumns] = new OPrivateColumns(aCols,m_xMetaData->supportsMixedCaseQuotedIdentifiers(),*this,m_aMutex,aNames,sal_True);
}
@@ -1240,14 +1264,15 @@ Reference< XIndexAccess > SAL_CALL OSingleSelectQueryComposer::getParameters( )
return m_aCurrentColumns[ParameterColumns];
}
// -----------------------------------------------------------------------------
-void OSingleSelectQueryComposer::clearParametersCollection()
+void OSingleSelectQueryComposer::clearColumns( const EColumnType _eType )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::clearParametersCollection" );
- if ( m_aCurrentColumns[ParameterColumns] )
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::clearColumns" );
+ OPrivateColumns* pColumns = m_aCurrentColumns[ _eType ];
+ if ( pColumns != NULL )
{
- m_aCurrentColumns[ParameterColumns]->disposing();
- m_aColumnsCollection.push_back(m_aCurrentColumns[ParameterColumns]);
- m_aCurrentColumns[ParameterColumns] = NULL;
+ pColumns->disposing();
+ m_aColumnsCollection.push_back( pColumns );
+ m_aCurrentColumns[ _eType ] = NULL;
}
}
// -----------------------------------------------------------------------------
@@ -1285,7 +1310,8 @@ Reference< XIndexAccess > OSingleSelectQueryComposer::setCurrentColumns( EColumn
if ( !m_aCurrentColumns[_eType] )
{
::std::vector< ::rtl::OUString> aNames;
- for(OSQLColumns::Vector::const_iterator aIter = _rCols->get().begin(); aIter != _rCols->get().end();++aIter)
+ OSQLColumns::Vector::const_iterator aEnd = _rCols->get().end();
+ for(OSQLColumns::Vector::const_iterator aIter = _rCols->get().begin(); aIter != aEnd;++aIter)
aNames.push_back(getString((*aIter)->getPropertyValue(PROPERTY_NAME)));
m_aCurrentColumns[_eType] = new OPrivateColumns(_rCols,m_xMetaData->supportsMixedCaseQuotedIdentifiers(),*this,m_aMutex,aNames,sal_True);
}
@@ -1340,75 +1366,75 @@ namespace
{
::rtl::OUString lcl_getCondition(const Sequence< Sequence< PropertyValue > >& filter )
{
- ::rtl::OUString sRet;
+ ::rtl::OUStringBuffer sRet;
const Sequence< PropertyValue >* pOrIter = filter.getConstArray();
const Sequence< PropertyValue >* pOrEnd = pOrIter + filter.getLength();
while ( pOrIter != pOrEnd )
{
if ( pOrIter->getLength() )
{
- sRet += L_BRACKET;
+ sRet.append(L_BRACKET);
const PropertyValue* pAndIter = pOrIter->getConstArray();
const PropertyValue* pAndEnd = pAndIter + pOrIter->getLength();
while ( pAndIter != pAndEnd )
{
- sRet += pAndIter->Name;
+ sRet.append(pAndIter->Name);
::rtl::OUString sValue;
pAndIter->Value >>= sValue;
switch( pAndIter->Handle )
{
case SQLFilterOperator::EQUAL:
- sRet += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" = "));
- sRet += sValue;
+ sRet.append(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" = ")));
+ sRet.append(sValue);
break;
case SQLFilterOperator::NOT_EQUAL:
- sRet += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" <> "));
- sRet += sValue;
+ sRet.append(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" <> ")));
+ sRet.append(sValue);
break;
case SQLFilterOperator::LESS:
- sRet += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" < "));
- sRet += sValue;
+ sRet.append(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" < ")));
+ sRet.append(sValue);
break;
case SQLFilterOperator::GREATER:
- sRet += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" > "));
- sRet += sValue;
+ sRet.append(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" > ")));
+ sRet.append(sValue);
break;
case SQLFilterOperator::LESS_EQUAL:
- sRet += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" <= "));
- sRet += sValue;
+ sRet.append(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" <= ")));
+ sRet.append(sValue);
break;
case SQLFilterOperator::GREATER_EQUAL:
- sRet += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" >= "));
- sRet += sValue;
+ sRet.append(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" >= ")));
+ sRet.append(sValue);
break;
case SQLFilterOperator::LIKE:
- sRet += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" LIKE "));
- sRet += sValue;
+ sRet.append(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" LIKE ")));
+ sRet.append(sValue);
break;
case SQLFilterOperator::NOT_LIKE:
- sRet += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" NOT LIKE "));
- sRet += sValue;
+ sRet.append(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" NOT LIKE ")));
+ sRet.append(sValue);
break;
case SQLFilterOperator::SQLNULL:
- sRet += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" IS NULL")) ;
+ sRet.append(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" IS NULL")) );
break;
case SQLFilterOperator::NOT_SQLNULL:
- sRet += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" IS NOT NULL")) ;
+ sRet.append(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" IS NOT NULL")) );
break;
default:
throw IllegalArgumentException();
}
++pAndIter;
if ( pAndIter != pAndEnd )
- sRet += STR_AND;
+ sRet.append(STR_AND);
}
- sRet += R_BRACKET;
+ sRet.append(R_BRACKET);
}
++pOrIter;
if ( pOrIter != pOrEnd && sRet.getLength() )
- sRet += STR_OR;
+ sRet.append(STR_OR);
}
- return sRet;
+ return sRet.makeStringAndClear();
}
}
// -----------------------------------------------------------------------------
@@ -1431,7 +1457,8 @@ void OSingleSelectQueryComposer::setConditionByColumn( const Reference< XPropert
if ( !column.is()
|| !column->getPropertySetInfo()->hasPropertyByName(PROPERTY_VALUE)
- || !column->getPropertySetInfo()->hasPropertyByName(PROPERTY_NAME) )
+ || !column->getPropertySetInfo()->hasPropertyByName(PROPERTY_NAME)
+ || !column->getPropertySetInfo()->hasPropertyByName(PROPERTY_TYPE))
throw SQLException(DBACORE_RESSTRING(RID_STR_COLUMN_NOT_VALID),*this,SQLSTATE_GENERAL,1000,Any() );
sal_Int32 nType = 0;
diff --git a/dbaccess/source/core/api/resultset.cxx b/dbaccess/source/core/api/resultset.cxx
index d924f5faf738..a5f5c3b84bba 100644
--- a/dbaccess/source/core/api/resultset.cxx
+++ b/dbaccess/source/core/api/resultset.cxx
@@ -1,1211 +1,1211 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: resultset.cxx,v $
- * $Revision: 1.21 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_dbaccess.hxx"
-#ifndef _DBA_COREAPI_RESULTSET_HXX_
-#include <resultset.hxx>
-#endif
-#ifndef DBACCESS_SHARED_DBASTRINGS_HRC
-#include "dbastrings.hrc"
-#endif
-#ifndef _DBASHARED_APITOOLS_HXX_
-#include "apitools.hxx"
-#endif
-#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_
-#include <com/sun/star/lang/DisposedException.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBC_RESULTSETTYPE_HPP_
-#include <com/sun/star/sdbc/ResultSetType.hpp>
-#endif
-#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
-#include <cppuhelper/typeprovider.hxx>
-#endif
-#ifndef _COMPHELPER_PROPERTY_HXX_
-#include <comphelper/property.hxx>
-#endif
-#ifndef _COMPHELPER_SEQUENCE_HXX_
-#include <comphelper/sequence.hxx>
-#endif
-#ifndef _COMPHELPER_TYPES_HXX_
-#include <comphelper/types.hxx>
-#endif
-#ifndef _TOOLS_DEBUG_HXX //autogen
-#include <tools/debug.hxx>
-#endif
-#ifndef TOOLS_DIAGNOSE_EX_H
-#include <tools/diagnose_ex.h>
-#endif
-#ifndef _DBA_COREAPI_DATACOLUMN_HXX_
-#include <datacolumn.hxx>
-#endif
-#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_
-#include <com/sun/star/beans/PropertyAttribute.hpp>
-#endif
-#ifndef _DBHELPER_DBEXCEPTION_HXX_
-#include <connectivity/dbexception.hxx>
-#endif
-#ifndef _CONNECTIVITY_DBTOOLS_HXX_
-#include <connectivity/dbtools.hxx>
-#endif
-#ifndef _CPPUHELPER_EXC_HLP_HXX_
-#include <cppuhelper/exc_hlp.hxx>
-#endif
-#ifndef _OSL_THREAD_H_
-#include <osl/thread.h>
-#endif
-#include <rtl/logfile.hxx>
-
-
-using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::sdbcx;
-//using namespace ::com::sun::star::sdb;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::container;
-using namespace ::cppu;
-using namespace ::osl;
-using namespace dbaccess;
-using namespace dbtools;
-
-DBG_NAME(OResultSet)
-
-//--------------------------------------------------------------------------
-OResultSet::OResultSet(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet >& _xResultSet,
- const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xStatement,
- sal_Bool _bCaseSensitive)
- :OResultSetBase(m_aMutex)
- ,OPropertySetHelper(OResultSetBase::rBHelper)
- ,m_xDelegatorResultSet(_xResultSet)
- ,m_aWarnings( Reference< XWarningsSupplier >( _xResultSet, UNO_QUERY ) )
- ,m_bIsBookmarkable(sal_False)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::OResultSet" );
- DBG_CTOR(OResultSet, NULL);
-
- m_pColumns = new OColumns(*this, m_aMutex, _bCaseSensitive, ::std::vector< ::rtl::OUString>(), NULL,NULL);
-
- try
- {
- m_aStatement = _xStatement;
- m_xDelegatorResultSetUpdate = m_xDelegatorResultSetUpdate.query( m_xDelegatorResultSet );
- m_xDelegatorRow = m_xDelegatorRow.query( m_xDelegatorResultSet );
- m_xDelegatorRowUpdate = m_xDelegatorRowUpdate.query( m_xDelegatorResultSet );
-
- Reference< XPropertySet > xSet(m_xDelegatorResultSet, UNO_QUERY);
- xSet->getPropertyValue(PROPERTY_RESULTSETTYPE) >>= m_nResultSetType;
- xSet->getPropertyValue(PROPERTY_RESULTSETCONCURRENCY) >>= m_nResultSetConcurrency;
-
- // test for Bookmarks
- if (ResultSetType::FORWARD_ONLY != m_nResultSetType)
- {
- Reference <XPropertySetInfo > xInfo(xSet->getPropertySetInfo());
- if (xInfo->hasPropertyByName(PROPERTY_ISBOOKMARKABLE))
- {
- m_bIsBookmarkable = ::comphelper::getBOOL(xSet->getPropertyValue(PROPERTY_ISBOOKMARKABLE));
- OSL_ENSURE( !m_bIsBookmarkable || Reference< XRowLocate >(m_xDelegatorResultSet, UNO_QUERY).is(),
- "OResultSet::OResultSet: aggregate is inconsistent in it's bookmarkable attribute!" );
- m_bIsBookmarkable = m_bIsBookmarkable && Reference< XRowLocate >(m_xDelegatorResultSet, UNO_QUERY).is();
- }
- }
- }
- catch(Exception&)
- {
- }
-}
-
-//--------------------------------------------------------------------------
-OResultSet::~OResultSet()
-{
- m_pColumns->acquire();
- m_pColumns->disposing();
- delete m_pColumns;
-
- DBG_DTOR(OResultSet, NULL);
-}
-
-// com::sun::star::lang::XTypeProvider
-//--------------------------------------------------------------------------
-Sequence< Type > OResultSet::getTypes() throw (RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getTypes" );
- OTypeCollection aTypes(::getCppuType( (const Reference< XPropertySet > *)0 ),
- OResultSetBase::getTypes());
-
- return aTypes.getTypes();
-}
-
-//--------------------------------------------------------------------------
-Sequence< sal_Int8 > OResultSet::getImplementationId() throw (RuntimeException)
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getImplementationId" );
- static OImplementationId * pId = 0;
- if (! pId)
- {
- MutexGuard aGuard( Mutex::getGlobalMutex() );
- if (! pId)
- {
- static OImplementationId aId;
- pId = &aId;
- }
- }
- return pId->getImplementationId();
-}
-
-// com::sun::star::uno::XInterface
-//--------------------------------------------------------------------------
-Any OResultSet::queryInterface( const Type & rType ) throw (RuntimeException)
-{
- //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::queryInterface" );
- Any aIface = OResultSetBase::queryInterface( rType );
- if (!aIface.hasValue())
- aIface = ::cppu::queryInterface(
- rType,
- static_cast< XPropertySet * >( this ));
-
- return aIface;
-}
-
-//--------------------------------------------------------------------------
-void OResultSet::acquire() throw ()
-{
- OResultSetBase::acquire();
-}
-
-//--------------------------------------------------------------------------
-void OResultSet::release() throw ()
-{
- OResultSetBase::release();
-}
-
-
-// OResultSetBase
-//------------------------------------------------------------------------------
-void OResultSet::disposing()
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::disposing" );
- OPropertySetHelper::disposing();
-
- MutexGuard aGuard(m_aMutex);
-
- // free the columns
- m_pColumns->disposing();
-
- // close the pending result set
- Reference< XCloseable > (m_xDelegatorResultSet, UNO_QUERY)->close();
-
- m_xDelegatorResultSet = NULL;
- m_xDelegatorRow = NULL;
- m_xDelegatorRowUpdate = NULL;
-
- m_aStatement = Reference< XInterface >();
-}
-
-// XCloseable
-//------------------------------------------------------------------------------
-void OResultSet::close(void) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::close" );
- {
- MutexGuard aGuard( m_aMutex );
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
- }
- dispose();
-}
-
-// XServiceInfo
-//------------------------------------------------------------------------------
-rtl::OUString OResultSet::getImplementationName( ) throw(RuntimeException)
-{
- //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getImplementationName" );
- return rtl::OUString::createFromAscii("com.sun.star.sdb.OResultSet");
-}
-
-//------------------------------------------------------------------------------
-sal_Bool OResultSet::supportsService( const ::rtl::OUString& _rServiceName ) throw (RuntimeException)
-{
- //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::supportsService" );
- return ::comphelper::findValue(getSupportedServiceNames(), _rServiceName, sal_True).getLength() != 0;
-}
-
-//------------------------------------------------------------------------------
-Sequence< ::rtl::OUString > OResultSet::getSupportedServiceNames( ) throw (RuntimeException)
-{
- //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getSupportedServiceNames" );
- Sequence< ::rtl::OUString > aSNS( 2 );
- aSNS[0] = SERVICE_SDBC_RESULTSET;
- aSNS[1] = SERVICE_SDB_RESULTSET;
- return aSNS;
-}
-
-// com::sun::star::beans::XPropertySet
-//------------------------------------------------------------------------------
-Reference< XPropertySetInfo > OResultSet::getPropertySetInfo() throw (RuntimeException)
-{
- //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getPropertySetInfo" );
- return createPropertySetInfo( getInfoHelper() ) ;
-}
-
-// comphelper::OPropertyArrayUsageHelper
-//------------------------------------------------------------------------------
-::cppu::IPropertyArrayHelper* OResultSet::createArrayHelper( ) const
-{
- //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::createArrayHelper" );
- BEGIN_PROPERTY_HELPER(6)
- DECL_PROP1(CURSORNAME, ::rtl::OUString, READONLY);
- DECL_PROP0(FETCHDIRECTION, sal_Int32);
- DECL_PROP0(FETCHSIZE, sal_Int32);
- DECL_PROP1_BOOL(ISBOOKMARKABLE, READONLY);
- DECL_PROP1(RESULTSETCONCURRENCY, sal_Int32, READONLY);
- DECL_PROP1(RESULTSETTYPE, sal_Int32, READONLY);
- END_PROPERTY_HELPER();
-}
-
-// cppu::OPropertySetHelper
-//------------------------------------------------------------------------------
-::cppu::IPropertyArrayHelper& OResultSet::getInfoHelper()
-{
- //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getInfoHelper" );
- return *getArrayHelper();
-}
-
-//------------------------------------------------------------------------------
-sal_Bool OResultSet::convertFastPropertyValue(Any & rConvertedValue, Any & rOldValue, sal_Int32 nHandle, const Any& rValue ) throw( IllegalArgumentException )
-{
- //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::convertFastPropertyValue" );
- // be lazy ...
- rConvertedValue = rValue;
- getFastPropertyValue( rOldValue, nHandle );
- return sal_True;
-}
-
-//------------------------------------------------------------------------------
-void OResultSet::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const Any& rValue ) throw (Exception)
-{
- //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::setFastPropertyValue_NoBroadcast" );
- // set it for the driver result set
- Reference< XPropertySet > xSet(m_xDelegatorResultSet, UNO_QUERY);
- switch (nHandle)
- {
- case PROPERTY_ID_FETCHDIRECTION:
- xSet->setPropertyValue(PROPERTY_FETCHDIRECTION, rValue);
- break;
- case PROPERTY_ID_FETCHSIZE:
- xSet->setPropertyValue(PROPERTY_FETCHSIZE, rValue);
- break;
- default:
- DBG_ERROR("unknown Property");
- }
-}
-
-//------------------------------------------------------------------------------
-void OResultSet::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const
-{
- //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getFastPropertyValue" );
- switch (nHandle)
- {
- case PROPERTY_ID_ISBOOKMARKABLE:
- {
- sal_Bool bVal = m_bIsBookmarkable;
- rValue.setValue(&bVal, getBooleanCppuType());
- } break;
- default:
- {
- // get the property name
- ::rtl::OUString aPropName;
- sal_Int16 nAttributes;
- const_cast<OResultSet*>(this)->getInfoHelper().
- fillPropertyMembersByHandle(&aPropName, &nAttributes, nHandle);
- OSL_ENSURE(aPropName.getLength(), "property not found?");
-
- // now read the value
- rValue = Reference< XPropertySet >(m_xDelegatorResultSet, UNO_QUERY)->getPropertyValue(aPropName);
- }
- }
-}
-
-// XWarningsSupplier
-//------------------------------------------------------------------------------
-Any OResultSet::getWarnings(void) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getWarnings" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
- return m_aWarnings.getWarnings();
-}
-
-//------------------------------------------------------------------------------
-void OResultSet::clearWarnings(void) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::clearWarnings" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
- m_aWarnings.clearWarnings();
-}
-
-// ::com::sun::star::sdbc::XResultSetMetaDataSupplier
-//------------------------------------------------------------------------------
-Reference< XResultSetMetaData > OResultSet::getMetaData(void) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getMetaData" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return Reference< XResultSetMetaDataSupplier >(m_xDelegatorResultSet, UNO_QUERY)->getMetaData();
-}
-
-// ::com::sun::star::sdbc::XColumnLocate
-//------------------------------------------------------------------------------
-sal_Int32 OResultSet::findColumn(const rtl::OUString& columnName) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::findColumn" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return Reference< XColumnLocate >(m_xDelegatorResultSet, UNO_QUERY)->findColumn(columnName);
-}
-
-//------------------------------------------------------------------------------
-namespace
-{
- static Reference< XDatabaseMetaData > lcl_getDBMetaDataFromStatement_nothrow( const Reference< XInterface >& _rxStatement )
- {
- Reference< XDatabaseMetaData > xDBMetaData;
- try
- {
- Reference< XStatement > xStatement( _rxStatement, UNO_QUERY );
- Reference< XPreparedStatement > xPreparedStatement( _rxStatement, UNO_QUERY );
- Reference< XConnection > xConn;
- if ( xStatement.is() )
- xConn = xStatement->getConnection();
- else if ( xPreparedStatement.is() )
- xConn = xPreparedStatement->getConnection();
- if ( xConn.is() )
- xDBMetaData = xConn->getMetaData();
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- return xDBMetaData;
- }
-}
-// ::com::sun::star::sdbcx::XColumnsSupplier
-//------------------------------------------------------------------------------
-Reference< ::com::sun::star::container::XNameAccess > OResultSet::getColumns(void) throw( RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getColumns" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- // do we have to populate the columns
- if (!m_pColumns->isInitialized())
- {
- // get the metadata
- Reference< XResultSetMetaData > xMetaData = Reference< XResultSetMetaDataSupplier >(m_xDelegatorResultSet, UNO_QUERY)->getMetaData();
-
- sal_Int32 nColCount = 0;
- // do we have columns
- try
- {
- Reference< XDatabaseMetaData > xDBMetaData( lcl_getDBMetaDataFromStatement_nothrow( getStatement() ) );
- nColCount = xMetaData->getColumnCount();
-
- for ( sal_Int32 i = 0; i < nColCount; ++i)
- {
- // retrieve the name of the column
- rtl::OUString sName = xMetaData->getColumnName(i + 1);
- ODataColumn* pColumn = new ODataColumn(xMetaData, m_xDelegatorRow, m_xDelegatorRowUpdate, i + 1, xDBMetaData);
-
- // don't silently assume that the name is unique - result set implementations
- // are allowed to return duplicate names, but we are required to have
- // unique column names
- if ( m_pColumns->hasByName( sName ) )
- sName = ::dbtools::createUniqueName( m_pColumns, sName );
-
- m_pColumns->append( sName, pColumn );
- }
- }
- catch ( const SQLException& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- m_pColumns->setInitialized();
-
- #if OSL_DEBUG_LEVEL > 0
- // some sanity checks. Especially in case we auto-adjusted the column names above,
- // this might be reasonable
- try
- {
- const Reference< XNameAccess > xColNames( static_cast< XNameAccess* >( m_pColumns ), UNO_SET_THROW );
- const Sequence< ::rtl::OUString > aNames( xColNames->getElementNames() );
- OSL_POSTCOND( aNames.getLength() == nColCount,
- "OResultSet::getColumns: invalid column count!" );
- for ( const ::rtl::OUString* pName = aNames.getConstArray();
- pName != aNames.getConstArray() + aNames.getLength();
- ++pName
- )
- {
- Reference< XPropertySet > xColProps( xColNames->getByName( *pName ), UNO_QUERY_THROW );
- ::rtl::OUString sName;
- OSL_VERIFY( xColProps->getPropertyValue( PROPERTY_NAME ) >>= sName );
- OSL_POSTCOND( sName == *pName, "OResultSet::getColumns: invalid column name!" );
- }
-
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- #endif
- }
- return m_pColumns;
-}
-
-// ::com::sun::star::sdbc::XRow
-//------------------------------------------------------------------------------
-sal_Bool OResultSet::wasNull(void) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::wasNull" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorRow->wasNull();
-}
-//------------------------------------------------------------------------------
-rtl::OUString OResultSet::getString(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
-{
- //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getString" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorRow->getString(columnIndex);
-}
-//------------------------------------------------------------------------------
-sal_Bool OResultSet::getBoolean(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
-{
- //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getBoolean" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorRow->getBoolean(columnIndex);
-}
-//------------------------------------------------------------------------------
-sal_Int8 OResultSet::getByte(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getByte" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorRow->getByte(columnIndex);
-}
-//------------------------------------------------------------------------------
-sal_Int16 OResultSet::getShort(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getShort" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorRow->getShort(columnIndex);
-}
-//------------------------------------------------------------------------------
-sal_Int32 OResultSet::getInt(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getInt" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorRow->getInt(columnIndex);
-}
-//------------------------------------------------------------------------------
-sal_Int64 OResultSet::getLong(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getLong" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorRow->getLong(columnIndex);
-}
-//------------------------------------------------------------------------------
-float OResultSet::getFloat(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getFloat" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorRow->getFloat(columnIndex);
-}
-//------------------------------------------------------------------------------
-double OResultSet::getDouble(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getDouble" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorRow->getDouble(columnIndex);
-}
-//------------------------------------------------------------------------------
-Sequence< sal_Int8 > OResultSet::getBytes(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getBytes" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorRow->getBytes(columnIndex);
-}
-//------------------------------------------------------------------------------
-::com::sun::star::util::Date OResultSet::getDate(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getDate" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorRow->getDate(columnIndex);
-}
-//------------------------------------------------------------------------------
-::com::sun::star::util::Time OResultSet::getTime(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getTime" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorRow->getTime(columnIndex);
-}
-//------------------------------------------------------------------------------
-::com::sun::star::util::DateTime OResultSet::getTimestamp(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getTimestamp" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorRow->getTimestamp(columnIndex);
-}
-//------------------------------------------------------------------------------
-Reference< ::com::sun::star::io::XInputStream > OResultSet::getBinaryStream(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getBinaryStream" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorRow->getBinaryStream(columnIndex);
-}
-//------------------------------------------------------------------------------
-Reference< ::com::sun::star::io::XInputStream > OResultSet::getCharacterStream(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getCharacterStream" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorRow->getCharacterStream(columnIndex);
-}
-//------------------------------------------------------------------------------
-Any OResultSet::getObject(sal_Int32 columnIndex, const Reference< ::com::sun::star::container::XNameAccess > & typeMap) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getObject" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorRow->getObject(columnIndex, typeMap);
-}
-//------------------------------------------------------------------------------
-Reference< XRef > OResultSet::getRef(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getRef" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorRow->getRef(columnIndex);
-}
-//------------------------------------------------------------------------------
-Reference< XBlob > OResultSet::getBlob(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getBlob" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorRow->getBlob(columnIndex);
-}
-//------------------------------------------------------------------------------
-Reference< XClob > OResultSet::getClob(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getClob" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorRow->getClob(columnIndex);
-}
-//------------------------------------------------------------------------------
-Reference< XArray > OResultSet::getArray(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getArray" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorRow->getArray(columnIndex);
-}
-
-// ::com::sun::star::sdbc::XRowUpdate
-//------------------------------------------------------------------------------
-void OResultSet::updateNull(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateNull" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- checkReadOnly();
-
- m_xDelegatorRowUpdate->updateNull(columnIndex);
-}
-
-//------------------------------------------------------------------------------
-void OResultSet::updateBoolean(sal_Int32 columnIndex, sal_Bool x) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateBoolean" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- checkReadOnly();
-
- m_xDelegatorRowUpdate->updateBoolean(columnIndex, x);
-}
-//------------------------------------------------------------------------------
-void OResultSet::updateByte(sal_Int32 columnIndex, sal_Int8 x) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateByte" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- checkReadOnly();
-
- m_xDelegatorRowUpdate->updateByte(columnIndex, x);
-}
-//------------------------------------------------------------------------------
-void OResultSet::updateShort(sal_Int32 columnIndex, sal_Int16 x) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateShort" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- checkReadOnly();
-
- m_xDelegatorRowUpdate->updateShort(columnIndex, x);
-}
-//------------------------------------------------------------------------------
-void OResultSet::updateInt(sal_Int32 columnIndex, sal_Int32 x) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateInt" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- checkReadOnly();
-
- m_xDelegatorRowUpdate->updateInt(columnIndex, x);
-}
-//------------------------------------------------------------------------------
-void OResultSet::updateLong(sal_Int32 columnIndex, sal_Int64 x) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateLong" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- checkReadOnly();
-
- m_xDelegatorRowUpdate->updateLong(columnIndex, x);
-}
-//------------------------------------------------------------------------------
-void OResultSet::updateFloat(sal_Int32 columnIndex, float x) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateFloat" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- checkReadOnly();
-
- m_xDelegatorRowUpdate->updateFloat(columnIndex, x);
-}
-//------------------------------------------------------------------------------
-void OResultSet::updateDouble(sal_Int32 columnIndex, double x) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateDouble" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- checkReadOnly();
-
- m_xDelegatorRowUpdate->updateDouble(columnIndex, x);
-}
-//------------------------------------------------------------------------------
-void OResultSet::updateString(sal_Int32 columnIndex, const rtl::OUString& x) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateString" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- checkReadOnly();
-
- m_xDelegatorRowUpdate->updateString(columnIndex, x);
-}
-//------------------------------------------------------------------------------
-void OResultSet::updateBytes(sal_Int32 columnIndex, const Sequence< sal_Int8 >& x) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateBytes" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- checkReadOnly();
-
- m_xDelegatorRowUpdate->updateBytes(columnIndex, x);
-}
-//------------------------------------------------------------------------------
-void OResultSet::updateDate(sal_Int32 columnIndex, const ::com::sun::star::util::Date& x) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateDate" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- checkReadOnly();
-
- m_xDelegatorRowUpdate->updateDate(columnIndex, x);
-}
-//------------------------------------------------------------------------------
-void OResultSet::updateTime(sal_Int32 columnIndex, const ::com::sun::star::util::Time& x) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateTime" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- checkReadOnly();
-
- m_xDelegatorRowUpdate->updateTime(columnIndex, x);
-}
-//------------------------------------------------------------------------------
-void OResultSet::updateTimestamp(sal_Int32 columnIndex, const ::com::sun::star::util::DateTime& x) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateTimestamp" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- checkReadOnly();
-
- m_xDelegatorRowUpdate->updateTimestamp(columnIndex, x);
-}
-//------------------------------------------------------------------------------
-void OResultSet::updateBinaryStream(sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream > & x, sal_Int32 length) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateBinaryStream" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- checkReadOnly();
-
- m_xDelegatorRowUpdate->updateBinaryStream(columnIndex, x, length);
-}
-//------------------------------------------------------------------------------
-void OResultSet::updateCharacterStream(sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream > & x, sal_Int32 length) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateCharacterStream" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- checkReadOnly();
-
- m_xDelegatorRowUpdate->updateCharacterStream(columnIndex, x, length);
-}
-//------------------------------------------------------------------------------
-void OResultSet::updateNumericObject(sal_Int32 columnIndex, const Any& x, sal_Int32 scale) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateNumericObject" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- checkReadOnly();
-
- m_xDelegatorRowUpdate->updateNumericObject(columnIndex, x, scale);
-}
-
-//------------------------------------------------------------------------------
-void OResultSet::updateObject(sal_Int32 columnIndex, const Any& x) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateObject" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- checkReadOnly();
-
- m_xDelegatorRowUpdate->updateObject(columnIndex, x);
-}
-
-// ::com::sun::star::sdbc::XResultSet
-//------------------------------------------------------------------------------
-sal_Bool OResultSet::next(void) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::next" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorResultSet->next();
-}
-
-//------------------------------------------------------------------------------
-sal_Bool OResultSet::isBeforeFirst(void) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::isBeforeFirst" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorResultSet->isBeforeFirst();
-}
-
-//------------------------------------------------------------------------------
-sal_Bool OResultSet::isAfterLast(void) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::isAfterLast" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorResultSet->isAfterLast();
-}
-
-//------------------------------------------------------------------------------
-sal_Bool OResultSet::isFirst(void) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::isFirst" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorResultSet->isFirst();
-}
-
-//------------------------------------------------------------------------------
-sal_Bool OResultSet::isLast(void) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::isLast" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorResultSet->isLast();
-}
-
-//------------------------------------------------------------------------------
-void OResultSet::beforeFirst(void) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::beforeFirst" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- m_xDelegatorResultSet->beforeFirst();
-}
-
-//------------------------------------------------------------------------------
-void OResultSet::afterLast(void) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::afterLast" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- m_xDelegatorResultSet->afterLast();
-}
-
-//------------------------------------------------------------------------------
-sal_Bool OResultSet::first(void) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::first" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorResultSet->first();
-}
-
-//------------------------------------------------------------------------------
-sal_Bool OResultSet::last(void) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::last" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorResultSet->last();
-}
-
-//------------------------------------------------------------------------------
-sal_Int32 OResultSet::getRow(void) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getRow" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorResultSet->getRow();
-}
-
-//------------------------------------------------------------------------------
-sal_Bool OResultSet::absolute(sal_Int32 row) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::absolute" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorResultSet->absolute(row);
-}
-
-//------------------------------------------------------------------------------
-sal_Bool OResultSet::relative(sal_Int32 rows) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::relative" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorResultSet->relative(rows);
-}
-
-//------------------------------------------------------------------------------
-sal_Bool OResultSet::previous(void) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::previous" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorResultSet->previous();
-}
-
-//------------------------------------------------------------------------------
-void OResultSet::refreshRow(void) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::refreshRow" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- m_xDelegatorResultSet->refreshRow();
-}
-
-//------------------------------------------------------------------------------
-sal_Bool OResultSet::rowUpdated(void) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::rowUpdated" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorResultSet->rowUpdated();
-}
-
-//------------------------------------------------------------------------------
-sal_Bool OResultSet::rowInserted(void) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::rowInserted" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorResultSet->rowInserted();
-}
-
-//------------------------------------------------------------------------------
-sal_Bool OResultSet::rowDeleted(void) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::rowDeleted" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_xDelegatorResultSet->rowDeleted();
-}
-
-//------------------------------------------------------------------------------
-Reference< XInterface > OResultSet::getStatement(void) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getStatement" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- return m_aStatement;
-}
-
-// ::com::sun::star::sdbcx::XRowLocate
-//------------------------------------------------------------------------------
-Any OResultSet::getBookmark(void) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getBookmark" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- checkBookmarkable();
-
- return Reference< XRowLocate >(m_xDelegatorResultSet, UNO_QUERY)->getBookmark();
-}
-
-//------------------------------------------------------------------------------
-sal_Bool OResultSet::moveToBookmark(const Any& bookmark) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::moveToBookmark" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- checkBookmarkable();
-
- return Reference< XRowLocate >(m_xDelegatorResultSet, UNO_QUERY)->moveToBookmark(bookmark);
-}
-
-//------------------------------------------------------------------------------
-sal_Bool OResultSet::moveRelativeToBookmark(const Any& bookmark, sal_Int32 rows) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::moveRelativeToBookmark" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- checkBookmarkable();
-
- return Reference< XRowLocate >(m_xDelegatorResultSet, UNO_QUERY)->moveRelativeToBookmark(bookmark, rows);
-}
-
-//------------------------------------------------------------------------------
-sal_Int32 OResultSet::compareBookmarks(const Any& _first, const Any& _second) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::compareBookmarks" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- checkBookmarkable();
-
- return Reference< XRowLocate >(m_xDelegatorResultSet, UNO_QUERY)->compareBookmarks(_first, _second);
-}
-
-//------------------------------------------------------------------------------
-sal_Bool OResultSet::hasOrderedBookmarks(void) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::hasOrderedBookmarks" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- checkBookmarkable();
-
- return Reference< XRowLocate >(m_xDelegatorResultSet, UNO_QUERY)->hasOrderedBookmarks();
-}
-
-//------------------------------------------------------------------------------
-sal_Int32 OResultSet::hashBookmark(const Any& bookmark) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::hashBookmark" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- checkBookmarkable();
-
- return Reference< XRowLocate >(m_xDelegatorResultSet, UNO_QUERY)->hashBookmark(bookmark);
-}
-
-// ::com::sun::star::sdbc::XResultSetUpdate
-//------------------------------------------------------------------------------
-void OResultSet::insertRow(void) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::insertRow" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- checkReadOnly();
-
- m_xDelegatorResultSetUpdate->insertRow();
-}
-
-//------------------------------------------------------------------------------
-void OResultSet::updateRow(void) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateRow" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- checkReadOnly();
-
- m_xDelegatorResultSetUpdate->updateRow();
-}
-
-//------------------------------------------------------------------------------
-void OResultSet::deleteRow(void) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::deleteRow" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- checkReadOnly();
-
- m_xDelegatorResultSetUpdate->deleteRow();
-}
-
-//------------------------------------------------------------------------------
-void OResultSet::cancelRowUpdates(void) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::cancelRowUpdates" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- checkReadOnly();
-
- m_xDelegatorResultSetUpdate->cancelRowUpdates();
-}
-
-//------------------------------------------------------------------------------
-void OResultSet::moveToInsertRow(void) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::moveToInsertRow" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- checkReadOnly();
-
- m_xDelegatorResultSetUpdate->moveToInsertRow();
-}
-
-//------------------------------------------------------------------------------
-void OResultSet::moveToCurrentRow(void) throw( SQLException, RuntimeException )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::moveToCurrentRow" );
- MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
-
- checkReadOnly();
-
- m_xDelegatorResultSetUpdate->moveToCurrentRow();
-}
-
-// -----------------------------------------------------------------------------
-void OResultSet::checkReadOnly() const
-{
- //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::checkReadOnly" );
- if ( ( m_nResultSetConcurrency == ResultSetConcurrency::READ_ONLY )
- || !m_xDelegatorResultSetUpdate.is()
- )
- throwSQLException( "The result set is read-only.", SQL_GENERAL_ERROR, *const_cast< OResultSet* >( this ) );
-}
-
-// -----------------------------------------------------------------------------
-void OResultSet::checkBookmarkable() const
-{
- //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::checkBookmarkable" );
- if ( !m_bIsBookmarkable )
- throwSQLException( "The result set does not have bookmark support.", SQL_GENERAL_ERROR, *const_cast< OResultSet* >( this ) );
-}
-// -----------------------------------------------------------------------------
-
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: resultset.cxx,v $
+ * $Revision: 1.21 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_dbaccess.hxx"
+#ifndef _DBA_COREAPI_RESULTSET_HXX_
+#include <resultset.hxx>
+#endif
+#ifndef DBACCESS_SHARED_DBASTRINGS_HRC
+#include "dbastrings.hrc"
+#endif
+#ifndef _DBASHARED_APITOOLS_HXX_
+#include "apitools.hxx"
+#endif
+#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_
+#include <com/sun/star/lang/DisposedException.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_RESULTSETTYPE_HPP_
+#include <com/sun/star/sdbc/ResultSetType.hpp>
+#endif
+#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
+#include <cppuhelper/typeprovider.hxx>
+#endif
+#ifndef _COMPHELPER_PROPERTY_HXX_
+#include <comphelper/property.hxx>
+#endif
+#ifndef _COMPHELPER_SEQUENCE_HXX_
+#include <comphelper/sequence.hxx>
+#endif
+#ifndef _COMPHELPER_TYPES_HXX_
+#include <comphelper/types.hxx>
+#endif
+#ifndef _TOOLS_DEBUG_HXX //autogen
+#include <tools/debug.hxx>
+#endif
+#ifndef TOOLS_DIAGNOSE_EX_H
+#include <tools/diagnose_ex.h>
+#endif
+#ifndef _DBA_COREAPI_DATACOLUMN_HXX_
+#include <datacolumn.hxx>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#endif
+#ifndef _DBHELPER_DBEXCEPTION_HXX_
+#include <connectivity/dbexception.hxx>
+#endif
+#ifndef _CONNECTIVITY_DBTOOLS_HXX_
+#include <connectivity/dbtools.hxx>
+#endif
+#ifndef _CPPUHELPER_EXC_HLP_HXX_
+#include <cppuhelper/exc_hlp.hxx>
+#endif
+#ifndef _OSL_THREAD_H_
+#include <osl/thread.h>
+#endif
+#include <rtl/logfile.hxx>
+
+
+using namespace ::com::sun::star::sdbc;
+using namespace ::com::sun::star::sdbcx;
+//using namespace ::com::sun::star::sdb;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::container;
+using namespace ::cppu;
+using namespace ::osl;
+using namespace dbaccess;
+using namespace dbtools;
+
+DBG_NAME(OResultSet)
+
+//--------------------------------------------------------------------------
+OResultSet::OResultSet(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet >& _xResultSet,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xStatement,
+ sal_Bool _bCaseSensitive)
+ :OResultSetBase(m_aMutex)
+ ,OPropertySetHelper(OResultSetBase::rBHelper)
+ ,m_xDelegatorResultSet(_xResultSet)
+ ,m_aWarnings( Reference< XWarningsSupplier >( _xResultSet, UNO_QUERY ) )
+ ,m_bIsBookmarkable(sal_False)
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::OResultSet" );
+ DBG_CTOR(OResultSet, NULL);
+
+ m_pColumns = new OColumns(*this, m_aMutex, _bCaseSensitive, ::std::vector< ::rtl::OUString>(), NULL,NULL);
+
+ try
+ {
+ m_aStatement = _xStatement;
+ m_xDelegatorResultSetUpdate = m_xDelegatorResultSetUpdate.query( m_xDelegatorResultSet );
+ m_xDelegatorRow = m_xDelegatorRow.query( m_xDelegatorResultSet );
+ m_xDelegatorRowUpdate = m_xDelegatorRowUpdate.query( m_xDelegatorResultSet );
+
+ Reference< XPropertySet > xSet(m_xDelegatorResultSet, UNO_QUERY);
+ xSet->getPropertyValue(PROPERTY_RESULTSETTYPE) >>= m_nResultSetType;
+ xSet->getPropertyValue(PROPERTY_RESULTSETCONCURRENCY) >>= m_nResultSetConcurrency;
+
+ // test for Bookmarks
+ if (ResultSetType::FORWARD_ONLY != m_nResultSetType)
+ {
+ Reference <XPropertySetInfo > xInfo(xSet->getPropertySetInfo());
+ if (xInfo->hasPropertyByName(PROPERTY_ISBOOKMARKABLE))
+ {
+ m_bIsBookmarkable = ::comphelper::getBOOL(xSet->getPropertyValue(PROPERTY_ISBOOKMARKABLE));
+ OSL_ENSURE( !m_bIsBookmarkable || Reference< XRowLocate >(m_xDelegatorResultSet, UNO_QUERY).is(),
+ "OResultSet::OResultSet: aggregate is inconsistent in it's bookmarkable attribute!" );
+ m_bIsBookmarkable = m_bIsBookmarkable && Reference< XRowLocate >(m_xDelegatorResultSet, UNO_QUERY).is();
+ }
+ }
+ }
+ catch(Exception&)
+ {
+ }
+}
+
+//--------------------------------------------------------------------------
+OResultSet::~OResultSet()
+{
+ m_pColumns->acquire();
+ m_pColumns->disposing();
+ delete m_pColumns;
+
+ DBG_DTOR(OResultSet, NULL);
+}
+
+// com::sun::star::lang::XTypeProvider
+//--------------------------------------------------------------------------
+Sequence< Type > OResultSet::getTypes() throw (RuntimeException)
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getTypes" );
+ OTypeCollection aTypes(::getCppuType( (const Reference< XPropertySet > *)0 ),
+ OResultSetBase::getTypes());
+
+ return aTypes.getTypes();
+}
+
+//--------------------------------------------------------------------------
+Sequence< sal_Int8 > OResultSet::getImplementationId() throw (RuntimeException)
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getImplementationId" );
+ static OImplementationId * pId = 0;
+ if (! pId)
+ {
+ MutexGuard aGuard( Mutex::getGlobalMutex() );
+ if (! pId)
+ {
+ static OImplementationId aId;
+ pId = &aId;
+ }
+ }
+ return pId->getImplementationId();
+}
+
+// com::sun::star::uno::XInterface
+//--------------------------------------------------------------------------
+Any OResultSet::queryInterface( const Type & rType ) throw (RuntimeException)
+{
+ //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::queryInterface" );
+ Any aIface = OResultSetBase::queryInterface( rType );
+ if (!aIface.hasValue())
+ aIface = ::cppu::queryInterface(
+ rType,
+ static_cast< XPropertySet * >( this ));
+
+ return aIface;
+}
+
+//--------------------------------------------------------------------------
+void OResultSet::acquire() throw ()
+{
+ OResultSetBase::acquire();
+}
+
+//--------------------------------------------------------------------------
+void OResultSet::release() throw ()
+{
+ OResultSetBase::release();
+}
+
+
+// OResultSetBase
+//------------------------------------------------------------------------------
+void OResultSet::disposing()
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::disposing" );
+ OPropertySetHelper::disposing();
+
+ MutexGuard aGuard(m_aMutex);
+
+ // free the columns
+ m_pColumns->disposing();
+
+ // close the pending result set
+ Reference< XCloseable > (m_xDelegatorResultSet, UNO_QUERY)->close();
+
+ m_xDelegatorResultSet = NULL;
+ m_xDelegatorRow = NULL;
+ m_xDelegatorRowUpdate = NULL;
+
+ m_aStatement = Reference< XInterface >();
+}
+
+// XCloseable
+//------------------------------------------------------------------------------
+void OResultSet::close(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::close" );
+ {
+ MutexGuard aGuard( m_aMutex );
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+ }
+ dispose();
+}
+
+// XServiceInfo
+//------------------------------------------------------------------------------
+rtl::OUString OResultSet::getImplementationName( ) throw(RuntimeException)
+{
+ //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getImplementationName" );
+ return rtl::OUString::createFromAscii("com.sun.star.sdb.OResultSet");
+}
+
+//------------------------------------------------------------------------------
+sal_Bool OResultSet::supportsService( const ::rtl::OUString& _rServiceName ) throw (RuntimeException)
+{
+ //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::supportsService" );
+ return ::comphelper::findValue(getSupportedServiceNames(), _rServiceName, sal_True).getLength() != 0;
+}
+
+//------------------------------------------------------------------------------
+Sequence< ::rtl::OUString > OResultSet::getSupportedServiceNames( ) throw (RuntimeException)
+{
+ //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getSupportedServiceNames" );
+ Sequence< ::rtl::OUString > aSNS( 2 );
+ aSNS[0] = SERVICE_SDBC_RESULTSET;
+ aSNS[1] = SERVICE_SDB_RESULTSET;
+ return aSNS;
+}
+
+// com::sun::star::beans::XPropertySet
+//------------------------------------------------------------------------------
+Reference< XPropertySetInfo > OResultSet::getPropertySetInfo() throw (RuntimeException)
+{
+ //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getPropertySetInfo" );
+ return createPropertySetInfo( getInfoHelper() ) ;
+}
+
+// comphelper::OPropertyArrayUsageHelper
+//------------------------------------------------------------------------------
+::cppu::IPropertyArrayHelper* OResultSet::createArrayHelper( ) const
+{
+ //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::createArrayHelper" );
+ BEGIN_PROPERTY_HELPER(6)
+ DECL_PROP1(CURSORNAME, ::rtl::OUString, READONLY);
+ DECL_PROP0(FETCHDIRECTION, sal_Int32);
+ DECL_PROP0(FETCHSIZE, sal_Int32);
+ DECL_PROP1_BOOL(ISBOOKMARKABLE, READONLY);
+ DECL_PROP1(RESULTSETCONCURRENCY, sal_Int32, READONLY);
+ DECL_PROP1(RESULTSETTYPE, sal_Int32, READONLY);
+ END_PROPERTY_HELPER();
+}
+
+// cppu::OPropertySetHelper
+//------------------------------------------------------------------------------
+::cppu::IPropertyArrayHelper& OResultSet::getInfoHelper()
+{
+ //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getInfoHelper" );
+ return *getArrayHelper();
+}
+
+//------------------------------------------------------------------------------
+sal_Bool OResultSet::convertFastPropertyValue(Any & rConvertedValue, Any & rOldValue, sal_Int32 nHandle, const Any& rValue ) throw( IllegalArgumentException )
+{
+ //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::convertFastPropertyValue" );
+ // be lazy ...
+ rConvertedValue = rValue;
+ getFastPropertyValue( rOldValue, nHandle );
+ return sal_True;
+}
+
+//------------------------------------------------------------------------------
+void OResultSet::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const Any& rValue ) throw (Exception)
+{
+ //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::setFastPropertyValue_NoBroadcast" );
+ // set it for the driver result set
+ Reference< XPropertySet > xSet(m_xDelegatorResultSet, UNO_QUERY);
+ switch (nHandle)
+ {
+ case PROPERTY_ID_FETCHDIRECTION:
+ xSet->setPropertyValue(PROPERTY_FETCHDIRECTION, rValue);
+ break;
+ case PROPERTY_ID_FETCHSIZE:
+ xSet->setPropertyValue(PROPERTY_FETCHSIZE, rValue);
+ break;
+ default:
+ DBG_ERROR("unknown Property");
+ }
+}
+
+//------------------------------------------------------------------------------
+void OResultSet::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const
+{
+ //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getFastPropertyValue" );
+ switch (nHandle)
+ {
+ case PROPERTY_ID_ISBOOKMARKABLE:
+ {
+ sal_Bool bVal = m_bIsBookmarkable;
+ rValue.setValue(&bVal, getBooleanCppuType());
+ } break;
+ default:
+ {
+ // get the property name
+ ::rtl::OUString aPropName;
+ sal_Int16 nAttributes;
+ const_cast<OResultSet*>(this)->getInfoHelper().
+ fillPropertyMembersByHandle(&aPropName, &nAttributes, nHandle);
+ OSL_ENSURE(aPropName.getLength(), "property not found?");
+
+ // now read the value
+ rValue = Reference< XPropertySet >(m_xDelegatorResultSet, UNO_QUERY)->getPropertyValue(aPropName);
+ }
+ }
+}
+
+// XWarningsSupplier
+//------------------------------------------------------------------------------
+Any OResultSet::getWarnings(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getWarnings" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+ return m_aWarnings.getWarnings();
+}
+
+//------------------------------------------------------------------------------
+void OResultSet::clearWarnings(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::clearWarnings" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+ m_aWarnings.clearWarnings();
+}
+
+// ::com::sun::star::sdbc::XResultSetMetaDataSupplier
+//------------------------------------------------------------------------------
+Reference< XResultSetMetaData > OResultSet::getMetaData(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getMetaData" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return Reference< XResultSetMetaDataSupplier >(m_xDelegatorResultSet, UNO_QUERY)->getMetaData();
+}
+
+// ::com::sun::star::sdbc::XColumnLocate
+//------------------------------------------------------------------------------
+sal_Int32 OResultSet::findColumn(const rtl::OUString& columnName) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::findColumn" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return Reference< XColumnLocate >(m_xDelegatorResultSet, UNO_QUERY)->findColumn(columnName);
+}
+
+//------------------------------------------------------------------------------
+namespace
+{
+ static Reference< XDatabaseMetaData > lcl_getDBMetaDataFromStatement_nothrow( const Reference< XInterface >& _rxStatement )
+ {
+ Reference< XDatabaseMetaData > xDBMetaData;
+ try
+ {
+ Reference< XStatement > xStatement( _rxStatement, UNO_QUERY );
+ Reference< XPreparedStatement > xPreparedStatement( _rxStatement, UNO_QUERY );
+ Reference< XConnection > xConn;
+ if ( xStatement.is() )
+ xConn = xStatement->getConnection();
+ else if ( xPreparedStatement.is() )
+ xConn = xPreparedStatement->getConnection();
+ if ( xConn.is() )
+ xDBMetaData = xConn->getMetaData();
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return xDBMetaData;
+ }
+}
+// ::com::sun::star::sdbcx::XColumnsSupplier
+//------------------------------------------------------------------------------
+Reference< ::com::sun::star::container::XNameAccess > OResultSet::getColumns(void) throw( RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getColumns" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ // do we have to populate the columns
+ if (!m_pColumns->isInitialized())
+ {
+ // get the metadata
+ Reference< XResultSetMetaData > xMetaData = Reference< XResultSetMetaDataSupplier >(m_xDelegatorResultSet, UNO_QUERY)->getMetaData();
+
+ sal_Int32 nColCount = 0;
+ // do we have columns
+ try
+ {
+ Reference< XDatabaseMetaData > xDBMetaData( lcl_getDBMetaDataFromStatement_nothrow( getStatement() ) );
+ nColCount = xMetaData->getColumnCount();
+
+ for ( sal_Int32 i = 0; i < nColCount; ++i)
+ {
+ // retrieve the name of the column
+ rtl::OUString sName = xMetaData->getColumnName(i + 1);
+ ODataColumn* pColumn = new ODataColumn(xMetaData, m_xDelegatorRow, m_xDelegatorRowUpdate, i + 1, xDBMetaData);
+
+ // don't silently assume that the name is unique - result set implementations
+ // are allowed to return duplicate names, but we are required to have
+ // unique column names
+ if ( m_pColumns->hasByName( sName ) )
+ sName = ::dbtools::createUniqueName( m_pColumns, sName );
+
+ m_pColumns->append( sName, pColumn );
+ }
+ }
+ catch ( const SQLException& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ m_pColumns->setInitialized();
+
+ #if OSL_DEBUG_LEVEL > 0
+ // some sanity checks. Especially in case we auto-adjusted the column names above,
+ // this might be reasonable
+ try
+ {
+ const Reference< XNameAccess > xColNames( static_cast< XNameAccess* >( m_pColumns ), UNO_SET_THROW );
+ const Sequence< ::rtl::OUString > aNames( xColNames->getElementNames() );
+ OSL_POSTCOND( aNames.getLength() == nColCount,
+ "OResultSet::getColumns: invalid column count!" );
+ for ( const ::rtl::OUString* pName = aNames.getConstArray();
+ pName != aNames.getConstArray() + aNames.getLength();
+ ++pName
+ )
+ {
+ Reference< XPropertySet > xColProps( xColNames->getByName( *pName ), UNO_QUERY_THROW );
+ ::rtl::OUString sName;
+ OSL_VERIFY( xColProps->getPropertyValue( PROPERTY_NAME ) >>= sName );
+ OSL_POSTCOND( sName == *pName, "OResultSet::getColumns: invalid column name!" );
+ }
+
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ #endif
+ }
+ return m_pColumns;
+}
+
+// ::com::sun::star::sdbc::XRow
+//------------------------------------------------------------------------------
+sal_Bool OResultSet::wasNull(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::wasNull" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorRow->wasNull();
+}
+//------------------------------------------------------------------------------
+rtl::OUString OResultSet::getString(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
+{
+ //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getString" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorRow->getString(columnIndex);
+}
+//------------------------------------------------------------------------------
+sal_Bool OResultSet::getBoolean(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
+{
+ //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getBoolean" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorRow->getBoolean(columnIndex);
+}
+//------------------------------------------------------------------------------
+sal_Int8 OResultSet::getByte(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getByte" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorRow->getByte(columnIndex);
+}
+//------------------------------------------------------------------------------
+sal_Int16 OResultSet::getShort(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getShort" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorRow->getShort(columnIndex);
+}
+//------------------------------------------------------------------------------
+sal_Int32 OResultSet::getInt(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getInt" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorRow->getInt(columnIndex);
+}
+//------------------------------------------------------------------------------
+sal_Int64 OResultSet::getLong(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getLong" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorRow->getLong(columnIndex);
+}
+//------------------------------------------------------------------------------
+float OResultSet::getFloat(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getFloat" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorRow->getFloat(columnIndex);
+}
+//------------------------------------------------------------------------------
+double OResultSet::getDouble(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getDouble" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorRow->getDouble(columnIndex);
+}
+//------------------------------------------------------------------------------
+Sequence< sal_Int8 > OResultSet::getBytes(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getBytes" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorRow->getBytes(columnIndex);
+}
+//------------------------------------------------------------------------------
+::com::sun::star::util::Date OResultSet::getDate(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getDate" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorRow->getDate(columnIndex);
+}
+//------------------------------------------------------------------------------
+::com::sun::star::util::Time OResultSet::getTime(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getTime" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorRow->getTime(columnIndex);
+}
+//------------------------------------------------------------------------------
+::com::sun::star::util::DateTime OResultSet::getTimestamp(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getTimestamp" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorRow->getTimestamp(columnIndex);
+}
+//------------------------------------------------------------------------------
+Reference< ::com::sun::star::io::XInputStream > OResultSet::getBinaryStream(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getBinaryStream" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorRow->getBinaryStream(columnIndex);
+}
+//------------------------------------------------------------------------------
+Reference< ::com::sun::star::io::XInputStream > OResultSet::getCharacterStream(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getCharacterStream" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorRow->getCharacterStream(columnIndex);
+}
+//------------------------------------------------------------------------------
+Any OResultSet::getObject(sal_Int32 columnIndex, const Reference< ::com::sun::star::container::XNameAccess > & typeMap) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getObject" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorRow->getObject(columnIndex, typeMap);
+}
+//------------------------------------------------------------------------------
+Reference< XRef > OResultSet::getRef(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getRef" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorRow->getRef(columnIndex);
+}
+//------------------------------------------------------------------------------
+Reference< XBlob > OResultSet::getBlob(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getBlob" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorRow->getBlob(columnIndex);
+}
+//------------------------------------------------------------------------------
+Reference< XClob > OResultSet::getClob(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getClob" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorRow->getClob(columnIndex);
+}
+//------------------------------------------------------------------------------
+Reference< XArray > OResultSet::getArray(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getArray" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorRow->getArray(columnIndex);
+}
+
+// ::com::sun::star::sdbc::XRowUpdate
+//------------------------------------------------------------------------------
+void OResultSet::updateNull(sal_Int32 columnIndex) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateNull" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorRowUpdate->updateNull(columnIndex);
+}
+
+//------------------------------------------------------------------------------
+void OResultSet::updateBoolean(sal_Int32 columnIndex, sal_Bool x) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateBoolean" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorRowUpdate->updateBoolean(columnIndex, x);
+}
+//------------------------------------------------------------------------------
+void OResultSet::updateByte(sal_Int32 columnIndex, sal_Int8 x) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateByte" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorRowUpdate->updateByte(columnIndex, x);
+}
+//------------------------------------------------------------------------------
+void OResultSet::updateShort(sal_Int32 columnIndex, sal_Int16 x) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateShort" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorRowUpdate->updateShort(columnIndex, x);
+}
+//------------------------------------------------------------------------------
+void OResultSet::updateInt(sal_Int32 columnIndex, sal_Int32 x) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateInt" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorRowUpdate->updateInt(columnIndex, x);
+}
+//------------------------------------------------------------------------------
+void OResultSet::updateLong(sal_Int32 columnIndex, sal_Int64 x) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateLong" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorRowUpdate->updateLong(columnIndex, x);
+}
+//------------------------------------------------------------------------------
+void OResultSet::updateFloat(sal_Int32 columnIndex, float x) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateFloat" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorRowUpdate->updateFloat(columnIndex, x);
+}
+//------------------------------------------------------------------------------
+void OResultSet::updateDouble(sal_Int32 columnIndex, double x) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateDouble" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorRowUpdate->updateDouble(columnIndex, x);
+}
+//------------------------------------------------------------------------------
+void OResultSet::updateString(sal_Int32 columnIndex, const rtl::OUString& x) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateString" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorRowUpdate->updateString(columnIndex, x);
+}
+//------------------------------------------------------------------------------
+void OResultSet::updateBytes(sal_Int32 columnIndex, const Sequence< sal_Int8 >& x) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateBytes" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorRowUpdate->updateBytes(columnIndex, x);
+}
+//------------------------------------------------------------------------------
+void OResultSet::updateDate(sal_Int32 columnIndex, const ::com::sun::star::util::Date& x) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateDate" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorRowUpdate->updateDate(columnIndex, x);
+}
+//------------------------------------------------------------------------------
+void OResultSet::updateTime(sal_Int32 columnIndex, const ::com::sun::star::util::Time& x) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateTime" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorRowUpdate->updateTime(columnIndex, x);
+}
+//------------------------------------------------------------------------------
+void OResultSet::updateTimestamp(sal_Int32 columnIndex, const ::com::sun::star::util::DateTime& x) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateTimestamp" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorRowUpdate->updateTimestamp(columnIndex, x);
+}
+//------------------------------------------------------------------------------
+void OResultSet::updateBinaryStream(sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream > & x, sal_Int32 length) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateBinaryStream" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorRowUpdate->updateBinaryStream(columnIndex, x, length);
+}
+//------------------------------------------------------------------------------
+void OResultSet::updateCharacterStream(sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream > & x, sal_Int32 length) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateCharacterStream" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorRowUpdate->updateCharacterStream(columnIndex, x, length);
+}
+//------------------------------------------------------------------------------
+void OResultSet::updateNumericObject(sal_Int32 columnIndex, const Any& x, sal_Int32 scale) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateNumericObject" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorRowUpdate->updateNumericObject(columnIndex, x, scale);
+}
+
+//------------------------------------------------------------------------------
+void OResultSet::updateObject(sal_Int32 columnIndex, const Any& x) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateObject" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorRowUpdate->updateObject(columnIndex, x);
+}
+
+// ::com::sun::star::sdbc::XResultSet
+//------------------------------------------------------------------------------
+sal_Bool OResultSet::next(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::next" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorResultSet->next();
+}
+
+//------------------------------------------------------------------------------
+sal_Bool OResultSet::isBeforeFirst(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::isBeforeFirst" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorResultSet->isBeforeFirst();
+}
+
+//------------------------------------------------------------------------------
+sal_Bool OResultSet::isAfterLast(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::isAfterLast" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorResultSet->isAfterLast();
+}
+
+//------------------------------------------------------------------------------
+sal_Bool OResultSet::isFirst(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::isFirst" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorResultSet->isFirst();
+}
+
+//------------------------------------------------------------------------------
+sal_Bool OResultSet::isLast(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::isLast" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorResultSet->isLast();
+}
+
+//------------------------------------------------------------------------------
+void OResultSet::beforeFirst(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::beforeFirst" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ m_xDelegatorResultSet->beforeFirst();
+}
+
+//------------------------------------------------------------------------------
+void OResultSet::afterLast(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::afterLast" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ m_xDelegatorResultSet->afterLast();
+}
+
+//------------------------------------------------------------------------------
+sal_Bool OResultSet::first(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::first" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorResultSet->first();
+}
+
+//------------------------------------------------------------------------------
+sal_Bool OResultSet::last(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::last" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorResultSet->last();
+}
+
+//------------------------------------------------------------------------------
+sal_Int32 OResultSet::getRow(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getRow" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorResultSet->getRow();
+}
+
+//------------------------------------------------------------------------------
+sal_Bool OResultSet::absolute(sal_Int32 row) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::absolute" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorResultSet->absolute(row);
+}
+
+//------------------------------------------------------------------------------
+sal_Bool OResultSet::relative(sal_Int32 rows) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::relative" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorResultSet->relative(rows);
+}
+
+//------------------------------------------------------------------------------
+sal_Bool OResultSet::previous(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::previous" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorResultSet->previous();
+}
+
+//------------------------------------------------------------------------------
+void OResultSet::refreshRow(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::refreshRow" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ m_xDelegatorResultSet->refreshRow();
+}
+
+//------------------------------------------------------------------------------
+sal_Bool OResultSet::rowUpdated(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::rowUpdated" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorResultSet->rowUpdated();
+}
+
+//------------------------------------------------------------------------------
+sal_Bool OResultSet::rowInserted(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::rowInserted" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorResultSet->rowInserted();
+}
+
+//------------------------------------------------------------------------------
+sal_Bool OResultSet::rowDeleted(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::rowDeleted" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_xDelegatorResultSet->rowDeleted();
+}
+
+//------------------------------------------------------------------------------
+Reference< XInterface > OResultSet::getStatement(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getStatement" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ return m_aStatement;
+}
+
+// ::com::sun::star::sdbcx::XRowLocate
+//------------------------------------------------------------------------------
+Any OResultSet::getBookmark(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::getBookmark" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkBookmarkable();
+
+ return Reference< XRowLocate >(m_xDelegatorResultSet, UNO_QUERY)->getBookmark();
+}
+
+//------------------------------------------------------------------------------
+sal_Bool OResultSet::moveToBookmark(const Any& bookmark) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::moveToBookmark" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkBookmarkable();
+
+ return Reference< XRowLocate >(m_xDelegatorResultSet, UNO_QUERY)->moveToBookmark(bookmark);
+}
+
+//------------------------------------------------------------------------------
+sal_Bool OResultSet::moveRelativeToBookmark(const Any& bookmark, sal_Int32 rows) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::moveRelativeToBookmark" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkBookmarkable();
+
+ return Reference< XRowLocate >(m_xDelegatorResultSet, UNO_QUERY)->moveRelativeToBookmark(bookmark, rows);
+}
+
+//------------------------------------------------------------------------------
+sal_Int32 OResultSet::compareBookmarks(const Any& _first, const Any& _second) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::compareBookmarks" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkBookmarkable();
+
+ return Reference< XRowLocate >(m_xDelegatorResultSet, UNO_QUERY)->compareBookmarks(_first, _second);
+}
+
+//------------------------------------------------------------------------------
+sal_Bool OResultSet::hasOrderedBookmarks(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::hasOrderedBookmarks" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkBookmarkable();
+
+ return Reference< XRowLocate >(m_xDelegatorResultSet, UNO_QUERY)->hasOrderedBookmarks();
+}
+
+//------------------------------------------------------------------------------
+sal_Int32 OResultSet::hashBookmark(const Any& bookmark) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::hashBookmark" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkBookmarkable();
+
+ return Reference< XRowLocate >(m_xDelegatorResultSet, UNO_QUERY)->hashBookmark(bookmark);
+}
+
+// ::com::sun::star::sdbc::XResultSetUpdate
+//------------------------------------------------------------------------------
+void OResultSet::insertRow(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::insertRow" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorResultSetUpdate->insertRow();
+}
+
+//------------------------------------------------------------------------------
+void OResultSet::updateRow(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::updateRow" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorResultSetUpdate->updateRow();
+}
+
+//------------------------------------------------------------------------------
+void OResultSet::deleteRow(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::deleteRow" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorResultSetUpdate->deleteRow();
+}
+
+//------------------------------------------------------------------------------
+void OResultSet::cancelRowUpdates(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::cancelRowUpdates" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorResultSetUpdate->cancelRowUpdates();
+}
+
+//------------------------------------------------------------------------------
+void OResultSet::moveToInsertRow(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::moveToInsertRow" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorResultSetUpdate->moveToInsertRow();
+}
+
+//------------------------------------------------------------------------------
+void OResultSet::moveToCurrentRow(void) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::moveToCurrentRow" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OResultSetBase::rBHelper.bDisposed);
+
+ checkReadOnly();
+
+ m_xDelegatorResultSetUpdate->moveToCurrentRow();
+}
+
+// -----------------------------------------------------------------------------
+void OResultSet::checkReadOnly() const
+{
+ //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::checkReadOnly" );
+ if ( ( m_nResultSetConcurrency == ResultSetConcurrency::READ_ONLY )
+ || !m_xDelegatorResultSetUpdate.is()
+ )
+ throwSQLException( "The result set is read-only.", SQL_GENERAL_ERROR, *const_cast< OResultSet* >( this ) );
+}
+
+// -----------------------------------------------------------------------------
+void OResultSet::checkBookmarkable() const
+{
+ //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OResultSet::checkBookmarkable" );
+ if ( !m_bIsBookmarkable )
+ throwSQLException( "The result set does not have bookmark support.", SQL_GENERAL_ERROR, *const_cast< OResultSet* >( this ) );
+}
+// -----------------------------------------------------------------------------
+
diff --git a/dbaccess/source/core/api/statement.cxx b/dbaccess/source/core/api/statement.cxx
index ac658ea1bba8..c4ddacd87db2 100644
--- a/dbaccess/source/core/api/statement.cxx
+++ b/dbaccess/source/core/api/statement.cxx
@@ -111,12 +111,14 @@ Sequence< Type > OStatementBase::getTypes() throw (RuntimeException)
::getCppuType( (const Reference< XWarningsSupplier > *)0 ),
::getCppuType( (const Reference< XCloseable > *)0 ),
::getCppuType( (const Reference< XMultipleResults > *)0 ),
- ::getCppuType( (const Reference< XPreparedBatchExecution > *)0 ),
::getCppuType( (const Reference< ::com::sun::star::util::XCancellable > *)0 ),
OSubComponent::getTypes() );
Reference< XGeneratedResultSet > xGRes(m_xAggregateAsSet, UNO_QUERY);
if ( xGRes.is() )
aTypes = OTypeCollection(::getCppuType( (const Reference< XGeneratedResultSet > *)0 ),aTypes.getTypes());
+ Reference< XPreparedBatchExecution > xPreparedBatchExecution(m_xAggregateAsSet, UNO_QUERY);
+ if ( xPreparedBatchExecution.is() )
+ aTypes = OTypeCollection(::getCppuType( (const Reference< XPreparedBatchExecution > *)0 ),aTypes.getTypes());
return aTypes.getTypes();
}
@@ -134,7 +136,6 @@ Any OStatementBase::queryInterface( const Type & rType ) throw (RuntimeException
static_cast< XPropertySet * >( this ),
static_cast< XWarningsSupplier * >( this ),
static_cast< XCloseable * >( this ),
- static_cast< XPreparedBatchExecution * >( this ),
static_cast< XMultipleResults * >( this ),
static_cast< ::com::sun::star::util::XCancellable * >( this ));
if ( !aIface.hasValue() )
@@ -142,6 +143,12 @@ Any OStatementBase::queryInterface( const Type & rType ) throw (RuntimeException
Reference< XGeneratedResultSet > xGRes(m_xAggregateAsSet, UNO_QUERY);
if ( ::getCppuType( (const Reference< XGeneratedResultSet > *)0 ) == rType && xGRes.is() )
aIface = ::cppu::queryInterface(rType,static_cast< XGeneratedResultSet * >( this ));
+ } // if ( !aIface.hasValue() )
+ if ( !aIface.hasValue() )
+ {
+ Reference< XPreparedBatchExecution > xGRes(m_xAggregateAsSet, UNO_QUERY);
+ if ( ::getCppuType( (const Reference< XPreparedBatchExecution > *)0 ) == rType && xGRes.is() )
+ aIface = ::cppu::queryInterface(rType,static_cast< XPreparedBatchExecution * >( this ));
}
}
return aIface;
@@ -583,6 +590,46 @@ sal_Bool OStatement::execute( const rtl::OUString& _rSQL ) throw( SQLException,
::rtl::OUString sSQL( impl_doEscapeProcessing_nothrow( _rSQL ) );
return m_xAggregateStatement->execute( sSQL );
}
+//------------------------------------------------------------------------------
+void OStatement::addBatch( const rtl::OUString& _rSQL ) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatement::execute" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+
+ // first check the meta data
+ Reference<XDatabaseMetaData> xMeta = Reference< XConnection > (m_xParent, UNO_QUERY)->getMetaData();
+ if (!xMeta.is() && !xMeta->supportsBatchUpdates())
+ throwFunctionSequenceException(*this);
+
+ ::rtl::OUString sSQL( impl_doEscapeProcessing_nothrow( _rSQL ) );
+ Reference< XBatchExecution >(m_xAggregateAsSet, UNO_QUERY)->addBatch( sSQL );
+}
+//------------------------------------------------------------------------------
+void OStatement::clearBatch( ) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatement::execute" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ // first check the meta data
+ Reference<XDatabaseMetaData> xMeta = Reference< XConnection > (m_xParent, UNO_QUERY)->getMetaData();
+ if (!xMeta.is() && !xMeta->supportsBatchUpdates())
+ throwFunctionSequenceException(*this);
+
+ Reference< XBatchExecution >(m_xAggregateAsSet, UNO_QUERY)->clearBatch();
+}
+//------------------------------------------------------------------------------
+Sequence< sal_Int32 > OStatement::executeBatch( ) throw( SQLException, RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStatement::execute" );
+ MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ // first check the meta data
+ Reference<XDatabaseMetaData> xMeta = Reference< XConnection > (m_xParent, UNO_QUERY)->getMetaData();
+ if (!xMeta.is() && !xMeta->supportsBatchUpdates())
+ throwFunctionSequenceException(*this);
+ return Reference< XBatchExecution >(m_xAggregateAsSet, UNO_QUERY)->executeBatch( );
+}
//------------------------------------------------------------------------------
Reference< XConnection > OStatement::getConnection(void) throw( SQLException, RuntimeException )
diff --git a/dbaccess/source/core/dataaccess/ModelImpl.cxx b/dbaccess/source/core/dataaccess/ModelImpl.cxx
index 17848caac41e..23c6a34d7808 100644
--- a/dbaccess/source/core/dataaccess/ModelImpl.cxx
+++ b/dbaccess/source/core/dataaccess/ModelImpl.cxx
@@ -608,7 +608,8 @@ void ODatabaseModelImpl::clearConnections()
aConnections.swap( m_aConnections );
Reference< XConnection > xConn;
- for ( OWeakConnectionArray::iterator i = aConnections.begin(); aConnections.end() != i; ++i )
+ OWeakConnectionArray::iterator aEnd = aConnections.end();
+ for ( OWeakConnectionArray::iterator i = aConnections.begin(); aEnd != i; ++i )
{
xConn = *i;
if ( xConn.is() )
diff --git a/dbaccess/source/core/dataaccess/connection.cxx b/dbaccess/source/core/dataaccess/connection.cxx
index 654fe9696280..8fb40fc63b1f 100644
--- a/dbaccess/source/core/dataaccess/connection.cxx
+++ b/dbaccess/source/core/dataaccess/connection.cxx
@@ -534,7 +534,8 @@ void OConnection::disposing()
OSubComponent::disposing();
OConnectionWrapper::disposing();
- for (OWeakRefArrayIterator i = m_aStatements.begin(); m_aStatements.end() != i; ++i)
+ OWeakRefArrayIterator aEnd = m_aStatements.end();
+ for (OWeakRefArrayIterator i = m_aStatements.begin(); aEnd != i; ++i)
{
Reference<XComponent> xComp(i->get(),UNO_QUERY);
::comphelper::disposeComponent(xComp);
@@ -549,7 +550,8 @@ void OConnection::disposing()
::comphelper::disposeComponent(m_xQueries);
- for (OWeakRefArrayIterator j = m_aComposers.begin(); m_aComposers.end() != j; ++j)
+ OWeakRefArrayIterator aComposerEnd = m_aComposers.end();
+ for (OWeakRefArrayIterator j = m_aComposers.begin(); aComposerEnd != j; ++j)
{
Reference<XComponent> xComp(j->get(),UNO_QUERY);
::comphelper::disposeComponent(xComp);
diff --git a/dbaccess/source/core/dataaccess/databasecontext.cxx b/dbaccess/source/core/dataaccess/databasecontext.cxx
index 9bc92a003c9a..22f3aa7c5bd7 100644
--- a/dbaccess/source/core/dataaccess/databasecontext.cxx
+++ b/dbaccess/source/core/dataaccess/databasecontext.cxx
@@ -610,6 +610,11 @@ void ODatabaseContext::revokeObject(const rtl::OUString& _rName) throw( Exceptio
aThisDriverSettings.getNodeValue(getDbLocationNodeName()) >>= sURL;
sURL = SvtPathOptions().SubstituteVariable(sURL);
+ if ( m_aDatabaseObjects.find( _rName ) != m_aDatabaseObjects.end() )
+ {
+ m_aDatasourceProperties[ sURL ] = m_aDatasourceProperties[ _rName ];
+ }
+
// check if URL is already loaded
ObjectCacheIterator aExistent = m_aDatabaseObjects.find(sURL);
if ( aExistent != m_aDatabaseObjects.end() )
diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx
index 9535228b7591..896edc257f1c 100644
--- a/dbaccess/source/core/dataaccess/databasedocument.cxx
+++ b/dbaccess/source/core/dataaccess/databasedocument.cxx
@@ -1102,7 +1102,8 @@ void ODatabaseDocument::impl_closeControllerFrames_nolck_throw( sal_Bool _bDeliv
{
Controllers aCopy = m_aControllers;
- for ( Controllers::iterator aIter = aCopy.begin(); aIter != aCopy.end() ; ++aIter )
+ Controllers::iterator aEnd = aCopy.end();
+ for ( Controllers::iterator aIter = aCopy.begin(); aIter != aEnd ; ++aIter )
{
if ( !aIter->is() )
continue;
diff --git a/dbaccess/source/core/inc/SingleSelectQueryComposer.hxx b/dbaccess/source/core/inc/SingleSelectQueryComposer.hxx
index 946de25ca364..88be29d9240d 100644
--- a/dbaccess/source/core/inc/SingleSelectQueryComposer.hxx
+++ b/dbaccess/source/core/inc/SingleSelectQueryComposer.hxx
@@ -160,8 +160,8 @@ namespace dbaccess
sal_Int32 getPredicateType(::connectivity::OSQLParseNode * _pPredicate) const;
// clears all Columns,Parameters and tables and insert it to their vectors
void clearCurrentCollections();
- // clear only the parameter columns
- void clearParametersCollection();
+ // clears the columns collection given by EColumnType
+ void clearColumns( const EColumnType _eType );
/** retrieves a particular part of a statement
@param _rIterator
diff --git a/dbaccess/source/core/inc/core_resource.hrc b/dbaccess/source/core/inc/core_resource.hrc
index e129dc1a66d2..245b90b985b3 100644
--- a/dbaccess/source/core/inc/core_resource.hrc
+++ b/dbaccess/source/core/inc/core_resource.hrc
@@ -89,8 +89,5 @@
#define RID_STR_NAME_NOT_FOUND ( RID_CORE_STRINGS_START + 45 )
#define RID_STR_QUERY_DOES_NOT_EXIST ( RID_CORE_STRINGS_START + 46 )
-#define RSC_DATASOURCE_TYPES ( RID_CORE_OTHER_START + 1 )
-#define RSC_DATASOURCE_TYPE_UINAMES ( RID_CORE_OTHER_START + 2 )
-
#endif // _DBA_CORE_RESOURCE_HRC_
diff --git a/dbaccess/source/core/inc/statement.hxx b/dbaccess/source/core/inc/statement.hxx
index 33d3e87e2f12..82b031548e22 100644
--- a/dbaccess/source/core/inc/statement.hxx
+++ b/dbaccess/source/core/inc/statement.hxx
@@ -54,6 +54,7 @@
#ifndef _COM_SUN_STAR_SDBC_XPREPAREDBATCHEXECUTION_HDL_
#include <com/sun/star/sdbc/XPreparedBatchExecution.hpp>
#endif
+#include <com/sun/star/sdbc/XBatchExecution.hpp>
#ifndef _COM_SUN_STAR_SDBC_XGENERATEDRESULTSET_HPP_
#include <com/sun/star/sdbc/XGeneratedResultSet.hpp>
#endif
@@ -72,9 +73,8 @@
#ifndef _COMPHELPER_BROADCASTHELPER_HXX_
#include <comphelper/broadcasthelper.hxx>
#endif
-#ifndef _CPPUHELPER_IMPLBASE2_HXX_
-#include <cppuhelper/implbase2.hxx>
-#endif
+
+#include <cppuhelper/implbase3.hxx>
//************************************************************
// OStatementBase
@@ -171,8 +171,9 @@ protected:
//************************************************************
// OStatement
//************************************************************
-typedef ::cppu::ImplHelper2 < ::com::sun::star::sdbc::XStatement
+typedef ::cppu::ImplHelper3 < ::com::sun::star::sdbc::XStatement
, ::com::sun::star::lang::XServiceInfo
+ , ::com::sun::star::sdbc::XBatchExecution
> OStatement_IFACE;
class OStatement :public OStatementBase
,public OStatement_IFACE
@@ -203,6 +204,13 @@ public:
// OComponentHelper
virtual void SAL_CALL disposing();
+ // XBatchExecution
+ virtual void SAL_CALL addBatch( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL clearBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL executeBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+
+ using OStatementBase::addBatch;
+
private:
/** does escape processing for the given SQL command, if the our EscapeProcessing
property allows so.
diff --git a/dbaccess/source/core/misc/dsntypes.cxx b/dbaccess/source/core/misc/dsntypes.cxx
index 30ec32935cd5..eb2e1ed6de67 100644
--- a/dbaccess/source/core/misc/dsntypes.cxx
+++ b/dbaccess/source/core/misc/dsntypes.cxx
@@ -34,18 +34,20 @@
#include "dsntypes.hxx"
#include "dbamiscres.hrc"
#include <unotools/confignode.hxx>
-#include <tools/rc.hxx>
#include <tools/debug.hxx>
+#include <tools/wldcrd.hxx>
#include <osl/file.hxx>
#include "dbastrings.hrc"
#include "core_resource.hxx"
#include "core_resource.hrc"
#include <comphelper/documentconstants.hxx>
+#include <connectivity/DriversConfig.hxx>
//.........................................................................
namespace dbaccess
{
//.........................................................................
+ using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::lang;
@@ -61,84 +63,31 @@ namespace dbaccess
_nPortNumber = _sUrl.GetToken(1,':').ToInt32();
}
}
- class ODataSourceTypeStringListResource : public Resource
- {
- ::std::vector<String> m_aStrings;
- public:
- ODataSourceTypeStringListResource(USHORT _nResId ) : Resource(ResId(_nResId,*ResourceManager::getResManager()))
- {
- m_aStrings.reserve(STR_END);
- for (int i = STR_MYSQL_ODBC; i < STR_END ; ++i)
- {
- m_aStrings.push_back(String(DBA_RES(sal::static_int_cast<USHORT>(i))));
- }
-
- }
- ~ODataSourceTypeStringListResource()
- {
- FreeResource();
- }
- /** fill the vector with our readed strings
- @param _rToFill
- Vector to fill.
- */
- inline void fill( ::std::vector<String>& _rToFill )
- {
- _rToFill = m_aStrings;
- }
- };
-
- ::rtl::OUString lcl_getUserDefinedDriverNodeName()
- {
- static ::rtl::OUString s_sNodeName(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.DataAccess/UserDefinedDriverSettings"));
- return s_sNodeName;
- }
- // -----------------------------------------------------------------------------
- ::rtl::OUString lcl_getDriverTypeDisplayNodeName()
- {
- static ::rtl::OUString s_sNodeName(RTL_CONSTASCII_USTRINGPARAM("DriverTypeDisplayName"));
- return s_sNodeName;
- }
- // -----------------------------------------------------------------------------
- ::rtl::OUString lcl_getDriverDsnPrefixNodeName()
- {
- static ::rtl::OUString s_sNodeName(RTL_CONSTASCII_USTRINGPARAM("DriverDsnPrefix"));
- return s_sNodeName;
- }
- // -----------------------------------------------------------------------------
- ::rtl::OUString lcl_getDriverExtensionNodeName()
- {
- static ::rtl::OUString s_sNodeName(RTL_CONSTASCII_USTRINGPARAM("Extension"));
- return s_sNodeName;
- }
-
}
//=========================================================================
//= ODsnTypeCollection
//=========================================================================
DBG_NAME(ODsnTypeCollection)
//-------------------------------------------------------------------------
-ODsnTypeCollection::ODsnTypeCollection()
+ODsnTypeCollection::ODsnTypeCollection(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xFactory)
+:m_xFactory(_xFactory)
#ifdef DBG_UTIL
-:m_nLivingIterators(0)
+,m_nLivingIterators(0)
#endif
{
DBG_CTOR(ODsnTypeCollection,NULL);
- ODataSourceTypeStringListResource aTypes(RSC_DATASOURCE_TYPES);
- aTypes.fill(m_aDsnPrefixes);
-
- ODataSourceTypeStringListResource aDisplayNames(RSC_DATASOURCE_TYPE_UINAMES);
- aDisplayNames.fill(m_aDsnTypesDisplayNames);
-
+ ::connectivity::DriversConfig aDriverConfig(m_xFactory);
+ const uno::Sequence< ::rtl::OUString > aURLs = aDriverConfig.getURLs();
+ const ::rtl::OUString* pIter = aURLs.getConstArray();
+ const ::rtl::OUString* pEnd = pIter + aURLs.getLength();
+ for(;pIter != pEnd;++pIter )
+ {
+ m_aDsnPrefixes.push_back(*pIter);
+ m_aDsnTypesDisplayNames.push_back(aDriverConfig.getDriverTypeDisplayName(*pIter));
+ }
DBG_ASSERT(m_aDsnTypesDisplayNames.size() == m_aDsnPrefixes.size(),
"ODsnTypeCollection::ODsnTypeCollection : invalid resources !");
- String sCurrentType;
-
- for (StringVector::iterator aIter = m_aDsnPrefixes.begin();aIter != m_aDsnPrefixes.end();++aIter)
- {
- m_aDsnTypes.push_back(implDetermineType(*aIter));
- }
}
//-------------------------------------------------------------------------
@@ -147,302 +96,261 @@ ODsnTypeCollection::~ODsnTypeCollection()
DBG_DTOR(ODsnTypeCollection,NULL);
DBG_ASSERT(0 == m_nLivingIterators, "ODsnTypeCollection::~ODsnTypeCollection : there are still living iterator objects!");
}
-// -----------------------------------------------------------------------------
-void ODsnTypeCollection::initUserDriverTypes(const Reference< XMultiServiceFactory >& _rxORB)
+//-------------------------------------------------------------------------
+String ODsnTypeCollection::getTypeDisplayName(const ::rtl::OUString& _sURL) const
{
- // read the user driver out of the configuration
- // the config node where all pooling relevant info are stored under
- ::utl::OConfigurationTreeRoot aUserDefinedDriverRoot = ::utl::OConfigurationTreeRoot::createWithServiceFactory(
- _rxORB, lcl_getUserDefinedDriverNodeName(), -1, ::utl::OConfigurationTreeRoot::CM_READONLY);
-
- if ( aUserDefinedDriverRoot.isValid() )
+ ::connectivity::DriversConfig aDriverConfig(m_xFactory);
+ return aDriverConfig.getDriverTypeDisplayName(_sURL);
+}
+//-------------------------------------------------------------------------
+String ODsnTypeCollection::cutPrefix(const ::rtl::OUString& _sURL) const
+{
+ String sURL( _sURL);
+ String sRet;
+ String sOldPattern;
+ StringVector::const_iterator aIter = m_aDsnPrefixes.begin();
+ StringVector::const_iterator aEnd = m_aDsnPrefixes.end();
+ for(;aIter != aEnd;++aIter)
{
- Sequence< ::rtl::OUString > aDriverKeys = aUserDefinedDriverRoot.getNodeNames();
- const ::rtl::OUString* pDriverKeys = aDriverKeys.getConstArray();
- const ::rtl::OUString* pDriverKeysEnd = pDriverKeys + aDriverKeys.getLength();
- for (sal_Int32 i=0;pDriverKeys != pDriverKeysEnd && i <= DST_USERDEFINE10; ++pDriverKeys)
+ WildCard aWildCard(*aIter);
+ if ( sOldPattern.Len() < aIter->Len() && aWildCard.Matches(_sURL) )
{
- ::utl::OConfigurationNode aThisDriverSettings = aUserDefinedDriverRoot.openNode(*pDriverKeys);
- if ( aThisDriverSettings.isValid() )
- {
- // read the needed information
- ::rtl::OUString sDsnPrefix,sDsnTypeDisplayName,sExtension;
- aThisDriverSettings.getNodeValue(lcl_getDriverTypeDisplayNodeName()) >>= sDsnTypeDisplayName;
- aThisDriverSettings.getNodeValue(lcl_getDriverDsnPrefixNodeName()) >>= sDsnPrefix;
- aThisDriverSettings.getNodeValue(lcl_getDriverExtensionNodeName()) >>= sExtension;
-
- m_aDsnTypesDisplayNames.push_back(sDsnTypeDisplayName);
- m_aDsnPrefixes.push_back(sDsnPrefix);
- m_aDsnTypes.push_back(static_cast<DATASOURCE_TYPE>(DST_USERDEFINE1 + i++));
- m_aUserExtensions.push_back(sExtension);
- }
+ if ( aIter->Len() < sURL.Len() )
+ sRet = sURL.Copy(sURL.Match(*aIter));
+ else
+ sRet = sURL.Copy(aIter->Match(sURL));
+ sOldPattern = *aIter;
}
}
-}
+ return sRet;
+}
//-------------------------------------------------------------------------
-DATASOURCE_TYPE ODsnTypeCollection::getType(const String& _rDsn) const
+String ODsnTypeCollection::getPrefix(const ::rtl::OUString& _sURL) const
{
- DATASOURCE_TYPE eType = DST_UNKNOWN;
- // look for user defined driver types
+ String sURL( _sURL);
+ String sRet;
+ String sOldPattern;
StringVector::const_iterator aIter = m_aDsnPrefixes.begin();
StringVector::const_iterator aEnd = m_aDsnPrefixes.end();
- for (; aIter != aEnd; ++aIter)
+ for(;aIter != aEnd;++aIter)
{
- if ( _rDsn.Len() >= aIter->Len() && aIter->EqualsIgnoreCaseAscii(_rDsn,0, aIter->Len()) )
+ WildCard aWildCard(*aIter);
+ if ( sOldPattern.Len() < aIter->Len() && aWildCard.Matches(sURL) )
{
- size_t nPos = (aIter - m_aDsnPrefixes.begin());
- if ( nPos < m_aDsnTypes.size() )
- {
- eType = m_aDsnTypes[nPos];
- break;
- }
+ if ( aIter->Len() < sURL.Len() )
+ sRet = aIter->Copy(0,sURL.Match(*aIter));
+ else
+ sRet = sURL.Copy(0,aIter->Match(sURL));
+ sRet.EraseTrailingChars('*');
+ sOldPattern = *aIter;
}
}
- return eType;
-}
-
-//-------------------------------------------------------------------------
-String ODsnTypeCollection::getTypeDisplayName(DATASOURCE_TYPE _eType) const
-{
- String sDisplayName;
- sal_Int32 nIndex = implDetermineTypeIndex(_eType);
- if ((nIndex >= 0) && (nIndex < (sal_Int32)m_aDsnTypesDisplayNames.size()))
- sDisplayName = m_aDsnTypesDisplayNames[nIndex];
-
- return sDisplayName;
+ return sRet;
}
-
-//-------------------------------------------------------------------------
-String ODsnTypeCollection::getDatasourcePrefix(DATASOURCE_TYPE _eType) const
+// -----------------------------------------------------------------------------
+bool ODsnTypeCollection::isConnectionUrlRequired(const ::rtl::OUString& _sURL) const
{
- String sPrefix;
- sal_Int32 nIndex = implDetermineTypeIndex(_eType);
- if ((nIndex >= 0) && (nIndex < (sal_Int32)m_aDsnPrefixes.size()))
- sPrefix = m_aDsnPrefixes[nIndex];
-
- return sPrefix;
+ String sURL( _sURL);
+ String sRet;
+ String sOldPattern;
+ StringVector::const_iterator aIter = m_aDsnPrefixes.begin();
+ StringVector::const_iterator aEnd = m_aDsnPrefixes.end();
+ for(;aIter != aEnd;++aIter)
+ {
+ WildCard aWildCard(*aIter);
+ if ( sOldPattern.Len() < aIter->Len() && aWildCard.Matches(sURL) )
+ {
+ sRet = *aIter;
+ sOldPattern = *aIter;
+ }
+ } // for(;aIter != aEnd;++aIter)
+ return sRet.GetChar(sRet.Len()-1) == '*';
}
-
-//-------------------------------------------------------------------------
-String ODsnTypeCollection::cutPrefix(const String& _rDsn) const
+// -----------------------------------------------------------------------------
+String ODsnTypeCollection::getMediaType(const ::rtl::OUString& _sURL) const
{
- DATASOURCE_TYPE eType = getType(_rDsn);
- String sPrefix = getDatasourcePrefix(eType);
- return _rDsn.Copy(sPrefix.Len());
+ ::connectivity::DriversConfig aDriverConfig(m_xFactory);
+ const ::comphelper::NamedValueCollection& aFeatures = aDriverConfig.getMetaData(_sURL);
+ return aFeatures.getOrDefault("MediaType",::rtl::OUString());
}
// -----------------------------------------------------------------------------
-String ODsnTypeCollection::getMediaType(DATASOURCE_TYPE _eType) const
+String ODsnTypeCollection::getDatasourcePrefixFromMediaType(const ::rtl::OUString& _sMediaType,const ::rtl::OUString& _sExtension)
{
- String sRet;
- switch (_eType)
+ String sURL;
+ ::connectivity::DriversConfig aDriverConfig(m_xFactory);
+ const uno::Sequence< ::rtl::OUString > aURLs = aDriverConfig.getURLs();
+ const ::rtl::OUString* pIter = aURLs.getConstArray();
+ const ::rtl::OUString* pEnd = pIter + aURLs.getLength();
+ for(;pIter != pEnd;++pIter )
{
- case DST_DBASE:
- sRet = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("application/dbase"));
- break;
- case DST_FLAT:
- sRet = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("text/csv"));
- break;
- case DST_CALC:
- sRet = MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET;
- break;
- case DST_MSACCESS:
- case DST_MSACCESS_2007:
- sRet = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("application/msaccess"));
- break;
- default:
- break;
- }
- return sRet;
+ const ::comphelper::NamedValueCollection& aFeatures = aDriverConfig.getMetaData(*pIter);
+ if ( aFeatures.getOrDefault("MediaType",::rtl::OUString()) == _sMediaType )
+ {
+ const ::rtl::OUString sFileExtension = aFeatures.getOrDefault("Extension",::rtl::OUString());
+ if ( (sFileExtension.getLength() && _sExtension == sFileExtension ) || !sFileExtension.getLength() || !_sExtension.getLength() )
+ {
+ sURL = *pIter;
+ break;
+ }
+ }
+ } // for(;pIter != pEnd;++pIter )
+ sURL.EraseTrailingChars('*');
+ return sURL;
+}
+// -----------------------------------------------------------------------------
+bool ODsnTypeCollection::isShowPropertiesEnabled( const ::rtl::OUString& _sURL ) const
+{
+ return !( _sURL.matchIgnoreAsciiCaseAsciiL("sdbc:embedded:hsqldb",sizeof("sdbc:embedded:hsqldb")-1)
+ || _sURL.matchIgnoreAsciiCaseAsciiL("sdbc:address:outlook",sizeof("sdbc:address:outlook")-1)
+ || _sURL.matchIgnoreAsciiCaseAsciiL("sdbc:address:outlookexp",sizeof("sdbc:address:outlookexp")-1)
+ || _sURL.matchIgnoreAsciiCaseAsciiL("sdbc:address:mozilla:",sizeof("sdbc:address:mozilla:")-1)
+ || _sURL.matchIgnoreAsciiCaseAsciiL("sdbc:address:kab",sizeof("sdbc:address:kab")-1)
+ || _sURL.matchIgnoreAsciiCaseAsciiL("sdbc:address:evolution:local",sizeof("sdbc:address:evolution:local")-1)
+ || _sURL.matchIgnoreAsciiCaseAsciiL("sdbc:address:evolution:groupwise",sizeof("sdbc:address:evolution:groupwise")-1)
+ || _sURL.matchIgnoreAsciiCaseAsciiL("sdbc:address:evolution:ldap",sizeof("sdbc:address:evolution:ldap")-1)
+ || _sURL.matchIgnoreAsciiCaseAsciiL("sdbc:address:macab",sizeof("sdbc:address:macab")-1) );
}
// -----------------------------------------------------------------------------
-String ODsnTypeCollection::getDatasourcePrefixFromMediaType(const String& _sMediaType,const String& _sExtension)
+void ODsnTypeCollection::extractHostNamePort(const ::rtl::OUString& _rDsn,String& _sDatabaseName,String& _rsHostname,sal_Int32& _nPortNumber) const
{
- ::rtl::OUString sURL(RTL_CONSTASCII_USTRINGPARAM("sdbc:"));
- if ( _sMediaType.EqualsIgnoreCaseAscii( "text/csv" ) )
+ String sUrl = cutPrefix(_rDsn);
+ if ( _rDsn.matchIgnoreAsciiCaseAsciiL("jdbc:oracle:thin:",sizeof("jdbc:oracle:thin:")-1) )
{
- sURL += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("flat:"));
+ lcl_extractHostAndPort(sUrl,_rsHostname,_nPortNumber);
+ if ( !_rsHostname.Len() && sUrl.GetTokenCount(':') == 2 )
+ {
+ _nPortNumber = -1;
+ _rsHostname = sUrl.GetToken(0,':');
+ }
+ if ( _rsHostname.Len() )
+ _rsHostname = _rsHostname.GetToken(_rsHostname.GetTokenCount('@') - 1,'@');
+ _sDatabaseName = sUrl.GetToken(sUrl.GetTokenCount(':') - 1,':');
+ } // if ( _rDsn.matchIgnoreAsciiCaseAsciiL("jdbc:oracle:thin:",sizeof("jdbc:oracle:thin:")-1) )
+ else if ( _rDsn.matchIgnoreAsciiCaseAsciiL("sdbc:address:ldap:",sizeof("sdbc:address:ldap:")-1) )
+ {
+ lcl_extractHostAndPort(sUrl,_sDatabaseName,_nPortNumber);
}
- else if ( _sMediaType.EqualsIgnoreCaseAscii( "application/dbase" ) )
+ else if ( _rDsn.matchIgnoreAsciiCaseAsciiL("sdbc:adabas:",sizeof("sdbc:adabas:")-1) )
{
- sURL += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("dbase:"));
+ if ( sUrl.GetTokenCount(':') == 2 )
+ _rsHostname = sUrl.GetToken(0,':');
+ _sDatabaseName = sUrl.GetToken(sUrl.GetTokenCount(':') - 1,':');
}
- else if ( _sMediaType.EqualsIgnoreCaseAscii( MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_ASCII ) )
+ else if ( _rDsn.matchIgnoreAsciiCaseAsciiL("sdbc:mysql:mysqlc:",sizeof("sdbc:mysql:mysqlc:")-1) || _rDsn.matchIgnoreAsciiCaseAsciiL("sdbc:mysql:jdbc:",sizeof("sdbc:mysql:jdbc:")-1) )
{
- sURL += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("calc:"));
+ lcl_extractHostAndPort(sUrl,_rsHostname,_nPortNumber);
+
+ if ( _nPortNumber == -1 && !_rsHostname.Len() && sUrl.GetTokenCount('/') == 2 )
+ _rsHostname = sUrl.GetToken(0,'/');
+ _sDatabaseName = sUrl.GetToken(sUrl.GetTokenCount('/') - 1,'/');
}
- else if ( _sMediaType.EqualsIgnoreCaseAscii( "application/msaccess" ) )
+ else if ( _rDsn.matchIgnoreAsciiCaseAsciiL("sdbc:ado:access:Provider=Microsoft.ACE.OLEDB.12.0;DATA SOURCE=",sizeof("sdbc:ado:access:Provider=Microsoft.ACE.OLEDB.12.0;DATA SOURCE=")-1)
+ || _rDsn.matchIgnoreAsciiCaseAsciiL("sdbc:ado:access:PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=",sizeof("sdbc:ado:access:PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=")-1))
{
- if ( _sExtension.EqualsIgnoreCaseAscii( "mdb" ) )
- sURL += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ado:access:PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE="));
- else
- sURL += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ado:access:Provider=Microsoft.ACE.OLEDB.12.0;DATA SOURCE="));
+ ::rtl::OUString sNewFileName;
+ if ( ::osl::FileBase::getFileURLFromSystemPath( sUrl, sNewFileName ) == ::osl::FileBase::E_None )
+ {
+ _sDatabaseName = sNewFileName;
+ }
}
- return sURL;
}
// -----------------------------------------------------------------------------
-void ODsnTypeCollection::extractHostNamePort(const String& _rDsn,String& _sDatabaseName,String& _rsHostname,sal_Int32& _nPortNumber) const
+String ODsnTypeCollection::getJavaDriverClass(const ::rtl::OUString& _sURL) const
{
- DATASOURCE_TYPE eType = getType(_rDsn);
- String sUrl = cutPrefix(_rDsn);
- switch( eType )
- {
- case DST_ORACLE_JDBC:
- lcl_extractHostAndPort(sUrl,_rsHostname,_nPortNumber);
- if ( !_rsHostname.Len() && sUrl.GetTokenCount(':') == 2 )
- {
- _nPortNumber = -1;
- _rsHostname = sUrl.GetToken(0,':');
- }
- if ( _rsHostname.Len() )
- _rsHostname = _rsHostname.GetToken(_rsHostname.GetTokenCount('@') - 1,'@');
- _sDatabaseName = sUrl.GetToken(sUrl.GetTokenCount(':') - 1,':');
- break;
- case DST_LDAP:
- lcl_extractHostAndPort(sUrl,_sDatabaseName,_nPortNumber);
- break;
- case DST_ADABAS:
- if ( sUrl.GetTokenCount(':') == 2 )
- _rsHostname = sUrl.GetToken(0,':');
- _sDatabaseName = sUrl.GetToken(sUrl.GetTokenCount(':') - 1,':');
- break;
- case DST_MYSQL_NATIVE:
- case DST_MYSQL_JDBC:
- {
- lcl_extractHostAndPort(sUrl,_rsHostname,_nPortNumber);
-
- if ( _nPortNumber == -1 && !_rsHostname.Len() && sUrl.GetTokenCount('/') == 2 )
- _rsHostname = sUrl.GetToken(0,'/');
- _sDatabaseName = sUrl.GetToken(sUrl.GetTokenCount('/') - 1,'/');
- }
- break;
- case DST_MSACCESS:
- case DST_MSACCESS_2007:
- {
- ::rtl::OUString sNewFileName;
- if ( ::osl::FileBase::getFileURLFromSystemPath( sUrl, sNewFileName ) == ::osl::FileBase::E_None )
- {
- _sDatabaseName = sNewFileName;
- }
- }
- break;
- default:
- break;
- }
+ ::connectivity::DriversConfig aDriverConfig(m_xFactory);
+ const ::comphelper::NamedValueCollection& aFeatures = aDriverConfig.getProperties(_sURL);
+ return aFeatures.getOrDefault("JavaDriverClass",::rtl::OUString());
}
-
//-------------------------------------------------------------------------
-sal_Bool ODsnTypeCollection::isFileSystemBased(DATASOURCE_TYPE _eType) const
+sal_Bool ODsnTypeCollection::isFileSystemBased(const ::rtl::OUString& _sURL) const
{
- switch (_eType)
- {
- case DST_DBASE:
- case DST_FLAT:
- case DST_CALC:
- case DST_MSACCESS:
- case DST_MSACCESS_2007:
- return sal_True;
-
- case DST_USERDEFINE1:
- case DST_USERDEFINE2:
- case DST_USERDEFINE3:
- case DST_USERDEFINE4:
- case DST_USERDEFINE5:
- case DST_USERDEFINE6:
- case DST_USERDEFINE7:
- case DST_USERDEFINE8:
- case DST_USERDEFINE9:
- case DST_USERDEFINE10:
- {
- StringVector::size_type nPos = static_cast<sal_Int16>(_eType-DST_USERDEFINE1);
- return nPos < m_aUserExtensions.size() && m_aUserExtensions[nPos].Len() != 0;
- }
- default:
- return sal_False;
- }
+ ::connectivity::DriversConfig aDriverConfig(m_xFactory);
+ const ::comphelper::NamedValueCollection& aFeatures = aDriverConfig.getMetaData(_sURL);
+ return aFeatures.getOrDefault("FileSystemBased",sal_False);
+}
+// -----------------------------------------------------------------------------
+sal_Bool ODsnTypeCollection::supportsTableCreation(const ::rtl::OUString& _sURL) const
+{
+ ::connectivity::DriversConfig aDriverConfig(m_xFactory);
+ const ::comphelper::NamedValueCollection& aFeatures = aDriverConfig.getMetaData(_sURL);
+ return aFeatures.getOrDefault("SupportsTableCreation",sal_False);
+}
+// -----------------------------------------------------------------------------
+sal_Bool ODsnTypeCollection::supportsBrowsing(const ::rtl::OUString& _sURL) const
+{
+ ::connectivity::DriversConfig aDriverConfig(m_xFactory);
+ const ::comphelper::NamedValueCollection& aFeatures = aDriverConfig.getMetaData(_sURL);
+ return aFeatures.getOrDefault("SupportsBrowsing",sal_False);
+}
+// -----------------------------------------------------------------------------
+bool ODsnTypeCollection::needsJVM(const String& _sURL) const
+{
+ ::connectivity::DriversConfig aDriverConfig(m_xFactory);
+ const ::comphelper::NamedValueCollection& aFeatures = aDriverConfig.getMetaData(_sURL);
+ return aFeatures.getOrDefault("UseJava",sal_False);
+}
+// -----------------------------------------------------------------------------
+Sequence<PropertyValue> ODsnTypeCollection::getDefaultDBSettings( const ::rtl::OUString& _sURL ) const
+{
+ ::connectivity::DriversConfig aDriverConfig(m_xFactory);
+ const ::comphelper::NamedValueCollection& aProperties = aDriverConfig.getProperties(_sURL);
+ return aProperties.getPropertyValues();
}
-
-sal_Bool ODsnTypeCollection::supportsTableCreation(DATASOURCE_TYPE _eType)
+// -----------------------------------------------------------------------------
+String ODsnTypeCollection::getTypeExtension(const ::rtl::OUString& _sURL) const
{
- BOOL bSupportsTableCreation;
- switch( _eType )
- {
- case DST_MOZILLA:
- case DST_OUTLOOK:
- case DST_OUTLOOKEXP:
- case DST_FLAT:
- case DST_EVOLUTION:
- case DST_EVOLUTION_GROUPWISE:
- case DST_EVOLUTION_LDAP:
- case DST_KAB:
- case DST_THUNDERBIRD:
- case DST_CALC:
- bSupportsTableCreation = FALSE;
- break;
- case DST_DBASE:
- case DST_ADABAS:
- case DST_ADO:
- case DST_MSACCESS:
- case DST_MSACCESS_2007:
- case DST_MYSQL_ODBC:
- case DST_ODBC:
- case DST_MYSQL_JDBC:
- case DST_MYSQL_NATIVE:
- case DST_ORACLE_JDBC:
- case DST_LDAP:
- case DST_JDBC:
- default:
- bSupportsTableCreation = TRUE;
- break;
- }
- return bSupportsTableCreation;
+ ::connectivity::DriversConfig aDriverConfig(m_xFactory);
+ const ::comphelper::NamedValueCollection& aFeatures = aDriverConfig.getMetaData(_sURL);
+ return aFeatures.getOrDefault("Extension",::rtl::OUString());
+}
+//-------------------------------------------------------------------------
+bool ODsnTypeCollection::isEmbeddedDatabase( const ::rtl::OUString& _sURL ) const
+{
+ const ::rtl::OUString sEmbeddedDatabaseURL = getEmbeddedDatabase();
+ WildCard aWildCard(sEmbeddedDatabaseURL);
+ return aWildCard.Matches(_sURL);
}
// -----------------------------------------------------------------------------
-sal_Bool ODsnTypeCollection::supportsBrowsing(DATASOURCE_TYPE _eType)
+::rtl::OUString ODsnTypeCollection::getEmbeddedDatabase() const
{
- sal_Bool bEnableBrowseButton = sal_False;
- switch( _eType )
+ ::rtl::OUString sEmbeddedDatabaseURL;
+ static const ::rtl::OUString s_sNodeName(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.DataAccess")); ///Installed
+ const ::utl::OConfigurationTreeRoot aInstalled = ::utl::OConfigurationTreeRoot::createWithServiceFactory(m_xFactory, s_sNodeName, -1, ::utl::OConfigurationTreeRoot::CM_READONLY);
+ if ( aInstalled.isValid() )
{
- case DST_DBASE:
- case DST_FLAT:
- case DST_CALC:
- case DST_ADABAS:
- case DST_ADO:
- case DST_MSACCESS:
- case DST_MSACCESS_2007:
- case DST_MYSQL_ODBC:
- case DST_ODBC:
- case DST_MOZILLA:
- case DST_THUNDERBIRD:
- bEnableBrowseButton = TRUE;
- break;
- case DST_MYSQL_NATIVE:
- case DST_MYSQL_JDBC:
- case DST_ORACLE_JDBC:
- case DST_LDAP:
- case DST_OUTLOOK:
- case DST_OUTLOOKEXP:
- case DST_JDBC:
- case DST_EVOLUTION:
- case DST_EVOLUTION_GROUPWISE:
- case DST_EVOLUTION_LDAP:
- case DST_KAB:
- bEnableBrowseButton = FALSE;
- break;
- default:
- bEnableBrowseButton = getTypeExtension(_eType).Len() != 0;
- break;
- }
- return bEnableBrowseButton;
-}
+ if ( aInstalled.hasByName("EmbeddedDatabases/DefaultEmbeddedDatabase/Value") )
+ {
+ static const ::rtl::OUString s_sValue(RTL_CONSTASCII_USTRINGPARAM("EmbeddedDatabases/DefaultEmbeddedDatabase/Value"));
+ aInstalled.getNodeValue(s_sValue) >>= sEmbeddedDatabaseURL;
+ if ( sEmbeddedDatabaseURL.getLength() )
+ aInstalled.getNodeValue(s_sValue + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")) + sEmbeddedDatabaseURL + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/URL"))) >>= sEmbeddedDatabaseURL;
+ }
+ } // if ( aInstalled.isValid() )
+ if ( !sEmbeddedDatabaseURL.getLength() )
+ sEmbeddedDatabaseURL = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:embedded:hsqldb"));
+ return sEmbeddedDatabaseURL;
+}
+//-------------------------------------------------------------------------
+ODsnTypeCollection::TypeIterator ODsnTypeCollection::begin() const
+{
+ return TypeIterator(this, 0);
+}
//-------------------------------------------------------------------------
-DATASOURCE_TYPE ODsnTypeCollection::implDetermineType(const String& _rDsn) const
+ODsnTypeCollection::TypeIterator ODsnTypeCollection::end() const
+{
+ return TypeIterator(this, m_aDsnTypesDisplayNames.size());
+}
+//-------------------------------------------------------------------------
+DATASOURCE_TYPE ODsnTypeCollection::determineType(const String& _rDsn) const
{
- sal_uInt16 nSeparator = _rDsn.Search((sal_Unicode)':');
+ String sDsn(_rDsn);
+ sDsn.EraseTrailingChars('*');
+ sal_uInt16 nSeparator = sDsn.Search((sal_Unicode)':');
if (STRING_NOTFOUND == nSeparator)
{
// there should be at least one such separator
@@ -450,19 +358,19 @@ DATASOURCE_TYPE ODsnTypeCollection::implDetermineType(const String& _rDsn) const
return DST_UNKNOWN;
}
// find first :
- sal_uInt16 nOracleSeparator = _rDsn.Search((sal_Unicode)':', nSeparator + 1);
+ sal_uInt16 nOracleSeparator = sDsn.Search((sal_Unicode)':', nSeparator + 1);
if ( nOracleSeparator != STRING_NOTFOUND )
{
- nOracleSeparator = _rDsn.Search((sal_Unicode)':', nOracleSeparator + 1);
- if (nOracleSeparator != STRING_NOTFOUND && _rDsn.EqualsIgnoreCaseAscii("jdbc:oracle:thin", 0, nOracleSeparator))
+ nOracleSeparator = sDsn.Search((sal_Unicode)':', nOracleSeparator + 1);
+ if (nOracleSeparator != STRING_NOTFOUND && sDsn.EqualsIgnoreCaseAscii("jdbc:oracle:thin", 0, nOracleSeparator))
return DST_ORACLE_JDBC;
}
- if (_rDsn.EqualsIgnoreCaseAscii("jdbc", 0, nSeparator))
+ if (sDsn.EqualsIgnoreCaseAscii("jdbc", 0, nSeparator))
return DST_JDBC;
// find second :
- nSeparator = _rDsn.Search((sal_Unicode)':', nSeparator + 1);
+ nSeparator = sDsn.Search((sal_Unicode)':', nSeparator + 1);
if (STRING_NOTFOUND == nSeparator)
{
// at the moment only jdbc is allowed to have just one separator
@@ -470,156 +378,185 @@ DATASOURCE_TYPE ODsnTypeCollection::implDetermineType(const String& _rDsn) const
return DST_UNKNOWN;
}
- if (_rDsn.EqualsIgnoreCaseAscii("sdbc:adabas", 0, nSeparator))
+ if (sDsn.EqualsIgnoreCaseAscii("sdbc:adabas", 0, nSeparator))
return DST_ADABAS;
- if (_rDsn.EqualsIgnoreCaseAscii("sdbc:odbc", 0, nSeparator))
+ if (sDsn.EqualsIgnoreCaseAscii("sdbc:odbc", 0, nSeparator))
return DST_ODBC;
- if (_rDsn.EqualsIgnoreCaseAscii("sdbc:dbase", 0, nSeparator))
+ if (sDsn.EqualsIgnoreCaseAscii("sdbc:dbase", 0, nSeparator))
return DST_DBASE;
- if (_rDsn.EqualsIgnoreCaseAscii("sdbc:ado:", 0, nSeparator))
+ if (sDsn.EqualsIgnoreCaseAscii("sdbc:ado:", 0, nSeparator))
{
- nSeparator = _rDsn.Search((sal_Unicode)':', nSeparator + 1);
- if (STRING_NOTFOUND != nSeparator && _rDsn.EqualsIgnoreCaseAscii("sdbc:ado:access",0, nSeparator) )
+ nSeparator = sDsn.Search((sal_Unicode)':', nSeparator + 1);
+ if (STRING_NOTFOUND != nSeparator && sDsn.EqualsIgnoreCaseAscii("sdbc:ado:access",0, nSeparator) )
{
- nSeparator = _rDsn.Search((sal_Unicode)';', nSeparator + 1);
- if (STRING_NOTFOUND != nSeparator && _rDsn.EqualsIgnoreCaseAscii("sdbc:ado:access:Provider=Microsoft.ACE.OLEDB.12.0",0, nSeparator) )
+ nSeparator = sDsn.Search((sal_Unicode)';', nSeparator + 1);
+ if (STRING_NOTFOUND != nSeparator && sDsn.EqualsIgnoreCaseAscii("sdbc:ado:access:Provider=Microsoft.ACE.OLEDB.12.0",0, nSeparator) )
return DST_MSACCESS_2007;
return DST_MSACCESS;
}
return DST_ADO;
}
- if (_rDsn.EqualsIgnoreCaseAscii("sdbc:flat:", 0, nSeparator))
+ if (sDsn.EqualsIgnoreCaseAscii("sdbc:flat:", 0, nSeparator))
return DST_FLAT;
- if (_rDsn.EqualsIgnoreCaseAscii("sdbc:calc:", 0, nSeparator))
+ if (sDsn.EqualsIgnoreCaseAscii("sdbc:calc:", 0, nSeparator))
return DST_CALC;
- //if ( ( 11 <= nSeparator) && _rDsn.EqualsIgnoreCaseAscii("sdbc:mysqlc:", 0, nSeparator))
+ //if ( ( 11 <= nSeparator) && sDsn.EqualsIgnoreCaseAscii("sdbc:mysqlc:", 0, nSeparator))
// return DST_MYSQL_NATIVE;
- if (_rDsn.EqualsIgnoreCaseAscii("sdbc:embedded:hsqldb", 0, _rDsn.Len()))
+ if (sDsn.EqualsIgnoreCaseAscii("sdbc:embedded:hsqldb", 0, sDsn.Len()))
return DST_EMBEDDED_HSQLDB;
- if (_rDsn.EqualsIgnoreCaseAscii("sdbc:address:", 0, nSeparator))
+ if (sDsn.EqualsIgnoreCaseAscii("sdbc:address:", 0, nSeparator))
{
++nSeparator;
- if (_rDsn.EqualsIgnoreCaseAscii("mozilla:", nSeparator,_rDsn.Len() - nSeparator))
+ if (sDsn.EqualsIgnoreCaseAscii("mozilla:", nSeparator,sDsn.Len() - nSeparator))
return DST_MOZILLA;
- if (_rDsn.EqualsIgnoreCaseAscii("thunderbird:", nSeparator,_rDsn.Len() - nSeparator))
+ if (sDsn.EqualsIgnoreCaseAscii("thunderbird:", nSeparator,sDsn.Len() - nSeparator))
return DST_THUNDERBIRD;
- if (_rDsn.EqualsIgnoreCaseAscii("ldap:", nSeparator,_rDsn.Len() - nSeparator))
+ if (sDsn.EqualsIgnoreCaseAscii("ldap:", nSeparator,sDsn.Len() - nSeparator))
return DST_LDAP;
- if (_rDsn.EqualsIgnoreCaseAscii("outlook", nSeparator,_rDsn.Len() - nSeparator))
+ if (sDsn.EqualsIgnoreCaseAscii("outlook", nSeparator,sDsn.Len() - nSeparator))
return DST_OUTLOOK;
- if (_rDsn.EqualsIgnoreCaseAscii("outlookexp", nSeparator,_rDsn.Len() - nSeparator))
+ if (sDsn.EqualsIgnoreCaseAscii("outlookexp", nSeparator,sDsn.Len() - nSeparator))
return DST_OUTLOOKEXP;
- if (_rDsn.EqualsIgnoreCaseAscii("evolution:ldap", nSeparator,_rDsn.Len() - nSeparator))
+ if (sDsn.EqualsIgnoreCaseAscii("evolution:ldap", nSeparator,sDsn.Len() - nSeparator))
return DST_EVOLUTION_LDAP;
- if (_rDsn.EqualsIgnoreCaseAscii("evolution:groupwise", nSeparator,_rDsn.Len() - nSeparator))
+ if (sDsn.EqualsIgnoreCaseAscii("evolution:groupwise", nSeparator,sDsn.Len() - nSeparator))
return DST_EVOLUTION_GROUPWISE;
- if (_rDsn.EqualsIgnoreCaseAscii("evolution:local", nSeparator,_rDsn.Len() - nSeparator))
+ if (sDsn.EqualsIgnoreCaseAscii("evolution:local", nSeparator,sDsn.Len() - nSeparator))
return DST_EVOLUTION;
- if (_rDsn.EqualsIgnoreCaseAscii("kab", nSeparator,_rDsn.Len() - nSeparator))
+ if (sDsn.EqualsIgnoreCaseAscii("kab", nSeparator,sDsn.Len() - nSeparator))
return DST_KAB;
- if (_rDsn.EqualsIgnoreCaseAscii("macab", nSeparator,_rDsn.Len() - nSeparator))
+ if (sDsn.EqualsIgnoreCaseAscii("macab", nSeparator,sDsn.Len() - nSeparator))
return DST_MACAB;
}
// find third :
- nSeparator = _rDsn.Search((sal_Unicode)':', nSeparator + 1);
+ nSeparator = sDsn.Search((sal_Unicode)':', nSeparator + 1);
if (STRING_NOTFOUND == nSeparator)
{
DBG_ERROR("ODsnTypeCollection::implDetermineType : missing the third colon !");
return DST_UNKNOWN;
}
- if (_rDsn.EqualsIgnoreCaseAscii("sdbc:mysql:odbc", 0, nSeparator))
+ if (sDsn.EqualsIgnoreCaseAscii("sdbc:mysql:odbc", 0, nSeparator))
return DST_MYSQL_ODBC;
- if (_rDsn.EqualsIgnoreCaseAscii("sdbc:mysql:jdbc", 0, nSeparator))
+ if (sDsn.EqualsIgnoreCaseAscii("sdbc:mysql:jdbc", 0, nSeparator))
return DST_MYSQL_JDBC;
- if (_rDsn.EqualsIgnoreCaseAscii("sdbc:mysql:mysqlc", 0, nSeparator))
+ if (sDsn.EqualsIgnoreCaseAscii("sdbc:mysql:mysqlc", 0, nSeparator))
return DST_MYSQL_NATIVE;
DBG_ERROR("ODsnTypeCollection::implDetermineType : unrecognized data source type !");
return DST_UNKNOWN;
}
// -----------------------------------------------------------------------------
-sal_Int32 ODsnTypeCollection::implDetermineTypeIndex(DATASOURCE_TYPE _eType) const
+void ODsnTypeCollection::fillPageIds(const ::rtl::OUString& _sURL,::std::vector<sal_Int16>& _rOutPathIds) const
{
- DBG_ASSERT(
- (m_aDsnTypesDisplayNames.size() == m_aDsnPrefixes.size())
- && (m_aDsnTypesDisplayNames.size() == m_aDsnTypes.size()),
- "ODsnTypeCollection::implDetermineTypeIndex : inconsistent structures !");
-
- // the type of the datasource described by the DSN string
- if (DST_UNKNOWN == _eType)
+ DATASOURCE_TYPE eType = determineType(_sURL);
+ switch(eType)
{
- return -1;
+ case DST_ADO:
+ _rOutPathIds.push_back(PAGE_DBSETUPWIZARD_ADO);
+ break;
+ case DST_DBASE:
+ _rOutPathIds.push_back(PAGE_DBSETUPWIZARD_DBASE);
+ break;
+ case DST_FLAT:
+ _rOutPathIds.push_back(PAGE_DBSETUPWIZARD_TEXT);
+ break;
+ case DST_CALC:
+ _rOutPathIds.push_back(PAGE_DBSETUPWIZARD_SPREADSHEET);
+ break;
+ case DST_ODBC:
+ _rOutPathIds.push_back(PAGE_DBSETUPWIZARD_ODBC);
+ break;
+ case DST_JDBC:
+ _rOutPathIds.push_back(PAGE_DBSETUPWIZARD_JDBC);
+ break;
+ case DST_MYSQL_ODBC:
+ _rOutPathIds.push_back(PAGE_DBSETUPWIZARD_MYSQL_INTRO);
+ _rOutPathIds.push_back(PAGE_DBSETUPWIZARD_MYSQL_ODBC);
+ break;
+ case DST_MYSQL_JDBC:
+ _rOutPathIds.push_back(PAGE_DBSETUPWIZARD_MYSQL_INTRO);
+ _rOutPathIds.push_back(PAGE_DBSETUPWIZARD_MYSQL_JDBC);
+ break;
+ case DST_MYSQL_NATIVE:
+ _rOutPathIds.push_back(PAGE_DBSETUPWIZARD_MYSQL_INTRO);
+ _rOutPathIds.push_back(PAGE_DBSETUPWIZARD_MYSQL_NATIVE);
+ break;
+ case DST_ORACLE_JDBC:
+ _rOutPathIds.push_back(PAGE_DBSETUPWIZARD_ORACLE);
+ break;
+ case DST_ADABAS:
+ _rOutPathIds.push_back(PAGE_DBSETUPWIZARD_ADABAS);
+ break;
+ case DST_LDAP:
+ _rOutPathIds.push_back(PAGE_DBSETUPWIZARD_LDAP);
+ break;
+ case DST_MSACCESS:
+ case DST_MSACCESS_2007:
+ _rOutPathIds.push_back(PAGE_DBSETUPWIZARD_MSACCESS);
+ break;
+ case DST_OUTLOOKEXP:
+ case DST_OUTLOOK:
+ case DST_MOZILLA:
+ case DST_THUNDERBIRD:
+ case DST_EVOLUTION:
+ case DST_EVOLUTION_GROUPWISE:
+ case DST_EVOLUTION_LDAP:
+ case DST_KAB:
+ case DST_MACAB:
+ case DST_EMBEDDED_HSQLDB:
+ break;
+ default:
+ _rOutPathIds.push_back(PAGE_DBSETUPWIZARD_USERDEFINED);
+ break;
}
-
- // search this type in our arrays
- sal_Int32 nIndex = 0;
- ConstTypeVectorIterator aSearch = m_aDsnTypes.begin();
-
- for (; aSearch != m_aDsnTypes.end(); ++nIndex, ++aSearch)
- if (*aSearch == _eType)
- return nIndex;
-
- DBG_ERROR("ODsnTypeCollection::implDetermineTypeIndex : recognized the DSN schema, but did not find the type!");
- return -1;
}
// -----------------------------------------------------------------------------
-Sequence<PropertyValue> ODsnTypeCollection::getDefaultDBSettings( DATASOURCE_TYPE _eType ) const
+::rtl::OUString ODsnTypeCollection::getType(const ::rtl::OUString& _sURL) const
{
- Sequence< PropertyValue > aSettings;
-
- switch ( _eType )
+ ::rtl::OUString sOldPattern;
+ StringVector::const_iterator aIter = m_aDsnPrefixes.begin();
+ StringVector::const_iterator aEnd = m_aDsnPrefixes.end();
+ for(;aIter != aEnd;++aIter)
{
- case DST_EMBEDDED_HSQLDB:
- aSettings.realloc( 3 );
-
- aSettings[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "AutoIncrementCreation" ) );
- aSettings[0].Value <<= ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IDENTITY" ) );
-
- aSettings[1].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "AutoRetrievingStatement" ) );
- aSettings[1].Value <<= ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CALL IDENTITY()" ) );
-
- aSettings[2].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsAutoRetrievingEnabled" ) );
- aSettings[2].Value <<= (sal_Bool)sal_True;
- break;
-
- default:
- DBG_ERROR( "ODsnTypeCollection::getDefaultDBSettings: type is unsupported by this method!" );
- break;
- }
-
- return aSettings;
+ WildCard aWildCard(*aIter);
+ if ( sOldPattern.getLength() < aIter->Len() && aWildCard.Matches(_sURL) )
+ {
+ sOldPattern = *aIter;
+ }
+ } // for(sal_Int32 i = 0;aIter != aEnd;++aIter,++i)
+ return sOldPattern;
}
-
// -----------------------------------------------------------------------------
-String ODsnTypeCollection::getTypeExtension(DATASOURCE_TYPE _eType) const
-{
- StringVector::size_type nPos = static_cast<sal_uInt16>(_eType-DST_USERDEFINE1);
- return nPos < m_aUserExtensions.size() ? m_aUserExtensions[nPos] : String();
-}
-//-------------------------------------------------------------------------
-bool ODsnTypeCollection::isEmbeddedDatabase( DATASOURCE_TYPE _eType ) const
+sal_Int32 ODsnTypeCollection::getIndexOf(const ::rtl::OUString& _sURL) const
{
- // the only known embedded type so far is DST_EMBEDDED_HSQLDB
- return ( _eType == DST_EMBEDDED_HSQLDB );
-}
-//-------------------------------------------------------------------------
-ODsnTypeCollection::TypeIterator ODsnTypeCollection::begin() const
-{
- return TypeIterator(this, 0);
-}
+ sal_Int32 nRet = -1;
+ String sURL( _sURL);
+ String sOldPattern;
+ StringVector::const_iterator aIter = m_aDsnPrefixes.begin();
+ StringVector::const_iterator aEnd = m_aDsnPrefixes.end();
+ for(sal_Int32 i = 0;aIter != aEnd;++aIter,++i)
+ {
+ WildCard aWildCard(*aIter);
+ if ( sOldPattern.Len() < aIter->Len() && aWildCard.Matches(sURL) )
+ {
+ nRet = i;
+ sOldPattern = *aIter;
+ }
+ }
-//-------------------------------------------------------------------------
-ODsnTypeCollection::TypeIterator ODsnTypeCollection::end() const
+ return nRet;
+}
+// -----------------------------------------------------------------------------
+sal_Int32 ODsnTypeCollection::size() const
{
- return TypeIterator(this, m_aDsnTypes.size());
+ return m_aDsnPrefixes.size();
}
-
//=========================================================================
//= ODsnTypeCollection::TypeIterator
//=========================================================================
@@ -653,24 +590,22 @@ ODsnTypeCollection::TypeIterator::~TypeIterator()
}
//-------------------------------------------------------------------------
-DATASOURCE_TYPE ODsnTypeCollection::TypeIterator::getType() const
-{
- DBG_ASSERT(m_nPosition < (sal_Int32)m_pContainer->m_aDsnTypes.size(), "ODsnTypeCollection::TypeIterator::getType : invalid position!");
- return m_pContainer->m_aDsnTypes[m_nPosition];
-}
-
-//-------------------------------------------------------------------------
String ODsnTypeCollection::TypeIterator::getDisplayName() const
{
DBG_ASSERT(m_nPosition < (sal_Int32)m_pContainer->m_aDsnTypesDisplayNames.size(), "ODsnTypeCollection::TypeIterator::getDisplayName : invalid position!");
return m_pContainer->m_aDsnTypesDisplayNames[m_nPosition];
}
-
+// -----------------------------------------------------------------------------
+::rtl::OUString ODsnTypeCollection::TypeIterator::getURLPrefix() const
+{
+ DBG_ASSERT(m_nPosition < (sal_Int32)m_pContainer->m_aDsnPrefixes.size(), "ODsnTypeCollection::TypeIterator::getDisplayName : invalid position!");
+ return m_pContainer->m_aDsnPrefixes[m_nPosition];
+}
//-------------------------------------------------------------------------
const ODsnTypeCollection::TypeIterator& ODsnTypeCollection::TypeIterator::operator++()
{
- DBG_ASSERT(m_nPosition < (sal_Int32)m_pContainer->m_aDsnTypes.size(), "ODsnTypeCollection::TypeIterator::operator++ : invalid position!");
- if (m_nPosition < (sal_Int32)m_pContainer->m_aDsnTypes.size())
+ DBG_ASSERT(m_nPosition < (sal_Int32)m_pContainer->m_aDsnTypesDisplayNames.size(), "ODsnTypeCollection::TypeIterator::operator++ : invalid position!");
+ if (m_nPosition < (sal_Int32)m_pContainer->m_aDsnTypesDisplayNames.size())
++m_nPosition;
return *this;
}
diff --git a/dbaccess/source/core/resource/strings.src b/dbaccess/source/core/resource/strings.src
index 23ad6023cbbc..4cf5b457c9fe 100644
--- a/dbaccess/source/core/resource/strings.src
+++ b/dbaccess/source/core/resource/strings.src
@@ -241,203 +241,3 @@ String RID_STR_NAME_NOT_FOUND
};
//-------------------------------------------------------------------------
-Resource RSC_DATASOURCE_TYPES
-{
- String STR_MYSQL_ODBC
- {
- Text ="sdbc:mysql:odbc:";
- };
- String STR_MYSQL_JDBC
- {
- Text ="sdbc:mysql:jdbc:";
- };
- String STR_ADABAS
- {
- Text ="sdbc:adabas:";
- };
- String STR_ORACLE_JDBC
- {
- Text ="jdbc:oracle:thin:";
- };
- String STR_JDBC
- {
- Text ="jdbc:";
- };
- String STR_ODBC
- {
- Text ="sdbc:odbc:";
- };
- String STR_DBASE
- {
- Text ="sdbc:dbase:";
- };
- String STR_MSACCESS
- {
- Text ="sdbc:ado:access:PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=";
- };
- String STR_MSACCESS2007
- {
- Text ="sdbc:ado:access:Provider=Microsoft.ACE.OLEDB.12.0;DATA SOURCE=";
- };
- String STR_ADO
- {
- Text ="sdbc:ado:";
- };
- String STR_FLAT
- {
- Text ="sdbc:flat:";
- };
- String STR_CALC
- {
- Text ="sdbc:calc:";
- };
- String STR_MOZILLA
- {
- Text ="sdbc:address:mozilla:";
- };
- String STR_LDAP
- {
- Text ="sdbc:address:ldap:";
- };
- String STR_OUTLOOK
- {
- Text ="sdbc:address:outlook";
- };
- String STR_OUTLOOKEXP
- {
- Text ="sdbc:address:outlookexp";
- };
- String STR_EVOLUTION
- {
- Text ="sdbc:address:evolution:local";
- };
- String STR_EVOLUTION_GROUPWISE
- {
- Text ="sdbc:address:evolution:groupwise";
- };
- String STR_EVOLUTION_LDAP
- {
- Text ="sdbc:address:evolution:ldap";
- };
- String STR_KAB
- {
- Text ="sdbc:address:kab";
- };
- String STR_EMBEDDED_HSQLDB
- {
- Text = "sdbc:embedded:hsqldb";
- };
- String STR_MACAB
- {
- Text ="sdbc:address:macab";
- };
- String STR_THUNDERBIRD
- {
- Text ="sdbc:address:thunderbird:";
- };
- String STR_MYSQL_NATIVE
- {
- Text ="sdbc:mysql:mysqlc:";
- };
-};
-
-Resource RSC_DATASOURCE_TYPE_UINAMES
-{
- String STR_MYSQL_ODBC
- {
- Text[ en-US ] = "MySQL (ODBC)";
- };
- String STR_MYSQL_JDBC
- {
- Text[ en-US ] = "MySQL (JDBC)";
- };
- String STR_ADABAS
- {
- Text[ en-US ] = "Adabas D";
- };
- String STR_ORACLE_JDBC
- {
- Text[ en-US ] = "Oracle JDBC";
- };
-
- String STR_JDBC
- {
- Text[ en-US ] = "JDBC";
- };
- String STR_ODBC
- {
- Text[ en-US ] = "ODBC";
- };
- String STR_DBASE
- {
- Text[ en-US ] = "dBASE";
- };
- String STR_MSACCESS
- {
- Text[ en-US ] = "Microsoft Access";
- };
- String STR_MSACCESS2007
- {
- Text[ en-US ] = "Microsoft Access 2007";
- };
- String STR_ADO
- {
- Text[ en-US ] = "ADO";
- };
- String STR_FLAT
- {
- Text[ en-US ] = "Text";
- };
- String STR_CALC
- {
- Text[ en-US ] = "Spreadsheet";
- };
- String STR_MOZILLA
- {
- Text[ en-US ] = "Mozilla Address Book";
- };
- String STR_LDAP
- {
- Text[ en-US ] = "LDAP Address Book";
- };
- String STR_OUTLOOK
- {
- Text[ en-US ] = "Microsoft Outlook Address Book";
- };
- String STR_OUTLOOKEXP
- {
- Text[ en-US ] = "Microsoft Windows Address Book";
- };
- String STR_EVOLUTION
- {
- Text[ en-US ] = "Evolution Local";
- };
- String STR_EVOLUTION_GROUPWISE
- {
- Text[ en-US ] = "Groupwise";
- };
- String STR_EVOLUTION_LDAP
- {
- Text[ en-US ] = "Evolution LDAP";
- };
- String STR_KAB
- {
- Text[ en-US ] = "KDE Address Book";
- };
- String STR_MACAB
- {
- Text[ en-US ] = "Mac OS X Address Book";
- };
- String STR_EMBEDDED_HSQLDB
- {
- Text[ en-US ] = "HSQL database engine";
- };
- String STR_THUNDERBIRD
- {
- Text[ en-US ] = "Thunderbird Address Book";
- };
- String STR_MYSQL_NATIVE
- {
- Text[ en-US ] = "MySQL (Native)";
- };
-};
diff --git a/dbaccess/source/ext/macromigration/makefile.mk b/dbaccess/source/ext/macromigration/makefile.mk
index 32be89263968..b108cac667e4 100644
--- a/dbaccess/source/ext/macromigration/makefile.mk
+++ b/dbaccess/source/ext/macromigration/makefile.mk
@@ -78,6 +78,7 @@ SHL1STDLIBS= \
$(SVTOOLLIB) \
$(SVLLIB) \
$(VCLLIB) \
+ $(SVXCORELIB) \
$(SVXLIB) \
$(UCBHELPERLIB) \
$(XMLSCRIPTLIB)
diff --git a/dbaccess/source/filter/xml/makefile.mk b/dbaccess/source/filter/xml/makefile.mk
index 8a7554ed4af3..41388880a30f 100644
--- a/dbaccess/source/filter/xml/makefile.mk
+++ b/dbaccess/source/filter/xml/makefile.mk
@@ -88,6 +88,8 @@ SHL1STDLIBS=\
$(CPPULIB) \
$(SFXLIB) \
$(SVLLIB) \
+ $(DBTOOLSLIB) \
+ $(UNOTOOLSLIB) \
$(SO2LIB) \
$(SALLIB)
diff --git a/dbaccess/source/filter/xml/xmlExport.cxx b/dbaccess/source/filter/xml/xmlExport.cxx
index efd744df1428..b42d65ba1cb0 100644
--- a/dbaccess/source/filter/xml/xmlExport.cxx
+++ b/dbaccess/source/filter/xml/xmlExport.cxx
@@ -106,6 +106,7 @@
#include <svtools/filenotation.hxx>
#include <svtools/pathoptions.hxx>
#include <tools/diagnose_ex.h>
+#include <connectivity/DriversConfig.hxx>
#include <boost/optional.hpp>
@@ -251,6 +252,7 @@ namespace dbaxml
// -----------------------------------------------------------------------------
ODBExport::ODBExport(const Reference< XMultiServiceFactory >& _rxMSF,sal_uInt16 nExportFlag)
: SvXMLExport( _rxMSF,MAP_10TH_MM,XML_DATABASE, EXPORT_OASIS | nExportFlag)
+,m_aTypeCollection(_rxMSF)
,m_bAllreadyFilled(sal_False)
{
GetMM100UnitConverter().setCoreMeasureUnit(MAP_10TH_MM);
@@ -339,6 +341,11 @@ void ODBExport::exportDataSource()
xSettingsState->getPropertyDefault( INFO_DECIMALDELIMITER ) >>= aDelimiter.sDecimal;
xSettingsState->getPropertyDefault( INFO_THOUSANDSDELIMITER ) >>= aDelimiter.sThousand;
+ ::connectivity::DriversConfig aDriverConfig(getServiceFactory());
+ const ::rtl::OUString sURL = ::comphelper::getString(xProp->getPropertyValue(PROPERTY_URL));
+ ::comphelper::NamedValueCollection aMetaData = aDriverConfig.getMetaData(sURL);
+ aMetaData.merge( aDriverConfig.getProperties(sURL),true ) ;
+
static ::rtl::OUString s_sTrue(::xmloff::token::GetXMLToken( XML_TRUE ));
static ::rtl::OUString s_sFalse(::xmloff::token::GetXMLToken( XML_FALSE ));
// loop through the properties, and export only those which are not defaulted
@@ -507,8 +514,11 @@ void ODBExport::exportDataSource()
}
else
{
- m_aDataSourceSettings.push_back( TypedPropertyValue(
- pProperties->Name, pProperties->Type, aValue ) );
+ if ( !aMetaData.has(pProperties->Name) || aMetaData.get(pProperties->Name) != aValue )
+ {
+ m_aDataSourceSettings.push_back( TypedPropertyValue(
+ pProperties->Name, pProperties->Type, aValue ) );
+ }
continue;
}
}
@@ -609,8 +619,7 @@ void ODBExport::exportConnectionData()
::rtl::OUString sValue;
Reference<XPropertySet> xProp(getDataSource());
xProp->getPropertyValue(PROPERTY_URL) >>= sValue;
- const ::dbaccess::DATASOURCE_TYPE eType = m_aTypeCollection.getType(sValue);
- if ( m_aTypeCollection.isFileSystemBased(eType) )
+ if ( m_aTypeCollection.isFileSystemBased(sValue) )
{
SvXMLElementExport aDatabaseDescription(*this,XML_NAMESPACE_DB, XML_DATABASE_DESCRIPTION, sal_True, sal_True);
{
@@ -620,11 +629,16 @@ void ODBExport::exportConnectionData()
if ( sOrigUrl == sFileName )
{
::svt::OFileNotation aTransformer( sFileName );
- AddAttribute(XML_NAMESPACE_XLINK,XML_HREF,GetRelativeReference(aTransformer.get( ::svt::OFileNotation::N_URL )));
+ ::rtl::OUStringBuffer sURL( aTransformer.get( ::svt::OFileNotation::N_URL ) );
+ if ( sURL.charAt(sURL.getLength()-1) != '/' )
+ sURL.append(sal_Unicode('/'));
+
+ AddAttribute(XML_NAMESPACE_XLINK,XML_HREF,GetRelativeReference(sURL.makeStringAndClear()));
} // if ( sOrigUrl == sFileName )
else
AddAttribute(XML_NAMESPACE_XLINK,XML_HREF,sOrigUrl);
- AddAttribute(XML_NAMESPACE_DB,XML_MEDIA_TYPE,m_aTypeCollection.getMediaType(eType));
+ AddAttribute(XML_NAMESPACE_DB,XML_MEDIA_TYPE,m_aTypeCollection.getMediaType(sValue));
+ const ::dbaccess::DATASOURCE_TYPE eType = m_aTypeCollection.determineType(sValue);
try
{
::rtl::OUString sExtension;
@@ -655,7 +669,7 @@ void ODBExport::exportConnectionData()
{
SvXMLElementExport aDatabaseDescription(*this,XML_NAMESPACE_DB, XML_DATABASE_DESCRIPTION, sal_True, sal_True);
{
- String sType = m_aTypeCollection.getDatasourcePrefix(eType);
+ String sType = m_aTypeCollection.getPrefix(sValue);
sType.EraseTrailingChars(':');
AddAttribute(XML_NAMESPACE_DB,XML_TYPE,sType);
AddAttribute(XML_NAMESPACE_DB,XML_HOSTNAME,sHostName);
diff --git a/dbaccess/source/filter/xml/xmlFileBasedDatabase.cxx b/dbaccess/source/filter/xml/xmlFileBasedDatabase.cxx
index b3a7d22fedf0..4cc82ad5e772 100644
--- a/dbaccess/source/filter/xml/xmlFileBasedDatabase.cxx
+++ b/dbaccess/source/filter/xml/xmlFileBasedDatabase.cxx
@@ -126,7 +126,8 @@ OXMLFileBasedDatabase::OXMLFileBasedDatabase( ODBFilter& rImport,
}
if ( sLocation.getLength() && sMediaType.getLength() )
{
- ::rtl::OUString sURL(dbaccess::ODsnTypeCollection::getDatasourcePrefixFromMediaType(sMediaType,sFileTypeExtension));
+ ::dbaccess::ODsnTypeCollection aTypeCollection(rImport.getORB());
+ ::rtl::OUString sURL(aTypeCollection.getDatasourcePrefixFromMediaType(sMediaType,sFileTypeExtension));
sURL += sLocation;
try
{
diff --git a/dbaccess/source/filter/xml/xmlfilter.cxx b/dbaccess/source/filter/xml/xmlfilter.cxx
index 5e9374dcce77..a02b26b9d209 100644
--- a/dbaccess/source/filter/xml/xmlfilter.cxx
+++ b/dbaccess/source/filter/xml/xmlfilter.cxx
@@ -115,20 +115,28 @@
#ifndef _COM_SUN_STAR_UTIL_XMODIFIABLE_HPP_
#include <com/sun/star/util/XModifiable.hpp>
#endif
+#include <com/sun/star/frame/XComponentLoader.hpp>
+#include <com/sun/star/frame/FrameSearchFlag.hpp>
#ifndef _SV_SVAPP_HXX //autogen
#include <vcl/svapp.hxx>
#endif
#ifndef _VOS_MUTEX_HXX_
#include <vos/mutex.hxx>
#endif
-#ifndef _SFXECODE_HXX
#include <svtools/sfxecode.hxx>
-#endif
+#include <svtools/moduleoptions.hxx>
#ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_
#include <toolkit/helper/vclunohelper.hxx>
#endif
#include <tools/diagnose_ex.h>
#include <comphelper/namedvaluecollection.hxx>
+#include <comphelper/mimeconfighelper.hxx>
+#include <comphelper/documentconstants.hxx>
+#include <comphelper/uno3.hxx>
+#include <osl/thread.hxx>
+#include <connectivity/CommonTools.hxx>
+#include <connectivity/DriversConfig.hxx>
+#include "dsntypes.hxx"
using namespace ::com::sun::star;
@@ -139,6 +147,138 @@ extern "C" void SAL_CALL createRegistryInfo_ODBFilter( )
//--------------------------------------------------------------------------
namespace dbaxml
{
+ namespace
+ {
+ class FastLoader : public ::osl::Thread
+ {
+ public:
+ typedef enum { E_JAVA, E_CALC } StartType;
+ FastLoader(uno::Reference< lang::XMultiServiceFactory > const & _xFactory,StartType _eType)
+ :m_xFactory(_xFactory)
+ ,m_eWhat(_eType)
+ {}
+
+ protected:
+ virtual ~FastLoader(){}
+
+ /// Working method which should be overridden.
+ virtual void SAL_CALL run();
+ virtual void SAL_CALL onTerminated();
+ private:
+ uno::Reference< lang::XMultiServiceFactory > m_xFactory;
+ StartType m_eWhat;
+ };
+
+ void SAL_CALL FastLoader::run()
+ {
+ if ( m_eWhat == E_JAVA )
+ {
+ static bool s_bFirstTime = true;
+ if ( s_bFirstTime )
+ {
+ s_bFirstTime = false;
+ try
+ {
+ ::rtl::Reference< jvmaccess::VirtualMachine > xJVM = ::connectivity::getJavaVM(m_xFactory);
+ }
+ catch(uno::Exception& ex)
+ {
+ (void)ex;
+ OSL_ASSERT(0);
+ }
+ } // if ( s_bFirstTime )
+ } // if ( m_eWhat == E_JAVA )
+ else if ( m_eWhat == E_CALC )
+ {
+ static bool s_bFirstTime = true;
+ if ( s_bFirstTime )
+ {
+ s_bFirstTime = false;
+ try
+ {
+ uno::Reference<frame::XComponentLoader> xFrameLoad( m_xFactory->createInstance(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")))
+ ,uno::UNO_QUERY);
+ const ::rtl::OUString sTarget(RTL_CONSTASCII_USTRINGPARAM("_blank"));
+ sal_Int32 nFrameSearchFlag = frame::FrameSearchFlag::TASKS | frame::FrameSearchFlag::CREATE;
+ uno::Reference< frame::XFrame> xFrame = uno::Reference< frame::XFrame>(xFrameLoad,uno::UNO_QUERY_THROW)->findFrame(sTarget,nFrameSearchFlag);
+ xFrameLoad.set( xFrame,uno::UNO_QUERY);
+
+ if ( xFrameLoad.is() )
+ {
+ uno::Sequence < beans::PropertyValue > aArgs( 3);
+ sal_Int32 nLen = 0;
+ aArgs[nLen].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AsTemplate"));
+ aArgs[nLen++].Value <<= sal_False;
+
+ aArgs[nLen].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReadOnly"));
+ aArgs[nLen++].Value <<= sal_True;
+
+ aArgs[nLen].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Hidden"));
+ aArgs[nLen++].Value <<= sal_True;
+
+ ::comphelper::MimeConfigurationHelper aHelper(m_xFactory);
+ SvtModuleOptions aModuleOptions;
+ uno::Reference< frame::XModel > xModel(xFrameLoad->loadComponentFromURL(
+ aModuleOptions.GetFactoryEmptyDocumentURL( aModuleOptions.ClassifyFactoryByServiceName( aHelper.GetDocServiceNameFromMediaType(MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET) )),
+ ::rtl::OUString(), // empty frame name
+ 0,
+ aArgs
+ ),uno::UNO_QUERY);
+ ::comphelper::disposeComponent(xModel);
+ }
+ }
+ catch(uno::Exception& ex)
+ {
+ (void)ex;
+ OSL_ASSERT(0);
+ }
+ }
+ }
+ }
+ void SAL_CALL FastLoader::onTerminated()
+ {
+ delete this;
+ }
+
+ class DatasourceURLListener : public ::cppu::WeakImplHelper1< beans::XPropertyChangeListener >
+ {
+ uno::Reference< lang::XMultiServiceFactory > m_xFactory;
+ ::dbaccess::ODsnTypeCollection m_aTypeCollection;
+ DatasourceURLListener(const DatasourceURLListener&);
+ void operator =(const DatasourceURLListener&);
+ protected:
+ virtual ~DatasourceURLListener(){}
+ public:
+ DatasourceURLListener(uno::Reference< lang::XMultiServiceFactory > const & _xFactory) : m_xFactory(_xFactory),m_aTypeCollection(_xFactory){}
+ // XPropertyChangeListener
+ virtual void SAL_CALL propertyChange( const beans::PropertyChangeEvent& _rEvent ) throw (uno::RuntimeException)
+ {
+ ::rtl::OUString sURL;
+ _rEvent.NewValue >>= sURL;
+ FastLoader* pCreatorThread = NULL;
+
+ if ( m_aTypeCollection.needsJVM(sURL) )
+ {
+ pCreatorThread = new FastLoader(m_xFactory,FastLoader::E_JAVA);
+ } // if ( m_aTypeCollection.needsJVM(sURL) )
+ else if ( sURL.matchIgnoreAsciiCaseAsciiL("sdbc:calc:",10,0) )
+ {
+ pCreatorThread = new FastLoader(m_xFactory,FastLoader::E_CALC);
+ }
+ if ( pCreatorThread )
+ {
+ pCreatorThread->createSuspended();
+ pCreatorThread->setPriority(osl_Thread_PriorityBelowNormal);
+ pCreatorThread->resume();
+ }
+ }
+ // XEventListener
+ virtual void SAL_CALL disposing( const lang::EventObject& /*_rSource*/ ) throw (uno::RuntimeException)
+ {
+ }
+ };
+ }
sal_Char __READONLY_DATA sXML_np__db[] = "_db";
sal_Char __READONLY_DATA sXML_np___db[] = "__db";
@@ -391,11 +531,11 @@ sal_Bool ODBFilter::implImport( const Sequence< PropertyValue >& rDescriptor )
{
uno::Reference<sdb::XOfficeDatabaseDocument> xOfficeDoc(GetModel(),UNO_QUERY_THROW);
m_xDataSource.set(xOfficeDoc->getDataSource(),UNO_QUERY_THROW);
- OSL_ENSURE(m_xDataSource.is(),"DataSource is NULL!");
+ uno::Reference<beans::XPropertyChangeListener> xListener = new DatasourceURLListener(getServiceFactory());
+ m_xDataSource->addPropertyChangeListener(PROPERTY_URL,xListener);
uno::Reference< XNumberFormatsSupplier > xNum(m_xDataSource->getPropertyValue(PROPERTY_NUMBERFORMATSSUPPLIER),UNO_QUERY);
SetNumberFormatsSupplier(xNum);
-
uno::Reference<XComponent> xModel(GetModel(),UNO_QUERY);
sal_Int32 nRet = ReadThroughComponent( xStorage
,xModel
@@ -820,16 +960,30 @@ UniReference < XMLPropertySetMapper > ODBFilter::GetCellStylesPropertySetMapper(
void ODBFilter::setPropertyInfo()
{
Reference<XPropertySet> xDataSource(getDataSource());
- if ( !m_aInfoSequence.empty() && xDataSource.is() )
+ if ( xDataSource.is() )
{
- try
+ ::connectivity::DriversConfig aDriverConfig(getServiceFactory());
+ const ::rtl::OUString sURL = ::comphelper::getString(xDataSource->getPropertyValue(PROPERTY_URL));
+ ::comphelper::NamedValueCollection aMetaData = aDriverConfig.getMetaData(sURL);
+ aMetaData.merge( aDriverConfig.getProperties(sURL),true ) ;
+ Sequence<PropertyValue> aInfo;
+ if ( !m_aInfoSequence.empty() )
{
- xDataSource->setPropertyValue(PROPERTY_INFO,makeAny(Sequence<PropertyValue>(&(*m_aInfoSequence.begin()),m_aInfoSequence.size())));
+ aInfo = Sequence<PropertyValue>(&(*m_aInfoSequence.begin()),m_aInfoSequence.size());
}
- catch(Exception)
+ aMetaData.merge(::comphelper::NamedValueCollection(aInfo),true);
+ aMetaData >>= aInfo;
+ if ( aInfo.getLength() )
{
- DBG_UNHANDLED_EXCEPTION();
- }
+ try
+ {
+ xDataSource->setPropertyValue(PROPERTY_INFO,makeAny(aInfo));
+ }
+ catch(Exception)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ } // if ( !m_aInfoSequence.empty() && xDataSource.is() )
}
}
// -----------------------------------------------------------------------------
diff --git a/dbaccess/source/inc/dbustrings.hrc b/dbaccess/source/inc/dbustrings.hrc
index 009b263d6081..e044627d32cd 100644
--- a/dbaccess/source/inc/dbustrings.hrc
+++ b/dbaccess/source/inc/dbustrings.hrc
@@ -74,6 +74,7 @@ namespace dbaui
DECLARE_CONSTASCII_USTRING(PROPERTY_DEFAULTCONTROL);
DECLARE_CONSTASCII_USTRING(PROPERTY_TABSTOP);
DECLARE_CONSTASCII_USTRING(PROPERTY_ENABLED);
+ DECLARE_CONSTASCII_USTRING(PROPERTY_MOUSE_WHEEL_BEHAVIOR);
}
#endif // DBACCESS_SHARED_DBUSTRINGS_HRC
diff --git a/dbaccess/source/inc/dsntypes.hxx b/dbaccess/source/inc/dsntypes.hxx
index d523d5a62012..575202a4fc43 100644
--- a/dbaccess/source/inc/dsntypes.hxx
+++ b/dbaccess/source/inc/dsntypes.hxx
@@ -89,6 +89,27 @@ enum DATASOURCE_TYPE
DST_UNKNOWN /// unrecognized type
};
+#define PAGE_DBSETUPWIZARD_INTRO 0
+#define PAGE_DBSETUPWIZARD_DBASE 1
+#define PAGE_DBSETUPWIZARD_TEXT 2
+#define PAGE_DBSETUPWIZARD_MSACCESS 3
+#define PAGE_DBSETUPWIZARD_LDAP 4
+#define PAGE_DBSETUPWIZARD_ADABAS 5
+#define PAGE_DBSETUPWIZARD_MYSQL_INTRO 6
+#define PAGE_DBSETUPWIZARD_MYSQL_JDBC 7
+#define PAGE_DBSETUPWIZARD_MYSQL_ODBC 8
+#define PAGE_DBSETUPWIZARD_ORACLE 9
+#define PAGE_DBSETUPWIZARD_JDBC 10
+#define PAGE_DBSETUPWIZARD_ADO 11
+#define PAGE_DBSETUPWIZARD_ODBC 12
+#define PAGE_DBSETUPWIZARD_SPREADSHEET 13
+#define PAGE_DBSETUPWIZARD_AUTHENTIFICATION 14
+#define PAGE_DBSETUPWIZARD_MOZILLA 15
+#define PAGE_DBSETUPWIZARD_FINAL 16
+#define PAGE_DBSETUPWIZARD_USERDEFINED 17
+#define PAGE_DBSETUPWIZARD_MYSQL_NATIVE 18
+
+
//=========================================================================
//= ODsnTypeCollection
//=========================================================================
@@ -96,13 +117,10 @@ class OOO_DLLPUBLIC_DBA ODsnTypeCollection
{
protected:
DECLARE_STL_VECTOR(String, StringVector);
- DECLARE_STL_VECTOR(DATASOURCE_TYPE, TypeVector);
- typedef ::std::map<DATASOURCE_TYPE,DATASOURCE_TYPE> TRelatedTypes;
StringVector m_aDsnTypesDisplayNames; /// user readable names for the datasource types
StringVector m_aDsnPrefixes; /// DSN prefixes which determine the type of a datasource
- TypeVector m_aDsnTypes; /// types of datasources we know
- StringVector m_aUserExtensions; /// extensions of user defined types
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory;
#ifdef DBG_UTIL
sal_Int32 m_nLivingIterators; /// just for debugging reasons, counts the living iterators
@@ -112,68 +130,70 @@ public:
class TypeIterator;
friend class ODsnTypeCollection::TypeIterator;
- ODsnTypeCollection();
+ ODsnTypeCollection(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xFactory);
~ODsnTypeCollection();
- /// get the datasource type from a DSN string
- DATASOURCE_TYPE getType(const String& _rDsn) const;
-
/// get the datasource type display name from a DSN string
- String getTypeDisplayName(DATASOURCE_TYPE _eType) const;
-
- /// the the DSN prefix associated with a given type
- String getDatasourcePrefix(DATASOURCE_TYPE _eType) const;
+ String getTypeDisplayName(const ::rtl::OUString& _sURL) const;
/// returns the extension of the user defined type
- String getTypeExtension(DATASOURCE_TYPE _eType) const;
+ String getTypeExtension(const ::rtl::OUString& _sURL) const;
/// on a given string, cut the type prefix and return the result
- String cutPrefix(const String& _rDsn) const;
+ String cutPrefix(const ::rtl::OUString& _sURL) const;
+
+ /// on a given string, return the type prefix
+ String getPrefix(const ::rtl::OUString& _sURL) const;
+
+ /// on a given string, return the Java Driver Class
+ String getJavaDriverClass(const ::rtl::OUString& _sURL) const;
/// returns the media type of a file based database
- String getMediaType(DATASOURCE_TYPE _eType) const;
+ String getMediaType(const ::rtl::OUString& _sURL) const;
/// returns the dsn prefix for a given media type
- static String getDatasourcePrefixFromMediaType(const String& _sMediaType,const String& _sExtension = String() );
+ String getDatasourcePrefixFromMediaType(const ::rtl::OUString& _sMediaType,const ::rtl::OUString& _sExtension = ::rtl::OUString() );
- void extractHostNamePort(const String& _rDsn,String& _sDatabaseName,String& _rHostname,sal_Int32& _nPortNumber) const;
+ void extractHostNamePort(const ::rtl::OUString& _rDsn,String& _sDatabaseName,String& _rHostname,sal_Int32& _nPortNumber) const;
/// check if the given data source allows creation of tables
- sal_Bool supportsTableCreation(DATASOURCE_TYPE _eType);
+ sal_Bool supportsTableCreation(const ::rtl::OUString& _sURL) const;
// check if a Browse button may be shown to insert connection url
- sal_Bool supportsBrowsing(DATASOURCE_TYPE _eType);
+ sal_Bool supportsBrowsing(const ::rtl::OUString& _sURL) const;
/// check if the given data source tyoe is based on the file system - i.e. the URL is a prefix plus a file URL
- sal_Bool isFileSystemBased(DATASOURCE_TYPE _eType) const;
+ sal_Bool isFileSystemBased(const ::rtl::OUString& _sURL) const;
+
+ bool isConnectionUrlRequired(const ::rtl::OUString& _sURL) const;
/// checks if the given data source type embeds its data into the database document
- bool isEmbeddedDatabase( DATASOURCE_TYPE _eType ) const;
+ bool isEmbeddedDatabase( const ::rtl::OUString& _sURL ) const;
- /** returns default settings for newly created databases of the given type.
+ ::rtl::OUString getEmbeddedDatabase() const;
+
+ // returns true when the properties dialog can be shown, otherwise false.
+ bool isShowPropertiesEnabled( const ::rtl::OUString& _sURL ) const;
- Currently implemented (and used) for DST_EMBEDDED_HSQLDB only
+ /** returns default settings for newly created databases of the given type.
*/
::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>
- getDefaultDBSettings( DATASOURCE_TYPE _eType ) const;
+ getDefaultDBSettings( const ::rtl::OUString& _sURL ) const;
/// get access to the first element of the types collection
TypeIterator begin() const;
/// get access to the (last + 1st) element of the types collection
TypeIterator end() const;
- /** read all user defined driver types.
- @param _rxORB
- The service factory
- */
- void initUserDriverTypes(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB);
+ void fillPageIds(const ::rtl::OUString& _sURL,::std::vector<sal_Int16>& _rOutPathIds) const;
-protected:
- /// return the connection type a DSN string represents
- DATASOURCE_TYPE implDetermineType(const String& _rDsn) const;
+ DATASOURCE_TYPE determineType(const String& _rDsn) const;
+
+ bool needsJVM(const String& _rDsn) const;
- /// return the index within the internal structures for the connection type given
- sal_Int32 implDetermineTypeIndex(DATASOURCE_TYPE _eType) const;
+ sal_Int32 getIndexOf(const ::rtl::OUString& _sURL) const;
+ sal_Int32 size() const;
+ ::rtl::OUString getType(const ::rtl::OUString& _sURL) const;
};
//-------------------------------------------------------------------------
@@ -194,7 +214,7 @@ public:
TypeIterator(const TypeIterator& _rSource);
~TypeIterator();
- DATASOURCE_TYPE getType() const;
+ ::rtl::OUString getURLPrefix() const;
String getDisplayName() const;
/// prefix increment
diff --git a/dbaccess/source/sdbtools/resource/sdbt_strings.src b/dbaccess/source/sdbtools/resource/sdbt_strings.src
index 599841c0806f..6ba41289b8ca 100644
--- a/dbaccess/source/sdbtools/resource/sdbt_strings.src
+++ b/dbaccess/source/sdbtools/resource/sdbt_strings.src
@@ -64,5 +64,5 @@ String STR_INVALID_COMPOSITION_TYPE
String STR_INVALID_COMMAND_TYPE
{
- Text [ en-US ] = "Invalid command type - only TABLE and AND QUERY from com.sun.star.sdb.CommandType are allowed.";
+ Text [ en-US ] = "Invalid command type - only TABLE and QUERY from com.sun.star.sdb.CommandType are allowed.";
};
diff --git a/dbaccess/source/shared/dbustrings.cxx b/dbaccess/source/shared/dbustrings.cxx
index 875342b73b07..7acbe561ffff 100644
--- a/dbaccess/source/shared/dbustrings.cxx
+++ b/dbaccess/source/shared/dbustrings.cxx
@@ -72,4 +72,5 @@ namespace dbaui
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_TABSTOP, "TabStop");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_DEFAULTCONTROL, "DefaultControl");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_ENABLED, "Enabled");
+ IMPLEMENT_CONSTASCII_USTRING(PROPERTY_MOUSE_WHEEL_BEHAVIOR, "MouseWheelBehavior");
}
diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx
index fb6c7e254e7c..b87b7706d87f 100644
--- a/dbaccess/source/ui/app/AppController.cxx
+++ b/dbaccess/source/ui/app/AppController.cxx
@@ -155,7 +155,7 @@
#ifndef _DBAUI_LISTVIEWITEMS_HXX_
#include "listviewitems.hxx"
#endif
-#include "ExtensionNotPresent.hxx"
+
#ifndef DBAUI_APPDETAILVIEW_HXX
#include "AppDetailView.hxx"
#endif
@@ -410,6 +410,7 @@ OApplicationController::OApplicationController(const Reference< XMultiServiceFac
:OApplicationController_CBASE( _rxORB )
,m_aContextMenuInterceptors( getMutex() )
,m_pSubComponentManager( new SubComponentManager( *this, getSharedMutex() ) )
+ ,m_aTypeCollection(_rxORB)
,m_aTableCopyHelper(this)
,m_pClipbordNotifier(NULL)
,m_nAsyncDrop(0)
@@ -422,8 +423,6 @@ OApplicationController::OApplicationController(const Reference< XMultiServiceFac
,m_pSelectionNotifier( new SelectionNotifier( getMutex(), *this ) )
{
DBG_CTOR(OApplicationController,NULL);
-
- m_aTypeCollection.initUserDriverTypes(_rxORB);
}
//------------------------------------------------------------------------------
OApplicationController::~OApplicationController()
@@ -940,11 +939,8 @@ FeatureState OApplicationController::GetState(sal_uInt16 _nId) const
aReturn.bEnabled = getContainer()->getSelectionCount() > 0 && getContainer()->isALeafSelected();
break;
case SID_DB_APP_DSUSERADMIN:
- {
- ::dbaccess::DATASOURCE_TYPE eType = m_aTypeCollection.getType(::comphelper::getString(m_xDataSource->getPropertyValue(PROPERTY_URL)));
- aReturn.bEnabled = ( ::dbaccess::DST_EMBEDDED_HSQLDB != eType );
- }
- break;
+ aReturn.bEnabled = !m_aTypeCollection.isEmbeddedDatabase(::comphelper::getString(m_xDataSource->getPropertyValue(PROPERTY_URL)));
+ break;
case SID_DB_APP_DSRELDESIGN:
aReturn.bEnabled = sal_True;
break;
@@ -955,36 +951,13 @@ FeatureState OApplicationController::GetState(sal_uInt16 _nId) const
aReturn.bEnabled = getContainer()->getElementType() == E_TABLE && isConnected();
break;
case SID_DB_APP_DSPROPS:
- aReturn.bEnabled = m_xDataSource.is();
- if ( aReturn.bEnabled )
- {
- ::dbaccess::DATASOURCE_TYPE eType = m_aTypeCollection.getType(::comphelper::getString(m_xDataSource->getPropertyValue(PROPERTY_URL)));
- aReturn.bEnabled = ::dbaccess::DST_EMBEDDED_HSQLDB != eType
- && ::dbaccess::DST_MOZILLA != eType
- && ::dbaccess::DST_EVOLUTION != eType
- && ::dbaccess::DST_EVOLUTION_GROUPWISE != eType
- && ::dbaccess::DST_EVOLUTION_LDAP != eType
- && ::dbaccess::DST_KAB != eType
- && ::dbaccess::DST_MACAB != eType
- && ::dbaccess::DST_OUTLOOK != eType
- && ::dbaccess::DST_OUTLOOKEXP != eType;
- }
+ aReturn.bEnabled = m_xDataSource.is() && m_aTypeCollection.isShowPropertiesEnabled(::comphelper::getString(m_xDataSource->getPropertyValue(PROPERTY_URL)));
break;
case SID_DB_APP_DSCONNECTION_TYPE:
- aReturn.bEnabled = !isDataSourceReadOnly() && m_xDataSource.is();
- if ( aReturn.bEnabled )
- {
- ::dbaccess::DATASOURCE_TYPE eType = m_aTypeCollection.getType(::comphelper::getString(m_xDataSource->getPropertyValue(PROPERTY_URL)));
- aReturn.bEnabled = ::dbaccess::DST_EMBEDDED_HSQLDB != eType;
- }
+ aReturn.bEnabled = !isDataSourceReadOnly() && m_xDataSource.is() && !m_aTypeCollection.isEmbeddedDatabase(::comphelper::getString(m_xDataSource->getPropertyValue(PROPERTY_URL)));
break;
case SID_DB_APP_DSADVANCED_SETTINGS:
- aReturn.bEnabled = m_xDataSource.is();
- if ( aReturn.bEnabled )
- {
- ::dbaccess::DATASOURCE_TYPE eType = m_aTypeCollection.getType( ::comphelper::getString( m_xDataSource->getPropertyValue( PROPERTY_URL ) ) );
- aReturn.bEnabled = AdvancedSettingsDialog::doesHaveAnyAdvancedSettings( eType );
- }
+ aReturn.bEnabled = m_xDataSource.is() && AdvancedSettingsDialog::doesHaveAnyAdvancedSettings( m_aTypeCollection.getType(::comphelper::getString( m_xDataSource->getPropertyValue( PROPERTY_URL ) )) );
break;
case SID_DB_APP_CONVERTTOVIEW:
aReturn.bEnabled = !isDataSourceReadOnly();
@@ -1034,15 +1007,16 @@ FeatureState OApplicationController::GetState(sal_uInt16 _nId) const
aReturn.bEnabled = m_xDataSource.is();
if ( aReturn.bEnabled )
{
- ::dbaccess::DATASOURCE_TYPE eType = m_aTypeCollection.getType(::comphelper::getString(m_xDataSource->getPropertyValue(PROPERTY_URL)));
+ ::rtl::OUString sURL;
+ m_xDataSource->getPropertyValue(PROPERTY_URL) >>= sURL;
::rtl::OUString sDSTypeName;
- if ( m_aTypeCollection.isEmbeddedDatabase( eType ) )
+ if ( m_aTypeCollection.isEmbeddedDatabase( sURL ) )
{
sDSTypeName = String( ModuleRes( RID_STR_EMBEDDED_DATABASE ) );
}
else
{
- sDSTypeName = m_aTypeCollection.getTypeDisplayName(eType);
+ sDSTypeName = m_aTypeCollection.getTypeDisplayName(sURL);
}
aReturn.sTitle = sDSTypeName;
}
@@ -1053,8 +1027,6 @@ FeatureState OApplicationController::GetState(sal_uInt16 _nId) const
{
::rtl::OUString sURL;
m_xDataSource->getPropertyValue(PROPERTY_URL) >>= sURL;
- ::dbaccess::DATASOURCE_TYPE eType = m_aTypeCollection.getType( sURL );
-
String sDatabaseName;
String sHostName;
sal_Int32 nPortNumber( -1 );
@@ -1063,7 +1035,7 @@ FeatureState OApplicationController::GetState(sal_uInt16 _nId) const
if ( !sDatabaseName.Len() )
sDatabaseName = m_aTypeCollection.cutPrefix( sURL );
- if ( m_aTypeCollection.isFileSystemBased(eType) )
+ if ( m_aTypeCollection.isFileSystemBased(sURL) )
{
sDatabaseName = SvtPathOptions().SubstituteVariable( sDatabaseName );
if ( sDatabaseName.Len() )
@@ -1075,7 +1047,7 @@ FeatureState OApplicationController::GetState(sal_uInt16 _nId) const
}
if ( sDatabaseName.Len() == 0 )
- sDatabaseName = m_aTypeCollection.getTypeDisplayName( eType );
+ sDatabaseName = m_aTypeCollection.getTypeDisplayName( sURL );
aReturn.sTitle = sDatabaseName;
}
diff --git a/dbaccess/source/ui/app/AppControllerDnD.cxx b/dbaccess/source/ui/app/AppControllerDnD.cxx
index c532c0d45fe7..a509986e8849 100644
--- a/dbaccess/source/ui/app/AppControllerDnD.cxx
+++ b/dbaccess/source/ui/app/AppControllerDnD.cxx
@@ -719,19 +719,24 @@ sal_Bool OApplicationController::paste( ElementType _eType,const ::svx::ODataAcc
}
// the target object name (as we'll suggest it to the user)
- String sTargetName;
- Reference< XNameAccess > xQueries;
+ ::rtl::OUString sTargetName;
try
{
- // the query container
- xQueries.set(getQueryDefintions(),UNO_QUERY);
- String aQueryDefaultName = String(ModuleRes(STR_QRY_TITLE));
- aQueryDefaultName = aQueryDefaultName.GetToken(0,' ');
- sTargetName = ::dbtools::createUniqueName(xQueries,aQueryDefaultName);
+ if ( CommandType::QUERY == nCommandType )
+ sTargetName = sCommand;
+
+ if ( !sTargetName.getLength() )
+ {
+ String sDefaultName = String( ModuleRes( STR_QRY_TITLE ) );
+ sDefaultName = sDefaultName.GetToken( 0, ' ' );
+
+ Reference< XNameAccess > xQueries( getQueryDefintions(), UNO_QUERY_THROW );
+ sTargetName = ::dbtools::createUniqueName( xQueries, sDefaultName, sal_False );
+ }
}
- catch(Exception)
+ catch(const Exception&)
{
- OSL_ENSURE(0,"could not create query default name!");
+ DBG_UNHANDLED_EXCEPTION();
}
Reference< XPropertySet > xQuery;
@@ -742,16 +747,14 @@ sal_Bool OApplicationController::paste( ElementType _eType,const ::svx::ODataAcc
try
{
// the concrete query
- Reference< XDataSource > xDataSource( getDataSourceByName( sDataSourceName, getView(), getORB(), NULL ) );
- Reference< XQueryDefinitionsSupplier > xSourceQuerySup( xDataSource, UNO_QUERY );
- if ( xSourceQuerySup.is() )
- xQueries.set(xSourceQuerySup->getQueryDefinitions(),UNO_QUERY);
-
- if ( xQueries.is() && xQueries->hasByName(sCommand) )
+ Reference< XQueryDefinitionsSupplier > xSourceQuerySup(
+ getDataSourceByName( sDataSourceName, getView(), getORB(), NULL ),
+ UNO_QUERY_THROW );
+ Reference< XNameAccess > xQueries( xSourceQuerySup->getQueryDefinitions(), UNO_SET_THROW );
+ if ( xQueries->hasByName( sCommand ) )
{
- xQuery.set(xQueries->getByName(sCommand),UNO_QUERY);
- bSuccess = xQuery.is();
- xQueries.clear();
+ xQuery.set( xQueries->getByName(sCommand), UNO_QUERY_THROW );
+ bSuccess = true;
}
}
catch(SQLException&) { throw; } // caught and handled by the outer catch
@@ -780,19 +783,28 @@ sal_Bool OApplicationController::paste( ElementType _eType,const ::svx::ODataAcc
// here we have everything needed to create a new query object ...
// ... ehm, except a new name
ensureConnection();
- DynamicTableOrQueryNameCheck aNameChecker( getConnection(), CommandType::QUERY );
- OSaveAsDlg aAskForName( getView(),
- CommandType::QUERY,
- getORB(),
- getConnection(),
- sTargetName,
- aNameChecker,
- SAD_ADDITIONAL_DESCRIPTION | SAD_TITLE_PASTE_AS);
- if ( RET_OK != aAskForName.Execute() )
- // cancelled by the user
- return sal_False;
- sTargetName = aAskForName.getName();
+ DynamicTableOrQueryNameCheck aNameChecker( getConnection(), CommandType::QUERY );
+ ::dbtools::SQLExceptionInfo aDummy;
+ bool bNeedAskForName = ( sCommand.getLength() == 0 )
+ /* we did not have a source name, so the target name was auto-generated */
+ || ( !aNameChecker.isNameValid( sTargetName, aDummy ) );
+ /* name is invalid in the target DB (e.g. because it already
+ has a /table/ with that name) */
+ if ( bNeedAskForName )
+ {
+ OSaveAsDlg aAskForName( getView(),
+ CommandType::QUERY,
+ getORB(),
+ getConnection(),
+ sTargetName,
+ aNameChecker,
+ SAD_ADDITIONAL_DESCRIPTION | SAD_TITLE_PASTE_AS);
+ if ( RET_OK != aAskForName.Execute() )
+ // cancelled by the user
+ return sal_False;
+ sTargetName = aAskForName.getName();
+ }
// create a new object
Reference< XPropertySet > xNewQuery(xQueryFactory->createInstance(), UNO_QUERY);
diff --git a/dbaccess/source/ui/browser/brwctrlr.cxx b/dbaccess/source/ui/browser/brwctrlr.cxx
index 706064da08f1..ddfb583f65c9 100644
--- a/dbaccess/source/ui/browser/brwctrlr.cxx
+++ b/dbaccess/source/ui/browser/brwctrlr.cxx
@@ -489,6 +489,7 @@ SbaXDataBrowserController::SbaXDataBrowserController(const Reference< ::com::sun
:SbaXDataBrowserController_Base(_rM)
,m_pClipbordNotifier( NULL )
,m_aAsyncGetCellFocus(LINK(this, SbaXDataBrowserController, OnAsyncGetCellFocus))
+ ,m_aAsyncDisplayError( LINK( this, SbaXDataBrowserController, OnAsyncDisplayError ) )
,m_sStateSaveRecord(ModuleRes(RID_STR_SAVE_CURRENT_RECORD))
,m_sStateUndoRecord(ModuleRes(RID_STR_UNDO_MODIFY_RECORD))
,m_sModuleIdentifier( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.DataSourceBrowser" ) ) )
@@ -498,7 +499,6 @@ SbaXDataBrowserController::SbaXDataBrowserController(const Reference< ::com::sun
,m_nFormActionNestingLevel(0)
,m_bLoadCanceled( sal_False )
,m_bClosingKillOpen( sal_False )
- ,m_bErrorOccured( sal_False )
,m_bCannotSelectUnfiltered( true )
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::SbaXDataBrowserController" );
@@ -608,7 +608,7 @@ sal_Bool SbaXDataBrowserController::reloadForm( const Reference< XLoadable >& _r
}
}
- return _rxLoadable->isLoaded() && !errorOccured();
+ return _rxLoadable->isLoaded();
}
// -----------------------------------------------------------------------------
@@ -1068,13 +1068,11 @@ void SbaXDataBrowserController::propertyChange(const PropertyChangeEvent& evt) t
// the filter or the sort criterias have changed ? -> update our parser
if (evt.PropertyName.equals(PROPERTY_ACTIVECOMMAND))
{
- initializeParser();
if (m_xParser.is())
DO_SAFE( m_xParser->setElementaryQuery(::comphelper::getString(evt.NewValue)), "SbaXDataBrowserController::propertyChange : could not forward the new query to my parser !" );
}
else if (evt.PropertyName.equals(PROPERTY_FILTER))
{
- initializeParser();
if ( m_xParser.is() && m_xParser->getFilter() != ::comphelper::getString(evt.NewValue))
{
DO_SAFE( m_xParser->setFilter(::comphelper::getString(evt.NewValue)), "SbaXDataBrowserController::propertyChange : could not forward the new filter to my parser !" );
@@ -1083,7 +1081,6 @@ void SbaXDataBrowserController::propertyChange(const PropertyChangeEvent& evt) t
}
else if (evt.PropertyName.equals(PROPERTY_HAVING_CLAUSE))
{
- initializeParser();
if ( m_xParser.is() && m_xParser->getHavingClause() != ::comphelper::getString(evt.NewValue))
{
DO_SAFE( m_xParser->setHavingClause(::comphelper::getString(evt.NewValue)), "SbaXDataBrowserController::propertyChange : could not forward the new filter to my parser !" );
@@ -1092,7 +1089,6 @@ void SbaXDataBrowserController::propertyChange(const PropertyChangeEvent& evt) t
}
else if (evt.PropertyName.equals(PROPERTY_ORDER))
{
- initializeParser();
if ( m_xParser.is() && m_xParser->getOrder() != ::comphelper::getString(evt.NewValue))
{
DO_SAFE( m_xParser->setOrder(::comphelper::getString(evt.NewValue)), "SbaXDataBrowserController::propertyChange : could not forward the new order to my parser !" );
@@ -1201,6 +1197,7 @@ sal_Bool SbaXDataBrowserController::suspend(sal_Bool /*bSuspend*/) throw( Runtim
DBG_ASSERT(m_nPendingLoadFinished == 0, "SbaXDataBrowserController::suspend : there shouldn't be a pending load !");
m_aAsyncGetCellFocus.CancelCall();
+ m_aAsyncDisplayError.CancelCall();
m_aAsyncInvalidateAll.CancelCall();
sal_Bool bSuccess = SaveModified();
@@ -1345,17 +1342,33 @@ void SbaXDataBrowserController::frameAction(const ::com::sun::star::frame::Frame
}
//------------------------------------------------------------------------------
+IMPL_LINK( SbaXDataBrowserController, OnAsyncDisplayError, void*, /* _pNotInterestedIn */ )
+{
+ if ( m_aCurrentError.isValid() )
+ {
+ OSQLMessageBox aDlg( getBrowserView(), m_aCurrentError );
+ aDlg.Execute();
+ }
+ return 0L;
+}
+
+//------------------------------------------------------------------------------
void SbaXDataBrowserController::errorOccured(const ::com::sun::star::sdb::SQLErrorEvent& aEvent) throw( RuntimeException )
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::errorOccured" );
- SQLExceptionInfo aInfo(aEvent.Reason);
- if ( aInfo.isValid() )
+ ::osl::MutexGuard aGuard( getMutex() );
+
+ SQLExceptionInfo aInfo( aEvent.Reason );
+ if ( !aInfo.isValid() )
+ return;
+
+ if ( m_nFormActionNestingLevel )
{
- ::vos::OGuard aGuard(Application::GetSolarMutex());
- showError( aInfo );
+ OSL_ENSURE( !m_aCurrentError.isValid(), "SbaXDataBrowserController::errorOccured: can handle one error per transaction only!" );
+ m_aCurrentError = aInfo;
}
- if (m_nFormActionNestingLevel)
- m_bErrorOccured = true;
+ else
+ m_aAsyncDisplayError.Call();
}
//------------------------------------------------------------------------------
@@ -1531,8 +1544,14 @@ FeatureState SbaXDataBrowserController::GetState(sal_uInt16 nId) const
}
break;
- case ID_BROWSER_PASTE:
case ID_BROWSER_COPY:
+ if ( getBrowserView()->getVclControl()->GetSelectRowCount() )
+ {
+ aReturn.bEnabled = m_aCurrentFrame.isActive();
+ break;
+ }
+ // run through
+ case ID_BROWSER_PASTE:
case ID_BROWSER_CUT:
{
CellControllerRef xCurrentController = getBrowserView()->getVclControl()->Controller();
@@ -1776,7 +1795,6 @@ void SbaXDataBrowserController::ExecuteFilterSortCrit(sal_Bool bFilter)
Reference< XPropertySet > xFormSet(getRowSet(), UNO_QUERY);
- initializeParser();
const ::rtl::OUString sOldVal = bFilter ? m_xParser->getFilter() : m_xParser->getOrder();
const ::rtl::OUString sOldHaving = m_xParser->getHavingClause();
try
@@ -1979,6 +1997,12 @@ void SbaXDataBrowserController::Execute(sal_uInt16 nId, const Sequence< Property
break;
case ID_BROWSER_COPY:
+ if ( getBrowserView()->getVclControl()->GetSelectRowCount() > 0 )
+ {
+ getBrowserView()->getVclControl()->CopySelectedRowsToClipboard();
+ break;
+ }
+ // run through
case ID_BROWSER_CUT:
case ID_BROWSER_PASTE:
{
@@ -1993,9 +2017,9 @@ void SbaXDataBrowserController::Execute(sal_uInt16 nId, const Sequence< Property
Edit& rEdit = (Edit&)xCurrentController->GetWindow();
switch (nId)
{
- case ID_BROWSER_CUT : rEdit.Cut(); break;
- case SID_COPY : rEdit.Copy(); break;
- case ID_BROWSER_PASTE : rEdit.Paste(); break;
+ case ID_BROWSER_CUT : rEdit.Cut(); break;
+ case SID_COPY : rEdit.Copy(); break;
+ case ID_BROWSER_PASTE : rEdit.Paste(); break;
}
if (ID_BROWSER_CUT == nId || ID_BROWSER_PASTE == nId)
{
@@ -2021,7 +2045,6 @@ void SbaXDataBrowserController::Execute(sal_uInt16 nId, const Sequence< Property
if (!xField.is())
break;
- initializeParser();
const ::rtl::OUString sOldSort = m_xParser->getOrder();
sal_Bool bParserSuccess = sal_False;
HANDLE_SQL_ERRORS(
@@ -2052,7 +2075,6 @@ void SbaXDataBrowserController::Execute(sal_uInt16 nId, const Sequence< Property
sal_Bool bHaving = sal_False;
::rtl::OUString sName;
xField->getPropertyValue(PROPERTY_NAME) >>= sName;
- initializeParser();
Reference< XColumnsSupplier > xColumnsSupplier(m_xParser, UNO_QUERY);
Reference< ::com::sun::star::container::XNameAccess > xCols = xColumnsSupplier.is() ? xColumnsSupplier->getColumns() : Reference< ::com::sun::star::container::XNameAccess > ();
if ( xCols.is() && xCols->hasByName(sName) )
@@ -2562,6 +2584,9 @@ void SbaXDataBrowserController::LoadFinished(sal_Bool /*bWasSynch*/)
getBrowserView()->getGridControl()->setDesignMode(sal_False);
// -------------------------------
+ initializeParser();
+
+ // -------------------------------
InvalidateAll();
m_aAsyncGetCellFocus.Call();
@@ -2597,7 +2622,7 @@ void SbaXDataBrowserController::initializeParser() const
}
catch(Exception&)
{
- DBG_WARNING("SbaXDataBrowserController::initializeParser: something went wrong while creating the parser !");
+ DBG_UNHANDLED_EXCEPTION();
m_xParser = NULL;
// no further handling, we ignore the error
}
@@ -2659,10 +2684,9 @@ void SbaXDataBrowserController::reloaded(const EventObject& /*aEvent*/) throw( R
//------------------------------------------------------------------------------
void SbaXDataBrowserController::enterFormAction()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::enterFormAction" );
- if (!m_nFormActionNestingLevel)
- // first action -> reset flag
- m_bErrorOccured = false;
+ if ( !m_nFormActionNestingLevel )
+ // first action -> reset
+ m_aCurrentError.clear();
++m_nFormActionNestingLevel;
}
@@ -2670,9 +2694,14 @@ void SbaXDataBrowserController::enterFormAction()
//------------------------------------------------------------------------------
void SbaXDataBrowserController::leaveFormAction()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::leaveFormAction" );
- DBG_ASSERT(m_nFormActionNestingLevel > 0, "SbaXDataBrowserController::leaveFormAction : invalid call !");
- --m_nFormActionNestingLevel;
+ DBG_ASSERT( m_nFormActionNestingLevel > 0, "SbaXDataBrowserController::leaveFormAction : invalid call !" );
+ if ( --m_nFormActionNestingLevel > 0 )
+ return;
+
+ if ( !m_aCurrentError.isValid() )
+ return;
+
+ m_aAsyncDisplayError.Call();
}
// -------------------------------------------------------------------------
@@ -2699,7 +2728,6 @@ sal_Bool SbaXDataBrowserController::isValidCursor() const
bIsValid = ::cppu::any2bool(xProp->getPropertyValue(PROPERTY_ISNEW));
if ( !bIsValid )
{
- initializeParser();
bIsValid = m_xParser.is();
}
} // if ( !bIsValid )
diff --git a/dbaccess/source/ui/browser/dbexchange.cxx b/dbaccess/source/ui/browser/dbexchange.cxx
index 5a6f11ebf840..70caccc10a3e 100644
--- a/dbaccess/source/ui/browser/dbexchange.cxx
+++ b/dbaccess/source/ui/browser/dbexchange.cxx
@@ -61,6 +61,7 @@
#ifndef _SVX_DATACCESSDESCRIPTOR_HXX_
#include <svx/dataaccessdescriptor.hxx>
#endif
+#include "UITools.hxx"
namespace dbaui
@@ -141,7 +142,8 @@ namespace dbaui
// -----------------------------------------------------------------------------
ODataClipboard::ODataClipboard( const Reference< XPropertySet >& _rxLivingForm,
const Sequence< Any >& _rSelectedRows,
- const Reference< XResultSet>& _rxResultSet)
+ const Reference< XResultSet>& _rxResultSet,
+ const Reference< XMultiServiceFactory >& _rxORB)
:ODataAccessObjectTransferable( _rxLivingForm )
,m_pHtml(NULL)
,m_pRtf(NULL)
@@ -158,6 +160,20 @@ namespace dbaui
getDescriptor()[daCursor] <<= _rxResultSet;
addCompatibleSelectionDescription( _rSelectedRows );
+ if ( xConnection.is() && _rxORB.is() )
+ {
+ Reference< XNumberFormatter > xFormatter( getNumberFormatter( xConnection, _rxORB ) );
+ if ( xFormatter.is() )
+ {
+ m_pHtml = new OHTMLImportExport( getDescriptor(),_rxORB, xFormatter );
+ m_aEventListeners.push_back( m_pHtml );
+
+ m_pRtf = new ORTFImportExport( getDescriptor(),_rxORB, xFormatter );
+ m_aEventListeners.push_back( m_pRtf );
+ }
+ }
+
+
osl_decrementInterlockedCount( &m_refCount );
}
diff --git a/dbaccess/source/ui/browser/dsEntriesNoExp.cxx b/dbaccess/source/ui/browser/dsEntriesNoExp.cxx
index 4880e9197170..16859283c9b7 100644
--- a/dbaccess/source/ui/browser/dsEntriesNoExp.cxx
+++ b/dbaccess/source/ui/browser/dsEntriesNoExp.cxx
@@ -165,7 +165,9 @@ void SbaTableQueryBrowser::SelectionChanged()
InvalidateFeature(ID_BROWSER_INSERTCOLUMNS);
InvalidateFeature(ID_BROWSER_INSERTCONTENT);
InvalidateFeature(ID_BROWSER_FORMLETTER);
- }
+ } // if ( !m_bShowMenu )
+ InvalidateFeature(ID_BROWSER_COPY);
+ InvalidateFeature(ID_BROWSER_CUT);
}
//------------------------------------------------------------------------------
void SbaTableQueryBrowser::describeSupportedFeatures()
diff --git a/dbaccess/source/ui/browser/sbagrid.cxx b/dbaccess/source/ui/browser/sbagrid.cxx
index 0251b6f653b8..1ca1a737dfd2 100644
--- a/dbaccess/source/ui/browser/sbagrid.cxx
+++ b/dbaccess/source/ui/browser/sbagrid.cxx
@@ -983,9 +983,16 @@ void SbaGridControl::PreExecuteRowContextMenu(sal_uInt16 nRow, PopupMenu& rMenu)
rMenu.InsertItem(ID_BROWSER_ROWHEIGHT, aNewItems.GetItemText(ID_BROWSER_ROWHEIGHT), 0, nPos++);
rMenu.SetHelpId(ID_BROWSER_ROWHEIGHT, aNewItems.GetHelpId(ID_BROWSER_ROWHEIGHT));
+ rMenu.InsertSeparator(nPos++);
+ } // if (!IsReadOnlyDB())
+
+ if ( GetSelectRowCount() > 0 )
+ {
+ rMenu.InsertItem(ID_BROWSER_COPY, aNewItems.GetItemText(SID_COPY), 0, nPos++);
+ rMenu.SetHelpId(ID_BROWSER_COPY, aNewItems.GetHelpId(SID_COPY));
+
+ rMenu.InsertSeparator(nPos++);
}
- if (nPos)
- rMenu.InsertSeparator(nPos);
}
//------------------------------------------------------------------------------
@@ -1145,6 +1152,9 @@ void SbaGridControl::PostExecuteRowContextMenu(sal_uInt16 nRow, const PopupMenu&
case ID_BROWSER_ROWHEIGHT:
SetRowHeight();
break;
+ case ID_BROWSER_COPY:
+ CopySelectedRowsToClipboard();
+ break;
default:
FmGridControl::PostExecuteRowContextMenu(nRow, rMenu, nExecutionResult);
@@ -1418,10 +1428,23 @@ void SbaGridControl::DoColumnDrag(sal_uInt16 nColumnPos)
}
// -----------------------------------------------------------------------
-void SbaGridControl::DoRowDrag(sal_Int16 nRowPos)
+void SbaGridControl::CopySelectedRowsToClipboard()
+{
+ DBG_ASSERT( GetSelectRowCount() > 0, "SbaGridControl::CopySelectedRowsToClipboard: invalid call!" );
+ implTransferSelectedRows( (sal_Int16)FirstSelectedRow(), true );
+}
+
+// -----------------------------------------------------------------------
+void SbaGridControl::DoRowDrag( sal_Int16 nRowPos )
+{
+ implTransferSelectedRows( nRowPos, false );
+}
+
+// -----------------------------------------------------------------------
+void SbaGridControl::implTransferSelectedRows( sal_Int16 nRowPos, bool _bTrueIfClipboardFalseIfDrag )
{
Reference< XPropertySet > xDataSource(getDataSource(), UNO_QUERY);
- DBG_ASSERT(xDataSource.is(), "SbaGridControl::DoRowDrag : invalid data source !");
+ DBG_ASSERT(xDataSource.is(), "SbaGridControl::implTransferSelectedRows : invalid data source !");
// build the sequence of numbers of selected rows
Sequence< Any > aSelectedRows;
@@ -1452,10 +1475,13 @@ void SbaGridControl::DoRowDrag(sal_Int16 nRowPos)
if ( xResultSetAccess.is() )
xRowSetClone = xResultSetAccess->createResultSet();
- ODataClipboard* pTransfer = new ODataClipboard(xDataSource, aSelectedRows,xRowSetClone);
+ ODataClipboard* pTransfer = new ODataClipboard(xDataSource, aSelectedRows,xRowSetClone, getServiceManager());
Reference< XTransferable > xEnsureDelete = pTransfer;
- pTransfer->StartDrag(this, DND_ACTION_COPY | DND_ACTION_LINK);
+ if ( _bTrueIfClipboardFalseIfDrag )
+ pTransfer->CopyToClipboard( this );
+ else
+ pTransfer->StartDrag(this, DND_ACTION_COPY | DND_ACTION_LINK);
}
catch(Exception&)
{
diff --git a/dbaccess/source/ui/browser/sbagrid.src b/dbaccess/source/ui/browser/sbagrid.src
index 8bcba2ffc3b8..aa86ed799657 100644
--- a/dbaccess/source/ui/browser/sbagrid.src
+++ b/dbaccess/source/ui/browser/sbagrid.src
@@ -84,6 +84,10 @@ Menu RID_SBA_GRID_ROWCTXMENU
HelpID = HID_BROWSER_ROWHEIGHT ;
Text [ en-US ] = "Row Height..." ;
};
+ MenuItem
+ {
+ ITEM_EDIT_COPY
+ };
};
};
diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx
index 57a4a9270c25..3c26b06aa003 100644
--- a/dbaccess/source/ui/browser/unodatbr.cxx
+++ b/dbaccess/source/ui/browser/unodatbr.cxx
@@ -60,6 +60,8 @@
/** === begin UNO includes === **/
#include <com/sun/star/awt/LineEndFormat.hpp>
+#include <com/sun/star/awt/LineEndFormat.hpp>
+#include <com/sun/star/awt/MouseWheelBehavior.hpp>
#include <com/sun/star/awt/TextAlign.hpp>
#include <com/sun/star/awt/VisualEffect.hpp>
#include <com/sun/star/beans/NamedValue.hpp>
@@ -684,13 +686,23 @@ sal_Bool SbaTableQueryBrowser::InitializeGridModel(const Reference< ::com::sun::
aCopyProperties.push_back( PROPERTY_WIDTH );
// help text to display for the column
- Any aDescription; aDescription <<= ::rtl::OUString();
+ Any aDescription;
if ( xColPSI->hasPropertyByName( PROPERTY_HELPTEXT ) )
- aDescription <<= ::comphelper::getString( xColumn->getPropertyValue( PROPERTY_HELPTEXT ) );
+ aDescription = xColumn->getPropertyValue( PROPERTY_HELPTEXT );
+ if ( !aDescription.hasValue() )
+ aDescription <<= ::rtl::OUString();
aInitialValues.push_back( NamedValue( PROPERTY_HELPTEXT, aDescription ) );
// ... horizontal justify
- aInitialValues.push_back( NamedValue( PROPERTY_ALIGN, makeAny( sal_Int16( ::comphelper::getINT32( xColumn->getPropertyValue( PROPERTY_ALIGN ) ) ) ) ) );
+ Any aAlign; aAlign <<= sal_Int16( 0 );
+ Any aColAlign( xColumn->getPropertyValue( PROPERTY_ALIGN ) );
+ if ( aColAlign.hasValue() )
+ aAlign <<= sal_Int16( ::comphelper::getINT32( aColAlign ) );
+ aInitialValues.push_back( NamedValue( PROPERTY_ALIGN, aAlign ) );
+
+ // don't allow the mouse to scroll in the cells
+ if ( xGridColPSI->hasPropertyByName( PROPERTY_MOUSE_WHEEL_BEHAVIOR ) )
+ aInitialValues.push_back( NamedValue( PROPERTY_MOUSE_WHEEL_BEHAVIOR, makeAny( MouseWheelBehavior::SCROLL_DISABLED ) ) );
// now set all those values
for ( ::std::vector< NamedValue >::const_iterator property = aInitialValues.begin();
@@ -1535,25 +1547,6 @@ void SbaTableQueryBrowser::LoadFinished(sal_Bool _bWasSynch)
// if the form has been loaded, this means that our "selection" has changed
EventObject aEvent( *this );
m_aSelectionListeners.notifyEach( &XSelectionChangeListener::selectionChanged, aEvent );
-
- // update our database document
- Reference< XModel > xDocument;
- try
- {
- Reference< XPropertySet > xCursorProps( getRowSet(), UNO_QUERY_THROW );
- Reference< XConnection > xConnection( xCursorProps->getPropertyValue( PROPERTY_ACTIVE_CONNECTION ), UNO_QUERY );
- if ( xConnection.is() )
- {
- Reference< XChild > xChild( xConnection, UNO_QUERY_THROW );
- Reference< XDocumentDataSource > xDataSource( xChild->getParent(), UNO_QUERY_THROW );
- xDocument.set( xDataSource->getDatabaseDocument(), UNO_QUERY_THROW );
- }
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- m_xCurrentDatabaseDocument = xDocument;
}
//------------------------------------------------------------------------------
@@ -1746,7 +1739,13 @@ FeatureState SbaTableQueryBrowser::GetState(sal_uInt16 nId) const
if (getBrowserView() && getBrowserView()->getVclControl() && !getBrowserView()->getVclControl()->IsEditing())
{
SbaGridControl* pControl = getBrowserView()->getVclControl();
- aReturn.bEnabled = pControl->canCopyCellText(pControl->GetCurRow(), pControl->GetCurColumnId());
+ if ( pControl->GetSelectRowCount() )
+ {
+ aReturn.bEnabled = m_aCurrentFrame.isActive();
+ break;
+ } // if ( getBrowserView()->getVclControl()->GetSelectRowCount() )
+ else
+ aReturn.bEnabled = pControl->canCopyCellText(pControl->GetCurRow(), pControl->GetCurColumnId());
break;
}
// NO break here
@@ -1942,7 +1941,7 @@ void SbaTableQueryBrowser::Execute(sal_uInt16 nId, const Sequence< PropertyValue
{
copyEntry(m_pTreeView->getListBox().GetCurEntry());
}
- else if (getBrowserView() && getBrowserView()->getVclControl() && !getBrowserView()->getVclControl()->IsEditing())
+ else if (getBrowserView() && getBrowserView()->getVclControl() && !getBrowserView()->getVclControl()->IsEditing() && getBrowserView()->getVclControl()->GetSelectRowCount() < 1)
{
SbaGridControl* pControl = getBrowserView()->getVclControl();
pControl->copyCellText(pControl->GetCurRow(), pControl->GetCurColumnId());
@@ -2346,31 +2345,34 @@ sal_Bool SbaTableQueryBrowser::implSelect(const ::rtl::OUString& _rDataSourceNam
SvLBoxEntry* pCommandType = NULL;
SvLBoxEntry* pCommand = getObjectEntry( _rDataSourceName, _rCommand, _nCommandType, &pDataSource, &pCommandType, sal_True, _rxConnection );
- // if (pDataSource) // OJ change for the new app
+ if (pCommand)
{
- if (pCommand)
+ bool bSuccess = true;
+ if ( _bSelectDirect )
{
- if ( _bSelectDirect )
- {
- implSelect( pCommand );
- }
- else
- m_pTreeView->getListBox().Select(pCommand);
+ bSuccess = implSelect( pCommand );
+ }
+ else
+ {
+ m_pTreeView->getListBox().Select( pCommand );
+ }
+ if ( bSuccess )
+ {
m_pTreeView->getListBox().MakeVisible(pCommand);
m_pTreeView->getListBox().SetCursor(pCommand);
}
- else if (!pCommandType)
- {
- if ( m_pCurrentlyDisplayed )
- { // tell the old entry (if any) it has been deselected
- selectPath(m_pCurrentlyDisplayed, sal_False);
- m_pCurrentlyDisplayed = NULL;
- }
-
- // we have a command and need to display this in the rowset
- return implLoadAnything(_rDataSourceName, _rCommand, _nCommandType, _bEscapeProcessing, _rxConnection);
+ }
+ else if (!pCommandType)
+ {
+ if ( m_pCurrentlyDisplayed )
+ { // tell the old entry (if any) it has been deselected
+ selectPath(m_pCurrentlyDisplayed, sal_False);
+ m_pCurrentlyDisplayed = NULL;
}
+
+ // we have a command and need to display this in the rowset
+ return implLoadAnything(_rDataSourceName, _rCommand, _nCommandType, _bEscapeProcessing, _rxConnection);
}
}
return sal_False;
@@ -2437,7 +2439,8 @@ bool SbaTableQueryBrowser::implSelect( SvLBoxEntry* _pEntry )
Reference< ::com::sun::star::form::XLoadable > xLoadable = getLoadable();
bRebuild |= !xLoadable->isLoaded();
- if(bRebuild)
+ bool bSuccess = true;
+ if ( bRebuild )
{
try
{
@@ -2458,7 +2461,7 @@ bool SbaTableQueryBrowser::implSelect( SvLBoxEntry* _pEntry )
if ( !pConData->xConnection.is() )
{
unloadAndCleanup( sal_False );
- return 0L;
+ return false;
}
Reference<XNameAccess> xNameAccess;
@@ -2532,6 +2535,7 @@ bool SbaTableQueryBrowser::implSelect( SvLBoxEntry* _pEntry )
}
catch (Exception&)
{
+ DBG_UNHANDLED_EXCEPTION();
}
}
}
@@ -2540,10 +2544,8 @@ bool SbaTableQueryBrowser::implSelect( SvLBoxEntry* _pEntry )
}
String sDataSourceName( getDataSourceAcessor( pConnection ) );
- if ( implLoadAnything( sDataSourceName, aName, nCommandType, sal_True, pConData->xConnection ) )
- // set the title of the beamer
- ;/*updateTitle();*/
- else
+ bSuccess = implLoadAnything( sDataSourceName, aName, nCommandType, sal_True, pConData->xConnection );
+ if ( !bSuccess )
{ // clean up
criticalFail();
}
@@ -2573,7 +2575,7 @@ bool SbaTableQueryBrowser::implSelect( SvLBoxEntry* _pEntry )
xRowSetProps->setPropertyValue(PROPERTY_ACTIVE_CONNECTION,Any());
}
}
- return true;
+ return bSuccess;
}
// -----------------------------------------------------------------------------
@@ -3698,8 +3700,25 @@ void SbaTableQueryBrowser::postReloadForm()
Reference< XEmbeddedScripts > SAL_CALL SbaTableQueryBrowser::getScriptContainer() throw (RuntimeException)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaTableQueryBrowser::getScriptContainer" );
- Reference< XEmbeddedScripts > xScripts( m_xCurrentDatabaseDocument, UNO_QUERY );
- OSL_ENSURE( xScripts.is() || !m_xCurrentDatabaseDocument.is(),
+ // update our database document
+ Reference< XModel > xDocument;
+ try
+ {
+ Reference< XPropertySet > xCursorProps( getRowSet(), UNO_QUERY_THROW );
+ Reference< XConnection > xConnection( xCursorProps->getPropertyValue( PROPERTY_ACTIVE_CONNECTION ), UNO_QUERY );
+ if ( xConnection.is() )
+ {
+ Reference< XChild > xChild( xConnection, UNO_QUERY_THROW );
+ Reference< XDocumentDataSource > xDataSource( xChild->getParent(), UNO_QUERY_THROW );
+ xDocument.set( xDataSource->getDatabaseDocument(), UNO_QUERY_THROW );
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ Reference< XEmbeddedScripts > xScripts( xDocument, UNO_QUERY );
+ OSL_ENSURE( xScripts.is() || !xDocument.is(),
"SbaTableQueryBrowser::getScriptContainer: invalid database document!" );
return xScripts;
}
diff --git a/dbaccess/source/ui/control/FieldDescControl.cxx b/dbaccess/source/ui/control/FieldDescControl.cxx
index a9c757a3cf70..4d9e81bc1f83 100644
--- a/dbaccess/source/ui/control/FieldDescControl.cxx
+++ b/dbaccess/source/ui/control/FieldDescControl.cxx
@@ -963,7 +963,8 @@ void OFieldDescControl::ActivateAggregate( EControlType eType )
{
const OTypeInfoMap* pTypeInfo = getTypeInfo();
OTypeInfoMap::const_iterator aIter = pTypeInfo->begin();
- for(;aIter != pTypeInfo->end();++aIter)
+ OTypeInfoMap::const_iterator aEnd = pTypeInfo->end();
+ for(;aIter != aEnd;++aIter)
m_pType->InsertEntry( aIter->second->aUIName );
}
m_pType->SelectEntryPos(0);
diff --git a/dbaccess/source/ui/control/RelationControl.cxx b/dbaccess/source/ui/control/RelationControl.cxx
index 08416eb7496e..ec0ebea8dea1 100644
--- a/dbaccess/source/ui/control/RelationControl.cxx
+++ b/dbaccess/source/ui/control/RelationControl.cxx
@@ -532,13 +532,14 @@ OTableListBoxControl::OTableListBoxControl( Window* _pParent
// -----------------------------------------------------------------------------
void OTableListBoxControl::fillListBoxes()
{
- DBG_ASSERT(m_pTableMap->size() >= 2, "OTableListBoxControl::OTableListBoxControl : brauche mindestens zwei TabWins !");
+ DBG_ASSERT( !m_pTableMap->empty(), "OTableListBoxControl::fillListBoxes: no table window!");
OTableWindow* pInitialLeft = NULL;
OTableWindow* pInitialRight = NULL;
// die Namen aller TabWins einsammeln
OJoinTableView::OTableWindowMap::const_iterator aIter = m_pTableMap->begin();
- for(;aIter != m_pTableMap->end();++aIter)
+ OJoinTableView::OTableWindowMap::const_iterator aEnd = m_pTableMap->end();
+ for(;aIter != aEnd;++aIter)
{
m_lmbLeftTable.InsertEntry(aIter->first);
m_lmbRightTable.InsertEntry(aIter->first);
@@ -553,6 +554,12 @@ OTableListBoxControl::OTableListBoxControl( Window* _pParent
pInitialRight = aIter->second;
m_strCurrentRight = aIter->first;
}
+ } // for(;aIter != m_pTableMap->end();++aIter)
+
+ if ( !pInitialRight )
+ {
+ pInitialRight = pInitialLeft;
+ m_strCurrentRight = m_strCurrentLeft;
}
// die entsprechenden Defs an mein Controls
diff --git a/dbaccess/source/ui/control/curledit.cxx b/dbaccess/source/ui/control/curledit.cxx
index 8dc6cd76abb8..02bddf81ac67 100644
--- a/dbaccess/source/ui/control/curledit.cxx
+++ b/dbaccess/source/ui/control/curledit.cxx
@@ -48,6 +48,7 @@ namespace dbaui
//=========================================================================
OConnectionURLEdit::OConnectionURLEdit(Window* _pParent, const ResId& _rResId,BOOL _bShowPrefix)
:Edit(_pParent, _rResId)
+ ,m_pTypeCollection(NULL)
,m_pForcedPrefix(NULL)
,m_bShowPrefix(_bShowPrefix)
{
@@ -111,13 +112,7 @@ void OConnectionURLEdit::SetText(const String& _rStr, const Selection& /*_rNewSe
if (!bIsEmpty)
{
// determine the type of the new URL described by the new text
- ::dbaccess::DATASOURCE_TYPE eType = m_aTypeCollection.getType(_rStr);
- // and the prefix belonging to this type
- if ( ::dbaccess::DST_UNKNOWN != eType)
- sPrefix = m_aTypeCollection.getDatasourcePrefix(eType);
- else {
- DBG_ERROR("OConnectionURLEdit::SetText : the new text is no valid connection URL!");
- }
+ sPrefix = m_pTypeCollection->getPrefix(_rStr);
}
// the fixed text gets the prefix
@@ -139,10 +134,10 @@ void OConnectionURLEdit::SetText(const String& _rStr, const Selection& /*_rNewSe
GetSubEdit()->Show();
// do the real SetTex
-// Edit::SetText(bIsEmpty ? _rStr : m_aTypeCollection.cutPrefix(_rStr), _rNewSelection);
+// Edit::SetText(bIsEmpty ? _rStr : m_pTypeCollection->cutPrefix(_rStr), _rNewSelection);
String sNewText( _rStr );
if ( !bIsEmpty )
- sNewText =m_aTypeCollection.cutPrefix( _rStr );
+ sNewText = m_pTypeCollection->cutPrefix( _rStr );
Edit::SetText( sNewText );
}
diff --git a/dbaccess/source/ui/control/dbtreelistbox.cxx b/dbaccess/source/ui/control/dbtreelistbox.cxx
index cd2bf2a4ad25..a11d39bdba04 100644
--- a/dbaccess/source/ui/control/dbtreelistbox.cxx
+++ b/dbaccess/source/ui/control/dbtreelistbox.cxx
@@ -56,6 +56,7 @@
#ifndef _COM_SUN_STAR_UI_XCONTEXTMENUINTERCEPTOR_HPP_
#include <com/sun/star/ui/XContextMenuInterceptor.hpp>
#endif
+#include <com/sun/star/frame/XFrame.hpp>
#ifndef _COM_SUN_STAR_UTIL_URL_HPP_
#include <com/sun/star/util/URL.hpp>
#endif
@@ -80,7 +81,8 @@
#ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_
#include <toolkit/helper/vclunohelper.hxx>
#endif
-
+#include <framework/imageproducer.hxx>
+#include <vcl/svapp.hxx>
#include <memory>
// .........................................................................
@@ -88,6 +90,7 @@ namespace dbaui
{
// .........................................................................
+using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::lang;
@@ -546,9 +549,9 @@ namespace
{
lcl_adjustMenuItemIDs( *pPopup, _rCommandController );
continue;
- }
+ } // if ( pPopup )
- USHORT nCommandId = _rCommandController.registerCommandURL( aCommand );
+ const USHORT nCommandId = _rCommandController.registerCommandURL( aCommand );
_rMenu.InsertItem( nCommandId, _rMenu.GetItemText( nId ), _rMenu.GetItemImage( nId ),
_rMenu.GetItemBits( nId ), pos );
@@ -562,6 +565,34 @@ namespace
_rMenu.RemoveItem( pos+1 );
}
}
+ void lcl_insertMenuItemImages( Menu& _rMenu, IController& _rCommandController )
+ {
+ const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings();
+ const BOOL bHiContrast = rSettings.GetMenuColor().IsDark();
+ uno::Reference< frame::XController > xController = _rCommandController.getXController();
+ uno::Reference< frame::XFrame> xFrame;
+ if ( xController.is() )
+ xFrame = xController->getFrame();
+ USHORT nCount = _rMenu.GetItemCount();
+ for ( USHORT pos = 0; pos < nCount; ++pos )
+ {
+ // do not adjust separators
+ if ( _rMenu.GetItemType( pos ) == MENUITEM_SEPARATOR )
+ continue;
+
+ USHORT nId = _rMenu.GetItemId(pos);
+ String aCommand = _rMenu.GetItemCommand( nId );
+ PopupMenu* pPopup = _rMenu.GetPopupMenu( nId );
+ if ( pPopup )
+ {
+ lcl_insertMenuItemImages( *pPopup, _rCommandController );
+ continue;
+ } // if ( pPopup )
+
+ if ( xFrame.is() )
+ _rMenu.SetItemImage(nId,framework::GetImageFromURL(xFrame,aCommand,FALSE,bHiContrast));
+ }
+ }
// =========================================================================
// = SelectionSupplier
// =========================================================================
@@ -629,6 +660,8 @@ PopupMenu* DBTreeListBox::CreateContextMenu( void )
pContextMenu.reset( m_pContextMenuProvider->getContextMenu( *this ) );
// disable what is not available currently
lcl_enableEntries( pContextMenu.get(), m_pContextMenuProvider->getCommandController() );
+ // set images
+ lcl_insertMenuItemImages( *pContextMenu, m_pContextMenuProvider->getCommandController() );
// allow context menu interception
::cppu::OInterfaceContainerHelper* pInterceptors = m_pContextMenuProvider->getContextMenuInterceptors();
if ( !pInterceptors || !pInterceptors->getLength() )
@@ -695,7 +728,7 @@ PopupMenu* DBTreeListBox::CreateContextMenu( void )
// the interceptors only know command URLs, but our menus primarily work
// with IDs -> we need to translate the commands to IDs
lcl_adjustMenuItemIDs( *pModifiedMenu, m_pContextMenuProvider->getCommandController() );
- }
+ } // if ( bModifiedMenu )
return pContextMenu.release();
}
diff --git a/dbaccess/source/ui/control/toolboxcontroller.cxx b/dbaccess/source/ui/control/toolboxcontroller.cxx
index a3608f49828a..86f5d02f5054 100644
--- a/dbaccess/source/ui/control/toolboxcontroller.cxx
+++ b/dbaccess/source/ui/control/toolboxcontroller.cxx
@@ -175,7 +175,8 @@ namespace dbaui
}
TCommandState::iterator aIter = m_aStates.begin();
- for (; aIter != m_aStates.end(); ++aIter)
+ TCommandState::iterator aEnd = m_aStates.end();
+ for (; aIter != aEnd; ++aIter)
addStatusListener(aIter->first);
ToolBox* pToolBox = static_cast<ToolBox*>(VCLUnoHelper::GetWindow(getParent()));
diff --git a/dbaccess/source/ui/dlg/AdabasStatDlg.cxx b/dbaccess/source/ui/dlg/AdabasStatDlg.cxx
deleted file mode 100644
index 459d8ac1ba4d..000000000000
--- a/dbaccess/source/ui/dlg/AdabasStatDlg.cxx
+++ /dev/null
@@ -1,208 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: AdabasStatDlg.cxx,v $
- * $Revision: 1.15.68.1 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_dbaccess.hxx"
-
-#ifndef DBAUI_ADABASSTATDLG_HXX
-#include "AdabasStatDlg.hxx"
-#endif
-#ifndef DBAUI_ADABASSTATDLG_HRC
-#include "AdabasStatDlg.hrc"
-#endif
-#ifndef _DBU_DLG_HRC_
-#include "dbu_dlg.hrc"
-#endif
-#ifndef _DBAUI_DATASOURCEITEMS_HXX_
-#include "dsitems.hxx"
-#endif
-#ifndef _SFXSTRITEM_HXX
-#include <svtools/stritem.hxx>
-#endif
-#ifndef _SFXENUMITEM_HXX
-#include <svtools/eitem.hxx>
-#endif
-#ifndef _SFXINTITEM_HXX
-#include <svtools/intitem.hxx>
-#endif
-#ifndef _VCL_STDTEXT_HXX
-#include <vcl/stdtext.hxx>
-#endif
-#ifndef _SV_MSGBOX_HXX
-#include <vcl/msgbox.hxx>
-#endif
-#ifndef _DBAUI_DATASOURCEITEMS_HXX_
-#include "dsitems.hxx"
-#endif
-#ifndef DBAUI_DRIVERSETTINGS_HXX
-#include "DriverSettings.hxx"
-#endif
-#ifndef _DBAUI_DBADMINIMPL_HXX_
-#include "DbAdminImpl.hxx"
-#endif
-#ifndef _DBAUI_PROPERTYSETITEM_HXX_
-#include "propertysetitem.hxx"
-#endif
-#ifndef _DBAUI_ADMINPAGES_HXX_
-#include "adminpages.hxx"
-#endif
-//.........................................................................
-namespace dbaui
-{
-//.........................................................................
- using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star::beans;
- using namespace ::com::sun::star::lang;
- using namespace ::com::sun::star::sdbc;
-
- //========================================================================
- //= OAdabasStatPageDlg
-DBG_NAME(OAdabasStatPageDlg)
-//========================================================================
- OAdabasStatPageDlg::OAdabasStatPageDlg(Window* _pParent
- , SfxItemSet* _pItems
- ,const Reference< XMultiServiceFactory >& _rxORB
- ,const ::com::sun::star::uno::Any& _aDataSourceName)
- :SfxTabDialog(_pParent, ModuleRes(DLG_DATABASE_ADABASADMIN), _pItems)
- {
- DBG_CTOR(OAdabasStatPageDlg,NULL);
-
- m_pImpl = ::std::auto_ptr<ODbDataSourceAdministrationHelper>(new ODbDataSourceAdministrationHelper(_rxORB,_pParent,this));
- m_pImpl->setDataSourceOrName(_aDataSourceName);
- Reference< XPropertySet > xDatasource = m_pImpl->getCurrentDataSource();
- m_pImpl->translateProperties(xDatasource, *GetInputSetImpl());
- SetInputSet(GetInputSetImpl());
- // propagate this set as our new input set and reset the example set
- delete pExampleSet;
- pExampleSet = new SfxItemSet(*GetInputSetImpl());
-
- ::dbaccess::DATASOURCE_TYPE eType = m_pImpl->getDatasourceType(*GetInputSetImpl());
-
- switch ( eType )
- {
- case ::dbaccess::DST_ADABAS:
- AddTabPage(TAB_PAG_ADABAS_SETTINGS, String(ModuleRes(STR_PAGETITLE_ADABAS_STATISTIC)), ODriversSettings::CreateAdabas,0, sal_False, 1);
- break;
- default:
- OSL_ENSURE(0,"Not supported for other types thasn adabas!");
- break;
- }
-
- // remove the reset button - it's meaning is much too ambiguous in this dialog
- RemoveResetButton();
- FreeResource();
- }
-
- // -----------------------------------------------------------------------
- OAdabasStatPageDlg::~OAdabasStatPageDlg()
- {
- SetInputSet(NULL);
- DELETEZ(pExampleSet);
-
- DBG_DTOR(OAdabasStatPageDlg,NULL);
- }
- // -----------------------------------------------------------------------
- short OAdabasStatPageDlg::Execute()
- {
- short nRet = SfxTabDialog::Execute();
- if ( nRet == RET_OK )
- {
- pExampleSet->Put(*GetOutputItemSet());
- m_pImpl->saveChanges(*pExampleSet);
- }
- return nRet;
- }
- //-------------------------------------------------------------------------
- void OAdabasStatPageDlg::PageCreated(USHORT _nId, SfxTabPage& _rPage)
- {
- // register ourself as modified listener
- static_cast<OGenericAdministrationPage&>(_rPage).SetServiceFactory(m_pImpl->getORB());
- static_cast<OGenericAdministrationPage&>(_rPage).SetAdminDialog(this,this);
-
- AdjustLayout();
- Window *pWin = GetViewWindow();
- if(pWin)
- pWin->Invalidate();
-
- SfxTabDialog::PageCreated(_nId, _rPage);
- }
- // -----------------------------------------------------------------------------
- const SfxItemSet* OAdabasStatPageDlg::getOutputSet() const
- {
- return GetExampleSet();
- }
- // -----------------------------------------------------------------------------
- SfxItemSet* OAdabasStatPageDlg::getWriteOutputSet()
- {
- return pExampleSet;
- }
- // -----------------------------------------------------------------------------
- ::std::pair< Reference<XConnection>,sal_Bool> OAdabasStatPageDlg::createConnection()
- {
- return m_pImpl->createConnection();
- }
- // -----------------------------------------------------------------------------
- Reference< XMultiServiceFactory > OAdabasStatPageDlg::getORB() const
- {
- return m_pImpl->getORB();
- }
- // -----------------------------------------------------------------------------
- Reference< XDriver > OAdabasStatPageDlg::getDriver()
- {
- return m_pImpl->getDriver();
- }
- // -----------------------------------------------------------------------------
- ::dbaccess::DATASOURCE_TYPE OAdabasStatPageDlg::getDatasourceType(const SfxItemSet& _rSet) const
- {
- return m_pImpl->getDatasourceType(_rSet);
- }
- // -----------------------------------------------------------------------------
- void OAdabasStatPageDlg::clearPassword()
- {
- m_pImpl->clearPassword();
- }
- // -----------------------------------------------------------------------------
- void OAdabasStatPageDlg::setTitle(const ::rtl::OUString& _sTitle)
- {
- SetText(_sTitle);
- }
- //-------------------------------------------------------------------------
- void OAdabasStatPageDlg::enableConfirmSettings( bool _bEnable )
- {
- (void)_bEnable;
- }
- //-------------------------------------------------------------------------
- sal_Bool OAdabasStatPageDlg::saveDatasource()
- {
- return PrepareLeaveCurrentPage();
- }
-//.........................................................................
-} // namespace dbaui
-//.........................................................................
diff --git a/dbaccess/source/ui/dlg/AdabasStatDlg.src b/dbaccess/source/ui/dlg/AdabasStatDlg.src
deleted file mode 100644
index 5e5407e9b9c6..000000000000
--- a/dbaccess/source/ui/dlg/AdabasStatDlg.src
+++ /dev/null
@@ -1,64 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: AdabasStatDlg.src,v $
- * $Revision: 1.5 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _DBA_DBACCESS_HELPID_HRC_
-#include "dbaccess_helpid.hrc"
-#endif
-#ifndef DBAUI_ADABASSTATDLG_HRC
-#include "AdabasStatDlg.hrc"
-#endif
-#ifndef _DBU_DLG_HRC_
-#include "dbu_dlg.hrc"
-#endif
-
-
-TabDialog DLG_DATABASE_ADABASADMIN
-{
- OutputSize = TRUE ;
- SVLook = TRUE ;
- Moveable = TRUE ;
- Closeable = TRUE ;
- Hide = TRUE;
- HelpId = HID_DSADMIN_ADABASADMIN;
-
- TabControl 1
- {
- OutputSize = TRUE ;
- HelpId = HID_DSADMIN_TABCONTROL;
- SingleLine=TRUE;
- };
- String STR_PAGETITLE_ADABAS_STATISTIC
- {
- Text [ en-US ] = "Adabas D Statistics";
- };
-
- Text [ en-US ] = "Advanced Properties" ;
-};
-
diff --git a/dbaccess/source/ui/dlg/ConnectionHelper.cxx b/dbaccess/source/ui/dlg/ConnectionHelper.cxx
index 16e4b51da212..ba0925d224ad 100644
--- a/dbaccess/source/ui/dlg/ConnectionHelper.cxx
+++ b/dbaccess/source/ui/dlg/ConnectionHelper.cxx
@@ -207,6 +207,7 @@ DBG_NAME(OConnectionHelper)
m_pCollection = pCollectionItem->getCollection();
m_aPB_Connection.SetClickHdl(LINK(this, OConnectionHelper, OnBrowseConnections));
DBG_ASSERT(m_pCollection, "OConnectionHelper::OConnectionHelper : really need a DSN type collection !");
+ m_aConnectionURL.SetTypeCollection(m_pCollection);
}
@@ -226,7 +227,7 @@ DBG_NAME(OConnectionHelper)
m_aFT_Connection.Show();
m_aConnectionURL.Show();
- m_aConnectionURL.ShowPrefix( ::dbaccess::DST_JDBC == m_eType );
+ m_aConnectionURL.ShowPrefix( ::dbaccess::DST_JDBC == m_pCollection->determineType(m_eType) );
BOOL bEnableBrowseButton = m_pCollection->supportsBrowsing( m_eType );
m_aPB_Connection.Show( bEnableBrowseButton );
@@ -253,21 +254,16 @@ DBG_NAME(OConnectionHelper)
if ( !m_pAdminDialog )
return;
- switch ( m_eType )
- {
- case ::dbaccess::DST_CALC:
+ if ( m_pCollection->isFileSystemBased(m_eType) )
m_pAdminDialog->enableConfirmSettings( getURLNoPrefix().Len() > 0 );
- break;
- default:
- break;
- }
}
// -----------------------------------------------------------------------
IMPL_LINK(OConnectionHelper, OnBrowseConnections, PushButton*, /*_pButton*/)
{
OSL_ENSURE(m_pAdminDialog,"No Admin dialog set! ->GPF");
- switch ( m_eType )
+ const ::dbaccess::DATASOURCE_TYPE eType = m_pCollection->determineType(m_eType);
+ switch ( eType )
{
case ::dbaccess::DST_DBASE:
case ::dbaccess::DST_FLAT:
@@ -324,15 +320,16 @@ DBG_NAME(OConnectionHelper)
break;
case ::dbaccess::DST_CALC:
{
+ SvtModuleOptions aModule;
::sfx2::FileDialogHelper aFileDlg(WB_3DLOOK | WB_STDMODAL | WB_OPEN
- ,SvtModuleOptions().GetFactoryEmptyDocumentURL(SvtModuleOptions::E_CALC)
+ ,aModule.GetFactoryEmptyDocumentURL(SvtModuleOptions::E_CALC)
,SFX_FILTER_IMPORT);
askForFileName(aFileDlg);
}
break;
case ::dbaccess::DST_MSACCESS:
{
- ::rtl::OUString sExt(RTL_CONSTASCII_USTRINGPARAM("*.mdb"));
+ const ::rtl::OUString sExt(RTL_CONSTASCII_USTRINGPARAM("*.mdb"));
String sFilterName(ModuleRes (STR_MSACCESS_FILTERNAME));
::sfx2::FileDialogHelper aFileDlg(WB_3DLOOK | WB_STDMODAL | WB_OPEN);
aFileDlg.AddFilter(sFilterName,sExt);
@@ -342,7 +339,7 @@ DBG_NAME(OConnectionHelper)
break;
case ::dbaccess::DST_MSACCESS_2007:
{
- ::rtl::OUString sAccdb(RTL_CONSTASCII_USTRINGPARAM("*.accdb"));
+ const ::rtl::OUString sAccdb(RTL_CONSTASCII_USTRINGPARAM("*.accdb"));
String sFilterName2(ModuleRes (STR_MSACCESS_2007_FILTERNAME));
::sfx2::FileDialogHelper aFileDlg(WB_3DLOOK | WB_STDMODAL | WB_OPEN);
aFileDlg.AddFilter(sFilterName2,sAccdb);
@@ -413,7 +410,7 @@ DBG_NAME(OConnectionHelper)
aInstalledDBs = getInstalledAdabasDBs(sAdabasConfigDir,sAdabasWorkDir);
}
- ODatasourceSelectDialog aSelector(GetParent(), aInstalledDBs, m_eType,m_pItemSetHelper->getWriteOutputSet());
+ ODatasourceSelectDialog aSelector(GetParent(), aInstalledDBs, true,m_pItemSetHelper->getWriteOutputSet());
if (RET_OK == aSelector.Execute())
{
setURLNoPrefix(aSelector.GetSelected());
@@ -435,9 +432,9 @@ DBG_NAME(OConnectionHelper)
case ::dbaccess::DST_ODBC:
{
// collect all ODBC data source names
- ::rtl::OUString sCurrDatasource=getURLNoPrefix();
+ ::rtl::OUString sCurrDatasource = getURLNoPrefix();
::rtl::OUString sDataSource;
- if ( getSelectedDataSource(m_eType,sDataSource,sCurrDatasource) && sDataSource.getLength() )
+ if ( getSelectedDataSource(sDataSource,sCurrDatasource) && sDataSource.getLength() )
{
setURLNoPrefix(sDataSource);
SetRoadmapStateValue(sal_True);
@@ -469,7 +466,7 @@ DBG_NAME(OConnectionHelper)
case ::dbaccess::DST_THUNDERBIRD:
{
MozillaProductType profileType = MozillaProductType_Mozilla;
- if (m_eType == ::dbaccess::DST_THUNDERBIRD)
+ if (eType == ::dbaccess::DST_THUNDERBIRD)
profileType = MozillaProductType_Thunderbird;
Reference<XMultiServiceFactory> xFactory = ::comphelper::getProcessServiceFactory();
@@ -496,7 +493,7 @@ DBG_NAME(OConnectionHelper)
// excute the select dialog
- ODatasourceSelectDialog aSelector(GetParent(), aProfiles, m_eType);
+ ODatasourceSelectDialog aSelector(GetParent(), aProfiles, eType);
::rtl::OUString sOldProfile=getURLNoPrefix();
if (sOldProfile.getLength())
@@ -539,7 +536,7 @@ DBG_NAME(OConnectionHelper)
String sTypePrefix, sFileURLEncoded;
if ( _bPrefix )
{
- sTypePrefix = m_pCollection->getDatasourcePrefix( m_eType );
+ sTypePrefix = m_pCollection->getPrefix( m_eType );
sFileURLEncoded = m_pCollection->cutPrefix( sURL );
}
else
@@ -585,7 +582,7 @@ DBG_NAME(OConnectionHelper)
String sTypePrefix, sFileURLDecoded;
if ( _bPrefix )
{
- sTypePrefix = m_pCollection->getDatasourcePrefix( m_eType );
+ sTypePrefix = m_pCollection->getPrefix( m_eType );
sFileURLDecoded = m_pCollection->cutPrefix( sURL );
}
else
@@ -770,10 +767,12 @@ DBG_NAME(OConnectionHelper)
aConfigDBs = getInstalledAdabasDBDirs(sAdabasConfigDir,::ucbhelper::INCLUDE_DOCUMENTS_ONLY);
aWrkDBs = getInstalledAdabasDBDirs(sAdabasWorkDir,::ucbhelper::INCLUDE_FOLDERS_ONLY);
ConstStringBagIterator aOuter = aConfigDBs.begin();
- for(;aOuter != aConfigDBs.end();++aOuter)
+ ConstStringBagIterator aOuterEnd = aConfigDBs.end();
+ for(;aOuter != aOuterEnd;++aOuter)
{
ConstStringBagIterator aInner = aWrkDBs.begin();
- for (;aInner != aWrkDBs.end(); ++aInner)
+ ConstStringBagIterator aInnerEnd = aWrkDBs.end();
+ for (;aInner != aInnerEnd; ++aInner)
{
if (aInner->equalsIgnoreAsciiCase(*aOuter))
{
@@ -811,11 +810,8 @@ DBG_NAME(OConnectionHelper)
//-------------------------------------------------------------------------
long OConnectionHelper::PreNotify( NotifyEvent& _rNEvt )
{
- if ( ( ::dbaccess::DST_DBASE == m_eType)
- || ( ::dbaccess::DST_FLAT == m_eType)
- || ( ::dbaccess::DST_MSACCESS == m_eType)
- || ( ::dbaccess::DST_MSACCESS_2007 == m_eType)
- || ( ::dbaccess::DST_CALC == m_eType) )
+ if ( m_pCollection->isFileSystemBased(m_eType) )
+ {
switch (_rNEvt.GetType())
{
case EVENT_GETFOCUS:
@@ -832,7 +828,8 @@ DBG_NAME(OConnectionHelper)
return 1L; // handled
}
break;
- }
+ } // switch (_rNEvt.GetType())
+ }
return OGenericAdministrationPage::PreNotify( _rNEvt );
}
@@ -933,13 +930,7 @@ DBG_NAME(OConnectionHelper)
sOldPath = m_aConnectionURL.GetSavedValueNoPrefix();
sURL = m_aConnectionURL.GetTextNoPrefix();
- switch ( m_eType )
- {
- case ::dbaccess::DST_DBASE:
- case ::dbaccess::DST_FLAT:
- case ::dbaccess::DST_MSACCESS:
- case ::dbaccess::DST_MSACCESS_2007:
- case ::dbaccess::DST_CALC:
+ if ( m_pCollection->isFileSystemBased(m_eType) )
{
if ( ( sURL != sOldPath ) && ( 0 != sURL.Len() ) )
{ // the text changed since entering the control
@@ -948,7 +939,9 @@ DBG_NAME(OConnectionHelper)
OFileNotation aTransformer(sURL);
sURL = aTransformer.get(OFileNotation::N_URL);
- if ( ( ::dbaccess::DST_CALC == m_eType) || ( ::dbaccess::DST_MSACCESS == m_eType) || ( ::dbaccess::DST_MSACCESS_2007 == m_eType) )
+ const ::dbaccess::DATASOURCE_TYPE eType = m_pCollection->determineType(m_eType);
+
+ if ( ( ::dbaccess::DST_CALC == eType) || ( ::dbaccess::DST_MSACCESS == eType) || ( ::dbaccess::DST_MSACCESS_2007 == eType) )
{ // #106016# --------------------------
if( pathExists(sURL, sal_True) == PATH_NOT_EXIST )
{
@@ -978,10 +971,6 @@ DBG_NAME(OConnectionHelper)
}
}
}
- break;
- default:
- break;
- }
setURLNoPrefix(sURL);
m_aConnectionURL.SaveValueNoPrefix();
diff --git a/dbaccess/source/ui/dlg/ConnectionHelper.hxx b/dbaccess/source/ui/dlg/ConnectionHelper.hxx
index cb9e4ff19816..4839bae4f364 100644
--- a/dbaccess/source/ui/dlg/ConnectionHelper.hxx
+++ b/dbaccess/source/ui/dlg/ConnectionHelper.hxx
@@ -77,8 +77,7 @@ namespace dbaui
FixedText m_aFT_Connection;
OConnectionURLEdit m_aConnectionURL;
PushButton m_aPB_Connection;
- ::dbaccess::DATASOURCE_TYPE
- m_eType; // the type can't be changed in this class, so we hold it as member.
+ ::rtl::OUString m_eType; // the type can't be changed in this class, so we hold it as member.
public:
@@ -122,7 +121,6 @@ namespace dbaui
virtual void SetServiceFactory(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > _rxORB)
{
OGenericAdministrationPage::SetServiceFactory(_rxORB);
- m_aConnectionURL.initializeTypeCollection(m_xORB);
}
protected:
diff --git a/dbaccess/source/ui/dlg/ConnectionPage.cxx b/dbaccess/source/ui/dlg/ConnectionPage.cxx
index a032b6a47908..db21de4d9a76 100644
--- a/dbaccess/source/ui/dlg/ConnectionPage.cxx
+++ b/dbaccess/source/ui/dlg/ConnectionPage.cxx
@@ -200,7 +200,6 @@ namespace dbaui
DBG_NAME(OConnectionTabPage)
OConnectionTabPage::OConnectionTabPage(Window* pParent, const SfxItemSet& _rCoreAttrs)
:OConnectionHelper(pParent, ModuleRes(PAGE_CONNECTION), _rCoreAttrs)
- ,m_pCollection(NULL)
,m_bUserGrabFocus(sal_True)
,m_aFL1(this, ModuleRes(FL_SEPARATOR1))
,m_aFL2(this, ModuleRes(FL_SEPARATOR2))
@@ -223,12 +222,6 @@ namespace dbaui
m_aTestConnection.SetClickHdl(LINK(this,OGenericAdministrationPage,OnTestConnectionClickHdl));
m_aTestJavaDriver.SetClickHdl(LINK(this,OConnectionTabPage,OnTestJavaClickHdl));
- // extract the datasource type collection from the item set
- DbuTypeCollectionItem* pCollectionItem = PTR_CAST(DbuTypeCollectionItem, _rCoreAttrs.GetItem(DSID_TYPECOLLECTION));
- if (pCollectionItem)
- m_pCollection = pCollectionItem->getCollection();
- DBG_ASSERT(m_pCollection, "OConnectionTabPage::OConnectionTabPage : really need a DSN type collection !");
-
FreeResource();
}
@@ -249,7 +242,8 @@ namespace dbaui
OConnectionHelper::implInitControls( _rSet, _bSaveValue);
LocalResourceAccess aLocRes( PAGE_CONNECTION, RSC_TABPAGE );
- switch( m_eType )
+ ::dbaccess::DATASOURCE_TYPE eType = m_pCollection->determineType(m_eType);
+ switch( eType )
{
case ::dbaccess::DST_DBASE:
m_aFT_Connection.SetText(String(ModuleRes(STR_DBASE_PATH_OR_FILE)));
@@ -287,7 +281,7 @@ namespace dbaui
case ::dbaccess::DST_MYSQL_ODBC:
case ::dbaccess::DST_ODBC:
m_aFT_Connection.SetText(String(ModuleRes(STR_NAME_OF_ODBC_DATASOURCE)));
- m_aConnectionURL.SetHelpId( m_eType == ::dbaccess::DST_MYSQL_ODBC ? HID_DSADMIN_MYSQL_ODBC_DATASOURCE : HID_DSADMIN_ODBC_DATASOURCE);
+ m_aConnectionURL.SetHelpId( eType == ::dbaccess::DST_MYSQL_ODBC ? HID_DSADMIN_MYSQL_ODBC_DATASOURCE : HID_DSADMIN_ODBC_DATASOURCE);
break;
case ::dbaccess::DST_LDAP:
m_aFT_Connection.SetText(String(ModuleRes(STR_HOSTNAME)));
@@ -319,8 +313,6 @@ namespace dbaui
m_aConnectionURL.Hide();
break;
case ::dbaccess::DST_JDBC:
- m_aFT_Connection.SetText(String(ModuleRes(STR_COMMONURL)));
- // run through
default:
m_aFT_Connection.SetText(String(ModuleRes(STR_COMMONURL)));
break;
@@ -355,8 +347,18 @@ namespace dbaui
String sUrl = pUrlItem->GetValue();
setURL( sUrl );
- BOOL bEnableJDBC = m_eType == ::dbaccess::DST_JDBC;
- m_aJavaDriver.SetText(pJdbcDrvItem->GetValue());
+ const BOOL bEnableJDBC = m_pCollection->determineType(m_eType) == ::dbaccess::DST_JDBC;
+ if ( !pJdbcDrvItem->GetValue().Len() )
+ {
+ String sDefaultJdbcDriverName = m_pCollection->getJavaDriverClass(m_eType);
+ if ( sDefaultJdbcDriverName.Len() )
+ {
+ m_aJavaDriver.SetText(sDefaultJdbcDriverName);
+ m_aJavaDriver.SetModifyFlag();
+ }
+ } // if ( !pJdbcDrvItem->GetValue().Len() )
+ else
+ m_aJavaDriver.SetText(pJdbcDrvItem->GetValue());
m_aJavaDriverLabel.Show(bEnableJDBC);
m_aJavaDriver.Show(bEnableJDBC);
@@ -409,7 +411,7 @@ namespace dbaui
fillBool(_rSet,&m_aPasswordRequired,DSID_PASSWORDREQUIRED,bChangedSomething);
- if ( m_eType == ::dbaccess::DST_JDBC )
+ if ( m_pCollection->determineType(m_eType) == ::dbaccess::DST_JDBC )
{
fillString(_rSet,&m_aJavaDriver, DSID_JDBCDRIVERCLASS, bChangedSomething);
}
@@ -445,7 +447,7 @@ namespace dbaui
{
OSL_ENSURE(m_pAdminDialog,"No Admin dialog set! ->GPF");
BOOL bEnableTestConnection = !m_aConnectionURL.IsVisible() || (m_aConnectionURL.GetTextNoPrefix().Len() != 0);
- if ( m_eType == ::dbaccess::DST_JDBC )
+ if ( m_pCollection->determineType(m_eType) == ::dbaccess::DST_JDBC )
bEnableTestConnection = bEnableTestConnection && (m_aJavaDriver.GetText().Len() != 0);
m_aTestConnection.Enable(bEnableTestConnection);
return true;
diff --git a/dbaccess/source/ui/dlg/ConnectionPage.hxx b/dbaccess/source/ui/dlg/ConnectionPage.hxx
index 90a120a32ef8..8109d3a550f5 100644
--- a/dbaccess/source/ui/dlg/ConnectionPage.hxx
+++ b/dbaccess/source/ui/dlg/ConnectionPage.hxx
@@ -58,8 +58,6 @@ namespace dbaui
*/
class OConnectionTabPage : public OConnectionHelper
{
- ::dbaccess::ODsnTypeCollection*
- m_pCollection; /// the DSN type collection instance
sal_Bool m_bUserGrabFocus : 1;
protected:
// connection
diff --git a/dbaccess/source/ui/dlg/ConnectionPageSetup.cxx b/dbaccess/source/ui/dlg/ConnectionPageSetup.cxx
index 4af66d7581a0..6b22d79e4b18 100644
--- a/dbaccess/source/ui/dlg/ConnectionPageSetup.cxx
+++ b/dbaccess/source/ui/dlg/ConnectionPageSetup.cxx
@@ -272,20 +272,22 @@ namespace dbaui
m_eType = m_pAdminDialog->getDatasourceType(_rSet);
// special handling for oracle, this can only happen
// if the user enters the same url as used for Oracle and we are on the JDBC path
- if ( ::dbaccess::DST_ORACLE_JDBC == m_eType )
- m_eType = ::dbaccess::DST_JDBC;
+ //! TODO
+ //if ( ::dbaccess::DST_ORACLE_JDBC == m_eType )
+ // m_eType = ::dbaccess::DST_JDBC;
OConnectionHelper::implInitControls(_rSet, _bSaveValue);
- if ( m_eType >= ::dbaccess::DST_USERDEFINE1 )
- {
- String sDisplayName = m_pCollection->getTypeDisplayName(m_eType);
- FixedText* ppTextControls[] ={&m_aFT_Connection};
- for (size_t i = 0; i < sizeof(ppTextControls)/sizeof(ppTextControls[0]); ++i)
- {
- ppTextControls[i]->SetText(sDisplayName);
- }
- }
+ //! TODO
+ //if ( m_eType >= ::dbaccess::DST_USERDEFINE1 )
+ //{
+ // String sDisplayName = m_pCollection->getTypeDisplayName(m_eType);
+ // FixedText* ppTextControls[] ={&m_aFT_Connection};
+ // for (size_t i = 0; i < sizeof(ppTextControls)/sizeof(ppTextControls[0]); ++i)
+ // {
+ // ppTextControls[i]->SetText(sDisplayName);
+ // }
+ //}
callModifiedHdl();
}
diff --git a/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx b/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx
index aa3ad63f4377..cf472eae45f4 100644
--- a/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx
+++ b/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx
@@ -103,37 +103,16 @@
#include <svtools/filenotation.hxx>
#endif
-#ifndef _UNOTOOLS_LOCALFILEHELPER_HXX
#include <unotools/localfilehelper.hxx>
-#endif
-#ifndef _UNOTOOLS_UCBHELPER_HXX
#include <unotools/ucbhelper.hxx>
-#endif
-#ifndef _UCBHELPER_COMMANDENVIRONMENT_HXX
#include <ucbhelper/commandenvironment.hxx>
-#endif
-#ifndef DBAUI_FILEPICKER_INTERACTION_HXX
#include "finteraction.hxx"
-#endif
-#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_
#include <connectivity/CommonTools.hxx>
-#endif
-
-#ifndef _DBA_DBACCESS_HELPID_HRC_
+#include <connectivity/DriversConfig.hxx>
#include "dbaccess_helpid.hrc"
-#endif
-
-#ifndef INCLUDED_SVTOOLS_PATHOPTIONS_HXX
#include <svtools/pathoptions.hxx>
-#endif
-
-#ifndef SVTOOLS_INC_ROADMAPWIZARD_HXX
#include <svtools/roadmapwizard.hxx>
-#endif
-
-#ifndef DBAUI_TEXTCONNECTIONHELPER_HXX
#include "TextConnectionHelper.hxx"
-#endif
//.........................................................................
@@ -288,7 +267,7 @@ DBG_NAME(OTextConnectionPageSetup)
pCollection = pCollectionItem->getCollection();
DBG_ASSERT(pCollection, "OLDAPConnectionPageSetup::FillItemSet : really need a DSN type collection !");
- String sUrl = pCollection->getDatasourcePrefix( ::dbaccess::DST_LDAP);
+ String sUrl = pCollection->getPrefix( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:address:ldap:")));
sUrl += m_aETHostServer.GetText();
_rSet.Put(SfxStringItem(DSID_CONNECTURL, sUrl));
bChangedSomething = sal_True;
@@ -389,13 +368,10 @@ DBG_NAME(OMySQLIntroPageSetup)
void OMySQLIntroPageSetup::implInitControls(const SfxItemSet& _rSet, sal_Bool /*_bSaveValue*/)
{
DbuTypeCollectionItem* pCollectionItem = PTR_CAST(DbuTypeCollectionItem, _rSet.GetItem(DSID_TYPECOLLECTION));
- ::dbaccess::ODsnTypeCollection* pCollection = NULL;
if (pCollectionItem)
{
- pCollection = pCollectionItem->getCollection();
- String sUrl = pCollection->getDatasourcePrefix( ::dbaccess::DST_MYSQL_NATIVE);
- uno::Reference< sdbc::XDriverAccess > xDriverManager( m_xORB->createInstance( SERVICE_SDBC_DRIVERMANAGER ), uno::UNO_QUERY );
- if ( xDriverManager.is() && xDriverManager->getDriverByURL( sUrl ).is() )
+ ::dbaccess::ODsnTypeCollection* pCollection = pCollectionItem->getCollection();
+ if ( pCollection->getPrefix(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:mysql:mysqlc:"))).Len() )
{
m_aRB_NATIVEDatabase.Show();
m_aRB_JDBCDatabase.SetState(sal_False);
@@ -443,7 +419,6 @@ DBG_NAME(OMySQLIntroPageSetup)
_rAttrSet,
DSID_MYSQL_PORTNUMBER ,
STR_MYSQL_DEFAULT,
- "com.mysql.jdbc.Driver",
STR_MYSQLJDBC_HELPTEXT,
STR_MYSQLJDBC_HEADERTEXT,
STR_MYSQL_DRIVERCLASSTEXT) );
@@ -457,7 +432,6 @@ DBG_NAME(OMySQLIntroPageSetup)
_rAttrSet,
DSID_MYSQL_PORTNUMBER ,
STR_MYSQL_DEFAULT,
- NULL,
STR_MYSQLJDBC_HELPTEXT,
STR_MYSQLJDBC_HEADERTEXT,
0) );
@@ -472,7 +446,6 @@ DBG_NAME(OMySQLIntroPageSetup)
_rAttrSet,
DSID_ORACLE_PORTNUMBER,
STR_ORACLE_DEFAULT,
- "oracle.jdbc.driver.OracleDriver",
STR_ORACLE_HELPTEXT,
STR_ORACLE_HEADERTEXT,
STR_ORACLE_DRIVERCLASSTEXT) );
@@ -482,7 +455,7 @@ DBG_NAME(OMySQLIntroPageSetup)
//========================================================================
//= OMySQLJDBCConnectionPageSetup
//========================================================================
- OGeneralSpecialJDBCConnectionPageSetup::OGeneralSpecialJDBCConnectionPageSetup( Window* pParent,USHORT _nResId, const SfxItemSet& _rCoreAttrs ,USHORT _nPortId, USHORT _nDefaultPortResId, const sal_Char* _pDriverName, USHORT _nHelpTextResId, USHORT _nHeaderTextResId, USHORT _nDriverClassId)
+ OGeneralSpecialJDBCConnectionPageSetup::OGeneralSpecialJDBCConnectionPageSetup( Window* pParent,USHORT _nResId, const SfxItemSet& _rCoreAttrs ,USHORT _nPortId, USHORT _nDefaultPortResId, USHORT _nHelpTextResId, USHORT _nHeaderTextResId, USHORT _nDriverClassId)
:OGenericAdministrationPage(pParent, ModuleRes(_nResId), _rCoreAttrs)
,m_pFTHeaderText (NULL)
,m_aFTHelpText (this, ModuleRes(FT_AUTOWIZARDHELPTEXT))
@@ -533,7 +506,15 @@ DBG_NAME(OMySQLIntroPageSetup)
m_aNFPortNumber.SetUseThousandSep(sal_False);
if ( m_bUseClass )
- m_sDefaultJdbcDriverName = String::CreateFromAscii(_pDriverName);
+ {
+ SFX_ITEMSET_GET(_rCoreAttrs, pUrlItem, SfxStringItem, DSID_CONNECTURL, sal_True);
+ SFX_ITEMSET_GET(_rCoreAttrs, pTypesItem, DbuTypeCollectionItem, DSID_TYPECOLLECTION, sal_True);
+ ::dbaccess::ODsnTypeCollection* pTypeCollection = pTypesItem ? pTypesItem->getCollection() : NULL;
+ if (pTypeCollection && pUrlItem && pUrlItem->GetValue().Len() )
+ {
+ m_sDefaultJdbcDriverName = pTypeCollection->getJavaDriverClass(pUrlItem->GetValue());
+ }
+ }
SetRoadmapStateValue(sal_False);
FreeResource();
}
@@ -710,8 +691,20 @@ DBG_NAME(OMySQLIntroPageSetup)
if ( bValid )
{
- m_aETDriverClass.SetText(pDrvItem->GetValue());
- m_aETDriverClass.ClearModifyFlag();
+ if ( !pDrvItem->GetValue().Len() )
+ {
+ String sDefaultJdbcDriverName = m_pCollection->getJavaDriverClass(m_eType);
+ if ( sDefaultJdbcDriverName.Len() )
+ {
+ m_aETDriverClass.SetText(sDefaultJdbcDriverName);
+ m_aETDriverClass.SetModifyFlag();
+ } // if ( sDefaultJdbcDriverName.Len() )
+ } // if ( !pJdbcDrvItem->GetValue().Len() )
+ else
+ {
+ m_aETDriverClass.SetText(pDrvItem->GetValue());
+ m_aETDriverClass.ClearModifyFlag();
+ }
}
sal_Bool bEnable = pDrvItem->GetValue().Len() != 0;
m_aPBTestJavaDriver.Enable(bEnable);
diff --git a/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx b/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx
index d2f1bac78057..0bbd3cbf729c 100644
--- a/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx
+++ b/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx
@@ -152,7 +152,6 @@ namespace dbaui
, const SfxItemSet& _rCoreAttrs
, USHORT _nPortId
, USHORT _nDefaultPortResId
- , const sal_Char* _pDriverName
, USHORT _nHelpTextResId
, USHORT _nHeaderTextResId
, USHORT _nDriverClassId );
diff --git a/dbaccess/source/ui/dlg/DbAdminImpl.cxx b/dbaccess/source/ui/dlg/DbAdminImpl.cxx
index 8018b424ee95..4390cc6b8dc4 100644
--- a/dbaccess/source/ui/dlg/DbAdminImpl.cxx
+++ b/dbaccess/source/ui/dlg/DbAdminImpl.cxx
@@ -61,6 +61,7 @@
#ifndef _DBHELPER_DBEXCEPTION_HXX_
#include <connectivity/dbexception.hxx>
#endif
+#include <connectivity/DriversConfig.hxx>
#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_
#include <com/sun/star/beans/PropertyAttribute.hpp>
#endif
@@ -472,21 +473,14 @@ Reference< XPropertySet > ODbDataSourceAdministrationHelper::getCurrentDataSourc
return m_xDatasource;
}
//-------------------------------------------------------------------------
-::dbaccess::DATASOURCE_TYPE ODbDataSourceAdministrationHelper::getDatasourceType( const SfxItemSet& _rSet )
+::rtl::OUString ODbDataSourceAdministrationHelper::getDatasourceType( const SfxItemSet& _rSet )
{
SFX_ITEMSET_GET( _rSet, pConnectURL, SfxStringItem, DSID_CONNECTURL, sal_True );
- SFX_ITEMSET_GET( _rSet, pTypeCollection, DbuTypeCollectionItem, DSID_TYPECOLLECTION, sal_True );
- DBG_ASSERT( pConnectURL && pTypeCollection, "ODbDataSourceAdministrationHelper::getDatasourceType: invalid items in the source set!" );
- if ( !pConnectURL || !pTypeCollection )
- return ::dbaccess::DST_UNKNOWN;
-
- String sConnectURL = pConnectURL->GetValue();
+ DBG_ASSERT( pConnectURL , "ODbDataSourceAdministrationHelper::getDatasourceType: invalid items in the source set!" );
+ SFX_ITEMSET_GET(_rSet, pTypeCollection, DbuTypeCollectionItem, DSID_TYPECOLLECTION, sal_True);
+ DBG_ASSERT(pTypeCollection, "ODbDataSourceAdministrationHelper::getDatasourceType: invalid items in the source set!");
::dbaccess::ODsnTypeCollection* pCollection = pTypeCollection->getCollection();
- DBG_ASSERT( pCollection, "ODbDataSourceAdministrationHelper::getDatasourceType: invalid type collection!" );
- if ( !pCollection )
- return ::dbaccess::DST_UNKNOWN;
-
- return pCollection->getType( sConnectURL );
+ return pCollection->getType(pConnectURL->GetValue());
}
//-------------------------------------------------------------------------
@@ -499,7 +493,7 @@ String ODbDataSourceAdministrationHelper::getConnectionURL() const
{
String sNewUrl;
- ::dbaccess::DATASOURCE_TYPE eType = getDatasourceType(*m_pItemSetHelper->getOutputSet());
+ ::rtl::OUString eType = getDatasourceType(*m_pItemSetHelper->getOutputSet());
SFX_ITEMSET_GET(*m_pItemSetHelper->getOutputSet(), pUrlItem, SfxStringItem, DSID_CONNECTURL, sal_True);
SFX_ITEMSET_GET(*m_pItemSetHelper->getOutputSet(), pTypeCollection, DbuTypeCollectionItem, DSID_TYPECOLLECTION, sal_True);
@@ -509,9 +503,7 @@ String ODbDataSourceAdministrationHelper::getConnectionURL() const
::dbaccess::ODsnTypeCollection* pCollection = pTypeCollection->getCollection();
DBG_ASSERT(pCollection, "ODbDataSourceAdministrationHelper::getDatasourceType: invalid type collection!");
-
-
- switch( eType )
+ switch( pCollection->determineType(eType) )
{
case ::dbaccess::DST_DBASE:
case ::dbaccess::DST_FLAT:
@@ -599,7 +591,7 @@ String ODbDataSourceAdministrationHelper::getConnectionURL() const
}
if ( sNewUrl.Len() )
{
- String sUrl = pCollection->getDatasourcePrefix(eType);
+ String sUrl = pCollection->getPrefix(eType);
sUrl += sNewUrl;
sNewUrl = sUrl;
}
@@ -672,18 +664,21 @@ void ODbDataSourceAdministrationHelper::translateProperties(const Reference< XPr
}
// go through all known translations and check if we have such a setting
- PropertyValue aSearchFor;
- for ( ConstMapInt2StringIterator aIndirect = m_aIndirectPropTranslator.begin();
- aIndirect != m_aIndirectPropTranslator.end();
- ++aIndirect
- )
+ if ( !aInfos.empty() )
{
- aSearchFor.Name = aIndirect->second;
- ConstPropertyValueSetIterator aInfoPos = aInfos.find(aSearchFor);
- if (aInfos.end() != aInfoPos)
- // the property is contained in the info sequence
- // -> transfer it into an item
- implTranslateProperty(_rDest, aIndirect->first, aInfoPos->Value);
+ PropertyValue aSearchFor;
+ ConstMapInt2StringIterator aEnd = m_aIndirectPropTranslator.end();
+ for ( ConstMapInt2StringIterator aIndirect = m_aIndirectPropTranslator.begin();
+ aIndirect != aEnd;
+ ++aIndirect)
+ {
+ aSearchFor.Name = aIndirect->second;
+ ConstPropertyValueSetIterator aInfoPos = aInfos.find(aSearchFor);
+ if (aInfos.end() != aInfoPos)
+ // the property is contained in the info sequence
+ // -> transfer it into an item
+ implTranslateProperty(_rDest, aIndirect->first, aInfoPos->Value);
+ }
}
convertUrl(_rDest);
@@ -770,9 +765,9 @@ void ODbDataSourceAdministrationHelper::fillDatasourceInfo(const SfxItemSet& _rS
// us)
// first determine which of all the items are relevant for the data source (depends on the connection url)
- ::dbaccess::DATASOURCE_TYPE eType = getDatasourceType(_rSource);
+ ::rtl::OUString eType = getDatasourceType(_rSource);
::std::vector< sal_Int32> aDetailIds;
- ODriversSettings::getSupportedIndirectSettings(eType,aDetailIds);
+ ODriversSettings::getSupportedIndirectSettings(eType,getORB(),aDetailIds);
// collect the translated property values for the relevant items
PropertyValueSet aRelevantSettings;
@@ -874,22 +869,13 @@ void ODbDataSourceAdministrationHelper::fillDatasourceInfo(const SfxItemSet& _rS
#endif
}
+ ::connectivity::DriversConfig aDriverConfig(getORB());
+ const ::comphelper::NamedValueCollection& aProperties = aDriverConfig.getProperties(eType);
+ Sequence< Any> aTypeSettings;
+ aTypeSettings = aProperties.getOrDefault("TypeInfoSettings",aTypeSettings);
// here we have a special entry for types from oracle
- if ( eType == ::dbaccess::DST_ORACLE_JDBC )
+ if ( aTypeSettings.getLength() )
{
- Sequence< Any > aTypeSettings;
- static const ::rtl::OUString s_sCondition(RTL_CONSTASCII_USTRINGPARAM("Column(2) = "));
- static const ::rtl::OUString s_sValue(RTL_CONSTASCII_USTRINGPARAM("Column(6) = PRECISION"));
- static const sal_Int32 pTypes[] = { -5, -4, -3, -2, -1, 1, 2, 12};
- aTypeSettings.realloc((sizeof(pTypes)/sizeof(pTypes[0])) * 2);
- Any* pCondIter = aTypeSettings.getArray();
- const Any* pCondEnd = pCondIter + aTypeSettings.getLength();
- for(const sal_Int32* pType = pTypes;pCondIter != pCondEnd;++pCondIter,++pType)
- {
- *pCondIter <<= (s_sCondition + ::rtl::OUString::valueOf(*pType));
- ++pCondIter;
- *pCondIter <<= s_sValue;
- }
aRelevantSettings.insert(PropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TypeInfoSettings")), 0, makeAny(aTypeSettings), PropertyState_DIRECT_VALUE));
}
@@ -1078,7 +1064,7 @@ String ODbDataSourceAdministrationHelper::getDocumentUrl(SfxItemSet& _rDest)
// -----------------------------------------------------------------------------
void ODbDataSourceAdministrationHelper::convertUrl(SfxItemSet& _rDest)
{
- ::dbaccess::DATASOURCE_TYPE eType = getDatasourceType(_rDest);
+ ::rtl::OUString eType = getDatasourceType(_rDest);
SFX_ITEMSET_GET(_rDest, pUrlItem, SfxStringItem, DSID_CONNECTURL, sal_True);
SFX_ITEMSET_GET(_rDest, pTypeCollection, DbuTypeCollectionItem, DSID_TYPECOLLECTION, sal_True);
@@ -1091,12 +1077,13 @@ void ODbDataSourceAdministrationHelper::convertUrl(SfxItemSet& _rDest)
USHORT nPortNumberId = 0;
sal_Int32 nPortNumber = -1;
String sNewHostName;
- String sUrl = pCollection->cutPrefix(pUrlItem->GetValue());
+ //String sUrl = pCollection->cutPrefix(pUrlItem->GetValue());
String sUrlPart;
pCollection->extractHostNamePort(pUrlItem->GetValue(),sUrlPart,sNewHostName,nPortNumber);
+ const ::dbaccess::DATASOURCE_TYPE eTy = pCollection->determineType(eType);
- switch( eType )
+ switch( eTy )
{
case ::dbaccess::DST_MYSQL_NATIVE:
case ::dbaccess::DST_MYSQL_JDBC:
@@ -1114,13 +1101,13 @@ void ODbDataSourceAdministrationHelper::convertUrl(SfxItemSet& _rDest)
if ( sUrlPart.Len() )
{
- if ( eType == ::dbaccess::DST_MYSQL_NATIVE )
+ if ( eTy == ::dbaccess::DST_MYSQL_NATIVE )
{
_rDest.Put( SfxStringItem( DSID_DATABASENAME, sUrlPart ) );
}
else
{
- String sNewUrl = pCollection->getDatasourcePrefix(eType);
+ String sNewUrl = pCollection->getPrefix(eType);
sNewUrl += sUrlPart;
_rDest.Put( SfxStringItem( DSID_CONNECTURL, sNewUrl ) );
}
diff --git a/dbaccess/source/ui/dlg/DbAdminImpl.hxx b/dbaccess/source/ui/dlg/DbAdminImpl.hxx
index 70a0c07a6722..a194ebc7b23c 100644
--- a/dbaccess/source/ui/dlg/DbAdminImpl.hxx
+++ b/dbaccess/source/ui/dlg/DbAdminImpl.hxx
@@ -71,6 +71,16 @@ class Window;
namespace dbaui
{
//.........................................................................
+ class DataSourceInfoConverter
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory;
+ public:
+ DataSourceInfoConverter(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xFactory)
+ :m_xFactory(_xFactory)
+ {
+ }
+ void convert(const ::dbaccess::ODsnTypeCollection* _pCollection,const ::rtl::OUString& _sOldURLPrefix,const ::rtl::OUString& _sNewURLPrefix,const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xDatasource);
+ };
class IItemSetHelper;
//========================================================================
//= ODbDataSourceAdministrationHelper
@@ -142,7 +152,7 @@ namespace dbaui
/** extracts the connection type from the given set<p/>
The connection type is determined by the value of the DSN item, analyzed by the TypeCollection item.
*/
- static ::dbaccess::DATASOURCE_TYPE getDatasourceType( const SfxItemSet& _rSet );
+ static ::rtl::OUString getDatasourceType( const SfxItemSet& _rSet );
/** returns the connection URL
@return
diff --git a/dbaccess/source/ui/dlg/DriverSettings.cxx b/dbaccess/source/ui/dlg/DriverSettings.cxx
index 15c40b3e40c5..4c66109d50e2 100644
--- a/dbaccess/source/ui/dlg/DriverSettings.cxx
+++ b/dbaccess/source/ui/dlg/DriverSettings.cxx
@@ -34,14 +34,15 @@
#include "DriverSettings.hxx"
#include "dsitems.hxx"
#include "datasourceui.hxx"
-
+#include <connectivity/DriversConfig.hxx>
using namespace dbaui;
-void ODriversSettings::getSupportedIndirectSettings( ::dbaccess::DATASOURCE_TYPE _eType, ::std::vector< sal_Int32>& _out_rDetailsIds )
+void ODriversSettings::getSupportedIndirectSettings( const ::rtl::OUString& _sURLPrefix,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xFactory, ::std::vector< sal_Int32>& _out_rDetailsIds )
{
// for a number of settings, we do not need to use hard-coded here, but can ask a
// central DataSourceUI instance.
- DataSourceUI aDSUI( _eType );
+ DataSourceMetaData aMeta(_sURLPrefix);
+ DataSourceUI aDSUI( aMeta );
const USHORT nGenericKnownSettings[] =
{
DSID_SQL92CHECK,
@@ -67,71 +68,35 @@ void ODriversSettings::getSupportedIndirectSettings( ::dbaccess::DATASOURCE_TYPE
_out_rDetailsIds.push_back( *pGenericKnowSetting );
// the rest is hard-coded. On the long run, all of this should be done via DataSourceUI::hasSetting
- switch ( _eType )
+ ::connectivity::DriversConfig aDriverConfig(_xFactory);
+ const ::comphelper::NamedValueCollection& aProperties = aDriverConfig.getProperties(_sURLPrefix);
+ typedef ::std::pair<USHORT, ::rtl::OUString> TProperties;
+ TProperties aProps[] = { TProperties(DSID_SHOWDELETEDROWS,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ShowDeleted")))
+ ,TProperties(DSID_CHARSET,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharSet")))
+ ,TProperties(DSID_FIELDDELIMITER,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FieldDelimiter")))
+ ,TProperties(DSID_TEXTDELIMITER,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("StringDelimiter")))
+ ,TProperties(DSID_DECIMALDELIMITER,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DecimalDelimiter")))
+ ,TProperties(DSID_THOUSANDSDELIMITER,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ThousandDelimiter")))
+ ,TProperties(DSID_TEXTFILEEXTENSION,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Extension")))
+ ,TProperties(DSID_TEXTFILEHEADER,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HeaderLine")))
+ ,TProperties(DSID_ADDITIONALOPTIONS,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SystemDriverSettings")))
+ ,TProperties(DSID_CONN_SHUTSERVICE,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ShutdownDatabase")))
+ ,TProperties(DSID_CONN_DATAINC,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DataCacheSizeIncrement")))
+ ,TProperties(DSID_CONN_CACHESIZE,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DataCacheSize")))
+ ,TProperties(DSID_CONN_CTRLUSER,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ControlUser")))
+ ,TProperties(DSID_CONN_CTRLPWD,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ControlPassword")))
+ ,TProperties(DSID_USECATALOG,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UseCatalog")))
+ ,TProperties(DSID_CONN_SOCKET,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LocalSocket")))
+ ,TProperties(DSID_JDBCDRIVERCLASS,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("JavaDriverClass")))
+ ,TProperties(DSID_CONN_LDAP_BASEDN,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BaseDN")))
+ ,TProperties(DSID_CONN_LDAP_ROWCOUNT,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MaxRowCount")))
+ ,TProperties(DSID_CONN_LDAP_USESSL,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UseSSL")))
+ ,TProperties(DSID_IGNORECURRENCY,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IgnoreCurrency")))
+ ,TProperties(0,::rtl::OUString())
+ };
+ for ( TProperties* pProps = aProps; pProps->first; ++pProps )
{
- case ::dbaccess::DST_DBASE:
- _out_rDetailsIds.push_back(DSID_SHOWDELETEDROWS);
- _out_rDetailsIds.push_back(DSID_CHARSET);
- break;
-
- case ::dbaccess::DST_FLAT:
- _out_rDetailsIds.push_back(DSID_FIELDDELIMITER);
- _out_rDetailsIds.push_back(DSID_TEXTDELIMITER);
- _out_rDetailsIds.push_back(DSID_DECIMALDELIMITER);
- _out_rDetailsIds.push_back(DSID_THOUSANDSDELIMITER);
- _out_rDetailsIds.push_back(DSID_TEXTFILEEXTENSION);
- _out_rDetailsIds.push_back(DSID_TEXTFILEHEADER);
- _out_rDetailsIds.push_back(DSID_CHARSET);
- break;
-
- case ::dbaccess::DST_ADABAS:
- _out_rDetailsIds.push_back(DSID_CHARSET);
- _out_rDetailsIds.push_back(DSID_CONN_SHUTSERVICE);
- _out_rDetailsIds.push_back(DSID_CONN_DATAINC);
- _out_rDetailsIds.push_back(DSID_CONN_CACHESIZE);
- _out_rDetailsIds.push_back(DSID_CONN_CTRLUSER);
- _out_rDetailsIds.push_back(DSID_CONN_CTRLPWD);
- break;
-
- case ::dbaccess::DST_ADO:
- _out_rDetailsIds.push_back(DSID_CHARSET);
- break;
-
- case ::dbaccess::DST_ODBC:
- _out_rDetailsIds.push_back(DSID_ADDITIONALOPTIONS);
- _out_rDetailsIds.push_back(DSID_CHARSET);
- _out_rDetailsIds.push_back(DSID_USECATALOG);
- break;
-
- case ::dbaccess::DST_MYSQL_NATIVE:
- _out_rDetailsIds.push_back(DSID_CHARSET);
- _out_rDetailsIds.push_back(DSID_CONN_SOCKET);
- break;
- case ::dbaccess::DST_MYSQL_JDBC:
- _out_rDetailsIds.push_back(DSID_CHARSET);
- _out_rDetailsIds.push_back(DSID_JDBCDRIVERCLASS);
- break;
-
- case ::dbaccess::DST_MYSQL_ODBC:
- _out_rDetailsIds.push_back(DSID_CHARSET);
- break;
-
- case ::dbaccess::DST_LDAP:
- _out_rDetailsIds.push_back(DSID_CONN_LDAP_BASEDN);
- _out_rDetailsIds.push_back(DSID_CONN_LDAP_ROWCOUNT);
- _out_rDetailsIds.push_back(DSID_CONN_LDAP_USESSL);
- break;
-
- case ::dbaccess::DST_JDBC:
- _out_rDetailsIds.push_back(DSID_JDBCDRIVERCLASS);
- break;
-
- case ::dbaccess::DST_ORACLE_JDBC:
- _out_rDetailsIds.push_back(DSID_JDBCDRIVERCLASS);
- _out_rDetailsIds.push_back(DSID_IGNORECURRENCY);
- break;
-
- default:
- break;
+ if ( aProperties.has(pProps->second) )
+ _out_rDetailsIds.push_back(pProps->first);
}
}
diff --git a/dbaccess/source/ui/dlg/DriverSettings.hxx b/dbaccess/source/ui/dlg/DriverSettings.hxx
index 29a68d35a5a5..154013a11bda 100644
--- a/dbaccess/source/ui/dlg/DriverSettings.hxx
+++ b/dbaccess/source/ui/dlg/DriverSettings.hxx
@@ -53,7 +53,7 @@ namespace dbaui
@param _out_rDetailsIds
Will be filled.
*/
- static void getSupportedIndirectSettings( ::dbaccess::DATASOURCE_TYPE _eType,::std::vector< sal_Int32>& _out_rDetailsIds );
+ static void getSupportedIndirectSettings( const ::rtl::OUString& _sURLPrefix,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xFactory,::std::vector< sal_Int32>& _out_rDetailsIds );
/** Creates the detail page for Dbase
*/
diff --git a/dbaccess/source/ui/dlg/UserAdminDlg.cxx b/dbaccess/source/ui/dlg/UserAdminDlg.cxx
index 63312762c7b8..204a57dc8758 100644
--- a/dbaccess/source/ui/dlg/UserAdminDlg.cxx
+++ b/dbaccess/source/ui/dlg/UserAdminDlg.cxx
@@ -180,7 +180,7 @@ DBG_NAME(OUserAdminDlg)
return m_pImpl->getDriver();
}
// -----------------------------------------------------------------------------
- ::dbaccess::DATASOURCE_TYPE OUserAdminDlg::getDatasourceType(const SfxItemSet& _rSet) const
+ ::rtl::OUString OUserAdminDlg::getDatasourceType(const SfxItemSet& _rSet) const
{
return m_pImpl->getDatasourceType(_rSet);
}
diff --git a/dbaccess/source/ui/dlg/adminpages.cxx b/dbaccess/source/ui/dlg/adminpages.cxx
index ff43481b847d..5b4d38dee215 100644
--- a/dbaccess/source/ui/dlg/adminpages.cxx
+++ b/dbaccess/source/ui/dlg/adminpages.cxx
@@ -183,7 +183,7 @@ namespace dbaui
return 0L;
}
// -----------------------------------------------------------------------
- sal_Bool OGenericAdministrationPage::getSelectedDataSource(::dbaccess::DATASOURCE_TYPE _eType,::rtl::OUString& _sReturn,::rtl::OUString& _sCurr)
+ sal_Bool OGenericAdministrationPage::getSelectedDataSource(::rtl::OUString& _sReturn,::rtl::OUString& _sCurr)
{
// collect all ODBC data source names
StringBag aOdbcDatasources;
@@ -202,7 +202,7 @@ namespace dbaui
{
aEnumeration.getDatasourceNames(aOdbcDatasources);
// excute the select dialog
- ODatasourceSelectDialog aSelector(GetParent(), aOdbcDatasources, _eType);
+ ODatasourceSelectDialog aSelector(GetParent(), aOdbcDatasources, false);
if (_sCurr.getLength())
aSelector.Select(_sCurr);
if ( RET_OK == aSelector.Execute() )
diff --git a/dbaccess/source/ui/dlg/adminpages.hxx b/dbaccess/source/ui/dlg/adminpages.hxx
index d1ef46a37cf1..d59ae3af8052 100644
--- a/dbaccess/source/ui/dlg/adminpages.hxx
+++ b/dbaccess/source/ui/dlg/adminpages.hxx
@@ -166,7 +166,7 @@ namespace dbaui
@return
<FALSE/> if an error occured, otherwise <TRUE/>
*/
- sal_Bool getSelectedDataSource(::dbaccess::DATASOURCE_TYPE _eType,::rtl::OUString& _sReturn,::rtl::OUString& _sCurr);
+ sal_Bool getSelectedDataSource(::rtl::OUString& _sReturn,::rtl::OUString& _sCurr);
// svt::IWizardPage
virtual void initializePage();
diff --git a/dbaccess/source/ui/dlg/advancedsettings.cxx b/dbaccess/source/ui/dlg/advancedsettings.cxx
index 7b930b81e4ab..7f0b5ee16515 100644
--- a/dbaccess/source/ui/dlg/advancedsettings.cxx
+++ b/dbaccess/source/ui/dlg/advancedsettings.cxx
@@ -417,7 +417,7 @@ namespace dbaui
delete pExampleSet;
pExampleSet = new SfxItemSet(*GetInputSetImpl());
- ::dbaccess::DATASOURCE_TYPE eType = m_pImpl->getDatasourceType(*_pItems);
+ const ::rtl::OUString eType = m_pImpl->getDatasourceType(*_pItems);
DataSourceMetaData aMeta( eType );
const AdvancedSettingsSupport& rAdvancedSupport( aMeta.getAdvancedSettingsSupport() );
@@ -443,9 +443,9 @@ namespace dbaui
}
// -----------------------------------------------------------------------
- bool AdvancedSettingsDialog::doesHaveAnyAdvancedSettings( ::dbaccess::DATASOURCE_TYPE _eType )
+ bool AdvancedSettingsDialog::doesHaveAnyAdvancedSettings( const ::rtl::OUString& _sURL )
{
- DataSourceMetaData aMeta( _eType );
+ DataSourceMetaData aMeta( _sURL );
const AdvancedSettingsSupport& rSupport( aMeta.getAdvancedSettingsSupport() );
if ( rSupport.bGeneratedValues || rSupport.supportsAnySpecialSetting() )
return true;
@@ -510,7 +510,7 @@ namespace dbaui
}
// -----------------------------------------------------------------------------
- ::dbaccess::DATASOURCE_TYPE AdvancedSettingsDialog::getDatasourceType(const SfxItemSet& _rSet) const
+ ::rtl::OUString AdvancedSettingsDialog::getDatasourceType(const SfxItemSet& _rSet) const
{
return m_pImpl->getDatasourceType(_rSet);
}
diff --git a/dbaccess/source/ui/dlg/datasourceui.cxx b/dbaccess/source/ui/dlg/datasourceui.cxx
index aa4c0e7f8444..f0a56e8dec83 100644
--- a/dbaccess/source/ui/dlg/datasourceui.cxx
+++ b/dbaccess/source/ui/dlg/datasourceui.cxx
@@ -52,12 +52,6 @@ namespace dbaui
//= DataSourceUI
//====================================================================
//--------------------------------------------------------------------
- DataSourceUI::DataSourceUI( ::dbaccess::DATASOURCE_TYPE _eType )
- :m_aDSMeta( DataSourceMetaData( _eType ) )
- {
- }
-
- //--------------------------------------------------------------------
DataSourceUI::DataSourceUI( const DataSourceMetaData& _rDSMeta )
:m_aDSMeta( _rDSMeta )
{
diff --git a/dbaccess/source/ui/dlg/datasourceui.hxx b/dbaccess/source/ui/dlg/datasourceui.hxx
index 9fa356503ed4..4ea63439c0d5 100644
--- a/dbaccess/source/ui/dlg/datasourceui.hxx
+++ b/dbaccess/source/ui/dlg/datasourceui.hxx
@@ -52,7 +52,6 @@ namespace dbaui
class DataSourceUI
{
public:
- DataSourceUI( ::dbaccess::DATASOURCE_TYPE _eType );
DataSourceUI( const DataSourceMetaData& _rDSMeta );
~DataSourceUI();
diff --git a/dbaccess/source/ui/dlg/dbadmin.cxx b/dbaccess/source/ui/dlg/dbadmin.cxx
index a28567c6b0af..4eefb05b7f89 100644
--- a/dbaccess/source/ui/dlg/dbadmin.cxx
+++ b/dbaccess/source/ui/dlg/dbadmin.cxx
@@ -181,7 +181,9 @@ void ODbAdminDialog::impl_selectDataSource(const ::com::sun::star::uno::Any& _aD
Reference< XPropertySet > xDatasource = m_pImpl->getCurrentDataSource();
impl_resetPages( xDatasource );
- ::dbaccess::DATASOURCE_TYPE eType = getDatasourceType(*getOutputSet());
+ DbuTypeCollectionItem* pCollectionItem = PTR_CAST(DbuTypeCollectionItem, getOutputSet()->GetItem(DSID_TYPECOLLECTION));
+ ::dbaccess::ODsnTypeCollection* pCollection = pCollectionItem->getCollection();
+ ::dbaccess::DATASOURCE_TYPE eType = pCollection->determineType(getDatasourceType(*getOutputSet()));
// and insert the new ones
switch ( eType )
@@ -282,8 +284,10 @@ void ODbAdminDialog::impl_resetPages(const Reference< XPropertySet >& _rxDatasou
pExampleSet = new SfxItemSet(*GetInputSetImpl());
// special case: MySQL Native does not have the generic PAGE_CONNECTION page
- ::dbaccess::DATASOURCE_TYPE eType = getDatasourceType( *pExampleSet );
- if ( eType == ::dbaccess::DST_MYSQL_NATIVE )
+
+ DbuTypeCollectionItem* pCollectionItem = PTR_CAST(DbuTypeCollectionItem, getOutputSet()->GetItem(DSID_TYPECOLLECTION));
+ ::dbaccess::ODsnTypeCollection* pCollection = pCollectionItem->getCollection();
+ if ( pCollection->determineType(getDatasourceType( *pExampleSet )) == ::dbaccess::DST_MYSQL_NATIVE )
{
LocalResourceAccess aDummy(DLG_DATABASE_ADMINISTRATION, RSC_TABDIALOG);
AddTabPage( PAGE_MYSQL_NATIVE, String( ModuleRes( STR_PAGETITLE_CONNECTION ) ), ODriversSettings::CreateMySQLNATIVE, NULL );
@@ -368,7 +372,7 @@ Reference< XDriver > ODbAdminDialog::getDriver()
return m_pImpl->getDriver();
}
// -----------------------------------------------------------------------------
-::dbaccess::DATASOURCE_TYPE ODbAdminDialog::getDatasourceType(const SfxItemSet& _rSet) const
+::rtl::OUString ODbAdminDialog::getDatasourceType(const SfxItemSet& _rSet) const
{
return m_pImpl->getDatasourceType(_rSet);
}
@@ -391,7 +395,7 @@ SfxItemSet* ODbAdminDialog::createItemSet(SfxItemSet*& _rpSet, SfxItemPool*& _rp
SfxPoolItem** pCounter = _rppDefaults; // want to modify this without affecting the out param _rppDefaults
*pCounter++ = new SfxStringItem(DSID_NAME, String());
*pCounter++ = new SfxStringItem(DSID_ORIGINALNAME, String());
- *pCounter++ = new SfxStringItem(DSID_CONNECTURL, _pTypeCollection ? _pTypeCollection->getDatasourcePrefix( ::dbaccess::DST_ADABAS ) : String());
+ *pCounter++ = new SfxStringItem(DSID_CONNECTURL, String());
*pCounter++ = new OStringListItem(DSID_TABLEFILTER, Sequence< ::rtl::OUString >(&sFilterAll, 1));
*pCounter++ = new DbuTypeCollectionItem(DSID_TYPECOLLECTION, _pTypeCollection);
*pCounter++ = new SfxBoolItem(DSID_INVALID_SELECTION, sal_False);
diff --git a/dbaccess/source/ui/dlg/dbwiz.cxx b/dbaccess/source/ui/dlg/dbwiz.cxx
index ff986cbcbd6f..c0b460cbb329 100644
--- a/dbaccess/source/ui/dlg/dbwiz.cxx
+++ b/dbaccess/source/ui/dlg/dbwiz.cxx
@@ -43,6 +43,7 @@
#ifndef _DBAUI_DATASOURCEITEMS_HXX_
#include "dsitems.hxx"
#endif
+#include "dsnItem.hxx"
#ifndef _SFXSTRITEM_HXX
#include <svtools/stritem.hxx>
#endif
@@ -153,6 +154,10 @@ ODbTypeWizDialog::ODbTypeWizDialog(Window* _pParent
m_pFinish->SetHelpId(HID_DBWIZ_FINISH);
m_pHelp->SetUniqueId(UID_DBWIZ_HELP);
// no local resources needed anymore
+
+ DbuTypeCollectionItem* pCollectionItem = PTR_CAST(DbuTypeCollectionItem, _pItems->GetItem(DSID_TYPECOLLECTION));
+ m_pCollection = pCollectionItem->getCollection();
+
FreeResource();
ActivatePage();
}
@@ -167,24 +172,9 @@ ODbTypeWizDialog::~ODbTypeWizDialog()
IMPL_LINK(ODbTypeWizDialog, OnTypeSelected, OGeneralPage*, _pTabPage)
{
m_eType = _pTabPage->GetSelectedType();
- switch(m_eType)
- {
- case ::dbaccess::DST_MOZILLA:
- case ::dbaccess::DST_OUTLOOK:
- case ::dbaccess::DST_OUTLOOKEXP:
- case ::dbaccess::DST_EVOLUTION:
- case ::dbaccess::DST_EVOLUTION_GROUPWISE:
- case ::dbaccess::DST_EVOLUTION_LDAP:
- case ::dbaccess::DST_KAB:
- case ::dbaccess::DST_MACAB:
- enableButtons(WZB_NEXT,sal_False);
- enableButtons(WZB_FINISH,sal_True);
- break;
- default:
- enableButtons(WZB_NEXT,sal_True);
- enableButtons(WZB_FINISH,sal_False);
- break;
- }
+ const bool bURLRequired = m_pCollection->isConnectionUrlRequired(m_eType);
+ enableButtons(WZB_NEXT,bURLRequired);
+ enableButtons(WZB_FINISH,!bURLRequired);
return 1L;
}
//-------------------------------------------------------------------------
@@ -194,7 +184,7 @@ WizardTypes::WizardState ODbTypeWizDialog::determineNextState( WizardState _nCur
switch(_nCurrentState)
{
case START_PAGE:
- switch(m_eType)
+ switch(m_pCollection->determineType(m_eType))
{
case ::dbaccess::DST_MOZILLA:
case ::dbaccess::DST_OUTLOOK:
@@ -215,7 +205,7 @@ WizardTypes::WizardState ODbTypeWizDialog::determineNextState( WizardState _nCur
}
break;
case CONNECTION_PAGE:
- switch(m_eType)
+ switch(m_pCollection->determineType(m_eType))
{
case ::dbaccess::DST_MOZILLA:
case ::dbaccess::DST_THUNDERBIRD:
@@ -295,7 +285,7 @@ Reference< XDriver > ODbTypeWizDialog::getDriver()
return m_pImpl->getDriver();
}
// -----------------------------------------------------------------------------
-::dbaccess::DATASOURCE_TYPE ODbTypeWizDialog::getDatasourceType(const SfxItemSet& _rSet) const
+::rtl::OUString ODbTypeWizDialog::getDatasourceType(const SfxItemSet& _rSet) const
{
return m_pImpl->getDatasourceType(_rSet);
}
@@ -409,6 +399,12 @@ sal_Bool ODbTypeWizDialog::saveDatasource()
SfxTabPage* pPage = static_cast<SfxTabPage*>(WizardDialog::GetPage(getCurrentState()));
if ( pPage )
pPage->FillItemSet(*m_pOutSet);
+
+ DataSourceInfoConverter aConverter(getORB());
+ ::rtl::OUString sOldURL;
+ if ( m_pImpl->getCurrentDataSource().is() )
+ m_pImpl->getCurrentDataSource()->getPropertyValue(PROPERTY_URL) >>= sOldURL;
+ aConverter.convert(m_pCollection,sOldURL,m_eType,m_pImpl->getCurrentDataSource());
return sal_True;
}
// -----------------------------------------------------------------------------
diff --git a/dbaccess/source/ui/dlg/dbwizsetup.cxx b/dbaccess/source/ui/dlg/dbwizsetup.cxx
index 6df5537544a4..9147ef69e9ad 100644
--- a/dbaccess/source/ui/dlg/dbwizsetup.cxx
+++ b/dbaccess/source/ui/dlg/dbwizsetup.cxx
@@ -161,32 +161,19 @@
#ifndef _COM_SUN_STAR_DOCUMENT_MACROEXECMODE_HPP_
#include <com/sun/star/document/MacroExecMode.hpp>
#endif
+#include <com/sun/star/ucb/IOErrorCode.hpp>
+#include <com/sun/star/task/XInteractionHandler.hpp>
+#include "com/sun/star/ui/dialogs/TemplateDescription.hpp"
+
+
/** === end UNO includes === **/
-#ifndef SVTOOLS_FILENOTATION_HXX_
#include <svtools/filenotation.hxx>
-#endif
-#ifndef _COMPHELPER_INTERACTION_HXX_
#include <comphelper/interaction.hxx>
-#endif
-#ifndef COMPHELPER_NAMEDVALUECOLLECTION_HXX
#include <comphelper/namedvaluecollection.hxx>
-#endif
-#ifndef _COMPHELPER_SEQUENCEASHASHMAP_HXX_
#include <comphelper/sequenceashashmap.hxx>
-#endif
-#ifndef TOOLS_DIAGNOSE_EX_H
#include <tools/diagnose_ex.h>
-#endif
-
-#ifndef _COM_SUN_STAR_UCB_IOERRORCODE_HPP_
-#include <com/sun/star/ucb/IOErrorCode.hpp>
-#endif
-#ifndef _COM_SUN_STAR_TASK_XINTERACTIONHANDLER_HPP_
-#include <com/sun/star/task/XInteractionHandler.hpp>
-#endif
-#include "com/sun/star/ui/dialogs/TemplateDescription.hpp"
-
+#include <connectivity/DriversConfig.hxx>
#include <memory>
@@ -197,6 +184,7 @@ namespace dbaui
//.........................................................................
using namespace dbtools;
using namespace svt;
+using namespace com::sun::star;
using namespace com::sun::star::uno;
using namespace com::sun::star::sdbc;
using namespace com::sun::star::sdbcx;
@@ -217,53 +205,34 @@ using namespace ::cppu;
#define CONNECTION_PAGE 1
-#define PAGE_DBSETUPWIZARD_INTRO 0
-#define PAGE_DBSETUPWIZARD_DBASE 1
-#define PAGE_DBSETUPWIZARD_TEXT 2
-#define PAGE_DBSETUPWIZARD_MSACCESS 3
-#define PAGE_DBSETUPWIZARD_LDAP 4
-#define PAGE_DBSETUPWIZARD_ADABAS 5
-#define PAGE_DBSETUPWIZARD_MYSQL_INTRO 6
-#define PAGE_DBSETUPWIZARD_MYSQL_JDBC 7
-#define PAGE_DBSETUPWIZARD_MYSQL_ODBC 8
-#define PAGE_DBSETUPWIZARD_ORACLE 9
-#define PAGE_DBSETUPWIZARD_JDBC 10
-#define PAGE_DBSETUPWIZARD_ADO 11
-#define PAGE_DBSETUPWIZARD_ODBC 12
-#define PAGE_DBSETUPWIZARD_SPREADSHEET 13
-#define PAGE_DBSETUPWIZARD_AUTHENTIFICATION 14
-#define PAGE_DBSETUPWIZARD_MOZILLA 15
-#define PAGE_DBSETUPWIZARD_FINAL 16
-#define PAGE_DBSETUPWIZARD_USERDEFINED 17
-#define PAGE_DBSETUPWIZARD_MYSQL_NATIVE 18
-
-
-#define DBASE_PATH 1
-#define TEXT_PATH 2
-#define MSACCESS_PATH 3
-#define LDAP_PATH 4
-#define ADABAS_PATH 5
-#define ADO_PATH 6
-#define JDBC_PATH 7
-#define ORACLE_PATH 8
-#define MYSQL_JDBC_PATH 9
-#define MYSQL_ODBC_PATH 10
-#define ODBC_PATH 11
-#define SPREADSHEET_PATH 12
-#define OUTLOOKEXP_PATH 13
-#define OUTLOOK_PATH 14
-#define MOZILLA_PATH 15
-#define EVOLUTION_PATH 16
-#define EVOLUTION_PATH_GROUPWISE 17
-#define EVOLUTION_PATH_LDAP 18
-#define KAB_PATH 19
-#define MACAB_PATH 20
-#define THUNDERBIRD_PATH 21
-#define CREATENEW_PATH 22
-#define USERDEFINED_PATH 23
-#define OPEN_DOC_PATH 24
-#define MSACCESS2007_PATH 25
-#define MYSQL_NATIVE_PATH 26
+
+
+//#define DBASE_PATH 1
+//#define TEXT_PATH 2
+//#define MSACCESS_PATH 3
+//#define LDAP_PATH 4
+//#define ADABAS_PATH 5
+//#define ADO_PATH 6
+//#define JDBC_PATH 7
+//#define ORACLE_PATH 8
+//#define MYSQL_JDBC_PATH 9
+//#define MYSQL_ODBC_PATH 10
+//#define ODBC_PATH 11
+//#define SPREADSHEET_PATH 12
+//#define OUTLOOKEXP_PATH 13
+//#define OUTLOOK_PATH 14
+//#define MOZILLA_PATH 15
+//#define EVOLUTION_PATH 16
+//#define EVOLUTION_PATH_GROUPWISE 17
+//#define EVOLUTION_PATH_LDAP 18
+//#define KAB_PATH 19
+//#define MACAB_PATH 20
+//#define THUNDERBIRD_PATH 21
+//#define CREATENEW_PATH 22
+//#define USERDEFINED_PATH 23
+//#define OPEN_DOC_PATH 24
+//#define MSACCESS2007_PATH 25
+//#define MYSQL_NATIVE_PATH 26
OFinalDBPageSetup* pFinalPage;
@@ -283,8 +252,6 @@ ODbTypeWizDialogSetup::ODbTypeWizDialogSetup(Window* _pParent
WZB_NEXT | WZB_PREVIOUS | WZB_FINISH | WZB_CANCEL | WZB_HELP )
, m_pOutSet(NULL)
- , m_eType( ::dbaccess::DST_UNKNOWN )
- , m_eOldType( ::dbaccess::DST_UNKNOWN )
, m_bResetting(sal_False)
, m_bApplied(sal_False)
, m_bUIEnabled( sal_True )
@@ -326,7 +293,7 @@ ODbTypeWizDialogSetup::ODbTypeWizDialogSetup(Window* _pParent
m_pOutSet = new SfxItemSet( *_pItems->GetPool(), _pItems->GetRanges() );
m_pImpl->translateProperties(xDatasource, *m_pOutSet);
- m_eType = m_pImpl->getDatasourceType(*m_pOutSet);
+// eType = m_pImpl->getDatasourceType(*m_pOutSet);
SetPageSizePixel(LogicToPixel(::Size(WIZARD_PAGE_X, WIZARD_PAGE_Y), MAP_APPFONT));
ShowButtonFixedLine(sal_True);
@@ -334,32 +301,23 @@ ODbTypeWizDialogSetup::ODbTypeWizDialogSetup(Window* _pParent
enableButtons(WZB_FINISH, sal_True);
enableAutomaticNextButtonState();
- declareAuthDepPath( ::dbaccess::DST_ADO, ADO_PATH, PAGE_DBSETUPWIZARD_INTRO, PAGE_DBSETUPWIZARD_ADO, PAGE_DBSETUPWIZARD_AUTHENTIFICATION, PAGE_DBSETUPWIZARD_FINAL, -1 );
- declareAuthDepPath( ::dbaccess::DST_DBASE, DBASE_PATH, PAGE_DBSETUPWIZARD_INTRO, PAGE_DBSETUPWIZARD_DBASE, PAGE_DBSETUPWIZARD_AUTHENTIFICATION, PAGE_DBSETUPWIZARD_FINAL, -1 );
- declareAuthDepPath( ::dbaccess::DST_FLAT, TEXT_PATH, PAGE_DBSETUPWIZARD_INTRO, PAGE_DBSETUPWIZARD_TEXT, PAGE_DBSETUPWIZARD_AUTHENTIFICATION, PAGE_DBSETUPWIZARD_FINAL, -1 );
- declarePath ( SPREADSHEET_PATH, PAGE_DBSETUPWIZARD_INTRO, PAGE_DBSETUPWIZARD_SPREADSHEET, PAGE_DBSETUPWIZARD_FINAL, -1 );
- declareAuthDepPath( ::dbaccess::DST_ODBC, ODBC_PATH, PAGE_DBSETUPWIZARD_INTRO, PAGE_DBSETUPWIZARD_ODBC, PAGE_DBSETUPWIZARD_AUTHENTIFICATION, PAGE_DBSETUPWIZARD_FINAL, -1 );
- declareAuthDepPath( ::dbaccess::DST_JDBC, JDBC_PATH, PAGE_DBSETUPWIZARD_INTRO, PAGE_DBSETUPWIZARD_JDBC, PAGE_DBSETUPWIZARD_AUTHENTIFICATION, PAGE_DBSETUPWIZARD_FINAL, -1 );
- declareAuthDepPath( ::dbaccess::DST_MYSQL_ODBC, MYSQL_ODBC_PATH, PAGE_DBSETUPWIZARD_INTRO, PAGE_DBSETUPWIZARD_MYSQL_INTRO, PAGE_DBSETUPWIZARD_MYSQL_ODBC, PAGE_DBSETUPWIZARD_AUTHENTIFICATION, PAGE_DBSETUPWIZARD_FINAL, -1 );
- declareAuthDepPath( ::dbaccess::DST_MYSQL_JDBC, MYSQL_JDBC_PATH, PAGE_DBSETUPWIZARD_INTRO, PAGE_DBSETUPWIZARD_MYSQL_INTRO, PAGE_DBSETUPWIZARD_MYSQL_JDBC, PAGE_DBSETUPWIZARD_AUTHENTIFICATION, PAGE_DBSETUPWIZARD_FINAL, -1 );
- declareAuthDepPath( ::dbaccess::DST_MYSQL_NATIVE, MYSQL_NATIVE_PATH, PAGE_DBSETUPWIZARD_INTRO, PAGE_DBSETUPWIZARD_MYSQL_INTRO, PAGE_DBSETUPWIZARD_MYSQL_NATIVE, PAGE_DBSETUPWIZARD_AUTHENTIFICATION, PAGE_DBSETUPWIZARD_FINAL, -1 );
- declareAuthDepPath( ::dbaccess::DST_ORACLE_JDBC, ORACLE_PATH, PAGE_DBSETUPWIZARD_INTRO, PAGE_DBSETUPWIZARD_ORACLE, PAGE_DBSETUPWIZARD_AUTHENTIFICATION, PAGE_DBSETUPWIZARD_FINAL, -1 );
- declareAuthDepPath( ::dbaccess::DST_ADABAS, ADABAS_PATH, PAGE_DBSETUPWIZARD_INTRO, PAGE_DBSETUPWIZARD_ADABAS, PAGE_DBSETUPWIZARD_AUTHENTIFICATION, PAGE_DBSETUPWIZARD_FINAL, -1 );
- declareAuthDepPath( ::dbaccess::DST_LDAP, LDAP_PATH, PAGE_DBSETUPWIZARD_INTRO, PAGE_DBSETUPWIZARD_LDAP, PAGE_DBSETUPWIZARD_AUTHENTIFICATION, PAGE_DBSETUPWIZARD_FINAL, -1 );
- declareAuthDepPath( ::dbaccess::DST_MSACCESS, MSACCESS_PATH, PAGE_DBSETUPWIZARD_INTRO, PAGE_DBSETUPWIZARD_MSACCESS, PAGE_DBSETUPWIZARD_AUTHENTIFICATION, PAGE_DBSETUPWIZARD_FINAL, -1 );
- declareAuthDepPath( ::dbaccess::DST_MSACCESS_2007, MSACCESS2007_PATH, PAGE_DBSETUPWIZARD_INTRO, PAGE_DBSETUPWIZARD_MSACCESS, PAGE_DBSETUPWIZARD_AUTHENTIFICATION, PAGE_DBSETUPWIZARD_FINAL, -1 );
- declareAuthDepPath( ::dbaccess::DST_OUTLOOKEXP, OUTLOOKEXP_PATH, PAGE_DBSETUPWIZARD_INTRO, PAGE_DBSETUPWIZARD_AUTHENTIFICATION, PAGE_DBSETUPWIZARD_FINAL, -1 );
- declareAuthDepPath( ::dbaccess::DST_OUTLOOK, OUTLOOK_PATH, PAGE_DBSETUPWIZARD_INTRO, PAGE_DBSETUPWIZARD_AUTHENTIFICATION, PAGE_DBSETUPWIZARD_FINAL, -1 );
- declareAuthDepPath( ::dbaccess::DST_MOZILLA, MOZILLA_PATH, PAGE_DBSETUPWIZARD_INTRO, PAGE_DBSETUPWIZARD_AUTHENTIFICATION, PAGE_DBSETUPWIZARD_FINAL, -1 );
- declareAuthDepPath( ::dbaccess::DST_THUNDERBIRD, THUNDERBIRD_PATH, PAGE_DBSETUPWIZARD_INTRO, PAGE_DBSETUPWIZARD_AUTHENTIFICATION, PAGE_DBSETUPWIZARD_FINAL, -1 );
- declareAuthDepPath( ::dbaccess::DST_EVOLUTION, EVOLUTION_PATH, PAGE_DBSETUPWIZARD_INTRO, PAGE_DBSETUPWIZARD_AUTHENTIFICATION, PAGE_DBSETUPWIZARD_FINAL, -1 );
- declareAuthDepPath( ::dbaccess::DST_EVOLUTION_GROUPWISE,EVOLUTION_PATH_GROUPWISE, PAGE_DBSETUPWIZARD_INTRO, PAGE_DBSETUPWIZARD_AUTHENTIFICATION, PAGE_DBSETUPWIZARD_FINAL, -1 );
- declareAuthDepPath( ::dbaccess::DST_EVOLUTION_LDAP, EVOLUTION_PATH_LDAP, PAGE_DBSETUPWIZARD_INTRO, PAGE_DBSETUPWIZARD_AUTHENTIFICATION, PAGE_DBSETUPWIZARD_FINAL, -1 );
- declareAuthDepPath( ::dbaccess::DST_KAB, KAB_PATH, PAGE_DBSETUPWIZARD_INTRO, PAGE_DBSETUPWIZARD_AUTHENTIFICATION, PAGE_DBSETUPWIZARD_FINAL, -1 );
- declareAuthDepPath( ::dbaccess::DST_MACAB, MACAB_PATH, PAGE_DBSETUPWIZARD_INTRO, PAGE_DBSETUPWIZARD_AUTHENTIFICATION, PAGE_DBSETUPWIZARD_FINAL, -1);
- declareAuthDepPath( getDefaultDatabaseType(),CREATENEW_PATH, PAGE_DBSETUPWIZARD_INTRO, PAGE_DBSETUPWIZARD_AUTHENTIFICATION, PAGE_DBSETUPWIZARD_FINAL, -1 );
- declareAuthDepPath( ::dbaccess::DST_USERDEFINE1, USERDEFINED_PATH, PAGE_DBSETUPWIZARD_INTRO, PAGE_DBSETUPWIZARD_USERDEFINED,PAGE_DBSETUPWIZARD_AUTHENTIFICATION, PAGE_DBSETUPWIZARD_FINAL, -1 );
- declarePath ( OPEN_DOC_PATH, PAGE_DBSETUPWIZARD_INTRO, -1 );
+ ::dbaccess::ODsnTypeCollection::TypeIterator aIter = m_pCollection->begin();
+ ::dbaccess::ODsnTypeCollection::TypeIterator aEnd = m_pCollection->end();
+ for(PathId i = 1;aIter != aEnd;++aIter,++i)
+ {
+ const ::rtl::OUString sURLPrefix = aIter.getURLPrefix();
+ svt::RoadmapWizardTypes::WizardPath aPath;
+ aPath.push_back(PAGE_DBSETUPWIZARD_INTRO);
+ m_pCollection->fillPageIds(sURLPrefix,aPath);
+ aPath.push_back(PAGE_DBSETUPWIZARD_AUTHENTIFICATION);
+ aPath.push_back(PAGE_DBSETUPWIZARD_FINAL);
+
+ declareAuthDepPath(sURLPrefix,i,aPath);
+ }
+
+ svt::RoadmapWizardTypes::WizardPath aPath;
+ aPath.push_back(PAGE_DBSETUPWIZARD_INTRO);
+ declarePath( static_cast<PathId>(m_pCollection->size()+1), aPath);
m_pPrevPage->SetHelpId(HID_DBWIZ_PREVIOUS);
m_pNextPage->SetHelpId(HID_DBWIZ_NEXT);
@@ -370,25 +328,20 @@ ODbTypeWizDialogSetup::ODbTypeWizDialogSetup(Window* _pParent
ActivatePage();
}
-void ODbTypeWizDialogSetup::declareAuthDepPath( ::dbaccess::DATASOURCE_TYPE _eType, PathId _nPathId, WizardState _nFirstState, ... )
+void ODbTypeWizDialogSetup::declareAuthDepPath( const ::rtl::OUString& _sURL, PathId _nPathId, const svt::RoadmapWizardTypes::WizardPath& _rPaths)
{
- bool bHasAuthentication = DataSourceMetaData::getAuthentication( _eType ) != AuthNone;
+ bool bHasAuthentication = DataSourceMetaData::getAuthentication( _sURL ) != AuthNone;
// collect the elements of the path
WizardPath aPath;
- va_list aStateList;
- va_start( aStateList, _nFirstState );
-
- WizardState nState = _nFirstState;
- while ( nState != WZS_INVALID_STATE )
+ svt::RoadmapWizardTypes::WizardPath::const_iterator aIter = _rPaths.begin();
+ svt::RoadmapWizardTypes::WizardPath::const_iterator aEnd = _rPaths.end();
+ for(;aIter != aEnd;++aIter)
{
- if ( bHasAuthentication || ( nState != PAGE_DBSETUPWIZARD_AUTHENTIFICATION ) )
- aPath.push_back( nState );
-
- nState = ::sal::static_int_cast< WizardState >( va_arg( aStateList, int ) );
- }
- va_end( aStateList );
+ if ( bHasAuthentication || ( *aIter != PAGE_DBSETUPWIZARD_AUTHENTIFICATION ) )
+ aPath.push_back( *aIter );
+ } // for(;aIter != aEnd;++aIter)
// call base method
::svt::RoadmapWizard::declarePath( _nPathId, aPath );
@@ -477,6 +430,41 @@ IMPL_LINK(ODbTypeWizDialogSetup, OnTypeSelected, OGeneralPage*, /*_pTabPage*/)
return 1L;
}
+void lcl_removeUnused(const ::comphelper::NamedValueCollection& _aOld,const ::comphelper::NamedValueCollection& _aNew,::comphelper::NamedValueCollection& _rDSInfo)
+{
+ _rDSInfo.merge(_aNew,true);
+ uno::Sequence< beans::NamedValue > aOldValues = _aOld.getNamedValues();
+ const beans::NamedValue* pIter = aOldValues.getConstArray();
+ const beans::NamedValue* pEnd = pIter + aOldValues.getLength();
+ for(;pIter != pEnd;++pIter)
+ {
+ if ( !_aNew.has(pIter->Name) )
+ {
+ _rDSInfo.remove(pIter->Name);
+ }
+ }
+}
+// -----------------------------------------------------------------------------
+void DataSourceInfoConverter::convert(const ::dbaccess::ODsnTypeCollection* _pCollection,const ::rtl::OUString& _sOldURLPrefix,const ::rtl::OUString& _sNewURLPrefix,const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xDatasource)
+{
+ if ( _pCollection->getPrefix(_sOldURLPrefix) == _pCollection->getPrefix(_sNewURLPrefix) )
+ return ;
+ uno::Sequence< beans::PropertyValue> aInfo;
+ _xDatasource->getPropertyValue(PROPERTY_INFO) >>= aInfo;
+ ::comphelper::NamedValueCollection aDS(aInfo);
+
+ ::connectivity::DriversConfig aDriverConfig(m_xFactory);
+ const ::comphelper::NamedValueCollection& aOldMetaData = aDriverConfig.getMetaData(_sOldURLPrefix);
+ const ::comphelper::NamedValueCollection& aOldProperties = aDriverConfig.getProperties(_sOldURLPrefix);
+
+ const ::comphelper::NamedValueCollection& aNewMetaData = aDriverConfig.getMetaData(_sNewURLPrefix);
+ const ::comphelper::NamedValueCollection& aNewProperties = aDriverConfig.getProperties(_sNewURLPrefix);
+
+ lcl_removeUnused(aOldMetaData,aNewMetaData,aDS);
+ lcl_removeUnused(aOldProperties,aNewProperties,aDS);
+ aDS >>= aInfo;
+ _xDatasource->setPropertyValue(PROPERTY_INFO,uno::makeAny(aInfo));
+}
//-------------------------------------------------------------------------
void ODbTypeWizDialogSetup::activateDatabasePath()
{
@@ -484,74 +472,28 @@ void ODbTypeWizDialogSetup::activateDatabasePath()
{
case OGeneralPage::eCreateNew:
{
- activatePath( CREATENEW_PATH, sal_True);
+ activatePath( static_cast<PathId>(m_pCollection->getIndexOf(m_pCollection->getEmbeddedDatabase()) + 1), sal_True);
enableState(PAGE_DBSETUPWIZARD_FINAL, sal_True );
enableButtons( WZB_FINISH, sal_True);
}
break;
case OGeneralPage::eConnectExternal:
{
- m_eType = VerifyDataSourceType(m_pGeneralPage->GetSelectedType());
- if (m_eType == ::dbaccess::DST_UNKNOWN)
- m_eType = m_eOldType;
-
- struct _map_type_to_path
- {
- ::dbaccess::DATASOURCE_TYPE eType;
- RoadmapWizardTypes::PathId nPathId;
- } aKnownTypesAndPaths[] = {
- { ::dbaccess::DST_DBASE, DBASE_PATH },
- { ::dbaccess::DST_ADO, ADO_PATH },
- { ::dbaccess::DST_FLAT, TEXT_PATH },
- { ::dbaccess::DST_CALC, SPREADSHEET_PATH },
- { ::dbaccess::DST_ODBC, ODBC_PATH },
- { ::dbaccess::DST_JDBC, JDBC_PATH },
- { ::dbaccess::DST_MYSQL_JDBC, MYSQL_JDBC_PATH },
- { ::dbaccess::DST_MYSQL_NATIVE, MYSQL_NATIVE_PATH },
- { ::dbaccess::DST_MYSQL_ODBC, MYSQL_ODBC_PATH },
- { ::dbaccess::DST_ORACLE_JDBC, ORACLE_PATH },
- { ::dbaccess::DST_ADABAS, ADABAS_PATH },
- { ::dbaccess::DST_LDAP, LDAP_PATH },
- { ::dbaccess::DST_MSACCESS, MSACCESS_PATH },
- { ::dbaccess::DST_MSACCESS_2007,MSACCESS2007_PATH },
- { ::dbaccess::DST_OUTLOOKEXP, OUTLOOKEXP_PATH },
- { ::dbaccess::DST_OUTLOOK, OUTLOOK_PATH },
- { ::dbaccess::DST_MOZILLA, MOZILLA_PATH },
- { ::dbaccess::DST_THUNDERBIRD, THUNDERBIRD_PATH },
- { ::dbaccess::DST_EVOLUTION, EVOLUTION_PATH },
- { ::dbaccess::DST_EVOLUTION_GROUPWISE, EVOLUTION_PATH_GROUPWISE },
- { ::dbaccess::DST_EVOLUTION_LDAP, EVOLUTION_PATH_LDAP },
- { ::dbaccess::DST_KAB, KAB_PATH },
- { ::dbaccess::DST_MACAB, MACAB_PATH },
- { ::dbaccess::DST_USERDEFINE1, USERDEFINED_PATH },
- { ::dbaccess::DST_USERDEFINE2, USERDEFINED_PATH },
- { ::dbaccess::DST_USERDEFINE3, USERDEFINED_PATH },
- { ::dbaccess::DST_USERDEFINE4, USERDEFINED_PATH },
- { ::dbaccess::DST_USERDEFINE5, USERDEFINED_PATH },
- { ::dbaccess::DST_USERDEFINE6, USERDEFINED_PATH },
- { ::dbaccess::DST_USERDEFINE7, USERDEFINED_PATH },
- { ::dbaccess::DST_USERDEFINE8, USERDEFINED_PATH },
- { ::dbaccess::DST_USERDEFINE9, USERDEFINED_PATH },
- { ::dbaccess::DST_USERDEFINE10, USERDEFINED_PATH }
- };
-
- size_t i = 0;
- for ( ; i < sizeof( aKnownTypesAndPaths ) / sizeof( aKnownTypesAndPaths[0] ); ++i )
- {
- if ( aKnownTypesAndPaths[i].eType == m_eType )
- {
- activatePath( aKnownTypesAndPaths[i].nPathId, sal_True);
- break;
- }
- }
- DBG_ASSERT( i < sizeof( aKnownTypesAndPaths ) / sizeof( aKnownTypesAndPaths[0] ),
- "ODbTypeWizDialogSetup::activateDatabasePath: unknown database type!" );
+ ::rtl::OUString sOld = m_sURL;
+ DataSourceInfoConverter aConverter(getORB());
+ m_sURL = m_pGeneralPage->GetSelectedType();
+ aConverter.convert(m_pCollection,sOld,m_sURL,m_pImpl->getCurrentDataSource());
+ ::dbaccess::DATASOURCE_TYPE eType = VerifyDataSourceType(m_pCollection->determineType(m_sURL));
+ if (eType == ::dbaccess::DST_UNKNOWN)
+ eType = m_pCollection->determineType(m_sOldURL);
+
+ activatePath( static_cast<PathId>(m_pCollection->getIndexOf(m_sURL) + 1), sal_True);
updateTypeDependentStates();
}
break;
case OGeneralPage::eOpenExisting:
{
- activatePath( OPEN_DOC_PATH, sal_True );
+ activatePath( static_cast<PathId>(m_pCollection->size() + 1), sal_True );
enableButtons( WZB_FINISH, m_pGeneralPage->GetSelectedDocument().sURL.Len() != 0 );
}
break;
@@ -574,12 +516,9 @@ void ODbTypeWizDialogSetup::updateTypeDependentStates()
{
bDoEnable = sal_True;
}
- else
+ else if ( m_sURL == m_sOldURL )
{
- if (m_eType == m_eOldType)
- {
- bDoEnable = m_bIsConnectable; //(sConnectURL.Len() != 0);
- }
+ bDoEnable = m_bIsConnectable;
}
enableState(PAGE_DBSETUPWIZARD_AUTHENTIFICATION, bDoEnable);
enableState(PAGE_DBSETUPWIZARD_FINAL, bDoEnable );
@@ -590,21 +529,7 @@ void ODbTypeWizDialogSetup::updateTypeDependentStates()
//-------------------------------------------------------------------------
sal_Bool ODbTypeWizDialogSetup::IsConnectionUrlRequired()
{
- switch ( m_eType )
- {
- case ::dbaccess::DST_KAB:
- case ::dbaccess::DST_MACAB:
- case ::dbaccess::DST_EVOLUTION:
- case ::dbaccess::DST_EVOLUTION_GROUPWISE:
- case ::dbaccess::DST_EVOLUTION_LDAP:
- case ::dbaccess::DST_OUTLOOK:
- case ::dbaccess::DST_OUTLOOKEXP:
- case ::dbaccess::DST_MOZILLA:
- case ::dbaccess::DST_THUNDERBIRD:
- return sal_False;
- default:
- return sal_True;
- }
+ return m_pCollection->isConnectionUrlRequired(m_sURL);
}
//-------------------------------------------------------------------------
@@ -675,10 +600,25 @@ Reference< XDriver > ODbTypeWizDialogSetup::getDriver()
// -----------------------------------------------------------------------------
-::dbaccess::DATASOURCE_TYPE ODbTypeWizDialogSetup::getDatasourceType(const SfxItemSet& _rSet) const
+::rtl::OUString ODbTypeWizDialogSetup::getDatasourceType(const SfxItemSet& _rSet) const
{
- ::dbaccess::DATASOURCE_TYPE LocDatabaseType = m_pImpl->getDatasourceType(_rSet);
- return VerifyDataSourceType(LocDatabaseType);
+ ::rtl::OUString sRet = m_pImpl->getDatasourceType(_rSet);
+ if (m_pMySQLIntroPage != NULL && m_pMySQLIntroPage->IsVisible() )
+ {
+ switch( m_pMySQLIntroPage->getMySQLMode() )
+ {
+ case OMySQLIntroPageSetup::VIA_JDBC:
+ sRet = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:mysql:jdbc:"));
+ break;
+ case OMySQLIntroPageSetup::VIA_NATIVE:
+ sRet = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:mysql:mysqlc:"));
+ break;
+ case OMySQLIntroPageSetup::VIA_ODBC:
+ sRet = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:mysql:odbc:"));
+ break;
+ }
+ }
+ return sRet;
}
// -----------------------------------------------------------------------------
@@ -725,16 +665,16 @@ TabPage* ODbTypeWizDialogSetup::createPage(WizardState _nState)
break;
case PAGE_DBSETUPWIZARD_MYSQL_ODBC:
- m_pOutSet->Put(SfxStringItem(DSID_CONNECTURL, m_pCollection->getDatasourcePrefix( ::dbaccess::DST_MYSQL_ODBC)));
+ m_pOutSet->Put(SfxStringItem(DSID_CONNECTURL, m_pCollection->getPrefix(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:mysql:odbc:")))));
pPage = OConnectionTabPageSetup::CreateODBCTabPage( this, *m_pOutSet);
break;
case PAGE_DBSETUPWIZARD_MYSQL_JDBC:
- m_pOutSet->Put(SfxStringItem(DSID_CONNECTURL, m_pCollection->getDatasourcePrefix( ::dbaccess::DST_MYSQL_JDBC)));
+ m_pOutSet->Put(SfxStringItem(DSID_CONNECTURL, m_pCollection->getPrefix(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:mysql:jdbc:")))));
pPage = OGeneralSpecialJDBCConnectionPageSetup::CreateMySQLJDBCTabPage( this, *m_pOutSet);
break;
case PAGE_DBSETUPWIZARD_MYSQL_NATIVE:
- m_pOutSet->Put(SfxStringItem(DSID_CONNECTURL, m_pCollection->getDatasourcePrefix( ::dbaccess::DST_MYSQL_NATIVE)));
+ m_pOutSet->Put(SfxStringItem(DSID_CONNECTURL, m_pCollection->getPrefix(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:mysql:mysqlc:")))));
pPage = OGeneralSpecialJDBCConnectionPageSetup::CreateMySQLNATIVETabPage( this, *m_pOutSet);
break;
@@ -788,7 +728,7 @@ TabPage* ODbTypeWizDialogSetup::createPage(WizardState _nState)
pPage->SetAdminDialog(this, this);
defaultButton( _nState == PAGE_DBSETUPWIZARD_FINAL ? WZB_FINISH : WZB_NEXT );
- enableButtons( WZB_FINISH, _nState == START_PAGE ? sal_False : sal_True);
+ enableButtons( WZB_FINISH, _nState == PAGE_DBSETUPWIZARD_FINAL );
enableButtons( WZB_NEXT, _nState == PAGE_DBSETUPWIZARD_FINAL ? sal_False : sal_True);
pPage->Show();
}
@@ -811,23 +751,22 @@ IMPL_LINK(ODbTypeWizDialogSetup, ImplModifiedHdl, OGenericAdministrationPage*, _
// -----------------------------------------------------------------------------
-IMPL_LINK(ODbTypeWizDialogSetup, ImplClickHdl, OMySQLIntroPageSetup*, /*_pMySQLIntroPageSetup*/)
+IMPL_LINK(ODbTypeWizDialogSetup, ImplClickHdl, OMySQLIntroPageSetup*, _pMySQLIntroPageSetup)
{
- const ::dbaccess::DATASOURCE_TYPE eType = getDatasourceType(*m_pOutSet);
- switch( eType )
+ ::rtl::OUString sURLPrefix;
+ switch( _pMySQLIntroPageSetup->getMySQLMode() )
{
- case ::dbaccess::DST_MYSQL_ODBC:
- activatePath( MYSQL_ODBC_PATH, sal_True);
+ case OMySQLIntroPageSetup::VIA_ODBC:
+ sURLPrefix = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:mysql:odbc:"));
break;
- case ::dbaccess::DST_MYSQL_JDBC:
- activatePath( MYSQL_JDBC_PATH, sal_True);
+ case OMySQLIntroPageSetup::VIA_JDBC:
+ sURLPrefix = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:mysql:jdbc:"));
break;
- case ::dbaccess::DST_MYSQL_NATIVE:
- activatePath( MYSQL_NATIVE_PATH, sal_True);
+ case OMySQLIntroPageSetup::VIA_NATIVE:
+ sURLPrefix = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:mysql:mysqlc:"));
break;
- default:
- ;
- }
+ } // switch( _pMySQLIntroPageSetup->getMySQLMode() )
+ activatePath( static_cast<PathId>(m_pCollection->getIndexOf(sURLPrefix) + 1), sal_True);
return sal_True;
}
@@ -856,17 +795,17 @@ IMPL_LINK(ODbTypeWizDialogSetup, OnSingleDocumentChosen, OGeneralPage*, /*_pGene
// -----------------------------------------------------------------------------
void ODbTypeWizDialogSetup::enterState(WizardState _nState)
{
- m_eType = m_pImpl->getDatasourceType(*m_pOutSet);
+ m_sURL = m_pImpl->getDatasourceType(*m_pOutSet);
RoadmapWizard::enterState(_nState);
switch(_nState)
{
case PAGE_DBSETUPWIZARD_INTRO:
- m_eOldType = m_eType;
+ m_sOldURL = m_sURL;
break;
case PAGE_DBSETUPWIZARD_FINAL:
enableButtons( WZB_FINISH, sal_True);
if ( pFinalPage )
- pFinalPage->enableTableWizardCheckBox(m_pCollection->supportsTableCreation(m_eType));
+ pFinalPage->enableTableWizardCheckBox(m_pCollection->supportsTableCreation(m_sURL));
break;
}
}
@@ -886,17 +825,12 @@ sal_Bool ODbTypeWizDialogSetup::leaveState(WizardState _nState)
{
if (_nState == PAGE_DBSETUPWIZARD_MYSQL_INTRO)
return sal_True;
- if ( _nState == PAGE_DBSETUPWIZARD_INTRO )
+ if ( _nState == PAGE_DBSETUPWIZARD_INTRO && m_sURL != m_sOldURL )
{
- OSL_ENSURE(m_eType != ::dbaccess::DST_UNKNOWN && m_eOldType != ::dbaccess::DST_UNKNOWN,"Type unknown");
- if ( m_eType != m_eOldType )
- resetPages(m_pImpl->getCurrentDataSource());
+ resetPages(m_pImpl->getCurrentDataSource());
}
SfxTabPage* pPage = static_cast<SfxTabPage*>(WizardDialog::GetPage(_nState));
- if ( pPage )
- return pPage->DeactivatePage(m_pOutSet) != 0;
- else
- return sal_False;
+ return pPage && pPage->DeactivatePage(m_pOutSet) != 0;
}
// -----------------------------------------------------------------------------
@@ -931,6 +865,7 @@ sal_Bool ODbTypeWizDialogSetup::SaveDatabaseDocument()
::comphelper::NamedValueCollection aArgs( xModel->getArgs() );
aArgs.put( "Overwrite", sal_Bool( sal_True ) );
aArgs.put( "InteractionHandler", xHandler );
+ aArgs.put( "MacroExecutionMode", MacroExecMode::USE_CONFIG );
::rtl::OUString sPath = m_pImpl->getDocumentUrl( *m_pOutSet );
xStore->storeAsURL( sPath, aArgs.getPropertyValues() );
@@ -980,39 +915,37 @@ sal_Bool ODbTypeWizDialogSetup::SaveDatabaseDocument()
}
//-------------------------------------------------------------------------
- ::dbaccess::DATASOURCE_TYPE ODbTypeWizDialogSetup::getDefaultDatabaseType() const
+ ::rtl::OUString ODbTypeWizDialogSetup::getDefaultDatabaseType() const
{
- ::dbaccess::DATASOURCE_TYPE eRet = ::dbaccess::DST_DBASE;
-
- ::rtl::OUString sURL = m_pCollection->getDatasourcePrefix( ::dbaccess::DST_EMBEDDED_HSQLDB );
- Reference< XDriverAccess > xDriverManager( getORB()->createInstance( SERVICE_SDBC_DRIVERMANAGER ), UNO_QUERY );
- if ( xDriverManager.is() && xDriverManager->getDriverByURL( sURL ).is() )
- eRet = ::dbaccess::DST_EMBEDDED_HSQLDB;
+ ::rtl::OUString sEmbeddedURL = m_pCollection->getEmbeddedDatabase();
+ ::connectivity::DriversConfig aDriverConfig(getORB());
+ if ( !aDriverConfig.getDriverFactoryName(sEmbeddedURL).getLength() )
+ sEmbeddedURL = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:dbase:"));
- return eRet;
+ return sEmbeddedURL;
}
//-------------------------------------------------------------------------
void ODbTypeWizDialogSetup::CreateDatabase()
{
::rtl::OUString sUrl;
- ::dbaccess::DATASOURCE_TYPE eType = getDefaultDatabaseType();
- if ( eType == ::dbaccess::DST_EMBEDDED_HSQLDB )
+ ::rtl::OUString eType = getDefaultDatabaseType();
+ if ( m_pCollection->isEmbeddedDatabase(eType) )
{
- sUrl = m_pCollection->getDatasourcePrefix( ::dbaccess::DST_EMBEDDED_HSQLDB );
+ sUrl = eType;
Reference< XPropertySet > xDatasource = m_pImpl->getCurrentDataSource();
OSL_ENSURE(xDatasource.is(),"DataSource is null!");
if ( xDatasource.is() )
- xDatasource->setPropertyValue( PROPERTY_INFO, makeAny( m_pCollection->getDefaultDBSettings( ::dbaccess::DST_EMBEDDED_HSQLDB ) ) );
+ xDatasource->setPropertyValue( PROPERTY_INFO, makeAny( m_pCollection->getDefaultDBSettings( eType ) ) );
m_pImpl->translateProperties(xDatasource,*m_pOutSet);
}
- if ( eType == ::dbaccess::DST_DBASE )
+ else if ( m_pCollection->isFileSystemBased(eType) )
{
Reference< XSimpleFileAccess > xSimpleFileAccess(getORB()->createInstance(::rtl::OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" )), UNO_QUERY);
INetURLObject aDBPathURL(m_sWorkPath);
aDBPathURL.Append(m_aDocURL.getBase());
createUniqueFolderName(&aDBPathURL);
- ::rtl::OUString sPrefix = m_pCollection->getDatasourcePrefix( ::dbaccess::DST_DBASE);
+ ::rtl::OUString sPrefix = eType;
sUrl = aDBPathURL.GetMainURL( INetURLObject::NO_DECODE);
xSimpleFileAccess->createFolder(sUrl);
//OFileNotation aFileNotation(sUrl);
diff --git a/dbaccess/source/ui/dlg/detailpages.cxx b/dbaccess/source/ui/dlg/detailpages.cxx
index 6e65fbe5d253..c264e760a2f7 100644
--- a/dbaccess/source/ui/dlg/detailpages.cxx
+++ b/dbaccess/source/ui/dlg/detailpages.cxx
@@ -528,7 +528,7 @@ namespace dbaui
//========================================================================
//= OMySQLJDBCDetailsPage
//========================================================================
- OGeneralSpecialJDBCDetailsPage::OGeneralSpecialJDBCDetailsPage( Window* pParent,USHORT _nResId, const SfxItemSet& _rCoreAttrs ,USHORT _nPortId, const char* _pDriverName)
+ OGeneralSpecialJDBCDetailsPage::OGeneralSpecialJDBCDetailsPage( Window* pParent,USHORT _nResId, const SfxItemSet& _rCoreAttrs ,USHORT _nPortId)
:OCommonBehaviourTabPage(pParent, _nResId, _rCoreAttrs, CBTP_USE_CHARSET ,false)
,m_aFL_1 (this, ModuleRes( FL_SEPARATOR1) )
,m_aFTHostname (this, ModuleRes(FT_HOSTNAME))
@@ -543,12 +543,18 @@ namespace dbaui
,m_nPortId(_nPortId)
,m_bUseClass(true)
{
- if ( _pDriverName != NULL )
+ SFX_ITEMSET_GET(_rCoreAttrs, pUrlItem, SfxStringItem, DSID_CONNECTURL, sal_True);
+ SFX_ITEMSET_GET(_rCoreAttrs, pTypesItem, DbuTypeCollectionItem, DSID_TYPECOLLECTION, sal_True);
+ ::dbaccess::ODsnTypeCollection* pTypeCollection = pTypesItem ? pTypesItem->getCollection() : NULL;
+ if (pTypeCollection && pUrlItem && pUrlItem->GetValue().Len() )
+ {
+ m_sDefaultJdbcDriverName = pTypeCollection->getJavaDriverClass(pUrlItem->GetValue());
+ }
+ if ( m_sDefaultJdbcDriverName.Len() )
{
m_aEDDriverClass.SetModifyHdl(getControlModifiedLink());
m_aEDDriverClass.SetModifyHdl(LINK(this, OGeneralSpecialJDBCDetailsPage, OnEditModified));
m_aTestJavaDriver.SetClickHdl(LINK(this,OGeneralSpecialJDBCDetailsPage,OnTestJavaClickHdl));
- m_sDefaultJdbcDriverName = String::CreateFromAscii(_pDriverName);
}
else
{
@@ -814,7 +820,7 @@ namespace dbaui
// -----------------------------------------------------------------------
SfxTabPage* ODriversSettings::CreateMySQLJDBC( Window* pParent, const SfxItemSet& _rAttrSet )
{
- return ( new OGeneralSpecialJDBCDetailsPage( pParent,PAGE_MYSQL_JDBC, _rAttrSet,DSID_MYSQL_PORTNUMBER ,"com.mysql.jdbc.Driver") );
+ return ( new OGeneralSpecialJDBCDetailsPage( pParent,PAGE_MYSQL_JDBC, _rAttrSet,DSID_MYSQL_PORTNUMBER ) );
}
// -----------------------------------------------------------------------
SfxTabPage* ODriversSettings::CreateMySQLNATIVE( Window* pParent, const SfxItemSet& _rAttrSet )
@@ -825,7 +831,7 @@ namespace dbaui
// -----------------------------------------------------------------------
SfxTabPage* ODriversSettings::CreateOracleJDBC( Window* pParent, const SfxItemSet& _rAttrSet )
{
- return ( new OGeneralSpecialJDBCDetailsPage( pParent,PAGE_ORACLE_JDBC, _rAttrSet,DSID_ORACLE_PORTNUMBER,"oracle.jdbc.driver.OracleDriver" ) );
+ return ( new OGeneralSpecialJDBCDetailsPage( pParent,PAGE_ORACLE_JDBC, _rAttrSet,DSID_ORACLE_PORTNUMBER) );
}
@@ -1181,7 +1187,7 @@ namespace dbaui
//------------------------------------------------------------------------
SfxTabPage* ODriversSettings::CreateSpecialSettingsPage( Window* _pParent, const SfxItemSet& _rAttrSet )
{
- ::dbaccess::DATASOURCE_TYPE eType = ODbDataSourceAdministrationHelper::getDatasourceType( _rAttrSet );
+ ::rtl::OUString eType = ODbDataSourceAdministrationHelper::getDatasourceType( _rAttrSet );
DataSourceMetaData aMetaData( eType );
return new SpecialSettingsPage( _pParent, _rAttrSet, aMetaData );
}
diff --git a/dbaccess/source/ui/dlg/detailpages.hxx b/dbaccess/source/ui/dlg/detailpages.hxx
index 6d42f163a57b..7eeefd90e9c0 100644
--- a/dbaccess/source/ui/dlg/detailpages.hxx
+++ b/dbaccess/source/ui/dlg/detailpages.hxx
@@ -220,7 +220,7 @@ namespace dbaui
, USHORT _nResId
, const SfxItemSet& _rCoreAttrs
, USHORT _nPortId
- , const char* _pDriverName);
+ );
protected:
diff --git a/dbaccess/source/ui/dlg/dsselect.cxx b/dbaccess/source/ui/dlg/dsselect.cxx
index 7c67ebda24bf..e21417ffdb0c 100644
--- a/dbaccess/source/ui/dlg/dsselect.cxx
+++ b/dbaccess/source/ui/dlg/dsselect.cxx
@@ -107,7 +107,7 @@ using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::ui::dialogs;
using namespace ::comphelper;
//==================================================================
-ODatasourceSelectDialog::ODatasourceSelectDialog(Window* _pParent, const StringBag& _rDatasources, ::dbaccess::DATASOURCE_TYPE _eType,SfxItemSet* _pOutputSet)
+ODatasourceSelectDialog::ODatasourceSelectDialog(Window* _pParent, const StringBag& _rDatasources, bool _bAdabas,SfxItemSet* _pOutputSet)
:ModalDialog(_pParent, ModuleRes(DLG_DATASOURCE_SELECTION))
,m_aDescription (this, ModuleRes(FT_DESCRIPTION))
,m_aDatasource (this, ModuleRes(LB_DATASOURCE))
@@ -120,7 +120,7 @@ ODatasourceSelectDialog::ODatasourceSelectDialog(Window* _pParent, const StringB
,m_aCreateAdabasDB (this, ModuleRes(PB_CREATE))
,m_pOutputSet(_pOutputSet)
{
- if ( ::dbaccess::DST_ADABAS == _eType)
+ if ( _bAdabas )
{ // set a new title (indicating that we're browsing local data sources only)
SetText(ModuleRes(STR_LOCAL_DATASOURCES));
m_aDescription.SetText(ModuleRes(STR_DESCRIPTION2));
@@ -158,7 +158,7 @@ ODatasourceSelectDialog::ODatasourceSelectDialog(Window* _pParent, const StringB
fillListBox(_rDatasources);
#ifdef HAVE_ODBC_ADMINISTRATION
// allow ODBC datasource managenment
- if ( ::dbaccess::DST_ODBC == _eType || ::dbaccess::DST_MYSQL_ODBC == _eType )
+ if ( !_bAdabas )
{
m_aManageDatasources.Show();
m_aManageDatasources.Enable();
diff --git a/dbaccess/source/ui/dlg/dsselect.hxx b/dbaccess/source/ui/dlg/dsselect.hxx
index 0a2bb0e7fe0a..c37121a170fe 100644
--- a/dbaccess/source/ui/dlg/dsselect.hxx
+++ b/dbaccess/source/ui/dlg/dsselect.hxx
@@ -72,7 +72,7 @@ protected:
#endif
public:
- ODatasourceSelectDialog( Window* _pParent, const StringBag& _rDatasources, ::dbaccess::DATASOURCE_TYPE _eType,SfxItemSet* _pOutputSet = NULL );
+ ODatasourceSelectDialog( Window* _pParent, const StringBag& _rDatasources, bool _bAdabas,SfxItemSet* _pOutputSet = NULL );
~ODatasourceSelectDialog();
inline String GetSelected() const { return m_aDatasource.GetSelectEntry();}
diff --git a/dbaccess/source/ui/dlg/generalpage.cxx b/dbaccess/source/ui/dlg/generalpage.cxx
index 63a914b8b3c7..66b36bd1a3f8 100644
--- a/dbaccess/source/ui/dlg/generalpage.cxx
+++ b/dbaccess/source/ui/dlg/generalpage.cxx
@@ -32,59 +32,26 @@
#include "precompiled_dbaccess.hxx"
#include "dsnItem.hxx"
-#ifndef _DBAUI_GENERALPAGE_HXX_
#include "generalpage.hxx"
-#endif
-#ifndef _DBHELPER_DBEXCEPTION_HXX_
#include <connectivity/dbexception.hxx>
-#endif
-#ifndef _DBU_DLG_HRC_
#include "dbu_dlg.hrc"
-#endif
-#ifndef _DBAUI_DBADMIN_HRC_
#include "dbadmin.hrc"
-#endif
-#ifndef _DBAUI_DATASOURCEITEMS_HXX_
#include "dsitems.hxx"
-#endif
-#ifndef DBACCESS_SHARED_DBUSTRINGS_HRC
#include "dbustrings.hrc"
-#endif
-#ifndef _DBAUI_DBADMIN_HXX_
#include "dbadmin.hxx"
-#endif
#include <sfx2/filedlghelper.hxx>
#include <sfx2/docfilt.hxx>
-#ifndef _VCL_STDTEXT_HXX
#include <vcl/stdtext.hxx>
-#endif
-#ifndef _DBAUI_LOCALRESACCESS_HXX_
#include "localresaccess.hxx"
-#endif
-#ifndef _SV_MSGBOX_HXX
#include <vcl/msgbox.hxx>
-#endif
-#ifndef _SFXSTRITEM_HXX
#include <svtools/stritem.hxx>
-#endif
-#ifndef _SV_WAITOBJ_HXX
+#include <connectivity/DriversConfig.hxx>
#include <vcl/waitobj.hxx>
-#endif
-#ifndef _COM_SUN_STAR_SDBC_XDRIVERACCESS_HPP_
#include <com/sun/star/sdbc/XDriverAccess.hpp>
-#endif
-#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_
#include <com/sun/star/beans/PropertyValue.hpp>
-#endif
-#ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_
#include <com/sun/star/uno/Sequence.hxx>
-#endif
-#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
#include <com/sun/star/container/XNameAccess.hpp>
-#endif
-#ifndef DBAUI_DRIVERSETTINGS_HXX
#include "DriverSettings.hxx"
-#endif
#include "UITools.hxx"
//.........................................................................
namespace dbaui
@@ -120,11 +87,11 @@ namespace dbaui
,m_sMySQLEntry (ModuleRes(STR_MYSQLENTRY))
,m_eOriginalCreationMode (eCreateNew)
,m_pCollection (NULL)
- ,m_eCurrentSelection ( ::dbaccess::DST_UNKNOWN)
,m_eNotSupportedKnownType ( ::dbaccess::DST_UNKNOWN)
,m_eLastMessage (smNone)
,m_bDisplayingInvalid (sal_False)
,m_bUserGrabFocus (sal_True)
+ ,m_bInitTypeList (true)
{
// fill the listbox with the UI descriptions for the possible types
// and remember the respective DSN prefixes
@@ -159,10 +126,10 @@ namespace dbaui
{
struct DisplayedType
{
- ::dbaccess::DATASOURCE_TYPE eType;
+ ::rtl::OUString eType;
String sDisplayName;
- DisplayedType( ::dbaccess::DATASOURCE_TYPE _eType, const String& _rDisplayName ) : eType( _eType ), sDisplayName( _rDisplayName ) { }
+ DisplayedType( const ::rtl::OUString& _eType, const String& _rDisplayName ) : eType( _eType ), sDisplayName( _rDisplayName ) { }
};
typedef ::std::vector< DisplayedType > DisplayedTypes;
@@ -178,69 +145,51 @@ namespace dbaui
//-------------------------------------------------------------------------
void OGeneralPage::initializeTypeList()
{
- m_pDatasourceType->Clear();
-
- Reference< XDriverAccess > xDriverManager;
-
- // get the driver manager, to ask it for all known URL prefixes
- DBG_ASSERT(m_xORB.is(), "OGeneralPage::initializeTypeList: have no service factory!");
- if (m_xORB.is())
- {
- {
- // if the connection pool (resp. driver manager) may be expensive to load if it is accessed the first time,
- // so display a wait cursor
- WaitObject aWaitCursor(GetParent());
- xDriverManager = Reference< XDriverAccess >(m_xORB->createInstance(SERVICE_SDBC_CONNECTIONPOOL), UNO_QUERY);
- if (!xDriverManager.is())
- xDriverManager = Reference< XDriverAccess >(m_xORB->createInstance(SERVICE_SDBC_DRIVERMANAGER), UNO_QUERY);
- }
- if (!xDriverManager.is())
- ShowServiceNotAvailableError(GetParent(), String(SERVICE_SDBC_DRIVERMANAGER), sal_True);
- }
-
- if ( m_pCollection )
+ if ( m_bInitTypeList )
{
- DisplayedTypes aDisplayedTypes;
+ m_bInitTypeList = false;
+ m_pDatasourceType->Clear();
- for ( ::dbaccess::ODsnTypeCollection::TypeIterator aTypeLoop = m_pCollection->begin();
- aTypeLoop != m_pCollection->end();
- ++aTypeLoop
- )
+ if ( m_pCollection )
{
- ::dbaccess::DATASOURCE_TYPE eType = aTypeLoop.getType();
-
- if ( xDriverManager.is() )
- { // we have a driver manager to check
- ::rtl::OUString sURLPrefix = m_pCollection->getDatasourcePrefix(eType);
- if (!xDriverManager->getDriverByURL(sURLPrefix).is())
- // we have no driver for this prefix
- // -> omit it
- continue;
- }
- String sDisplayName = aTypeLoop.getDisplayName();
- if ( m_pDatasourceType->GetEntryPos( sDisplayName ) == LISTBOX_ENTRY_NOTFOUND )
+ DisplayedTypes aDisplayedTypes;
+
+ ::dbaccess::ODsnTypeCollection::TypeIterator aEnd = m_pCollection->end();
+ for ( ::dbaccess::ODsnTypeCollection::TypeIterator aTypeLoop = m_pCollection->begin();
+ aTypeLoop != aEnd;
+ ++aTypeLoop
+ )
{
- if ( approveDataSourceType( eType, sDisplayName ) )
- aDisplayedTypes.push_back( DisplayedTypes::value_type( eType, sDisplayName ) );
+ const ::rtl::OUString sURLPrefix = aTypeLoop.getURLPrefix();
+ if ( sURLPrefix.getLength() )
+ {
+ String sDisplayName = aTypeLoop.getDisplayName();
+ if ( m_pDatasourceType->GetEntryPos( sDisplayName ) == LISTBOX_ENTRY_NOTFOUND
+ && approveDataSourceType( sURLPrefix, sDisplayName ) )
+ {
+ aDisplayedTypes.push_back( DisplayedTypes::value_type( sURLPrefix, sDisplayName ) );
+ }
+ }
}
- }
- ::std::sort( aDisplayedTypes.begin(), aDisplayedTypes.end(), DisplayedTypeLess() );
- for ( DisplayedTypes::const_iterator loop = aDisplayedTypes.begin();
- loop != aDisplayedTypes.end();
- ++loop
- )
- insertDatasourceTypeEntryData( loop->eType, loop->sDisplayName );
+ ::std::sort( aDisplayedTypes.begin(), aDisplayedTypes.end(), DisplayedTypeLess() );
+ DisplayedTypes::const_iterator aDisplayEnd = aDisplayedTypes.end();
+ for ( DisplayedTypes::const_iterator loop = aDisplayedTypes.begin();
+ loop != aDisplayEnd;
+ ++loop
+ )
+ insertDatasourceTypeEntryData( loop->eType, loop->sDisplayName );
+ } // if ( m_pCollection )
}
}
//-------------------------------------------------------------------------
- void OGeneralPage::setParentTitle(::dbaccess::DATASOURCE_TYPE _eSelectedType)
+ void OGeneralPage::setParentTitle(const ::rtl::OUString& _sURLPrefix)
{
if (!m_DBWizardMode)
{
- String sName = m_pCollection->getTypeDisplayName(_eSelectedType);
+ const String sName = m_pCollection->getTypeDisplayName(_sURLPrefix);
if ( m_pAdminDialog )
{
LocalResourceAccess aStringResAccess( PAGE_GENERAL, RSC_TABPAGE );
@@ -272,10 +221,10 @@ namespace dbaui
}
//-------------------------------------------------------------------------
- void OGeneralPage::switchMessage(const ::dbaccess::DATASOURCE_TYPE _eType)
+ void OGeneralPage::switchMessage(const ::rtl::OUString& _sURLPrefix)
{
SPECIAL_MESSAGE eMessage = smNone;
- if ( _eType == m_eNotSupportedKnownType )
+ if ( !_sURLPrefix.getLength()/*_eType == m_eNotSupportedKnownType*/ )
{
eMessage = smUnsupportedType;
}
@@ -299,12 +248,12 @@ namespace dbaui
}
//-------------------------------------------------------------------------
- void OGeneralPage::onTypeSelected(const ::dbaccess::DATASOURCE_TYPE _eType)
+ void OGeneralPage::onTypeSelected(const ::rtl::OUString& _sURLPrefix)
{
// the the new URL text as indicated by the selection history
- implSetCurrentType( _eType );
+ implSetCurrentType( _sURLPrefix );
- switchMessage(_eType);
+ switchMessage(_sURLPrefix);
if ( m_aTypeSelectHandler.IsSet() )
m_aTypeSelectHandler.Call(this);
@@ -382,16 +331,16 @@ namespace dbaui
sConnectURL = pUrlItem->GetValue();
}
- ::dbaccess::DATASOURCE_TYPE eOldSelection = m_eCurrentSelection;
+ ::rtl::OUString eOldSelection = m_eCurrentSelection;
m_eNotSupportedKnownType = ::dbaccess::DST_UNKNOWN;
- implSetCurrentType( ::dbaccess::DST_UNKNOWN );
+ implSetCurrentType( ::rtl::OUString() );
// compare the DSN prefix with the registered ones
String sDisplayName;
if (m_pCollection && bValid)
{
- implSetCurrentType( m_pCollection->getType(sConnectURL) );
+ implSetCurrentType( m_pCollection->getPrefix(sConnectURL) );
sDisplayName = m_pCollection->getTypeDisplayName(m_eCurrentSelection);
}
@@ -405,11 +354,11 @@ namespace dbaui
insertDatasourceTypeEntryData(m_eCurrentSelection, sDisplayName);
// remember this type so we can show the special message again if the user selects this
// type again (without changing the data source)
- m_eNotSupportedKnownType = m_eCurrentSelection;
+ m_eNotSupportedKnownType = m_pCollection->determineType(m_eCurrentSelection);
}
if (m_aRB_CreateDatabase.IsChecked() && m_DBWizardMode)
- sDisplayName = m_pCollection->getTypeDisplayName( ::dbaccess::DST_JDBC);
+ sDisplayName = m_pCollection->getTypeDisplayName( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("jdbc:")));
m_pDatasourceType->SelectEntry(sDisplayName);
// notify our listener that our type selection has changed (if so)
@@ -432,8 +381,9 @@ namespace dbaui
// representative for all MySQl databases)
// Also, embedded databases (embedded HSQL, at the moment), are not to appear in the list of
// databases to connect to.
- bool OGeneralPage::approveDataSourceType( ::dbaccess::DATASOURCE_TYPE eType, String& _inout_rDisplayName )
+ bool OGeneralPage::approveDataSourceType( const ::rtl::OUString& _sURLPrefix, String& _inout_rDisplayName )
{
+ const ::dbaccess::DATASOURCE_TYPE eType = m_pCollection->determineType(_sURLPrefix);
if ( m_DBWizardMode && ( eType == ::dbaccess::DST_MYSQL_JDBC ) )
_inout_rDisplayName = m_sMySQLEntry;
@@ -451,11 +401,13 @@ namespace dbaui
// -----------------------------------------------------------------------
- void OGeneralPage::insertDatasourceTypeEntryData(::dbaccess::DATASOURCE_TYPE _eType, String sDisplayName)
+ void OGeneralPage::insertDatasourceTypeEntryData(const ::rtl::OUString& _sType, String sDisplayName)
{
// insert a (temporary) entry
sal_uInt16 nPos = m_pDatasourceType->InsertEntry(sDisplayName);
- m_pDatasourceType->SetEntryData(nPos, reinterpret_cast<void*>(_eType));
+ if ( nPos >= m_aURLPrefixes.size() )
+ m_aURLPrefixes.resize(nPos+1);
+ m_aURLPrefixes[nPos] = _sType;
}
// -----------------------------------------------------------------------
@@ -480,7 +432,7 @@ namespace dbaui
}
//-------------------------------------------------------------------------
- void OGeneralPage::implSetCurrentType( const ::dbaccess::DATASOURCE_TYPE _eType )
+ void OGeneralPage::implSetCurrentType( const ::rtl::OUString& _eType )
{
if ( _eType == m_eCurrentSelection )
return;
@@ -492,7 +444,7 @@ namespace dbaui
void OGeneralPage::Reset(const SfxItemSet& _rCoreAttrs)
{
// reset all locale data
- implSetCurrentType( ::dbaccess::DST_UNKNOWN );
+ implSetCurrentType( ::rtl::OUString() );
// this ensures that our type selection link will be called, even if the new is is the same as the
// current one
OGenericAdministrationPage::Reset(_rCoreAttrs);
@@ -508,7 +460,7 @@ namespace dbaui
{
if ( m_aRB_CreateDatabase.IsChecked() )
{
- _rCoreAttrs.Put(SfxStringItem(DSID_CONNECTURL, m_pCollection->getDatasourcePrefix( ::dbaccess::DST_DBASE)));
+ _rCoreAttrs.Put(SfxStringItem(DSID_CONNECTURL, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:dbase:"))));
bChangedSomething = sal_True;
bCommitTypeSelection = false;
}
@@ -525,24 +477,24 @@ namespace dbaui
if ( bCommitTypeSelection )
{
USHORT nEntry = m_pDatasourceType->GetSelectEntryPos();
- ::dbaccess::DATASOURCE_TYPE eSelectedType = static_cast< ::dbaccess::DATASOURCE_TYPE>(reinterpret_cast<sal_IntPtr>(m_pDatasourceType->GetEntryData(nEntry)));
+ ::rtl::OUString sURLPrefix = m_aURLPrefixes[nEntry];
if (m_DBWizardMode)
{
if ( ( m_pDatasourceType->GetSavedValue() != nEntry )
|| ( GetDatabaseCreationMode() != m_eOriginalCreationMode )
)
{
- _rCoreAttrs.Put(SfxStringItem(DSID_CONNECTURL, m_pCollection->getDatasourcePrefix(eSelectedType)));
+ _rCoreAttrs.Put(SfxStringItem(DSID_CONNECTURL,sURLPrefix ));
bChangedSomething = sal_True;
}
else
- implSetCurrentType(eSelectedType);
+ implSetCurrentType(sURLPrefix);
}
else
{
if ( m_pDatasourceType->GetSavedValue() != nEntry)
{
- _rCoreAttrs.Put(SfxStringItem(DSID_CONNECTURL, m_pCollection->getDatasourcePrefix(eSelectedType)));
+ _rCoreAttrs.Put(SfxStringItem(DSID_CONNECTURL, sURLPrefix));
bChangedSomething = sal_True;
}
}
@@ -555,11 +507,11 @@ namespace dbaui
{
// get the type from the entry data
sal_Int16 nSelected = _pBox->GetSelectEntryPos();
- ::dbaccess::DATASOURCE_TYPE eSelectedType = static_cast< ::dbaccess::DATASOURCE_TYPE>(reinterpret_cast<sal_IntPtr>(_pBox->GetEntryData(nSelected)));
+ const ::rtl::OUString sURLPrefix = m_aURLPrefixes[nSelected];
- setParentTitle(eSelectedType);
+ setParentTitle(sURLPrefix);
// let the impl method do all the stuff
- onTypeSelected(eSelectedType);
+ onTypeSelected(sURLPrefix);
// tell the listener we were modified
callModifiedHdl();
// outta here
@@ -607,7 +559,8 @@ namespace dbaui
}
if ( aFileDlg.Execute() == ERRCODE_NONE )
{
- if ( aFileDlg.GetCurrentFilter() != pFilter->GetUIName() )
+ String sPath = aFileDlg.GetPath();
+ if ( aFileDlg.GetCurrentFilter() != pFilter->GetUIName() || !pFilter->GetWildcard().Matches(sPath) )
{
String sMessage(ModuleRes(STR_ERR_USE_CONNECT_TO));
InfoBox aError(this, sMessage);
@@ -616,7 +569,7 @@ namespace dbaui
OnSetupModeSelected(&m_aRB_GetExistingDatabase);
return 0L;
}
- m_aBrowsedDocument.sURL = aFileDlg.GetPath();
+ m_aBrowsedDocument.sURL = sPath;
m_aBrowsedDocument.sFilter = String();
m_aChooseDocumentHandler.Call( this );
return 1L;
diff --git a/dbaccess/source/ui/dlg/generalpage.hxx b/dbaccess/source/ui/dlg/generalpage.hxx
index 24f89ff3569f..973447460b14 100644
--- a/dbaccess/source/ui/dlg/generalpage.hxx
+++ b/dbaccess/source/ui/dlg/generalpage.hxx
@@ -102,11 +102,12 @@ namespace dbaui
::svt::ControlDependencyManager
m_aControlDependencies;
+ ::std::vector< ::rtl::OUString> m_aURLPrefixes;
::dbaccess::ODsnTypeCollection*
m_pCollection; /// the DSN type collection instance
- ::dbaccess::DATASOURCE_TYPE m_eCurrentSelection; /// currently selected type
+ ::rtl::OUString m_eCurrentSelection; /// currently selected type
::dbaccess::DATASOURCE_TYPE m_eNotSupportedKnownType; /// if a data source of an unsupported, but known type is encountered ....
enum SPECIAL_MESSAGE
@@ -122,8 +123,9 @@ namespace dbaui
Link m_aChooseDocumentHandler; /// to be called when a recent document has been definately chosen
sal_Bool m_bDisplayingInvalid : 1; // the currently displayed data source is deleted
sal_Bool m_bUserGrabFocus : 1;
- bool approveDataSourceType( ::dbaccess::DATASOURCE_TYPE eType, String& _inout_rDisplayName );
- void insertDatasourceTypeEntryData(::dbaccess::DATASOURCE_TYPE eType, String sDisplayName);
+ bool m_bInitTypeList : 1;
+ bool approveDataSourceType( const ::rtl::OUString& _sURLPrefix, String& _inout_rDisplayName );
+ void insertDatasourceTypeEntryData(const ::rtl::OUString& _sType, String sDisplayName);
public:
static SfxTabPage* Create(Window* pParent, const SfxItemSet& _rAttrSet, sal_Bool _bDBWizardMode = sal_False);
@@ -138,7 +140,7 @@ namespace dbaui
DocumentDescriptor GetSelectedDocument() const;
/// get the currently selected datasource type
- ::dbaccess::DATASOURCE_TYPE GetSelectedType() const { return m_eCurrentSelection; }
+ ::rtl::OUString GetSelectedType() const { return m_eCurrentSelection; }
protected:
// SfxTabPage overridables
@@ -156,15 +158,15 @@ namespace dbaui
protected:
- void onTypeSelected(const ::dbaccess::DATASOURCE_TYPE _eType);
+ void onTypeSelected(const ::rtl::OUString& _sURLPrefix);
void initializeTypeList();
- void implSetCurrentType( const ::dbaccess::DATASOURCE_TYPE _eType );
+ void implSetCurrentType( const ::rtl::OUString& _eType );
- void switchMessage(const ::dbaccess::DATASOURCE_TYPE _eType);
+ void switchMessage(const ::rtl::OUString& _sURLPrefix);
/// sets the the title of the parent dialog
- void setParentTitle(::dbaccess::DATASOURCE_TYPE _eSelectedType);
+ void setParentTitle(const ::rtl::OUString& _sURLPrefix);
DECL_LINK(OnDatasourceTypeSelected, ListBox*);
DECL_LINK(OnSetupModeSelected, RadioButton*);
diff --git a/dbaccess/source/ui/dlg/indexdialog.cxx b/dbaccess/source/ui/dlg/indexdialog.cxx
index 75a2ae2a1cde..ea082491e85b 100644
--- a/dbaccess/source/ui/dlg/indexdialog.cxx
+++ b/dbaccess/source/ui/dlg/indexdialog.cxx
@@ -102,8 +102,9 @@ namespace dbaui
return sal_False;
ConstIndexFieldsIterator aLeft = _rLHS.begin();
+ ConstIndexFieldsIterator aLeftEnd = _rLHS.end();
ConstIndexFieldsIterator aRight = _rRHS.begin();
- for (; aLeft != _rLHS.end(); ++aLeft, ++aRight)
+ for (; aLeft != aLeftEnd; ++aLeft, ++aRight)
{
if (*aLeft != *aRight)
return sal_False;
diff --git a/dbaccess/source/ui/dlg/makefile.mk b/dbaccess/source/ui/dlg/makefile.mk
index 0502de1c2880..ceeac9f8cdc7 100644
--- a/dbaccess/source/ui/dlg/makefile.mk
+++ b/dbaccess/source/ui/dlg/makefile.mk
@@ -78,10 +78,8 @@ SRC1FILES = \
CollectionView.src \
dlgattr.src \
advancedsettings.src\
- AdabasStatDlg.src \
UserAdminDlg.src \
sqlmessage.src \
- ExtensionNotPresent.src \
textconnectionsettings.src
@@ -109,7 +107,6 @@ EXCEPTIONSFILES= \
$(SLO)$/TextConnectionHelper.obj \
$(SLO)$/ConnectionPageSetup.obj \
$(SLO)$/DBSetupConnectionPages.obj \
- $(SLO)$/AdabasStatDlg.obj \
$(SLO)$/UserAdminDlg.obj \
$(SLO)$/UserAdmin.obj \
$(SLO)$/AdabasStat.obj \
@@ -121,7 +118,6 @@ EXCEPTIONSFILES= \
$(SLO)$/dbfindex.obj \
$(SLO)$/DriverSettings.obj \
$(SLO)$/odbcconfig.obj \
- $(SLO)$/ExtensionNotPresent.obj \
$(SLO)$/advancedsettings.obj \
$(SLO)$/datasourceui.obj \
$(SLO)$/textconnectionsettings.obj
diff --git a/dbaccess/source/ui/dlg/odbcconfig.cxx b/dbaccess/source/ui/dlg/odbcconfig.cxx
index d9dbef373ba4..2d13ac1f7bff 100644
--- a/dbaccess/source/ui/dlg/odbcconfig.cxx
+++ b/dbaccess/source/ui/dlg/odbcconfig.cxx
@@ -34,6 +34,7 @@
#ifndef _DBAUI_ODBC_CONFIG_HXX_
#include "odbcconfig.hxx"
#endif
+#include <rtl/bootstrap.hxx>
#ifndef _RTL_USTRING_HXX_
#include <rtl/ustring.hxx>
#endif
@@ -380,7 +381,8 @@ bool OOdbcManagement::manageDataSources_async()
// this is done in an external process, due to #i78733#
// (and note this whole functionality is supported on Windows only, ATM)
- ::rtl::OUString sExecutableName( RTL_CONSTASCII_USTRINGPARAM( "odbcconfig.exe" ) );
+ ::rtl::OUString sExecutableName( RTL_CONSTASCII_USTRINGPARAM( "$OOO_BASE_DIR/program/odbcconfig.exe" ) );
+ ::rtl::Bootstrap::expandMacros( sExecutableName ); //TODO: detect failure
oslProcess hProcessHandle(0);
oslProcessError eError = osl_executeProcess( sExecutableName.pData, NULL, 0, 0, NULL, NULL, NULL, 0, &hProcessHandle );
if ( eError != osl_Process_E_None )
diff --git a/dbaccess/source/ui/dlg/queryfilter.cxx b/dbaccess/source/ui/dlg/queryfilter.cxx
index 0241fab2a2c5..ff8ceca88ce6 100644
--- a/dbaccess/source/ui/dlg/queryfilter.cxx
+++ b/dbaccess/source/ui/dlg/queryfilter.cxx
@@ -6,9 +6,6 @@
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: queryfilter.cxx,v $
- * $Revision: 1.36.66.1 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
@@ -382,7 +379,16 @@ sal_Bool DlgFilterCrit::getCondition(const ListBox& _rField,const ListBox& _rCom
if ( xInfo->hasPropertyByName(PROPERTY_REALNAME) )
{
if ( xInfo->hasPropertyByName(PROPERTY_TABLENAME) )
+ {
xColumn->getPropertyValue(PROPERTY_TABLENAME) >>= sTableName;
+ if ( sTableName.getLength() )
+ {
+ // properly quote all parts of the table name, so e.g. <schema>.<table> becomes "<schema>"."<table>"
+ ::rtl::OUString aCatlog,aSchema,aTable;
+ ::dbtools::qualifiedNameComponents( m_xMetaData, sTableName, aCatlog, aSchema, aTable, ::dbtools::eInDataManipulation );
+ sTableName = ::dbtools::composeTableName( m_xMetaData, aCatlog, aSchema, aTable, sal_True, ::dbtools::eInDataManipulation );
+ }
+ }
xColumn->getPropertyValue(PROPERTY_REALNAME) >>= _rFilter.Name;
static ::rtl::OUString sAgg(RTL_CONSTASCII_USTRINGPARAM("AggregateFunction"));
if ( xInfo->hasPropertyByName(sAgg) )
@@ -398,7 +404,6 @@ sal_Bool DlgFilterCrit::getCondition(const ListBox& _rField,const ListBox& _rCom
if ( sTableName.getLength() )
{
static ::rtl::OUString sSep(RTL_CONSTASCII_USTRINGPARAM("."));
- sTableName = ::dbtools::quoteName(aQuote,sTableName);
sTableName += sSep;
sTableName += _rFilter.Name;
_rFilter.Name = sTableName;
diff --git a/dbaccess/source/ui/dlg/sqlmessage.cxx b/dbaccess/source/ui/dlg/sqlmessage.cxx
index cc8f01dd4daf..b27429092f60 100644
--- a/dbaccess/source/ui/dlg/sqlmessage.cxx
+++ b/dbaccess/source/ui/dlg/sqlmessage.cxx
@@ -539,14 +539,17 @@ void OSQLMessageBox::impl_positionControls()
{
OSL_PRECOND( !m_pImpl->aDisplayInfo.empty(), "OSQLMessageBox::impl_positionControls: nothing to display at all?" );
- const ExceptionDisplayInfo& rFirstInfo = *m_pImpl->aDisplayInfo.begin();
+
+ if ( m_pImpl->aDisplayInfo.empty() )
+ return;
const ExceptionDisplayInfo* pSecondInfo = NULL;
+
+ const ExceptionDisplayInfo& rFirstInfo = *m_pImpl->aDisplayInfo.begin();
if ( m_pImpl->aDisplayInfo.size() > 1 )
pSecondInfo = &m_pImpl->aDisplayInfo[1];
-
- // one or two texts to display?
String sPrimary, sSecondary;
sPrimary = rFirstInfo.sMessage;
+ // one or two texts to display?
if ( pSecondInfo )
{
// we show two elements in the main dialog if and only if one of
diff --git a/dbaccess/source/ui/inc/AdabasStatDlg.hxx b/dbaccess/source/ui/inc/AdabasStatDlg.hxx
deleted file mode 100644
index 68c95b3500f0..000000000000
--- a/dbaccess/source/ui/inc/AdabasStatDlg.hxx
+++ /dev/null
@@ -1,99 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: AdabasStatDlg.hxx,v $
- * $Revision: 1.8.68.1 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef DBAUI_ADABASSTATDLG_HXX
-#define DBAUI_ADABASSTATDLG_HXX
-
-#ifndef _SFXTABDLG_HXX
-#include <sfx2/tabdlg.hxx>
-#endif
-#ifndef _DBAUI_DSNTYPES_HXX_
-#include "dsntypes.hxx"
-#endif
-#ifndef DBAUI_ITEMSETHELPER_HXX
-#include "IItemSetHelper.hxx"
-#endif
-#ifndef _COMPHELPER_UNO3_HXX_
-#include <comphelper/uno3.hxx>
-#endif
-#ifndef _DBAUI_MODULE_DBU_HXX_
-#include "moduledbu.hxx"
-#endif
-#include <memory>
-
-FORWARD_DECLARE_INTERFACE(beans,XPropertySet)
-FORWARD_DECLARE_INTERFACE(sdbc,XConnection)
-FORWARD_DECLARE_INTERFACE(lang,XMultiServiceFactory)
-
-//.........................................................................
-namespace dbaui
-{
-//.........................................................................
- class ODbDataSourceAdministrationHelper;
- //=========================================================================
- //= OAdabasStatPageDlg
- //=========================================================================
-
- /** implements the adabas admin dialog
- */
- class OAdabasStatPageDlg : public SfxTabDialog, public IItemSetHelper, public IDatabaseSettingsDialog,public dbaui::OModuleClient
- {
- OModuleClient m_aModuleClient;
- ::std::auto_ptr<ODbDataSourceAdministrationHelper> m_pImpl;
- protected:
- virtual void PageCreated(USHORT _nId, SfxTabPage& _rPage);
- public:
- OAdabasStatPageDlg( Window* _pParent
- ,SfxItemSet* _pItems
- ,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB
- ,const ::com::sun::star::uno::Any& _aDataSourceName);
-
- virtual ~OAdabasStatPageDlg();
-
- virtual const SfxItemSet* getOutputSet() const;
- virtual SfxItemSet* getWriteOutputSet();
-
- virtual short Execute();
-
- // forwards to ODbDataSourceAdministrationHelper
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getORB() const;
- virtual ::std::pair< ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >,sal_Bool> createConnection();
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriver > getDriver();
- virtual ::dbaccess::DATASOURCE_TYPE getDatasourceType(const SfxItemSet& _rSet) const;
- virtual void clearPassword();
- virtual sal_Bool saveDatasource();
- virtual void setTitle(const ::rtl::OUString& _sTitle);
- virtual void enableConfirmSettings( bool _bEnable );
- };
-//.........................................................................
-} // namespace dbaui
-//.........................................................................
-
-#endif // DBAUI_ADABASSTATDLG_HXX
diff --git a/dbaccess/source/ui/inc/IItemSetHelper.hxx b/dbaccess/source/ui/inc/IItemSetHelper.hxx
index c4c2904487fe..4b040576d126 100644
--- a/dbaccess/source/ui/inc/IItemSetHelper.hxx
+++ b/dbaccess/source/ui/inc/IItemSetHelper.hxx
@@ -62,7 +62,7 @@ namespace dbaui
virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getORB() const = 0;
virtual ::std::pair< ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >,sal_Bool> createConnection() = 0;
virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriver > getDriver() = 0;
- virtual ::dbaccess::DATASOURCE_TYPE getDatasourceType(const SfxItemSet& _rSet) const = 0;
+ virtual ::rtl::OUString getDatasourceType(const SfxItemSet& _rSet) const = 0;
virtual void clearPassword() = 0;
virtual sal_Bool saveDatasource() = 0;
virtual void setTitle(const ::rtl::OUString& _sTitle) = 0;
diff --git a/dbaccess/source/ui/inc/IUpdateHelper.hxx b/dbaccess/source/ui/inc/IUpdateHelper.hxx
index acf4038fbcc0..aff1072153c1 100644
--- a/dbaccess/source/ui/inc/IUpdateHelper.hxx
+++ b/dbaccess/source/ui/inc/IUpdateHelper.hxx
@@ -30,6 +30,10 @@
#ifndef DBAUI_IUPDATEHELPER_HXX
#define DBAUI_IUPDATEHELPER_HXX
+#include <com/sun/star/util/Date.hpp>
+#include <com/sun/star/util/DateTime.hpp>
+#include <com/sun/star/util/Time.hpp>
+
namespace dbaui
{
class SAL_NO_VTABLE IUpdateHelper
@@ -39,6 +43,9 @@ namespace dbaui
virtual void updateDouble(sal_Int32 _nPos,const double& _nValue) = 0;
virtual void updateInt(sal_Int32 _nPos,const sal_Int32& _nValue) = 0;
virtual void updateNull(sal_Int32 _nPos, ::sal_Int32 sqlType) = 0;
+ virtual void updateDate(sal_Int32 _nPos,const ::com::sun::star::util::Date& _nValue) = 0;
+ virtual void updateTime(sal_Int32 _nPos,const ::com::sun::star::util::Time& _nValue) = 0;
+ virtual void updateTimestamp(sal_Int32 _nPos,const ::com::sun::star::util::DateTime& _nValue) = 0;
virtual void moveToInsertRow() = 0;
virtual void insertRow() = 0;
};
diff --git a/dbaccess/source/ui/inc/TableController.hxx b/dbaccess/source/ui/inc/TableController.hxx
index 7f9d3bc5eb7e..736fd7bdf6a8 100644
--- a/dbaccess/source/ui/inc/TableController.hxx
+++ b/dbaccess/source/ui/inc/TableController.hxx
@@ -60,7 +60,6 @@
#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
#include <com/sun/star/container/XNameAccess.hpp>
#endif
-#include "dsntypes.hxx"
class FixedText;
namespace dbaui
@@ -75,7 +74,6 @@ namespace dbaui
::std::vector< ::boost::shared_ptr<OTableRow> > m_vRowList;
OTypeInfoMap m_aTypeInfo;
::std::vector<OTypeInfoMap::iterator> m_aTypeInfoIndex;
- ::dbaccess::ODsnTypeCollection m_aTypeCollection;
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xTable;
diff --git a/dbaccess/source/ui/inc/TableFieldDescription.hxx b/dbaccess/source/ui/inc/TableFieldDescription.hxx
index a217f9af3eb5..80eeeff20dfa 100644
--- a/dbaccess/source/ui/inc/TableFieldDescription.hxx
+++ b/dbaccess/source/ui/inc/TableFieldDescription.hxx
@@ -131,10 +131,11 @@ namespace dbaui
sal_Bool HasCriteria() const
{
::std::vector< ::rtl::OUString>::const_iterator aIter = m_vecCriteria.begin();
- for(;aIter != m_vecCriteria.end();++aIter)
+ ::std::vector< ::rtl::OUString>::const_iterator aEnd = m_vecCriteria.end();
+ for(;aIter != aEnd;++aIter)
if(aIter->getLength())
break;
- return aIter != m_vecCriteria.end();
+ return aIter != aEnd;
}
const ::std::vector< ::rtl::OUString>& GetCriteria() const { return m_vecCriteria;}
diff --git a/dbaccess/source/ui/inc/TokenWriter.hxx b/dbaccess/source/ui/inc/TokenWriter.hxx
index 2eb162a05020..27a103e1af8a 100644
--- a/dbaccess/source/ui/inc/TokenWriter.hxx
+++ b/dbaccess/source/ui/inc/TokenWriter.hxx
@@ -173,7 +173,7 @@ namespace dbaui
class ORTFImportExport : public ODatabaseImportExport
{
-
+ void appendRow(::rtl::OString* pHorzChar,sal_Int32 _nColumnCount,sal_Int32& k,sal_Int32& kk);
public:
// export data
ORTFImportExport( const ::svx::ODataAccessDescriptor& _aDataDescriptor,
diff --git a/dbaccess/source/ui/inc/UserAdminDlg.hxx b/dbaccess/source/ui/inc/UserAdminDlg.hxx
index 0f482be4baf8..cf748240bb71 100644
--- a/dbaccess/source/ui/inc/UserAdminDlg.hxx
+++ b/dbaccess/source/ui/inc/UserAdminDlg.hxx
@@ -90,7 +90,7 @@ namespace dbaui
virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getORB() const;
virtual ::std::pair< ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >,sal_Bool> createConnection();
virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriver > getDriver();
- virtual ::dbaccess::DATASOURCE_TYPE getDatasourceType(const SfxItemSet& _rSet) const;
+ virtual ::rtl::OUString getDatasourceType(const SfxItemSet& _rSet) const;
virtual void clearPassword();
virtual sal_Bool saveDatasource();
virtual void setTitle(const ::rtl::OUString& _sTitle);
diff --git a/dbaccess/source/ui/inc/WCPage.hxx b/dbaccess/source/ui/inc/WCPage.hxx
index b367a07f5f45..09531e1990ee 100644
--- a/dbaccess/source/ui/inc/WCPage.hxx
+++ b/dbaccess/source/ui/inc/WCPage.hxx
@@ -66,6 +66,7 @@ namespace dbaui
RadioButton m_aRB_Def;
RadioButton m_aRB_View;
RadioButton m_aRB_AppendData;
+ CheckBox m_aCB_UseHeaderLine;
CheckBox m_aCB_PrimaryColumn;
FixedText m_aFT_KeyName;
Edit m_edKeyName;
@@ -75,6 +76,7 @@ namespace dbaui
OWizNormalExtend* m_pPage3;
BOOL m_bPKeyAllowed;
+ BOOL m_bUseHeaderAllowed;
DECL_LINK( AppendDataClickHdl, Button* );
@@ -99,13 +101,19 @@ namespace dbaui
inline BOOL IsOptionDef() const { return m_aRB_Def.IsChecked(); }
inline BOOL IsOptionAppendData() const { return m_aRB_AppendData.IsChecked(); }
inline BOOL IsOptionView() const { return m_aRB_View.IsChecked(); }
+ inline BOOL UseHeaderLine() const { return m_aCB_UseHeaderLine.IsChecked(); }
String GetKeyName() const { return m_edKeyName.GetText(); }
void setCreateStyleAction();
- void disallowViews()
+ inline void disallowViews()
{
m_aRB_View.Disable();
}
+ inline void disallowUseHeaderLine()
+ {
+ m_bUseHeaderAllowed = FALSE;
+ m_aCB_UseHeaderLine.Disable();
+ }
void setCreatePrimaryKey( bool _bDoCreate, const ::rtl::OUString& _rSuggestedName );
};
diff --git a/dbaccess/source/ui/inc/WCopyTable.hxx b/dbaccess/source/ui/inc/WCopyTable.hxx
index fa46608991da..37d0d870f538 100644
--- a/dbaccess/source/ui/inc/WCopyTable.hxx
+++ b/dbaccess/source/ui/inc/WCopyTable.hxx
@@ -314,6 +314,7 @@ namespace dbaui
sal_Int16 m_nOperation;
Wizard_Button_Style m_ePressed;
sal_Bool m_bCreatePrimaryKeyColumn;
+ sal_Bool m_bUseHeaderLine;
private:
DECL_LINK( ImplPrevHdl , PushButton* );
@@ -373,6 +374,8 @@ namespace dbaui
// when not the value is COLUMN_POSITION_NOT_FOUND == (sal_uInt32)-1
ODatabaseExport::TPositions GetColumnPositions() const { return m_vColumnPos; }
::std::vector<sal_Int32> GetColumnTypes() const { return m_vColumnTypes; }
+ sal_Bool UseHeaderLine() const { return m_bUseHeaderLine; }
+ void setUseHeaderLine(sal_Bool _bUseHeaderLine) { m_bUseHeaderLine = _bUseHeaderLine; }
void insertColumn(sal_Int32 _nPos,OFieldDescription* _pField);
diff --git a/dbaccess/source/ui/inc/advancedsettingsdlg.hxx b/dbaccess/source/ui/inc/advancedsettingsdlg.hxx
index 5f690f96893b..9e53c72c8614 100644
--- a/dbaccess/source/ui/inc/advancedsettingsdlg.hxx
+++ b/dbaccess/source/ui/inc/advancedsettingsdlg.hxx
@@ -72,7 +72,7 @@ namespace dbaui
virtual ~AdvancedSettingsDialog();
/// determines whether or not the given data source type has any advanced setting
- static bool doesHaveAnyAdvancedSettings( ::dbaccess::DATASOURCE_TYPE _eType );
+ static bool doesHaveAnyAdvancedSettings( const ::rtl::OUString& _sURL );
virtual const SfxItemSet* getOutputSet() const;
virtual SfxItemSet* getWriteOutputSet();
@@ -83,7 +83,7 @@ namespace dbaui
virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getORB() const;
virtual ::std::pair< ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >,sal_Bool> createConnection();
virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriver > getDriver();
- virtual ::dbaccess::DATASOURCE_TYPE getDatasourceType(const SfxItemSet& _rSet) const;
+ virtual ::rtl::OUString getDatasourceType(const SfxItemSet& _rSet) const;
virtual void clearPassword();
virtual sal_Bool saveDatasource();
virtual void setTitle(const ::rtl::OUString& _sTitle);
diff --git a/dbaccess/source/ui/inc/brwctrlr.hxx b/dbaccess/source/ui/inc/brwctrlr.hxx
index 381c70a2c0cd..1e796fbed624 100644
--- a/dbaccess/source/ui/inc/brwctrlr.hxx
+++ b/dbaccess/source/ui/inc/brwctrlr.hxx
@@ -71,7 +71,6 @@ namespace dbtools
namespace dbaui
{
-
// =========================================================================
typedef ::cppu::ImplInheritanceHelper9 < OGenericUnoController
@@ -115,6 +114,8 @@ namespace dbaui
::osl::Mutex m_aAsyncLoadSafety; // for multi-thread access to our members
OAsyncronousLink m_aAsyncGetCellFocus;
+ OAsyncronousLink m_aAsyncDisplayError;
+ ::dbtools::SQLExceptionInfo m_aCurrentError;
String m_sStateSaveRecord;
String m_sStateUndoRecord;
@@ -129,7 +130,6 @@ namespace dbaui
sal_Bool m_bLoadCanceled : 1; // the load was canceled somehow
sal_Bool m_bClosingKillOpen : 1; // are we killing the load thread because we are to be suspended ?
- sal_Bool m_bErrorOccured : 1; // see enter-/leaveFormAction
bool m_bCannotSelectUnfiltered : 1; // recieved an DATA_CANNOT_SELECT_UNFILTERED error
protected:
@@ -237,6 +237,8 @@ namespace dbaui
virtual void BeforeDrop();
virtual void AfterDrop();
+ public:
+
protected:
virtual ~SbaXDataBrowserController();
@@ -322,10 +324,7 @@ namespace dbaui
void enterFormAction();
void leaveFormAction();
- bool errorOccured() const { return m_bErrorOccured; }
- // As many form actions don't throw an exception but call their error handler instead we don't have
- // a chance to recognize errors by exception catching.
- // So for error recognition the above methods may be used.
+
// init the formatter if form changes
void initFormatter();
@@ -371,6 +370,8 @@ namespace dbaui
// (the alternative would be to lock the SolarMutex in OnOpenFinished to avoid problems with the needed updates,
// but playing with this mutex seems very hazardous to me ....)
DECL_LINK(OnAsyncGetCellFocus, void*);
+
+ DECL_LINK( OnAsyncDisplayError, void* );
};
//==================================================================
diff --git a/dbaccess/source/ui/inc/curledit.hxx b/dbaccess/source/ui/inc/curledit.hxx
index 1a4570512ec0..3bc7fa2b328f 100644
--- a/dbaccess/source/ui/inc/curledit.hxx
+++ b/dbaccess/source/ui/inc/curledit.hxx
@@ -40,6 +40,7 @@
#ifndef _DBAUI_DSNTYPES_HXX_
#include "dsntypes.hxx"
#endif
+#include <memory>
//.........................................................................
namespace dbaui
@@ -55,8 +56,8 @@ namespace dbaui
*/
class OConnectionURLEdit : public Edit
{
- ::dbaccess::ODsnTypeCollection
- m_aTypeCollection;
+ ::dbaccess::ODsnTypeCollection*
+ m_pTypeCollection;
FixedText* m_pForcedPrefix;
String m_sSaveValueNoPrefix;
BOOL m_bShowPrefix; // when <TRUE> the prefix will be visible, otherwise not
@@ -84,7 +85,7 @@ public:
inline void SaveValueNoPrefix() { m_sSaveValueNoPrefix = GetTextNoPrefix(); }
inline String GetSavedValueNoPrefix() const { return m_sSaveValueNoPrefix; }
- inline void initializeTypeCollection(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB) { m_aTypeCollection.initUserDriverTypes(_rxORB); }
+ inline void SetTypeCollection(::dbaccess::ODsnTypeCollection* _pTypeCollection) { m_pTypeCollection = _pTypeCollection; }
};
//.........................................................................
diff --git a/dbaccess/source/ui/inc/dbadmin.hxx b/dbaccess/source/ui/inc/dbadmin.hxx
index aae2b0af95f1..5c002747a1cc 100644
--- a/dbaccess/source/ui/inc/dbadmin.hxx
+++ b/dbaccess/source/ui/inc/dbadmin.hxx
@@ -105,7 +105,7 @@ public:
virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getORB() const;
virtual ::std::pair< ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >,sal_Bool> createConnection();
virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriver > getDriver();
- virtual ::dbaccess::DATASOURCE_TYPE getDatasourceType(const SfxItemSet& _rSet) const;
+ virtual ::rtl::OUString getDatasourceType(const SfxItemSet& _rSet) const;
virtual void clearPassword();
virtual sal_Bool saveDatasource();
virtual void setTitle(const ::rtl::OUString& _sTitle);
diff --git a/dbaccess/source/ui/inc/dbexchange.hxx b/dbaccess/source/ui/inc/dbexchange.hxx
index dd93d241a912..6627e3b2af1d 100644
--- a/dbaccess/source/ui/inc/dbexchange.hxx
+++ b/dbaccess/source/ui/inc/dbexchange.hxx
@@ -89,12 +89,11 @@ namespace dbaui
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB
);
- /** with this ctor, only the object descriptor format will be provided
- */
ODataClipboard(
const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxLivingForm,
const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& _rSelectedRows,
- const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _rxResultSet
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _rxResultSet,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB
);
DECLARE_XINTERFACE( )
diff --git a/dbaccess/source/ui/inc/dbu_misc.hrc b/dbaccess/source/ui/inc/dbu_misc.hrc
index 2a1ecb8b78da..0ee803edec10 100644
--- a/dbaccess/source/ui/inc/dbu_misc.hrc
+++ b/dbaccess/source/ui/inc/dbu_misc.hrc
@@ -34,9 +34,8 @@
#include "dbu_resource.hrc"
#endif
-
-#define STR_HTML_TITLE RID_STR_MISC_START
-#define STR_RTF_TITLE RID_STR_MISC_START + 1
+// free
+// free
#define STR_WIZ_COLUMN_SELECT_TITEL RID_STR_MISC_START + 2
#define STR_WIZ_TYPE_SELECT_TITEL RID_STR_MISC_START + 3
#define STR_WIZ_PKEY_ALREADY_DEFINED RID_STR_MISC_START + 4
diff --git a/dbaccess/source/ui/inc/dbu_resource.hrc b/dbaccess/source/ui/inc/dbu_resource.hrc
index 41ed7e0a7fe6..28917c91396a 100644
--- a/dbaccess/source/ui/inc/dbu_resource.hrc
+++ b/dbaccess/source/ui/inc/dbu_resource.hrc
@@ -392,7 +392,7 @@
// free
#define RSC_CHARSETS RID_UNTYPED_START + 2
-#define RSC_DATASOURCE_TYPE_UINAMES RID_UNTYPED_START + 3
+// free
#define RSC_QUERY_OBJECT_TYPE RID_UNTYPED_START + 4
#define IMG_TABLESUBCRIPTION_SC RID_UNTYPED_START + 5
#define IMG_TABLESUBCRIPTION_SCH RID_UNTYPED_START + 6
diff --git a/dbaccess/source/ui/inc/dbwiz.hxx b/dbaccess/source/ui/inc/dbwiz.hxx
index c0526a0d7533..dccb5109de83 100644
--- a/dbaccess/source/ui/inc/dbwiz.hxx
+++ b/dbaccess/source/ui/inc/dbwiz.hxx
@@ -77,7 +77,9 @@ private:
OModuleClient m_aModuleClient;
::std::auto_ptr<ODbDataSourceAdministrationHelper> m_pImpl;
SfxItemSet* m_pOutSet;
- ::dbaccess::DATASOURCE_TYPE m_eType;
+ ::dbaccess::ODsnTypeCollection*
+ m_pCollection; /// the DSN type collection instance
+ ::rtl::OUString m_eType;
sal_Bool m_bResetting : 1; /// sal_True while we're resetting the pages
sal_Bool m_bApplied : 1; /// sal_True if any changes have been applied while the dialog was executing
@@ -101,7 +103,7 @@ public:
virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getORB() const;
virtual ::std::pair< ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >,sal_Bool> createConnection();
virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriver > getDriver();
- virtual ::dbaccess::DATASOURCE_TYPE getDatasourceType(const SfxItemSet& _rSet) const;
+ virtual ::rtl::OUString getDatasourceType(const SfxItemSet& _rSet) const;
virtual void clearPassword();
virtual sal_Bool saveDatasource();
virtual void setTitle(const ::rtl::OUString& _sTitle);
diff --git a/dbaccess/source/ui/inc/dbwizsetup.hxx b/dbaccess/source/ui/inc/dbwizsetup.hxx
index b25bbad01a8e..2cf3577ba1c6 100644
--- a/dbaccess/source/ui/inc/dbwizsetup.hxx
+++ b/dbaccess/source/ui/inc/dbwizsetup.hxx
@@ -84,8 +84,8 @@ private:
OModuleClient m_aModuleClient;
::std::auto_ptr<ODbDataSourceAdministrationHelper> m_pImpl;
SfxItemSet* m_pOutSet;
- ::dbaccess::DATASOURCE_TYPE m_eType;
- ::dbaccess::DATASOURCE_TYPE m_eOldType;
+ ::rtl::OUString m_sURL;
+ ::rtl::OUString m_sOldURL;
sal_Bool m_bResetting : 1; /// sal_True while we're resetting the pages
sal_Bool m_bApplied : 1; /// sal_True if any changes have been applied while the dialog was executing
sal_Bool m_bUIEnabled : 1; /// <TRUE/> if the UI is enabled, false otherwise. Cannot be switched back to <TRUE/>, once it is <FALSE/>
@@ -131,7 +131,7 @@ public:
virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getORB() const;
virtual ::std::pair< ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >,sal_Bool> createConnection();
virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriver > getDriver();
- virtual ::dbaccess::DATASOURCE_TYPE getDatasourceType(const SfxItemSet& _rSet) const;
+ virtual ::rtl::OUString getDatasourceType(const SfxItemSet& _rSet) const;
virtual void clearPassword();
virtual void setTitle(const ::rtl::OUString& _sTitle);
virtual void enableConfirmSettings( bool _bEnable );
@@ -172,7 +172,7 @@ protected:
private:
/** declares a path with or without authentication, as indicated by the database type
- @param _eType
+ @param _sURL
the data source type for which the path is declared. If this
data source type does not support authentication, the PAGE_DBSETUPWIZARD_AUTHENTIFICATION
state will be stripped from the sequence of states.
@@ -182,7 +182,7 @@ private:
the first state in this path, following by an arbitrary number of others, as in
RoadmapWizard::declarePath.
*/
- void declareAuthDepPath( ::dbaccess::DATASOURCE_TYPE _eType, PathId _nPathId, WizardState _nFirstState, ... );
+ void declareAuthDepPath( const ::rtl::OUString& _sURL, PathId _nPathId, const svt::RoadmapWizardTypes::WizardPath& _rPaths);
void RegisterDataSourceByLocation(const ::rtl::OUString& sPath);
sal_Bool SaveDatabaseDocument();
@@ -192,7 +192,7 @@ private:
void createUniqueFolderName(INetURLObject* pURL);
::dbaccess::DATASOURCE_TYPE VerifyDataSourceType(const ::dbaccess::DATASOURCE_TYPE _DatabaseType) const;
- ::dbaccess::DATASOURCE_TYPE getDefaultDatabaseType() const;
+ ::rtl::OUString getDefaultDatabaseType() const;
void updateTypeDependentStates();
sal_Bool callSaveAsDialog();
diff --git a/dbaccess/source/ui/inc/dsmeta.hxx b/dbaccess/source/ui/inc/dsmeta.hxx
index 88053668a4ed..62ad79e80a67 100644
--- a/dbaccess/source/ui/inc/dsmeta.hxx
+++ b/dbaccess/source/ui/inc/dsmeta.hxx
@@ -70,7 +70,7 @@ namespace dbaui
class DataSourceMetaData
{
public:
- DataSourceMetaData( ::dbaccess::DATASOURCE_TYPE _eType );
+ DataSourceMetaData( const ::rtl::OUString& _sURL );
~DataSourceMetaData();
/// returns a struct describing this data source type's support for our known advanced settings
@@ -79,7 +79,7 @@ namespace dbaui
/// determines whether or not the data source requires authentication
AuthenticationMode getAuthentication() const;
- static AuthenticationMode getAuthentication( ::dbaccess::DATASOURCE_TYPE _eType );
+ static AuthenticationMode getAuthentication( const ::rtl::OUString& _sURL );
private:
::boost::shared_ptr< DataSourceMetaData_Impl > m_pImpl;
@@ -108,7 +108,6 @@ namespace dbaui
bool bBooleanComparisonMode;
bool bFormsCheckRequiredFields;
bool bIgnoreCurrency;
- bool bAutoIncrementIsPrimaryKey;
bool bEscapeDateTime;
// Note: If you extend this list, you need to adjust the ctor (of course)
@@ -130,7 +129,6 @@ namespace dbaui
,bBooleanComparisonMode ( true )
,bFormsCheckRequiredFields ( true )
,bIgnoreCurrency ( false )
- ,bAutoIncrementIsPrimaryKey ( false )
,bEscapeDateTime ( false )
{
}
@@ -158,7 +156,6 @@ namespace dbaui
|| ( bBooleanComparisonMode == true )
|| ( bFormsCheckRequiredFields == true )
|| ( bIgnoreCurrency == true )
- || ( bAutoIncrementIsPrimaryKey == true )
|| ( bEscapeDateTime == true )
;
}
diff --git a/dbaccess/source/ui/inc/sbagrid.hxx b/dbaccess/source/ui/inc/sbagrid.hxx
index 41e99ca0124b..60c879d3fbb7 100644
--- a/dbaccess/source/ui/inc/sbagrid.hxx
+++ b/dbaccess/source/ui/inc/sbagrid.hxx
@@ -299,6 +299,12 @@ namespace dbaui
virtual ::rtl::OUString GetAccessibleObjectDescription( ::svt::AccessibleBrowseBoxObjType eObjType,sal_Int32 _nPosition = -1) const;
virtual void DeleteSelectedRows();
+ /** copies the currently selected rows to the clipboard
+ @precond
+ at least one row is selected
+ */
+ void CopySelectedRowsToClipboard();
+
protected:
// DragSourceHelper overridables
@@ -348,6 +354,7 @@ namespace dbaui
private:
sal_Bool IsReadOnlyDB() const;
+ void implTransferSelectedRows( sal_Int16 nRowPos, bool _bTrueIfClipboardFalseIfDrag );
private:
using FmGridControl::AcceptDrop;
diff --git a/dbaccess/source/ui/inc/unodatbr.hxx b/dbaccess/source/ui/inc/unodatbr.hxx
index 9354aa943a93..c6315cc1db22 100644
--- a/dbaccess/source/ui/inc/unodatbr.hxx
+++ b/dbaccess/source/ui/inc/unodatbr.hxx
@@ -130,7 +130,6 @@ namespace dbaui
::com::sun::star::uno::Reference< ::com::sun::star::i18n::XCollator > m_xCollator;
::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xCurrentFrameParent;
::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xMainToolbar;
- ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xCurrentDatabaseDocument;
// ---------------------------
struct ExternalFeature
diff --git a/dbaccess/source/ui/misc/DExport.cxx b/dbaccess/source/ui/misc/DExport.cxx
index 880bb91b3727..aaa1e9ce1ff4 100644
--- a/dbaccess/source/ui/misc/DExport.cxx
+++ b/dbaccess/source/ui/misc/DExport.cxx
@@ -353,8 +353,8 @@ void ODatabaseExport::insertValueIntoColumn()
{
Reference< XNumberFormatsSupplier > xSupplier = m_xFormatter->getNumberFormatsSupplier();
Reference<XNumberFormatTypes> xNumType(xSupplier->getNumberFormats(),UNO_QUERY);
- sal_Int16 nFormats[] = { NumberFormat::DATETIME
- ,NumberFormat::DATETIME
+ sal_Int16 nFormats[] = {
+ NumberFormat::DATETIME
,NumberFormat::DATE
,NumberFormat::TIME
,NumberFormat::NUMBER
@@ -393,13 +393,17 @@ void ODatabaseExport::insertValueIntoColumn()
switch(nType)
{
case NumberFormat::DATE:
+ m_pUpdateHelper->updateDate(nPos,::dbtools::DBTypeConversion::toDate(fOutNumber,m_aNullDate));
+ break;
case NumberFormat::DATETIME:
- fOutNumber = ::dbtools::DBTypeConversion::toStandardDbDate(m_aNullDate,fOutNumber);
+ m_pUpdateHelper->updateTimestamp(nPos,::dbtools::DBTypeConversion::toDateTime(fOutNumber,m_aNullDate));
+ break;
+ case NumberFormat::TIME:
+ m_pUpdateHelper->updateTime(nPos,::dbtools::DBTypeConversion::toTime(fOutNumber));
break;
default:
- ;
+ m_pUpdateHelper->updateDouble(nPos,fOutNumber);
}
- m_pUpdateHelper->updateDouble(nPos,fOutNumber);//::dbtools::DBTypeConversion::getStandardDate()
}
catch(Exception&)
{
@@ -686,35 +690,7 @@ sal_Bool ODatabaseExport::createRowSet()
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "ODatabaseExport::createRowSet" );
DBG_CHKTHIS(ODatabaseExport,NULL);
- //Reference<XResultSet> xDestSet(m_xFactory->createInstance(::rtl::OUString::createFromAscii("com.sun.star.sdb.RowSet")),UNO_QUERY);
- //Reference<XPropertySet > xProp(xDestSet,UNO_QUERY);
- //if(xProp.is())
- //{
- // ::rtl::OUString sDestName = ::dbtools::composeTableName(
- // m_xConnection->getMetaData(), m_xTable, ::dbtools::eInDataManipulation, false, false, false );
-
- // xProp->setPropertyValue(PROPERTY_ACTIVE_CONNECTION,makeAny(m_xConnection.getTyped()));
- // xProp->setPropertyValue(PROPERTY_COMMAND_TYPE,makeAny(CommandType::TABLE));
- // xProp->setPropertyValue(PROPERTY_COMMAND,makeAny(sDestName));
- // xProp->setPropertyValue(PROPERTY_IGNORERESULT,::cppu::bool2any(sal_True));
- // xProp->setPropertyValue(PROPERTY_FETCHSIZE,sal_Int32(1));
- // Reference<XRowSet> xRowSet(xProp,UNO_QUERY);
- // xRowSet->execute();
-
- // Reference< XResultSetMetaDataSupplier> xSrcMetaSup(xRowSet,UNO_QUERY_THROW);
- // m_xResultSetMetaData = xSrcMetaSup->getMetaData();
-
- // if ( ::dbtools::canInsert(xProp) )
- // {
- // m_pUpdateHelper.reset(new ORowUpdateHelper(xRowSet));
- // OSL_ENSURE(m_xResultSetMetaData.is(),"No ResultSetMetaData!");
- // TPositions::iterator aIter = m_vColumns.begin();
- // for (;aIter != m_vColumns.end() ; ++aIter)
- // aIter->first = aIter->second;
- // }
- // else
- m_pUpdateHelper.reset(new OParameterUpdateHelper(createPreparedStatment(m_xConnection->getMetaData(),m_xTable,m_vColumns)));
- //}
+ m_pUpdateHelper.reset(new OParameterUpdateHelper(createPreparedStatment(m_xConnection->getMetaData(),m_xTable,m_vColumns)));
return m_pUpdateHelper.get() != NULL;
}
@@ -760,6 +736,7 @@ sal_Bool ODatabaseExport::executeWizard(const ::rtl::OUString& _rTableName,const
m_bIsAutoIncrement = aWizard.shouldCreatePrimaryKey();
m_vColumns = aWizard.GetColumnPositions();
m_vColumnTypes = aWizard.GetColumnTypes();
+ m_bAppendFirstLine = !aWizard.UseHeaderLine();
}
break;
default:
@@ -891,7 +868,8 @@ Reference< XPreparedStatement > ODatabaseExport::createPreparedStatment( const R
i = 1;
// create the sql string
- for (::std::vector< ::rtl::OUString>::iterator aInsertIter = aInsertList.begin(); aInsertIter != aInsertList.end(); ++aInsertIter)
+ ::std::vector< ::rtl::OUString>::iterator aInsertEnd = aInsertList.end();
+ for (::std::vector< ::rtl::OUString>::iterator aInsertIter = aInsertList.begin(); aInsertIter != aInsertEnd; ++aInsertIter)
{
if ( aInsertIter->getLength() )
{
diff --git a/dbaccess/source/ui/misc/RowSetDrop.cxx b/dbaccess/source/ui/misc/RowSetDrop.cxx
index 54b7c4cf36a6..53b1105c6aba 100644
--- a/dbaccess/source/ui/misc/RowSetDrop.cxx
+++ b/dbaccess/source/ui/misc/RowSetDrop.cxx
@@ -177,7 +177,8 @@ sal_Bool ORowSetImportExport::insertNewRow()
{
m_xTargetResultSetUpdate->moveToInsertRow();
sal_Int32 i = 1;
- for (::std::vector<sal_Int32>::iterator aIter = m_aColumnMapping.begin(); aIter != m_aColumnMapping.end() ;++aIter,++i )
+ ::std::vector<sal_Int32>::iterator aEnd = m_aColumnMapping.end();
+ for (::std::vector<sal_Int32>::iterator aIter = m_aColumnMapping.begin(); aIter != aEnd ;++aIter,++i )
{
if(*aIter > 0)
{
diff --git a/dbaccess/source/ui/misc/RtfReader.cxx b/dbaccess/source/ui/misc/RtfReader.cxx
index 34540ad11684..5ba41d439b3e 100644
--- a/dbaccess/source/ui/misc/RtfReader.cxx
+++ b/dbaccess/source/ui/misc/RtfReader.cxx
@@ -163,16 +163,17 @@ void ORTFReader::NextToken( int nToken )
break;
case RTF_TROWD:
{
- sal_uInt32 nTell = rInput.Tell(); // verndert vielleicht die Position des Streams
bool bInsertRow = true;
if ( !m_xTable.is() ) // erste Zeile als Header verwenden
{
+ sal_uInt32 nTell = rInput.Tell(); // verndert vielleicht die Position des Streams
+
m_bError = !CreateTable(nToken);
bInsertRow = m_bAppendFirstLine;
if ( m_bAppendFirstLine )
{
rInput.Seek(nTell);
- bInsertRow = true;
+ rInput.ResetError();
}
}
if ( bInsertRow && !m_bError)
@@ -333,7 +334,7 @@ sal_Bool ORTFReader::CreateTable(int nToken)
break;
}
}
- while((nTmpToken2 = GetNextToken()) != RTF_ROW && eState != SVPAR_ERROR && eState != SVPAR_ACCEPTED);
+ while((nTmpToken2 = GetNextToken()) != RTF_TROWD && eState != SVPAR_ERROR && eState != SVPAR_ACCEPTED);
sal_Bool bOk = !m_vDestVector.empty();
if(bOk)
diff --git a/dbaccess/source/ui/misc/TokenWriter.cxx b/dbaccess/source/ui/misc/TokenWriter.cxx
index 38643109d675..02765c333c21 100644
--- a/dbaccess/source/ui/misc/TokenWriter.cxx
+++ b/dbaccess/source/ui/misc/TokenWriter.cxx
@@ -95,6 +95,7 @@ const static char __FAR_DATA sFontFamily[] = "font-family: ";
const static char __FAR_DATA sFontSize[] = "font-size: ";
#define SBA_FORMAT_SELECTION_COUNT 4
+#define CELL_X 1437
DBG_NAME(ODatabaseImportExport)
//======================================================================
@@ -479,12 +480,9 @@ BOOL ORTFImportExport::Write()
(*m_pStream) << ";\\red255\\green255\\blue255;\\red192\\green192\\blue192;}"
<< ODatabaseImportExport::sNewLine;
- sal_Int32 nCellx = 1437;
::rtl::OString aTRRH("\\trrh-270\\pard\\intbl");
::rtl::OString aFS("\\fs20\\f0\\cf0\\cb2");
- ::rtl::OString aFS2("\\fs20\\f1\\cf0\\cb1");
::rtl::OString aCell1("\\clbrdrl\\brdrs\\brdrcf0\\clbrdrt\\brdrs\\brdrcf0\\clbrdrb\\brdrs\\brdrcf0\\clbrdrr\\brdrs\\brdrcf0\\clshdng10000\\clcfpat2\\cellx");
- ::rtl::OString aCell2("\\clbrdrl\\brdrs\\brdrcf2\\clbrdrt\\brdrs\\brdrcf2\\clbrdrb\\brdrs\\brdrcf2\\clbrdrr\\brdrs\\brdrcf2\\clshdng10000\\clcfpat1\\cellx");
(*m_pStream) << OOO_STRING_SVTOOLS_RTF_TROWD << OOO_STRING_SVTOOLS_RTF_TRGAPH;
m_pStream->WriteNumber(40);
@@ -508,7 +506,7 @@ BOOL ORTFImportExport::Write()
for( sal_Int32 i=1; i<=nCount; ++i )
{
(*m_pStream) << aCell1;
- m_pStream->WriteNumber(i*nCellx);
+ m_pStream->WriteNumber(i*CELL_X);
(*m_pStream) << ODatabaseImportExport::sNewLine;
}
@@ -572,65 +570,30 @@ BOOL ORTFImportExport::Write()
Reference< XRowSet > xRowSet(m_xRow,UNO_QUERY);
sal_Int32 k=1;
sal_Int32 kk=0;
- m_xResultSet->beforeFirst(); // set back before the first row
- while(m_xResultSet->next())
+ if(m_aSelection.getLength())
{
- if(!m_pRowMarker || m_pRowMarker[kk] == k)
+ const Any* pSelIter = m_aSelection.getConstArray();
+ const Any* pEnd = pSelIter + m_aSelection.getLength();
+ sal_Bool bContinue = sal_True;
+ for(;pSelIter != pEnd && bContinue;++pSelIter)
{
- ++kk;
- (*m_pStream) << OOO_STRING_SVTOOLS_RTF_TROWD << OOO_STRING_SVTOOLS_RTF_TRGAPH;
- m_pStream->WriteNumber(40);
- (*m_pStream) << ODatabaseImportExport::sNewLine;
-
- for ( sal_Int32 i=1; i<=nCount; ++i )
- {
- (*m_pStream) << aCell2;
- m_pStream->WriteNumber(i*nCellx);
- (*m_pStream) << ODatabaseImportExport::sNewLine;
- }
-
- (*m_pStream) << '{';
- (*m_pStream) << aTRRH;
- for ( sal_Int32 i=1; i<=nCount; ++i )
- {
- (*m_pStream) << ODatabaseImportExport::sNewLine;
- (*m_pStream) << '{';
- (*m_pStream) << pHorzChar[i-1];
+ sal_Int32 nPos = -1;
+ *pSelIter >>= nPos;
+ OSL_ENSURE(nPos != -1,"Invalid posiotion!");
+ bContinue = (m_xResultSet->absolute(nPos));
+ if ( bContinue )
+ appendRow(pHorzChar,nCount,k,kk);
- if ( bBold ) (*m_pStream) << OOO_STRING_SVTOOLS_RTF_B;
- if ( bItalic ) (*m_pStream) << OOO_STRING_SVTOOLS_RTF_I;
- if ( bUnderline ) (*m_pStream) << OOO_STRING_SVTOOLS_RTF_UL;
- if ( bStrikeout ) (*m_pStream) << OOO_STRING_SVTOOLS_RTF_STRIKE;
-
- (*m_pStream) << aFS2;
- (*m_pStream) << ' ';
-
- try
- {
- Reference<XPropertySet> xColumn(m_xRowSetColumns->getByIndex(i-1),UNO_QUERY_THROW);
- dbtools::FormattedColumnValue aFormatedValue(aContext,xRowSet,xColumn);
- ::rtl::OUString sValue = aFormatedValue.getFormattedValue();
- // m_xRow->getString(i);
- //if (!m_xRow->wasNull())
- if ( sValue.getLength() )
- RTFOutFuncs::Out_String(*m_pStream,sValue,m_eDestEnc);
- }
- catch (Exception&)
- {
- OSL_ENSURE(0,"RTF WRITE!");
- }
-
- (*m_pStream) << OOO_STRING_SVTOOLS_RTF_CELL;
- (*m_pStream) << '}';
- (*m_pStream) << ODatabaseImportExport::sNewLine;
- (*m_pStream) << OOO_STRING_SVTOOLS_RTF_PARD << OOO_STRING_SVTOOLS_RTF_INTBL;
- }
- (*m_pStream) << OOO_STRING_SVTOOLS_RTF_ROW << ODatabaseImportExport::sNewLine;
- (*m_pStream) << '}';
}
- ++k;
+ } // if(m_aSelection.getLength())
+ else
+ {
+ m_xResultSet->beforeFirst(); // set back before the first row
+ while(m_xResultSet->next())
+ {
+ appendRow(pHorzChar,nCount,k,kk);
+ }
}
-
delete [] pHorzChar;
}
@@ -638,6 +601,75 @@ BOOL ORTFImportExport::Write()
(*m_pStream) << (BYTE) 0;
return ((*m_pStream).GetError() == SVSTREAM_OK);
}
+// -----------------------------------------------------------------------------
+void ORTFImportExport::appendRow(::rtl::OString* pHorzChar,sal_Int32 _nColumnCount,sal_Int32& k,sal_Int32& kk)
+{
+ if(!m_pRowMarker || m_pRowMarker[kk] == k)
+ {
+ ++kk;
+ (*m_pStream) << OOO_STRING_SVTOOLS_RTF_TROWD << OOO_STRING_SVTOOLS_RTF_TRGAPH;
+ m_pStream->WriteNumber(40);
+ (*m_pStream) << ODatabaseImportExport::sNewLine;
+
+ static const ::rtl::OString aCell2("\\clbrdrl\\brdrs\\brdrcf2\\clbrdrt\\brdrs\\brdrcf2\\clbrdrb\\brdrs\\brdrcf2\\clbrdrr\\brdrs\\brdrcf2\\clshdng10000\\clcfpat1\\cellx");
+ static const ::rtl::OString aTRRH("\\trrh-270\\pard\\intbl");
+
+ for ( sal_Int32 i=1; i<=_nColumnCount; ++i )
+ {
+ (*m_pStream) << aCell2;
+ m_pStream->WriteNumber(i*CELL_X);
+ (*m_pStream) << ODatabaseImportExport::sNewLine;
+ }
+
+ const BOOL bBold = ( ::com::sun::star::awt::FontWeight::BOLD == m_aFont.Weight );
+ const BOOL bItalic = ( ::com::sun::star::awt::FontSlant_ITALIC == m_aFont.Slant );
+ const BOOL bUnderline = ( ::com::sun::star::awt::FontUnderline::NONE != m_aFont.Underline );
+ const BOOL bStrikeout = ( ::com::sun::star::awt::FontStrikeout::NONE != m_aFont.Strikeout );
+ static const ::rtl::OString aFS2("\\fs20\\f1\\cf0\\cb1");
+ ::comphelper::ComponentContext aContext(m_xFactory);
+ Reference< XRowSet > xRowSet(m_xRow,UNO_QUERY);
+
+ (*m_pStream) << '{';
+ (*m_pStream) << aTRRH;
+ for ( sal_Int32 i=1; i <= _nColumnCount; ++i )
+ {
+ (*m_pStream) << ODatabaseImportExport::sNewLine;
+ (*m_pStream) << '{';
+ (*m_pStream) << pHorzChar[i-1];
+
+ if ( bBold ) (*m_pStream) << OOO_STRING_SVTOOLS_RTF_B;
+ if ( bItalic ) (*m_pStream) << OOO_STRING_SVTOOLS_RTF_I;
+ if ( bUnderline ) (*m_pStream) << OOO_STRING_SVTOOLS_RTF_UL;
+ if ( bStrikeout ) (*m_pStream) << OOO_STRING_SVTOOLS_RTF_STRIKE;
+
+ (*m_pStream) << aFS2;
+ (*m_pStream) << ' ';
+
+ try
+ {
+ Reference<XPropertySet> xColumn(m_xRowSetColumns->getByIndex(i-1),UNO_QUERY_THROW);
+ dbtools::FormattedColumnValue aFormatedValue(aContext,xRowSet,xColumn);
+ ::rtl::OUString sValue = aFormatedValue.getFormattedValue();
+ // m_xRow->getString(i);
+ //if (!m_xRow->wasNull())
+ if ( sValue.getLength() )
+ RTFOutFuncs::Out_String(*m_pStream,sValue,m_eDestEnc);
+ }
+ catch (Exception&)
+ {
+ OSL_ENSURE(0,"RTF WRITE!");
+ }
+
+ (*m_pStream) << OOO_STRING_SVTOOLS_RTF_CELL;
+ (*m_pStream) << '}';
+ (*m_pStream) << ODatabaseImportExport::sNewLine;
+ (*m_pStream) << OOO_STRING_SVTOOLS_RTF_PARD << OOO_STRING_SVTOOLS_RTF_INTBL;
+ }
+ (*m_pStream) << OOO_STRING_SVTOOLS_RTF_ROW << ODatabaseImportExport::sNewLine;
+ (*m_pStream) << '}';
+ }
+ ++k;
+}
//-------------------------------------------------------------------
BOOL ORTFImportExport::Read()
{
diff --git a/dbaccess/source/ui/misc/UITools.cxx b/dbaccess/source/ui/misc/UITools.cxx
index 809f9c407e51..25a6299bae12 100644
--- a/dbaccess/source/ui/misc/UITools.cxx
+++ b/dbaccess/source/ui/misc/UITools.cxx
@@ -867,7 +867,8 @@ void fillTypeInfo( const Reference< ::com::sun::star::sdbc::XConnection>& _rxCo
_rTypeInfoIters.reserve(_rTypeInfoMap.size());
OTypeInfoMap::iterator aIter = _rTypeInfoMap.begin();
- for(;aIter != _rTypeInfoMap.end();++aIter)
+ OTypeInfoMap::iterator aEnd = _rTypeInfoMap.end();
+ for(;aIter != aEnd;++aIter)
_rTypeInfoIters.push_back(aIter);
// Close the result set/statement.
diff --git a/dbaccess/source/ui/misc/UpdateHelperImpl.hxx b/dbaccess/source/ui/misc/UpdateHelperImpl.hxx
index a0a9e63fc183..5a5633571722 100644
--- a/dbaccess/source/ui/misc/UpdateHelperImpl.hxx
+++ b/dbaccess/source/ui/misc/UpdateHelperImpl.hxx
@@ -60,6 +60,18 @@ namespace dbaui
{
m_xRowUpdate->updateDouble(_nPos, _nValue);
}
+ virtual void updateDate(sal_Int32 _nPos,const ::com::sun::star::util::Date& _nValue)
+ {
+ m_xRowUpdate->updateDate(_nPos, _nValue);
+ }
+ virtual void updateTime(sal_Int32 _nPos,const ::com::sun::star::util::Time& _nValue)
+ {
+ m_xRowUpdate->updateTime(_nPos, _nValue);
+ }
+ virtual void updateTimestamp(sal_Int32 _nPos,const ::com::sun::star::util::DateTime& _nValue)
+ {
+ m_xRowUpdate->updateTimestamp(_nPos, _nValue);
+ }
virtual void updateInt(sal_Int32 _nPos,const sal_Int32& _nValue)
{
m_xRowUpdate->updateInt(_nPos, _nValue);
@@ -100,6 +112,21 @@ namespace dbaui
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OParameterUpdateHelper::updateDouble" );
m_xParameters->setDouble(_nPos, _nValue);
}
+ virtual void updateDate(sal_Int32 _nPos,const ::com::sun::star::util::Date& _nValue)
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OParameterUpdateHelper::updateDouble" );
+ m_xParameters->setDate(_nPos, _nValue);
+ }
+ virtual void updateTime(sal_Int32 _nPos,const ::com::sun::star::util::Time& _nValue)
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OParameterUpdateHelper::updateDouble" );
+ m_xParameters->setTime(_nPos, _nValue);
+ }
+ virtual void updateTimestamp(sal_Int32 _nPos,const ::com::sun::star::util::DateTime& _nValue)
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OParameterUpdateHelper::updateDouble" );
+ m_xParameters->setTimestamp(_nPos, _nValue);
+ }
virtual void updateInt(sal_Int32 _nPos,const sal_Int32& _nValue)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OParameterUpdateHelper::updateInt" );
diff --git a/dbaccess/source/ui/misc/WCPage.cxx b/dbaccess/source/ui/misc/WCPage.cxx
index a6788ac1926f..63a910929836 100644
--- a/dbaccess/source/ui/misc/WCPage.cxx
+++ b/dbaccess/source/ui/misc/WCPage.cxx
@@ -112,11 +112,13 @@ OCopyTable::OCopyTable( Window * pParent )
,m_aRB_Def( this, ModuleRes( RB_DEF ) )
,m_aRB_View( this, ModuleRes( RB_VIEW ) )
,m_aRB_AppendData( this, ModuleRes( RB_APPENDDATA ) )
+ ,m_aCB_UseHeaderLine( this, ModuleRes( CB_USEHEADERLINE ) )
,m_aCB_PrimaryColumn( this, ModuleRes( CB_PRIMARY_COLUMN ) )
,m_aFT_KeyName( this, ModuleRes( FT_KEYNAME ) )
,m_edKeyName( this, ModuleRes( ET_KEYNAME ) )
,m_pPage2(NULL)
,m_pPage3(NULL)
+ ,m_bUseHeaderAllowed(TRUE)
{
DBG_CTOR(OCopyTable,NULL);
@@ -127,6 +129,7 @@ OCopyTable::OCopyTable( Window * pParent )
if ( !m_pParent->supportsViews() )
m_aRB_View.Disable();
+ m_aCB_UseHeaderLine.Check(TRUE);
m_bPKeyAllowed = m_pParent->supportsPrimaryKey();
m_aCB_PrimaryColumn.Enable(m_bPKeyAllowed);
@@ -187,6 +190,7 @@ IMPL_LINK( OCopyTable, RadioChangeHdl, Button*, pButton )
m_aFT_KeyName.Enable(bKey && m_aCB_PrimaryColumn.IsChecked());
m_edKeyName.Enable(bKey && m_aCB_PrimaryColumn.IsChecked());
m_aCB_PrimaryColumn.Enable(bKey);
+ m_aCB_UseHeaderLine.Enable(m_bUseHeaderAllowed && IsOptionDefData());
// set typ what to do
if( IsOptionDefData() )
@@ -211,7 +215,8 @@ sal_Bool OCopyTable::LeavePage()
{
DBG_CHKTHIS(OCopyTable,NULL);
m_pParent->m_bCreatePrimaryKeyColumn = (m_bPKeyAllowed && m_aCB_PrimaryColumn.IsEnabled()) ? m_aCB_PrimaryColumn.IsChecked() : sal_False;
- m_pParent->m_aKeyName = m_pParent->m_bCreatePrimaryKeyColumn ? m_edKeyName.GetText() : String();
+ m_pParent->m_aKeyName = m_pParent->m_bCreatePrimaryKeyColumn ? m_edKeyName.GetText() : String();
+ m_pParent->setUseHeaderLine( m_aCB_UseHeaderLine.IsChecked() );
// first check if the table already exists in the database
if( m_pParent->getOperation() != CopyTableOperation::AppendData )
@@ -296,6 +301,7 @@ void OCopyTable::ActivatePage()
m_pParent->GetOKButton().Enable( TRUE );
m_nOldOperation = m_pParent->getOperation();
m_edTableName.GrabFocus();
+ m_aCB_UseHeaderLine.Check(m_pParent->UseHeaderLine());
}
//------------------------------------------------------------------------
String OCopyTable::GetTitle() const
@@ -336,10 +342,11 @@ sal_Bool OCopyTable::checkAppendData()
// #90027#
const ODatabaseExport::TColumnVector* pDestColumns = m_pParent->getDestVector();
ODatabaseExport::TColumnVector::const_iterator aDestIter = pDestColumns->begin();
+ ODatabaseExport::TColumnVector::const_iterator aDestEnd = pDestColumns->end();
const sal_uInt32 nDestSize = pDestColumns->size();
sal_Bool bNotConvert;
sal_uInt32 i = 0;
- for(sal_Int32 nPos = 1;aDestIter != pDestColumns->end() && i < nDestSize && i < nSrcSize;++aDestIter,++nPos,++i)
+ for(sal_Int32 nPos = 1;aDestIter != aDestEnd && i < nDestSize && i < nSrcSize;++aDestIter,++nPos,++i)
{
bNotConvert = sal_True;
m_pParent->m_vColumnPos[i] = ODatabaseExport::TPositions::value_type(nPos,nPos);
diff --git a/dbaccess/source/ui/misc/WColumnSelect.cxx b/dbaccess/source/ui/misc/WColumnSelect.cxx
index 9b4ad13d8dc7..69d5c3bad4fd 100644
--- a/dbaccess/source/ui/misc/WColumnSelect.cxx
+++ b/dbaccess/source/ui/misc/WColumnSelect.cxx
@@ -144,8 +144,9 @@ void OWizColumnSelect::Reset()
// insert the source columns in the left listbox
const ODatabaseExport::TColumnVector* pSrcColumns = m_pParent->getSrcVector();
ODatabaseExport::TColumnVector::const_iterator aIter = pSrcColumns->begin();
+ ODatabaseExport::TColumnVector::const_iterator aEnd = pSrcColumns->end();
- for(;aIter != pSrcColumns->end();++aIter)
+ for(;aIter != aEnd;++aIter)
{
sal_uInt16 nPos = m_lbOrgColumnNames.InsertEntry((*aIter)->first);
m_lbOrgColumnNames.SetEntryData(nPos,(*aIter)->second);
diff --git a/dbaccess/source/ui/misc/WCopyTable.cxx b/dbaccess/source/ui/misc/WCopyTable.cxx
index ca9aeacf73e4..1feb51cf49a9 100644
--- a/dbaccess/source/ui/misc/WCopyTable.cxx
+++ b/dbaccess/source/ui/misc/WCopyTable.cxx
@@ -633,6 +633,7 @@ OCopyTableWizard::OCopyTableWizard( Window * pParent, const ::rtl::OUString& _rD
bAllowViews = false;
OCopyTable* pPage1( new OCopyTable( this ) );
+ pPage1->disallowUseHeaderLine();
if ( !bAllowViews )
pPage1->disallowViews();
pPage1->setCreateStyleAction();
@@ -831,7 +832,8 @@ sal_Bool OCopyTableWizard::CheckColumns(sal_Int32& _rnBreakPos)
if ( bContainsColumns )
{ // we have dest columns so look for the matching column
ODatabaseExport::TColumnVector::const_iterator aSrcIter = m_vSourceVec.begin();
- for(;aSrcIter != m_vSourceVec.end();++aSrcIter)
+ ODatabaseExport::TColumnVector::const_iterator aSrcEnd = m_vSourceVec.end();
+ for(;aSrcIter != aSrcEnd;++aSrcIter)
{
ODatabaseExport::TColumns::iterator aDestIter = m_vDestColumns.find(m_mNameMapping[(*aSrcIter)->first]);
@@ -856,7 +858,8 @@ sal_Bool OCopyTableWizard::CheckColumns(sal_Int32& _rnBreakPos)
sal_Int32 nMaxNameLen = getMaxColumnNameLength();
ODatabaseExport::TColumnVector::const_iterator aSrcIter = m_vSourceVec.begin();
- for(_rnBreakPos=0;aSrcIter != m_vSourceVec.end() && bRet ;++aSrcIter,++_rnBreakPos)
+ ODatabaseExport::TColumnVector::const_iterator aSrcEnd = m_vSourceVec.end();
+ for(_rnBreakPos=0;aSrcIter != aSrcEnd && bRet ;++aSrcIter,++_rnBreakPos)
{
OFieldDescription* pField = new OFieldDescription(*(*aSrcIter)->second);
pField->SetName(convertColumnName(TExportColumnFindFunctor(&m_vDestColumns),(*aSrcIter)->first,sExtraChars,nMaxNameLen));
@@ -1096,7 +1099,8 @@ void OCopyTableWizard::impl_loadSourceData()
void OCopyTableWizard::loadData( const ICopyTableSourceObject& _rSourceObject, ODatabaseExport::TColumns& _rColumns, ODatabaseExport::TColumnVector& _rColVector )
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OCopyTableWizard::loadData" );
- for ( ODatabaseExport::TColumns::iterator col = _rColumns.begin(); col != _rColumns.end(); ++col )
+ ODatabaseExport::TColumns::iterator colEnd = _rColumns.end();
+ for ( ODatabaseExport::TColumns::iterator col = _rColumns.begin(); col != colEnd; ++col )
delete col->second;
_rColVector.clear();
@@ -1176,7 +1180,8 @@ void OCopyTableWizard::appendColumns( Reference<XColumnsSupplier>& _rxColSup, co
OSL_ENSURE(xAppend.is(),"No XAppend Interface!");
ODatabaseExport::TColumnVector::const_iterator aIter = _pVec->begin();
- for(;aIter != _pVec->end();++aIter)
+ ODatabaseExport::TColumnVector::const_iterator aEnd = _pVec->end();
+ for(;aIter != aEnd;++aIter)
{
OFieldDescription* pField = (*aIter)->second;
if(!pField)
diff --git a/dbaccess/source/ui/misc/WNameMatch.cxx b/dbaccess/source/ui/misc/WNameMatch.cxx
index 5325f0388cfc..5b50a7e553cd 100644
--- a/dbaccess/source/ui/misc/WNameMatch.cxx
+++ b/dbaccess/source/ui/misc/WNameMatch.cxx
@@ -187,9 +187,10 @@ sal_Bool OWizNameMatching::LeavePage()
DBG_ASSERT(pSrcField,"OWizNameMatching: OColumn can not be null!");
ODatabaseExport::TColumnVector::const_iterator aSrcIter = pSrcColumns->begin();
- for(;aSrcIter != pSrcColumns->end() && (*aSrcIter)->second != pSrcField;++aSrcIter)
+ ODatabaseExport::TColumnVector::const_iterator aSrcEnd = pSrcColumns->end();
+ for(;aSrcIter != aSrcEnd && (*aSrcIter)->second != pSrcField;++aSrcIter)
;
- sal_Int32 nPos = ::std::distance(pSrcColumns->begin(),aSrcIter);
+ const sal_Int32 nPos = ::std::distance(pSrcColumns->begin(),aSrcIter);
// sal_Int32 nPos = m_CTRL_LEFT.GetModel()->GetAbsPos(pLeftEntry);
if(m_CTRL_LEFT.GetCheckButtonState(pLeftEntry) == SV_BUTTON_CHECKED)
@@ -198,8 +199,9 @@ sal_Bool OWizNameMatching::LeavePage()
DBG_ASSERT(pDestField,"OWizNameMatching: OColumn can not be null!");
const ODatabaseExport::TColumnVector* pDestColumns = m_pParent->getDestVector();
ODatabaseExport::TColumnVector::const_iterator aDestIter = pDestColumns->begin();
+ ODatabaseExport::TColumnVector::const_iterator aDestEnd = pDestColumns->end();
- for(;aDestIter != pDestColumns->end() && (*aDestIter)->second != pDestField;++aDestIter)
+ for(;aDestIter != aDestEnd && (*aDestIter)->second != pDestField;++aDestIter)
;
OSL_ENSURE((nPos) < static_cast<sal_Int32>(m_pParent->m_vColumnPos.size()),"m_pParent->m_vColumnPos: Illegal index for vector");
@@ -435,7 +437,8 @@ void OColumnTreeBox::FillListBox( const ODatabaseExport::TColumnVector& _rList)
{
Clear();
ODatabaseExport::TColumnVector::const_iterator aIter = _rList.begin();
- for(;aIter != _rList.end();++aIter)
+ ODatabaseExport::TColumnVector::const_iterator aEnd = _rList.end();
+ for(;aIter != aEnd;++aIter)
{
SvLBoxEntry* pEntry = InsertEntry((*aIter)->first,0,sal_False,LIST_APPEND,(*aIter)->second);
SvButtonState eState = !(m_bReadOnly && (*aIter)->second->IsAutoIncrement()) ? SV_BUTTON_CHECKED : SV_BUTTON_UNCHECKED;
diff --git a/dbaccess/source/ui/misc/WTypeSelect.cxx b/dbaccess/source/ui/misc/WTypeSelect.cxx
index fa6e91142fc9..ceeb058528df 100644
--- a/dbaccess/source/ui/misc/WTypeSelect.cxx
+++ b/dbaccess/source/ui/misc/WTypeSelect.cxx
@@ -339,7 +339,8 @@ void OWizTypeSelect::Reset()
const ODatabaseExport::TColumnVector* pDestColumns = m_pParent->getDestVector();
ODatabaseExport::TColumnVector::const_iterator aIter = pDestColumns->begin();
- for(;aIter != pDestColumns->end();++aIter)
+ ODatabaseExport::TColumnVector::const_iterator aEnd = pDestColumns->end();
+ for(;aIter != aEnd;++aIter)
{
sal_uInt16 nPos;
if((*aIter)->second->IsPrimaryKey())
diff --git a/dbaccess/source/ui/misc/WizardPages.hrc b/dbaccess/source/ui/misc/WizardPages.hrc
index b199a8012853..9a489861acf9 100644
--- a/dbaccess/source/ui/misc/WizardPages.hrc
+++ b/dbaccess/source/ui/misc/WizardPages.hrc
@@ -72,6 +72,7 @@
#define RB_VIEW 3
#define RB_APPENDDATA 4
#define CB_PRIMARY_COLUMN 5
+#define CB_USEHEADERLINE 6
#define CONTROL_CONTAINER 1
// controls
diff --git a/dbaccess/source/ui/misc/WizardPages.src b/dbaccess/source/ui/misc/WizardPages.src
index 4e8884d9144b..638feb92e54c 100644
--- a/dbaccess/source/ui/misc/WizardPages.src
+++ b/dbaccess/source/ui/misc/WizardPages.src
@@ -48,16 +48,6 @@
#define BUTTON_SIZE_X 50
#define BUTTON_SIZE_Y 14
-String STR_HTML_TITLE
-{
- Text [ en-US ] = "Copy HTML table" ;
-};
-
-String STR_RTF_TITLE
-{
- Text [ en-US ] = "Copy RTF table" ;
-};
-
String STR_WIZ_COLUMN_SELECT_TITEL
{
Text [ en-US ] = "Apply columns";
@@ -523,22 +513,29 @@ TabPage TAB_WIZ_COPYTABLE
Text [ en-US ] = "Append ~data" ;
};
- CheckBox CB_PRIMARY_COLUMN
+ CheckBox CB_USEHEADERLINE
{
Pos = MAP_APPFONT ( 12, 93 ) ;
+ Size = MAP_APPFONT ( WINDOW_SIZE_X - 18, 10 ) ;
+ Text [ en-US ] = "Use first ~line as column names" ;
+ };
+
+ CheckBox CB_PRIMARY_COLUMN
+ {
+ Pos = MAP_APPFONT ( 12, 107 ) ;
Size = MAP_APPFONT ( 90 , 10 ) ;
Text [ en-US ] = "Crea~te primary key";
};
FixedText FT_KEYNAME
{
- Pos = MAP_APPFONT ( 21 , 108 ) ;
+ Pos = MAP_APPFONT ( 21 , 122 ) ;
Size = MAP_APPFONT ( 39 , 8 ) ;
Text [ en-US ] = "Name";
};
Edit ET_KEYNAME
{
- Pos = MAP_APPFONT ( 80, 106 ) ;
+ Pos = MAP_APPFONT ( 80, 120 ) ;
Size = MAP_APPFONT ( 65 , 12 ) ;
TabStop = TRUE ;
Border = TRUE ;
diff --git a/dbaccess/source/ui/misc/dbumiscres.src b/dbaccess/source/ui/misc/dbumiscres.src
index f58b0b8b23ba..e20e603b2343 100644
--- a/dbaccess/source/ui/misc/dbumiscres.src
+++ b/dbaccess/source/ui/misc/dbumiscres.src
@@ -96,4 +96,8 @@ String STR_NAMED_OBJECT_ALREADY_EXISTS
{
Text [ en-US ] = "The name '$#$' already exists.\nPlease enter another name." ;
};
-
+String RID_STR_EXTENSION_NOT_PRESENT
+{
+ // #i96130# use hard coded name
+ Text [ en-US ] = "The report, \"$file$\", requires the extension Sun Report Builder.";
+};
diff --git a/dbaccess/source/ui/misc/dsmeta.cxx b/dbaccess/source/ui/misc/dsmeta.cxx
index aa50736ba6b7..f758f529f66f 100644
--- a/dbaccess/source/ui/misc/dsmeta.cxx
+++ b/dbaccess/source/ui/misc/dsmeta.cxx
@@ -29,7 +29,9 @@
************************************************************************/
#include "dsmeta.hxx"
-
+#include <connectivity/DriversConfig.hxx>
+#include "dsntypes.hxx"
+#include <comphelper/processfactory.hxx>
/** === begin UNO includes === **/
/** === end UNO includes === **/
@@ -41,34 +43,12 @@ namespace dbaui
//........................................................................
/** === begin UNO using === **/
+ using namespace dbaccess;
+ using namespace ::com::sun::star;
/** === end UNO using === **/
struct InitAdvanced : public AdvancedSettingsSupport
{
- // strange ctor, but makes instantiating this class more readable (see below)
- InitAdvanced( short _Generated, short _SQL, short _Append, short _As, short _Outer, short _Priv, short _Param,
- short _Version, short _Catalog, short _Schema, short _Index, short _DOS, short _Required, short _Bool,short _IgnoreCur,short _AutoPKey, short _EscapeDT )
- :AdvancedSettingsSupport()
- {
- bGeneratedValues = ( _Generated != 0 );
- bUseSQL92NamingConstraints = ( _SQL != 0 );
- bAppendTableAliasInSelect = ( _Append != 0 );
- bUseKeywordAsBeforeAlias = ( _As != 0 );
- bUseBracketedOuterJoinSyntax = ( _Outer != 0 );
- bIgnoreDriverPrivileges = ( _Priv != 0 );
- bParameterNameSubstitution = ( _Param != 0 );
- bDisplayVersionColumns = ( _Version != 0 );
- bUseCatalogInSelect = ( _Catalog != 0 );
- bUseSchemaInSelect = ( _Schema != 0 );
- bUseIndexDirectionKeyword = ( _Index != 0 );
- bUseDOSLineEnds = ( _DOS != 0 );
- bBooleanComparisonMode = ( _Bool != 0 );
- bFormsCheckRequiredFields = ( _Required != 0 );
- bIgnoreCurrency = ( _IgnoreCur != 0 );
- bAutoIncrementIsPrimaryKey = ( _AutoPKey != 0 );
- bEscapeDateTime = ( _EscapeDT != 0 );
- }
-
enum Special { All, AllButIgnoreCurrency, None };
InitAdvanced( Special _eType )
@@ -89,7 +69,6 @@ namespace dbaui
bBooleanComparisonMode = ( _eType == All ) || ( _eType == AllButIgnoreCurrency );
bFormsCheckRequiredFields = ( _eType == All ) || ( _eType == AllButIgnoreCurrency );
bIgnoreCurrency = ( _eType == All );
- bAutoIncrementIsPrimaryKey = false; // hsqldb special
bEscapeDateTime = ( _eType == All ) || ( _eType == AllButIgnoreCurrency );
}
};
@@ -114,95 +93,125 @@ namespace dbaui
//= global tables
//====================================================================
//--------------------------------------------------------------------
- static const AdvancedSettingsSupport& getAdvancedSettingsSupport( ::dbaccess::DATASOURCE_TYPE _eType )
+ static const AdvancedSettingsSupport& getAdvancedSettingsSupport( const ::rtl::OUString& _sURL )
{
- typedef ::std::map< ::dbaccess::DATASOURCE_TYPE, AdvancedSettingsSupport > AdvancedSupport;
-
+ DECLARE_STL_USTRINGACCESS_MAP( AdvancedSettingsSupport, AdvancedSupport);
static AdvancedSupport s_aSupport;
if ( s_aSupport.empty() )
{
- s_aSupport[ ::dbaccess::DST_MSACCESS ] = InitAdvanced( 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0 );
- s_aSupport[ ::dbaccess::DST_MYSQL_ODBC ] = InitAdvanced( 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0 );
- s_aSupport[ ::dbaccess::DST_MYSQL_JDBC ] = InitAdvanced( 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1 );
- s_aSupport[ ::dbaccess::DST_MYSQL_NATIVE ] = InitAdvanced( 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0 );
- s_aSupport[ ::dbaccess::DST_ORACLE_JDBC ] = InitAdvanced( InitAdvanced::All );
- s_aSupport[ ::dbaccess::DST_ADABAS ] = InitAdvanced( 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0 );
- s_aSupport[ ::dbaccess::DST_CALC ] = InitAdvanced( InitAdvanced::None );
- s_aSupport[ ::dbaccess::DST_DBASE ] = InitAdvanced( 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 );
- s_aSupport[ ::dbaccess::DST_FLAT ] = InitAdvanced( 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 );
- s_aSupport[ ::dbaccess::DST_JDBC ] = InitAdvanced( InitAdvanced::AllButIgnoreCurrency );
- s_aSupport[ ::dbaccess::DST_ODBC ] = InitAdvanced( InitAdvanced::AllButIgnoreCurrency );
- s_aSupport[ ::dbaccess::DST_ADO ] = InitAdvanced( 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0 );
- s_aSupport[ ::dbaccess::DST_MOZILLA ] = InitAdvanced( InitAdvanced::None );
- s_aSupport[ ::dbaccess::DST_THUNDERBIRD ] = InitAdvanced( InitAdvanced::None );
- s_aSupport[ ::dbaccess::DST_LDAP ] = InitAdvanced( InitAdvanced::None );
- s_aSupport[ ::dbaccess::DST_OUTLOOK ] = InitAdvanced( InitAdvanced::None );
- s_aSupport[ ::dbaccess::DST_OUTLOOKEXP ] = InitAdvanced( InitAdvanced::None );
- s_aSupport[ ::dbaccess::DST_EVOLUTION ] = InitAdvanced( InitAdvanced::None );
- s_aSupport[ ::dbaccess::DST_EVOLUTION_GROUPWISE ] = InitAdvanced( InitAdvanced::None );
- s_aSupport[ ::dbaccess::DST_EVOLUTION_LDAP ] = InitAdvanced( InitAdvanced::None );
- s_aSupport[ ::dbaccess::DST_KAB ] = InitAdvanced( InitAdvanced::None );
- s_aSupport[ ::dbaccess::DST_MACAB ] = InitAdvanced( InitAdvanced::None );
- s_aSupport[ ::dbaccess::DST_MSACCESS_2007 ] = InitAdvanced( 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0 );
- s_aSupport[ ::dbaccess::DST_EMBEDDED_HSQLDB ] = InitAdvanced( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0 );
- s_aSupport[ ::dbaccess::DST_USERDEFINE1 ] = InitAdvanced( InitAdvanced::AllButIgnoreCurrency );
- s_aSupport[ ::dbaccess::DST_USERDEFINE2 ] = InitAdvanced( InitAdvanced::AllButIgnoreCurrency );
- s_aSupport[ ::dbaccess::DST_USERDEFINE3 ] = InitAdvanced( InitAdvanced::AllButIgnoreCurrency );
- s_aSupport[ ::dbaccess::DST_USERDEFINE4 ] = InitAdvanced( InitAdvanced::AllButIgnoreCurrency );
- s_aSupport[ ::dbaccess::DST_USERDEFINE5 ] = InitAdvanced( InitAdvanced::AllButIgnoreCurrency );
- s_aSupport[ ::dbaccess::DST_USERDEFINE6 ] = InitAdvanced( InitAdvanced::AllButIgnoreCurrency );
- s_aSupport[ ::dbaccess::DST_USERDEFINE7 ] = InitAdvanced( InitAdvanced::AllButIgnoreCurrency );
- s_aSupport[ ::dbaccess::DST_USERDEFINE8 ] = InitAdvanced( InitAdvanced::AllButIgnoreCurrency );
- s_aSupport[ ::dbaccess::DST_USERDEFINE9 ] = InitAdvanced( InitAdvanced::AllButIgnoreCurrency );
- s_aSupport[ ::dbaccess::DST_USERDEFINE10 ] = InitAdvanced( InitAdvanced::AllButIgnoreCurrency );
- }
- return s_aSupport[ _eType ];
+ ::connectivity::DriversConfig aDriverConfig(::comphelper::getProcessServiceFactory());
+ const uno::Sequence< ::rtl::OUString > aURLs = aDriverConfig.getURLs();
+ const ::rtl::OUString* pIter = aURLs.getConstArray();
+ const ::rtl::OUString* pEnd = pIter + aURLs.getLength();
+ for(;pIter != pEnd;++pIter)
+ {
+ InitAdvanced aInit(InitAdvanced::None);
+ const uno::Sequence< beans::NamedValue> aProperties = aDriverConfig.getFeatures(*pIter).getNamedValues();
+ const beans::NamedValue* pPropertiesIter = aProperties.getConstArray();
+ const beans::NamedValue* pPropertiesEnd = pPropertiesIter + aProperties.getLength();
+ for (;pPropertiesIter != pPropertiesEnd ; ++pPropertiesIter)
+ {
+ if ( pPropertiesIter->Name.equalsAscii("GeneratedValues") )
+ {
+ pPropertiesIter->Value >>= aInit.bGeneratedValues;
+ }
+ else if ( pPropertiesIter->Name.equalsAscii("UseSQL92NamingConstraints") )
+ {
+ pPropertiesIter->Value >>= aInit.bUseSQL92NamingConstraints;
+ }
+ else if ( pPropertiesIter->Name.equalsAscii("AppendTableAliasInSelect") )
+ {
+ pPropertiesIter->Value >>= aInit.bAppendTableAliasInSelect;
+ }
+ else if ( pPropertiesIter->Name.equalsAscii("UseKeywordAsBeforeAlias") )
+ {
+ pPropertiesIter->Value >>= aInit.bUseKeywordAsBeforeAlias;
+ }
+ else if ( pPropertiesIter->Name.equalsAscii("UseBracketedOuterJoinSyntax") )
+ {
+ pPropertiesIter->Value >>= aInit.bUseBracketedOuterJoinSyntax;
+ }
+ else if ( pPropertiesIter->Name.equalsAscii("IgnoreDriverPrivileges") )
+ {
+ pPropertiesIter->Value >>= aInit.bIgnoreDriverPrivileges;
+ }
+ else if ( pPropertiesIter->Name.equalsAscii("ParameterNameSubstitution") )
+ {
+ pPropertiesIter->Value >>= aInit.bParameterNameSubstitution;
+ }
+ else if ( pPropertiesIter->Name.equalsAscii("DisplayVersionColumns") )
+ {
+ pPropertiesIter->Value >>= aInit.bDisplayVersionColumns;
+ }
+ else if ( pPropertiesIter->Name.equalsAscii("UseCatalogInSelect") )
+ {
+ pPropertiesIter->Value >>= aInit.bUseCatalogInSelect;
+ }
+ else if ( pPropertiesIter->Name.equalsAscii("UseSchemaInSelect") )
+ {
+ pPropertiesIter->Value >>= aInit.bUseSchemaInSelect;
+ }
+ else if ( pPropertiesIter->Name.equalsAscii("UseIndexDirectionKeyword") )
+ {
+ pPropertiesIter->Value >>= aInit.bUseIndexDirectionKeyword;
+ }
+ else if ( pPropertiesIter->Name.equalsAscii("UseDOSLineEnds") )
+ {
+ pPropertiesIter->Value >>= aInit.bUseDOSLineEnds;
+ }
+ else if ( pPropertiesIter->Name.equalsAscii("BooleanComparisonMode") )
+ {
+ pPropertiesIter->Value >>= aInit.bBooleanComparisonMode;
+ }
+ else if ( pPropertiesIter->Name.equalsAscii("FormsCheckRequiredFields") )
+ {
+ pPropertiesIter->Value >>= aInit.bFormsCheckRequiredFields;
+ }
+ else if ( pPropertiesIter->Name.equalsAscii("IgnoreCurrency") )
+ {
+ pPropertiesIter->Value >>= aInit.bIgnoreCurrency;
+ }
+ else if ( pPropertiesIter->Name.equalsAscii("EscapeDateTime") )
+ {
+ pPropertiesIter->Value >>= aInit.bEscapeDateTime;
+ }
+ } // for (;pPropertiesIter != pPropertiesEnd ; ++pPropertiesIter)
+ s_aSupport.insert(AdvancedSupport::value_type(*pIter,aInit));
+ }
+ } // if ( s_aSupport.empty() )
+ OSL_ENSURE(s_aSupport.find(_sURL) != s_aSupport.end(),"Illegal URL!");
+ return s_aSupport[ _sURL ];
}
//--------------------------------------------------------------------
- static AuthenticationMode getAuthenticationMode( ::dbaccess::DATASOURCE_TYPE _eType )
+ static AuthenticationMode getAuthenticationMode( const ::rtl::OUString& _sURL )
{
- typedef ::std::map< ::dbaccess::DATASOURCE_TYPE, FeatureSupport > Supported;
-
+ DECLARE_STL_USTRINGACCESS_MAP( FeatureSupport, Supported);
static Supported s_aSupport;
if ( s_aSupport.empty() )
{
- s_aSupport[ ::dbaccess::DST_MSACCESS ] = FeatureSupport( AuthNone );
- s_aSupport[ ::dbaccess::DST_MYSQL_NATIVE ] = FeatureSupport( AuthUserPwd );
- s_aSupport[ ::dbaccess::DST_MYSQL_ODBC ] = FeatureSupport( AuthUserPwd );
- s_aSupport[ ::dbaccess::DST_MYSQL_JDBC ] = FeatureSupport( AuthUserPwd );
- s_aSupport[ ::dbaccess::DST_ORACLE_JDBC ] = FeatureSupport( AuthUserPwd );
- s_aSupport[ ::dbaccess::DST_ADABAS ] = FeatureSupport( AuthUserPwd );
- s_aSupport[ ::dbaccess::DST_CALC ] = FeatureSupport( AuthPwd );
- s_aSupport[ ::dbaccess::DST_DBASE ] = FeatureSupport( AuthNone );
- s_aSupport[ ::dbaccess::DST_FLAT ] = FeatureSupport( AuthNone );
- s_aSupport[ ::dbaccess::DST_JDBC ] = FeatureSupport( AuthUserPwd );
- s_aSupport[ ::dbaccess::DST_ODBC ] = FeatureSupport( AuthUserPwd );
- s_aSupport[ ::dbaccess::DST_ADO ] = FeatureSupport( AuthUserPwd );
- s_aSupport[ ::dbaccess::DST_MOZILLA ] = FeatureSupport( AuthNone );
- s_aSupport[ ::dbaccess::DST_THUNDERBIRD ] = FeatureSupport( AuthNone );
- s_aSupport[ ::dbaccess::DST_LDAP ] = FeatureSupport( AuthUserPwd );
- s_aSupport[ ::dbaccess::DST_OUTLOOK ] = FeatureSupport( AuthNone );
- s_aSupport[ ::dbaccess::DST_OUTLOOKEXP ] = FeatureSupport( AuthNone );
- s_aSupport[ ::dbaccess::DST_EVOLUTION ] = FeatureSupport( AuthNone );
- s_aSupport[ ::dbaccess::DST_EVOLUTION_GROUPWISE ] = FeatureSupport( AuthNone );
- s_aSupport[ ::dbaccess::DST_EVOLUTION_LDAP ] = FeatureSupport( AuthNone );
- s_aSupport[ ::dbaccess::DST_KAB ] = FeatureSupport( AuthNone );
- s_aSupport[ ::dbaccess::DST_MACAB ] = FeatureSupport( AuthNone );
- s_aSupport[ ::dbaccess::DST_MSACCESS_2007 ] = FeatureSupport( AuthNone );
- s_aSupport[ ::dbaccess::DST_EMBEDDED_HSQLDB ] = FeatureSupport( AuthNone );
- s_aSupport[ ::dbaccess::DST_USERDEFINE1 ] = FeatureSupport( AuthUserPwd );
- s_aSupport[ ::dbaccess::DST_USERDEFINE2 ] = FeatureSupport( AuthUserPwd );
- s_aSupport[ ::dbaccess::DST_USERDEFINE3 ] = FeatureSupport( AuthUserPwd );
- s_aSupport[ ::dbaccess::DST_USERDEFINE4 ] = FeatureSupport( AuthUserPwd );
- s_aSupport[ ::dbaccess::DST_USERDEFINE5 ] = FeatureSupport( AuthUserPwd );
- s_aSupport[ ::dbaccess::DST_USERDEFINE6 ] = FeatureSupport( AuthUserPwd );
- s_aSupport[ ::dbaccess::DST_USERDEFINE7 ] = FeatureSupport( AuthUserPwd );
- s_aSupport[ ::dbaccess::DST_USERDEFINE8 ] = FeatureSupport( AuthUserPwd );
- s_aSupport[ ::dbaccess::DST_USERDEFINE9 ] = FeatureSupport( AuthUserPwd );
- s_aSupport[ ::dbaccess::DST_USERDEFINE10 ] = FeatureSupport( AuthUserPwd );
- }
- return s_aSupport[ _eType ].eAuthentication;
+ ::connectivity::DriversConfig aDriverConfig(::comphelper::getProcessServiceFactory());
+ const uno::Sequence< ::rtl::OUString > aURLs = aDriverConfig.getURLs();
+ const ::rtl::OUString* pIter = aURLs.getConstArray();
+ const ::rtl::OUString* pEnd = pIter + aURLs.getLength();
+ for(;pIter != pEnd;++pIter)
+ {
+ FeatureSupport aInit( AuthNone );
+ const ::comphelper::NamedValueCollection& aMetaData = aDriverConfig.getMetaData(*pIter);
+ if ( aMetaData.has("Authentication") )
+ {
+ ::rtl::OUString sAuth;
+ aMetaData.get("Authentication") >>= sAuth;
+ if ( sAuth.equalsAscii("UserPassword") )
+ aInit = AuthUserPwd;
+ else if ( sAuth.equalsAscii("Password") )
+ aInit = AuthPwd;
+ }
+ s_aSupport.insert(Supported::value_type(*pIter,aInit));
+ } // for(;pIter != pEnd;++pIter)
+ } // if ( s_aSupport.empty() )
+ OSL_ENSURE(s_aSupport.find(_sURL) != s_aSupport.end(),"Illegal URL!");
+ return s_aSupport[ _sURL ].eAuthentication;
}
//====================================================================
@@ -211,17 +220,17 @@ namespace dbaui
class DataSourceMetaData_Impl
{
public:
- DataSourceMetaData_Impl( ::dbaccess::DATASOURCE_TYPE _eType );
+ DataSourceMetaData_Impl( const ::rtl::OUString& _sURL );
- inline ::dbaccess::DATASOURCE_TYPE getType() const { return m_eType; }
+ inline ::rtl::OUString getType() const { return m_sURL; }
private:
- ::dbaccess::DATASOURCE_TYPE m_eType;
+ const ::rtl::OUString m_sURL;
};
//--------------------------------------------------------------------
- DataSourceMetaData_Impl::DataSourceMetaData_Impl( ::dbaccess::DATASOURCE_TYPE _eType )
- :m_eType( _eType )
+ DataSourceMetaData_Impl::DataSourceMetaData_Impl( const ::rtl::OUString& _sURL )
+ :m_sURL( _sURL )
{
}
@@ -229,8 +238,8 @@ namespace dbaui
//= DataSourceMetaData
//====================================================================
//--------------------------------------------------------------------
- DataSourceMetaData::DataSourceMetaData( ::dbaccess::DATASOURCE_TYPE _eType )
- :m_pImpl( new DataSourceMetaData_Impl( _eType ) )
+ DataSourceMetaData::DataSourceMetaData( const ::rtl::OUString& _sURL )
+ :m_pImpl( new DataSourceMetaData_Impl( _sURL ) )
{
}
@@ -252,9 +261,9 @@ namespace dbaui
}
//--------------------------------------------------------------------
- AuthenticationMode DataSourceMetaData::getAuthentication( ::dbaccess::DATASOURCE_TYPE _eType )
+ AuthenticationMode DataSourceMetaData::getAuthentication( const ::rtl::OUString& _sURL )
{
- return getAuthenticationMode( _eType );
+ return getAuthenticationMode( _sURL );
}
//........................................................................
diff --git a/dbaccess/source/ui/misc/indexcollection.cxx b/dbaccess/source/ui/misc/indexcollection.cxx
index 9f485067d4a4..681675f2003c 100644
--- a/dbaccess/source/ui/misc/indexcollection.cxx
+++ b/dbaccess/source/ui/misc/indexcollection.cxx
@@ -119,7 +119,8 @@ namespace dbaui
// loop'n'compare
Indexes::const_iterator aSearch = m_aIndexes.begin();
- for (; aSearch != m_aIndexes.end(); ++aSearch)
+ Indexes::const_iterator aEnd = m_aIndexes.end();
+ for (; aSearch != aEnd; ++aSearch)
if (aSearch->sName == sNameCompare)
break;
@@ -133,7 +134,8 @@ namespace dbaui
// loop'n'compare
Indexes::iterator aSearch = m_aIndexes.begin();
- for (; aSearch != m_aIndexes.end(); ++aSearch)
+ Indexes::iterator aEnd = m_aIndexes.end();
+ for (; aSearch != aEnd; ++aSearch)
if (aSearch->sName == sNameCompare)
break;
@@ -147,7 +149,8 @@ namespace dbaui
// loop'n'compare
Indexes::const_iterator aSearch = m_aIndexes.begin();
- for (; aSearch != m_aIndexes.end(); ++aSearch)
+ Indexes::const_iterator aEnd = m_aIndexes.end();
+ for (; aSearch != aEnd; ++aSearch)
if (aSearch->getOriginalName() == sNameCompare)
break;
@@ -161,7 +164,8 @@ namespace dbaui
// loop'n'compare
Indexes::iterator aSearch = m_aIndexes.begin();
- for (; aSearch != m_aIndexes.end(); ++aSearch)
+ Indexes::iterator aEnd = m_aIndexes.end();
+ for (; aSearch != aEnd; ++aSearch)
if (aSearch->getOriginalName() == sNameCompare)
break;
diff --git a/dbaccess/source/ui/misc/linkeddocuments.cxx b/dbaccess/source/ui/misc/linkeddocuments.cxx
index d1c056b6e4a3..69ec1dcf4975 100644
--- a/dbaccess/source/ui/misc/linkeddocuments.cxx
+++ b/dbaccess/source/ui/misc/linkeddocuments.cxx
@@ -140,7 +140,6 @@
#include <connectivity/dbtools.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <com/sun/star/io/WrongFormatException.hpp>
-#include "ExtensionNotPresent.hxx"
#include "com/sun/star/sdb/RowSetVetoException.hpp"
//......................................................................
@@ -455,7 +454,7 @@ namespace dbaui
// more like a hack, insert an empty message
String sText( ModuleRes( RID_STR_EXTENSION_NOT_PRESENT ) );
- sText = sText.GetToken(0,'\n');
+ sText.SearchAndReplaceAscii("$file$",_rLinkName);
aInfo.prepend(sText);
String sMessage = String(ModuleRes(STR_COULDNOTOPEN_LINKEDDOC));
diff --git a/dbaccess/source/ui/misc/uiservices.cxx b/dbaccess/source/ui/misc/uiservices.cxx
index 3de9c2c1d015..9cca58ff853a 100644
--- a/dbaccess/source/ui/misc/uiservices.cxx
+++ b/dbaccess/source/ui/misc/uiservices.cxx
@@ -74,7 +74,6 @@ extern "C" void SAL_CALL createRegistryInfo_OAdvancedSettingsDialog();
extern "C" void SAL_CALL createRegistryInfo_ODBTypeWizDialog();
extern "C" void SAL_CALL createRegistryInfo_OUserSettingsDialog();
extern "C" void SAL_CALL createRegistryInfo_ODBTypeWizDialogSetup();
-extern "C" void SAL_CALL createRegistryInfo_OAdabasSettingsDialog();
extern "C" void SAL_CALL createRegistryInfo_OColumnControlModel();
extern "C" void SAL_CALL createRegistryInfo_OColumnControl();
extern "C" void SAL_CALL createRegistryInfo_OToolboxController();
@@ -107,7 +106,6 @@ extern "C" void SAL_CALL createRegistryInfo_DBU()
createRegistryInfo_ODBTypeWizDialog();
createRegistryInfo_ODBTypeWizDialogSetup();
createRegistryInfo_OUserSettingsDialog();
- createRegistryInfo_OAdabasSettingsDialog();
createRegistryInfo_OColumnControlModel();
createRegistryInfo_OColumnControl();
createRegistryInfo_OToolboxController();
diff --git a/dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx b/dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx
index ecabea880895..bfe3213f2291 100644
--- a/dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx
+++ b/dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx
@@ -129,9 +129,10 @@ namespace dbaui
nIndex = m_pLine->GetParent()->GetTabWinMap()->size();
const ::std::vector<OTableConnection*>* pVec = m_pLine->GetParent()->getTableConnections();
::std::vector<OTableConnection*>::const_iterator aIter = pVec->begin();
- for (; aIter != pVec->end() && (*aIter) != m_pLine; ++nIndex,++aIter)
+ ::std::vector<OTableConnection*>::const_iterator aEnd = pVec->end();
+ for (; aIter != aEnd && (*aIter) != m_pLine; ++nIndex,++aIter)
;
- nIndex = ( aIter != pVec->end() ) ? nIndex : -1;
+ nIndex = ( aIter != aEnd ) ? nIndex : -1;
}
return nIndex;
}
diff --git a/dbaccess/source/ui/querydesign/JoinController.cxx b/dbaccess/source/ui/querydesign/JoinController.cxx
index d3f81d34d1d7..95531ed3bbaa 100644
--- a/dbaccess/source/ui/querydesign/JoinController.cxx
+++ b/dbaccess/source/ui/querydesign/JoinController.cxx
@@ -419,7 +419,8 @@ void OJoinController::SaveTabWinsPosSize( OJoinTableView::OTableWindowMap* pTabW
"OJoinController::SaveTabWinsPosSize : inkonsistenter Zustand : sollte genausviel TabWinDatas haben wie TabWins !");
OJoinTableView::OTableWindowMap::iterator aIter = pTabWinList->begin();
- for(;aIter != pTabWinList->end();++aIter)
+ OJoinTableView::OTableWindowMap::iterator aEnd = pTabWinList->end();
+ for(;aIter != aEnd;++aIter)
SaveTabWinPosSize(aIter->second, nOffsetX, nOffsetY);
}
// -----------------------------------------------------------------------------
diff --git a/dbaccess/source/ui/querydesign/JoinExchange.cxx b/dbaccess/source/ui/querydesign/JoinExchange.cxx
index 21edc112be38..4f80fdefab9c 100644
--- a/dbaccess/source/ui/querydesign/JoinExchange.cxx
+++ b/dbaccess/source/ui/querydesign/JoinExchange.cxx
@@ -92,8 +92,9 @@ namespace dbaui
//------------------------------------------------------------------------
sal_Bool OJoinExchObj::isFormatAvailable( const DataFlavorExVector& _rFormats ,SotFormatStringId _nSlotID)
{
+ DataFlavorExVector::const_iterator aCheckEnd = _rFormats.end();
for ( DataFlavorExVector::const_iterator aCheck = _rFormats.begin();
- aCheck != _rFormats.end();
+ aCheck != aCheckEnd;
++aCheck
)
{
diff --git a/dbaccess/source/ui/querydesign/JoinTableView.cxx b/dbaccess/source/ui/querydesign/JoinTableView.cxx
index 150e39f9545d..16f4990cb5b5 100644
--- a/dbaccess/source/ui/querydesign/JoinTableView.cxx
+++ b/dbaccess/source/ui/querydesign/JoinTableView.cxx
@@ -102,6 +102,7 @@
#endif
#include <cppuhelper/exc_hlp.hxx>
#include <tools/diagnose_ex.h>
+#include <boost/bind.hpp>
#include <algorithm>
#include <functional>
@@ -291,7 +292,8 @@ void OJoinTableView::Resize()
return;
OTableWindowMapIterator aIter = m_aTableMap.begin();
- for(;aIter != m_aTableMap.end();++aIter)
+ OTableWindowMapIterator aEnd = m_aTableMap.end();
+ for(;aIter != aEnd;++aIter)
{
OTableWindow* pCurrent = aIter->second;
Point aPos(pCurrent->GetData()->GetPosition() - GetScrollOffset());
@@ -631,7 +633,8 @@ void OJoinTableView::SetDefaultTabWinPosSize( OTableWindow* pTabWin )
// Belegte Bereiche dieser Zeile pruefen
OTableWindow* pOtherTabWin;// = GetTabWinMap()->First();
OTableWindowMapIterator aIter = m_aTableMap.begin();
- for(;aIter != m_aTableMap.end();++aIter)
+ OTableWindowMapIterator aEnd = m_aTableMap.end();
+ for(;aIter != aEnd;++aIter)
{
pOtherTabWin = aIter->second;
Rectangle aOtherTabWinRect( pOtherTabWin->GetPosPixel(), pOtherTabWin->GetSizePixel() );
@@ -814,7 +817,8 @@ BOOL OJoinTableView::ScrollPane( long nDelta, BOOL bHoriz, BOOL bPaintScrollBars
Point aPos;
OTableWindowMapIterator aIter = m_aTableMap.begin();
- for(;aIter != m_aTableMap.end();++aIter)
+ OTableWindowMapIterator aEnd = m_aTableMap.end();
+ for(;aIter != aEnd;++aIter)
{
pTabWin = aIter->second;
aPos = pTabWin->GetPosPixel();
@@ -954,7 +958,8 @@ void OJoinTableView::MouseButtonUp( const MouseEvent& rEvt )
DeselectConn(GetSelectedConn());
::std::vector<OTableConnection*>::iterator aIter = m_vTableConnection.begin();
- for(;aIter != m_vTableConnection.end();++aIter)
+ ::std::vector<OTableConnection*>::iterator aEnd = m_vTableConnection.end();
+ for(;aIter != aEnd;++aIter)
{
if( (*aIter)->CheckHit(rEvt.GetPosPixel()) )
{
@@ -1085,9 +1090,7 @@ void OJoinTableView::DrawConnections( const Rectangle& rRect )
DBG_CHKTHIS(OJoinTableView,NULL);
//////////////////////////////////////////////////////////////////////
// Die Joins zeichnen
- ::std::vector<OTableConnection*>::iterator aIter = m_vTableConnection.begin();
- for(;aIter != m_vTableConnection.end();++aIter)
- (*aIter)->Draw( rRect );
+ ::std::for_each(m_vTableConnection.begin(),m_vTableConnection.end(),boost::bind( &OTableConnection::Draw, _1, boost::cref( rRect )));
// zum Schluss noch mal die selektierte ueber alle anderen drueber
if (GetSelectedConn())
GetSelectedConn()->Draw( rRect );
@@ -1124,7 +1127,8 @@ void OJoinTableView::ClearAll()
// und das selbe mit den Connections
::std::vector<OTableConnection*>::iterator aIter = m_vTableConnection.begin();
- for(;aIter != m_vTableConnection.end();++aIter)
+ ::std::vector<OTableConnection*>::iterator aEnd = m_vTableConnection.end();
+ for(;aIter != aEnd;++aIter)
RemoveConnection( *aIter ,sal_True);
m_vTableConnection.clear();
@@ -1325,7 +1329,8 @@ void OJoinTableView::Command(const CommandEvent& rEvt)
const Point& aMousePos = rEvt.GetMousePosPixel();
::std::vector<OTableConnection*>::iterator aIter = m_vTableConnection.begin();
- for(;aIter != m_vTableConnection.end();++aIter)
+ ::std::vector<OTableConnection*>::iterator aEnd = m_vTableConnection.end();
+ for(;aIter != aEnd;++aIter)
{
if( (*aIter)->CheckHit(aMousePos) )
{
@@ -1355,7 +1360,8 @@ OTableConnection* OJoinTableView::GetTabConn(const OTableWindow* pLhs,const OTab
BOOL bFoundStart = _rpFirstAfter ? FALSE : TRUE;
::std::vector<OTableConnection*>::const_iterator aIter = m_vTableConnection.begin();
- for(;aIter != m_vTableConnection.end();++aIter)
+ ::std::vector<OTableConnection*>::const_iterator aEnd = m_vTableConnection.end();
+ for(;aIter != aEnd;++aIter)
{
OTableConnection* pData = *aIter;
@@ -1437,7 +1443,8 @@ long OJoinTableView::PreNotify(NotifyEvent& rNEvt)
BOOL bForward = !pKeyEvent->GetKeyCode().IsShift();
// is there an active tab win ?
OTableWindowMapIterator aIter = m_aTableMap.begin();
- for(;aIter != m_aTableMap.end();++aIter)
+ OTableWindowMapIterator aEnd = m_aTableMap.end();
+ for(;aIter != aEnd;++aIter)
if (aIter->second && aIter->second->HasChildPathFocus())
break;
@@ -1569,7 +1576,8 @@ long OJoinTableView::PreNotify(NotifyEvent& rNEvt)
if (pSearchFor)
{
OTableWindowMapIterator aIter = m_aTableMap.begin();
- for(;aIter != m_aTableMap.end();++aIter)
+ OTableWindowMapIterator aEnd = m_aTableMap.end();
+ for(;aIter != aEnd;++aIter)
{
if (aIter->second == pSearchFor)
{
@@ -1622,7 +1630,8 @@ void OJoinTableView::StateChanged( StateChangedType nType )
SetZoomedPointFont( aFont );
OTableWindowMapIterator aIter = m_aTableMap.begin();
- for(;aIter != m_aTableMap.end();++aIter)
+ OTableWindowMapIterator aEnd = m_aTableMap.end();
+ for(;aIter != aEnd;++aIter)
{
aIter->second->SetZoom(GetZoom());
Size aSize(CalcZoom(aIter->second->GetSizePixel().Width()),CalcZoom(aIter->second->GetSizePixel().Height()));
@@ -1643,7 +1652,8 @@ void OJoinTableView::HideTabWins()
// working on a copy because the real list will be cleared in inner calls
OTableWindowMap aCopy(*pTabWins);
OTableWindowMap::iterator aIter = aCopy.begin();
- for(;aIter != aCopy.end();++aIter)
+ OTableWindowMap::iterator aEnd = aCopy.end();
+ for(;aIter != aEnd;++aIter)
RemoveTabWin(aIter->second);
}
@@ -1690,7 +1700,8 @@ void OJoinTableView::clearLayoutInformation()
m_aTableMap.clear();
::std::vector<OTableConnection*>::const_iterator aIter2 = m_vTableConnection.begin();
- for(;aIter2 != m_vTableConnection.end();++aIter2)
+ ::std::vector<OTableConnection*>::const_iterator aEnd2 = m_vTableConnection.end();
+ for(;aIter2 != aEnd2;++aIter2)
delete *aIter2;
m_vTableConnection.clear();
diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
index 30e3bd5cc5b8..e489a0c2a585 100644
--- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
@@ -464,34 +464,36 @@ namespace
OConnectionLineDataVec* pLineDataList,
OQueryTableConnectionData* pData)
{
- ::rtl::OUString aCondition;
- if ( !_xConnection.is() )
- return aCondition;
-
- OConnectionLineDataVec::iterator aIter = pLineDataList->begin();
- try
+ ::rtl::OUStringBuffer aCondition;
+ if ( _xConnection.is() )
{
- Reference< XDatabaseMetaData > xMetaData = _xConnection->getMetaData();
- ::rtl::OUString aQuote = xMetaData->getIdentifierQuoteString();
+ OConnectionLineDataVec::iterator aIter = pLineDataList->begin();
+ OConnectionLineDataVec::iterator aEnd = pLineDataList->end();
+ try
+ {
+ const Reference< XDatabaseMetaData > xMetaData = _xConnection->getMetaData();
+ const ::rtl::OUString aQuote = xMetaData->getIdentifierQuoteString();
+ const ::rtl::OUString sEqual(RTL_CONSTASCII_USTRINGPARAM(" = "));
- for(;aIter != pLineDataList->end();++aIter)
+ for(;aIter != aEnd;++aIter)
+ {
+ OConnectionLineDataRef pLineData = *aIter;
+ if(aCondition.getLength())
+ aCondition.append(C_AND);
+ aCondition.append(quoteTableAlias(sal_True,pData->GetAliasName(JTCS_FROM),aQuote));
+ aCondition.append(::dbtools::quoteName(aQuote, pLineData->GetFieldName(JTCS_FROM) ));
+ aCondition.append(sEqual);
+ aCondition.append(quoteTableAlias(sal_True,pData->GetAliasName(JTCS_TO),aQuote));
+ aCondition.append(::dbtools::quoteName(aQuote, pLineData->GetFieldName(JTCS_TO) ));
+ }
+ }
+ catch(SQLException&)
{
- OConnectionLineDataRef pLineData = *aIter;
- if(aCondition.getLength())
- aCondition += C_AND;
- aCondition += quoteTableAlias(sal_True,pData->GetAliasName(JTCS_FROM),aQuote);
- aCondition += ::dbtools::quoteName(aQuote, pLineData->GetFieldName(JTCS_FROM) );
- aCondition += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" = "));
- aCondition += quoteTableAlias(sal_True,pData->GetAliasName(JTCS_TO),aQuote);
- aCondition += ::dbtools::quoteName(aQuote, pLineData->GetFieldName(JTCS_TO) );
+ OSL_ASSERT(!"Failure while building Join criteria!");
}
}
- catch(SQLException&)
- {
- OSL_ASSERT(!"Failure while building Join criteria!");
- }
- return aCondition;
+ return aCondition.makeStringAndClear();
}
//------------------------------------------------------------------------------
/** JoinCycle looks for a join cycle and append it to the string
@@ -657,7 +659,8 @@ namespace
// first search for the "to" window
const ::std::vector<OTableConnection*>* pConnections = pEntryConn->GetParent()->getTableConnections();
::std::vector<OTableConnection*>::const_iterator aIter = pConnections->begin();
- for(;aIter != pConnections->end();++aIter)
+ ::std::vector<OTableConnection*>::const_iterator aEnd = pConnections->end();
+ for(;aIter != aEnd;++aIter)
{
OQueryTableConnection* pNext = static_cast<OQueryTableConnection*>(*aIter);
if(!pNext->IsVisited() && (pNext->GetSourceWin() == pEntryTabTo || pNext->GetDestWin() == pEntryTabTo))
@@ -671,11 +674,11 @@ namespace
}
// when nothing found found look for the "from" window
- if(aIter == pConnections->end())
+ if(aIter == aEnd)
{
OQueryTableWindow* pEntryTabFrom = static_cast<OQueryTableWindow*>(pEntryConn->GetSourceWin());
aIter = pConnections->begin();
- for(;aIter != pConnections->end();++aIter)
+ for(;aIter != aEnd;++aIter)
{
OQueryTableConnection* pNext = static_cast<OQueryTableConnection*>(*aIter);
if(!pNext->IsVisited() && (pNext->GetSourceWin() == pEntryTabFrom || pNext->GetDestWin() == pEntryTabFrom))
@@ -746,12 +749,17 @@ namespace
OTableFields& _rFieldList,
sal_Bool bAlias)
{
- ::rtl::OUString aTmpStr,aFieldListStr;
+ Reference< XConnection> xConnection = static_cast<OQueryController&>(_pView->getController()).getConnection();
+ if ( !xConnection.is() )
+ return ::rtl::OUString();
+
+ ::rtl::OUStringBuffer aTmpStr,aFieldListStr;
sal_Bool bAsterix = sal_False;
int nVis = 0;
OTableFields::iterator aIter = _rFieldList.begin();
- for(;aIter != _rFieldList.end();++aIter)
+ OTableFields::iterator aEnd = _rFieldList.end();
+ for(;aIter != aEnd;++aIter)
{
OTableFieldDescRef pEntryField = *aIter;
if ( pEntryField->IsVisible() )
@@ -764,31 +772,28 @@ namespace
if(nVis == 1)
bAsterix = sal_False;
- Reference< XConnection> xConnection = static_cast<OQueryController&>(_pView->getController()).getConnection();
- if(!xConnection.is())
- return aFieldListStr;
-
try
{
- Reference< XDatabaseMetaData > xMetaData = xConnection->getMetaData();
- ::rtl::OUString aQuote = xMetaData->getIdentifierQuoteString();
+ const Reference< XDatabaseMetaData > xMetaData = xConnection->getMetaData();
+ const ::rtl::OUString aQuote = xMetaData->getIdentifierQuoteString();
OJoinTableView::OTableWindowMap* pTabList = _pView->getTableView()->GetTabWinMap();
const static ::rtl::OUString sFieldSeparator(RTL_CONSTASCII_USTRINGPARAM(", "));
+ const static ::rtl::OUString s_sAs(RTL_CONSTASCII_USTRINGPARAM(" AS "));
aIter = _rFieldList.begin();
- for(;aIter != _rFieldList.end();++aIter)
+ for(;aIter != aEnd;++aIter)
{
OTableFieldDescRef pEntryField = *aIter;
::rtl::OUString rFieldName = pEntryField->GetField();
if ( rFieldName.getLength() && pEntryField->IsVisible() )
{
aTmpStr = ::rtl::OUString();
- ::rtl::OUString rAlias = pEntryField->GetAlias();
- ::rtl::OUString rFieldAlias = pEntryField->GetFieldAlias();
+ const ::rtl::OUString rAlias = pEntryField->GetAlias();
+ const ::rtl::OUString rFieldAlias = pEntryField->GetFieldAlias();
- aTmpStr += quoteTableAlias((bAlias || bAsterix),rAlias,aQuote);
+ aTmpStr.append(quoteTableAlias((bAlias || bAsterix),rAlias,aQuote));
// if we have a none numeric field, the table alias could be in the name
// otherwise we are not allowed to do this (e.g. 0.1 * PRICE )
@@ -798,8 +803,9 @@ namespace
String sTemp = rFieldName;
OTableFieldDescRef aInfo = new OTableFieldDesc();
OJoinTableView::OTableWindowMap::iterator tableIter = pTabList->begin();
+ OJoinTableView::OTableWindowMap::iterator tableEnd = pTabList->end();
sal_Bool bFound = sal_False;
- for(;!bFound && tableIter != pTabList->end() ;++tableIter)
+ for(;!bFound && tableIter != tableEnd ;++tableIter)
{
OQueryTableWindow* pTabWin = static_cast<OQueryTableWindow*>(tableIter->second);
@@ -810,21 +816,21 @@ namespace
if ( ( rFieldName.toChar() != '*' ) && ( rFieldName.indexOf( aQuote ) == -1 ) )
{
OSL_ENSURE(pEntryField->GetTable().getLength(),"No table field name!");
- aTmpStr += ::dbtools::quoteName(aQuote, rFieldName);
+ aTmpStr.append(::dbtools::quoteName(aQuote, rFieldName));
}
else
- aTmpStr += rFieldName;
+ aTmpStr.append(rFieldName);
}
else
- aTmpStr += rFieldName;
+ aTmpStr.append(rFieldName);
if ( pEntryField->isAggreateFunction() )
{
DBG_ASSERT(pEntryField->GetFunction().getLength(),"Functionname darf hier nicht leer sein! ;-(");
- ::rtl::OUString aTmpStr2( pEntryField->GetFunction());
- aTmpStr2 += ::rtl::OUString('(');
- aTmpStr2 += aTmpStr;
- aTmpStr2 += ::rtl::OUString(')');
+ ::rtl::OUStringBuffer aTmpStr2( pEntryField->GetFunction());
+ aTmpStr2.appendAscii("(");
+ aTmpStr2.append(aTmpStr.makeStringAndClear());
+ aTmpStr2.appendAscii(")");
aTmpStr = aTmpStr2;
}
@@ -833,26 +839,26 @@ namespace
pEntryField->isNumericOrAggreateFunction() ||
pEntryField->isOtherFunction()))
{
- aTmpStr += ::rtl::OUString::createFromAscii(" AS ");
- aTmpStr += ::dbtools::quoteName(aQuote, rFieldAlias);
+ aTmpStr.append(s_sAs);
+ aTmpStr.append(::dbtools::quoteName(aQuote, rFieldAlias));
}
- aFieldListStr += aTmpStr;
- aFieldListStr += sFieldSeparator;
+ aFieldListStr.append(aTmpStr.makeStringAndClear());
+ aFieldListStr.append(sFieldSeparator);
}
}
if(aFieldListStr.getLength())
- aFieldListStr = aFieldListStr.replaceAt(aFieldListStr.getLength()-2,2, ::rtl::OUString() );
+ aFieldListStr.setLength(aFieldListStr.getLength()-2);
}
catch(SQLException&)
{
OSL_ASSERT(!"Failure while building select list!");
}
- return aFieldListStr;
+ return aFieldListStr.makeStringAndClear();
}
//------------------------------------------------------------------------------
sal_Bool GenerateCriterias( OQueryDesignView* _pView,
- ::rtl::OUString& rRetStr,
- ::rtl::OUString& rHavingStr,
+ ::rtl::OUStringBuffer& rRetStr,
+ ::rtl::OUStringBuffer& rHavingStr,
OTableFields& _rFieldList,
sal_Bool bMulti )
{
@@ -863,7 +869,8 @@ namespace
// Zeilenweise werden die Ausdr"ucke mit AND verknuepft
sal_uInt16 nMaxCriteria = 0;
OTableFields::iterator aIter = _rFieldList.begin();
- for(;aIter != _rFieldList.end();++aIter)
+ OTableFields::iterator aEnd = _rFieldList.end();
+ for(;aIter != aEnd;++aIter)
{
nMaxCriteria = ::std::max<sal_uInt16>(nMaxCriteria,(sal_uInt16)(*aIter)->GetCriteria().size());
}
@@ -872,15 +879,15 @@ namespace
return FALSE;
try
{
- Reference< XDatabaseMetaData > xMetaData = xConnection->getMetaData();
- ::rtl::OUString aQuote = xMetaData->getIdentifierQuoteString();
+ const Reference< XDatabaseMetaData > xMetaData = xConnection->getMetaData();
+ const ::rtl::OUString aQuote = xMetaData->getIdentifierQuoteString();
const IParseContext& rContext = static_cast<OQueryController&>(_pView->getController()).getParser().getContext();
for (sal_uInt16 i=0 ; i < nMaxCriteria ; i++)
{
aHavingStr = aWhereStr = ::rtl::OUString();
- for(aIter = _rFieldList.begin();aIter != _rFieldList.end();++aIter)
+ for(aIter = _rFieldList.begin();aIter != aEnd;++aIter)
{
OTableFieldDescRef pEntryField = *aIter;
aFieldName = pEntryField->GetField();
@@ -996,26 +1003,26 @@ namespace
{
aWhereStr += ::rtl::OUString(')'); // Klammern zu fuer 'AND' Zweig
if (rRetStr.getLength()) // schon Feldbedingungen ?
- rRetStr += C_OR;
+ rRetStr.append(C_OR);
else // Klammern auf fuer 'OR' Zweig
- rRetStr += ::rtl::OUString('(');
- rRetStr += aWhereStr;
+ rRetStr.append(sal_Unicode('('));
+ rRetStr.append(aWhereStr);
}
if (aHavingStr.getLength())
{
aHavingStr += ::rtl::OUString(')'); // Klammern zu fuer 'AND' Zweig
if (rHavingStr.getLength()) // schon Feldbedingungen ?
- rHavingStr += C_OR;
+ rHavingStr.append(C_OR);
else // Klammern auf fuer 'OR' Zweig
- rHavingStr += ::rtl::OUString('(');
- rHavingStr += aHavingStr;
+ rHavingStr.append(sal_Unicode('('));
+ rHavingStr.append(aHavingStr);
}
}
if (rRetStr.getLength())
- rRetStr += ::rtl::OUString(')'); // Klammern zu fuer 'OR' Zweig
+ rRetStr.append(sal_Unicode(')')); // Klammern zu fuer 'OR' Zweig
if (rHavingStr.getLength())
- rHavingStr += ::rtl::OUString(')'); // Klammern zu fuer 'OR' Zweig
+ rHavingStr.append(sal_Unicode(')')); // Klammern zu fuer 'OR' Zweig
}
catch(SQLException&)
{
@@ -1046,8 +1053,8 @@ namespace
// * darf keine Filter enthalten : habe ich die entsprechende Warnung schon angezeigt ?
sal_Bool bCritsOnAsterikWarning = sal_False; // ** TMFS **
OTableFields::iterator aIter = _rFieldList.begin();
-
- for(;aIter != _rFieldList.end();++aIter)
+ OTableFields::iterator aEnd = _rFieldList.end();
+ for(;aIter != aEnd;++aIter)
{
OTableFieldDescRef pEntryField = *aIter;
EOrderDir eOrder = pEntryField->GetOrderDir();
@@ -1132,7 +1139,8 @@ namespace
const ::std::vector<OTableConnection*>* _pConnList)
{
::std::vector<OTableConnection*>::const_iterator aIter = _pConnList->begin();
- for(;aIter != _pConnList->end();++aIter)
+ ::std::vector<OTableConnection*>::const_iterator aEnd = _pConnList->end();
+ for(;aIter != aEnd;++aIter)
{
const OQueryTableConnection* pEntryConn = static_cast<const OQueryTableConnection*>(*aIter);
OQueryTableConnectionData* pEntryConnData = static_cast<OQueryTableConnectionData*>(pEntryConn->GetData().get());
@@ -1175,12 +1183,13 @@ namespace
if(!pConnList->empty())
{
::std::vector<OTableConnection*>::const_iterator aIter = pConnList->begin();
- for(;aIter != pConnList->end();++aIter)
+ ::std::vector<OTableConnection*>::const_iterator aEnd = pConnList->end();
+ for(;aIter != aEnd;++aIter)
static_cast<OQueryTableConnection*>(*aIter)->SetVisited(sal_False);
aIter = pConnList->begin();
- sal_Bool bUseEscape = ::dbtools::getBooleanDataSourceSetting( _xConnection, PROPERTY_OUTERJOINESCAPE );
- for(;aIter != pConnList->end();++aIter)
+ const sal_Bool bUseEscape = ::dbtools::getBooleanDataSourceSetting( _xConnection, PROPERTY_OUTERJOINESCAPE );
+ for(;aIter != aEnd;++aIter)
{
OQueryTableConnection* pEntryConn = static_cast<OQueryTableConnection*>(*aIter);
if(!pEntryConn->IsVisited())
@@ -1228,7 +1237,7 @@ namespace
// and now all inner joins
aIter = pConnList->begin();
- for(;aIter != pConnList->end();++aIter)
+ for(;aIter != aEnd;++aIter)
{
OQueryTableConnection* pEntryConn = static_cast<OQueryTableConnection*>(*aIter);
if(!pEntryConn->IsVisited())
@@ -1247,7 +1256,8 @@ namespace
}
// all tables that haven't a connection to anyone
OQueryTableView::OTableWindowMap::const_iterator aTabIter = pTabList->begin();
- for(;aTabIter != pTabList->end();++aTabIter)
+ OQueryTableView::OTableWindowMap::const_iterator aTabEnd = pTabList->end();
+ for(;aTabIter != aTabEnd;++aTabIter)
{
const OQueryTableWindow* pEntryTab = static_cast<const OQueryTableWindow*>(aTabIter->second);
if(!pEntryTab->ExistsAConn())
@@ -1278,7 +1288,8 @@ namespace
const ::rtl::OUString aQuote = xMetaData->getIdentifierQuoteString();
OTableFields::iterator aIter = _rFieldList.begin();
- for(;aIter != _rFieldList.end();++aIter)
+ OTableFields::iterator aEnd = _rFieldList.end();
+ for(;aIter != aEnd;++aIter)
{
OTableFieldDescRef pEntryField = *aIter;
if ( pEntryField->IsGroupBy() )
@@ -1421,7 +1432,7 @@ namespace
if ( SQL_ISRULE(pChild,search_condition) )
eErrorCode = GetORCriteria(_pView,_pSelectionBrw,pChild,nLevel,bHaving,bAddOrOnOneLine);
else
- eErrorCode = GetANDCriteria(_pView,_pSelectionBrw,pChild, bAddOrOnOneLine ? nLevel : nLevel++,bHaving,bAddOrOnOneLine);
+ eErrorCode = GetANDCriteria(_pView,_pSelectionBrw,pChild, bAddOrOnOneLine ? nLevel : nLevel++,bHaving, i == 0 ? false : bAddOrOnOneLine);
}
}
else
@@ -1475,8 +1486,9 @@ namespace
eErrorCode = GetORCriteria(_pView,_pSelectionBrw,pCondition->getChild(1), nLevel2,bHaving,bMustAddOrOnOneLine );
}
// Das erste Element ist (wieder) eine AND-Verknuepfung
- else if ( SQL_ISRULE(pCondition,boolean_term) && pCondition->count() == 3 )
+ else if ( SQL_ISRULE(pCondition,boolean_term) )
{
+ OSL_ENSURE(pCondition->count() == 3,"Illegal definifiton of boolean_term");
eErrorCode = GetANDCriteria(_pView,_pSelectionBrw,pCondition->getChild(0), nLevel,bHaving,bAddOrOnOneLine );
if ( eErrorCode == eOk )
eErrorCode = GetANDCriteria(_pView,_pSelectionBrw,pCondition->getChild(2), nLevel,bHaving,bAddOrOnOneLine );
@@ -1644,7 +1656,8 @@ namespace
{
OJoinTableView::OTableWindowMap* pTabList = _pView->getTableView()->GetTabWinMap();
OJoinTableView::OTableWindowMap::iterator aIter = pTabList->begin();
- for(;aIter != pTabList->end();++aIter)
+ OJoinTableView::OTableWindowMap::iterator aTabEnd = pTabList->end();
+ for(;aIter != aTabEnd;++aIter)
{
OQueryTableWindow* pTabWin = static_cast<OQueryTableWindow*>(aIter->second);
if (pTabWin->ExistsField( ::rtl::OUString::createFromAscii("*"), aDragLeft ))
@@ -1718,13 +1731,14 @@ namespace
{
OConnectionLineDataVec* pLineDataList = pConn->GetData()->GetConnLineDataList();
OConnectionLineDataVec::iterator aIter = pLineDataList->begin();
- for(;aIter != pLineDataList->end();++aIter)
+ OConnectionLineDataVec::iterator aEnd = pLineDataList->end();
+ for(;aIter != aEnd;++aIter)
{
if((*aIter)->GetSourceFieldName() == aDragLeft->GetField() ||
(*aIter)->GetDestFieldName() == aDragLeft->GetField() )
break;
}
- if(aIter != pLineDataList->end())
+ if(aIter != aEnd)
return eOk;
}
}
@@ -1853,7 +1867,8 @@ namespace
OQueryTableWindow* lcl_findColumnInTables( const ::rtl::OUString& _rColumName, const OJoinTableView::OTableWindowMap& _rTabList, OTableFieldDescRef& _rInfo )
{
OJoinTableView::OTableWindowMap::const_iterator aIter = _rTabList.begin();
- for ( ; aIter != _rTabList.end(); ++aIter )
+ OJoinTableView::OTableWindowMap::const_iterator aEnd = _rTabList.end();
+ for ( ; aIter != aEnd; ++aIter )
{
OQueryTableWindow* pTabWin = static_cast< OQueryTableWindow* >( aIter->second );
if ( pTabWin && pTabWin->ExistsField( _rColumName, _rInfo ) )
@@ -2019,7 +2034,8 @@ namespace
// now we have to insert the fields which aren't in the statement
OQueryController& rController = static_cast<OQueryController&>(_pView->getController());
OTableFields& rUnUsedFields = rController.getUnUsedFields();
- for(OTableFields::iterator aIter = rUnUsedFields.begin();aIter != rUnUsedFields.end();++aIter)
+ OTableFields::iterator aEnd = rUnUsedFields.end();
+ for(OTableFields::iterator aIter = rUnUsedFields.begin();aIter != aEnd;++aIter)
if(_pSelectionBrw->InsertField(*aIter,BROWSER_INVALIDID,sal_False,sal_False).isValid())
(*aIter) = NULL;
OTableFields().swap( rUnUsedFields );
@@ -2088,7 +2104,8 @@ namespace
OQueryTableView* pTableView = static_cast<OQueryTableView*>(_pView->getTableView());
pTableView->clearLayoutInformation();
OSQLTables::const_iterator aIter = aMap.begin();
- for(;aIter != aMap.end();++aIter)
+ OSQLTables::const_iterator aEnd = aMap.end();
+ for(;aIter != aEnd;++aIter)
{
OSQLTable xTable = aIter->second;
Reference< XPropertySet > xTableProps( xTable, UNO_QUERY_THROW );
@@ -2132,7 +2149,8 @@ namespace
// now delete the data for which we haven't any tablewindow
OJoinTableView::OTableWindowMap aTableMap(*pTableView->GetTabWinMap());
OJoinTableView::OTableWindowMap::iterator aIterTableMap = aTableMap.begin();
- for(;aIterTableMap != aTableMap.end();++aIterTableMap)
+ OJoinTableView::OTableWindowMap::iterator aIterTableEnd = aTableMap.end();
+ for(;aIterTableMap != aIterTableEnd;++aIterTableMap)
{
if(aMap.find(aIterTableMap->second->GetComposedName()) == aMap.end() &&
aMap.find(aIterTableMap->first) == aMap.end())
@@ -2191,7 +2209,8 @@ namespace
sal_Bool bFirstField = sal_True;
::rtl::OUString sAsterix(RTL_CONSTASCII_USTRINGPARAM("*"));
OJoinTableView::OTableWindowMap::iterator aIter = _pTabList->begin();
- for(;aIter != _pTabList->end() && eOk == eErrorCode ;++aIter)
+ OJoinTableView::OTableWindowMap::iterator aEnd = _pTabList->end();
+ for(;aIter != aEnd && eOk == eErrorCode ;++aIter)
{
OQueryTableWindow* pTabWin = static_cast<OQueryTableWindow*>(aIter->second);
OTableFieldDescRef aInfo = new OTableFieldDesc();
@@ -2319,7 +2338,8 @@ namespace
if ( pParamRef && pParamRef->getTokenValue().toChar() == '*' )
{
OJoinTableView::OTableWindowMap::iterator aIter = pTabList->begin();
- for(;aIter != pTabList->end();++aIter)
+ OJoinTableView::OTableWindowMap::iterator aEnd = pTabList->end();
+ for(;aIter != aEnd;++aIter)
{
OQueryTableWindow* pTabWin = static_cast<OQueryTableWindow*>(aIter->second);
if (pTabWin->ExistsField( ::rtl::OUString::createFromAscii("*"), aInfo ))
@@ -2448,7 +2468,8 @@ namespace
OTableFields& aList = rController.getTableFieldDesc();
OTableFields::iterator aIter = aList.begin();
- for(;aIter != aList.end();++aIter)
+ OTableFields::iterator aEnd = aList.end();
+ for(;aIter != aEnd;++aIter)
{
OTableFieldDescRef pEntry = *aIter;
if(pEntry.isValid() && pEntry->GetFieldAlias() == aColumnName)
@@ -2869,7 +2890,8 @@ void OQueryDesignView::fillValidFields(const ::rtl::OUString& sAliasName, ComboB
::rtl::OUString strCurrentPrefix;
::std::vector< ::rtl::OUString> aFields;
OJoinTableView::OTableWindowMap::iterator aIter = pTabWins->begin();
- for(;aIter != pTabWins->end();++aIter)
+ OJoinTableView::OTableWindowMap::iterator aEnd = pTabWins->end();
+ for(;aIter != aEnd;++aIter)
{
OQueryTableWindow* pCurrentWin = static_cast<OQueryTableWindow*>(aIter->second);
if (bAllTables || (pCurrentWin->GetAliasName() == sAliasName))
@@ -2880,7 +2902,8 @@ void OQueryDesignView::fillValidFields(const ::rtl::OUString& sAliasName, ComboB
pCurrentWin->EnumValidFields(aFields);
::std::vector< ::rtl::OUString>::iterator aStrIter = aFields.begin();
- for(;aStrIter != aFields.end();++aStrIter)
+ ::std::vector< ::rtl::OUString>::iterator aStrEnd = aFields.end();
+ for(;aStrIter != aStrEnd;++aStrIter)
{
if (bAllTables || aStrIter->toChar() == '*')
pFieldList->InsertEntry(::rtl::OUString(strCurrentPrefix) += *aStrIter);
@@ -2942,7 +2965,8 @@ sal_Bool OQueryDesignView::checkStatement()
sal_uInt32 nFieldcount = 0;
OTableFields& rFieldList = rController.getTableFieldDesc();
OTableFields::iterator aIter = rFieldList.begin();
- for(;aIter != rFieldList.end();++aIter)
+ OTableFields::iterator aEnd = rFieldList.end();
+ for(;aIter != aEnd;++aIter)
{
OTableFieldDescRef pEntryField = *aIter;
if ( pEntryField->GetField().getLength() && pEntryField->IsVisible() )
@@ -2951,6 +2975,7 @@ sal_Bool OQueryDesignView::checkStatement()
!pEntryField->HasCriteria() &&
pEntryField->isNoneFunction() &&
pEntryField->GetOrderDir() == ORDER_NONE &&
+ !pEntryField->IsGroupBy() &&
!pEntryField->GetFunction().getLength() )
rUnUsedFields.push_back(pEntryField);
}
@@ -2979,7 +3004,7 @@ sal_Bool OQueryDesignView::checkStatement()
// wenn es Felder gibt, koennen die nur durch Einfuegen aus einer schon existenten Tabelle entstanden sein; wenn andererseits
// eine Tabelle geloescht wird, verschwinden auch die zugehoerigen Felder -> ergo KANN es das nicht geben, dass Felder
// existieren, aber keine Tabellen (und aFieldListStr hat schon eine Laenge, das stelle ich oben sicher)
- ::rtl::OUString aHavingStr,aCriteriaListStr;
+ ::rtl::OUStringBuffer aHavingStr,aCriteriaListStr;
// ----------------- Kriterien aufbauen ----------------------
if (!GenerateCriterias(this,aCriteriaListStr,aHavingStr,rFieldList, nTabcount > 1))
return ::rtl::OUString();
@@ -2994,22 +3019,22 @@ sal_Bool OQueryDesignView::checkStatement()
if(aCriteriaListStr.getLength())
{
aTmp += C_AND;
- aTmp += aCriteriaListStr;
+ aTmp += aCriteriaListStr.makeStringAndClear();
}
aCriteriaListStr = aTmp;
}
// ----------------- Statement aufbauen ----------------------
- ::rtl::OUString aSqlCmd(::rtl::OUString::createFromAscii("SELECT "));
+ ::rtl::OUStringBuffer aSqlCmd(::rtl::OUString::createFromAscii("SELECT "));
if(static_cast<OQueryController&>(getController()).isDistinct())
- aSqlCmd += ::rtl::OUString::createFromAscii(" DISTINCT ");
- aSqlCmd += aFieldListStr;
- aSqlCmd += ::rtl::OUString::createFromAscii(" FROM ");
- aSqlCmd += aTableListStr;
+ aSqlCmd.append(::rtl::OUString::createFromAscii(" DISTINCT "));
+ aSqlCmd.append(aFieldListStr);
+ aSqlCmd.append(::rtl::OUString::createFromAscii(" FROM "));
+ aSqlCmd.append(aTableListStr);
if (aCriteriaListStr.getLength())
{
- aSqlCmd += ::rtl::OUString::createFromAscii(" WHERE ");
- aSqlCmd += aCriteriaListStr;
+ aSqlCmd.append(::rtl::OUString::createFromAscii(" WHERE "));
+ aSqlCmd.append(aCriteriaListStr.makeStringAndClear());
}
// ----------------- GroupBy aufbauen und Anh"angen ------------
Reference<XDatabaseMetaData> xMeta;
@@ -3019,18 +3044,18 @@ sal_Bool OQueryDesignView::checkStatement()
if ( xMeta.is() )
bUseAlias = bUseAlias || !xMeta->supportsGroupByUnrelated();
- aSqlCmd += GenerateGroupBy(this,rFieldList,bUseAlias);
+ aSqlCmd.append(GenerateGroupBy(this,rFieldList,bUseAlias));
// ----------------- having Anh"angen ------------
if(aHavingStr.getLength())
{
- aSqlCmd += ::rtl::OUString::createFromAscii(" HAVING ");
- aSqlCmd += aHavingStr;
+ aSqlCmd.append(::rtl::OUString::createFromAscii(" HAVING "));
+ aSqlCmd.append(aHavingStr.makeStringAndClear());
}
// ----------------- Sortierung aufbauen und Anh"angen ------------
::rtl::OUString sOrder;
SqlParseError eErrorCode = eOk;
if ( (eErrorCode = GenerateOrder(this,rFieldList,nTabcount > 1,sOrder)) == eOk)
- aSqlCmd += sOrder;
+ aSqlCmd.append(sOrder);
else
{
if ( !m_rController.hasError() )
@@ -3039,11 +3064,12 @@ sal_Bool OQueryDesignView::checkStatement()
m_rController.displayError();
}
+ ::rtl::OUString sSQL = aSqlCmd.makeStringAndClear();
if ( xConnection.is() )
{
::connectivity::OSQLParser& rParser( rController.getParser() );
::rtl::OUString sErrorMessage;
- ::std::auto_ptr<OSQLParseNode> pParseNode( rParser.parseTree( sErrorMessage, aSqlCmd, sal_True ) );
+ ::std::auto_ptr<OSQLParseNode> pParseNode( rParser.parseTree( sErrorMessage, sSQL, sal_True ) );
if ( pParseNode.get() )
{
OSQLParseNode* pNode = pParseNode->getChild(3)->getChild(1);
@@ -3055,12 +3081,12 @@ sal_Bool OQueryDesignView::checkStatement()
OSQLParseNode::compress(pCondition);
::rtl::OUString sTemp;
pParseNode->parseNodeToStr(sTemp,xConnection);
- aSqlCmd = sTemp;
+ sSQL = sTemp;
}
}
}
}
- return aSqlCmd;
+ return sSQL;
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
diff --git a/dbaccess/source/ui/querydesign/QueryTabWinUndoAct.cxx b/dbaccess/source/ui/querydesign/QueryTabWinUndoAct.cxx
index edcd46f09ae4..0bab915045cb 100644
--- a/dbaccess/source/ui/querydesign/QueryTabWinUndoAct.cxx
+++ b/dbaccess/source/ui/querydesign/QueryTabWinUndoAct.cxx
@@ -96,7 +96,8 @@ OQueryTabWinUndoAct::~OQueryTabWinUndoAct()
// und natuerlich auch die entsprechenden Connections
::std::vector<OTableConnection*>::iterator aIter = m_vTableConnection.begin();
- for(;aIter != m_vTableConnection.end();++aIter)
+ ::std::vector<OTableConnection*>::iterator aEnd = m_vTableConnection.end();
+ for(;aIter != aEnd;++aIter)
{
m_pOwner->DeselectConn(*aIter);
delete (*aIter);
diff --git a/dbaccess/source/ui/querydesign/QueryTableView.cxx b/dbaccess/source/ui/querydesign/QueryTableView.cxx
index 2d2623e4b246..a936178c0fab 100644
--- a/dbaccess/source/ui/querydesign/QueryTableView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryTableView.cxx
@@ -434,14 +434,15 @@ void OQueryTableView::NotifyTabConnection(const OQueryTableConnection& rNewConn,
// erst mal schauen, ob ich diese Connection schon habe
OQueryTableConnection* pTabConn = NULL;
const ::std::vector<OTableConnection*>* pConnections = getTableConnections();
+ ::std::vector<OTableConnection*>::const_iterator aEnd = pConnections->end();
::std::vector<OTableConnection*>::const_iterator aIter = ::std::find( pConnections->begin(),
- pConnections->end(),
+ aEnd,
static_cast<const OTableConnection*>(&rNewConn)
);
- if(aIter == pConnections->end())
+ if(aIter == aEnd )
{
aIter = pConnections->begin();
- for(;aIter != pConnections->end();++aIter)
+ for(;aIter != aEnd;++aIter)
{
if(*static_cast<OQueryTableConnection*>(*aIter) == rNewConn)
{
@@ -549,14 +550,15 @@ void OQueryTableView::AddTabWin(const ::rtl::OUString& _rComposedName, const ::r
TTableWindowData::value_type pNewTabWinData;
TTableWindowData* pWindowData = getDesignView()->getController().getTableWindowData();
TTableWindowData::iterator aWinIter = pWindowData->begin();
- for(;aWinIter != pWindowData->end();++aWinIter)
+ TTableWindowData::iterator aWinEnd = pWindowData->end();
+ for(;aWinIter != aWinEnd;++aWinIter)
{
pNewTabWinData = *aWinIter;
if (pNewTabWinData && pNewTabWinData->GetWinName() == strAlias && pNewTabWinData->GetComposedName() == _rComposedName && pNewTabWinData->GetTableName() == _rTableName)
break;
}
if ( !bAppend )
- bAppend = ( aWinIter == pWindowData->end() );
+ bAppend = ( aWinIter == aWinEnd );
if ( bAppend )
pNewTabWinData = createTableWindowData(_rComposedName, _rTableName, strAlias);
// die TabWinData brauche ich nicht in die entsprechende Liste der DocShell eintragen, das macht ShowTabWin
@@ -626,9 +628,10 @@ void OQueryTableView::AddTabWin(const ::rtl::OUString& _rComposedName, const ::r
OSL_ENSURE(aReferencedTable.getLength(),"Foreign key without referencedTableName");
OTableWindowMap::const_iterator aIter = pTabWins->find(aReferencedTable);
- if(aIter == pTabWins->end())
+ OTableWindowMap::const_iterator aEnd = pTabWins->end();
+ if(aIter == aEnd)
{
- for(aIter = pTabWins->begin();aIter != pTabWins->end();++aIter)
+ for(aIter = pTabWins->begin();aIter != aEnd;++aIter)
{
OQueryTableWindow* pTabWinTmp = static_cast<OQueryTableWindow*>(aIter->second);
OSL_ENSURE( pTabWinTmp,"TableWindow is null!" );
@@ -636,7 +639,7 @@ void OQueryTableView::AddTabWin(const ::rtl::OUString& _rComposedName, const ::r
break;
}
}
- if ( aIter != pTabWins->end() && pNewTabWin != aIter->second )
+ if ( aIter != aEnd && pNewTabWin != aIter->second )
addConnections( this, *pNewTabWin, *static_cast<OQueryTableWindow*>(aIter->second), xFKeyColumns );
}
break;
@@ -645,7 +648,8 @@ void OQueryTableView::AddTabWin(const ::rtl::OUString& _rComposedName, const ::r
{
// we have a primary key so look in our list if there exsits a key which this is refered to
OTableWindowMap::const_iterator aIter = pTabWins->begin();
- for(;aIter != pTabWins->end();++aIter)
+ OTableWindowMap::const_iterator aEnd = pTabWins->end();
+ for(;aIter != aEnd;++aIter)
{
OQueryTableWindow* pTabWinTmp = static_cast<OQueryTableWindow*>(aIter->second);
if ( pTabWinTmp == pNewTabWin )
@@ -827,7 +831,8 @@ sal_Bool OQueryTableView::FindTableFromField(const String& rFieldName, OTableFie
DBG_CHKTHIS(OQueryTableView,NULL);
rCnt = 0;
OTableWindowMap::const_iterator aIter = GetTabWinMap()->begin();
- for(;aIter != GetTabWinMap()->end();++aIter)
+ OTableWindowMap::const_iterator aEnd = GetTabWinMap()->end();
+ for(;aIter != aEnd;++aIter)
{
if(static_cast<OQueryTableWindow*>(aIter->second)->ExistsField(rFieldName, rInfo))
++rCnt;
@@ -919,7 +924,8 @@ void OQueryTableView::HideTabWin( OQueryTableWindow* pTabWin, OQueryTabWinUndoAc
// (ich muss ueber das Parent gehen, da nur das die Position der Scrollbars kennt)
// dann aus der Liste der TabWins raus und verstecken
OTableWindowMap::iterator aIter = pTabWins->begin();
- for ( ;aIter != pTabWins->end(); ++aIter )
+ OTableWindowMap::iterator aEnd = pTabWins->end();
+ for ( ;aIter != aEnd ; ++aIter )
if ( aIter->second == pTabWin )
{
pTabWins->erase( aIter );
@@ -943,7 +949,7 @@ void OQueryTableView::HideTabWin( OQueryTableWindow* pTabWin, OQueryTabWinUndoAc
sal_Int16 nCnt = 0;
const ::std::vector<OTableConnection*>* pTabConList = getTableConnections();
::std::vector<OTableConnection*>::const_iterator aIter2 = pTabConList->begin();
- for(;aIter2 != pTabConList->end();)
+ for(;aIter2 != pTabConList->end();)// the end may change
{
OQueryTableConnection* pTmpEntry = static_cast<OQueryTableConnection*>(*aIter2);
OSL_ENSURE(pTmpEntry,"OQueryTableConnection is null!");
@@ -1016,8 +1022,9 @@ sal_Bool OQueryTableView::ShowTabWin( OQueryTableWindow* pTabWin, OQueryTabWinUn
// die Connections
::std::vector<OTableConnection*>* pTableCon = pUndoAction->GetTabConnList();
::std::vector<OTableConnection*>::iterator aIter = pTableCon->begin();
+ ::std::vector<OTableConnection*>::iterator aEnd = pTableCon->end();
- for(;aIter != pTableCon->end();++aIter)
+ for(;aIter != aEnd;++aIter)
addConnection(*aIter); // add all connections from the undo action
// each connection should invalidated inside addConnection so we don't need this here any longer
@@ -1069,7 +1076,8 @@ sal_Bool OQueryTableView::ExistsAVisitedConn(const OQueryTableWindow* pFrom) con
if (pList)
{
::std::vector<OTableConnection*>::const_iterator aIter = pList->begin();
- for(;aIter != pList->end();++aIter)
+ ::std::vector<OTableConnection*>::const_iterator aEnd = pList->end();
+ for(;aIter != aEnd;++aIter)
{
OQueryTableConnection* pTemp = static_cast<OQueryTableConnection*>(*aIter);
if (pTemp->IsVisited() &&
diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
index 440be631a3ae..6b48bc528776 100644
--- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
+++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
@@ -573,7 +573,9 @@ void OSelectionBrowseBox::InitController(CellControllerRef& /*rController*/, lon
if (pTabWinList)
{
OJoinTableView::OTableWindowMap::iterator aIter = pTabWinList->begin();
- for(;aIter != pTabWinList->end();++aIter)
+ OJoinTableView::OTableWindowMap::iterator aEnd = pTabWinList->end();
+
+ for(;aIter != aEnd;++aIter)
m_pTableCell->InsertEntry(static_cast<OQueryTableWindow*>(aIter->second)->GetAliasName());
m_pTableCell->InsertEntry(String(ModuleRes(STR_QUERY_NOTABLE)), 0);
@@ -1790,7 +1792,8 @@ void OSelectionBrowseBox::AddGroupBy( const OTableFieldDescRef& rInfo , sal_uInt
OTableFields& rFields = getFields();
OTableFields::iterator aIter = rFields.begin();
- for(;aIter != rFields.end();++aIter)
+ OTableFields::iterator aEnd = rFields.end();
+ for(;aIter != aEnd;++aIter)
{
pEntry = *aIter;
OSL_ENSURE(pEntry.isValid(),"OTableFieldDescRef was null!");
@@ -1841,14 +1844,16 @@ void OSelectionBrowseBox::AddCondition( const OTableFieldDescRef& rInfo, const S
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
DBG_ASSERT(rInfo.isValid() && !rInfo->IsEmpty(),"AddCondition:: OTableFieldDescRef sollte nicht Empty sein!");
- OTableFieldDescRef pEntry;
+ OTableFieldDescRef pLastEntry;
Reference<XDatabaseMetaData> xMeta = xConnection->getMetaData();
::comphelper::UStringMixEqual bCase(xMeta.is() && xMeta->supportsMixedCaseQuotedIdentifiers());
- OTableFields::iterator aIter = getFields().begin();
- for(;aIter != getFields().end();++aIter)
+ OTableFields& rFields = getFields();
+ OTableFields::iterator aIter = rFields.begin();
+ OTableFields::iterator aEnd = rFields.end();
+ for(;aIter != aEnd;++aIter)
{
- pEntry = *aIter;
+ OTableFieldDescRef pEntry = *aIter;
const ::rtl::OUString aField = pEntry->GetField();
const ::rtl::OUString aAlias = pEntry->GetAlias();
@@ -1865,22 +1870,9 @@ void OSelectionBrowseBox::AddCondition( const OTableFieldDescRef& rInfo, const S
if(!m_bGroupByUnRelated && pEntry->IsGroupBy())
pEntry->SetVisible(sal_True);
}
- if (!pEntry->GetCriteria(nLevel).getLength() || _bAddOrOnOneLine )
+ if (!pEntry->GetCriteria(nLevel).getLength() )
{
- String sCriteria = rValue;
- if ( _bAddOrOnOneLine )
- {
- String sOldCriteria = pEntry->GetCriteria( nLevel );
- if ( sOldCriteria.Len() )
- {
- sCriteria = String(RTL_CONSTASCII_USTRINGPARAM("("));
- sCriteria += sOldCriteria;
- sCriteria += String(RTL_CONSTASCII_USTRINGPARAM(" OR "));
- sCriteria += rValue;
- sCriteria += String(RTL_CONSTASCII_USTRINGPARAM(")"));
- }
- }
- pEntry->SetCriteria( nLevel, sCriteria);
+ pEntry->SetCriteria( nLevel, rValue);
if(nLevel == (m_nVisibleCount-BROW_CRIT1_ROW-1))
{
RowInserted( GetRowCount()-1, 1, TRUE );
@@ -1889,11 +1881,36 @@ void OSelectionBrowseBox::AddCondition( const OTableFieldDescRef& rInfo, const S
}
m_bVisibleRow[BROW_CRIT1_ROW + nLevel] = sal_True;
break;
+ } // if (!pEntry->GetCriteria(nLevel).getLength() )
+ if ( _bAddOrOnOneLine )
+ {
+ pLastEntry = pEntry;
}
}
+ } // for(;aIter != getFields().end();++aIter)
+ if ( pLastEntry.isValid() )
+ {
+ String sCriteria = rValue;
+ String sOldCriteria = pLastEntry->GetCriteria( nLevel );
+ if ( sOldCriteria.Len() )
+ {
+ sCriteria = String(RTL_CONSTASCII_USTRINGPARAM("( "));
+ sCriteria += sOldCriteria;
+ sCriteria += String(RTL_CONSTASCII_USTRINGPARAM(" OR "));
+ sCriteria += rValue;
+ sCriteria += String(RTL_CONSTASCII_USTRINGPARAM(" )"));
+ }
+ pLastEntry->SetCriteria( nLevel, sCriteria);
+ if(nLevel == (m_nVisibleCount-BROW_CRIT1_ROW-1))
+ {
+ RowInserted( GetRowCount()-1, 1, TRUE );
+ m_bVisibleRow.push_back(sal_True);
+ ++m_nVisibleCount;
+ }
+ m_bVisibleRow[BROW_CRIT1_ROW + nLevel] = sal_True;
}
- if (aIter == getFields().end())
+ else if (aIter == getFields().end())
{
OTableFieldDescRef pTmp = InsertField(rInfo, BROWSER_INVALIDID, sal_False, sal_False );
if ( pTmp->isNumericOrAggreateFunction() && rInfo->IsGroupBy() ) // das GroupBy wird bereits von rInfo "ubernommen
@@ -1926,7 +1943,8 @@ void OSelectionBrowseBox::AddOrder( const OTableFieldDescRef& rInfo, const EOrde
sal_Bool bAppend = sal_False;
OTableFields& rFields = getFields();
OTableFields::iterator aIter = rFields.begin();
- for(;aIter != rFields.end();++aIter)
+ OTableFields::iterator aEnd = rFields.end();
+ for(;aIter != aEnd;++aIter)
{
pEntry = *aIter;
::rtl::OUString aField = pEntry->GetField();
diff --git a/dbaccess/source/ui/querydesign/TableConnection.cxx b/dbaccess/source/ui/querydesign/TableConnection.cxx
index 11e9da016f0d..38b2507da98a 100644
--- a/dbaccess/source/ui/querydesign/TableConnection.cxx
+++ b/dbaccess/source/ui/querydesign/TableConnection.cxx
@@ -89,8 +89,9 @@ namespace dbaui
// Linienliste mit Defaults initialisieren
OConnectionLineDataVec* pLineData = GetData()->GetConnLineDataList();
OConnectionLineDataVec::const_iterator aIter = pLineData->begin();
+ OConnectionLineDataVec::const_iterator aEnd = pLineData->end();
m_vConnLine.reserve(pLineData->size());
- for(;aIter != pLineData->end();++aIter)
+ for(;aIter != aEnd;++aIter)
m_vConnLine.push_back( new OConnectionLine(this, *aIter) );
}
@@ -102,7 +103,8 @@ namespace dbaui
// -----------------------------------------------------------------------------
void OTableConnection::clearLineData()
{
- for(::std::vector<OConnectionLine*>::iterator aLineIter = m_vConnLine.begin();aLineIter != m_vConnLine.end();++aLineIter)
+ ::std::vector<OConnectionLine*>::iterator aLineEnd = m_vConnLine.end();
+ for(::std::vector<OConnectionLine*>::iterator aLineIter = m_vConnLine.begin();aLineIter != aLineEnd;++aLineIter)
delete *aLineIter;
m_vConnLine.clear();
}
@@ -130,8 +132,9 @@ namespace dbaui
{
const ::std::vector<OConnectionLine*>* pLine = rConn.GetConnLineList();
::std::vector<OConnectionLine*>::const_iterator aIter = pLine->begin();
+ ::std::vector<OConnectionLine*>::const_iterator aEnd = pLine->end();
m_vConnLine.reserve(pLine->size());
- for(;aIter != pLine->end();++aIter)
+ for(;aIter != aEnd;++aIter)
m_vConnLine.push_back( CreateConnLine( **aIter ));
}
@@ -223,7 +226,8 @@ namespace dbaui
// Aus allen Linien das umgebende Rechteck bestimmen
Rectangle aBoundingRect( Point(0,0), Point(0,0) );
Rectangle aTempRect;
- for(::std::vector<OConnectionLine*>::const_iterator aIter = m_vConnLine.begin();aIter != m_vConnLine.end();++aIter)
+ ::std::vector<OConnectionLine*>::const_iterator aEnd = m_vConnLine.end();
+ for(::std::vector<OConnectionLine*>::const_iterator aIter = m_vConnLine.begin();aIter != aEnd;++aIter)
{
aTempRect = (*aIter)->GetBoundingRect();
diff --git a/dbaccess/source/ui/querydesign/TableConnectionData.cxx b/dbaccess/source/ui/querydesign/TableConnectionData.cxx
index 3ef73f61dbdb..c1d55cfb4793 100644
--- a/dbaccess/source/ui/querydesign/TableConnectionData.cxx
+++ b/dbaccess/source/ui/querydesign/TableConnectionData.cxx
@@ -111,7 +111,8 @@ OTableConnectionData& OTableConnectionData::operator=( const OTableConnectionDat
OConnectionLineDataVec* pLineData = const_cast<OTableConnectionData*>(&rConnData)->GetConnLineDataList();
OConnectionLineDataVec::const_iterator aIter = pLineData->begin();
- for(;aIter != pLineData->end();++aIter)
+ OConnectionLineDataVec::const_iterator aEnd = pLineData->end();
+ for(;aIter != aEnd;++aIter)
m_vConnLineData.push_back(new OConnectionLineData(**aIter));
return *this;
@@ -140,12 +141,13 @@ BOOL OTableConnectionData::SetConnLine( USHORT nIndex, const String& rSourceFiel
BOOL OTableConnectionData::AppendConnLine( const ::rtl::OUString& rSourceFieldName, const ::rtl::OUString& rDestFieldName )
{
OConnectionLineDataVec::iterator aIter = m_vConnLineData.begin();
- for(;aIter != m_vConnLineData.end();++aIter)
+ OConnectionLineDataVec::iterator aEnd = m_vConnLineData.end();
+ for(;aIter != aEnd;++aIter)
{
if((*aIter)->GetDestFieldName() == rDestFieldName && (*aIter)->GetSourceFieldName() == rSourceFieldName)
break;
}
- if(aIter == m_vConnLineData.end())
+ if(aIter == aEnd)
{
OConnectionLineDataRef pNew = new OConnectionLineData(rSourceFieldName, rDestFieldName);
if (!pNew.isValid())
diff --git a/dbaccess/source/ui/querydesign/TableWindowAccess.cxx b/dbaccess/source/ui/querydesign/TableWindowAccess.cxx
index 9db1be38959f..fe419a957e7e 100644
--- a/dbaccess/source/ui/querydesign/TableWindowAccess.cxx
+++ b/dbaccess/source/ui/querydesign/TableWindowAccess.cxx
@@ -187,9 +187,10 @@ namespace dbaui
// search the postion of our table window in the table window map
OJoinTableView::OTableWindowMap* pMap = m_pTable->getTableView()->GetTabWinMap();
OJoinTableView::OTableWindowMap::iterator aIter = pMap->begin();
- for (nIndex = 0; aIter != pMap->end() && aIter->second != m_pTable; ++nIndex,++aIter)
+ OJoinTableView::OTableWindowMap::iterator aEnd = pMap->end();
+ for (nIndex = 0; aIter != aEnd && aIter->second != m_pTable; ++nIndex,++aIter)
;
- nIndex = aIter != pMap->end() ? nIndex : -1;
+ nIndex = aIter != aEnd ? nIndex : -1;
}
return nIndex;
}
@@ -278,9 +279,10 @@ namespace dbaui
const ::std::vector<OTableConnection*>* pConnectionList = pView->getTableConnections();
::std::vector<OTableConnection*>::const_iterator aIter = pView->getTableConnections(m_pTable);
+ ::std::vector<OTableConnection*>::const_iterator aEnd = pConnectionList->end();
::std::vector< Reference<XInterface> > aRelations;
aRelations.reserve(5); // just guessing
- for (; aIter != pConnectionList->end() ; ++aIter )
+ for (; aIter != aEnd ; ++aIter )
aRelations.push_back(getParentChild(aIter - pConnectionList->begin()));
Reference<XInterface> *pRelations = aRelations.empty() ? 0 : &aRelations[0];
diff --git a/dbaccess/source/ui/querydesign/query.src b/dbaccess/source/ui/querydesign/query.src
index 4dd9cb564b3e..393003b9a4f8 100644
--- a/dbaccess/source/ui/querydesign/query.src
+++ b/dbaccess/source/ui/querydesign/query.src
@@ -310,28 +310,6 @@ String STR_QRY_ILLEGAL_JOIN
Text [ en-US ] = "Join could not be processed" ;
};
-String STR_QUERY_SAVEMODIFIED
-{
- Text [ en-US ] = "The $object$ has been changed.\nDo you want to save the changes?" ;
- Text [ x-comment ] = "For $object$, one of the values of the RSC_QUERY_OBJECT_TYPE resource will be inserted.";
-};
-
-Resource RSC_QUERY_OBJECT_TYPE
-{
- String 1
- {
- Text [ en-US ] = "table view";
- };
- String 2
- {
- Text [ en-US ] = "query";
- };
- String 3
- {
- Text [ en-US ] = "SQL statement";
- };
-};
-
String STR_SVT_SQL_SYNTAX_ERROR
{
Text [ en-US ] = "Syntax error in SQL statement" ;
@@ -401,20 +379,42 @@ String STR_VIEWDESIGN
Text [ en-US ] = " - %PRODUCTNAME Base: View Design";
};
+String STR_QUERY_SAVEMODIFIED
+{
+ Text [ en-US ] = "$object$ has been changed.\nDo you want to save the changes?" ;
+ Text [ x-comment ] = "For $object$, one of the values of the RSC_QUERY_OBJECT_TYPE resource will be inserted.";
+};
+
String STR_ERROR_PARSING_STATEMENT
{
- Text [ en-US ] = "The SQL command which constitutes the $object$ could not be parsed.";
+ Text [ en-US ] = "$object$ is based on an SQL command which could not be parsed.";
Text [ x-comment ] = "For $object$, one of the values of the RSC_QUERY_OBJECT_TYPE resource "
"(except \"SQL command\", which doesn't make sense here) will be inserted.";
};
String STR_INFO_OPENING_IN_SQL_VIEW
{
- Text [ en-US ] = "The $object$ will be opened in SQL view.";
+ Text [ en-US ] = "$object$ will be opened in SQL view.";
Text [ x-comment ] = "For $object$, one of the values of the RSC_QUERY_OBJECT_TYPE resource "
"(except \"SQL command\", which doesn't make sense here) will be inserted.";
};
+Resource RSC_QUERY_OBJECT_TYPE
+{
+ String 1
+ {
+ Text [ en-US ] = "The table view";
+ };
+ String 2
+ {
+ Text [ en-US ] = "The query";
+ };
+ String 3
+ {
+ Text [ en-US ] = "The SQL statement";
+ };
+};
+
String STR_STATEMENT_WITHOUT_RESULT_SET
{
Text [ en-US ] = "The query does not create a result set, and thus cannot be part of another query.";
diff --git a/dbaccess/source/ui/querydesign/querycontroller.cxx b/dbaccess/source/ui/querydesign/querycontroller.cxx
index 5b6be38be4a9..ca1bc56f01ef 100644
--- a/dbaccess/source/ui/querydesign/querycontroller.cxx
+++ b/dbaccess/source/ui/querydesign/querycontroller.cxx
@@ -717,6 +717,8 @@ void OQueryController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue >&
pNodeTmp = pTemp->getChild(1);
::connectivity::OSQLParseNode::absorptions(pNodeTmp);
pNodeTmp = pTemp->getChild(1);
+ OSQLParseNode::compress(pNodeTmp);
+ pNodeTmp = pTemp->getChild(1);
} // if ( pCondition ) // no where clause
::rtl::OUString sTemp;
pNode->parseNodeToStr(sTemp,getConnection());
@@ -1098,8 +1100,9 @@ void OQueryController::reconnect(sal_Bool _bUI)
void OQueryController::saveViewSettings(Sequence<PropertyValue>& _rViewProps)
{
OTableFields::const_iterator aFieldIter = m_vTableFieldDesc.begin();
+ OTableFields::const_iterator aFieldEnd = m_vTableFieldDesc.end();
sal_Int32 nCount = 0;
- for(;aFieldIter != m_vTableFieldDesc.end();++aFieldIter)
+ for(;aFieldIter != aFieldEnd;++aFieldIter)
{
if(!(*aFieldIter)->IsEmpty())
++nCount;
@@ -1118,7 +1121,7 @@ void OQueryController::saveViewSettings(Sequence<PropertyValue>& _rViewProps)
PropertyValue *pFieldsIter = aFields.getArray();
// the fielddata
aFieldIter = m_vTableFieldDesc.begin();
- for(sal_Int32 i = 1;aFieldIter != m_vTableFieldDesc.end();++aFieldIter,++i)
+ for(sal_Int32 i = 1;aFieldIter !=aFieldEnd;++aFieldIter,++i)
{
if ( !(*aFieldIter)->IsEmpty() )
{
diff --git a/dbaccess/source/ui/relationdesign/RTableConnection.cxx b/dbaccess/source/ui/relationdesign/RTableConnection.cxx
index 7d83a2fc8cc4..6c10df064a18 100644
--- a/dbaccess/source/ui/relationdesign/RTableConnection.cxx
+++ b/dbaccess/source/ui/relationdesign/RTableConnection.cxx
@@ -104,7 +104,8 @@ void ORelationTableConnection::Draw( const Rectangle& rRect )
const OConnectionLine* pTopLine = NULL;
const ::std::vector<OConnectionLine*>* pConnLineList = GetConnLineList();
::std::vector<OConnectionLine*>::const_iterator aIter = pConnLineList->begin();
- for(;aIter != pConnLineList->end();++aIter)
+ ::std::vector<OConnectionLine*>::const_iterator aEnd = pConnLineList->end();
+ for(;aIter != aEnd;++aIter)
{
if( (*aIter)->IsValid() )
{
diff --git a/dbaccess/source/ui/relationdesign/RTableConnectionData.cxx b/dbaccess/source/ui/relationdesign/RTableConnectionData.cxx
index f052003c2c58..ad0bc1a26ea5 100644
--- a/dbaccess/source/ui/relationdesign/RTableConnectionData.cxx
+++ b/dbaccess/source/ui/relationdesign/RTableConnectionData.cxx
@@ -138,7 +138,8 @@ void ORelationTableConnectionData::ChangeOrientation()
// Source- und DestFieldName der Linien austauschen
::rtl::OUString sTempString;
OConnectionLineDataVec::iterator aIter = m_vConnLineData.begin();
- for(;aIter != m_vConnLineData.end();++aIter)
+ OConnectionLineDataVec::iterator aEnd = m_vConnLineData.end();
+ for(;aIter != aEnd;++aIter)
{
sTempString = (*aIter)->GetSourceFieldName();
(*aIter)->SetSourceFieldName( (*aIter)->GetDestFieldName() );
@@ -195,7 +196,8 @@ BOOL ORelationTableConnectionData::checkPrimaryKey(const Reference< XIndexAccess
for(;pKeyIter != pKeyEnd;++pKeyIter)
{
OConnectionLineDataVec::const_iterator aIter = m_vConnLineData.begin();
- for(;aIter != m_vConnLineData.end();++aIter)
+ OConnectionLineDataVec::const_iterator aEnd = m_vConnLineData.end();
+ for(;aIter != aEnd;++aIter)
{
++nValidLinesCount;
if ( (*aIter)->GetFieldName(_eEConnectionSide) == *pKeyIter )
@@ -338,7 +340,8 @@ BOOL ORelationTableConnectionData::Update()
if ( xColumnFactory.is() )
{
OConnectionLineDataVec::iterator aIter = m_vConnLineData.begin();
- for(;aIter != m_vConnLineData.end();++aIter)
+ OConnectionLineDataVec::iterator aEnd = m_vConnLineData.end();
+ for(;aIter != aEnd;++aIter)
{
if((*aIter)->GetSourceFieldName().getLength() && (*aIter)->GetDestFieldName().getLength())
{
@@ -392,7 +395,8 @@ BOOL ORelationTableConnectionData::Update()
xColumn->getPropertyValue(PROPERTY_RELATEDCOLUMN) >>= sRelatedColumn;
OConnectionLineDataVec::iterator aIter = m_vConnLineData.begin();
- for(;aIter != m_vConnLineData.end();++aIter)
+ OConnectionLineDataVec::iterator aEnd = m_vConnLineData.end();
+ for(;aIter != aEnd;++aIter)
{
if( (*aIter)->GetSourceFieldName() == sName
&& (*aIter)->GetDestFieldName() == sRelatedColumn )
diff --git a/dbaccess/source/ui/relationdesign/RelationController.cxx b/dbaccess/source/ui/relationdesign/RelationController.cxx
index b9b599c1c8cc..3997cb656799 100644
--- a/dbaccess/source/ui/relationdesign/RelationController.cxx
+++ b/dbaccess/source/ui/relationdesign/RelationController.cxx
@@ -515,12 +515,13 @@ TTableWindowData::value_type ORelationController::existsTable(const ::rtl::OUStr
Reference<XDatabaseMetaData> xMeta = getConnection()->getMetaData();
::comphelper::UStringMixEqual bCase(xMeta.is() && xMeta->supportsMixedCaseQuotedIdentifiers());
TTableWindowData::const_iterator aIter = m_vTableData.begin();
- for(;aIter != m_vTableData.end();++aIter)
+ TTableWindowData::const_iterator aEnd = m_vTableData.end();
+ for(;aIter != aEnd;++aIter)
{
if(bCase((*aIter)->GetComposedName(),_rComposedTableName))
break;
}
- return ( aIter != m_vTableData.end()) ? *aIter : TTableWindowData::value_type();
+ return ( aIter != aEnd) ? *aIter : TTableWindowData::value_type();
}
// -----------------------------------------------------------------------------
void ORelationController::loadLayoutInformation()
diff --git a/dbaccess/source/ui/relationdesign/RelationTableView.cxx b/dbaccess/source/ui/relationdesign/RelationTableView.cxx
index 82d42ccc87de..ffbff7cf2e3e 100644
--- a/dbaccess/source/ui/relationdesign/RelationTableView.cxx
+++ b/dbaccess/source/ui/relationdesign/RelationTableView.cxx
@@ -207,7 +207,8 @@ void ORelationTableView::AddConnection(const OJoinExchangeData& jxdSource, const
OTableWindow* pDestWin = jxdDest.pListBox->GetTabWin();
::std::vector<OTableConnection*>::const_iterator aIter = getTableConnections()->begin();
- for(;aIter != getTableConnections()->end();++aIter)
+ ::std::vector<OTableConnection*>::const_iterator aEnd = getTableConnections()->end();
+ for(;aIter != aEnd;++aIter)
{
OTableConnection* pFirst = *aIter;
if((pFirst->GetSourceWin() == pSourceWin && pFirst->GetDestWin() == pDestWin) ||
diff --git a/dbaccess/source/ui/relationdesign/relation.src b/dbaccess/source/ui/relationdesign/relation.src
index 391205223886..cb068c43d50c 100644
--- a/dbaccess/source/ui/relationdesign/relation.src
+++ b/dbaccess/source/ui/relationdesign/relation.src
@@ -77,7 +77,7 @@ String STR_QUERY_REL_DELETE_WINDOW
String STR_QUERY_REL_COULD_NOT_CREATE
{
- Text [ en-US ] = "The datbase could not create the relation. May be foreign keys for this kind of table aren't supported.\nPlease check your documentation of the database.";
+ Text [ en-US ] = "The database could not create the relation. May be foreign keys for this kind of table aren't supported.\nPlease check your documentation of the database.";
};
diff --git a/dbaccess/source/ui/tabledesign/FieldDescriptions.cxx b/dbaccess/source/ui/tabledesign/FieldDescriptions.cxx
index 4ece37f2fa51..699a2db8404b 100644
--- a/dbaccess/source/ui/tabledesign/FieldDescriptions.cxx
+++ b/dbaccess/source/ui/tabledesign/FieldDescriptions.cxx
@@ -176,7 +176,11 @@ OFieldDescription::OFieldDescription(const Reference< XPropertySet >& xAffectedC
if(xPropSetInfo->hasPropertyByName(PROPERTY_ISNULLABLE))
SetIsNullable(::comphelper::getINT32(xAffectedCol->getPropertyValue(PROPERTY_ISNULLABLE)));
if(xPropSetInfo->hasPropertyByName(PROPERTY_FORMATKEY))
- SetFormatKey(::comphelper::getINT32(xAffectedCol->getPropertyValue(PROPERTY_FORMATKEY)));
+ {
+ const Any aValue = xAffectedCol->getPropertyValue(PROPERTY_FORMATKEY);
+ if ( aValue.hasValue() )
+ SetFormatKey(::comphelper::getINT32(aValue));
+ }
if(xPropSetInfo->hasPropertyByName(PROPERTY_RELATIVEPOSITION))
m_aRelativePosition = xAffectedCol->getPropertyValue(PROPERTY_RELATIVEPOSITION);
if(xPropSetInfo->hasPropertyByName(PROPERTY_WIDTH))
@@ -184,7 +188,11 @@ OFieldDescription::OFieldDescription(const Reference< XPropertySet >& xAffectedC
if(xPropSetInfo->hasPropertyByName(PROPERTY_HIDDEN))
xAffectedCol->getPropertyValue(PROPERTY_HIDDEN) >>= m_bHidden;
if(xPropSetInfo->hasPropertyByName(PROPERTY_ALIGN))
- SetHorJustify( ::dbaui::mapTextJustify(::comphelper::getINT32(xAffectedCol->getPropertyValue(PROPERTY_ALIGN))));
+ {
+ const Any aValue = xAffectedCol->getPropertyValue(PROPERTY_ALIGN);
+ if ( aValue.hasValue() )
+ SetHorJustify( ::dbaui::mapTextJustify(::comphelper::getINT32(aValue)));
+ }
if(xPropSetInfo->hasPropertyByName(PROPERTY_ISAUTOINCREMENT))
SetAutoIncrement(::cppu::any2bool(xAffectedCol->getPropertyValue(PROPERTY_ISAUTOINCREMENT)));
}
diff --git a/dbaccess/source/ui/tabledesign/TEditControl.cxx b/dbaccess/source/ui/tabledesign/TEditControl.cxx
index 353ff0ea11d5..9694d285c511 100644
--- a/dbaccess/source/ui/tabledesign/TEditControl.cxx
+++ b/dbaccess/source/ui/tabledesign/TEditControl.cxx
@@ -512,7 +512,8 @@ void OTableEditorCtrl::InitController(CellControllerRef&, long nRow, sal_uInt16
const OTypeInfoMap* pTypeInfo = GetView()->getController().getTypeInfo();
OTypeInfoMap::const_iterator aIter = pTypeInfo->begin();
- for(;aIter != pTypeInfo->end();++aIter)
+ OTypeInfoMap::const_iterator aEnd = pTypeInfo->end();
+ for(;aIter != aEnd;++aIter)
pTypeCell->InsertEntry( aIter->second->aUIName );
pTypeCell->SelectEntry( aInitString );
}
@@ -620,9 +621,10 @@ sal_Int32 OTableEditorCtrl::HasFieldName( const String& rFieldName )
::comphelper::UStringMixEqual bCase(xMetaData.is() ? xMetaData->supportsMixedCaseQuotedIdentifiers() : sal_True);
::std::vector< ::boost::shared_ptr<OTableRow> >::iterator aIter = m_pRowList->begin();
+ ::std::vector< ::boost::shared_ptr<OTableRow> >::iterator aEnd = m_pRowList->end();
OFieldDescription* pFieldDescr;
sal_Int32 nCount(0);
- for(;aIter != m_pRowList->end();++aIter)
+ for(;aIter != aEnd;++aIter)
{
pFieldDescr = (*aIter)->GetActFieldDescr();
if( pFieldDescr && bCase(rFieldName,pFieldDescr->GetName()))
@@ -1310,9 +1312,9 @@ Any OTableEditorCtrl::GetCellData( long nRow, sal_uInt16 nColId )
String OTableEditorCtrl::GetCellText( long nRow, sal_uInt16 nColId ) const
{
DBG_CHKTHIS(OTableEditorCtrl,NULL);
- //////////////////////////////////////////////////////////////////////
- // Text aus Dokumentdaten holen
- return ::comphelper::getString(const_cast<OTableEditorCtrl*>(this)->GetCellData( nRow, nColId ));
+ ::rtl::OUString sCellText;
+ const_cast< OTableEditorCtrl* >( this )->GetCellData( nRow, nColId ) >>= sCellText;
+ return sCellText;
}
//------------------------------------------------------------------------------
@@ -1806,7 +1808,8 @@ void OTableEditorCtrl::SetPrimaryKey( sal_Bool bSet )
long nIndex = 0;
::std::vector< ::boost::shared_ptr<OTableRow> >::const_iterator aIter = m_pRowList->begin();
- for(sal_Int32 nRow = 0;aIter != m_pRowList->end();++aIter,++nRow)
+ ::std::vector< ::boost::shared_ptr<OTableRow> >::const_iterator aEnd = m_pRowList->end();
+ for(sal_Int32 nRow = 0;aIter != aEnd;++aIter,++nRow)
{
OFieldDescription* pFieldDescr = (*aIter)->GetActFieldDescr();
if( pFieldDescr && (*aIter)->IsPrimaryKey() && (!bSet || !IsRowSelected(nRow)) )
@@ -1856,7 +1859,8 @@ sal_Bool OTableEditorCtrl::IsPrimaryKey()
// Gehoeren alle markierten Felder zu einem Primary Key ?
long nPrimaryKeys = 0;
::std::vector< ::boost::shared_ptr<OTableRow> >::const_iterator aIter = m_pRowList->begin();
- for(sal_Int32 nRow=0;aIter != m_pRowList->end();++aIter,++nRow)
+ ::std::vector< ::boost::shared_ptr<OTableRow> >::const_iterator aEnd = m_pRowList->end();
+ for(sal_Int32 nRow=0;aIter != aEnd;++aIter,++nRow)
{
if( IsRowSelected(nRow) && !(*aIter)->IsPrimaryKey() )
return sal_False;
@@ -1890,7 +1894,7 @@ void OTableEditorCtrl::SwitchType( const TOTypeInfoSP& _pType )
pRow->SetFieldType( _pType, sal_True );
if ( _pType.get() )
{
- sal_uInt16 nCurrentlySelected = pTypeCell->GetSelectEntryPos();
+ const sal_uInt16 nCurrentlySelected = pTypeCell->GetSelectEntryPos();
if ( ( LISTBOX_ENTRY_NOTFOUND == nCurrentlySelected )
|| ( GetView()->getController().getTypeInfo( nCurrentlySelected ) != _pType )
@@ -1899,7 +1903,8 @@ void OTableEditorCtrl::SwitchType( const TOTypeInfoSP& _pType )
USHORT nEntryPos = 0;
const OTypeInfoMap* pTypeInfo = GetView()->getController().getTypeInfo();
OTypeInfoMap::const_iterator aIter = pTypeInfo->begin();
- for(;aIter != pTypeInfo->end();++aIter,++nEntryPos)
+ OTypeInfoMap::const_iterator aEnd = pTypeInfo->end();
+ for(;aIter != aEnd;++aIter,++nEntryPos)
{
if(aIter->second == _pType)
break;
diff --git a/dbaccess/source/ui/tabledesign/TableController.cxx b/dbaccess/source/ui/tabledesign/TableController.cxx
index f54c5104c955..87077ef9b766 100644
--- a/dbaccess/source/ui/tabledesign/TableController.cxx
+++ b/dbaccess/source/ui/tabledesign/TableController.cxx
@@ -166,6 +166,9 @@
#include <cppuhelper/exc_hlp.hxx>
#endif
#include "dsmeta.hxx"
+#include <boost/bind.hpp>
+#include <algorithm>
+#include <functional>
extern "C" void SAL_CALL createRegistryInfo_OTableControl()
{
@@ -255,7 +258,6 @@ OTableController::OTableController(const Reference< XMultiServiceFactory >& _rM)
InvalidateAll();
m_pTypeInfo = TOTypeInfoSP(new OTypeInfo());
m_pTypeInfo->aUIName = m_sTypeNames.GetToken(TYPE_OTHER);
- m_aTypeCollection.initUserDriverTypes(_rM);
}
// -----------------------------------------------------------------------------
OTableController::~OTableController()
@@ -1015,7 +1017,8 @@ void OTableController::loadData()
for(;pKeyBegin != pKeyEnd;++pKeyBegin)
{
::std::vector< ::boost::shared_ptr<OTableRow> >::iterator rowIter = m_vRowList.begin();
- for(;rowIter != m_vRowList.end();++rowIter)
+ ::std::vector< ::boost::shared_ptr<OTableRow> >::iterator rowEnd = m_vRowList.end();
+ for(;rowIter != rowEnd;++rowIter)
{
if((*rowIter)->GetActFieldDescr()->GetName() == *pKeyBegin)
{
@@ -1399,7 +1402,7 @@ void OTableController::alterColumns()
// third append the new columns
aIter = m_vRowList.begin();
- for(;aIter != m_vRowList.end();++aIter)
+ for(;aIter != aEnd;++aIter)
{
OSL_ENSURE(*aIter,"OTableRow is null!");
OFieldDescription* pField = (*aIter)->GetActFieldDescr();
@@ -1437,7 +1440,7 @@ void OTableController::alterColumns()
if ( xKeyColumns.is() )
{
aIter = m_vRowList.begin();
- for(;aIter != m_vRowList.end();++aIter)
+ for(;aIter != aEnd;++aIter)
{
OSL_ENSURE(*aIter,"OTableRow is null!");
OFieldDescription* pField = (*aIter)->GetActFieldDescr();
@@ -1551,9 +1554,7 @@ void OTableController::assignTable()
setEditable( xMeta.is() && !xMeta->isReadOnly() && (isAlterAllowed() || isDropAllowed() || isAddAllowed()) );
if(!isEditable())
{
- ::std::vector< ::boost::shared_ptr<OTableRow> >::iterator aIter = m_vRowList.begin();
- for(; aIter != m_vRowList.end(); ++aIter)
- (*aIter)->SetReadOnly(sal_True);
+ ::std::for_each(m_vRowList.begin(),m_vRowList.end(),boost::bind( &OTableRow::SetReadOnly, _1, boost::cref( sal_True )));
}
m_bNew = sal_False;
// be notified when the table is in disposing
@@ -1612,7 +1613,8 @@ void OTableController::reSyncRows()
sal_Bool bAlterAllowed = isAlterAllowed();
sal_Bool bAddAllowed = isAddAllowed();
::std::vector< ::boost::shared_ptr<OTableRow> >::iterator aIter = m_vRowList.begin();
- for(;aIter != m_vRowList.end();++aIter)
+ ::std::vector< ::boost::shared_ptr<OTableRow> >::iterator aEnd = m_vRowList.end();
+ for(;aIter != aEnd;++aIter)
{
OSL_ENSURE(*aIter,"OTableRow is null!");
OFieldDescription* pField = (*aIter)->GetActFieldDescr();
@@ -1636,7 +1638,8 @@ void OTableController::reSyncRows()
::comphelper::UStringMixEqual bCase(xMetaData.is() ? xMetaData->supportsMixedCaseQuotedIdentifiers() : sal_True);
::std::vector< ::boost::shared_ptr<OTableRow> >::const_iterator aIter = m_vRowList.begin();
- for(sal_Int32 i=0;aIter != m_vRowList.end();++aIter)
+ ::std::vector< ::boost::shared_ptr<OTableRow> >::const_iterator aEnd = m_vRowList.end();
+ for(sal_Int32 i=0;aIter != aEnd;++aIter)
{
OFieldDescription* pFieldDesc = (*aIter)->GetActFieldDescr();
if (pFieldDesc && pFieldDesc->GetName().getLength() && bCase(sName,pFieldDesc->GetName()))
@@ -1702,8 +1705,6 @@ sal_Int32 OTableController::getFirstEmptyRowPosition() const
// -----------------------------------------------------------------------------
bool OTableController::isAutoIncrementPrimaryKey() const
{
- ::dbaccess::DATASOURCE_TYPE eType = m_aTypeCollection.getType(::comphelper::getString(getDataSource()->getPropertyValue(PROPERTY_URL)));
- DataSourceMetaData aMeta(eType);
- return aMeta.getAdvancedSettingsSupport().bAutoIncrementIsPrimaryKey;
+ return getSdbMetaData().isAutoIncrementPrimaryKey();
}
// -----------------------------------------------------------------------------
diff --git a/dbaccess/source/ui/tabledesign/TableRowExchange.cxx b/dbaccess/source/ui/tabledesign/TableRowExchange.cxx
index a0aebcbc7b72..910b912d75b5 100644
--- a/dbaccess/source/ui/tabledesign/TableRowExchange.cxx
+++ b/dbaccess/source/ui/tabledesign/TableRowExchange.cxx
@@ -61,7 +61,8 @@ namespace dbaui
{
(*rxOStm) << (sal_Int32)pRows->size(); // first stream the size
::std::vector< ::boost::shared_ptr<OTableRow> >::const_iterator aIter = pRows->begin();
- for(;aIter != pRows->end();++aIter)
+ ::std::vector< ::boost::shared_ptr<OTableRow> >::const_iterator aEnd = pRows->end();
+ for(;aIter != aEnd;++aIter)
(*rxOStm) << *(*aIter);
return sal_True;
}
diff --git a/dbaccess/source/ui/tabledesign/TableUndo.cxx b/dbaccess/source/ui/tabledesign/TableUndo.cxx
index 2d8ec4d49994..e4a801c41396 100644
--- a/dbaccess/source/ui/tabledesign/TableUndo.cxx
+++ b/dbaccess/source/ui/tabledesign/TableUndo.cxx
@@ -271,11 +271,12 @@ void OTableEditorDelUndoAct::Undo()
// Geloeschte Zeilen wieder einfuegen
ULONG nPos;
::std::vector< ::boost::shared_ptr<OTableRow> >::iterator aIter = m_aDeletedRows.begin();
+ ::std::vector< ::boost::shared_ptr<OTableRow> >::iterator aEnd = m_aDeletedRows.end();
::boost::shared_ptr<OTableRow> pNewOrigRow;
::std::vector< ::boost::shared_ptr<OTableRow> >* pOriginalRows = pTabEdCtrl->GetRowList();
- for(;aIter != m_aDeletedRows.end();++aIter)
+ for(;aIter != aEnd;++aIter)
{
pNewOrigRow.reset(new OTableRow( **aIter ));
nPos = (*aIter)->GetPos();
@@ -294,9 +295,10 @@ void OTableEditorDelUndoAct::Redo()
// Zeilen wieder loeschen
ULONG nPos;
::std::vector< ::boost::shared_ptr<OTableRow> >::iterator aIter = m_aDeletedRows.begin();
+ ::std::vector< ::boost::shared_ptr<OTableRow> >::iterator aEnd = m_aDeletedRows.end();
::std::vector< ::boost::shared_ptr<OTableRow> >* pOriginalRows = pTabEdCtrl->GetRowList();
- for(;aIter != m_aDeletedRows.end();++aIter)
+ for(;aIter != aEnd;++aIter)
{
nPos = (*aIter)->GetPos();
pOriginalRows->erase( pOriginalRows->begin()+nPos );
@@ -354,8 +356,9 @@ void OTableEditorInsUndoAct::Redo()
long nInsertRow = m_nInsPos;
::boost::shared_ptr<OTableRow> pRow;
::std::vector< ::boost::shared_ptr<OTableRow> >::iterator aIter = m_vInsertedRows.begin();
+ ::std::vector< ::boost::shared_ptr<OTableRow> >::iterator aEnd = m_vInsertedRows.end();
::std::vector< ::boost::shared_ptr<OTableRow> >* pRowList = pTabEdCtrl->GetRowList();
- for(;aIter != m_vInsertedRows.end();++aIter)
+ for(;aIter != aEnd;++aIter)
{
pRow.reset(new OTableRow( **aIter ));
pRowList->insert( pRowList->begin()+nInsertRow ,pRow );
diff --git a/dbaccess/source/ui/uno/copytablewizard.cxx b/dbaccess/source/ui/uno/copytablewizard.cxx
index 511edcd4bb07..26f859cf2045 100644
--- a/dbaccess/source/ui/uno/copytablewizard.cxx
+++ b/dbaccess/source/ui/uno/copytablewizard.cxx
@@ -171,6 +171,8 @@ namespace dbaui
virtual void SAL_CALL setDestinationTableName( const ::rtl::OUString& _destinationTableName ) throw (RuntimeException);
virtual Optional< ::rtl::OUString > SAL_CALL getCreatePrimaryKey() throw (RuntimeException);
virtual void SAL_CALL setCreatePrimaryKey( const Optional< ::rtl::OUString >& _newPrimaryKey ) throw (IllegalArgumentException, RuntimeException);
+ virtual sal_Bool SAL_CALL getUseHeaderLineAsColumnNames() throw (RuntimeException);
+ virtual void SAL_CALL setUseHeaderLineAsColumnNames( sal_Bool _bUseHeaderLineAsColumnNames ) throw (RuntimeException);
virtual void SAL_CALL addCopyTableListener( const Reference< XCopyTableListener >& Listener ) throw (RuntimeException);
virtual void SAL_CALL removeCopyTableListener( const Reference< XCopyTableListener >& Listener ) throw (RuntimeException);
@@ -331,6 +333,7 @@ private:
sal_Int16 m_nOperation;
::rtl::OUString m_sDestinationTable;
Optional< ::rtl::OUString > m_aPrimaryKeyName;
+ sal_Bool m_bUseHeaderLineAsColumnNames;
// source
SharedConnection m_xSourceConnection;
@@ -381,6 +384,7 @@ CopyTableWizard::CopyTableWizard( const Reference< XMultiServiceFactory >& _rxOR
,m_nOperation( CopyTableOperation::CopyDefinitionAndData )
,m_sDestinationTable()
,m_aPrimaryKeyName( sal_False, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ID" ) ))
+ ,m_bUseHeaderLineAsColumnNames( sal_True )
,m_xSourceConnection()
,m_nCommandType( CommandType::COMMAND )
,m_pSourceObject()
@@ -522,7 +526,18 @@ void SAL_CALL CopyTableWizard::setCreatePrimaryKey( const Optional< ::rtl::OUStr
m_aPrimaryKeyName = _newPrimaryKey;
}
-
+// -----------------------------------------------------------------------------
+sal_Bool SAL_CALL CopyTableWizard::getUseHeaderLineAsColumnNames() throw (RuntimeException)
+{
+ CopyTableAccessGuard aGuard( *this );
+ return m_bUseHeaderLineAsColumnNames;
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL CopyTableWizard::setUseHeaderLineAsColumnNames( sal_Bool _bUseHeaderLineAsColumnNames ) throw (RuntimeException)
+{
+ CopyTableAccessGuard aGuard( *this );
+ m_bUseHeaderLineAsColumnNames = _bUseHeaderLineAsColumnNames;
+}
//--------------------------------------------------------------------
void SAL_CALL CopyTableWizard::addCopyTableListener( const Reference< XCopyTableListener >& _rxListener ) throw (RuntimeException)
{
@@ -589,6 +604,7 @@ void CopyTableWizard::impl_attributesToDialog_nothrow( OCopyTableWizard& _rDialo
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "uno", "Ocke.Janssen@sun.com", "CopyTableWizard::impl_attributesToDialog_nothrow" );
// primary key column
_rDialog.setCreatePrimaryKey( m_aPrimaryKeyName.IsPresent, m_aPrimaryKeyName.Value );
+ _rDialog.setUseHeaderLine(m_bUseHeaderLineAsColumnNames);
// everything else was passed at construction time already
}
@@ -606,6 +622,7 @@ void CopyTableWizard::impl_dialogToAttributes_nothrow( const OCopyTableWizard& _
m_sDestinationTable = _rDialog.getName();
m_nOperation = _rDialog.getOperation();
+ m_bUseHeaderLineAsColumnNames = _rDialog.UseHeaderLine();
}
//-------------------------------------------------------------------------
@@ -1018,18 +1035,18 @@ namespace
else
(m_xDest.get()->*_pSetter)( m_rDestPos, value );
}
-
- template< typename VALUE_TYPE >
+ template< typename VALUE_TYPE >
void transferComplexValue( VALUE_TYPE ( SAL_CALL XRow::*_pGetter )( sal_Int32 ),
void (SAL_CALL XParameters::*_pSetter)( sal_Int32, const VALUE_TYPE& ) )
{
- VALUE_TYPE value( (m_xSource.get()->*_pGetter)( m_rSourcePos ) );
+ const VALUE_TYPE value( (m_xSource.get()->*_pGetter)( m_rSourcePos ) );
+ {
if ( m_xSource->wasNull() )
m_xDest->setNull( m_rDestPos, m_rColTypes[ m_rSourcePos ] );
else
(m_xDest.get()->*_pSetter)( m_rDestPos, value );
+ }
}
-
private:
const sal_Int32& m_rSourcePos;
const sal_Int32& m_rDestPos;
@@ -1193,11 +1210,14 @@ void CopyTableWizard::impl_copyRows_throw( const Reference< XResultSet >& _rxSou
bContinue = _rxSourceResultSet->next();
if ( !bContinue )
+ {
break;
+ }
++nRowCount;
sal_Bool bInsertAutoIncrement = sal_True;
ODatabaseExport::TPositions::const_iterator aPosIter = aColumnMapping.begin();
+ ODatabaseExport::TPositions::const_iterator aPosEnd = aColumnMapping.end();
aCopyEvent.Error.clear();
try
@@ -1209,7 +1229,7 @@ void CopyTableWizard::impl_copyRows_throw( const Reference< XResultSet >& _rxSou
sal_Int32 nSourceColumn( 1 );
ValueTransfer aTransfer( nSourceColumn, nDestColumn, aSourceColTypes, xRow, xStatementParams );
- for ( ; aPosIter != aColumnMapping.end(); ++aPosIter )
+ for ( ; aPosIter != aPosEnd; ++aPosIter )
{
nDestColumn = aPosIter->first;
if ( nDestColumn == COLUMN_POSITION_NOT_FOUND )
diff --git a/dbaccess/source/ui/uno/makefile.mk b/dbaccess/source/ui/uno/makefile.mk
index 8651a83fd33a..11a1c7c5fbbd 100644
--- a/dbaccess/source/ui/uno/makefile.mk
+++ b/dbaccess/source/ui/uno/makefile.mk
@@ -51,8 +51,14 @@ SRC1FILES = \
copytablewizard.src
# ... object files ............................
+# workaround for issue http://qa.openoffice.org/issues/show_bug.cgi?id=102305 Linux specific
+.IF "$(COM)" == "GCC"
+NOOPTFILES=\
+ $(SLO)$/copytablewizard.obj
+.ENDIF
SLOFILES= \
+ $(SLO)$/copytablewizard.obj \
$(SLO)$/composerdialogs.obj \
$(SLO)$/unosqlmessage.obj \
$(SLO)$/unoadmin.obj \
@@ -62,13 +68,11 @@ SLOFILES= \
$(SLO)$/unoDirectSql.obj \
$(SLO)$/DBTypeWizDlg.obj \
$(SLO)$/DBTypeWizDlgSetup.obj \
- $(SLO)$/AdabasSettingsDlg.obj \
$(SLO)$/UserSettingsDlg.obj \
$(SLO)$/ColumnModel.obj \
$(SLO)$/ColumnControl.obj \
$(SLO)$/ColumnPeer.obj \
$(SLO)$/dbinteraction.obj \
- $(SLO)$/copytablewizard.obj \
$(SLO)$/textconnectionsettings_uno.obj
# --- Targets ----------------------------------
diff --git a/dbaccess/source/ui/uno/unoadmin.cxx b/dbaccess/source/ui/uno/unoadmin.cxx
index 547bad4cee07..d41675c0c051 100644
--- a/dbaccess/source/ui/uno/unoadmin.cxx
+++ b/dbaccess/source/ui/uno/unoadmin.cxx
@@ -94,8 +94,7 @@ ODatabaseAdministrationDialog::ODatabaseAdministrationDialog(const Reference< XM
{
DBG_CTOR(ODatabaseAdministrationDialog,NULL);
- m_pCollection = new ::dbaccess::ODsnTypeCollection();
- m_pCollection->initUserDriverTypes(m_aContext.getLegacyServiceFactory());
+ m_pCollection = new ::dbaccess::ODsnTypeCollection(_rxORB);
ODbAdminDialog::createItemSet(m_pDatasourceItems, m_pItemPool, m_pItemPoolDefaults, m_pCollection);
}
diff --git a/dbaccess/util/makefile.mk b/dbaccess/util/makefile.mk
index c21cba0cfdb5..cb276b7a7a5a 100644
--- a/dbaccess/util/makefile.mk
+++ b/dbaccess/util/makefile.mk
@@ -111,6 +111,7 @@ LIB2FILES=\
SHL2TARGET=$(TARGET2)$(DLLPOSTFIX)
SHL2STDLIBS= \
+ $(SVXCORELIB) \
$(SVXLIB) \
$(SFXLIB) \
$(SVTOOLLIB) \
diff --git a/reportdesign/inc/RptObject.hxx b/reportdesign/inc/RptObject.hxx
index 8415fd128e1d..00fe6d5a357f 100644
--- a/reportdesign/inc/RptObject.hxx
+++ b/reportdesign/inc/RptObject.hxx
@@ -176,8 +176,6 @@ public:
virtual ~OCustomShape();
virtual sal_Int32 GetStep() const;
-
- virtual SdrObject* CheckHit(const Point& rPnt,USHORT nTol,const SetOfByte*) const;
virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> getAwtComponent();
virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > getUnoShape();
@@ -220,8 +218,6 @@ public:
virtual ~OOle2Obj();
virtual sal_Int32 GetStep() const;
-
- virtual SdrObject* CheckHit(const Point& rPnt,USHORT nTol,const SetOfByte*) const;
virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> getAwtComponent();
virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > getUnoShape();
@@ -266,8 +262,6 @@ public:
TYPEINFO();
virtual sal_Int32 GetStep() const;
-
- virtual SdrObject* CheckHit(const Point& rPnt,USHORT nTol,const SetOfByte*) const;
virtual void _propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw(::com::sun::star::uno::RuntimeException);
/** creates the m_xMediator when it doesn't already exist.
diff --git a/reportdesign/inc/rptui_slotid.hrc b/reportdesign/inc/rptui_slotid.hrc
index 68b3019f2d86..c42eba11ec8f 100644
--- a/reportdesign/inc/rptui_slotid.hrc
+++ b/reportdesign/inc/rptui_slotid.hrc
@@ -209,4 +209,7 @@
#define SID_SECTION_SHRINK_BOTTOM ( SID_RPTUI_START + 165 )
#define SID_SECTION_SHRINK_MENU ( SID_RPTUI_START + 166 )
+#define SID_COLLAPSE_SECTION ( SID_RPTUI_START + 167 )
+#define SID_EXPAND_SECTION ( SID_RPTUI_START + 168 )
+
#endif // _RPTUI_SLOTID_HRC_
diff --git a/reportdesign/source/core/sdr/RptObject.cxx b/reportdesign/source/core/sdr/RptObject.cxx
index 3036872518b6..ab9b3e750bd5 100644
--- a/reportdesign/source/core/sdr/RptObject.cxx
+++ b/reportdesign/source/core/sdr/RptObject.cxx
@@ -609,16 +609,6 @@ FASTBOOL OCustomShape::EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd)
return bResult;
}
-//----------------------------------------------------------------------------
-SdrObject* OCustomShape::CheckHit( const Point& rPnt, USHORT nTol,const SetOfByte* pSet ) const
-{
- // #109994# fixed here, because the drawing layer doesn't handle objects
- // with a width or height of 0 in a proper way
- if ( IsInside(aOutRect,rPnt,nTol) )
- return const_cast<OCustomShape*>(this);
-
- return SdrObjCustomShape::CheckHit( rPnt, nTol, pSet );
-}
//----------------------------------------------------------------------------
void OCustomShape::SetObjectItemHelper(const SfxPoolItem& rItem)
@@ -900,15 +890,7 @@ FASTBOOL OUnoObject::EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd)
return aDefaultName;
}
-//----------------------------------------------------------------------------
-SdrObject* OUnoObject::CheckHit( const Point& rPnt, USHORT nTol,const SetOfByte* pSet ) const
-{
- DBG_CHKTHIS( rpt_OUnoObject,NULL);
- if ( IsInside(aOutRect,rPnt,nTol) )
- return const_cast<OUnoObject*>(this);
- return SdrUnoObj::CheckHit( rPnt, nTol, pSet );
-}
// -----------------------------------------------------------------------------
void OUnoObject::_propertyChange( const beans::PropertyChangeEvent& evt ) throw( uno::RuntimeException)
{
@@ -1144,16 +1126,7 @@ FASTBOOL OOle2Obj::EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd)
return bResult;
}
-//----------------------------------------------------------------------------
-SdrObject* OOle2Obj::CheckHit( const Point& rPnt, USHORT nTol,const SetOfByte* pSet ) const
-{
- DBG_CHKTHIS( rpt_OOle2Obj,NULL);
- if ( IsInside(aOutRect,rPnt,nTol) )
- return const_cast<OOle2Obj*>(this);
- return SdrOle2Obj::CheckHit( rPnt, nTol, pSet );
-}
-// -----------------------------------------------------------------------------
uno::Reference< beans::XPropertySet> OOle2Obj::getAwtComponent()
{
return uno::Reference< beans::XPropertySet>(m_xReportComponent,uno::UNO_QUERY);
diff --git a/reportdesign/source/filter/xml/xmlExport.cxx b/reportdesign/source/filter/xml/xmlExport.cxx
index 63a76c047195..31ac92345a2f 100644
--- a/reportdesign/source/filter/xml/xmlExport.cxx
+++ b/reportdesign/source/filter/xml/xmlExport.cxx
@@ -996,6 +996,11 @@ void ORptExport::exportContainer(const Reference< XSection>& _xSection)
exportSection(xSection);
}
}
+ } // if ( aColIter->xElement.is() )
+ else if ( !bShapeHandled )
+ {
+ bShapeHandled = true;
+ exportShapes(_xSection);
}
aColIter = aColIter + (aColIter->nColSpan - 1);
}
@@ -1617,7 +1622,7 @@ void ORptExport::exportShapes(const Reference< XSection>& _xSection,bool _bAddPa
{
::std::auto_ptr<SvXMLElementExport> pSubDocument;
uno::Reference< frame::XModel> xModel(xShape->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Model"))),uno::UNO_QUERY);
- if ( xModel.is() ) // special handlingfor chart object
+ if ( xModel.is() ) // special handling for chart object
{
pSubDocument.reset(new SvXMLElementExport(*this,XML_NAMESPACE_REPORT, XML_SUB_DOCUMENT, sal_False, sal_False));
exportMasterDetailFields(xShape.get());
diff --git a/reportdesign/source/ui/dlg/AddField.cxx b/reportdesign/source/ui/dlg/AddField.cxx
index 034ff5f9c7b5..6beebfcb30c8 100644
--- a/reportdesign/source/ui/dlg/AddField.cxx
+++ b/reportdesign/source/ui/dlg/AddField.cxx
@@ -116,7 +116,7 @@ uno::Sequence< beans::PropertyValue > OAddFieldWindowListBox::getSelectedFieldDe
DBG_NAME( rpt_OAddFieldWindowListBox );
//------------------------------------------------------------------------------
OAddFieldWindowListBox::OAddFieldWindowListBox( OAddFieldWindow* _pParent )
- :SvTreeListBox( _pParent, WB_BORDER|WB_SORT )
+ :SvTreeListBox( _pParent, WB_TABSTOP|WB_BORDER|WB_SORT )
,m_pTabWin( _pParent )
{
DBG_CTOR( rpt_OAddFieldWindowListBox,NULL);
diff --git a/reportdesign/source/ui/dlg/Formula.cxx b/reportdesign/source/ui/dlg/Formula.cxx
index 01c951b76363..7328b1c628eb 100644
--- a/reportdesign/source/ui/dlg/Formula.cxx
+++ b/reportdesign/source/ui/dlg/Formula.cxx
@@ -260,6 +260,11 @@ uno::Reference< sheet::XFormulaOpCodeMapper> FormulaDialog::getFormulaOpCodeMapp
return m_xOpCodeMapper;
}
// -----------------------------------------------------------------------------
+table::CellAddress FormulaDialog::getReferencePosition() const
+{
+ return table::CellAddress();
+}
+// -----------------------------------------------------------------------------
::std::auto_ptr<formula::FormulaTokenArray> FormulaDialog::convertToTokenArray(const uno::Sequence< sheet::FormulaToken >& _aTokenList)
{
::std::auto_ptr<formula::FormulaTokenArray> pArray(new FormulaTokenArray());
diff --git a/reportdesign/source/ui/dlg/Navigator.cxx b/reportdesign/source/ui/dlg/Navigator.cxx
index 0ed6d3a9affd..7932c5c04371 100644
--- a/reportdesign/source/ui/dlg/Navigator.cxx
+++ b/reportdesign/source/ui/dlg/Navigator.cxx
@@ -224,7 +224,7 @@ private:
DBG_NAME(rpt_NavigatorTree)
// -----------------------------------------------------------------------------
NavigatorTree::NavigatorTree( Window* pParent,OReportController& _rController )
- :SvTreeListBox( pParent, WB_HASBUTTONS|WB_HASLINES|WB_BORDER|WB_HSCROLL|WB_HASBUTTONSATROOT )
+ :SvTreeListBox( pParent, WB_TABSTOP| WB_HASBUTTONS|WB_HASLINES|WB_BORDER|WB_HSCROLL|WB_HASBUTTONSATROOT )
,comphelper::OSelectionChangeListener(m_aMutex)
,OPropertyChangeListener(m_aMutex)
,m_aTimerTriggered(-1,-1)
@@ -945,6 +945,7 @@ ONavigator::ONavigator( Window* _pParent
//SetOutputSizePixel(aOutSize);
FreeResource();
m_pImpl->m_pNavigatorTree->Show();
+ m_pImpl->m_pNavigatorTree->GrabFocus();
SetSizePixel(Size(STD_WIN_SIZE_X,STD_WIN_SIZE_Y));
Show();
@@ -975,6 +976,13 @@ void ONavigator::Resize()
m_pImpl->m_pNavigatorTree->SetPosSizePixel( aLBPos, aLBSize );
}
// -----------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
+void ONavigator::GetFocus()
+{
+ Window::GetFocus();
+ if ( m_pImpl->m_pNavigatorTree.get() )
+ m_pImpl->m_pNavigatorTree->GrabFocus();
+}
// =============================================================================
} // rptui
// =============================================================================
diff --git a/reportdesign/source/ui/inc/FixedTextColor.hxx b/reportdesign/source/ui/inc/FixedTextColor.hxx
index c80a49a9a557..32c139fa847b 100644
--- a/reportdesign/source/ui/inc/FixedTextColor.hxx
+++ b/reportdesign/source/ui/inc/FixedTextColor.hxx
@@ -31,10 +31,6 @@
#ifndef INCLUDED_FIXEDTEXTCOLOR_HXX
#define INCLUDED_FIXEDTEXTCOLOR_HXX
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_reportdesign.hxx"
-
-
/** === begin UNO includes === **/
#include <com/sun/star/beans/PropertyChangeEvent.hpp>
#include <com/sun/star/container/XChild.hpp>
diff --git a/reportdesign/source/ui/inc/FormattedFieldBeautifier.hxx b/reportdesign/source/ui/inc/FormattedFieldBeautifier.hxx
index bc5d406d1e5c..5c835d983ff3 100644
--- a/reportdesign/source/ui/inc/FormattedFieldBeautifier.hxx
+++ b/reportdesign/source/ui/inc/FormattedFieldBeautifier.hxx
@@ -31,10 +31,6 @@
#ifndef INCLUDED_FORMATTEDFIELDBEAUTIFIER_HXX
#define INCLUDED_FORMATTEDFIELDBEAUTIFIER_HXX
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_reportdesign.hxx"
-
-
/** === begin UNO includes === **/
#include <com/sun/star/beans/PropertyChangeEvent.hpp>
#include <com/sun/star/container/XChild.hpp>
diff --git a/reportdesign/source/ui/inc/Formula.hxx b/reportdesign/source/ui/inc/Formula.hxx
index a3a9f35d3ac0..3cb95522bc08 100644
--- a/reportdesign/source/ui/inc/Formula.hxx
+++ b/reportdesign/source/ui/inc/Formula.hxx
@@ -93,6 +93,7 @@ public:
virtual formula::IFunctionManager* getFunctionManager();
virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XFormulaParser> getFormulaParser() const;
virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XFormulaOpCodeMapper> getFormulaOpCodeMapper() const;
+ virtual ::com::sun::star::table::CellAddress getReferencePosition() const;
virtual ::std::auto_ptr<formula::FormulaTokenArray> convertToTokenArray(const ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken >& _aTokenList);
diff --git a/reportdesign/source/ui/inc/IReportControllerObserver.hxx b/reportdesign/source/ui/inc/IReportControllerObserver.hxx
index 2a51e1a655eb..e171fc386967 100644
--- a/reportdesign/source/ui/inc/IReportControllerObserver.hxx
+++ b/reportdesign/source/ui/inc/IReportControllerObserver.hxx
@@ -31,9 +31,6 @@
#ifndef INCLUDED_BEAUTIFIER_HXX
#define INCLUDED_BEAUTIFIER_HXX
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_reportdesign.hxx"
-
/** === begin UNO includes === **/
#include <com/sun/star/beans/PropertyChangeEvent.hpp>
/** === end UNO includes === **/
diff --git a/reportdesign/source/ui/inc/Navigator.hxx b/reportdesign/source/ui/inc/Navigator.hxx
index 764c53384bee..54dbba4caa88 100644
--- a/reportdesign/source/ui/inc/Navigator.hxx
+++ b/reportdesign/source/ui/inc/Navigator.hxx
@@ -50,6 +50,7 @@ namespace rptui
// window
virtual void Resize();
+ virtual void GetFocus();
};
// =============================================================================
} // namespace rptui
diff --git a/reportdesign/source/ui/inc/ReportController.hxx b/reportdesign/source/ui/inc/ReportController.hxx
index d84da255e9e3..f685723b418c 100644
--- a/reportdesign/source/ui/inc/ReportController.hxx
+++ b/reportdesign/source/ui/inc/ReportController.hxx
@@ -277,6 +277,12 @@ namespace rptui
*/
void markSection(const bool _bNext);
+ /** collapse or expand the currently selected section.
+ *
+ * \param _bCollapse collapse if TRUE otherwise expand
+ */
+ void collapseSection(const bool _bCollapse);
+
/** fills the member that chart is enabled or not
*
*/
diff --git a/reportdesign/source/ui/inc/SectionWindow.hxx b/reportdesign/source/ui/inc/SectionWindow.hxx
index 36eee47f83f3..1e6c71dd6d2d 100644
--- a/reportdesign/source/ui/inc/SectionWindow.hxx
+++ b/reportdesign/source/ui/inc/SectionWindow.hxx
@@ -65,7 +65,6 @@ namespace rptui
OReportSection m_aReportSection;
Splitter m_aSplitter;
OEndMarker m_aEndMarker;
- //Window m_aFill;
::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pSectionMulti;
::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pGroupMulti;
@@ -94,7 +93,7 @@ namespace rptui
bool setReportSectionTitle(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition>& _xReport,USHORT _nResId,::std::mem_fun_t< ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection> , OReportHelper> _pGetSection,::std::mem_fun_t<sal_Bool, OReportHelper> _pIsSectionOn);
void ImplInitSettings();
- DECL_LINK(Collapsed,OStartMarker*);
+ DECL_LINK(Collapsed,OColorListener*);
DECL_LINK(StartSplitHdl, Splitter*);
DECL_LINK(SplitHdl, Splitter*);
DECL_LINK(EndSplitHdl, Splitter*);
diff --git a/reportdesign/source/ui/inc/StartMarker.hxx b/reportdesign/source/ui/inc/StartMarker.hxx
index bbe4204eb989..d14abd076fc5 100644
--- a/reportdesign/source/ui/inc/StartMarker.hxx
+++ b/reportdesign/source/ui/inc/StartMarker.hxx
@@ -54,6 +54,7 @@ namespace rptui
sal_Bool m_bShowRuler;
+ void changeImage();
void initDefaultNodeImages();
void setColor();
virtual void ImplInitSettings();
diff --git a/reportdesign/source/ui/report/DesignView.cxx b/reportdesign/source/ui/report/DesignView.cxx
index b8da21afa273..40264c642d52 100644
--- a/reportdesign/source/ui/report/DesignView.cxx
+++ b/reportdesign/source/ui/report/DesignView.cxx
@@ -207,7 +207,7 @@ ODesignView::~ODesignView()
if ( m_pAddField )
{
SvtViewOptions aDlgOpt( E_WINDOW, String::CreateFromInt32( UID_RPT_RPT_APP_VIEW ) );
- aDlgOpt.SetWindowState( ::rtl::OUString::createFromAscii( m_pAddField->GetWindowState((WINDOWSTATE_MASK_X | WINDOWSTATE_MASK_Y | WINDOWSTATE_MASK_STATE | WINDOWSTATE_MASK_MINIMIZED)).GetBuffer() ) );
+ aDlgOpt.SetWindowState( ::rtl::OUString::createFromAscii( m_pAddField->GetWindowState(WINDOWSTATE_MASK_ALL).GetBuffer() ) );
notifySystemWindow(this,m_pAddField,::comphelper::mem_fun(&TaskPaneList::RemoveWindow));
::std::auto_ptr<Window> aTemp2(m_pAddField);
m_pAddField = NULL;
@@ -215,7 +215,7 @@ ODesignView::~ODesignView()
if ( m_pReportExplorer )
{
SvtViewOptions aDlgOpt( E_WINDOW, String::CreateFromInt32( RID_NAVIGATOR ) );
- aDlgOpt.SetWindowState( ::rtl::OUString::createFromAscii( m_pReportExplorer->GetWindowState((WINDOWSTATE_MASK_X | WINDOWSTATE_MASK_Y | WINDOWSTATE_MASK_STATE | WINDOWSTATE_MASK_MINIMIZED)).GetBuffer() ) );
+ aDlgOpt.SetWindowState( ::rtl::OUString::createFromAscii( m_pReportExplorer->GetWindowState(WINDOWSTATE_MASK_ALL).GetBuffer() ) );
notifySystemWindow(this,m_pReportExplorer,::comphelper::mem_fun(&TaskPaneList::RemoveWindow));
::std::auto_ptr<Window> aTemp2(m_pReportExplorer);
m_pReportExplorer = NULL;
@@ -691,6 +691,10 @@ sal_Bool ODesignView::handleKeyEvent(const KeyEvent& _rEvent)
{
if ( (m_pPropWin && m_pPropWin->HasChildPathFocus()) )
return sal_False;
+ if ( (m_pAddField && m_pAddField->HasChildPathFocus()) )
+ return sal_False;
+ if ( (m_pReportExplorer && m_pReportExplorer->HasChildPathFocus()) )
+ return sal_False;
return m_aScrollWindow.handleKeyEvent(_rEvent);
}
//------------------------------------------------------------------------
diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx
index 5e6781ef909c..1df7981e21b4 100644
--- a/reportdesign/source/ui/report/ReportController.cxx
+++ b/reportdesign/source/ui/report/ReportController.cxx
@@ -53,8 +53,7 @@
#include "AddField.hxx"
#include <toolkit/helper/vclunohelper.hxx>
#include "DateTime.hxx"
-#include <svtools/syslocale.hxx>
-#include <vcl/svapp.hxx>
+
#include <sfx2/filedlghelper.hxx>
#include <tools/string.hxx>
#include <tools/diagnose_ex.h>
@@ -104,6 +103,7 @@
#include <com/sun/star/sdbc/SQLWarning.hpp>
#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <vcl/svapp.hxx>
#include <vcl/msgbox.hxx>
#include <vcl/waitobj.hxx>
@@ -142,6 +142,8 @@
#include <svtools/itemset.hxx>
#include <svtools/aeitem.hxx> //CHINA001
#include <svtools/cliplistener.hxx>
+#include <svtools/syslocale.hxx>
+#include <svtools/viewoptions.hxx>
#include <vos/mutex.hxx>
#include "PropertyForward.hxx"
@@ -341,8 +343,11 @@ void OReportController::disposing()
m_pClipbordNotifier->AddRemoveListener( getView(), sal_False );
m_pClipbordNotifier->release();
m_pClipbordNotifier = NULL;
- }
+ } // if ( getView() && m_pClipbordNotifier )
+ if ( m_pGroupsFloater )
{
+ SvtViewOptions aDlgOpt( E_WINDOW, String::CreateFromInt32( RID_GROUPS_SORTING ) );
+ aDlgOpt.SetWindowState( ::rtl::OUString::createFromAscii( m_pGroupsFloater->GetWindowState(WINDOWSTATE_MASK_ALL).GetBuffer() ) );
::std::auto_ptr<FloatingWindow> aTemp(m_pGroupsFloater);
m_pGroupsFloater = NULL;
}
@@ -554,6 +559,8 @@ FeatureState OReportController::GetState(sal_uInt16 _nId) const
case SID_RPT_NEW_FUNCTION:
aReturn.bEnabled = isEditable();
break;
+ case SID_COLLAPSE_SECTION:
+ case SID_EXPAND_SECTION:
case SID_NEXT_MARK:
case SID_PREV_MARK:
aReturn.bEnabled = isEditable();
@@ -1166,6 +1173,12 @@ void OReportController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue >
case SID_RPT_NEW_FUNCTION:
createNewFunction(aArgs[0].Value);
break;
+ case SID_COLLAPSE_SECTION:
+ collapseSection(true);
+ break;
+ case SID_EXPAND_SECTION:
+ collapseSection(false);
+ break;
case SID_NEXT_MARK:
markSection(true);
break;
@@ -2102,6 +2115,8 @@ void OReportController::describeSupportedFeatures()
implDescribeSupportedFeature( ".uno:TerminateInplaceActivation", SID_TERMINATE_INPLACEACTIVATION);
implDescribeSupportedFeature( ".uno:SelectAllLabels", SID_SELECT_ALL_LABELS);
implDescribeSupportedFeature( ".uno:SelectAllEdits", SID_SELECT_ALL_EDITS);
+ implDescribeSupportedFeature( ".uno:CollapseSection", SID_COLLAPSE_SECTION);
+ implDescribeSupportedFeature( ".uno:ExpandSection", SID_EXPAND_SECTION);
}
// -----------------------------------------------------------------------------
SfxUndoManager* OReportController::getUndoMgr()
@@ -2558,6 +2573,9 @@ void OReportController::openSortingAndGroupingDialog()
if ( !m_pGroupsFloater )
{
m_pGroupsFloater = new OGroupsSortingDialog(getView(),!isEditable(),this);
+ SvtViewOptions aDlgOpt( E_WINDOW, String::CreateFromInt32( RID_GROUPS_SORTING ) );
+ if ( aDlgOpt.Exists() )
+ m_pGroupsFloater->SetWindowState( ByteString( aDlgOpt.GetWindowState().getStr(), RTL_TEXTENCODING_ASCII_US ) );
m_pGroupsFloater->AddEventListener(LINK(this,OReportController,EventLstHdl));
}
else if ( isUiVisible() )
@@ -3280,7 +3298,7 @@ void OReportController::createDateTime(const Sequence< PropertyValue >& _aArgs)
sal_Bool bTime = aMap.getUnpackedValueOrDefault(PROPERTY_TIME_STATE,sal_False);
if ( bTime )
{
- sFunction = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("NOW()"));
+ sFunction = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("TIMEVALUE(NOW())"));
aMap[PROPERTY_FORMATKEY] <<= aMap.getUnpackedValueOrDefault(PROPERTY_FORMATKEYTIME,sal_Int32(0));
createControl(aMap.getAsConstPropertyValueList(),xSection,sFunction);
}
@@ -3959,6 +3977,15 @@ void OReportController::createGroupSection(const bool _bUndo,const bool _bHeader
}
}
// -----------------------------------------------------------------------------
+void OReportController::collapseSection(const bool _bCollapse)
+{
+ ::boost::shared_ptr<OSectionWindow> pSection = m_pMyOwnView->getMarkedSection();
+ if ( pSection )
+ {
+ pSection->setCollapsed(_bCollapse);
+ }
+}
+// -----------------------------------------------------------------------------
void OReportController::markSection(const bool _bNext)
{
::boost::shared_ptr<OSectionWindow> pSection = m_pMyOwnView->getMarkedSection();
diff --git a/reportdesign/source/ui/report/ScrollHelper.cxx b/reportdesign/source/ui/report/ScrollHelper.cxx
index c4410ae7f079..5d13f78f3755 100644
--- a/reportdesign/source/ui/report/ScrollHelper.cxx
+++ b/reportdesign/source/ui/report/ScrollHelper.cxx
@@ -169,7 +169,7 @@ Size OScrollWindowHelper::ResizeScrollBars()
// disable painting in the corner between the scrollbars
if ( bVVisible && bHVisible )
{
- m_aCornerWin.SetPosSizePixel(*((Point*) &aOutPixSz), Size(nScrSize, nScrSize) );
+ m_aCornerWin.SetPosSizePixel(Point(aOutPixSz.Width(), aOutPixSz.Height()), Size(nScrSize, nScrSize) );
m_aCornerWin.Show();
}
else
diff --git a/reportdesign/source/ui/report/SectionWindow.cxx b/reportdesign/source/ui/report/SectionWindow.cxx
index 020db169cca2..a781a9f654d7 100644
--- a/reportdesign/source/ui/report/SectionWindow.cxx
+++ b/reportdesign/source/ui/report/SectionWindow.cxx
@@ -274,9 +274,10 @@ void OSectionWindow::Resize()
// -----------------------------------------------------------------------------
void OSectionWindow::setCollapsed(sal_Bool _bCollapsed)
{
- m_aReportSection.Show(_bCollapsed);
- m_aEndMarker.Show(_bCollapsed);
- m_aSplitter.Show(_bCollapsed);
+ if ( m_aStartMarker.isCollapsed() != _bCollapsed )
+ {
+ m_aStartMarker.setCollapsed(_bCollapsed);
+ }
}
//-----------------------------------------------------------------------------
void OSectionWindow::showProperties()
@@ -290,17 +291,20 @@ void OSectionWindow::setMarked(sal_Bool _bMark)
m_aEndMarker.setMarked(_bMark);
}
// -----------------------------------------------------------------------------
-IMPL_LINK( OSectionWindow, Collapsed, OStartMarker *, _pMarker )
+IMPL_LINK( OSectionWindow, Collapsed, OColorListener *, _pMarker )
{
if ( _pMarker )
{
- setCollapsed(!_pMarker->isCollapsed());
+ sal_Bool bShow = !_pMarker->isCollapsed();
+ m_aReportSection.Show(bShow);
+ m_aEndMarker.Show(bShow);
+ m_aSplitter.Show(bShow);
+
m_pParent->resize(*this);
Resize();
// TRY
// m_pParent->Invalidate(INVALIDATE_TRANSPARENT | INVALIDATE_NOCHILDREN);
Invalidate();
- // _pMarker->Invalidate();
}
return 0L;
}
diff --git a/reportdesign/source/ui/report/StartMarker.cxx b/reportdesign/source/ui/report/StartMarker.cxx
index b525a42f5dd8..d87f7464a140 100644
--- a/reportdesign/source/ui/report/StartMarker.cxx
+++ b/reportdesign/source/ui/report/StartMarker.cxx
@@ -181,12 +181,7 @@ void OStartMarker::MouseButtonUp( const MouseEvent& rMEvt )
{
m_bCollapsed = !m_bCollapsed;
- Image* pImage = NULL;
- if ( GetDisplayBackground().GetColor().IsDark() )
- pImage = m_bCollapsed ? s_pDefCollapsedHC : s_pDefExpandedHC;
- else
- pImage = m_bCollapsed ? s_pDefCollapsed : s_pDefExpanded;
- m_aImage.SetImage(*pImage);
+ changeImage();
m_aVRuler.Show(!m_bCollapsed && m_bShowRuler);
if ( m_aCollapsedLink.IsSet() )
@@ -195,6 +190,16 @@ void OStartMarker::MouseButtonUp( const MouseEvent& rMEvt )
m_pParent->showProperties();
}
+// -----------------------------------------------------------------------------
+void OStartMarker::changeImage()
+{
+ Image* pImage = NULL;
+ if ( GetDisplayBackground().GetColor().IsDark() )
+ pImage = m_bCollapsed ? s_pDefCollapsedHC : s_pDefExpandedHC;
+ else
+ pImage = m_bCollapsed ? s_pDefCollapsed : s_pDefExpanded;
+ m_aImage.SetImage(*pImage);
+}
// -----------------------------------------------------------------------
void OStartMarker::initDefaultNodeImages()
{
@@ -311,6 +316,7 @@ void OStartMarker::setCollapsed(sal_Bool _bCollapsed)
{
OColorListener::setCollapsed(_bCollapsed);
showRuler(_bCollapsed);
+ changeImage();
}
// -----------------------------------------------------------------------
void OStartMarker::zoom(const Fraction& _aZoom)
diff --git a/reportdesign/uiconfig/dbreport/accelerator/de-DE/default.xml b/reportdesign/uiconfig/dbreport/accelerator/de-DE/default.xml
index 4c64318cb9f1..6aaa305ae7a1 100644
--- a/reportdesign/uiconfig/dbreport/accelerator/de-DE/default.xml
+++ b/reportdesign/uiconfig/dbreport/accelerator/de-DE/default.xml
@@ -12,6 +12,8 @@
<accel:item accel:code="KEY_F" accel:mod1="true" accel:shift="false" xlink:href=".uno:SelectAllEdits"/>
<accel:item accel:code="KEY_Y" accel:mod1="true" xlink:href=".uno:Redo"/>
<accel:item accel:code="KEY_Z" accel:mod1="true" xlink:href=".uno:Undo"/>
+ <accel:item accel:code="KEY_SUBTRACT" xlink:href=".uno:CollapseSection"/>
+ <accel:item accel:code="KEY_ADD" xlink:href=".uno:ExpandSection"/>
<accel:item accel:code="KEY_TAB" accel:mod1="true" xlink:href=".uno:NextMark"/>
<accel:item accel:code="KEY_TAB" accel:mod1="true" accel:shift="true" xlink:href=".uno:PrevMark"/>
</accel:acceleratorlist>
diff --git a/reportdesign/uiconfig/dbreport/accelerator/en-GB/default.xml b/reportdesign/uiconfig/dbreport/accelerator/en-GB/default.xml
index 4c64318cb9f1..6aaa305ae7a1 100644
--- a/reportdesign/uiconfig/dbreport/accelerator/en-GB/default.xml
+++ b/reportdesign/uiconfig/dbreport/accelerator/en-GB/default.xml
@@ -12,6 +12,8 @@
<accel:item accel:code="KEY_F" accel:mod1="true" accel:shift="false" xlink:href=".uno:SelectAllEdits"/>
<accel:item accel:code="KEY_Y" accel:mod1="true" xlink:href=".uno:Redo"/>
<accel:item accel:code="KEY_Z" accel:mod1="true" xlink:href=".uno:Undo"/>
+ <accel:item accel:code="KEY_SUBTRACT" xlink:href=".uno:CollapseSection"/>
+ <accel:item accel:code="KEY_ADD" xlink:href=".uno:ExpandSection"/>
<accel:item accel:code="KEY_TAB" accel:mod1="true" xlink:href=".uno:NextMark"/>
<accel:item accel:code="KEY_TAB" accel:mod1="true" accel:shift="true" xlink:href=".uno:PrevMark"/>
</accel:acceleratorlist>
diff --git a/reportdesign/uiconfig/dbreport/accelerator/en-US/default.xml b/reportdesign/uiconfig/dbreport/accelerator/en-US/default.xml
index 4c64318cb9f1..6aaa305ae7a1 100644
--- a/reportdesign/uiconfig/dbreport/accelerator/en-US/default.xml
+++ b/reportdesign/uiconfig/dbreport/accelerator/en-US/default.xml
@@ -12,6 +12,8 @@
<accel:item accel:code="KEY_F" accel:mod1="true" accel:shift="false" xlink:href=".uno:SelectAllEdits"/>
<accel:item accel:code="KEY_Y" accel:mod1="true" xlink:href=".uno:Redo"/>
<accel:item accel:code="KEY_Z" accel:mod1="true" xlink:href=".uno:Undo"/>
+ <accel:item accel:code="KEY_SUBTRACT" xlink:href=".uno:CollapseSection"/>
+ <accel:item accel:code="KEY_ADD" xlink:href=".uno:ExpandSection"/>
<accel:item accel:code="KEY_TAB" accel:mod1="true" xlink:href=".uno:NextMark"/>
<accel:item accel:code="KEY_TAB" accel:mod1="true" accel:shift="true" xlink:href=".uno:PrevMark"/>
</accel:acceleratorlist>
diff --git a/reportdesign/util/makefile.mk b/reportdesign/util/makefile.mk
index 328dd2f55d3c..c6a5c8e8f75f 100644
--- a/reportdesign/util/makefile.mk
+++ b/reportdesign/util/makefile.mk
@@ -54,6 +54,7 @@ LIB1FILES=\
SHL1TARGET=$(TARGET)$(DLLPOSTFIX)
SHL1STDLIBS= \
+ $(SVXCORELIB) \
$(SVXLIB) \
$(FWELIB) \
$(SFXLIB) \
@@ -108,6 +109,7 @@ LIB2FILES=\
SHL2TARGET=$(TARGET2)$(DLLPOSTFIX)
SHL2STDLIBS= \
+ $(SVXCORELIB) \
$(SVXLIB) \
$(SFXLIB) \
$(SVTOOLLIB) \
@@ -175,7 +177,7 @@ LIB3FILES=\
SHL3TARGET=$(TARGET3)$(DLLPOSTFIX)
SHL3STDLIBS=\
- $(SVXLIB) \
+ $(SVXCORELIB) \
$(XMLOFFLIB) \
$(VCLLIB) \
$(UNOTOOLSLIB) \