summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladimir Glazounov <vg@openoffice.org>2009-08-26 10:09:17 +0000
committerVladimir Glazounov <vg@openoffice.org>2009-08-26 10:09:17 +0000
commitd8b00ac6bded309719287fd8335395aece6b5242 (patch)
tree6398904ec362cd4e4996e81c130546bf364f4537
parentcd17372fa9d49bf97c738adc4835d5f8e96d062a (diff)
CWS-TOOLING: integrate CWS dba32e
2009-08-10 13:16:25 +0200 fs r274805 : #i84390# typo corrected 2009-08-10 13:04:28 +0200 fs r274804 : #i103741# properly terminate the last token in a string with a 0 byte 2009-07-24 08:54:05 +0200 msc r274286 : #103219# changed long name 2009-07-24 08:42:28 +0200 msc r274285 : #i79649# changed behaviour of the wizard 2009-07-22 14:17:49 +0200 oj r274238 : GrabFocus 2009-07-22 13:38:01 +0200 oj r274232 : #i102934# mixed up 2009-07-22 13:37:16 +0200 oj r274231 : #i102934# mixed up 2009-07-21 12:30:36 +0200 oj r274176 : crash when using distinct 2009-07-21 10:03:44 +0200 oj r274163 : set last char to 0 2009-07-21 09:31:22 +0200 oj r274161 : mediatype corrected 2009-07-20 11:45:33 +0200 fs r274118 : typo in formatting string 2009-07-20 11:40:39 +0200 fs r274117 : removed unused include 2009-07-20 11:40:01 +0200 fs r274116 : class name corrected 2009-07-16 13:41:45 +0200 oj r274046 : i101587 wrong check for embeddeddatabase url in confguration, have to check path 2009-07-16 13:12:05 +0200 tbo r274044 : #i103219# adjust declarion to new hid.lst 2009-07-16 12:43:48 +0200 oj r274041 : #i102497# check also fot longvarchar 2009-07-16 12:15:41 +0200 oj r274039 : #i103030# handle type description and exceptions as well 2009-07-16 11:14:26 +0200 fs r274035 : let SVN ignore output paths 2009-07-16 09:23:43 +0200 fs r274030 : TransforFormComponentProperties: no need to check for attribute equality 2009-07-10 14:16:23 +0200 oj r273892 : CWS-TOOLING: rebase CWS dba32e to trunk@273858 (milestone: DEV300:m52) 2009-07-01 21:41:50 +0200 fs r273614 : #i10000# 2009-07-01 15:01:10 +0200 fs r273589 : Input required doesn't make sense at all in XML form documents 2009-07-01 12:10:31 +0200 fs r273562 : updated 2009-07-01 11:46:12 +0200 fs r273560 : #i103219# add about 100 missing long names 2009-07-01 10:11:41 +0200 fs r273551 : moved from socket/port usage to pipe/name usage, which is more common nowadays 2009-07-01 09:50:03 +0200 fs r273549 : removed obsolete (empty) folder 2009-07-01 09:47:35 +0200 fs r273548 : copied the code for the Accessibility Workbench herein, formerly located in the old CVS repository, at gsl/awb 2009-06-30 10:07:47 +0200 fs r273493 : merging latest changes from CWS dba32d 2009-06-29 20:46:31 +0200 fs r273482 : #i103138# Rectangle conversions 2009-06-29 10:01:13 +0200 fs r273453 : #i103138# refactored the code for positioning/zooming the control Basically, we now allow adjustControlGeometry_throw (formerly known as positionControl_throw and setControlZoom) to take an additional ViewTransformation parameter, describing the transformation to obtain the actual control position/size. Consequently, positionControl itself also allows for a ViewTransformation parameter. This has become necessary since during painting, the device which we created our control for might not necessarily have a proper MapMode set. In this case, if we would use this map mode for calculating the control's position/size, this would lead to wrong results. Note that this problem was introduced by the fix for #i101398#: During the fix, we postponed the control creation to a later time (when it is really needed). At this later time, the MapMode at the device is broken, at the earlier time where we formerly crearted the control (createPrimitive2DSequence), it is not yet broken. Whether or not the MapMode is defined as "broken" might depend on one's point of view, however ... I consider it broken, since: - we need the map mode to obtain the proper zoom level, which is to be forwarded to the control - there are scenarios where the MapMode is *not* set to MAP_PIXEL (in those scenarios, everything works fine), and there are scenarios where it *is* set to MAP_PIXEL (in those the bug 103138 appears). It somehow feels wrong that one cannot rely on the device's map mode this way, but on the other hand one has no possibility to obtain the current zoom by other means. Note that one issue (still to be submitted) is left: In the page pane of a Draw/Impress document, controls have a wrong text size. This is because in this pane, the above-mentioned "broken" map mode is used, which means the controls have a zoom of "1:1" set, which is wrong here. 2009-06-29 09:52:13 +0200 fs r273452 : during #i103138#: belongsToDevice is unused nowadays 2009-06-24 12:40:06 +0200 fs r273329 : #i102888# #i102899# 2009-06-24 12:10:29 +0200 oj r273327 : #i103030# some code changes 2009-06-24 09:44:14 +0200 oj r273311 : #i103030# some code changes 2009-06-24 09:24:42 +0200 oj r273309 : #i103030# add log 2009-06-24 09:03:29 +0200 fs r273308 : if a col's table name is schema.table, properly quote all parts 2009-06-24 08:56:06 +0200 oj r273307 : #i102691# changed string 2009-06-23 13:31:43 +0200 oj r273280 : #i102479# fix date, time and datetime 2009-06-23 12:51:28 +0200 oj r273277 : #i103020# clear old expression when updating to avoid dead pointers in treelist userdata 2009-06-23 12:17:16 +0200 oj r273275 : #i103030# add LogBridge 2009-06-23 11:53:10 +0200 oj r273272 : shawdowed var resolved 2009-06-23 11:48:49 +0200 oj r273270 : #i103030# add :log to uno env if var UNO_ENV_LOG is set 2009-06-23 11:47:47 +0200 oj r273269 : #i103030# add LogBridge 2009-06-23 11:47:11 +0200 oj r273268 : #i103030# add LogBridge 2009-06-23 08:05:08 +0200 oj r273253 : #i102934# add key for collapsing 2009-06-22 13:21:33 +0200 fs r273225 : merging latest changes from CWS dba32d 2009-06-22 13:15:22 +0200 fs r273221 : why restrict to 12 entries? 2009-06-22 08:12:21 +0200 oj r273196 : #i102655# choosen > chosen typo fixed 2009-06-22 08:08:04 +0200 oj r273195 : #i102657# typo fix 2009-06-22 08:06:28 +0200 oj r273194 : #i102934# expanding and collasping of section 2009-06-22 08:05:52 +0200 oj r273193 : #i102930# set focus in treelistbox 2009-06-22 08:04:56 +0200 oj r273192 : #i102929# enable tabstop 2009-06-19 13:18:26 +0200 oj r273157 : remove unused param 2009-06-19 10:07:05 +0200 oj r273149 : CWS-TOOLING: rebase CWS dba32e to trunk@272827 (milestone: DEV300:m50) 2009-06-19 07:32:40 +0200 oj r273146 : merge from dba32d to dba32e 2009-06-19 07:22:56 +0200 oj r273145 : merge from dba32d to dba32e 2009-06-19 07:22:33 +0200 oj r273144 : merge from dba32d to dba32e 2009-06-18 14:09:34 +0200 fs r273116 : merging the latest changes from CWS dba32d (up to revision 273108) herein, which effectively is a rebase to DEV300.m50 2009-06-18 08:50:35 +0200 oj r273098 : #i102894# fix for new line in text 2009-06-18 08:28:48 +0200 oj r273097 : #i102892# check any 2009-06-18 08:21:34 +0200 oj r273096 : check if error is valid 2009-06-16 13:49:28 +0200 fs r273019 : why make a drop down control by default? The form control factory in SVX does this better those days ... 2009-06-10 09:53:20 +0200 oj r272797 : add lic text 2009-06-10 09:48:55 +0200 oj r272796 : test added for i101618 2009-06-09 14:57:39 +0200 oj r272771 : #i101618# access database document only when script container is needed 2009-06-09 12:42:25 +0200 oj r272765 : #i102497# check type property 2009-06-09 12:32:49 +0200 oj r272764 : adjust test cases 2009-06-09 12:31:58 +0200 oj r272763 : adjust test cases 2009-06-09 12:31:22 +0200 oj r272762 : adjust test cases 2009-06-09 11:35:42 +0200 oj r272761 : check if error is valid 2009-06-09 11:29:42 +0200 oj r272760 : #i102497# longvarchar was missing 2009-06-08 14:52:49 +0200 fs r272733 : #i102564# when setting a new field, also set m_nFieldType 2009-06-08 13:51:20 +0200 oj r272730 : add tests 2009-06-05 14:38:01 +0200 oj r272686 : add dep 2009-06-05 14:35:00 +0200 oj r272684 : add new tests 2009-06-05 13:41:18 +0200 oj r272681 : code clean ups 2009-06-05 12:40:51 +0200 oj r272678 : code cleanup 2009-06-05 12:02:57 +0200 oj r272677 : code cleanup 2009-06-05 10:42:38 +0200 oj r272670 : #i49320# impl export of single rows and as RTF and HTML 2009-06-03 14:30:37 +0200 oj r272576 : #i79649# check if file matches filter wildcard 2009-06-03 13:41:57 +0200 oj r272560 : #i102470# impl not b like 'c'
-rwxr-xr-xconnectivity/qa/connectivity/tools/AbstractDatabase.java230
-rw-r--r--connectivity/qa/connectivity/tools/DataSource.java81
-rwxr-xr-xconnectivity/qa/connectivity/tools/DatabaseAccess.java66
-rwxr-xr-xconnectivity/qa/connectivity/tools/DbaseDatabase.java100
-rw-r--r--connectivity/qa/connectivity/tools/HsqlDatabase.java338
-rw-r--r--connectivity/qa/drivers/dbase/DBaseDateFunctions.java375
-rw-r--r--connectivity/qa/drivers/dbase/DBaseDriverTest.java75
-rw-r--r--connectivity/qa/drivers/dbase/DBaseNumericFunctions.java456
-rwxr-xr-xconnectivity/qa/drivers/dbase/DBaseSqlTests.java99
-rw-r--r--connectivity/qa/drivers/dbase/DBaseStringFunctions.java408
-rw-r--r--connectivity/qa/drivers/dbase/makefile.mk9
-rw-r--r--connectivity/source/commontools/DateConversion.cxx1
-rw-r--r--connectivity/source/commontools/dbtools.cxx1
-rw-r--r--connectivity/source/drivers/file/FResultSet.cxx4
-rw-r--r--connectivity/source/drivers/file/FStatement.cxx1
-rw-r--r--connectivity/source/drivers/file/fcode.cxx25
-rw-r--r--connectivity/source/drivers/file/fcomp.cxx7
-rw-r--r--connectivity/source/drivers/file/quotedstring.cxx4
-rw-r--r--connectivity/source/drivers/flat/ETable.cxx10
-rwxr-xr-xconnectivity/source/drivers/flat/flat.xcu2
-rw-r--r--connectivity/source/inc/file/fcode.hxx10
-rw-r--r--connectivity/source/inc/flat/ETable.hxx1
-rw-r--r--connectivity/source/parse/sqlflex.l2
-rw-r--r--connectivity/source/resource/conn_shared_res.src2
-rw-r--r--formula/source/ui/dlg/formula.cxx1
-rw-r--r--sfx2/source/dialog/templdlg.cxx6
26 files changed, 1469 insertions, 845 deletions
diff --git a/connectivity/qa/connectivity/tools/AbstractDatabase.java b/connectivity/qa/connectivity/tools/AbstractDatabase.java
new file mode 100755
index 0000000000..60a35c1d3d
--- /dev/null
+++ b/connectivity/qa/connectivity/tools/AbstractDatabase.java
@@ -0,0 +1,230 @@
+/*************************************************************************
+ *
+ * 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 connectivity.tools;
+
+import com.sun.star.container.XNameAccess;
+import com.sun.star.frame.XModel;
+import com.sun.star.frame.XStorable;
+import com.sun.star.io.IOException;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sdb.XDocumentDataSource;
+import com.sun.star.sdb.XOfficeDatabaseDocument;
+import com.sun.star.sdbc.SQLException;
+import com.sun.star.sdbc.XCloseable;
+import com.sun.star.sdbc.XConnection;
+import com.sun.star.sdbc.XStatement;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.util.CloseVetoException;
+import java.io.File;
+
+/**
+ *
+ * @author oj93728
+ */
+public abstract class AbstractDatabase implements DatabaseAccess
+{
+ // the service factory
+
+ protected final XMultiServiceFactory m_orb;
+ // the URL of the temporary file used for the database document
+ protected String m_databaseDocumentFile;
+ // the database document
+ protected XOfficeDatabaseDocument m_databaseDocument;
+ // the data source belonging to the database document
+ protected DataSource m_dataSource;
+ // the default connection
+ protected XConnection m_connection;
+
+ public AbstractDatabase(final XMultiServiceFactory orb) throws Exception
+ {
+ m_orb = orb;
+ }
+
+ // --------------------------------------------------------------------------------------------------------
+ public AbstractDatabase(final XMultiServiceFactory orb, final String _existingDocumentURL ) throws Exception
+ {
+ m_orb = orb;
+ createDBDocument( _existingDocumentURL );
+ }
+
+ /** returns a connection to the database
+ *
+ * Multiple calls to this method return the same connection. The DbaseDatabase object keeps
+ * the ownership of the connection, so you don't need to (and should not) dispose/close it.
+ *
+ */
+ public XConnection defaultConnection() throws SQLException
+ {
+ if (m_connection == null)
+ {
+ m_connection = m_databaseDocument.getDataSource().getConnection("", "");
+ }
+
+ return m_connection;
+ }
+
+ /** executes the given SQL statement via the defaultConnection
+ */
+ public void executeSQL(final String statementString) throws SQLException
+ {
+ final XStatement statement = defaultConnection().createStatement();
+ statement.execute(statementString);
+ }
+
+ /** stores the database document
+ */
+ public void store() throws IOException
+ {
+ if (m_databaseDocument != null)
+ {
+ final XStorable storeDoc = (XStorable) UnoRuntime.queryInterface(XStorable.class,
+ m_databaseDocument);
+ storeDoc.store();
+ }
+ }
+
+ /** closes the database document
+ *
+ * Any CloseVetoExceptions fired by third parties are ignored, and any reference to the
+ * database document is released.
+ */
+ public void close()
+ {
+ // close connection
+ final XCloseable closeConn = (XCloseable) UnoRuntime.queryInterface(XCloseable.class,
+ m_connection);
+ if (closeConn != null)
+ {
+ try
+ {
+ closeConn.close();
+ }
+ catch (SQLException e)
+ {
+ }
+ }
+ m_connection = null;
+
+ // close document
+ final com.sun.star.util.XCloseable closeDoc = (com.sun.star.util.XCloseable) UnoRuntime.queryInterface(
+ com.sun.star.util.XCloseable.class, m_databaseDocument);
+ if (closeDoc != null)
+ {
+ try
+ {
+ closeDoc.close(true);
+ }
+ catch (CloseVetoException e)
+ {
+ }
+ }
+ m_databaseDocument = null;
+ }
+
+ /** closes the document, and deletes the underlying file
+ */
+ public void closeAndDelete()
+ {
+ close();
+
+ if (m_databaseDocumentFile != null)
+ {
+ try
+ {
+ final File file = new File(m_databaseDocumentFile);
+ file.delete();
+ }
+ catch (Exception e)
+ {
+ }
+ }
+ }
+
+ /** returns the underlying database document
+ */
+ public XOfficeDatabaseDocument getDatabaseDocument()
+ {
+ return m_databaseDocument;
+ }
+
+ /** returns the model interface of the underlying database document
+ */
+ public XModel getModel()
+ {
+ return (XModel) UnoRuntime.queryInterface(XModel.class, m_databaseDocument);
+ }
+
+ public XMultiServiceFactory getORB()
+ {
+ return m_orb;
+ }
+
+ // --------------------------------------------------------------------------------------------------------
+ final protected void createDBDocument(final String _docURL) throws Exception
+ {
+ m_databaseDocumentFile = _docURL;
+
+ final XNameAccess dbContext = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class,
+ m_orb.createInstance("com.sun.star.sdb.DatabaseContext"));
+ final XDocumentDataSource dataSource = (XDocumentDataSource) UnoRuntime.queryInterface(XDocumentDataSource.class,
+ dbContext.getByName(_docURL));
+
+ m_databaseDocument = dataSource.getDatabaseDocument();
+ m_dataSource = new DataSource(m_orb, m_databaseDocument.getDataSource());
+ }
+
+ /** returns the URL of the ODB document represented by this instance
+ */
+ public String getDocumentURL()
+ {
+ return m_databaseDocumentFile;
+ }
+
+ /** returns the data source belonging to this database
+ */
+ public DataSource getDataSource()
+ {
+ return m_dataSource;
+ }
+
+ /** creates a row set operating the database, with a given command/type
+ */
+ public RowSet createRowSet(final int _commandType, final String _command)
+ {
+ return new RowSet(m_orb, getDocumentURL(), _commandType, _command);
+ }
+
+ @Override
+ protected void finalize() throws Throwable
+ {
+ closeAndDelete();
+ super.finalize();
+ }
+}
diff --git a/connectivity/qa/connectivity/tools/DataSource.java b/connectivity/qa/connectivity/tools/DataSource.java
index c28f4983f0..578d906fb2 100644
--- a/connectivity/qa/connectivity/tools/DataSource.java
+++ b/connectivity/qa/connectivity/tools/DataSource.java
@@ -27,10 +27,8 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-
package connectivity.tools;
-import com.sun.star.beans.UnknownPropertyException;
import com.sun.star.container.ElementExistException;
import com.sun.star.container.NoSuchElementException;
import com.sun.star.container.XNameAccess;
@@ -51,21 +49,22 @@ import java.util.logging.Logger;
public class DataSource
{
// the service factory
- XMultiServiceFactory m_orb;
- XDataSource m_dataSource;
- public DataSource( XMultiServiceFactory _orb, String _registeredName ) throws Exception
+ private final XMultiServiceFactory m_orb;
+ private XDataSource m_dataSource;
+
+ public DataSource(final XMultiServiceFactory _orb, final String _registeredName) throws Exception
{
m_orb = _orb;
- XNameAccess dbContext = (XNameAccess)UnoRuntime.queryInterface(XNameAccess.class,
- _orb.createInstance("com.sun.star.sdb.DatabaseContext"));
+ final XNameAccess dbContext = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class,
+ _orb.createInstance("com.sun.star.sdb.DatabaseContext"));
- m_dataSource = (XDataSource)UnoRuntime.queryInterface(XDataSource.class,
- dbContext.getByName( _registeredName ) );
+ m_dataSource = (XDataSource) UnoRuntime.queryInterface(XDataSource.class,
+ dbContext.getByName(_registeredName));
}
- public DataSource( XMultiServiceFactory _orb, XDataSource _dataSource )
+ public DataSource(final XMultiServiceFactory _orb,final XDataSource _dataSource)
{
m_orb = _orb;
m_dataSource = _dataSource;
@@ -75,49 +74,49 @@ public class DataSource
{
return m_dataSource;
}
-
+
/** creates a query with a given name and SQL command
- */
- public void createQuery( String _name, String _sqlCommand ) throws ElementExistException, WrappedTargetException, com.sun.star.lang.IllegalArgumentException
+ */
+ public void createQuery(final String _name, final String _sqlCommand) throws ElementExistException, WrappedTargetException, com.sun.star.lang.IllegalArgumentException
{
- createQuery( _name, _sqlCommand, true );
+ createQuery(_name, _sqlCommand, true);
}
/** creates a query with a given name, SQL command, and EscapeProcessing flag
- */
- public void createQuery( String _name, String _sqlCommand, boolean _escapeProcessing ) throws ElementExistException, WrappedTargetException, com.sun.star.lang.IllegalArgumentException
+ */
+ public void createQuery(final String _name, final String _sqlCommand, final boolean _escapeProcessing) throws ElementExistException, WrappedTargetException, com.sun.star.lang.IllegalArgumentException
{
- XSingleServiceFactory queryDefsFac = (XSingleServiceFactory)UnoRuntime.queryInterface(
- XSingleServiceFactory.class, getQueryDefinitions() );
+ final XSingleServiceFactory queryDefsFac = (XSingleServiceFactory) UnoRuntime.queryInterface(
+ XSingleServiceFactory.class, getQueryDefinitions());
XPropertySet queryDef = null;
try
{
- queryDef = (XPropertySet)UnoRuntime.queryInterface(
- XPropertySet.class, queryDefsFac.createInstance() );
- queryDef.setPropertyValue( "Command", _sqlCommand );
- queryDef.setPropertyValue( "EscapeProcessing", new Boolean( _escapeProcessing ) );
+ queryDef = (XPropertySet) UnoRuntime.queryInterface(
+ XPropertySet.class, queryDefsFac.createInstance());
+ queryDef.setPropertyValue("Command", _sqlCommand);
+ queryDef.setPropertyValue("EscapeProcessing", Boolean.valueOf(_escapeProcessing));
}
- catch( com.sun.star.uno.Exception e )
+ catch (com.sun.star.uno.Exception e)
{
- e.printStackTrace( System.err );
+ e.printStackTrace(System.err);
}
- XNameContainer queryDefsContainer = (XNameContainer)UnoRuntime.queryInterface(
- XNameContainer.class, getQueryDefinitions() );
- queryDefsContainer.insertByName( _name, queryDef );
+ final XNameContainer queryDefsContainer = (XNameContainer) UnoRuntime.queryInterface(
+ XNameContainer.class, getQueryDefinitions());
+ queryDefsContainer.insertByName(_name, queryDef);
}
/** provides the query definition with the given name
*/
- public QueryDefinition getQueryDefinition( String _name ) throws NoSuchElementException
+ public QueryDefinition getQueryDefinition(final String _name) throws NoSuchElementException
{
- XNameAccess allDefs = getQueryDefinitions();
+ final XNameAccess allDefs = getQueryDefinitions();
try
{
return new QueryDefinition(
- (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class, allDefs.getByName( _name ) ) );
+ (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, allDefs.getByName(_name)));
}
- catch ( WrappedTargetException e )
+ catch (WrappedTargetException e)
{
}
throw new NoSuchElementException();
@@ -127,8 +126,8 @@ public class DataSource
*/
public XNameAccess getQueryDefinitions()
{
- XQueryDefinitionsSupplier suppQueries = (XQueryDefinitionsSupplier)UnoRuntime.queryInterface(
- XQueryDefinitionsSupplier.class, m_dataSource );
+ final XQueryDefinitionsSupplier suppQueries = (XQueryDefinitionsSupplier) UnoRuntime.queryInterface(
+ XQueryDefinitionsSupplier.class, m_dataSource);
return suppQueries.getQueryDefinitions();
}
@@ -137,12 +136,12 @@ public class DataSource
* This is usually necessary if you created tables by directly executing SQL statements,
* bypassing the SDBCX layer.
*/
- public void refreshTables( com.sun.star.sdbc.XConnection _connection )
+ public void refreshTables(final com.sun.star.sdbc.XConnection _connection)
{
- XTablesSupplier suppTables = (XTablesSupplier)UnoRuntime.queryInterface(
- XTablesSupplier.class, _connection );
- XRefreshable refreshTables = (XRefreshable)UnoRuntime.queryInterface(
- XRefreshable.class, suppTables.getTables() );
+ final XTablesSupplier suppTables = (XTablesSupplier) UnoRuntime.queryInterface(
+ XTablesSupplier.class, _connection);
+ final XRefreshable refreshTables = (XRefreshable) UnoRuntime.queryInterface(
+ XRefreshable.class, suppTables.getTables());
refreshTables.refresh();
}
@@ -158,9 +157,9 @@ public class DataSource
String name = null;
try
{
- XPropertySet dataSourceProps = (XPropertySet) UnoRuntime.queryInterface(
- XPropertySet.class, m_dataSource );
- name = (String)dataSourceProps.getPropertyValue("Name");
+ final XPropertySet dataSourceProps = (XPropertySet) UnoRuntime.queryInterface(
+ XPropertySet.class, m_dataSource);
+ name = (String) dataSourceProps.getPropertyValue("Name");
}
catch (Exception ex)
{
diff --git a/connectivity/qa/connectivity/tools/DatabaseAccess.java b/connectivity/qa/connectivity/tools/DatabaseAccess.java
new file mode 100755
index 0000000000..bc39bb0990
--- /dev/null
+++ b/connectivity/qa/connectivity/tools/DatabaseAccess.java
@@ -0,0 +1,66 @@
+/*************************************************************************
+ *
+ * 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 connectivity.tools;
+
+import com.sun.star.frame.XModel;
+import com.sun.star.io.IOException;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sdb.XOfficeDatabaseDocument;
+import com.sun.star.sdbc.SQLException;
+import com.sun.star.sdbc.XConnection;
+
+/**
+ *
+ * @author oj93728
+ */
+public interface DatabaseAccess
+{
+ XConnection defaultConnection() throws SQLException;
+
+ void executeSQL(final String statementString) throws SQLException;
+
+ void store() throws IOException;
+
+ void close();
+
+ void closeAndDelete();
+
+ XOfficeDatabaseDocument getDatabaseDocument();
+
+ XModel getModel();
+
+ String getDocumentURL();
+
+ DataSource getDataSource();
+
+ RowSet createRowSet(final int _commandType, final String _command);
+
+ XMultiServiceFactory getORB();
+}
diff --git a/connectivity/qa/connectivity/tools/DbaseDatabase.java b/connectivity/qa/connectivity/tools/DbaseDatabase.java
new file mode 100755
index 0000000000..be41dfae39
--- /dev/null
+++ b/connectivity/qa/connectivity/tools/DbaseDatabase.java
@@ -0,0 +1,100 @@
+/*************************************************************************
+ *
+ * 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: DbaseDatabase.java,v $
+ * $Revision: 1.4.50.2 $
+ *
+ * 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 connectivity.tools;
+
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.frame.XStorable;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sdb.XOfficeDatabaseDocument;
+import com.sun.star.sdbc.SQLException;
+import com.sun.star.uno.UnoRuntime;
+
+import helper.URLHelper;
+import java.io.File;
+
+/**
+ *
+ * @author Ocke
+ */
+public class DbaseDatabase extends AbstractDatabase
+{
+ // --------------------------------------------------------------------------------------------------------
+
+ public DbaseDatabase(final XMultiServiceFactory orb) throws Exception
+ {
+ super(orb);
+ createDBDocument();
+ }
+
+ // --------------------------------------------------------------------------------------------------------
+ public DbaseDatabase(final XMultiServiceFactory orb, final String _existingDocumentURL) throws Exception
+ {
+ super(orb, _existingDocumentURL);
+ }
+
+ /** creates an empty database document in a temporary location
+ */
+ private void createDBDocument() throws Exception
+ {
+ final File documentFile = File.createTempFile("dbase", ".odb");
+ documentFile.deleteOnExit();
+ final File subPath = new File(documentFile.getParent() + File.separator + documentFile.getName().replaceAll(".odb", "") + File.separator );
+ subPath.mkdir();
+ //subPath.deleteOnExit();
+ m_databaseDocumentFile = URLHelper.getFileURLFromSystemPath(documentFile);
+ final String path = URLHelper.getFileURLFromSystemPath(subPath.getPath());
+
+ m_databaseDocument = (XOfficeDatabaseDocument) UnoRuntime.queryInterface(
+ XOfficeDatabaseDocument.class, m_orb.createInstance("com.sun.star.sdb.OfficeDatabaseDocument"));
+ m_dataSource = new DataSource(m_orb, m_databaseDocument.getDataSource());
+
+ final XPropertySet dsProperties = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, m_databaseDocument.getDataSource());
+ dsProperties.setPropertyValue("URL", "sdbc:dbase:" + path);
+
+ final XStorable storable = (XStorable) UnoRuntime.queryInterface(XStorable.class, m_databaseDocument);
+ storable.storeAsURL(m_databaseDocumentFile, new PropertyValue[]
+ {
+ });
+ }
+
+ /** drops the table with a given name
+
+ @param _name
+ the name of the table to drop
+ @param _ifExists
+ TRUE if it should be dropped only when it exists.
+ */
+ public void dropTable(final String _name,final boolean _ifExists) throws SQLException
+ {
+ String dropStatement = "DROP TABLE \"" + _name;
+ executeSQL(dropStatement);
+ }
+}
diff --git a/connectivity/qa/connectivity/tools/HsqlDatabase.java b/connectivity/qa/connectivity/tools/HsqlDatabase.java
index 36e507c0ff..b1af0c118e 100644
--- a/connectivity/qa/connectivity/tools/HsqlDatabase.java
+++ b/connectivity/qa/connectivity/tools/HsqlDatabase.java
@@ -27,29 +27,19 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-
package connectivity.tools;
import com.sun.star.beans.PropertyValue;
import com.sun.star.beans.XPropertySet;
import com.sun.star.container.ElementExistException;
-import com.sun.star.container.XNameAccess;
import com.sun.star.frame.XStorable;
-import com.sun.star.frame.XModel;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.sdb.XOfficeDatabaseDocument;
import com.sun.star.sdbc.SQLException;
-import com.sun.star.sdbc.XCloseable;
-import com.sun.star.sdbc.XConnection;
-import com.sun.star.sdbc.XStatement;
import com.sun.star.sdbcx.XAppend;
import com.sun.star.sdbcx.XTablesSupplier;
import com.sun.star.uno.UnoRuntime;
-import com.sun.star.io.IOException;
-import com.sun.star.sdb.XDocumentDataSource;
-import java.io.File;
-import com.sun.star.util.CloseVetoException;
import helper.URLHelper;
import java.util.HashMap;
import java.util.Iterator;
@@ -60,309 +50,167 @@ import java.io.File;
*
* @author fs93730
*/
-public class HsqlDatabase
+public class HsqlDatabase extends AbstractDatabase
{
- // the service factory
- XMultiServiceFactory m_orb;
- // the URL of the temporary file used for the database document
- String m_databaseDocumentFile;
- // the database document
- XOfficeDatabaseDocument m_databaseDocument;
- // the data source belonging to the database document
- DataSource m_dataSource;
- // the default connection
- XConnection m_connection;
// --------------------------------------------------------------------------------------------------------
- public HsqlDatabase( XMultiServiceFactory orb ) throws Exception
+ public HsqlDatabase(final XMultiServiceFactory orb) throws Exception
{
- m_orb = orb;
+ super(orb);
createDBDocument();
}
// --------------------------------------------------------------------------------------------------------
- public HsqlDatabase( XMultiServiceFactory orb, String _existingDocumentURL ) throws Exception
- {
- m_orb = orb;
- createDBDocument( _existingDocumentURL );
- }
-
- // --------------------------------------------------------------------------------------------------------
- private void createDBDocument( String _docURL ) throws Exception
+ public HsqlDatabase(final XMultiServiceFactory orb, final String _existingDocumentURL) throws Exception
{
- m_databaseDocumentFile = _docURL;
-
- XNameAccess dbContext = (XNameAccess)UnoRuntime.queryInterface( XNameAccess.class,
- m_orb.createInstance( "com.sun.star.sdb.DatabaseContext" ) );
- XDocumentDataSource dataSource = (XDocumentDataSource)UnoRuntime.queryInterface( XDocumentDataSource.class,
- dbContext.getByName( _docURL ) );
-
- m_databaseDocument = dataSource.getDatabaseDocument();
- m_dataSource = new DataSource( m_orb, m_databaseDocument.getDataSource() );
+ super(orb, _existingDocumentURL);
}
/** creates an empty database document in a temporary location
*/
private void createDBDocument() throws Exception
{
- File documentFile = File.createTempFile("testdb",".odb");
+ final File documentFile = File.createTempFile("testdb", ".odb");
documentFile.deleteOnExit();
- m_databaseDocumentFile = URLHelper.getFileURLFromSystemPath( documentFile );
+ m_databaseDocumentFile = URLHelper.getFileURLFromSystemPath(documentFile);
- m_databaseDocument = (XOfficeDatabaseDocument)UnoRuntime.queryInterface(
- XOfficeDatabaseDocument.class, m_orb.createInstance( "com.sun.star.sdb.OfficeDatabaseDocument" ) );
- m_dataSource = new DataSource( m_orb, m_databaseDocument.getDataSource() );
+ m_databaseDocument = (XOfficeDatabaseDocument) UnoRuntime.queryInterface(
+ XOfficeDatabaseDocument.class, m_orb.createInstance("com.sun.star.sdb.OfficeDatabaseDocument"));
+ m_dataSource = new DataSource(m_orb, m_databaseDocument.getDataSource());
- XPropertySet dsProperties = (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class, m_databaseDocument.getDataSource() );
+ final XPropertySet dsProperties = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, m_databaseDocument.getDataSource());
dsProperties.setPropertyValue("URL", "sdbc:embedded:hsqldb");
- XStorable storable = (XStorable)UnoRuntime.queryInterface( XStorable.class, m_databaseDocument );
- storable.storeAsURL( m_databaseDocumentFile, new PropertyValue[]{} );
+ final XStorable storable = (XStorable) UnoRuntime.queryInterface(XStorable.class, m_databaseDocument);
+ storable.storeAsURL(m_databaseDocumentFile, new PropertyValue[]
+ {
+ });
}
- /** returns a connection to the database
- *
- * Multiple calls to this method return the same connection. The HsqlDatabase object keeps
- * the ownership of the connection, so you don't need to (and should not) dispose/close it.
- *
- */
- public XConnection defaultConnection() throws SQLException
- {
- if ( m_connection != null )
- return m_connection;
- m_connection = m_databaseDocument.getDataSource().getConnection(new String(),new String());
- return m_connection;
- }
+ /** drops the table with a given name
- /** executes the given SQL statement via the defaultConnection
+ @param _name
+ the name of the table to drop
+ @param _ifExists
+ TRUE if it should be dropped only when it exists.
*/
- public void executeSQL( String statementString ) throws SQLException
- {
- XStatement statement = defaultConnection().createStatement();
- statement.execute( statementString );
- }
-
- /** stores the database document
- */
- public void store() throws IOException
+ public void dropTable(final String _name, final boolean _ifExists) throws SQLException
{
- if ( m_databaseDocument != null )
+ final StringBuffer dropStatement = new StringBuffer("DROP TABLE \"");
+ dropStatement.append(_name);
+ if (_ifExists)
{
- XStorable storeDoc = (XStorable)UnoRuntime.queryInterface( XStorable.class,
- m_databaseDocument );
- storeDoc.store();
+ dropStatement.append("\" IF EXISTS");
}
+ executeSQL(dropStatement.toString());
}
- /** closes the database document
- *
- * Any CloseVetoExceptions fired by third parties are ignored, and any reference to the
- * database document is released.
- */
- public void close()
+ public void createTable(final HsqlTableDescriptor _tableDesc, final boolean _dropIfExists) throws SQLException
{
- // close connection
- XCloseable closeConn = (XCloseable)UnoRuntime.queryInterface( XCloseable.class,
- m_connection );
- if ( closeConn != null )
+ if (_dropIfExists)
{
- try
- {
- closeConn.close();
- }
- catch( SQLException e )
- {
- }
+ dropTable(_tableDesc.getName(), true);
}
- m_connection = null;
-
- // close document
- com.sun.star.util.XCloseable closeDoc = (com.sun.star.util.XCloseable)UnoRuntime.queryInterface(
- com.sun.star.util.XCloseable.class, m_databaseDocument );
- if ( closeDoc != null )
- {
- try
- {
- closeDoc.close( true );
- }
- catch( CloseVetoException e )
- {
- }
- }
- m_databaseDocument = null;
- }
-
- /** closes the document, and deletes the underlying file
- */
- public void closeAndDelete()
- {
- close();
-
- if ( m_databaseDocumentFile != null )
- {
- try
- {
- File file = new File(m_databaseDocumentFile);
- file.delete();
- }
- catch(Exception e)
- {
- }
- m_databaseDocumentFile = null;
- }
- }
-
- /** returns the underlying database document
- */
- public XOfficeDatabaseDocument getDatabaseDocument()
- {
- return m_databaseDocument;
- }
-
- /** returns the model interface of the underlying database document
- */
- XModel getModel()
- {
- return (XModel)UnoRuntime.queryInterface( XModel.class, m_databaseDocument );
- }
-
- /** drops the table with a given name
-
- @param _name
- the name of the table to drop
- @param _ifExists
- TRUE if it should be dropped only when it exists.
- */
- public void dropTable( String _name, boolean _ifExists ) throws SQLException
- {
- String dropStatement = "DROP TABLE \"" + _name;
- if ( _ifExists )
- dropStatement += "\" IF EXISTS";
- executeSQL( dropStatement );
- }
-
- public void createTable( HsqlTableDescriptor _tableDesc, boolean _dropIfExists ) throws SQLException
- {
- if ( _dropIfExists )
- dropTable( _tableDesc.getName(), true );
- createTable( _tableDesc );
+ createTable(_tableDesc);
}
/** creates a table
*/
- public void createTable( HsqlTableDescriptor _tableDesc ) throws SQLException
+ public void createTable(final HsqlTableDescriptor _tableDesc) throws SQLException
{
- String createStatement = "CREATE CACHED TABLE \"";
- createStatement += _tableDesc.getName();
- createStatement += "\" ( ";
+ StringBuffer createStatement = new StringBuffer("CREATE CACHED TABLE \"");
+ createStatement.append(_tableDesc.getName());
+ createStatement.append("\" ( ");
String primaryKeyList = "";
- HashMap foreignKeys = new HashMap();
- HashMap foreignKeyRefs = new HashMap();
+ final HashMap foreignKeys = new HashMap();
+ final HashMap foreignKeyRefs = new HashMap();
- HsqlColumnDescriptor[] columns = _tableDesc.getColumns();
- for ( int i=0; i<columns.length; ++i )
+ final HsqlColumnDescriptor[] columns = _tableDesc.getColumns();
+ for (int i = 0; i < columns.length; ++i)
{
- if ( i > 0 )
- createStatement += ", ";
+ if (i > 0)
+ {
+ createStatement.append(", ");
+ }
- createStatement += "\"" + columns[i].getName();
- createStatement += "\" " + columns[i].getTypeName();
+ createStatement.append("\"" + columns[i].getName());
+ createStatement.append("\" " + columns[i].getTypeName());
- if ( columns[i].isRequired() )
- createStatement += " NOT NULL";
+ if (columns[i].isRequired())
+ {
+ createStatement.append(" NOT NULL");
+ }
- if ( columns[i].isPrimaryKey() )
+ if (columns[i].isPrimaryKey())
{
- if ( primaryKeyList.length() > 0 )
+ if (primaryKeyList.length() > 0)
+ {
primaryKeyList += ", ";
+ }
primaryKeyList += "\"" + columns[i].getName() + "\"";
}
- if ( columns[i].isForeignKey() )
+ if (columns[i].isForeignKey())
{
- String foreignTable = columns[i].getForeignTable();
+ final String foreignTable = columns[i].getForeignTable();
- String foreignKeysForTable = foreignKeys.containsKey( foreignTable ) ? (String)foreignKeys.get( foreignTable ) : "";
- if ( foreignKeysForTable.length() > 0 )
+ String foreignKeysForTable = foreignKeys.containsKey(foreignTable) ? (String) foreignKeys.get(foreignTable) : "";
+ if (foreignKeysForTable.length() > 0)
+ {
foreignKeysForTable += ", ";
+ }
foreignKeysForTable += "\"" + columns[i].getName() + "\"";
- foreignKeys.put( foreignTable, foreignKeysForTable );
-
- String foreignKeyRefsForTable = foreignKeyRefs.containsKey( foreignTable ) ? (String)foreignKeyRefs.get( foreignTable ) : "";
- if ( foreignKeyRefsForTable.length() > 0 )
- foreignKeyRefsForTable += ", ";
- foreignKeyRefsForTable += "\"" + columns[i].getForeignColumn() + "\"";
- foreignKeyRefs.put( foreignTable, foreignKeyRefsForTable );
+ foreignKeys.put(foreignTable, foreignKeysForTable);
+
+ final StringBuffer foreignKeyRefsForTable = new StringBuffer(foreignKeyRefs.containsKey(foreignTable) ? (String) foreignKeyRefs.get(foreignTable) : "");
+ if (foreignKeyRefsForTable.length() > 0)
+ {
+ foreignKeyRefsForTable.append(", ");
+ }
+ foreignKeyRefsForTable.append("\"" + columns[i].getForeignColumn() + "\"");
+ foreignKeyRefs.put(foreignTable, foreignKeyRefsForTable.toString());
}
}
- if ( primaryKeyList.length() > 0 )
+ if (primaryKeyList.length() > 0)
{
- createStatement += ", PRIMARY KEY (";
- createStatement += primaryKeyList;
- createStatement += ")";
+ createStatement.append(", PRIMARY KEY (");
+ createStatement.append(primaryKeyList);
+ createStatement.append(')');
}
- Set foreignKeyTables = foreignKeys.keySet();
- for ( Iterator foreignKey = foreignKeyTables.iterator();
- foreignKey.hasNext();
- )
+ final Set foreignKeyTables = foreignKeys.keySet();
+ for (final Iterator foreignKey = foreignKeyTables.iterator();
+ foreignKey.hasNext();)
{
- String foreignTable = (String)foreignKey.next();
-
- createStatement += ", FOREIGN KEY (";
- createStatement += (String)foreignKeys.get(foreignTable);
- createStatement += ") REFERENCES \"";
- createStatement += foreignTable;
- createStatement += "\"(";
- createStatement += (String)foreignKeyRefs.get(foreignTable);
- createStatement += ")";
+ final String foreignTable = (String) foreignKey.next();
+
+ createStatement.append(", FOREIGN KEY (");
+ createStatement.append((String) foreignKeys.get(foreignTable));
+ createStatement.append(") REFERENCES \"");
+ createStatement.append(foreignTable);
+ createStatement.append("\"(");
+ createStatement.append((String) foreignKeyRefs.get(foreignTable));
+ createStatement.append(')');
}
- createStatement += ")";
+ createStatement.append(')');
//System.err.println( createStatement );
- executeSQL( createStatement );
+ executeSQL(createStatement.toString());
}
/** creates a table in the database. using the SDBCX-API
*/
- public void createTableInSDBCX( HsqlTableDescriptor _tableDesc ) throws SQLException, ElementExistException
- {
- XPropertySet sdbcxDescriptor = _tableDesc.createSdbcxDescriptor( defaultConnection() );
- XTablesSupplier suppTables = (XTablesSupplier)UnoRuntime.queryInterface(
- XTablesSupplier.class, defaultConnection() );
- XAppend appendTable = (XAppend)UnoRuntime.queryInterface(
- XAppend.class, suppTables.getTables() );
- appendTable.appendByDescriptor( sdbcxDescriptor );
- }
-
- /** returns the URL of the ODB document represented by this instance
- */
- public String getDocumentURL()
- {
- return m_databaseDocumentFile;
- }
-
- /** returns the data source belonging to this database
- */
- public DataSource getDataSource()
- {
- return m_dataSource;
- }
-
- /** creates a row set operating the database, with a given command/type
- */
- public RowSet createRowSet( int _commandType, String _command )
- {
- return new RowSet(m_orb, getDocumentURL(), _commandType, _command);
- }
-
- protected void finalize() throws Throwable
- {
- closeAndDelete();
- super.finalize();
+ public void createTableInSDBCX(final HsqlTableDescriptor _tableDesc) throws SQLException, ElementExistException
+ {
+ final XPropertySet sdbcxDescriptor = _tableDesc.createSdbcxDescriptor(defaultConnection());
+ final XTablesSupplier suppTables = (XTablesSupplier) UnoRuntime.queryInterface(
+ XTablesSupplier.class, defaultConnection());
+ final XAppend appendTable = (XAppend) UnoRuntime.queryInterface(
+ XAppend.class, suppTables.getTables());
+ appendTable.appendByDescriptor(sdbcxDescriptor);
}
}
diff --git a/connectivity/qa/drivers/dbase/DBaseDateFunctions.java b/connectivity/qa/drivers/dbase/DBaseDateFunctions.java
index 67197f4c06..1c0ff72b34 100644
--- a/connectivity/qa/drivers/dbase/DBaseDateFunctions.java
+++ b/connectivity/qa/drivers/dbase/DBaseDateFunctions.java
@@ -27,219 +27,286 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-package complex.connectivity;
+package qa.drivers.dbase;
-import complex.connectivity.DBaseDriverTest;
import com.sun.star.uno.UnoRuntime;
-import com.sun.star.util.XCloseable;
import com.sun.star.sdbc.*;
-import com.sun.star.sdb.*;
-import com.sun.star.beans.PropertyValue;
import com.sun.star.beans.XPropertySet;
import com.sun.star.lang.XMultiServiceFactory;
-import complexlib.ComplexTestCase;
+public class DBaseDateFunctions
+{
-import java.io.PrintWriter;
-
-import util.utils;
-import java.util.*;
-import java.io.*;
+ private final String where = "FROM \"biblio\" \"biblio\" where \"Identifier\" = 'BOR00'";
+ private final XMultiServiceFactory m_xORB;
+ private final DBaseDriverTest testcase;
+ public DBaseDateFunctions(final XMultiServiceFactory _xORB, final DBaseDriverTest _testcase)
+ {
+ m_xORB = _xORB;
+ testcase = _testcase;
+ }
-public class DBaseDateFunctions {
+ private void assure(final String s, final boolean b)
+ {
+ testcase.assure2(s, b);
+ }
- private String where = "FROM \"biblio\" \"biblio\" where \"Identifier\" = 'BOR00'";
- private XMultiServiceFactory m_xORB;
- private DBaseDriverTest testcase;
- public DBaseDateFunctions(XMultiServiceFactory _xORB,DBaseDriverTest _testcase){
- m_xORB = _xORB;
- testcase = _testcase;
- }
-
- private void assure(String s,boolean b){
- testcase.assure2(s,b);
- }
-
- public void testFunctions() throws com.sun.star.uno.Exception,com.sun.star.beans.UnknownPropertyException {
- XRowSet xRowRes = (XRowSet)UnoRuntime.queryInterface(XRowSet.class,
- m_xORB.createInstance("com.sun.star.sdb.RowSet"));
+ public void testFunctions() throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException
+ {
+ final XRowSet xRowRes = (XRowSet) UnoRuntime.queryInterface(XRowSet.class,
+ m_xORB.createInstance("com.sun.star.sdb.RowSet"));
- System.out.println("starting DateTime function test!");
+ testcase.getLog().println("starting DateTime function test!");
// set the properties needed to connect to a database
- XPropertySet xProp = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xRowRes);
- xProp.setPropertyValue("DataSourceName","Bibliography");
-
- xProp.setPropertyValue("CommandType",new Integer(com.sun.star.sdb.CommandType.COMMAND));
-
- try {
+ final XPropertySet xProp = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xRowRes);
+ xProp.setPropertyValue("DataSourceName", "Bibliography");
+
+ xProp.setPropertyValue("CommandType", Integer.valueOf(com.sun.star.sdb.CommandType.COMMAND));
+
+ try
+ {
curdate(xRowRes);
- } catch( SQLException ex){
- assure("upper " + ex.getMessage(),false);
+ }
+ catch (SQLException ex)
+ {
+ assure("upper " + ex.getMessage(), false);
throw ex;
}
- try{
+ try
+ {
curtime(xRowRes);
- } catch( SQLException ex){
- assure("lower " + ex.getMessage(),false);
+ }
+ catch (SQLException ex)
+ {
+ assure("lower " + ex.getMessage(), false);
throw ex;
}
- try{
+ try
+ {
dayname(xRowRes);
- } catch( SQLException ex){
- assure("ascii " + ex.getMessage(),false);
+ }
+ catch (SQLException ex)
+ {
+ assure("ascii " + ex.getMessage(), false);
throw ex;
}
- try{
+ try
+ {
dayofmonth(xRowRes);
- } catch( SQLException ex){
- assure("char_len " + ex.getMessage(),false);
+ }
+ catch (SQLException ex)
+ {
+ assure("char_len " + ex.getMessage(), false);
throw ex;
}
- try{
+ try
+ {
dayofweek(xRowRes);
- } catch( SQLException ex){
- assure("concat " + ex.getMessage(),false);
+ }
+ catch (SQLException ex)
+ {
+ assure("concat " + ex.getMessage(), false);
throw ex;
}
- try{
+ try
+ {
dayofyear(xRowRes);
- } catch( SQLException ex){
- assure("locate " + ex.getMessage(),false);
+ }
+ catch (SQLException ex)
+ {
+ assure("locate " + ex.getMessage(), false);
throw ex;
}
- try{
+ try
+ {
hour(xRowRes);
- } catch( SQLException ex){
- assure("substr " + ex.getMessage(),false);
+ }
+ catch (SQLException ex)
+ {
+ assure("substr " + ex.getMessage(), false);
throw ex;
}
- try{
+ try
+ {
minute(xRowRes);
- } catch( SQLException ex){
- assure("ltrim " + ex.getMessage(),false);
+ }
+ catch (SQLException ex)
+ {
+ assure("ltrim " + ex.getMessage(), false);
throw ex;
}
- try{
+ try
+ {
month(xRowRes);
- } catch( SQLException ex){
- assure("rtrim " + ex.getMessage(),false);
+ }
+ catch (SQLException ex)
+ {
+ assure("rtrim " + ex.getMessage(), false);
throw ex;
}
- try{
+ try
+ {
monthname(xRowRes);
- } catch( SQLException ex){
- assure("space " + ex.getMessage(),false);
+ }
+ catch (SQLException ex)
+ {
+ assure("space " + ex.getMessage(), false);
throw ex;
}
- try{
+ try
+ {
now(xRowRes);
- } catch( SQLException ex){
- assure("replace " + ex.getMessage(),false);
+ }
+ catch (SQLException ex)
+ {
+ assure("replace " + ex.getMessage(), false);
throw ex;
}
- try{
+ try
+ {
quarter(xRowRes);
- } catch( SQLException ex){
- assure("repeat " + ex.getMessage(),false);
+ }
+ catch (SQLException ex)
+ {
+ assure("repeat " + ex.getMessage(), false);
throw ex;
}
- try{
+ try
+ {
second(xRowRes);
- } catch( SQLException ex){
- assure("insert " + ex.getMessage(),false);
+ }
+ catch (SQLException ex)
+ {
+ assure("insert " + ex.getMessage(), false);
throw ex;
}
- try{
+ try
+ {
week(xRowRes);
- } catch( SQLException ex){
- assure("left " + ex.getMessage(),false);
+ }
+ catch (SQLException ex)
+ {
+ assure("left " + ex.getMessage(), false);
throw ex;
}
- try{
+ try
+ {
year(xRowRes);
- } catch( SQLException ex){
- assure("right " + ex.getMessage(),false);
+ }
+ catch (SQLException ex)
+ {
+ assure("right " + ex.getMessage(), false);
throw ex;
}
}
-
- private XRow execute(XRowSet xRowRes,String sql) throws com.sun.star.uno.Exception,com.sun.star.beans.UnknownPropertyException {
- XPropertySet xProp = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xRowRes);
- xProp.setPropertyValue("Command","SELECT " + sql + where);
+
+ private XRow execute(final XRowSet xRowRes, final String sql) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException
+ {
+ final XPropertySet xProp = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xRowRes);
+ xProp.setPropertyValue("Command", "SELECT " + sql + where);
xRowRes.execute();
- XResultSet xRes = (XResultSet)UnoRuntime.queryInterface(XResultSet.class,xRowRes);
- assure("No valid row! ",xRes.next());
-
- return (XRow)UnoRuntime.queryInterface(XRow.class, xRes);
- }
-
- private void dayofweek(XRowSet xRowRes) throws com.sun.star.uno.Exception,com.sun.star.beans.UnknownPropertyException {
- XRow row = execute(xRowRes,"DAYOFWEEK('1998-02-03') ");
- assure("DAYOFWEEK('1998-02-03') failed!",row.getInt(1) == 3);
- }
- private void dayofmonth(XRowSet xRowRes) throws com.sun.star.uno.Exception,com.sun.star.beans.UnknownPropertyException {
- XRow row = execute(xRowRes,"DAYOFMONTH('1998-02-03') ");
- assure("DAYOFMONTH('1998-02-03') failed!",row.getInt(1) == 3);
- }
- private void dayofyear(XRowSet xRowRes) throws com.sun.star.uno.Exception,com.sun.star.beans.UnknownPropertyException {
- XRow row = execute(xRowRes,"DAYOFYEAR('1998-02-03') ");
- assure("DAYOFYEAR('1998-02-03') failed!",row.getInt(1) == 34);
- }
- private void month(XRowSet xRowRes) throws com.sun.star.uno.Exception,com.sun.star.beans.UnknownPropertyException {
- XRow row = execute(xRowRes,"month('1998-02-03') ");
- assure("month('1998-02-03') failed!",row.getInt(1) == 2);
- }
- private void dayname(XRowSet xRowRes) throws com.sun.star.uno.Exception,com.sun.star.beans.UnknownPropertyException {
- XRow row = execute(xRowRes,"DAYNAME('1998-02-05') ");
- assure("DAYNAME('1998-02-05') failed!",row.getString(1).equals("Thursday"));
- }
- private void monthname(XRowSet xRowRes) throws com.sun.star.uno.Exception,com.sun.star.beans.UnknownPropertyException {
- XRow row = execute(xRowRes,"MONTHNAME('1998-02-05') ");
- assure("MONTHNAME('1998-02-05') failed!",row.getString(1).equals("February"));
- }
- private void quarter(XRowSet xRowRes) throws com.sun.star.uno.Exception,com.sun.star.beans.UnknownPropertyException {
- XRow row = execute(xRowRes,"QUARTER('98-01-01'),QUARTER('98-04-01'),QUARTER('98-07-01'),QUARTER('98-10-01') ");
- assure("QUARTER('98-01-01') failed!",row.getInt(1) == 1);
- assure("QUARTER('98-04-01') failed!",row.getInt(2) == 2);
- assure("QUARTER('98-07-01') failed!",row.getInt(3) == 3);
- assure("QUARTER('98-10-01') failed!",row.getInt(4) == 4);
- }
- private void week(XRowSet xRowRes) throws com.sun.star.uno.Exception,com.sun.star.beans.UnknownPropertyException {
- XRow row = execute(xRowRes,"WEEK('1998-02-20') ");
- assure("WEEK('1998-02-20') failed!",row.getInt(1) == 7);
- }
- private void year(XRowSet xRowRes) throws com.sun.star.uno.Exception,com.sun.star.beans.UnknownPropertyException {
- XRow row = execute(xRowRes,"YEAR('98-02-03') ");
- assure("YEAR('98-02-03') failed!",row.getInt(1) == 98);
- }
- private void hour(XRowSet xRowRes) throws com.sun.star.uno.Exception,com.sun.star.beans.UnknownPropertyException {
- XRow row = execute(xRowRes,"HOUR('10:05:03') ");
- assure("HOUR('10:05:03') failed!",row.getInt(1) == 10);
- }
- private void minute(XRowSet xRowRes) throws com.sun.star.uno.Exception,com.sun.star.beans.UnknownPropertyException {
- XRow row = execute(xRowRes,"MINUTE('98-02-03 10:05:03') ");
- assure("MINUTE('98-02-03 10:05:03') failed!",row.getInt(1) == 5);
- }
- private void second(XRowSet xRowRes) throws com.sun.star.uno.Exception,com.sun.star.beans.UnknownPropertyException {
- XRow row = execute(xRowRes,"SECOND('10:05:03') ");
- assure("SECOND('10:05:03') failed!",row.getInt(1) == 3);
- }
- private void curdate(XRowSet xRowRes) throws com.sun.star.uno.Exception,com.sun.star.beans.UnknownPropertyException {
- XRow row = execute(xRowRes,"CURDATE() ");
- com.sun.star.util.Date aDate = row.getDate(1);
- System.out.println("CURDATE() is '" + aDate.Year + "-" + aDate.Month + "-" + aDate.Day +"'");
- }
- private void curtime(XRowSet xRowRes) throws com.sun.star.uno.Exception,com.sun.star.beans.UnknownPropertyException {
- XRow row = execute(xRowRes,"CURTIME() ");
- com.sun.star.util.Time aTime = row.getTime(1);
- System.out.println("CURTIME() is '" + aTime.Hours + ":" + aTime.Minutes + ":" + aTime.Seconds + "'");
- }
- private void now(XRowSet xRowRes) throws com.sun.star.uno.Exception,com.sun.star.beans.UnknownPropertyException {
- XRow row = execute(xRowRes,"NOW() ");
- com.sun.star.util.DateTime aTime = row.getTimestamp(1);
- System.out.println("NOW() is '" + aTime.Year + "-" + aTime.Month + "-" + aTime.Day + "'");
- System.out.println("'" + aTime.Hours + ":" + aTime.Minutes + ":" + aTime.Seconds + "'");
+ final XResultSet xRes = (XResultSet) UnoRuntime.queryInterface(XResultSet.class, xRowRes);
+ assure("No valid row! ", xRes.next());
+
+ return (XRow) UnoRuntime.queryInterface(XRow.class, xRes);
+ }
+
+ private void dayofweek(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException
+ {
+ final XRow row = execute(xRowRes, "DAYOFWEEK('1998-02-03') ");
+ assure("DAYOFWEEK('1998-02-03') failed!", row.getInt(1) == 3);
+ }
+
+ private void dayofmonth(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException
+ {
+ final XRow row = execute(xRowRes, "DAYOFMONTH('1998-02-03') ");
+ assure("DAYOFMONTH('1998-02-03') failed!", row.getInt(1) == 3);
+ }
+
+ private void dayofyear(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException
+ {
+ final XRow row = execute(xRowRes, "DAYOFYEAR('1998-02-03') ");
+ assure("DAYOFYEAR('1998-02-03') failed!", row.getInt(1) == 34);
+ }
+
+ private void month(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException
+ {
+ final XRow row = execute(xRowRes, "month('1998-02-03') ");
+ assure("month('1998-02-03') failed!", row.getInt(1) == 2);
+ }
+
+ private void dayname(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException
+ {
+ final XRow row = execute(xRowRes, "DAYNAME('1998-02-05') ");
+ assure("DAYNAME('1998-02-05') failed!", row.getString(1).equals("Thursday"));
+ }
+
+ private void monthname(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException
+ {
+ final XRow row = execute(xRowRes, "MONTHNAME('1998-02-05') ");
+ assure("MONTHNAME('1998-02-05') failed!", row.getString(1).equals("February"));
+ }
+
+ private void quarter(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException
+ {
+ final XRow row = execute(xRowRes, "QUARTER('98-01-01'),QUARTER('98-04-01'),QUARTER('98-07-01'),QUARTER('98-10-01') ");
+ assure("QUARTER('98-01-01') failed!", row.getInt(1) == 1);
+ assure("QUARTER('98-04-01') failed!", row.getInt(2) == 2);
+ assure("QUARTER('98-07-01') failed!", row.getInt(3) == 3);
+ assure("QUARTER('98-10-01') failed!", row.getInt(4) == 4);
+ }
+
+ private void week(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException
+ {
+ final XRow row = execute(xRowRes, "WEEK('1998-02-20') ");
+ assure("WEEK('1998-02-20') failed!", row.getInt(1) == 7);
+ }
+
+ private void year(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException
+ {
+ final XRow row = execute(xRowRes, "YEAR('98-02-03') ");
+ assure("YEAR('98-02-03') failed!", row.getInt(1) == 98);
+ }
+
+ private void hour(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException
+ {
+ final XRow row = execute(xRowRes, "HOUR('10:05:03') ");
+ assure("HOUR('10:05:03') failed!", row.getInt(1) == 10);
+ }
+
+ private void minute(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException
+ {
+ final XRow row = execute(xRowRes, "MINUTE('98-02-03 10:05:03') ");
+ assure("MINUTE('98-02-03 10:05:03') failed!", row.getInt(1) == 5);
+ }
+
+ private void second(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException
+ {
+ final XRow row = execute(xRowRes, "SECOND('10:05:03') ");
+ assure("SECOND('10:05:03') failed!", row.getInt(1) == 3);
+ }
+
+ private void curdate(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException
+ {
+ final XRow row = execute(xRowRes, "CURDATE() ");
+ final com.sun.star.util.Date aDate = row.getDate(1);
+ testcase.getLog().println("CURDATE() is '" + aDate.Year + "-" + aDate.Month + "-" + aDate.Day + "'");
+ }
+
+ private void curtime(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException
+ {
+ final XRow row = execute(xRowRes, "CURTIME() ");
+ final com.sun.star.util.Time aTime = row.getTime(1);
+ testcase.getLog().println("CURTIME() is '" + aTime.Hours + ":" + aTime.Minutes + ":" + aTime.Seconds + "'");
+ }
+
+ private void now(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException
+ {
+ final XRow row = execute(xRowRes, "NOW() ");
+ final com.sun.star.util.DateTime aTime = row.getTimestamp(1);
+ testcase.getLog().println("NOW() is '" + aTime.Year + "-" + aTime.Month + "-" + aTime.Day + "'");
+ testcase.getLog().println("'" + aTime.Hours + ":" + aTime.Minutes + ":" + aTime.Seconds + "'");
}
}
diff --git a/connectivity/qa/drivers/dbase/DBaseDriverTest.java b/connectivity/qa/drivers/dbase/DBaseDriverTest.java
index fc2777794e..f25d02f122 100644
--- a/connectivity/qa/drivers/dbase/DBaseDriverTest.java
+++ b/connectivity/qa/drivers/dbase/DBaseDriverTest.java
@@ -27,60 +27,71 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-package complex.connectivity;
+package qa.drivers.dbase;
-import com.sun.star.uno.UnoRuntime;
-import com.sun.star.util.XCloseable;
import com.sun.star.sdbc.*;
-import com.sun.star.sdb.*;
-import com.sun.star.beans.PropertyValue;
-import com.sun.star.beans.XPropertySet;
-
import com.sun.star.lang.XMultiServiceFactory;
-
import complexlib.ComplexTestCase;
-
-import java.io.PrintWriter;
-
-import util.utils;
import java.util.*;
import java.io.*;
+import share.LogWriter;
//import complex.connectivity.DBaseStringFunctions;
-public class DBaseDriverTest extends ComplexTestCase {
+public class DBaseDriverTest extends ComplexTestCase
+{
private static Properties props = new Properties();
private XDriver m_xDiver;
- private String where = "FROM \"biblio\" \"biblio\" where \"Identifier\" = 'BOR00'";
-
- static {
- try {
+ private String where = "FROM \"biblio\" \"biblio\" where \"Identifier\" = 'BOR00'";
+
+ static
+ {
+ try
+ {
String propsFile = "test.properties";
- props.load( new FileInputStream(propsFile) );
- } catch(Exception ex) {
+ props.load(new FileInputStream(propsFile));
+ }
+ catch (Exception ex)
+ {
throw new RuntimeException(ex);
}
}
-
- public String[] getTestMethodNames() {
- return new String[] { "Functions" };
+
+ public String[] getTestMethodNames()
+ {
+ return new String[]
+ {
+ "Functions"
+ };
}
- public String getTestObjectName() {
+ public String getTestObjectName()
+ {
return "DBaseDriverTest";
}
- public void assure2(String s,boolean b){
- assure(s,b);
+
+ public void assure2(String s, boolean b)
+ {
+ assure(s, b);
}
-
- public void Functions() throws com.sun.star.uno.Exception,com.sun.star.beans.UnknownPropertyException {
- DBaseStringFunctions aStringTest = new DBaseStringFunctions(((XMultiServiceFactory)param.getMSF()),this);
+
+ public LogWriter getLog()
+ {
+ return log;
+ }
+
+ public void Functions() throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException
+ {
+ DBaseStringFunctions aStringTest = new DBaseStringFunctions(((XMultiServiceFactory) param.getMSF()), this);
aStringTest.testFunctions();
-
- DBaseNumericFunctions aNumericTest = new DBaseNumericFunctions(((XMultiServiceFactory)param.getMSF()),this);
+
+ DBaseNumericFunctions aNumericTest = new DBaseNumericFunctions(((XMultiServiceFactory) param.getMSF()), this);
aNumericTest.testFunctions();
-
- DBaseDateFunctions aDateTest = new DBaseDateFunctions(((XMultiServiceFactory)param.getMSF()),this);
+
+ DBaseDateFunctions aDateTest = new DBaseDateFunctions(((XMultiServiceFactory) param.getMSF()), this);
aDateTest.testFunctions();
+
+ DBaseSqlTests aSqlTest = new DBaseSqlTests(((XMultiServiceFactory) param.getMSF()), this);
+ aSqlTest.testFunctions();
}
}
diff --git a/connectivity/qa/drivers/dbase/DBaseNumericFunctions.java b/connectivity/qa/drivers/dbase/DBaseNumericFunctions.java
index fdca0f1245..d76456536a 100644
--- a/connectivity/qa/drivers/dbase/DBaseNumericFunctions.java
+++ b/connectivity/qa/drivers/dbase/DBaseNumericFunctions.java
@@ -27,285 +27,379 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-package complex.connectivity;
+package qa.drivers.dbase;
-import complex.connectivity.DBaseDriverTest;
import com.sun.star.uno.UnoRuntime;
-import com.sun.star.util.XCloseable;
import com.sun.star.sdbc.*;
-import com.sun.star.sdb.*;
-import com.sun.star.beans.PropertyValue;
import com.sun.star.beans.XPropertySet;
-
import com.sun.star.lang.XMultiServiceFactory;
-import complexlib.ComplexTestCase;
-import java.io.PrintWriter;
-
-import util.utils;
-import java.util.*;
-import java.io.*;
+public class DBaseNumericFunctions
+{
+ private final String where = "FROM \"biblio\" \"biblio\" where \"Identifier\" = 'BOR00'";
+ private final XMultiServiceFactory m_xORB;
+ private final DBaseDriverTest testcase;
-public class DBaseNumericFunctions {
+ public DBaseNumericFunctions(final XMultiServiceFactory _xORB, final DBaseDriverTest _testcase)
+ {
+ m_xORB = _xORB;
+ testcase = _testcase;
+ }
- private String where = "FROM \"biblio\" \"biblio\" where \"Identifier\" = 'BOR00'";
- private XMultiServiceFactory m_xORB;
- private DBaseDriverTest testcase;
- public DBaseNumericFunctions(XMultiServiceFactory _xORB,DBaseDriverTest _testcase){
- m_xORB = _xORB;
- testcase = _testcase;
- }
-
- private void assure(String s,boolean b){
- testcase.assure2(s,b);
- }
-
- public void testFunctions() throws com.sun.star.uno.Exception,com.sun.star.beans.UnknownPropertyException {
- XRowSet xRowRes = (XRowSet)UnoRuntime.queryInterface(XRowSet.class,
- m_xORB.createInstance("com.sun.star.sdb.RowSet"));
+ private void assure(final String s, final boolean b)
+ {
+ testcase.assure2(s, b);
+ }
+
+ public void testFunctions() throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException
+ {
+ final XRowSet xRowRes = (XRowSet) UnoRuntime.queryInterface(XRowSet.class,
+ m_xORB.createInstance("com.sun.star.sdb.RowSet"));
- System.out.println("starting Numeric function test");
+ testcase.getLog().println("starting Numeric function test");
// set the properties needed to connect to a database
- XPropertySet xProp = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xRowRes);
- xProp.setPropertyValue("DataSourceName","Bibliography");
-
- xProp.setPropertyValue("CommandType",new Integer(com.sun.star.sdb.CommandType.COMMAND));
-
- try {
+ final XPropertySet xProp = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xRowRes);
+ xProp.setPropertyValue("DataSourceName", "Bibliography");
+
+ xProp.setPropertyValue("CommandType", Integer.valueOf(com.sun.star.sdb.CommandType.COMMAND));
+
+ try
+ {
abs(xRowRes);
- } catch( SQLException ex){
- assure("abs " + ex.getMessage(),false);
+ }
+ catch (SQLException ex)
+ {
+ assure("abs " + ex.getMessage(), false);
throw ex;
}
- try{
+ try
+ {
acos(xRowRes);
- } catch( SQLException ex){
- assure("acos " + ex.getMessage(),false);
+ }
+ catch (SQLException ex)
+ {
+ assure("acos " + ex.getMessage(), false);
throw ex;
}
- try{
+ try
+ {
asin(xRowRes);
- } catch( SQLException ex){
- assure("asin " + ex.getMessage(),false);
+ }
+ catch (SQLException ex)
+ {
+ assure("asin " + ex.getMessage(), false);
throw ex;
}
- try{
+ try
+ {
atan(xRowRes);
- } catch( SQLException ex){
- assure("atan " + ex.getMessage(),false);
+ }
+ catch (SQLException ex)
+ {
+ assure("atan " + ex.getMessage(), false);
throw ex;
}
- try{
+ try
+ {
atan2(xRowRes);
- } catch( SQLException ex){
- assure("atan2 " + ex.getMessage(),false);
+ }
+ catch (SQLException ex)
+ {
+ assure("atan2 " + ex.getMessage(), false);
throw ex;
}
- try{
+ try
+ {
ceiling(xRowRes);
- } catch( SQLException ex){
- assure("ceiling " + ex.getMessage(),false);
+ }
+ catch (SQLException ex)
+ {
+ assure("ceiling " + ex.getMessage(), false);
throw ex;
}
- try{
+ try
+ {
cos(xRowRes);
- } catch( SQLException ex){
- assure("cos " + ex.getMessage(),false);
+ }
+ catch (SQLException ex)
+ {
+ assure("cos " + ex.getMessage(), false);
throw ex;
}
- try{
+ try
+ {
degrees(xRowRes);
- } catch( SQLException ex){
- assure("degrees " + ex.getMessage(),false);
+ }
+ catch (SQLException ex)
+ {
+ assure("degrees " + ex.getMessage(), false);
throw ex;
}
- try{
+ try
+ {
exp(xRowRes);
- } catch( SQLException ex){
- assure("exp " + ex.getMessage(),false);
+ }
+ catch (SQLException ex)
+ {
+ assure("exp " + ex.getMessage(), false);
throw ex;
}
- try{
+ try
+ {
floor(xRowRes);
- } catch( SQLException ex){
- assure("floor " + ex.getMessage(),false);
+ }
+ catch (SQLException ex)
+ {
+ assure("floor " + ex.getMessage(), false);
throw ex;
}
- try{
+ try
+ {
log(xRowRes);
- } catch( SQLException ex){
- assure("log " + ex.getMessage(),false);
+ }
+ catch (SQLException ex)
+ {
+ assure("log " + ex.getMessage(), false);
throw ex;
}
- try{
+ try
+ {
log10(xRowRes);
- } catch( SQLException ex){
- assure("log10 " + ex.getMessage(),false);
+ }
+ catch (SQLException ex)
+ {
+ assure("log10 " + ex.getMessage(), false);
throw ex;
}
- try{
+ try
+ {
mod(xRowRes);
- } catch( SQLException ex){
- assure("mod " + ex.getMessage(),false);
+ }
+ catch (SQLException ex)
+ {
+ assure("mod " + ex.getMessage(), false);
throw ex;
}
- try{
+ try
+ {
pi(xRowRes);
- } catch( SQLException ex){
- assure("pi " + ex.getMessage(),false);
+ }
+ catch (SQLException ex)
+ {
+ assure("pi " + ex.getMessage(), false);
throw ex;
}
- try{
+ try
+ {
pow(xRowRes);
- } catch( SQLException ex){
- assure("pow " + ex.getMessage(),false);
+ }
+ catch (SQLException ex)
+ {
+ assure("pow " + ex.getMessage(), false);
throw ex;
}
- try{
+ try
+ {
radians(xRowRes);
- } catch( SQLException ex){
- assure("radians " + ex.getMessage(),false);
+ }
+ catch (SQLException ex)
+ {
+ assure("radians " + ex.getMessage(), false);
throw ex;
}
- try{
+ try
+ {
round(xRowRes);
- } catch( SQLException ex){
- assure("round " + ex.getMessage(),false);
+ }
+ catch (SQLException ex)
+ {
+ assure("round " + ex.getMessage(), false);
throw ex;
}
- try{
+ try
+ {
sign(xRowRes);
- } catch( SQLException ex){
- assure("sign " + ex.getMessage(),false);
+ }
+ catch (SQLException ex)
+ {
+ assure("sign " + ex.getMessage(), false);
throw ex;
}
- try{
+ try
+ {
sin(xRowRes);
- } catch( SQLException ex){
- assure("sin " + ex.getMessage(),false);
+ }
+ catch (SQLException ex)
+ {
+ assure("sin " + ex.getMessage(), false);
throw ex;
}
- try{
+ try
+ {
sqrt(xRowRes);
- } catch( SQLException ex){
- assure("sqrt " + ex.getMessage(),false);
+ }
+ catch (SQLException ex)
+ {
+ assure("sqrt " + ex.getMessage(), false);
throw ex;
}
- try{
+ try
+ {
tan(xRowRes);
- } catch( SQLException ex){
- assure("tan " + ex.getMessage(),false);
+ }
+ catch (SQLException ex)
+ {
+ assure("tan " + ex.getMessage(), false);
throw ex;
}
-
+
}
-
- private XRow execute(XRowSet xRowRes,String sql) throws com.sun.star.uno.Exception,com.sun.star.beans.UnknownPropertyException {
- XPropertySet xProp = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xRowRes);
- xProp.setPropertyValue("Command","SELECT " + sql + where);
+
+ private XRow execute(final XRowSet xRowRes,final String sql) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException
+ {
+ final XPropertySet xProp = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xRowRes);
+ xProp.setPropertyValue("Command", "SELECT " + sql + where);
xRowRes.execute();
- XResultSet xRes = (XResultSet)UnoRuntime.queryInterface(XResultSet.class,xRowRes);
- assure("No valid row! ",xRes.next());
-
- return (XRow)UnoRuntime.queryInterface(XRow.class, xRes);
+ final XResultSet xRes = (XResultSet) UnoRuntime.queryInterface(XResultSet.class, xRowRes);
+ assure("No valid row! ", xRes.next());
+
+ return (XRow) UnoRuntime.queryInterface(XRow.class, xRes);
}
-
- private void abs(XRowSet xRowRes) throws com.sun.star.uno.Exception,com.sun.star.beans.UnknownPropertyException {
- XRow row = execute(xRowRes,"ABS(2),ABS(-32) ");
- assure("ABS(2) failed!",row.getInt(1) == 2);
- assure("ABS(-32) failed!",row.getInt(2) == 32);
+
+ private void abs(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException
+ {
+ final XRow row = execute(xRowRes, "ABS(2),ABS(-32) ");
+ assure("ABS(2) failed!", row.getInt(1) == 2);
+ assure("ABS(-32) failed!", row.getInt(2) == 32);
}
-
- private void sign(XRowSet xRowRes) throws com.sun.star.uno.Exception,com.sun.star.beans.UnknownPropertyException {
- XRow row = execute(xRowRes,"SIGN(-32),SIGN(0),SIGN(234) ");
- assure("SIGN(-32)failed!",row.getInt(1) == -1);
- assure("SIGN(0) failed!",row.getInt(2) == 0);
- assure("SIGN(234) failed!",row.getInt(3) == 1);
+
+ private void sign(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException
+ {
+ final XRow row = execute(xRowRes, "SIGN(-32),SIGN(0),SIGN(234) ");
+ assure("SIGN(-32)failed!", row.getInt(1) == -1);
+ assure("SIGN(0) failed!", row.getInt(2) == 0);
+ assure("SIGN(234) failed!", row.getInt(3) == 1);
}
-
- private void mod(XRowSet xRowRes) throws com.sun.star.uno.Exception,com.sun.star.beans.UnknownPropertyException {
- XRow row = execute(xRowRes,"MOD(234, 10) ");
- assure("MOD(234, 10) failed!",row.getInt(1) == 4);
+
+ private void mod(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException
+ {
+ final XRow row = execute(xRowRes, "MOD(234, 10) ");
+ assure("MOD(234, 10) failed!", row.getInt(1) == 4);
}
-
- private void floor(XRowSet xRowRes) throws com.sun.star.uno.Exception,com.sun.star.beans.UnknownPropertyException {
- XRow row = execute(xRowRes,"FLOOR(1.23),FLOOR(-1.23) ");
- assure("FLOOR(1.23) failed!",row.getInt(1) == 1);
- assure("FLOOR(-1.23) failed!",row.getInt(2) == -2);
+
+ private void floor(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException
+ {
+ final XRow row = execute(xRowRes, "FLOOR(1.23),FLOOR(-1.23) ");
+ assure("FLOOR(1.23) failed!", row.getInt(1) == 1);
+ assure("FLOOR(-1.23) failed!", row.getInt(2) == -2);
}
- private void ceiling(XRowSet xRowRes) throws com.sun.star.uno.Exception,com.sun.star.beans.UnknownPropertyException {
- XRow row = execute(xRowRes,"CEILING(1.23),CEILING(-1.23) ");
- assure("CEILING(1.23) failed!",row.getInt(1) == 2);
- assure("CEILING(-1.23) failed!",row.getInt(2) == -1);
+
+ private void ceiling(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException
+ {
+ final XRow row = execute(xRowRes, "CEILING(1.23),CEILING(-1.23) ");
+ assure("CEILING(1.23) failed!", row.getInt(1) == 2);
+ assure("CEILING(-1.23) failed!", row.getInt(2) == -1);
}
- private void round(XRowSet xRowRes) throws com.sun.star.uno.Exception,com.sun.star.beans.UnknownPropertyException {
- XRow row = execute(xRowRes,"ROUND(-1.23),ROUND(1.298, 1) ");
- assure("ROUND(-1.23) failed!",row.getInt(1) == -1);
- assure("ROUND(1.298, 1) failed!",row.getDouble(2) == 1.3);
+
+ private void round(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException
+ {
+ final XRow row = execute(xRowRes, "ROUND(-1.23),ROUND(1.298, 1) ");
+ assure("ROUND(-1.23) failed!", row.getInt(1) == -1);
+ assure("ROUND(1.298, 1) failed!", row.getDouble(2) == 1.3);
}
- private void exp(XRowSet xRowRes) throws com.sun.star.uno.Exception,com.sun.star.beans.UnknownPropertyException {
- XRow row = execute(xRowRes,"EXP(2),EXP(-2) ");
- assure("EXP(2) failed!",(float)row.getDouble(1) == (float)java.lang.Math.exp(2) );
- assure("EXP(-2) failed!",(float)row.getDouble(2) == (float)java.lang.Math.exp(-2));
+
+ private void exp(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException
+ {
+ final XRow row = execute(xRowRes, "EXP(2),EXP(-2) ");
+ assure("EXP(2) failed!", (float) row.getDouble(1) == (float) java.lang.Math.exp(2));
+ assure("EXP(-2) failed!", (float) row.getDouble(2) == (float) java.lang.Math.exp(-2));
}
- private void log(XRowSet xRowRes) throws com.sun.star.uno.Exception,com.sun.star.beans.UnknownPropertyException {
- XRow row = execute(xRowRes,"LOG(2),LOG(-2) ");
- assure("LOG(2) failed!",(float)row.getDouble(1) == (float)java.lang.Math.log(2) );
+
+ private void log(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException
+ {
+ final XRow row = execute(xRowRes, "LOG(2),LOG(-2) ");
+ assure("LOG(2) failed!", (float) row.getDouble(1) == (float) java.lang.Math.log(2));
row.getDouble(2);
- assure("LOG(-2) failed!",row.wasNull());
+ assure("LOG(-2) failed!", row.wasNull());
}
- private void log10(XRowSet xRowRes) throws com.sun.star.uno.Exception,com.sun.star.beans.UnknownPropertyException {
- XRow row = execute(xRowRes,"LOG10(100) ");
- assure("LOG10(100) failed!",row.getDouble(1) == 2.0 );
+
+ private void log10(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException
+ {
+ final XRow row = execute(xRowRes, "LOG10(100) ");
+ assure("LOG10(100) failed!", row.getDouble(1) == 2.0);
}
- private void pow(XRowSet xRowRes) throws com.sun.star.uno.Exception,com.sun.star.beans.UnknownPropertyException {
- XRow row = execute(xRowRes,"POWER(2,2) ");
- assure("POWER(2,2) failed!",row.getDouble(1) == 4.0 );
+
+ private void pow(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException
+ {
+ final XRow row = execute(xRowRes, "POWER(2,2) ");
+ assure("POWER(2,2) failed!", row.getDouble(1) == 4.0);
}
- private void sqrt(XRowSet xRowRes) throws com.sun.star.uno.Exception,com.sun.star.beans.UnknownPropertyException {
- XRow row = execute(xRowRes,"SQRT(4) ");
- assure("SQRT(4) failed!",row.getDouble(1) == 2.0 );
+
+ private void sqrt(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException
+ {
+ final XRow row = execute(xRowRes, "SQRT(4) ");
+ assure("SQRT(4) failed!", row.getDouble(1) == 2.0);
}
- private void pi(XRowSet xRowRes) throws com.sun.star.uno.Exception,com.sun.star.beans.UnknownPropertyException {
- XRow row = execute(xRowRes,"PI() ");
- assure("PI() failed!",(float)row.getDouble(1) == (float)java.lang.Math.PI );
+
+ private void pi(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException
+ {
+ final XRow row = execute(xRowRes, "PI() ");
+ assure("PI() failed!", (float) row.getDouble(1) == (float) java.lang.Math.PI);
}
- private void cos(XRowSet xRowRes) throws com.sun.star.uno.Exception,com.sun.star.beans.UnknownPropertyException {
- XRow row = execute(xRowRes,"COS(PI()) ");
- assure("COS(PI()) failed!",row.getDouble(1) == -1.0 );
+
+ private void cos(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException
+ {
+ final XRow row = execute(xRowRes, "COS(PI()) ");
+ assure("COS(PI()) failed!", row.getDouble(1) == -1.0);
}
- private void sin(XRowSet xRowRes) throws com.sun.star.uno.Exception,com.sun.star.beans.UnknownPropertyException {
- XRow row = execute(xRowRes,"SIN(2) ");
- assure("SIN(PI()) failed!",(float)row.getDouble(1) == (float)java.lang.Math.sin( 2 ) );
+
+ private void sin(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException
+ {
+ final XRow row = execute(xRowRes, "SIN(2) ");
+ assure("SIN(PI()) failed!", (float) row.getDouble(1) == (float) java.lang.Math.sin(2));
}
- private void tan(XRowSet xRowRes) throws com.sun.star.uno.Exception,com.sun.star.beans.UnknownPropertyException {
- XRow row = execute(xRowRes,"TAN(PI()+1) ");
- assure("TAN(PI()+1) failed!",(float)row.getDouble(1) == (float)java.lang.Math.tan(java.lang.Math.PI+1.0) );
+
+ private void tan(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException
+ {
+ final XRow row = execute(xRowRes, "TAN(PI()+1) ");
+ assure("TAN(PI()+1) failed!", (float) row.getDouble(1) == (float) java.lang.Math.tan(java.lang.Math.PI + 1.0));
}
- private void acos(XRowSet xRowRes) throws com.sun.star.uno.Exception,com.sun.star.beans.UnknownPropertyException {
- XRow row = execute(xRowRes,"ACOS(1) ");
- assure("ACOS(1) failed!",(float)row.getDouble(1) == 0.0 );
+
+ private void acos(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException
+ {
+ final XRow row = execute(xRowRes, "ACOS(1) ");
+ assure("ACOS(1) failed!", (float) row.getDouble(1) == 0.0);
}
- private void asin(XRowSet xRowRes) throws com.sun.star.uno.Exception,com.sun.star.beans.UnknownPropertyException {
- XRow row = execute(xRowRes,"ASIN(0) ");
- assure("ASIN(0) failed!",(float)row.getDouble(1) == (float)java.lang.Math.asin(0.0) );
+
+ private void asin(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException
+ {
+ final XRow row = execute(xRowRes, "ASIN(0) ");
+ assure("ASIN(0) failed!", (float) row.getDouble(1) == (float) java.lang.Math.asin(0.0));
}
- private void atan(XRowSet xRowRes) throws com.sun.star.uno.Exception,com.sun.star.beans.UnknownPropertyException {
- XRow row = execute(xRowRes,"ATAN(0) ");
- assure("ATAN(0) failed!",row.getDouble(1) == 0.0 );
+
+ private void atan(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException
+ {
+ final XRow row = execute(xRowRes, "ATAN(0) ");
+ assure("ATAN(0) failed!", row.getDouble(1) == 0.0);
}
- private void atan2(XRowSet xRowRes) throws com.sun.star.uno.Exception,com.sun.star.beans.UnknownPropertyException {
- XRow row = execute(xRowRes,"ATAN2(0,2) ");
- assure("ATAN2(0,2) failed!",(float)row.getDouble(1) == 0.0 );
+
+ private void atan2(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException
+ {
+ final XRow row = execute(xRowRes, "ATAN2(0,2) ");
+ assure("ATAN2(0,2) failed!", (float) row.getDouble(1) == 0.0);
}
- private void degrees(XRowSet xRowRes) throws com.sun.star.uno.Exception,com.sun.star.beans.UnknownPropertyException {
- XRow row = execute(xRowRes,"DEGREES(PI()) ");
- assure("DEGREES(PI()) failed!",row.getDouble(1) == 180.0 );
+
+ private void degrees(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException
+ {
+ final XRow row = execute(xRowRes, "DEGREES(PI()) ");
+ assure("DEGREES(PI()) failed!", row.getDouble(1) == 180.0);
}
- private void radians(XRowSet xRowRes) throws com.sun.star.uno.Exception,com.sun.star.beans.UnknownPropertyException {
- XRow row = execute(xRowRes,"RADIANS(90) ");
- assure("RADIANS(90) failed!",(float)row.getDouble(1) == (float)(java.lang.Math.PI / 2.0) );
+
+ private void radians(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException
+ {
+ final XRow row = execute(xRowRes, "RADIANS(90) ");
+ assure("RADIANS(90) failed!", (float) row.getDouble(1) == (float) (java.lang.Math.PI / 2.0));
}
}
diff --git a/connectivity/qa/drivers/dbase/DBaseSqlTests.java b/connectivity/qa/drivers/dbase/DBaseSqlTests.java
new file mode 100755
index 0000000000..c60352636f
--- /dev/null
+++ b/connectivity/qa/drivers/dbase/DBaseSqlTests.java
@@ -0,0 +1,99 @@
+/*************************************************************************
+ *
+ * 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: DBaseStringFunctions.java,v $
+ * $Revision: 1.6 $
+ *
+ * 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 qa.drivers.dbase;
+
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.sdbc.*;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.lang.XMultiServiceFactory;
+
+public class DBaseSqlTests
+{
+ private final XMultiServiceFactory m_xORB;
+ private final DBaseDriverTest testcase;
+
+ public DBaseSqlTests(final XMultiServiceFactory _xORB,final DBaseDriverTest _testcase)
+ {
+ m_xORB = _xORB;
+ testcase = _testcase;
+ }
+
+ private void assure(final String s,final boolean b)
+ {
+ testcase.assure2(s, b);
+ }
+
+ public void testFunctions() throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException
+ {
+ final XRowSet xRowRes = (XRowSet) UnoRuntime.queryInterface(XRowSet.class,
+ m_xORB.createInstance("com.sun.star.sdb.RowSet"));
+
+ testcase.getLog().println("starting SQL test");
+ // set the properties needed to connect to a database
+ final XPropertySet xProp = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xRowRes);
+ xProp.setPropertyValue("DataSourceName", "Bibliography");
+ xProp.setPropertyValue("CommandType", Integer.valueOf(com.sun.star.sdb.CommandType.COMMAND));
+
+ execute(xRowRes,"1 FROM \"biblio\" \"biblio\" where \"Identifier\" like 'B%'");
+ execute(xRowRes,"1 FROM \"biblio\" \"biblio\" where not \"Identifier\" like 'B%'");
+ execute(xRowRes,"1 FROM \"biblio\" \"biblio\" where not \"Identifier\" not like 'B%'");
+ execute(xRowRes,"1 FROM \"biblio\" \"biblio\" where not(0 = 1)");
+ execute(xRowRes,"1 FROM \"biblio\" \"biblio\" where 0 = 0");
+ execute(xRowRes,"1 FROM \"biblio\" \"biblio\" where (0 = 0)");
+ execute(xRowRes,"1 FROM \"biblio\" \"biblio\" where 0 <> 1");
+ execute(xRowRes,"1 FROM \"biblio\" \"biblio\" where 0 < 1");
+ execute(xRowRes,"1 FROM \"biblio\" \"biblio\" where 2 > 1");
+ execute(xRowRes,"1,1+1,'a' + 'b' FROM \"biblio\" \"biblio\" where 2 > 1");
+ // execute(xRowRes,"1 FROM \"biblio\" \"biblio\" where (0 = 0) is true");
+ // execute(xRowRes,"1 FROM \"biblio\" \"biblio\" where not (0 = 0) is not true");
+ // execute(xRowRes,"1 FROM \"biblio\" \"biblio\" where 1 between 0 and 2");
+ execute(xRowRes,"1 FROM \"biblio\" \"biblio\" where not \"Identifier\" is NULL");
+ execute(xRowRes,"1 FROM \"biblio\" \"biblio\" where \"Identifier\" is not NULL");
+ execute(xRowRes,"1 FROM \"biblio\" \"biblio\" where \"Identifier\" = \"Identifier\"");
+ execute(xRowRes,"1 FROM \"biblio\" \"biblio\" where not(not(\"Identifier\" = \"Identifier\"))");
+ execute(xRowRes,"1 FROM \"biblio\" \"biblio\" where (1 = 1 and 2 = 1) or 3 = 33 or 4 = 44 or ('a' = 'a' and 'b' = 'b')");
+ }
+
+ private void execute(final XRowSet xRowRes, String sql) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException
+ {
+ try
+ {
+ final XPropertySet xProp = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xRowRes);
+ xProp.setPropertyValue("Command", "SELECT " + sql);
+ xRowRes.execute();
+ }
+ catch(SQLException e)
+ {
+ testcase.getLog().println(sql + " Error: " + e.getMessage());
+ }
+ }
+
+
+}
diff --git a/connectivity/qa/drivers/dbase/DBaseStringFunctions.java b/connectivity/qa/drivers/dbase/DBaseStringFunctions.java
index 2a98519feb..f6a35dafc7 100644
--- a/connectivity/qa/drivers/dbase/DBaseStringFunctions.java
+++ b/connectivity/qa/drivers/dbase/DBaseStringFunctions.java
@@ -27,244 +27,300 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-package complex.connectivity;
+package qa.drivers.dbase;
-import complex.connectivity.DBaseDriverTest;
import com.sun.star.uno.UnoRuntime;
-import com.sun.star.util.XCloseable;
import com.sun.star.sdbc.*;
-import com.sun.star.sdb.*;
-import com.sun.star.beans.PropertyValue;
import com.sun.star.beans.XPropertySet;
-
import com.sun.star.lang.XMultiServiceFactory;
-import complexlib.ComplexTestCase;
-
-import java.io.PrintWriter;
-
-import util.utils;
-import java.util.*;
-import java.io.*;
+public class DBaseStringFunctions
+{
+ private String where = "FROM \"biblio\" \"biblio\" where \"Identifier\" = 'BOR00'";
+ private final XMultiServiceFactory m_xORB;
+ private final DBaseDriverTest testcase;
+ public DBaseStringFunctions(final XMultiServiceFactory _xORB,final DBaseDriverTest _testcase)
+ {
+ m_xORB = _xORB;
+ testcase = _testcase;
+ }
-public class DBaseStringFunctions {
+ private void assure(final String s,final boolean b)
+ {
+ testcase.assure2(s, b);
+ }
- private String where = "FROM \"biblio\" \"biblio\" where \"Identifier\" = 'BOR00'";
- private XMultiServiceFactory m_xORB;
- private DBaseDriverTest testcase;
- public DBaseStringFunctions(XMultiServiceFactory _xORB,DBaseDriverTest _testcase){
- m_xORB = _xORB;
- testcase = _testcase;
- }
-
- private void assure(String s,boolean b){
- testcase.assure2(s,b);
- }
-
- public void testFunctions() throws com.sun.star.uno.Exception,com.sun.star.beans.UnknownPropertyException {
- XRowSet xRowRes = (XRowSet)UnoRuntime.queryInterface(XRowSet.class,
- m_xORB.createInstance("com.sun.star.sdb.RowSet"));
+ public void testFunctions() throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException
+ {
+ final XRowSet xRowRes = (XRowSet) UnoRuntime.queryInterface(XRowSet.class,
+ m_xORB.createInstance("com.sun.star.sdb.RowSet"));
- System.out.println("starting String function test");
+ testcase.getLog().println("starting String function test");
// set the properties needed to connect to a database
- XPropertySet xProp = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xRowRes);
- xProp.setPropertyValue("DataSourceName","Bibliography");
-
- xProp.setPropertyValue("CommandType",new Integer(com.sun.star.sdb.CommandType.COMMAND));
-
- try {
- upper(xRowRes);
- } catch( SQLException ex){
- assure("upper " + ex.getMessage(),false);
+ final XPropertySet xProp = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xRowRes);
+ xProp.setPropertyValue("DataSourceName", "Bibliography");
+
+ xProp.setPropertyValue("CommandType", Integer.valueOf(com.sun.star.sdb.CommandType.COMMAND));
+
+ try
+ {
+ upper(xRowRes);
+ }
+ catch (SQLException ex)
+ {
+ assure("upper " + ex.getMessage(), false);
throw ex;
}
- try{
- lower(xRowRes);
- } catch( SQLException ex){
- assure("lower " + ex.getMessage(),false);
+ try
+ {
+ lower(xRowRes);
+ }
+ catch (SQLException ex)
+ {
+ assure("lower " + ex.getMessage(), false);
throw ex;
}
- try{
- acsii(xRowRes);
- } catch( SQLException ex){
- assure("ascii " + ex.getMessage(),false);
+ try
+ {
+ acsii(xRowRes);
+ }
+ catch (SQLException ex)
+ {
+ assure("ascii " + ex.getMessage(), false);
throw ex;
}
- try{
- char_length(xRowRes);
- } catch( SQLException ex){
- assure("char_len " + ex.getMessage(),false);
+ try
+ {
+ char_length(xRowRes);
+ }
+ catch (SQLException ex)
+ {
+ assure("char_len " + ex.getMessage(), false);
throw ex;
}
- try{
- concat(xRowRes);
- } catch( SQLException ex){
- assure("concat " + ex.getMessage(),false);
+ try
+ {
+ concat(xRowRes);
+ }
+ catch (SQLException ex)
+ {
+ assure("concat " + ex.getMessage(), false);
throw ex;
}
- try{
+ try
+ {
chartest(xRowRes);
- } catch( SQLException ex){
- assure("char " + ex.getMessage(),false);
+ }
+ catch (SQLException ex)
+ {
+ assure("char " + ex.getMessage(), false);
throw ex;
}
- try{
- locate(xRowRes);
- } catch( SQLException ex){
- assure("locate " + ex.getMessage(),false);
+ try
+ {
+ locate(xRowRes);
+ }
+ catch (SQLException ex)
+ {
+ assure("locate " + ex.getMessage(), false);
throw ex;
}
- try{
- substring(xRowRes);
- } catch( SQLException ex){
- assure("substr " + ex.getMessage(),false);
+ try
+ {
+ substring(xRowRes);
+ }
+ catch (SQLException ex)
+ {
+ assure("substr " + ex.getMessage(), false);
throw ex;
}
- try{
- ltrim(xRowRes);
- } catch( SQLException ex){
- assure("ltrim " + ex.getMessage(),false);
+ try
+ {
+ ltrim(xRowRes);
+ }
+ catch (SQLException ex)
+ {
+ assure("ltrim " + ex.getMessage(), false);
throw ex;
}
- try{
- rtrim(xRowRes);
- } catch( SQLException ex){
- assure("rtrim " + ex.getMessage(),false);
+ try
+ {
+ rtrim(xRowRes);
+ }
+ catch (SQLException ex)
+ {
+ assure("rtrim " + ex.getMessage(), false);
throw ex;
}
- try{
- space(xRowRes);
- } catch( SQLException ex){
- assure("space " + ex.getMessage(),false);
+ try
+ {
+ space(xRowRes);
+ }
+ catch (SQLException ex)
+ {
+ assure("space " + ex.getMessage(), false);
throw ex;
}
- try{
- replace(xRowRes);
- } catch( SQLException ex){
- assure("replace " + ex.getMessage(),false);
+ try
+ {
+ replace(xRowRes);
+ }
+ catch (SQLException ex)
+ {
+ assure("replace " + ex.getMessage(), false);
throw ex;
}
- try{
- repeat(xRowRes);
- } catch( SQLException ex){
- assure("repeat " + ex.getMessage(),false);
+ try
+ {
+ repeat(xRowRes);
+ }
+ catch (SQLException ex)
+ {
+ assure("repeat " + ex.getMessage(), false);
throw ex;
}
- try{
- insert(xRowRes);
- } catch( SQLException ex){
- assure("insert " + ex.getMessage(),false);
+ try
+ {
+ insert(xRowRes);
+ }
+ catch (SQLException ex)
+ {
+ assure("insert " + ex.getMessage(), false);
throw ex;
}
- try{
- left(xRowRes);
- } catch( SQLException ex){
- assure("left " + ex.getMessage(),false);
+ try
+ {
+ left(xRowRes);
+ }
+ catch (SQLException ex)
+ {
+ assure("left " + ex.getMessage(), false);
throw ex;
}
- try{
- right(xRowRes);
- } catch( SQLException ex){
- assure("right " + ex.getMessage(),false);
+ try
+ {
+ right(xRowRes);
+ }
+ catch (SQLException ex)
+ {
+ assure("right " + ex.getMessage(), false);
throw ex;
}
}
-
- private XRow execute(XRowSet xRowRes,String sql) throws com.sun.star.uno.Exception,com.sun.star.beans.UnknownPropertyException {
- XPropertySet xProp = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xRowRes);
- xProp.setPropertyValue("Command","SELECT " + sql + where);
+
+ private XRow execute(final XRowSet xRowRes, String sql) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException
+ {
+ final XPropertySet xProp = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xRowRes);
+ xProp.setPropertyValue("Command", "SELECT " + sql + where);
xRowRes.execute();
- XResultSet xRes = (XResultSet)UnoRuntime.queryInterface(XResultSet.class,xRowRes);
- assure("No valid row! ",xRes.next());
-
- return (XRow)UnoRuntime.queryInterface(XRow.class, xRes);
+ final XResultSet xRes = (XResultSet) UnoRuntime.queryInterface(XResultSet.class, xRowRes);
+ assure("No valid row! ", xRes.next());
+
+ return (XRow) UnoRuntime.queryInterface(XRow.class, xRes);
}
-
- private void upper(XRowSet xRowRes) throws com.sun.star.uno.Exception,com.sun.star.beans.UnknownPropertyException {
- XRow row = execute(xRowRes,"upper('test'),UCASE('test') ");
- assure("upper('test') failed!",row.getString(1).equals("TEST"));
- assure("ucase('test') failed!",row.getString(2).equals("TEST"));
+
+ private void upper(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException
+ {
+ final XRow row = execute(xRowRes, "upper('test'),UCASE('test') ");
+ assure("upper('test') failed!", row.getString(1).equals("TEST"));
+ assure("ucase('test') failed!", row.getString(2).equals("TEST"));
}
-
- private void lower(XRowSet xRowRes) throws com.sun.star.uno.Exception,com.sun.star.beans.UnknownPropertyException {
- XRow row = execute(xRowRes,"lower('TEST'),LCASE('TEST') ");
- assure("lower('TEST') failed!",row.getString(1).equals("test"));
- assure("lcase('TEST') failed!",row.getString(2).equals("test"));
- final String t = where;
+
+ private void lower(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException
+ {
+ final XRow row = execute(xRowRes, "lower('TEST'),LCASE('TEST') ");
+ assure("lower('TEST') failed!", row.getString(1).equals("test"));
+ assure("lcase('TEST') failed!", row.getString(2).equals("test"));
+ final String temp = where;
where = "FROM \"biblio\" \"biblio\" where LOWER(\"Identifier\") like 'bor%'";
- row = execute(xRowRes,"lower('TEST'),LCASE('TEST') ");
- where = t;
+ execute(xRowRes, "lower('TEST'),LCASE('TEST') ");
+ where = temp;
}
-
- private void acsii(XRowSet xRowRes) throws com.sun.star.uno.Exception,com.sun.star.beans.UnknownPropertyException {
- XRow row = execute(xRowRes,"ASCII('2') ");
- assure("acsii('2') failed!",row.getInt(1) == 50);
+
+ private void acsii(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException
+ {
+ final XRow row = execute(xRowRes, "ASCII('2') ");
+ assure("acsii('2') failed!", row.getInt(1) == 50);
}
-
- private void char_length(XRowSet xRowRes) throws com.sun.star.uno.Exception,com.sun.star.beans.UnknownPropertyException {
- XRow row = execute(xRowRes,"char_length('test'),character_length('test'),OCTET_LENGTH('test') ");
- assure("char_length('test') failed!",row.getInt(1) == 4);
- assure("character_length('test') failed!",row.getInt(2) == 4);
- assure("OCTET_LENGTH('test') failed!",row.getInt(3) == 4);
+
+ private void char_length(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException
+ {
+ final XRow row = execute(xRowRes, "char_length('test'),character_length('test'),OCTET_LENGTH('test') ");
+ assure("char_length('test') failed!", row.getInt(1) == 4);
+ assure("character_length('test') failed!", row.getInt(2) == 4);
+ assure("OCTET_LENGTH('test') failed!", row.getInt(3) == 4);
}
-
- private void concat(XRowSet xRowRes) throws com.sun.star.uno.Exception,com.sun.star.beans.UnknownPropertyException {
- XRow row = execute(xRowRes,"CONCAT('Hello',' ','World') ");
- assure("CONCAT('Hello',' ',,'World') failed!",row.getString(1).equals("Hello World"));
+
+ private void concat(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException
+ {
+ final XRow row = execute(xRowRes, "CONCAT('Hello',' ','World') ");
+ assure("CONCAT('Hello',' ',,'World') failed!", row.getString(1).equals("Hello World"));
}
-
- private void locate(XRowSet xRowRes) throws com.sun.star.uno.Exception,com.sun.star.beans.UnknownPropertyException {
- XRow row = execute(xRowRes,"LOCATE('bar', 'foobarbar') ");
- assure("LOCATE('bar', 'foobarbar') failed!",row.getInt(1) == 4);
+
+ private void locate(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException
+ {
+ final XRow row = execute(xRowRes, "LOCATE('bar', 'foobarbar') ");
+ assure("LOCATE('bar', 'foobarbar') failed!", row.getInt(1) == 4);
}
-
- private void substring(XRowSet xRowRes) throws com.sun.star.uno.Exception,com.sun.star.beans.UnknownPropertyException {
- XRow row = execute(xRowRes,"SUBSTRING('Quadratically',5) ");
- assure("SUBSTRING('Quadratically',5) failed!",row.getString(1).equals("ratically"));
+
+ private void substring(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException
+ {
+ final XRow row = execute(xRowRes, "SUBSTRING('Quadratically',5) ");
+ assure("SUBSTRING('Quadratically',5) failed!", row.getString(1).equals("ratically"));
}
-
- private void ltrim(XRowSet xRowRes) throws com.sun.star.uno.Exception,com.sun.star.beans.UnknownPropertyException {
- XRow row = execute(xRowRes,"LTRIM(' barbar') ");
- assure("LTRIM(' barbar') failed!",row.getString(1).equals("barbar"));
+
+ private void ltrim(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException
+ {
+ final XRow row = execute(xRowRes, "LTRIM(' barbar') ");
+ assure("LTRIM(' barbar') failed!", row.getString(1).equals("barbar"));
}
-
- private void rtrim(XRowSet xRowRes) throws com.sun.star.uno.Exception,com.sun.star.beans.UnknownPropertyException {
- XRow row = execute(xRowRes,"RTRIM('barbar ') ");
- assure("RTRIM('barbar ') failed!",row.getString(1).equals( "barbar"));
+
+ private void rtrim(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException
+ {
+ final XRow row = execute(xRowRes, "RTRIM('barbar ') ");
+ assure("RTRIM('barbar ') failed!", row.getString(1).equals("barbar"));
}
-
- private void space(XRowSet xRowRes) throws com.sun.star.uno.Exception,com.sun.star.beans.UnknownPropertyException {
- XRow row = execute(xRowRes,"space(6) ");
- assure("space(6) failed!",row.getString(1).equals(" "));
+
+ private void space(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException
+ {
+ final XRow row = execute(xRowRes, "space(6) ");
+ assure("space(6) failed!", row.getString(1).equals(" "));
}
-
- private void replace(XRowSet xRowRes) throws com.sun.star.uno.Exception,com.sun.star.beans.UnknownPropertyException {
- XRow row = execute(xRowRes,"REPLACE('www.OOo.com', 'w', 'Ww') ");
- assure("REPLACE('www.OOo.com', 'w', 'Ww') failed!",row.getString(1).equals("WwWwWw.OOo.com"));
+
+ private void replace(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException
+ {
+ final XRow row = execute(xRowRes, "REPLACE('www.OOo.com', 'w', 'Ww') ");
+ assure("REPLACE('www.OOo.com', 'w', 'Ww') failed!", row.getString(1).equals("WwWwWw.OOo.com"));
}
-
- private void repeat(XRowSet xRowRes) throws com.sun.star.uno.Exception,com.sun.star.beans.UnknownPropertyException {
- XRow row = execute(xRowRes,"REPEAT('OOo', 3) ");
- assure("REPEAT('OOo', 3) failed!",row.getString(1).equals("OOoOOoOOo"));
+
+ private void repeat(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException
+ {
+ final XRow row = execute(xRowRes, "REPEAT('OOo', 3) ");
+ assure("REPEAT('OOo', 3) failed!", row.getString(1).equals("OOoOOoOOo"));
}
-
- private void insert(XRowSet xRowRes) throws com.sun.star.uno.Exception,com.sun.star.beans.UnknownPropertyException {
- XRow row = execute(xRowRes,"INSERT('Quadratic', 3, 4, 'What') ");
- assure("INSERT('Quadratic', 3, 4, 'What') failed!",row.getString(1).equals("QuWhattic"));
+
+ private void insert(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException
+ {
+ final XRow row = execute(xRowRes, "INSERT('Quadratic', 3, 4, 'What') ");
+ assure("INSERT('Quadratic', 3, 4, 'What') failed!", row.getString(1).equals("QuWhattic"));
}
-
- private void left(XRowSet xRowRes) throws com.sun.star.uno.Exception,com.sun.star.beans.UnknownPropertyException {
- XRow row = execute(xRowRes,"LEFT('foobarbar', 5) ");
- assure("LEFT('foobarbar', 5) failed!",row.getString(1).equals("fooba"));
+
+ private void left(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException
+ {
+ final XRow row = execute(xRowRes, "LEFT('foobarbar', 5) ");
+ assure("LEFT('foobarbar', 5) failed!", row.getString(1).equals("fooba"));
}
-
- private void right(XRowSet xRowRes) throws com.sun.star.uno.Exception,com.sun.star.beans.UnknownPropertyException {
- XRow row = execute(xRowRes,"RIGHT('foobarbar', 4) ");
- assure("RIGHT('foobarbar', 4) failed!",row.getString(1).equals("rbar"));
+
+ private void right(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException
+ {
+ final XRow row = execute(xRowRes, "RIGHT('foobarbar', 4) ");
+ assure("RIGHT('foobarbar', 4) failed!", row.getString(1).equals("rbar"));
}
- private void chartest(XRowSet xRowRes) throws com.sun.star.uno.Exception,com.sun.star.beans.UnknownPropertyException {
- XRow row = execute(xRowRes,"CHAR(ascii('t'),ascii('e'),ascii('s'),ascii('t')) ");
- assure("CHAR(ascii('t'),ascii('e'),ascii('s'),ascii('t')) failed!",row.getString(1).equals("test"));
+
+ private void chartest(final XRowSet xRowRes) throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException
+ {
+ final XRow row = execute(xRowRes, "CHAR(ascii('t'),ascii('e'),ascii('s'),ascii('t')) ");
+ assure("CHAR(ascii('t'),ascii('e'),ascii('s'),ascii('t')) failed!", row.getString(1).equals("test"));
}
}
diff --git a/connectivity/qa/drivers/dbase/makefile.mk b/connectivity/qa/drivers/dbase/makefile.mk
index f7d2f79a74..4544b2a2bc 100644
--- a/connectivity/qa/drivers/dbase/makefile.mk
+++ b/connectivity/qa/drivers/dbase/makefile.mk
@@ -32,7 +32,7 @@
PRJ = ..$/..$/..
TARGET = DBaseDriverTest
PRJNAME = connectivity
-PACKAGE = complex$/connectivity
+PACKAGE = qa$/drivers$/dbase
# --- Settings -----------------------------------------------------
.INCLUDE: settings.mk
@@ -45,7 +45,8 @@ JAVAFILES =\
DBaseDateFunctions.java\
DBaseDriverTest.java\
DBaseNumericFunctions.java\
- DBaseStringFunctions.java
+ DBaseStringFunctions.java\
+ DBaseSqlTests.java
JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class)
@@ -62,6 +63,6 @@ JARCOMPRESS = TRUE
.INCLUDE : target.mk
-run:
- java -cp "$(CLASSPATH)$(PATH_SEPERATOR)$(SOLARBINDIR)$/OOoRunner.jar" org.openoffice.Runner -TestBase java_complex -o complex.connectivity.$(TARGET)
+run: $(CLASSDIR)$/$(JARTARGET)
+ java -cp "$(CLASSPATH)$(PATH_SEPERATOR)$(SOLARBINDIR)$/OOoRunner.jar" org.openoffice.Runner -TestBase java_complex -o qa.drivers.dbase.$(TARGET)
diff --git a/connectivity/source/commontools/DateConversion.cxx b/connectivity/source/commontools/DateConversion.cxx
index ba92259534..bd6ad7bd76 100644
--- a/connectivity/source/commontools/DateConversion.cxx
+++ b/connectivity/source/commontools/DateConversion.cxx
@@ -87,6 +87,7 @@ using namespace ::com::sun::star::beans;
break;
case DataType::CHAR:
case DataType::VARCHAR:
+ case DataType::LONGVARCHAR:
if (bQuote)
aRet += ::rtl::OUString::createFromAscii("'");
{
diff --git a/connectivity/source/commontools/dbtools.cxx b/connectivity/source/commontools/dbtools.cxx
index da7bcd1a8d..bfbfdc7383 100644
--- a/connectivity/source/commontools/dbtools.cxx
+++ b/connectivity/source/commontools/dbtools.cxx
@@ -1014,7 +1014,6 @@ try
Property* pResult = ::std::lower_bound(pNewProps, pNewProps + nNewLen,pOldProps[i].Name, ::comphelper::PropertyStringLessFunctor());
if ( pResult
&& ( pResult != pNewProps + nNewLen && pResult->Name == pOldProps[i].Name )
- && ( pResult->Attributes == pOldProps[i].Attributes )
&& ( (pResult->Attributes & PropertyAttribute::READONLY) == 0 )
&& ( pResult->Type.equals(pOldProps[i].Type)) )
{ // Attribute stimmen ueberein und Property ist nicht read-only
diff --git a/connectivity/source/drivers/file/FResultSet.cxx b/connectivity/source/drivers/file/FResultSet.cxx
index 03f0d6f317..ae614f0c28 100644
--- a/connectivity/source/drivers/file/FResultSet.cxx
+++ b/connectivity/source/drivers/file/FResultSet.cxx
@@ -1303,8 +1303,9 @@ void OResultSet::sortRows()
OSL_ENSURE((sal_Int32)m_aRow->get().size() > *aOrderByIter,"Invalid Index");
switch ((*(m_aRow->get().begin()+*aOrderByIter))->getValue().getTypeKind())
{
- case DataType::CHAR:
+ case DataType::CHAR:
case DataType::VARCHAR:
+ case DataType::LONGVARCHAR:
eKeyType[i] = SQL_ORDERBYKEY_STRING;
break;
@@ -1471,6 +1472,7 @@ BOOL OResultSet::OpenImpl()
if(IsSorted())
{
aOrderbyColumnNumberSave = m_aOrderbyColumnNumber;// .assign(m_aOrderbyColumnNumber.begin(), m_aOrderbyColumnNumber.end());
+ m_aOrderbyColumnNumber.clear();
aOrderbyAscendingSave.assign(m_aOrderbyAscending.begin(), m_aOrderbyAscending.end());
bWasSorted = TRUE;
}
diff --git a/connectivity/source/drivers/file/FStatement.cxx b/connectivity/source/drivers/file/FStatement.cxx
index ead8799afa..6d82486dae 100644
--- a/connectivity/source/drivers/file/FStatement.cxx
+++ b/connectivity/source/drivers/file/FStatement.cxx
@@ -796,6 +796,7 @@ void OStatement_Base::SetAssignValue(const String& aColumnName,
// Kriterium je nach Typ als String oder double in die Variable packen ...
case DataType::CHAR:
case DataType::VARCHAR:
+ case DataType::LONGVARCHAR:
*(m_aAssignValues->get())[nId] = ORowSetValue(aValue);
// Zeichensatz ist bereits konvertiert, da ja das gesamte Statement konvertiert wurde
break;
diff --git a/connectivity/source/drivers/file/fcode.cxx b/connectivity/source/drivers/file/fcode.cxx
index 9c686df607..1793cf58e3 100644
--- a/connectivity/source/drivers/file/fcode.cxx
+++ b/connectivity/source/drivers/file/fcode.cxx
@@ -65,6 +65,7 @@ TYPEINIT1(OStopOperand, OOperandValue);
TYPEINIT1(OOperator, OCode);
TYPEINIT1(OBoolOperator,OOperator);
+TYPEINIT1(OOp_NOT, OBoolOperator);
TYPEINIT1(OOp_AND, OBoolOperator);
TYPEINIT1(OOp_OR, OBoolOperator);
TYPEINIT1(OOp_ISNULL, OBoolOperator);
@@ -242,6 +243,29 @@ void OBoolOperator::Exec(OCodeStack& rCodeStack)
if (IS_TYPE(OOperandResult,pRight))
delete pRight;
}
+//------------------------------------------------------------------
+sal_Bool OOp_NOT::operate(const OOperand* pLeft, const OOperand* ) const
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_AND::operate" );
+ return !pLeft->isValid();
+}
+//------------------------------------------------------------------
+void OOp_NOT::Exec(OCodeStack& rCodeStack)
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_ISNULL::Exec" );
+ OOperand* pOperand = rCodeStack.top();
+ rCodeStack.pop();
+
+ rCodeStack.push(new OOperandResultBOOL(operate(pOperand)));
+ if (IS_TYPE(OOperandResult,pOperand))
+ delete pOperand;
+}
+//------------------------------------------------------------------
+sal_uInt16 OOp_NOT::getRequestedOperands() const
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_NOT::getRequestedOperands" );
+ return 1;
+}
//------------------------------------------------------------------
sal_Bool OOp_AND::operate(const OOperand* pLeft, const OOperand* pRight) const
@@ -331,6 +355,7 @@ sal_Bool OOp_COMPARE::operate(const OOperand* pLeft, const OOperand* pRight) con
{
case DataType::CHAR:
case DataType::VARCHAR:
+ case DataType::LONGVARCHAR:
{
rtl::OUString sLH = aLH, sRH = aRH;
INT32 nRes = rtl_ustr_compareIgnoreAsciiCase_WithLength
diff --git a/connectivity/source/drivers/file/fcomp.cxx b/connectivity/source/drivers/file/fcomp.cxx
index c3dd5eb478..c402bdefc5 100644
--- a/connectivity/source/drivers/file/fcomp.cxx
+++ b/connectivity/source/drivers/file/fcomp.cxx
@@ -166,7 +166,7 @@ OOperand* OPredicateCompiler::execute(OSQLParseNode* pPredicateNode)
}
else if ((SQL_ISRULE(pPredicateNode,search_condition) || (SQL_ISRULE(pPredicateNode,boolean_term)))
&& // AND/OR-Verknuepfung:
- pPredicateNode->count() == 3)
+ pPredicateNode->count() == 3)
{
execute(pPredicateNode->getChild(0)); // Bearbeiten des linken Zweigs
execute(pPredicateNode->getChild(2)); // Bearbeiten des rechten Zweigs
@@ -183,6 +183,11 @@ OOperand* OPredicateCompiler::execute(OSQLParseNode* pPredicateNode)
DBG_ERROR("OPredicateCompiler: Fehler im Parse Tree");
}
}
+ else if (SQL_ISRULE(pPredicateNode,boolean_factor))
+ {
+ execute(pPredicateNode->getChild(1));
+ m_aCodeList.push_back(new OOp_NOT());
+ }
else if (SQL_ISRULE(pPredicateNode,comparison_predicate))
{
execute_COMPARE(pPredicateNode);
diff --git a/connectivity/source/drivers/file/quotedstring.cxx b/connectivity/source/drivers/file/quotedstring.cxx
index e3474c322f..2b78034b2d 100644
--- a/connectivity/source/drivers/file/quotedstring.cxx
+++ b/connectivity/source/drivers/file/quotedstring.cxx
@@ -113,7 +113,7 @@ namespace connectivity
if ( nStartPos >= nLen )
return;
- sal_Unicode* pData = _rStr.AllocBuffer(nLen - nStartPos);
+ sal_Unicode* pData = _rStr.AllocBuffer( nLen - nStartPos + 1 );
const sal_Unicode* pStart = pData;
// Suche bis Stringende nach dem ersten nicht uebereinstimmenden Zeichen
for( xub_StrLen i = nStartPos; i < nLen; ++i )
@@ -135,6 +135,7 @@ namespace connectivity
{
// String-Ende
bInString = FALSE;
+ *pData = 0;
}
}
else
@@ -151,6 +152,7 @@ namespace connectivity
// Vorzeitiger Abbruch der Schleife moeglich, denn
// wir haben, was wir wollten.
nStartPos = i+1;
+ *pData = 0;
break;
}
else
diff --git a/connectivity/source/drivers/flat/ETable.cxx b/connectivity/source/drivers/flat/ETable.cxx
index 60ed8731b9..7fbc472586 100644
--- a/connectivity/source/drivers/flat/ETable.cxx
+++ b/connectivity/source/drivers/flat/ETable.cxx
@@ -660,7 +660,10 @@ sal_Bool OFlatTable::fetchRow(OValueRefRow& _rRow,const OSQLColumns & _rCols,sal
}
return sal_True;
}
-
+void OFlatTable::refreshHeader()
+{
+ m_nRowPos = 0;
+}
// -----------------------------------------------------------------------------
sal_Bool OFlatTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int32 nOffset, sal_Int32& nCurPos)
{
@@ -692,7 +695,7 @@ sal_Bool OFlatTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int
m_pFileStream->Seek(m_nFilePos);
if ( m_pFileStream->IsEof() || !readLine(nCurPos) /*|| !checkHeaderLine()*/)
{
- m_nMaxRowCount = m_nRowPos;
+ m_nMaxRowCount = m_nRowPos -1;
return sal_False;
} // if ( m_pFileStream->IsEof() || !readLine(nCurPos) /*|| !checkHeaderLine()*/)
@@ -797,7 +800,10 @@ sal_Bool OFlatTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int
TRowPositionsInFile::const_iterator aFind = m_aFilePosToEndLinePos.find(nOffset);
m_bNeedToReadLine = aFind != m_aFilePosToEndLinePos.end();
if ( m_bNeedToReadLine )
+ {
+ m_nFilePos = aFind->first;
nCurPos = aFind->second;
+ }
else
{
m_nFilePos = nOffset;
diff --git a/connectivity/source/drivers/flat/flat.xcu b/connectivity/source/drivers/flat/flat.xcu
index 29c88bfbe0..6a22ed8662 100755
--- a/connectivity/source/drivers/flat/flat.xcu
+++ b/connectivity/source/drivers/flat/flat.xcu
@@ -104,7 +104,7 @@
</node>
<node oor:name="MediaType" oor:op="replace">
<prop oor:name="Value" oor:type="xs:string">
- <value>application/csv</value>
+ <value>text/csv</value>
</prop>
</node>
</node>
diff --git a/connectivity/source/inc/file/fcode.hxx b/connectivity/source/inc/file/fcode.hxx
index 89c68f654a..de07555d40 100644
--- a/connectivity/source/inc/file/fcode.hxx
+++ b/connectivity/source/inc/file/fcode.hxx
@@ -236,6 +236,16 @@ namespace connectivity
virtual sal_Bool operate(const OOperand*, const OOperand*) const;
};
+ class OOp_NOT : public OBoolOperator
+ {
+ public:
+ TYPEINFO();
+
+ protected:
+ virtual void Exec(OCodeStack&);
+ virtual sal_Bool operate(const OOperand*, const OOperand* = NULL) const;
+ virtual sal_uInt16 getRequestedOperands() const;
+ };
class OOp_AND : public OBoolOperator
{
diff --git a/connectivity/source/inc/flat/ETable.hxx b/connectivity/source/inc/flat/ETable.hxx
index 45702a4e20..24c0b150a0 100644
--- a/connectivity/source/inc/flat/ETable.hxx
+++ b/connectivity/source/inc/flat/ETable.hxx
@@ -87,6 +87,7 @@ namespace connectivity
virtual sal_Bool seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int32 nOffset, sal_Int32& nCurPos);
virtual sal_Bool fetchRow(OValueRefRow& _rRow,const OSQLColumns& _rCols, sal_Bool bIsTable,sal_Bool bRetrieveData);
+ virtual void refreshHeader();
virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
//XTypeProvider
diff --git a/connectivity/source/parse/sqlflex.l b/connectivity/source/parse/sqlflex.l
index 6159f79e1b..e365fdec1e 100644
--- a/connectivity/source/parse/sqlflex.l
+++ b/connectivity/source/parse/sqlflex.l
@@ -483,7 +483,7 @@ sal_Int32 gatherString( sal_Int32 delim, sal_Int32 nTyp)
}
}
- else if (ch == '\r' || ch == '\n')
+ else if (nTyp != 1 && (ch == '\r' || ch == '\n') )
break;
else
{
diff --git a/connectivity/source/resource/conn_shared_res.src b/connectivity/source/resource/conn_shared_res.src
index 65bced9629..ea3fb4e065 100644
--- a/connectivity/source/resource/conn_shared_res.src
+++ b/connectivity/source/resource/conn_shared_res.src
@@ -407,7 +407,7 @@ String STR_COULD_NOT_CREATE_INDEX_NAME
};
String STR_COULD_NOT_CREATE_INDEX_KEYSIZE
{
- Text [ en-US ] = "The index could not be created. The size of the choosen column is to big.";
+ Text [ en-US ] = "The index could not be created. The size of the chosen column is to big.";
};
String STR_SQL_NAME_ERROR
diff --git a/formula/source/ui/dlg/formula.cxx b/formula/source/ui/dlg/formula.cxx
index f8869986a4..897f53b59b 100644
--- a/formula/source/ui/dlg/formula.cxx
+++ b/formula/source/ui/dlg/formula.cxx
@@ -1605,6 +1605,7 @@ void FormulaDlg_Impl::Update()
{
FormEditData* pData = m_pHelper->getFormEditData();
const String sExpression = pMEdit->GetText();
+ aOldFormula = String();
UpdateTokenArray(sExpression);
FormulaCursorHdl(&aMEFormula);
CalcStruct(sExpression);
diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx
index dcfa8a1247..2cc7b52d25 100644
--- a/sfx2/source/dialog/templdlg.cxx
+++ b/sfx2/source/dialog/templdlg.cxx
@@ -102,8 +102,8 @@ using namespace ::com::sun::star::uno;
static USHORT nLastItemId = USHRT_MAX;
-// filter box has maximum 7 entries visible
-#define MAX_FILTER_ENTRIES 7
+// filter box has maximum 12 entries visible
+#define MAX_FILTER_ENTRIES 12
//=========================================================================
@@ -1299,7 +1299,7 @@ void SfxCommonTemplateDialog_Impl::UpdateStyles_Impl(USHORT nFlags) // Flags
if(pTreeBox)
aFilterLb.SelectEntry(String(SfxResId(STR_STYLE_FILTER_HIERARCHICAL)));
- // show maximum seven entries
+ // show maximum 12 entries
aFilterLb.SetDropDownLineCount( MAX_FILTER_ENTRIES );
aFilterLb.SetUpdateMode(TRUE);
}