Tag: cws_src680_qiq User: fs Date: 2006/06/27 13:14:14 Modified: dba/connectivity/qa/connectivity/tools/HsqlDatabase.java
Log: allow table creation via SDBCX means File Changes: Directory: /dba/connectivity/qa/connectivity/tools/ =================================================== File [changed]: HsqlDatabase.java Url: http://dba.openoffice.org/source/browse/dba/connectivity/qa/connectivity/tools/HsqlDatabase.java?r1=1.2.54.2&r2=1.2.54.3 Delta lines: +28 -9 -------------------- --- HsqlDatabase.java 26 Jun 2006 21:05:42 -0000 1.2.54.2 +++ HsqlDatabase.java 27 Jun 2006 20:14:11 -0000 1.2.54.3 @@ -4,9 +4,9 @@ * * $RCSfile: HsqlDatabase.java,v $ * - * $Revision: 1.2.54.2 $ + * $Revision: 1.2.54.3 $ * - * last change: $Author: fs $ $Date: 2006/06/26 21:05:42 $ + * last change: $Author: fs $ $Date: 2006/06/27 20:14:11 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -35,14 +35,21 @@ 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.frame.XStorable; +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 java.io.File; -import com.sun.star.uno.UnoRuntime; -import com.sun.star.sdb.*; -import com.sun.star.sdbc.*; -import com.sun.star.lang.*; -import com.sun.star.beans.*; -import com.sun.star.frame.*; import com.sun.star.util.CloseVetoException; /** @@ -117,7 +124,7 @@ public void close() { // close connection - com.sun.star.sdbc.XCloseable closeConn = (com.sun.star.sdbc.XCloseable)UnoRuntime.queryInterface( XCloseable.class, + XCloseable closeConn = (XCloseable)UnoRuntime.queryInterface( XCloseable.class, m_connection ); if ( closeConn != null ) { @@ -229,6 +236,18 @@ createStatement += ")"; executeSQL( createStatement ); + } + + /** 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 --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
