From 0be6537b8572f502f519d7068f42a9f274c341ac Mon Sep 17 00:00:00 2001 From: Vasiliy Yashkov Date: Mon, 29 Oct 2018 17:35:56 +0300 Subject: [PATCH 01/12] Native OO API implementations New OO API interfaces implementations and tests for them. Classes are in a separate package org.firebirdsql.nativeoo.gds.ng by analogy with existing JNA implementations. Some batch interfaces (FbBatch, etc.) have been added to the wire layer and can be used for wire implementations. Connection through new interfaces is carried out through its own protocols: jdbc:firebirdsql:fboo: [embedded:|locale:|native:]. Interface FbInterface extends FbClientLibrary, while the library has only the definition of the interface IMaster. FbInterface was generated by modified cloop. --- .classpath | 2 + build/archive.xml | 3 + build/compile.xml | 2 + build/dist.xml | 1 + build/init.xml | 2 + .../ng/jna/AbstractNativeDatabaseFactory.java | 9 +- .../firebirdsql/gds/ng/jna/JnaDatabase.java | 15 + .../jna/fbclient/CryptoObjectInfo.java | 8 + .../firebirdsql/jna/fbclient/FB_DEC16.java | 41 + .../firebirdsql/jna/fbclient/FB_DEC34.java | 37 + .../jna/fbclient/FbClientLibrary.java | 7 + .../firebirdsql/jna/fbclient/ISC_DATE.java | 17 + .../firebirdsql/jna/fbclient/ISC_QUAD.java | 4 + .../firebirdsql/jna/fbclient/ISC_TIME.java | 17 + .../firebirdsql/gds/ng/jna/TestJnaBlob.java | 2 +- .../gds/ng/jna/TestJnaDatabase.java | 22 +- .../firebirdsql/gds/ng/jna/TestJnaEvents.java | 6 +- .../gds/ng/jna/TestJnaService.java | 10 +- .../firebirdsql/gds/BatchParameterBuffer.java | 171 + .../gds/impl/BatchParameterBufferImpl.java | 54 + .../org/firebirdsql/gds/impl/GDSFactory.java | 3 + .../FbOOEmbeddedGDSFactoryPlugin.java | 45 + .../nativeoo/FbOOLocalGDSFactoryPlugin.java | 44 + .../nativeoo/FbOONativeGDSFactoryPlugin.java | 56 + .../firebirdsql/gds/ng/AbstractFbBatch.java | 86 + .../gds/ng/AbstractFbMessageBuilder.java | 445 + src/main/org/firebirdsql/gds/ng/FbBatch.java | 98 + .../gds/ng/FbBatchCompletionState.java | 23 + .../org/firebirdsql/gds/ng/FbDatabase.java | 40 +- .../firebirdsql/gds/ng/FbMessageBuilder.java | 65 + .../firebirdsql/gds/ng/FbMessageMetadata.java | 44 + .../firebirdsql/gds/ng/FbMetadataBuilder.java | 57 + .../gds/ng/SeekableByteArrayOutputStream.java | 137 + .../gds/ng/wire/version10/V10Database.java | 18 + .../nativeoo/gds/ng/TestIBatchImpl.java | 1326 ++ .../nativeoo/gds/ng/TestIBlobImpl.java | 449 + .../nativeoo/gds/ng/TestIDatabaseImpl.java | 304 + .../nativeoo/gds/ng/TestIEventBlockImpl.java | 163 + .../gds/ng/TestIServiceConnectionImpl.java | 60 + .../nativeoo/gds/ng/TestIServiceImpl.java | 170 + .../nativeoo/gds/ng/TestIStatementImpl.java | 273 + .../nativeoo/gds/ng/TestITransactionImpl.java | 37 + .../gds/ng/TestNativeDatabaseConnection.java | 61 + .../gds/ng/AbstractNativeConnection.java | 87 + .../ng/AbstractNativeOODatabaseFactory.java | 39 + .../nativeoo/gds/ng/CloseableMemory.java | 21 + .../nativeoo/gds/ng/FbException.java | 131 + .../nativeoo/gds/ng/FbInterface.java | 19473 ++++++++++++++++ .../nativeoo/gds/ng/FbInterfaceImpl.java | 9 + .../gds/ng/FbOOClientDatabaseFactory.java | 37 + .../gds/ng/FbOOEmbeddedDatabaseFactory.java | 74 + .../gds/ng/FbOOLocalDatabaseFactory.java | 26 + .../gds/ng/IBatchCompletionStateImpl.java | 112 + .../nativeoo/gds/ng/IBatchImpl.java | 160 + .../nativeoo/gds/ng/IBlobImpl.java | 237 + .../nativeoo/gds/ng/IDatabaseImpl.java | 419 + .../nativeoo/gds/ng/IEventBlockImpl.java | 134 + .../nativeoo/gds/ng/IMessageBuilderImpl.java | 20 + .../nativeoo/gds/ng/IMessageMetadataImpl.java | 101 + .../nativeoo/gds/ng/IMetadataBuilderImpl.java | 197 + .../gds/ng/IParameterConverterImpl.java | 33 + .../gds/ng/IServiceConnectionImpl.java | 55 + .../nativeoo/gds/ng/IServiceImpl.java | 187 + .../nativeoo/gds/ng/IStatementImpl.java | 359 + .../nativeoo/gds/ng/ITransactionImpl.java | 135 + .../gds/ng/NativeDatabaseConnection.java | 45 + .../org.firebirdsql.gds.impl.GDSFactoryPlugin | 3 + .../firebirdsql/common/FBTestProperties.java | 3 + .../common/matchers/GdsTypeMatchers.java | 15 +- .../firebirdsql/common/rules/GdsTypeRule.java | 13 +- .../gds/impl/jni/TestEmbeddedServicesAPI.java | 11 + .../impl/jni/TestFbOOEmbeddedServicesAPI.java | 12 + .../impl/jni/TestFbOOLocalServicesAPI.java | 12 + .../impl/jni/TestFbOONativeServicesAPI.java | 13 + .../jni/TestJaybirdBlobBackupProblem.java | 4 +- .../gds/impl/jni/TestLocalServicesAPI.java | 11 + .../gds/impl/jni/TestNativeServicesAPI.java | 12 + .../gds/impl/jni/TestServicesAPI.java | 26 +- .../TestSpecialFbOOEmbeddedServerUrls.java | 119 + .../firebirdsql/gds/ng/AbstractBatchTest.java | 280 + .../ng/wire/version10/TestV10Database.java | 3 +- .../firebirdsql/jdbc/JDBCUrlPrefixTest.java | 15 +- .../management/TestUserManager.java | 4 +- 83 files changed, 27019 insertions(+), 62 deletions(-) create mode 100644 src/jna-client/org/firebirdsql/jna/fbclient/CryptoObjectInfo.java create mode 100644 src/jna-client/org/firebirdsql/jna/fbclient/FB_DEC16.java create mode 100644 src/jna-client/org/firebirdsql/jna/fbclient/FB_DEC34.java create mode 100644 src/jna-client/org/firebirdsql/jna/fbclient/ISC_DATE.java create mode 100644 src/jna-client/org/firebirdsql/jna/fbclient/ISC_QUAD.java create mode 100644 src/jna-client/org/firebirdsql/jna/fbclient/ISC_TIME.java create mode 100644 src/main/org/firebirdsql/gds/BatchParameterBuffer.java create mode 100644 src/main/org/firebirdsql/gds/impl/BatchParameterBufferImpl.java create mode 100644 src/main/org/firebirdsql/gds/impl/nativeoo/FbOOEmbeddedGDSFactoryPlugin.java create mode 100644 src/main/org/firebirdsql/gds/impl/nativeoo/FbOOLocalGDSFactoryPlugin.java create mode 100644 src/main/org/firebirdsql/gds/impl/nativeoo/FbOONativeGDSFactoryPlugin.java create mode 100644 src/main/org/firebirdsql/gds/ng/AbstractFbBatch.java create mode 100644 src/main/org/firebirdsql/gds/ng/AbstractFbMessageBuilder.java create mode 100644 src/main/org/firebirdsql/gds/ng/FbBatch.java create mode 100644 src/main/org/firebirdsql/gds/ng/FbBatchCompletionState.java create mode 100644 src/main/org/firebirdsql/gds/ng/FbMessageBuilder.java create mode 100644 src/main/org/firebirdsql/gds/ng/FbMessageMetadata.java create mode 100644 src/main/org/firebirdsql/gds/ng/FbMetadataBuilder.java create mode 100644 src/main/org/firebirdsql/gds/ng/SeekableByteArrayOutputStream.java create mode 100644 src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/TestIBatchImpl.java create mode 100644 src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/TestIBlobImpl.java create mode 100644 src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/TestIDatabaseImpl.java create mode 100644 src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/TestIEventBlockImpl.java create mode 100644 src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/TestIServiceConnectionImpl.java create mode 100644 src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/TestIServiceImpl.java create mode 100644 src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/TestIStatementImpl.java create mode 100644 src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/TestITransactionImpl.java create mode 100644 src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/TestNativeDatabaseConnection.java create mode 100644 src/nativeoo/org/firebirdsql/nativeoo/gds/ng/AbstractNativeConnection.java create mode 100644 src/nativeoo/org/firebirdsql/nativeoo/gds/ng/AbstractNativeOODatabaseFactory.java create mode 100644 src/nativeoo/org/firebirdsql/nativeoo/gds/ng/CloseableMemory.java create mode 100644 src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbException.java create mode 100644 src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbInterface.java create mode 100644 src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbInterfaceImpl.java create mode 100644 src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbOOClientDatabaseFactory.java create mode 100644 src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbOOEmbeddedDatabaseFactory.java create mode 100644 src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbOOLocalDatabaseFactory.java create mode 100644 src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IBatchCompletionStateImpl.java create mode 100644 src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IBatchImpl.java create mode 100644 src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IBlobImpl.java create mode 100644 src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IDatabaseImpl.java create mode 100644 src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IEventBlockImpl.java create mode 100644 src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IMessageBuilderImpl.java create mode 100644 src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IMessageMetadataImpl.java create mode 100644 src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IMetadataBuilderImpl.java create mode 100644 src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IParameterConverterImpl.java create mode 100644 src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IServiceConnectionImpl.java create mode 100644 src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IServiceImpl.java create mode 100644 src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IStatementImpl.java create mode 100644 src/nativeoo/org/firebirdsql/nativeoo/gds/ng/ITransactionImpl.java create mode 100644 src/nativeoo/org/firebirdsql/nativeoo/gds/ng/NativeDatabaseConnection.java create mode 100644 src/test/org/firebirdsql/gds/impl/jni/TestEmbeddedServicesAPI.java create mode 100644 src/test/org/firebirdsql/gds/impl/jni/TestFbOOEmbeddedServicesAPI.java create mode 100644 src/test/org/firebirdsql/gds/impl/jni/TestFbOOLocalServicesAPI.java create mode 100644 src/test/org/firebirdsql/gds/impl/jni/TestFbOONativeServicesAPI.java create mode 100644 src/test/org/firebirdsql/gds/impl/jni/TestLocalServicesAPI.java create mode 100644 src/test/org/firebirdsql/gds/impl/jni/TestNativeServicesAPI.java create mode 100644 src/test/org/firebirdsql/gds/impl/jni/TestSpecialFbOOEmbeddedServerUrls.java create mode 100644 src/test/org/firebirdsql/gds/ng/AbstractBatchTest.java diff --git a/.classpath b/.classpath index 677c49d34d..242e282dd6 100644 --- a/.classpath +++ b/.classpath @@ -7,6 +7,8 @@ + + diff --git a/build/archive.xml b/build/archive.xml index e11842da36..36ffa23d2d 100644 --- a/build/archive.xml +++ b/build/archive.xml @@ -76,6 +76,9 @@ + + + diff --git a/build/compile.xml b/build/compile.xml index ef9357f88d..fb9632f3f3 100644 --- a/build/compile.xml +++ b/build/compile.xml @@ -55,6 +55,7 @@ + @@ -87,6 +88,7 @@ + diff --git a/build/dist.xml b/build/dist.xml index 90b0442acd..a51c9286a4 100644 --- a/build/dist.xml +++ b/build/dist.xml @@ -19,6 +19,7 @@ + diff --git a/build/init.xml b/build/init.xml index c1d3985d9d..471d5ba925 100644 --- a/build/init.xml +++ b/build/init.xml @@ -116,12 +116,14 @@ + + diff --git a/src/jna-client/org/firebirdsql/gds/ng/jna/AbstractNativeDatabaseFactory.java b/src/jna-client/org/firebirdsql/gds/ng/jna/AbstractNativeDatabaseFactory.java index 63bae8411e..a97d97616c 100644 --- a/src/jna-client/org/firebirdsql/gds/ng/jna/AbstractNativeDatabaseFactory.java +++ b/src/jna-client/org/firebirdsql/gds/ng/jna/AbstractNativeDatabaseFactory.java @@ -18,10 +18,7 @@ */ package org.firebirdsql.gds.ng.jna; -import org.firebirdsql.gds.ng.FbDatabaseFactory; -import org.firebirdsql.gds.ng.IAttachProperties; -import org.firebirdsql.gds.ng.IConnectionProperties; -import org.firebirdsql.gds.ng.IServiceProperties; +import org.firebirdsql.gds.ng.*; import org.firebirdsql.jna.fbclient.FbClientLibrary; import java.sql.SQLException; @@ -35,14 +32,14 @@ public abstract class AbstractNativeDatabaseFactory implements FbDatabaseFactory { @Override - public JnaDatabase connect(IConnectionProperties connectionProperties) throws SQLException { + public FbDatabase connect(IConnectionProperties connectionProperties) throws SQLException { final JnaDatabaseConnection jnaDatabaseConnection = new JnaDatabaseConnection(getClientLibrary(), filterProperties(connectionProperties)); return jnaDatabaseConnection.identify(); } @Override - public JnaService serviceConnect(IServiceProperties serviceProperties) throws SQLException { + public FbService serviceConnect(IServiceProperties serviceProperties) throws SQLException { final JnaServiceConnection jnaServiceConnection = new JnaServiceConnection(getClientLibrary(), filterProperties(serviceProperties)); return jnaServiceConnection.identify(); diff --git a/src/jna-client/org/firebirdsql/gds/ng/jna/JnaDatabase.java b/src/jna-client/org/firebirdsql/gds/ng/jna/JnaDatabase.java index b177430e3c..5c0d7c0baf 100644 --- a/src/jna-client/org/firebirdsql/gds/ng/jna/JnaDatabase.java +++ b/src/jna-client/org/firebirdsql/gds/ng/jna/JnaDatabase.java @@ -471,6 +471,21 @@ public void cancelEvent(EventHandle eventHandle) throws SQLException { } } + @Override + public FbBatch createBatch(FbTransaction transaction, String statement, FbMessageMetadata metadata, BatchParameterBuffer parameters) throws SQLException { + throw new SQLException("Not implemented"); + } + + @Override + public FbBatch createBatch(FbTransaction transaction, String statement, BatchParameterBuffer parameters) throws SQLException { + throw new SQLException("Not implemented"); + } + + @Override + public FbMetadataBuilder getMetadataBuilder(int fieldCount) throws SQLException { + throw new SQLException("Not implemented"); + } + private void processStatusVector() throws SQLException { processStatusVector(statusVector, getDatabaseWarningCallback()); } diff --git a/src/jna-client/org/firebirdsql/jna/fbclient/CryptoObjectInfo.java b/src/jna-client/org/firebirdsql/jna/fbclient/CryptoObjectInfo.java new file mode 100644 index 0000000000..ae8638b91b --- /dev/null +++ b/src/jna-client/org/firebirdsql/jna/fbclient/CryptoObjectInfo.java @@ -0,0 +1,8 @@ +package org.firebirdsql.jna.fbclient; + +/** + * @author Vasiliy Yashkov + * @since 4.0 + */ +public class CryptoObjectInfo { +} diff --git a/src/jna-client/org/firebirdsql/jna/fbclient/FB_DEC16.java b/src/jna-client/org/firebirdsql/jna/fbclient/FB_DEC16.java new file mode 100644 index 0000000000..8d003cd3cd --- /dev/null +++ b/src/jna-client/org/firebirdsql/jna/fbclient/FB_DEC16.java @@ -0,0 +1,41 @@ +package org.firebirdsql.jna.fbclient; + +import com.sun.jna.Pointer; +import com.sun.jna.Structure; +import java.util.Arrays; +import java.util.List; + +/** + * This file was autogenerated by JNAerator,
+ * a tool written by Olivier Chafik that uses a few opensource projects..
+ * For help, please visit NativeLibs4Java , Rococoa, or JNA. + * @since 4.0 + */ +public class FB_DEC16 extends Structure { + + public long[] fb_data = new long[1]; + public FB_DEC16() { + super(); + } + + protected List getFieldOrder() { + return Arrays.asList("fb_data"); + } + public FB_DEC16(long fb_data[]) { + super(); + if ((fb_data.length != this.fb_data.length)) + throw new IllegalArgumentException("Wrong array size !"); + this.fb_data = fb_data; + } + + public FB_DEC16(Pointer peer) { + super(peer); + } + + public static class ByReference extends FB_DEC16 implements Structure.ByReference { + + }; + public static class ByValue extends FB_DEC16 implements Structure.ByValue { + + }; +} diff --git a/src/jna-client/org/firebirdsql/jna/fbclient/FB_DEC34.java b/src/jna-client/org/firebirdsql/jna/fbclient/FB_DEC34.java new file mode 100644 index 0000000000..2c40e9098d --- /dev/null +++ b/src/jna-client/org/firebirdsql/jna/fbclient/FB_DEC34.java @@ -0,0 +1,37 @@ +package org.firebirdsql.jna.fbclient; + +import com.sun.jna.Pointer; +import com.sun.jna.Structure; +import java.util.Arrays; +import java.util.List; + +/** + * This file was autogenerated by JNAerator,
+ * a tool written by Olivier Chafik that uses a few opensource projects..
+ * For help, please visit NativeLibs4Java , Rococoa, or JNA. + * @since 4.0 + */ +public class FB_DEC34 extends Structure { + public long[] fb_data = new long[2]; + public FB_DEC34() { + super(); + } + protected List getFieldOrder() { + return Arrays.asList("fb_data"); + } + public FB_DEC34(long fb_data[]) { + super(); + if ((fb_data.length != this.fb_data.length)) + throw new IllegalArgumentException("Wrong array size !"); + this.fb_data = fb_data; + } + public FB_DEC34(Pointer peer) { + super(peer); + } + public static class ByReference extends FB_DEC34 implements Structure.ByReference { + + }; + public static class ByValue extends FB_DEC34 implements Structure.ByValue { + + }; +} diff --git a/src/jna-client/org/firebirdsql/jna/fbclient/FbClientLibrary.java b/src/jna-client/org/firebirdsql/jna/fbclient/FbClientLibrary.java index d9589ae1f0..fa8aa85029 100644 --- a/src/jna-client/org/firebirdsql/jna/fbclient/FbClientLibrary.java +++ b/src/jna-client/org/firebirdsql/jna/fbclient/FbClientLibrary.java @@ -26,6 +26,7 @@ import com.sun.jna.ptr.LongByReference; import com.sun.jna.ptr.PointerByReference; import com.sun.jna.ptr.ShortByReference; +import org.firebirdsql.nativeoo.gds.ng.FbInterface; import java.nio.ByteBuffer; import java.nio.IntBuffer; @@ -752,4 +753,10 @@ ISC_STATUS fb_shutdown_callback(ISC_STATUS[] statusVector, FbShutdownCallback FB * native declaration : C:\Program Files\Firebird\Firebird_2_5\include\ibase.h:1306 */ int isc_get_client_minor_version(); + + /** + * Original signature : extern "C" IMaster* ISC_EXPORT fb_get_master_interface();
+ * native declaration : firebird/include/firebird/interface.h:364 + */ + FbInterface.IMaster fb_get_master_interface(); } diff --git a/src/jna-client/org/firebirdsql/jna/fbclient/ISC_DATE.java b/src/jna-client/org/firebirdsql/jna/fbclient/ISC_DATE.java new file mode 100644 index 0000000000..b5dbc160ff --- /dev/null +++ b/src/jna-client/org/firebirdsql/jna/fbclient/ISC_DATE.java @@ -0,0 +1,17 @@ +package org.firebirdsql.jna.fbclient; + +import com.sun.jna.Structure; + +import java.util.Arrays; +import java.util.List; + +public class ISC_DATE extends Structure implements Structure.ByValue +{ + public int value; + + @Override + protected List getFieldOrder() + { + return Arrays.asList("value"); + } +} diff --git a/src/jna-client/org/firebirdsql/jna/fbclient/ISC_QUAD.java b/src/jna-client/org/firebirdsql/jna/fbclient/ISC_QUAD.java new file mode 100644 index 0000000000..41f28ebc48 --- /dev/null +++ b/src/jna-client/org/firebirdsql/jna/fbclient/ISC_QUAD.java @@ -0,0 +1,4 @@ +package org.firebirdsql.jna.fbclient; + +public class ISC_QUAD extends GDS_QUAD_t { +} diff --git a/src/jna-client/org/firebirdsql/jna/fbclient/ISC_TIME.java b/src/jna-client/org/firebirdsql/jna/fbclient/ISC_TIME.java new file mode 100644 index 0000000000..61b2f3a2c9 --- /dev/null +++ b/src/jna-client/org/firebirdsql/jna/fbclient/ISC_TIME.java @@ -0,0 +1,17 @@ +package org.firebirdsql.jna.fbclient; + +import com.sun.jna.Structure; + +import java.util.Arrays; +import java.util.List; + +public class ISC_TIME extends Structure implements Structure.ByValue +{ + public int value; + + @Override + protected List getFieldOrder() + { + return Arrays.asList("value"); + } +} diff --git a/src/jna-test/org/firebirdsql/gds/ng/jna/TestJnaBlob.java b/src/jna-test/org/firebirdsql/gds/ng/jna/TestJnaBlob.java index 8f4f68e76d..44e9a86f12 100644 --- a/src/jna-test/org/firebirdsql/gds/ng/jna/TestJnaBlob.java +++ b/src/jna-test/org/firebirdsql/gds/ng/jna/TestJnaBlob.java @@ -437,7 +437,7 @@ public void testOutputBlobDoubleOpen() throws Exception { @Override protected JnaDatabase createFbDatabase(FbConnectionProperties connectionInfo) throws SQLException { - final JnaDatabase db = factory.connect(connectionInfo); + final JnaDatabase db = (JnaDatabase) factory.connect(connectionInfo); db.attach(); return db; } diff --git a/src/jna-test/org/firebirdsql/gds/ng/jna/TestJnaDatabase.java b/src/jna-test/org/firebirdsql/gds/ng/jna/TestJnaDatabase.java index 75d5beaf40..04a9b36974 100644 --- a/src/jna-test/org/firebirdsql/gds/ng/jna/TestJnaDatabase.java +++ b/src/jna-test/org/firebirdsql/gds/ng/jna/TestJnaDatabase.java @@ -84,7 +84,7 @@ public class TestJnaDatabase { public void testBasicAttach() throws Exception { FBManager fbManager = createFBManager(); defaultDatabaseSetUp(fbManager); - try (JnaDatabase db = factory.connect(connectionInfo)) { + try (JnaDatabase db = (JnaDatabase) factory.connect(connectionInfo)) { db.attach(); assertTrue("Expected isAttached() to return true", db.isAttached()); @@ -104,7 +104,7 @@ public void doubleAttach() throws Exception { FBManager fbManager = createFBManager(); defaultDatabaseSetUp(fbManager); - try (JnaDatabase db = factory.connect(connectionInfo)) { + try (JnaDatabase db = (JnaDatabase) factory.connect(connectionInfo)) { db.attach(); //Second attach should throw exception @@ -120,7 +120,7 @@ public void basicStatusVectorProcessing_wrongLogin() throws Exception { FBTestProperties.GDS_TYPE, not(isEmbeddedType())); // set invalid password connectionInfo.setPassword("abcd"); - try (JnaDatabase db = factory.connect(connectionInfo)) { + try (JnaDatabase db = (JnaDatabase) factory.connect(connectionInfo)) { expectedException.expect(allOf( isA(SQLException.class), @@ -137,7 +137,7 @@ public void testBasicStatusVectorProcessing_wrongDatabase() throws Exception { // set invalid database final String invalidDatabaseName = FBTestProperties.getDatabasePath() + "doesnotexist"; connectionInfo.setDatabaseName(invalidDatabaseName); - try (JnaDatabase db = factory.connect(connectionInfo)) { + try (JnaDatabase db = (JnaDatabase) factory.connect(connectionInfo)) { expectedException.expect(allOf( isA(SQLException.class), @@ -166,7 +166,7 @@ public void testBasicStatusVectorProcessing_wrongDatabase() throws Exception { public void testBasicCreateAndDrop() throws Exception { connectionInfo.getExtraDatabaseParameters() .addArgument(ISCConstants.isc_dpb_sql_dialect, 3); - JnaDatabase db = factory.connect(connectionInfo); + JnaDatabase db = (JnaDatabase) factory.connect(connectionInfo); File dbFile = new File(connectionInfo.getDatabaseName()); try { db.createDatabase(); @@ -194,7 +194,7 @@ public void testDrop_NotAttached() throws Exception { FBManager fbManager = createFBManager(); defaultDatabaseSetUp(fbManager); try { - JnaDatabase db = factory.connect(connectionInfo); + JnaDatabase db = (JnaDatabase) factory.connect(connectionInfo); db.dropDatabase(); } finally { defaultDatabaseTearDown(fbManager); @@ -203,7 +203,7 @@ public void testDrop_NotAttached() throws Exception { @Test public void testDetach_NotConnected() throws Exception { - JnaDatabase db = factory.connect(connectionInfo); + JnaDatabase db = (JnaDatabase) factory.connect(connectionInfo); // Note: the error is different from the one in the pure java implementation as we cannot discern between // not connected and not attached @@ -219,7 +219,7 @@ public void testBasicDetach() throws Exception { FBManager fbManager = createFBManager(); defaultDatabaseSetUp(fbManager); try { - JnaDatabase db = factory.connect(connectionInfo); + JnaDatabase db = (JnaDatabase) factory.connect(connectionInfo); try { db.attach(); @@ -240,7 +240,7 @@ public void testDetach_openTransactions() throws Exception { defaultDatabaseSetUp(fbManager); try { - JnaDatabase db = factory.connect(connectionInfo); + JnaDatabase db = (JnaDatabase) factory.connect(connectionInfo); FbTransaction transaction = null; try { db.attach(); @@ -274,7 +274,7 @@ FBTestProperties.GDS_TYPE, not( FBManager fbManager = createFBManager(); defaultDatabaseSetUp(fbManager); try { - JnaDatabase db = factory.connect(connectionInfo); + JnaDatabase db = (JnaDatabase) factory.connect(connectionInfo); try { db.attach(); assumeTrue("expected database attached", db.isAttached()); @@ -293,7 +293,7 @@ FBTestProperties.GDS_TYPE, not( @Test public void testExecuteImmediate_createDatabase() throws Exception { - JnaDatabase db = factory.connect(connectionInfo); + JnaDatabase db = (JnaDatabase) factory.connect(connectionInfo); try { String createDb = String.format("CREATE DATABASE '%s' USER '%s' PASSWORD '%s'", getDatabasePath(), DB_USER, DB_PASSWORD); diff --git a/src/jna-test/org/firebirdsql/gds/ng/jna/TestJnaEvents.java b/src/jna-test/org/firebirdsql/gds/ng/jna/TestJnaEvents.java index c2bb12667e..d29f39db3a 100644 --- a/src/jna-test/org/firebirdsql/gds/ng/jna/TestJnaEvents.java +++ b/src/jna-test/org/firebirdsql/gds/ng/jna/TestJnaEvents.java @@ -95,7 +95,7 @@ public final void tearDown() throws Exception { @Test public void testCreateEventHandle() throws Exception { - db = factory.connect(connectionInfo); + db = (JnaDatabase) factory.connect(connectionInfo); db.attach(); JnaEventHandle eventHandle = db.createEventHandle("TEST_EVENT", new EventHandler() { @@ -109,7 +109,7 @@ public void eventOccurred(EventHandle eventHandle) { @Test public void testQueueEvent_andNotification() throws Exception { - db = factory.connect(connectionInfo); + db = (JnaDatabase) factory.connect(connectionInfo); db.attach(); FbTransaction transaction = getTransaction(db); @@ -176,7 +176,7 @@ public void testQueueEvent_andNotification() throws Exception { @Test public void cancelAfterCallback_directJNA() throws Exception { - db = factory.connect(connectionInfo); + db = (JnaDatabase) factory.connect(connectionInfo); db.attach(); FbClientLibrary lib = db.getClientLibrary(); diff --git a/src/jna-test/org/firebirdsql/gds/ng/jna/TestJnaService.java b/src/jna-test/org/firebirdsql/gds/ng/jna/TestJnaService.java index 113849a4e0..bd68d3fb5d 100644 --- a/src/jna-test/org/firebirdsql/gds/ng/jna/TestJnaService.java +++ b/src/jna-test/org/firebirdsql/gds/ng/jna/TestJnaService.java @@ -72,7 +72,7 @@ public class TestJnaService { @Test public void testBasicAttach() throws Exception { - try (JnaService service = factory.serviceConnect(connectionInfo)) { + try (JnaService service = (JnaService)factory.serviceConnect(connectionInfo)) { service.attach(); assertTrue("Expected isAttached() to return true", service.isAttached()); @@ -87,7 +87,7 @@ public void doubleAttach() throws Exception { expectedException.expect(SQLException.class); expectedException.expectMessage(equalTo("Already attached to a service")); - try (JnaService service = factory.serviceConnect(connectionInfo)) { + try (JnaService service = (JnaService)factory.serviceConnect(connectionInfo)) { service.attach(); //Second attach should throw exception @@ -101,7 +101,7 @@ public void basicStatusVectorProcessing_wrongLogin() throws Exception { FBTestProperties.GDS_TYPE, not(isEmbeddedType())); // set invalid password connectionInfo.setPassword("abcd"); - try (JnaService service = factory.serviceConnect(connectionInfo)) { + try (JnaService service = (JnaService)factory.serviceConnect(connectionInfo)) { expectedException.expect(allOf( isA(SQLException.class), @@ -118,7 +118,7 @@ public void testBasicStatusVectorProcessing_wrongService() throws Exception { // set invalid database final String invalidServiceName = "doesnotexist"; connectionInfo.setServiceName(invalidServiceName); - try (JnaService service = factory.serviceConnect(connectionInfo)) { + try (JnaService service = (JnaService)factory.serviceConnect(connectionInfo)) { expectedException.expect(allOf( isA(SQLException.class), @@ -139,7 +139,7 @@ public void testBasicStatusVectorProcessing_wrongService() throws Exception { public void testStartServiceAction() throws Exception { FBManager fbManager = createFBManager(); defaultDatabaseSetUp(fbManager); - try (JnaService service = factory.serviceConnect(connectionInfo)) { + try (JnaService service = (JnaService)factory.serviceConnect(connectionInfo)) { service.attach(); ServiceRequestBuffer actionSrb = service.createServiceRequestBuffer(); diff --git a/src/main/org/firebirdsql/gds/BatchParameterBuffer.java b/src/main/org/firebirdsql/gds/BatchParameterBuffer.java new file mode 100644 index 0000000000..1594febfbb --- /dev/null +++ b/src/main/org/firebirdsql/gds/BatchParameterBuffer.java @@ -0,0 +1,171 @@ +package org.firebirdsql.gds; + +import org.firebirdsql.encodings.Encoding; +import org.firebirdsql.gds.impl.wire.Xdrable; + +import java.io.IOException; +import java.io.OutputStream; +import java.util.Iterator; + +/** + * + * @author Vasiliy Yashkov + * @since 4.0 + */ +public interface BatchParameterBuffer extends ParameterBuffer { + + /** + * @return The parameter buffer type identifier + */ + int getType(); + + /** + * Add argument with no parameters. + * + * @param argumentType + * type of argument. + */ + void addArgument(int argumentType); + + /** + * Add string argument with the default encoding. + * + * @param argumentType + * type of argument. + * @param value + * string value to add. + */ + void addArgument(int argumentType, String value); + + /** + * Add string argument. + * + * @param argumentType + * type of argument. + * @param value + * string value to add. + * @param encoding + * encoding to use for conversion to bytes + */ + void addArgument(int argumentType, String value, Encoding encoding); + + /** + * Add integer argument. + * + * @param argumentType + * type of argument. + * @param value + * integer value to add. + */ + void addArgument(int argumentType, int value); + + /** + * Add long argument. + * + * @param argumentType + * type of argument. + * @param value + * long value to add. + */ + void addArgument(int argumentType, long value); + + /** + * Add array of bytes. + * + * @param argumentType + * type of argument. + * @param content + * content of argument. + */ + void addArgument(int argumentType, byte[] content); + + /** + * Remove specified argument. + * + * @param argumentType + * type of argument to remove. + */ + void removeArgument(int argumentType); + + /** + * Get argument as string. + * + * @param argumentType + * type of argument to find. + * @return argument as string or null if nothing found. + */ + String getArgumentAsString(int argumentType); + + /** + * Get argument as int. + * + * @param argumentType + * type of argument to find. + * @return argument as string or 0 if nothing found. + */ + int getArgumentAsInt(int argumentType); + + /** + * Check if this parameter buffer has specified argument. + * + * @param argumentType + * type of argument to find. + * @return true if this buffer contains specified argument. + */ + boolean hasArgument(int argumentType); + + /** + * Returns an iterator over a copy of the parameters in this parameter buffer. + *

+ * It is safe to iterate over this iterator while modifying the parameter buffer. Changes will not be reflected in + * the iterator. + *

+ * + * @return Iterator over the parameters in this parameter buffer. + */ + @Override + Iterator iterator(); + + /** + * Writes the arguments in the implementation specific serialization into the {@code OutputStream}. + * + * @param outputStream + * The {@code OutputStream} to write to + * @throws IOException + * Errors produced by the output stream during writes + */ + void writeArgumentsTo(OutputStream outputStream) throws IOException; + + /** + * @return {@code Xdrable} to write (and optionally read) this instance as Xdr. + */ + Xdrable toXdrable(); + + /** + * Converts this parameter buffer to a byte array. + *

+ * This byte array includes the extra header-bytes (if any), but does not include the type information + *

+ * + * @return Byte array with serialization of this parameter buffer + * @see #toBytesWithType() + */ + byte[] toBytes(); + + /** + * Converts this parameter buffer to a byte array with type information. + *

+ * This byte array includes the type information and the extra header bytes (if any). + *

+ * + * @return Byte array with serialization of this parameter buffer + * @see #toBytes() + */ + byte[] toBytesWithType(); + + /** + * @return the number of parameters stored. + */ + int size(); + +} diff --git a/src/main/org/firebirdsql/gds/impl/BatchParameterBufferImpl.java b/src/main/org/firebirdsql/gds/impl/BatchParameterBufferImpl.java new file mode 100644 index 0000000000..92326e5713 --- /dev/null +++ b/src/main/org/firebirdsql/gds/impl/BatchParameterBufferImpl.java @@ -0,0 +1,54 @@ +package org.firebirdsql.gds.impl; + +import org.firebirdsql.gds.BatchParameterBuffer; +import org.firebirdsql.gds.ParameterBuffer; +import org.firebirdsql.gds.impl.argument.ArgumentType; +import org.firebirdsql.nativeoo.gds.ng.FbInterface; + +/** + * + * @author Vasiliy Yashkov + * @since 4.0 + */ +public class BatchParameterBufferImpl extends ParameterBufferBase implements BatchParameterBuffer { + + public BatchParameterBufferImpl() { + super(BatchMetaData.BATCH_VERSION_1); + } + + private enum BatchMetaData implements ParameterBufferMetaData { + + BATCH_VERSION_1(FbInterface.IBatch.VERSION1); + + private final int batchVersion; + + BatchMetaData(int batchVersion) { + this.batchVersion = batchVersion; + } + + @Override + public final int getType() { + return batchVersion; + } + + @Override + public final void addPreamble(ParameterBuffer parameterBuffer) { + // Do nothing + } + + @Override + public final ArgumentType getStringArgumentType(int tag) { + return ArgumentType.TraditionalDpb; + } + + @Override + public final ArgumentType getByteArrayArgumentType(int tag) { + return ArgumentType.TraditionalDpb; + } + + @Override + public final ArgumentType getIntegerArgumentType(int tag) { + return ArgumentType.Wide; + } + } +} \ No newline at end of file diff --git a/src/main/org/firebirdsql/gds/impl/GDSFactory.java b/src/main/org/firebirdsql/gds/impl/GDSFactory.java index d8e9cca24a..4f2dd1aad9 100644 --- a/src/main/org/firebirdsql/gds/impl/GDSFactory.java +++ b/src/main/org/firebirdsql/gds/impl/GDSFactory.java @@ -146,6 +146,9 @@ private static void loadPluginsFallback(final ClassLoader classLoader) { "org.firebirdsql.gds.impl.jni.NativeGDSFactoryPlugin", "org.firebirdsql.gds.impl.jni.LocalGDSFactoryPlugin", "org.firebirdsql.gds.impl.jni.EmbeddedGDSFactoryPlugin", + "org.firebirdsql.gds.impl.jni.FbOONativeGDSFactoryPlugin", + "org.firebirdsql.gds.impl.jni.FbOOLocalGDSFactoryPlugin", + "org.firebirdsql.gds.impl.jni.FbOOEmbeddedGDSFactoryPlugin", "org.firebirdsql.gds.impl.oo.OOGDSFactoryPlugin" }; for (String className : pluginClasses) { diff --git a/src/main/org/firebirdsql/gds/impl/nativeoo/FbOOEmbeddedGDSFactoryPlugin.java b/src/main/org/firebirdsql/gds/impl/nativeoo/FbOOEmbeddedGDSFactoryPlugin.java new file mode 100644 index 0000000000..8eec0bdee5 --- /dev/null +++ b/src/main/org/firebirdsql/gds/impl/nativeoo/FbOOEmbeddedGDSFactoryPlugin.java @@ -0,0 +1,45 @@ +package org.firebirdsql.gds.impl.nativeoo; + +import org.firebirdsql.gds.GDSException; +import org.firebirdsql.gds.impl.BaseGDSFactoryPlugin; +import org.firebirdsql.nativeoo.gds.ng.FbOOEmbeddedDatabaseFactory; + +public class FbOOEmbeddedGDSFactoryPlugin extends BaseGDSFactoryPlugin { + + public static final String EMBEDDED_TYPE_NAME = "FBOOEMBEDDED"; + + private static final String[] TYPE_ALIASES = new String[0]; + + private static final String[] JDBC_PROTOCOLS = new String[] { + "jdbc:firebirdsql:fboo:embedded:", "jdbc:firebird:fboo:embedded:" + }; + + public String getPluginName() { + return "GDS implementation for embedded server."; + } + + public String getTypeName() { + return EMBEDDED_TYPE_NAME; + } + + public String[] getTypeAliases() { + return TYPE_ALIASES; + } + + public String[] getSupportedProtocols() { + return JDBC_PROTOCOLS; + } + + public String getDatabasePath(String server, Integer port, String path) throws GDSException { + if (path == null) { + throw new GDSException("Database name/path is required."); + } + + return path; + } + + @Override + public FbOOEmbeddedDatabaseFactory getDatabaseFactory() { + return FbOOEmbeddedDatabaseFactory.getInstance(); + } +} diff --git a/src/main/org/firebirdsql/gds/impl/nativeoo/FbOOLocalGDSFactoryPlugin.java b/src/main/org/firebirdsql/gds/impl/nativeoo/FbOOLocalGDSFactoryPlugin.java new file mode 100644 index 0000000000..4bdb801936 --- /dev/null +++ b/src/main/org/firebirdsql/gds/impl/nativeoo/FbOOLocalGDSFactoryPlugin.java @@ -0,0 +1,44 @@ +package org.firebirdsql.gds.impl.nativeoo; + +import org.firebirdsql.gds.GDSException; +import org.firebirdsql.gds.impl.BaseGDSFactoryPlugin; +import org.firebirdsql.nativeoo.gds.ng.FbOOLocalDatabaseFactory; + +public class FbOOLocalGDSFactoryPlugin extends BaseGDSFactoryPlugin { + + public static final String LOCAL_TYPE_NAME = "FBOOLOCAL"; + + private static final String[] TYPE_ALIASES = new String[0]; + private static final String[] JDBC_PROTOCOLS = new String[] { + "jdbc:firebirdsql:fboo:local:", "jdbc:firebird:fboo:local:" + }; + + public String getPluginName() { + return "JNA-based GDS implementation using IPC communication."; + } + + public String getTypeName() { + return LOCAL_TYPE_NAME; + } + + public String[] getTypeAliases() { + return TYPE_ALIASES; + } + + public String[] getSupportedProtocols() { + return JDBC_PROTOCOLS; + } + + public String getDatabasePath(String server, Integer port, String path) throws GDSException { + if (path == null) { + throw new GDSException("Database name/path is required."); + } + + return path; + } + + @Override + public FbOOLocalDatabaseFactory getDatabaseFactory() { + return FbOOLocalDatabaseFactory.getInstance(); + } +} \ No newline at end of file diff --git a/src/main/org/firebirdsql/gds/impl/nativeoo/FbOONativeGDSFactoryPlugin.java b/src/main/org/firebirdsql/gds/impl/nativeoo/FbOONativeGDSFactoryPlugin.java new file mode 100644 index 0000000000..4870806580 --- /dev/null +++ b/src/main/org/firebirdsql/gds/impl/nativeoo/FbOONativeGDSFactoryPlugin.java @@ -0,0 +1,56 @@ +package org.firebirdsql.gds.impl.nativeoo; + +import org.firebirdsql.gds.GDSException; +import org.firebirdsql.gds.impl.BaseGDSFactoryPlugin; +import org.firebirdsql.nativeoo.gds.ng.FbOOClientDatabaseFactory; + +public class FbOONativeGDSFactoryPlugin extends BaseGDSFactoryPlugin { + + public static final String NATIVE_TYPE_NAME = "FBOONATIVE"; + + private static final String[] TYPE_ALIASES = new String[] { "TYPE2" }; + private static final String[] JDBC_PROTOCOLS = new String[] { + "jdbc:firebirdsql:fboo:native:", "jdbc:firebird:fboo:native:" + }; + + public String getPluginName() { + return "JNA-based GDS implementation."; + } + + public String getTypeName() { + return NATIVE_TYPE_NAME; + } + + public String[] getTypeAliases() { + return TYPE_ALIASES; + } + + public String[] getSupportedProtocols() { + return JDBC_PROTOCOLS; + } + + public String getDatabasePath(String server, Integer port, String path) throws GDSException { + if (server == null) { + throw new GDSException("Server name/address is required for native implementation."); + } + if (path == null) { + throw new GDSException("Database name/path is required."); + } + + StringBuilder sb = new StringBuilder(); + + sb.append(server); + if (port != null) { + sb.append('/').append(port.intValue()); + } + + sb.append(':').append(path); + + return sb.toString(); + } + + @Override + public FbOOClientDatabaseFactory getDatabaseFactory() { + return FbOOClientDatabaseFactory.getInstance(); + } +} diff --git a/src/main/org/firebirdsql/gds/ng/AbstractFbBatch.java b/src/main/org/firebirdsql/gds/ng/AbstractFbBatch.java new file mode 100644 index 0000000000..d46bf8deae --- /dev/null +++ b/src/main/org/firebirdsql/gds/ng/AbstractFbBatch.java @@ -0,0 +1,86 @@ +package org.firebirdsql.gds.ng; + +import org.firebirdsql.gds.BatchParameterBuffer; +import org.firebirdsql.gds.ng.listeners.ExceptionListener; +import org.firebirdsql.gds.ng.listeners.ExceptionListenerDispatcher; +import org.firebirdsql.logging.Logger; +import org.firebirdsql.logging.LoggerFactory; + +/** + * + * @author Vasiliy Yashkov + * @since 4.0 + */ +public abstract class AbstractFbBatch implements FbBatch { + + private static final Logger log = LoggerFactory.getLogger(AbstractFbBatch.class); + + private final Object syncObject; + protected final ExceptionListenerDispatcher exceptionListenerDispatcher = new ExceptionListenerDispatcher(this); + private final BatchParameterBuffer batchParameterBuffer; + private FbTransaction transaction; + private FbDatabase database; + private String statement; + private FbMessageMetadata metadata; + + protected AbstractFbBatch(FbDatabase database, FbTransaction transaction, String statement, FbMessageMetadata metadata, BatchParameterBuffer batchParameterBuffer) { + this.syncObject = database.getSynchronizationObject(); + this.database = database; + this.transaction = transaction; + this.batchParameterBuffer = batchParameterBuffer; + this.statement = statement; + this.metadata = metadata; + } + + protected AbstractFbBatch(FbDatabase database, FbTransaction transaction, String statement, BatchParameterBuffer batchParameterBuffer) { + this.syncObject = database.getSynchronizationObject(); + this.database = database; + this.transaction = transaction; + this.batchParameterBuffer = batchParameterBuffer; + this.statement = statement; + } + + @Override + public void addExceptionListener(ExceptionListener listener) { + exceptionListenerDispatcher.addListener(listener); + } + + @Override + public void removeExceptionListener(ExceptionListener listener) { + exceptionListenerDispatcher.removeListener(listener); + } + + protected final Object getSynchronizationObject() { + return syncObject; + } + + public BatchParameterBuffer getBatchParameterBuffer() { + return batchParameterBuffer; + } + + @Override + public FbTransaction getTransaction() { + return transaction; + } + + public void setTransaction(FbTransaction transaction) { + this.transaction = transaction; + } + + @Override + public FbDatabase getDatabase() { + return database; + } + + public void setDatabase(FbDatabase database) { + this.database = database; + } + + public String getStatement() { + return statement; + } + + public void setStatement(String statement) { + this.statement = statement; + } +} diff --git a/src/main/org/firebirdsql/gds/ng/AbstractFbMessageBuilder.java b/src/main/org/firebirdsql/gds/ng/AbstractFbMessageBuilder.java new file mode 100644 index 0000000000..3783121beb --- /dev/null +++ b/src/main/org/firebirdsql/gds/ng/AbstractFbMessageBuilder.java @@ -0,0 +1,445 @@ +package org.firebirdsql.gds.ng; + +import org.firebirdsql.encodings.EncodingFactory; +import org.firebirdsql.extern.decimal.Decimal128; +import org.firebirdsql.extern.decimal.Decimal64; +import org.firebirdsql.gds.BlobParameterBuffer; +import org.firebirdsql.gds.ng.FbBatch; +import org.firebirdsql.gds.ng.FbMessageBuilder; +import org.firebirdsql.gds.ng.FbMessageMetadata; +import org.firebirdsql.gds.ng.SeekableByteArrayOutputStream; +import org.firebirdsql.gds.ng.jna.LittleEndianDatatypeCoder; + +import java.io.IOException; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.sql.Date; +import java.sql.SQLException; +import java.sql.Time; +import java.sql.Timestamp; + +import static org.firebirdsql.gds.ISCConstants.SQL_INT64; +import static org.firebirdsql.gds.ISCConstants.SQL_LONG; +import static org.firebirdsql.gds.ISCConstants.SQL_SHORT; + +/** + * Common implementation of {@link org.firebirdsql.gds.ng.FbMessageBuilder} to build firebird message + * + * @author Vasiliy Yashkov + * @since 4.0 + */ +public abstract class AbstractFbMessageBuilder implements FbMessageBuilder { + + private FbMessageMetadata metadata; + private ByteBuffer buffer; + private final LittleEndianDatatypeCoder datatypeCoder = new LittleEndianDatatypeCoder(EncodingFactory.createInstance(StandardCharsets.UTF_8)); + private final SeekableByteArrayOutputStream stream = new SeekableByteArrayOutputStream(); + private final SeekableByteArrayOutputStream blobStream = new SeekableByteArrayOutputStream(); + private int messageAlign; + private int messageLength; + private int blobAlign; + private int segmentedBlobSize = 0; + + private int align(int target, int alignment) { + return (((target) + alignment - 1) & ~(alignment - 1)); + } + + protected AbstractFbMessageBuilder(E batch) throws SQLException { + this.metadata = batch.getMetadata(); + this.messageLength = metadata.getMessageLength(); + this.messageAlign = metadata.getAlignedLength(); + this.blobAlign = batch.getBlobAlignment(); + buffer = ByteBuffer.allocate(this.messageLength); + } + + @Override + public void addSmallint(int index, short value) throws SQLException { + int nullOffset = metadata.getNullOffset(index); + int offset = metadata.getOffset(index); + + byte[] bytes = datatypeCoder.encodeShort(value); + byte[] nullShort = datatypeCoder.encodeShort(0); + + buffer.position(offset); + buffer.put(bytes); + buffer.position(nullOffset); + buffer.put(nullShort); + } + + @Override + public void addInteger(int index, int value) throws SQLException { + int nullOffset = metadata.getNullOffset(index); + int offset = metadata.getOffset(index); + + byte[] bytes = datatypeCoder.encodeInt(value); + byte[] nullShort = datatypeCoder.encodeShort(0); + + buffer.position(offset); + buffer.put(bytes); + buffer.position(nullOffset); + buffer.put(nullShort); + } + + @Override + public void addBigint(int index, long value) throws SQLException { + int nullOffset = metadata.getNullOffset(index); + int offset = metadata.getOffset(index); + + byte[] bytes = datatypeCoder.encodeLong(value); + byte[] nullShort = datatypeCoder.encodeShort(0); + + buffer.position(offset); + buffer.put(bytes); + buffer.position(nullOffset); + buffer.put(nullShort); + } + + @Override + public void addFloat(int index, float value) throws SQLException { + int nullOffset = metadata.getNullOffset(index); + int offset = metadata.getOffset(index); + + byte[] bytes = datatypeCoder.encodeFloat(value); + byte[] nullShort = datatypeCoder.encodeShort(0); + + buffer.position(offset); + buffer.put(bytes); + buffer.position(nullOffset); + buffer.put(nullShort); + } + + @Override + public void addDouble(int index, double value) throws SQLException { + int nullOffset = metadata.getNullOffset(index); + int offset = metadata.getOffset(index); + int type = metadata.getType(index); + byte[] bytes = null; + if (type == SQL_INT64) { + BigDecimal decimal = BigDecimal.valueOf(value); + BigInteger integer = decimal.unscaledValue(); + bytes = datatypeCoder.encodeLong(integer.longValue()); + } + else + bytes = datatypeCoder.encodeDouble(value); + byte[] nullShort = datatypeCoder.encodeShort(0); + + buffer.position(offset); + buffer.put(bytes); + buffer.position(nullOffset); + buffer.put(nullShort); + } + + @Override + public void addNumeric(int index, double value) throws SQLException { + int nullOffset = metadata.getNullOffset(index); + int offset = metadata.getOffset(index); + int type = metadata.getType(index); + byte[] bytes = null; + if (type == SQL_INT64) { + BigDecimal decimal = BigDecimal.valueOf(value); + BigInteger integer = decimal.unscaledValue(); + bytes = datatypeCoder.encodeLong(integer.longValue()); + } else if (type == SQL_SHORT) { + BigDecimal decimal = BigDecimal.valueOf(value); + short encodedShort = (short)decimal.unscaledValue().intValue(); + bytes = datatypeCoder.encodeShort(encodedShort); + } else if (type == SQL_LONG) { +// long encodedLong = Double.doubleToLongBits(value); + BigDecimal decimal = BigDecimal.valueOf(value); + long encodedLong = (short)decimal.unscaledValue().longValue(); + bytes = datatypeCoder.encodeLong(encodedLong); + } + byte[] nullShort = datatypeCoder.encodeShort(0); + + buffer.position(offset); + buffer.put(bytes); + buffer.position(nullOffset); + buffer.put(nullShort); + } + + @Override + public void addDecimal(int index, double value) throws SQLException { + int nullOffset = metadata.getNullOffset(index); + int offset = metadata.getOffset(index); + int type = metadata.getType(index); + byte[] bytes = null; + if (type == SQL_INT64) { + BigDecimal decimal = BigDecimal.valueOf(value); + BigInteger integer = decimal.unscaledValue(); + bytes = datatypeCoder.encodeLong(integer.longValue()); + } else if (type == SQL_SHORT) { + BigDecimal decimal = BigDecimal.valueOf(value); + short encodedShort = (short)decimal.unscaledValue().intValue(); + bytes = datatypeCoder.encodeShort(encodedShort); + } else if (type == SQL_LONG) { + BigDecimal decimal = BigDecimal.valueOf(value); + long encodedLong = decimal.unscaledValue().longValue(); + bytes = datatypeCoder.encodeLong(encodedLong); + } + byte[] nullShort = datatypeCoder.encodeShort(0); + + buffer.position(offset); + buffer.put(bytes); + buffer.position(nullOffset); + buffer.put(nullShort); + } + + @Override + public void addDecfloat16(int index, BigDecimal value) throws SQLException { + final Decimal64 decimal128 = Decimal64.valueOf(value); + int nullOffset = metadata.getNullOffset(index); + int offset = metadata.getOffset(index); + + byte[] bytes = datatypeCoder.encodeDecimal64(decimal128); + byte[] nullShort = datatypeCoder.encodeShort(0); + + buffer.position(offset); + buffer.put(bytes); + buffer.position(nullOffset); + buffer.put(nullShort); + } + + @Override + public void addDecfloat34(int index, BigDecimal value) throws SQLException { + final Decimal128 decimal128 = Decimal128.valueOf(value); + int nullOffset = metadata.getNullOffset(index); + int offset = metadata.getOffset(index); + + byte[] bytes = datatypeCoder.encodeDecimal128(decimal128); + byte[] nullShort = datatypeCoder.encodeShort(0); + + buffer.position(offset); + buffer.put(bytes); + buffer.position(nullOffset); + buffer.put(nullShort); + } + + @Override + public void addBlob(int index, long blobId) throws SQLException { + int nullOffset = metadata.getNullOffset(index); + int offset = metadata.getOffset(index); + + byte[] bytes = datatypeCoder.encodeLong(blobId); + byte[] nullShort = datatypeCoder.encodeShort(0); + + buffer.position(offset); + buffer.put(bytes); + buffer.position(nullOffset); + buffer.put(nullShort); + } + + @Override + public void addBoolean(int index, boolean value) throws SQLException { + int nullOffset = metadata.getNullOffset(index); + int offset = metadata.getOffset(index); + + byte[] bytes = datatypeCoder.encodeBoolean(value); + byte[] nullShort = datatypeCoder.encodeShort(0); + + buffer.position(offset); + buffer.put(bytes); + buffer.position(nullOffset); + buffer.put(nullShort); + } + + @Override + public void addDate(int index, Date value) throws SQLException { + int nullOffset = metadata.getNullOffset(index); + int offset = metadata.getOffset(index); + + byte[] bytes = datatypeCoder.encodeDate(value); + byte[] nullShort = datatypeCoder.encodeShort(0); + + buffer.position(offset); + buffer.put(bytes); + buffer.position(nullOffset); + buffer.put(nullShort); + } + + @Override + public void addTime(int index, Time value) throws SQLException { + int nullOffset = metadata.getNullOffset(index); + int offset = metadata.getOffset(index); + + byte[] bytes = datatypeCoder.encodeTime(value); + byte[] nullShort = datatypeCoder.encodeShort(0); + + buffer.position(offset); + buffer.put(bytes); + buffer.position(nullOffset); + buffer.put(nullShort); + } + + @Override + public void addTimestamp(int index, Timestamp value) throws SQLException { + int nullOffset = metadata.getNullOffset(index); + int offset = metadata.getOffset(index); + + byte[] bytes = datatypeCoder.encodeTimestamp(value); + byte[] nullShort = datatypeCoder.encodeShort(0); + + buffer.position(offset); + buffer.put(bytes); + buffer.position(nullOffset); + buffer.put(nullShort); + } + + @Override + public void addChar(int index, String value) throws SQLException { + int nullOffset = metadata.getNullOffset(index); + int offset = metadata.getOffset(index); + + byte[] bytes = datatypeCoder.encodeString(value); + byte[] nullShort = datatypeCoder.encodeShort(0); + + buffer.position(offset); + buffer.put(bytes); + buffer.position(nullOffset); + buffer.put(nullShort); + } + + @Override + public void addVarchar(int index, String value) throws SQLException { + int nullOffset = metadata.getNullOffset(index); + int offset = metadata.getOffset(index); + + byte[] bytes = datatypeCoder.encodeString(value); + byte[] encodeShort = datatypeCoder.encodeShort(bytes.length); + byte[] nullShort = datatypeCoder.encodeShort(0); + + buffer.position(offset); + buffer.put(encodeShort); + offset += encodeShort.length; + buffer.position(offset); + buffer.put(bytes); + buffer.position(nullOffset); + buffer.put(nullShort); + } + + @Override + public byte[] getData() { + return buffer.array(); + } + + @Override + public void clear() { + buffer.clear(); + } + + @Override + public void addStreamData(byte[] data) throws IOException { + + stream.write(data); + + int align = align(messageLength, messageAlign); + + if (align != 0) { + byte[] shift = ByteBuffer.allocate(Math.abs(data.length - align)).array(); + stream.write(shift); + } + } + + @Override + public void clearStream() { + stream.reset(); + } + + @Override + public byte[] getStreamData() { + return stream.toByteArray(); + } + + @Override + public void addBlobData(byte[] data, long blobId) throws IOException { + long position = addBlobHeader(blobId, null); + blobStream.write(data); + + long oldPosition = blobStream.getStreamPosition(); + blobStream.seek(position); + + blobStream.write(datatypeCoder.encodeInt(data.length)); + + blobStream.seek(oldPosition); + + int align = align(blobStream.size(), blobAlign); + + if (align != 0 && blobStream.size() - align < 0) { + byte[] shift = ByteBuffer.allocate(Math.abs(blobStream.size() - align)).array(); + blobStream.write(shift); + } + } + + @Override + public long addBlobHeader(long blobId, BlobParameterBuffer buffer) throws IOException { + + int align = align(blobStream.size(), blobAlign); + + if (align != 0 && blobStream.size() - align < 0) { + byte[] shift = ByteBuffer.allocate(Math.abs(blobStream.size() - align)).array(); + blobStream.write(shift); + } + + blobStream.write(datatypeCoder.encodeLong(blobId)); + + int rc = blobStream.size(); + segmentedBlobSize = rc; + + if (buffer != null) { + byte[] bytes = buffer.toBytesWithType(); + byte[] bytesLength = datatypeCoder.encodeInt(bytes.length); + blobStream.write(bytesLength); + blobStream.write(bytesLength); + blobStream.write(bytes); + } else { + byte[] bytesLength = datatypeCoder.encodeInt(0); + blobStream.write(bytesLength); + blobStream.write(bytesLength); + } + + return rc; + } + + @Override + public void addBlobSegment(byte[] data, long offset, boolean lastSegment) throws IOException { + int align = align(blobStream.size(), FbBatch.BLOB_SEGHDR_ALIGN); + if (align != 0 && blobStream.size() - align < 0) { + byte[] shift = ByteBuffer.allocate(Math.abs(blobStream.size() - align)).array(); + blobStream.write(shift); + } + long oldPosition = blobStream.getStreamPosition(); + blobStream.seek(offset); + + byte[] dataLength = datatypeCoder.encodeShort(data.length); + segmentedBlobSize += align(data.length + dataLength.length, FbBatch.BLOB_SEGHDR_ALIGN); + blobStream.write(datatypeCoder.encodeShort(segmentedBlobSize)); + + blobStream.seek(oldPosition); + + blobStream.write(dataLength); + blobStream.write(data); + + // If the last blob segment is added, + // then blob stream must be aligned using blobAlign + if (lastSegment) { + align = align(blobStream.size(), blobAlign); + + if (align != 0 && blobStream.size() - align < 0) { + byte[] shift = ByteBuffer.allocate(Math.abs(blobStream.size() - align)).array(); + blobStream.write(shift); + } + } + } + + @Override + public void clearBlobStream() { + segmentedBlobSize = 0; + blobStream.reset(); + } + + @Override + public byte[] getBlobStreamData() { + return blobStream.toByteArray(); + } +} diff --git a/src/main/org/firebirdsql/gds/ng/FbBatch.java b/src/main/org/firebirdsql/gds/ng/FbBatch.java new file mode 100644 index 0000000000..54d110fcfa --- /dev/null +++ b/src/main/org/firebirdsql/gds/ng/FbBatch.java @@ -0,0 +1,98 @@ +package org.firebirdsql.gds.ng; + + +import org.firebirdsql.gds.BlobParameterBuffer; +import org.firebirdsql.gds.ng.listeners.ExceptionListenable; + +import java.sql.SQLException; + +/** + * Interface for batch operations. + *

+ * All methods defined in this interface are required to notify all {@code SQLException} thrown from the methods + * defined in this interface. + *

+ * + * @author Vasiliy Yashkov + * @since 4.0 + */ +public interface FbBatch extends ExceptionListenable { + + int VERSION1 = 1; + int TAG_MULTIERROR = 1; + int TAG_RECORD_COUNTS = 2; + int TAG_BUFFER_BYTES_SIZE = 3; + int TAG_BLOB_POLICY = 4; + int TAG_DETAILED_ERRORS = 5; + int BLOB_NONE = 0; + int BLOB_ID_ENGINE = 1; + int BLOB_ID_USER = 2; + int BLOB_STREAM = 3; + int BLOB_SEGHDR_ALIGN = 2; + + /** + * @return Transaction currently associated with this batch. + */ + FbTransaction getTransaction(); + + /** + * @return The database connection that created this batch. + */ + FbDatabase getDatabase(); + + /** + * Add data in this batch for record number. + */ + void add(int count, byte[] inBuffer) throws SQLException; + + /** + * Add blob in this batch and ID will be generated by engine. + */ + FbBlob addBlob(byte[] inBuffer, BlobParameterBuffer buffer) throws SQLException; + + /** + * Add blob in this batch. + */ + FbBlob addBlob(byte[] inBuffer, long blobId, BlobParameterBuffer buffer) throws SQLException; + + /** + * Append blob data. + */ + void appendBlobData(byte[] inBuffer) throws SQLException; + + /** + * Add blob stream. + */ + void addBlobStream(byte[] inBuffer) throws SQLException; + + /** + * Register existing blob. + */ + void registerBlob(long existingBlob, long blobId) throws SQLException; + + /** + * Execute tis batch and + * @return completion state. + */ + FbBatchCompletionState execute() throws SQLException; + + /** + * Cancel the batch execution. + */ + void cancel() throws SQLException; + + /** + * @return Blob alignment. + */ + int getBlobAlignment() throws SQLException; + + /** + * @return The metadata that contained in this batch. + */ + FbMessageMetadata getMetadata() throws SQLException; + + /** + * Set default batch parameters buffer. + */ + void setDefaultBpb(int parLength, byte[] par) throws SQLException; +} diff --git a/src/main/org/firebirdsql/gds/ng/FbBatchCompletionState.java b/src/main/org/firebirdsql/gds/ng/FbBatchCompletionState.java new file mode 100644 index 0000000000..f746466b62 --- /dev/null +++ b/src/main/org/firebirdsql/gds/ng/FbBatchCompletionState.java @@ -0,0 +1,23 @@ +package org.firebirdsql.gds.ng; + +import org.firebirdsql.nativeoo.gds.ng.FbException; + +/** + * + * @author Vasiliy Yashkov + * @since 4.0 + */ +public interface FbBatchCompletionState { + + int EXECUTE_FAILED = -1; + int SUCCESS_NO_INFO = -2; + int NO_MORE_ERRORS = -1; + + int getSize() throws FbException; + + int getState(int index) throws FbException; + + String getError(int index) throws FbException; + + String getAllStates() throws FbException; +} diff --git a/src/main/org/firebirdsql/gds/ng/FbDatabase.java b/src/main/org/firebirdsql/gds/ng/FbDatabase.java index d07c1c5279..1047937c81 100644 --- a/src/main/org/firebirdsql/gds/ng/FbDatabase.java +++ b/src/main/org/firebirdsql/gds/ng/FbDatabase.java @@ -24,10 +24,7 @@ */ package org.firebirdsql.gds.ng; -import org.firebirdsql.gds.BlobParameterBuffer; -import org.firebirdsql.gds.EventHandle; -import org.firebirdsql.gds.EventHandler; -import org.firebirdsql.gds.TransactionParameterBuffer; +import org.firebirdsql.gds.*; import org.firebirdsql.gds.ng.fields.RowDescriptor; import org.firebirdsql.gds.ng.listeners.DatabaseListener; import org.firebirdsql.gds.ng.listeners.ExceptionListenable; @@ -329,4 +326,39 @@ T getDatabaseInfo(byte[] requestItems, int bufferLength, InfoProcessor in * @return A potentially cached empty row descriptor for this database. */ RowDescriptor emptyRowDescriptor(); + + /** + * Creates a batch. + * + * @param transaction + * Transaction associated with the batch. + * @param statement + * Sql statement for creating batch + * @param metadata + * Input metadata {@link FbMessageMetadata} + * @param parameters + * Batch parameters buffer {@link BatchParameterBuffer} + * @return Instance of {@link FbBatch} + * @throws SQLException + */ + FbBatch createBatch(FbTransaction transaction, String statement, FbMessageMetadata metadata, BatchParameterBuffer parameters) throws SQLException; + + /** + * Creates a batch that call prepared statement to get a metadata. + * + * @param transaction + * Transaction associated with the batch. + * @param statement + * Sql statement for creating batch + * @param parameters + * Batch parameters buffer {@link BatchParameterBuffer} + * @return Instance of {@link FbBatch} + * @throws SQLException + */ + FbBatch createBatch(FbTransaction transaction, String statement, BatchParameterBuffer parameters) throws SQLException; + + /** + * @return A metadata builder for a batch execution. + */ + FbMetadataBuilder getMetadataBuilder(int fieldCount) throws SQLException; } diff --git a/src/main/org/firebirdsql/gds/ng/FbMessageBuilder.java b/src/main/org/firebirdsql/gds/ng/FbMessageBuilder.java new file mode 100644 index 0000000000..952d118955 --- /dev/null +++ b/src/main/org/firebirdsql/gds/ng/FbMessageBuilder.java @@ -0,0 +1,65 @@ +package org.firebirdsql.gds.ng; + +import org.firebirdsql.gds.BlobParameterBuffer; + +import java.io.IOException; +import java.math.BigDecimal; +import java.sql.Date; +import java.sql.SQLException; +import java.sql.Time; +import java.sql.Timestamp; + +public interface FbMessageBuilder { + + void addSmallint(int index, short value) throws SQLException; + + void addInteger(int index, int value) throws SQLException; + + void addBigint(int index, long value) throws SQLException; + + void addFloat(int index, float value) throws SQLException; + + void addDouble(int index, double value) throws SQLException; + + void addNumeric(int index, double value) throws SQLException; + + void addDecimal(int index, double value) throws SQLException; + + void addDecfloat16(int index, BigDecimal value) throws SQLException; + + void addDecfloat34(int index, BigDecimal value) throws SQLException; + + void addBlob(int index, long blobId) throws SQLException; + + void addBoolean(int index, boolean value) throws SQLException; + + void addDate(int index, Date value) throws SQLException; + + void addTime(int index, Time value) throws SQLException; + + void addTimestamp(int index, Timestamp value) throws SQLException; + + void addChar(int index, String value) throws SQLException; + + void addVarchar(int index, String value) throws SQLException; + + byte[] getData(); + + void clear(); + + void addStreamData(byte[] data) throws IOException; + + byte[] getStreamData(); + + void clearStream(); + + void addBlobData(byte[] data, long blobId) throws IOException; + + long addBlobHeader(long blobId, BlobParameterBuffer buffer) throws IOException; + + void addBlobSegment(byte[] data, long offset, boolean lastSegment) throws IOException; + + byte[] getBlobStreamData(); + + void clearBlobStream(); +} diff --git a/src/main/org/firebirdsql/gds/ng/FbMessageMetadata.java b/src/main/org/firebirdsql/gds/ng/FbMessageMetadata.java new file mode 100644 index 0000000000..0e17a8f7bc --- /dev/null +++ b/src/main/org/firebirdsql/gds/ng/FbMessageMetadata.java @@ -0,0 +1,44 @@ +package org.firebirdsql.gds.ng; + +import org.firebirdsql.nativeoo.gds.ng.FbException; +import org.firebirdsql.nativeoo.gds.ng.FbInterface.*; + +/** + * + * @author Vasiliy Yashkov + * @since 4.0 + */ +public interface FbMessageMetadata { + + int getOffset(int index) throws FbException; + + int getNullOffset(int index) throws FbException; + + int getLength(int index) throws FbException; + + String getAlias(int index) throws FbException; + + String getField(int index) throws FbException; + + String getOwner(int index) throws FbException; + + String getRelation(int index) throws FbException; + + int getAlignedLength() throws FbException; + + int getAlignment() throws FbException; + + int getCount() throws FbException; + + int getCharSet(int index) throws FbException; + + int getMessageLength() throws FbException; + + int getScale(int index) throws FbException; + + int getSubType(int index) throws FbException; + + int getType(int index) throws FbException; + + IMetadataBuilder getBuilder() throws FbException; +} diff --git a/src/main/org/firebirdsql/gds/ng/FbMetadataBuilder.java b/src/main/org/firebirdsql/gds/ng/FbMetadataBuilder.java new file mode 100644 index 0000000000..9f42588e85 --- /dev/null +++ b/src/main/org/firebirdsql/gds/ng/FbMetadataBuilder.java @@ -0,0 +1,57 @@ +package org.firebirdsql.gds.ng; + +import org.firebirdsql.nativeoo.gds.ng.FbException; + +/** + * + * @author Vasiliy Yashkov + * @since 4.0 + */ +public interface FbMetadataBuilder { + + FbMessageMetadata getMessageMetadata() throws FbException; + + int addField() throws FbException; + + void addSmallint(int index) throws FbException; + + void addInteger(int index) throws FbException; + + void addBigint(int index) throws FbException; + + void addFloat(int index) throws FbException; + + void addNumeric(int index, int size, int scale) throws FbException; + + void addDecimal(int index, int size, int scale) throws FbException; + + void addDouble(int index) throws FbException; + + void addDecfloat16(int index) throws FbException; + + void addDecfloat34(int index) throws FbException; + + void addBlob(int index) throws FbException; + + void addBlob(int index, int subtype) throws FbException; + + void addBoolean(int index) throws FbException; + + void addDate(int index) throws FbException; + + void addTime(int index) throws FbException; + + void addTimestamp(int index) throws FbException; + + void addChar(int index, int length) throws FbException; + + void addVarchar(int index, int length) throws FbException; + + void addChar(int index, int length, int charSet) throws FbException; + + void addVarchar(int index, int length, int charSet) throws FbException; + + void addDecDecimal(int index, int size, int scale) throws FbException; + + void addDecNumeric(int index, int size, int scale) throws FbException; +} diff --git a/src/main/org/firebirdsql/gds/ng/SeekableByteArrayOutputStream.java b/src/main/org/firebirdsql/gds/ng/SeekableByteArrayOutputStream.java new file mode 100644 index 0000000000..bc0b78e3a0 --- /dev/null +++ b/src/main/org/firebirdsql/gds/ng/SeekableByteArrayOutputStream.java @@ -0,0 +1,137 @@ +package org.firebirdsql.gds.ng; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.util.Arrays; +import static java.lang.Math.*; + +public class SeekableByteArrayOutputStream extends ByteArrayOutputStream { + + /** + * The current stream position. + */ + private int pos; + + /** + * Creates a new byte array output stream. The buffer capacity is + * initially 32 bytes, though its size increases if necessary. + */ + public SeekableByteArrayOutputStream() { + this(32); + } + + /** + * Creates a new byte array output stream, with a buffer capacity of + * the specified size, in bytes. + * + * @param size the initial size. + * @exception IllegalArgumentException if size is negative. + */ + public SeekableByteArrayOutputStream(int size) { + if (size < 0) { + throw new IllegalArgumentException("Negative initial size: " + + size); + } + buf = new byte[size]; + } + + /** + * Writes the specified byte to this byte array output stream. + * + * @param b the byte to be written. + */ + @Override + public synchronized void write(int b) { + int newcount = max(pos + 1, count); + if (newcount > buf.length) { + buf = Arrays.copyOf(buf, Math.max(buf.length << 1, newcount)); + } + buf[pos++] = (byte)b; + count = newcount; + } + + /** + * Writes len bytes from the specified byte array + * starting at offset off to this byte array output stream. + * + * @param b the data. + * @param off the start offset in the data. + * @param len the number of bytes to write. + */ + @Override + public synchronized void write(byte b[], int off, int len) { + if ((off < 0) || (off > b.length) || (len < 0) || + ((off + len) > b.length) || ((off + len) < 0)) { + throw new IndexOutOfBoundsException(); + } else if (len == 0) { + return; + } + int newcount = max(pos+len,count); + if (newcount > buf.length) { + buf = Arrays.copyOf(buf, Math.max(buf.length << 1, newcount)); + } + System.arraycopy(b, off, buf, pos, len); + pos+=len; + count = newcount; + } + + /** + * Resets the count field of this byte array output + * stream to zero, so that all currently accumulated output in the + * output stream is discarded. The output stream can be used again, + * reusing the already allocated buffer space. + * + * @see java.io.ByteArrayInputStream#count + */ + @Override + public synchronized void reset() { + count = 0; + pos=0; + } + + /** + * Sets the current stream position to the desired location. The + * next read will occur at this location. The bit offset is set + * to 0. + * + *

An IndexOutOfBoundsException will be thrown if + * pos is smaller than the flushed position (as + * returned by getflushedPosition). + * + *

It is legal to seek past the end of the file; an + * EOFException will be thrown only if a read is + * performed. + * + * @param pos a long containing the desired file + * pointer position. + * + * @exception IndexOutOfBoundsException if pos is smaller + * than the flushed position. + * @exception IOException if any other I/O error occurs. + */ + public void seek(long pos) throws IOException { + this.pos = (int)pos; + } + + /** + * Returns the current byte position of the stream. The next write + * will take place starting at this offset. + * + * @return a long containing the position of the stream. + * + * @exception IOException if an I/O error occurs. + */ + public long getStreamPosition() throws IOException { + return pos; + } + + /** Writes the contents of the byte array into the specified output + * stream. + * @param out + */ + public void toOutputStream(OutputStream out) throws IOException { + out.write(buf, 0, count); + } + +} \ No newline at end of file diff --git a/src/main/org/firebirdsql/gds/ng/wire/version10/V10Database.java b/src/main/org/firebirdsql/gds/ng/wire/version10/V10Database.java index 29ff51047d..84df4b59b6 100644 --- a/src/main/org/firebirdsql/gds/ng/wire/version10/V10Database.java +++ b/src/main/org/firebirdsql/gds/ng/wire/version10/V10Database.java @@ -22,7 +22,10 @@ import org.firebirdsql.gds.*; import org.firebirdsql.gds.impl.DatabaseParameterBufferExtension; import org.firebirdsql.gds.impl.wire.XdrOutputStream; +import org.firebirdsql.gds.ng.FbBatch; import org.firebirdsql.gds.ng.FbExceptionBuilder; +import org.firebirdsql.gds.ng.FbMessageMetadata; +import org.firebirdsql.gds.ng.FbMetadataBuilder; import org.firebirdsql.gds.ng.FbStatement; import org.firebirdsql.gds.ng.FbTransaction; import org.firebirdsql.gds.ng.TransactionState; @@ -74,6 +77,21 @@ public final int getHandle() { return handle; } + @Override + public FbBatch createBatch(FbTransaction transaction, String statement, FbMessageMetadata metadata, BatchParameterBuffer parameters) throws SQLException { + throw new SQLException("Not implemented"); + } + + @Override + public FbBatch createBatch(FbTransaction transaction, String statement, BatchParameterBuffer parameters) throws SQLException { + throw new SQLException("Not implemented"); + } + + @Override + public FbMetadataBuilder getMetadataBuilder(int fieldCount) throws SQLException { + throw new SQLException("Not implemented"); + } + @Override public final void attach() throws SQLException { try { diff --git a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/TestIBatchImpl.java b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/TestIBatchImpl.java new file mode 100644 index 0000000000..01b5f822e3 --- /dev/null +++ b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/TestIBatchImpl.java @@ -0,0 +1,1326 @@ +package org.firebirdsql.nativeoo.gds.ng; + +import org.firebirdsql.gds.BatchParameterBuffer; +import org.firebirdsql.gds.BlobParameterBuffer; +import org.firebirdsql.gds.ISCConstants; +import org.firebirdsql.gds.impl.*; +import org.firebirdsql.gds.ng.*; +import org.firebirdsql.gds.ng.fields.RowValue; +import org.firebirdsql.gds.ng.jna.AbstractNativeDatabaseFactory; +import org.firebirdsql.gds.ng.wire.SimpleStatementListener; +import org.firebirdsql.jdbc.FBBlob; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; + +import java.io.ByteArrayOutputStream; +import java.math.BigDecimal; +import java.sql.Date; +import java.sql.SQLException; +import java.sql.Time; +import java.sql.Timestamp; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Calendar; + +import static org.hamcrest.CoreMatchers.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; + +/** + * Test for batch in the OO API implementation. + * + * {@link org.firebirdsql.nativeoo.gds.ng.IBatchImpl}. + * + * @author Vasiliy Yashkov + * @since 4.0 + */ +public class TestIBatchImpl extends AbstractBatchTest { + + private static final String gdsType = "FBOONATIVE"; + + //@formatter:off + protected String INSERT_QUERY_WITHOUT_BLOBS = "INSERT INTO test_p_metadata (" + + " id, " + + " simple_field, " + + " two_byte_field, " + + " three_byte_field, " + + " long_field, " + + " int_field, " + + " short_field, " + + " float_field, " + + " double_field, " + + " smallint_numeric, " + + " integer_decimal_1, " + + " integer_numeric, " + + " integer_decimal_2, " + + " bigint_numeric, " + + " bigint_decimal, " + + " date_field, " + + " time_field, " + + " timestamp_field " + + ") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; + + protected String INSERT_QUERY_WITH_BLOBS = "INSERT INTO test_p_metadata (" + + " id, " + + " simple_field, " + + " two_byte_field, " + + " three_byte_field, " + + " long_field, " + + " int_field, " + + " short_field, " + + " float_field, " + + " double_field, " + + " smallint_numeric, " + + " integer_decimal_1, " + + " integer_numeric, " + + " integer_decimal_2, " + + " bigint_numeric, " + + " bigint_decimal, " + + " date_field, " + + " time_field, " + + " timestamp_field, " + + " blob_field, " + + " blob_text_field, " + + " blob_minus_one " + + ") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; + + protected String INSERT_QUERY_ONLY_BLOBS = "INSERT INTO test_p_metadata (" + + " blob_field, " + + " blob_text_field, " + + " blob_minus_one " + + ") VALUES (?, ?, ?)"; + + protected String SELECT_QUERY_WITHOUT_BLOBS = + "SELECT " + + "id, simple_field, two_byte_field, three_byte_field, long_field, int_field, short_field," + + "float_field, double_field, smallint_numeric, integer_decimal_1, integer_numeric," + + "integer_decimal_2, bigint_numeric, bigint_decimal, date_field, time_field," + + "timestamp_field " + + " from test_p_metadata"; + + protected String SELECT_QUERY_WITH_BLOBS = + "SELECT " + + "id, simple_field, two_byte_field, three_byte_field, long_field, int_field, short_field," + + "float_field, double_field, smallint_numeric, integer_decimal_1, integer_numeric," + + "integer_decimal_2, bigint_numeric, bigint_decimal, date_field, time_field," + + "timestamp_field, blob_field, blob_text_field, blob_minus_one " + + " from test_p_metadata"; + + protected String SELECT_QUERY_ONLY_BLOBS = + "SELECT " + + "blob_field, blob_text_field, blob_minus_one " + + " from test_p_metadata"; + //@formatter:on + + @Rule + public final ExpectedException expectedException = ExpectedException.none(); + + private final AbstractNativeOODatabaseFactory factory = + (AbstractNativeOODatabaseFactory) GDSFactory.getDatabaseFactoryForType(GDSType.getType(gdsType)); + + @Override + protected Class getExpectedDatabaseType() { + return IDatabaseImpl.class; + } + + @Override + protected FbDatabase createDatabase() throws SQLException { + return factory.connect(connectionInfo); + } + + @Test + public void testSingleExecuteBatchWithoutBlobs() throws SQLException { + allocateTransaction(); + BatchParameterBuffer buffer = new BatchParameterBufferImpl(); + buffer.addArgument(FbInterface.IBatch.TAG_RECORD_COUNTS, 1); + FbBatch batch = db.createBatch(transaction, INSERT_QUERY_WITHOUT_BLOBS, buffer); + + int testInteger = 42; + String testVarchar = "test varchar"; + long testBigInteger = 123456789234L; + short testShort = 24; + float testFloat = 42.42f; + double testDouble = 42.4242d; + double testSmallintNumeric = 42.4d; + double testIntNumeric = 42.42d; + double testIntNumeric2 = 42.424d; + double testBigintNumeric = 4242.4242d; + double testBigintNumeric2 = 4242.424242424d; + DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); + DateFormat timeFormat = new SimpleDateFormat("HH:mm:ss"); + DateFormat timestampFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Calendar cal = Calendar.getInstance(); + Date testDate = Date.valueOf(dateFormat.format(cal.getTime())); + Time testTime = Time.valueOf(timeFormat.format(cal.getTime())); + Timestamp testTimestamp = Timestamp.valueOf(timestampFormat.format(cal.getTime())); + + FbMessageBuilder builder = new IMessageBuilderImpl(batch); + + builder.addInteger(0, testInteger); + builder.addVarchar(1, testVarchar); + builder.addVarchar(2, testVarchar); + builder.addVarchar(3, testVarchar); + builder.addBigint(4, testBigInteger); + builder.addInteger(5, testInteger); + builder.addSmallint(6, testShort); + builder.addFloat(7, testFloat); + builder.addDouble(8, testDouble); + builder.addNumeric(9, testSmallintNumeric); + builder.addDecimal(10, testSmallintNumeric); + builder.addNumeric(11, testIntNumeric); + builder.addDecimal(12, testIntNumeric2); + builder.addNumeric(13, testBigintNumeric); + builder.addDecimal(14, testBigintNumeric2); + builder.addDate(15, testDate); + builder.addTime(16, testTime); + builder.addTimestamp(17, testTimestamp); + + batch.add(1, builder.getData()); + + FbBatchCompletionState execute = batch.execute(); + + System.out.println(execute.getAllStates()); + + assertThat("Expected successful batch execution", execute.getAllStates(), allOf( + startsWith("Message Status"), + containsString("total=1 success=1"), + endsWith("0\n"))); + + batch.getTransaction().commit(); + + allocateTransaction(); + + FbStatement statement = db.createStatement(transaction); + final SimpleStatementListener statementListener = new SimpleStatementListener(); + statement.addStatementListener(statementListener); + statement.prepare(SELECT_QUERY_WITHOUT_BLOBS); + statement.execute(RowValue.EMPTY_ROW_VALUE); + statement.fetchRows(1); + RowValue fieldValues = statementListener.getRows().get(0); + byte[] fieldData = fieldValues.getFieldData(0); + assertEquals(testInteger, + statement.getFieldDescriptor().getFieldDescriptor(0).getDatatypeCoder().decodeInt(fieldData)); + fieldData = fieldValues.getFieldData(1); + assertEquals(testVarchar, + statement.getFieldDescriptor().getFieldDescriptor(1).getDatatypeCoder().decodeString(fieldData)); + fieldData = fieldValues.getFieldData(2); + assertEquals(testVarchar, + statement.getFieldDescriptor().getFieldDescriptor(2).getDatatypeCoder().decodeString(fieldData)); + fieldData = fieldValues.getFieldData(3); + assertEquals(testVarchar, + statement.getFieldDescriptor().getFieldDescriptor(3).getDatatypeCoder().decodeString(fieldData)); + fieldData = fieldValues.getFieldData(4); + assertEquals(testBigInteger, + statement.getFieldDescriptor().getFieldDescriptor(4).getDatatypeCoder().decodeLong(fieldData)); + fieldData = fieldValues.getFieldData(5); + assertEquals(testInteger, + statement.getFieldDescriptor().getFieldDescriptor(5).getDatatypeCoder().decodeInt(fieldData)); + fieldData = fieldValues.getFieldData(6); + assertEquals(testShort, + statement.getFieldDescriptor().getFieldDescriptor(6).getDatatypeCoder().decodeShort(fieldData)); + fieldData = fieldValues.getFieldData(7); + assertEquals(testFloat, + statement.getFieldDescriptor().getFieldDescriptor(7).getDatatypeCoder().decodeFloat(fieldData), + 0); + fieldData = fieldValues.getFieldData(8); + assertEquals(testDouble, + statement.getFieldDescriptor().getFieldDescriptor(8).getDatatypeCoder().decodeDouble(fieldData), + 0); + fieldData = fieldValues.getFieldData(9); + short decodeShort = statement.getFieldDescriptor().getFieldDescriptor(9).getDatatypeCoder().decodeShort(fieldData); + BigDecimal decimal = BigDecimal.valueOf(decodeShort, -statement.getFieldDescriptor().getFieldDescriptor(9).getScale()); + float floatValue = decimal.floatValue(); + assertEquals(testSmallintNumeric, + floatValue, + 0.001); + fieldData = fieldValues.getFieldData(10); + int decodeInt = statement.getFieldDescriptor().getFieldDescriptor(10).getDatatypeCoder().decodeInt(fieldData); + decimal = BigDecimal.valueOf(decodeInt, -statement.getFieldDescriptor().getFieldDescriptor(10).getScale()); + double doubleValue = decimal.doubleValue(); + assertEquals(testSmallintNumeric, + doubleValue, + 0.001); + fieldData = fieldValues.getFieldData(11); + decodeInt = statement.getFieldDescriptor().getFieldDescriptor(11).getDatatypeCoder().decodeInt(fieldData); + decimal = BigDecimal.valueOf(decodeInt, -statement.getFieldDescriptor().getFieldDescriptor(11).getScale()); + doubleValue = decimal.doubleValue(); + assertEquals(testIntNumeric, + doubleValue, + 0); + fieldData = fieldValues.getFieldData(12); + decodeInt = statement.getFieldDescriptor().getFieldDescriptor(12).getDatatypeCoder().decodeInt(fieldData); + decimal = BigDecimal.valueOf(decodeInt, -statement.getFieldDescriptor().getFieldDescriptor(12).getScale()); + doubleValue = decimal.doubleValue(); + assertEquals(testIntNumeric2, + doubleValue, + 0); + fieldData = fieldValues.getFieldData(13); + long decodeLong = statement.getFieldDescriptor().getFieldDescriptor(13).getDatatypeCoder().decodeLong(fieldData); + decimal = BigDecimal.valueOf(decodeLong, -statement.getFieldDescriptor().getFieldDescriptor(13).getScale()); + doubleValue = decimal.doubleValue(); + assertEquals(testBigintNumeric, + doubleValue, + 0); + fieldData = fieldValues.getFieldData(14); + decodeLong = statement.getFieldDescriptor().getFieldDescriptor(14).getDatatypeCoder().decodeLong(fieldData); + decimal = BigDecimal.valueOf(decodeLong, -statement.getFieldDescriptor().getFieldDescriptor(14).getScale()); + doubleValue = decimal.doubleValue(); + assertEquals(testBigintNumeric2, + doubleValue, + 0); + fieldData = fieldValues.getFieldData(15); + assertEquals(testDate, + statement.getFieldDescriptor().getFieldDescriptor(15).getDatatypeCoder().decodeDate(fieldData)); + fieldData = fieldValues.getFieldData(16); + assertEquals(testTime, + statement.getFieldDescriptor().getFieldDescriptor(16).getDatatypeCoder().decodeTime(fieldData)); + fieldData = fieldValues.getFieldData(17); + assertEquals(testTimestamp, + statement.getFieldDescriptor().getFieldDescriptor(17).getDatatypeCoder().decodeTimestamp(fieldData)); + } + + @Test + public void testSingleExecuteBatchWithBlobs() throws Exception { + allocateTransaction(); + BatchParameterBuffer buffer = new BatchParameterBufferImpl(); + buffer.addArgument(FbInterface.IBatch.TAG_RECORD_COUNTS, 1); + // continue batch processing in case of errors in some messages + buffer.addArgument(FbBatch.TAG_MULTIERROR, 1); + // enable blobs processing - IDs generated by firebird engine + buffer.addArgument(FbBatch.TAG_BLOB_POLICY, FbBatch.BLOB_ID_ENGINE); + FbBatch batch = db.createBatch(transaction, INSERT_QUERY_WITH_BLOBS, buffer); + + int testInteger = 42; + String testVarchar = "test varchar"; + long testBigInteger = 123456789234L; + short testShort = 24; + float testFloat = 42.42f; + double testDouble = 42.4242d; + double testSmallintNumeric = 42.4d; + double testIntNumeric = 42.42d; + double testIntNumeric2 = 42.424d; + double testBigintNumeric = 4242.4242d; + double testBigintNumeric2 = 4242.424242424d; + DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); + DateFormat timeFormat = new SimpleDateFormat("HH:mm:ss"); + DateFormat timestampFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Calendar cal = Calendar.getInstance(); + Date testDate = Date.valueOf(dateFormat.format(cal.getTime())); + Time testTime = Time.valueOf(timeFormat.format(cal.getTime())); + Timestamp testTimestamp = Timestamp.valueOf(timestampFormat.format(cal.getTime())); + + FbMessageBuilder builder = new IMessageBuilderImpl(batch); + + builder.addInteger(0, testInteger); + builder.addVarchar(1, testVarchar); + builder.addVarchar(2, testVarchar); + builder.addVarchar(3, testVarchar); + builder.addBigint(4, testBigInteger); + builder.addInteger(5, testInteger); + builder.addSmallint(6, testShort); + builder.addFloat(7, testFloat); + builder.addDouble(8, testDouble); + builder.addNumeric(9, testSmallintNumeric); + builder.addDecimal(10, testSmallintNumeric); + builder.addNumeric(11, testIntNumeric); + builder.addDecimal(12, testIntNumeric2); + builder.addNumeric(13, testBigintNumeric); + builder.addDecimal(14, testBigintNumeric2); + builder.addDate(15, testDate); + builder.addTime(16, testTime); + builder.addTimestamp(17, testTimestamp); + long blobID = 0; + FbBlob blob18 = batch.addBlob(INSERT_QUERY_WITH_BLOBS.getBytes(), blobID, null); + builder.addBlob(18, blob18.getBlobId()); + FbBlob blob19 = batch.addBlob(INSERT_QUERY_WITH_BLOBS.getBytes(), blobID, null); + builder.addBlob(19, blob19.getBlobId()); + FbBlob blob20 = batch.addBlob(INSERT_QUERY_WITH_BLOBS.getBytes(), blobID, null); + builder.addBlob(20, blob20.getBlobId()); + + batch.add(1, builder.getData()); + + FbBatchCompletionState execute = batch.execute(); + + System.out.println(execute.getAllStates()); + + assertThat("Expected successful batch execution", execute.getAllStates(), allOf( + startsWith("Message Status"), + containsString("total=1 success=1"), + endsWith("0\n"))); + + batch.getTransaction().commit(); + + allocateTransaction(); + + FbStatement statement = db.createStatement(transaction); + final SimpleStatementListener statementListener = new SimpleStatementListener(); + statement.addStatementListener(statementListener); + statement.prepare(SELECT_QUERY_WITH_BLOBS); + statement.execute(RowValue.EMPTY_ROW_VALUE); + statement.fetchRows(1); + RowValue fieldValues = statementListener.getRows().get(0); + byte[] fieldData = fieldValues.getFieldData(0); + assertEquals(testInteger, + statement.getFieldDescriptor().getFieldDescriptor(0).getDatatypeCoder().decodeInt(fieldData)); + fieldData = fieldValues.getFieldData(1); + assertEquals(testVarchar, + statement.getFieldDescriptor().getFieldDescriptor(1).getDatatypeCoder().decodeString(fieldData)); + fieldData = fieldValues.getFieldData(2); + assertEquals(testVarchar, + statement.getFieldDescriptor().getFieldDescriptor(2).getDatatypeCoder().decodeString(fieldData)); + fieldData = fieldValues.getFieldData(3); + assertEquals(testVarchar, + statement.getFieldDescriptor().getFieldDescriptor(3).getDatatypeCoder().decodeString(fieldData)); + fieldData = fieldValues.getFieldData(4); + assertEquals(testBigInteger, + statement.getFieldDescriptor().getFieldDescriptor(4).getDatatypeCoder().decodeLong(fieldData)); + fieldData = fieldValues.getFieldData(5); + assertEquals(testInteger, + statement.getFieldDescriptor().getFieldDescriptor(5).getDatatypeCoder().decodeInt(fieldData)); + fieldData = fieldValues.getFieldData(6); + assertEquals(testShort, + statement.getFieldDescriptor().getFieldDescriptor(6).getDatatypeCoder().decodeShort(fieldData)); + fieldData = fieldValues.getFieldData(7); + assertEquals(testFloat, + statement.getFieldDescriptor().getFieldDescriptor(7).getDatatypeCoder().decodeFloat(fieldData), + 0); + fieldData = fieldValues.getFieldData(8); + assertEquals(testDouble, + statement.getFieldDescriptor().getFieldDescriptor(8).getDatatypeCoder().decodeDouble(fieldData), + 0); + fieldData = fieldValues.getFieldData(9); + short decodeShort = statement.getFieldDescriptor().getFieldDescriptor(9).getDatatypeCoder().decodeShort(fieldData); + BigDecimal decimal = BigDecimal.valueOf(decodeShort, -statement.getFieldDescriptor().getFieldDescriptor(9).getScale()); + float floatValue = decimal.floatValue(); + assertEquals(testSmallintNumeric, + floatValue, + 0.001); + fieldData = fieldValues.getFieldData(10); + int decodeInt = statement.getFieldDescriptor().getFieldDescriptor(10).getDatatypeCoder().decodeInt(fieldData); + decimal = BigDecimal.valueOf(decodeInt, -statement.getFieldDescriptor().getFieldDescriptor(10).getScale()); + double doubleValue = decimal.doubleValue(); + assertEquals(testSmallintNumeric, + doubleValue, + 0.001); + fieldData = fieldValues.getFieldData(11); + decodeInt = statement.getFieldDescriptor().getFieldDescriptor(11).getDatatypeCoder().decodeInt(fieldData); + decimal = BigDecimal.valueOf(decodeInt, -statement.getFieldDescriptor().getFieldDescriptor(11).getScale()); + doubleValue = decimal.doubleValue(); + assertEquals(testIntNumeric, + doubleValue, + 0); + fieldData = fieldValues.getFieldData(12); + decodeInt = statement.getFieldDescriptor().getFieldDescriptor(12).getDatatypeCoder().decodeInt(fieldData); + decimal = BigDecimal.valueOf(decodeInt, -statement.getFieldDescriptor().getFieldDescriptor(12).getScale()); + doubleValue = decimal.doubleValue(); + assertEquals(testIntNumeric2, + doubleValue, + 0); + fieldData = fieldValues.getFieldData(13); + long decodeLong = statement.getFieldDescriptor().getFieldDescriptor(13).getDatatypeCoder().decodeLong(fieldData); + decimal = BigDecimal.valueOf(decodeLong, -statement.getFieldDescriptor().getFieldDescriptor(13).getScale()); + doubleValue = decimal.doubleValue(); + assertEquals(testBigintNumeric, + doubleValue, + 0); + fieldData = fieldValues.getFieldData(14); + decodeLong = statement.getFieldDescriptor().getFieldDescriptor(14).getDatatypeCoder().decodeLong(fieldData); + decimal = BigDecimal.valueOf(decodeLong, -statement.getFieldDescriptor().getFieldDescriptor(14).getScale()); + doubleValue = decimal.doubleValue(); + assertEquals(testBigintNumeric2, + doubleValue, + 0); + fieldData = fieldValues.getFieldData(15); + assertEquals(testDate, + statement.getFieldDescriptor().getFieldDescriptor(15).getDatatypeCoder().decodeDate(fieldData)); + fieldData = fieldValues.getFieldData(16); + assertEquals(testTime, + statement.getFieldDescriptor().getFieldDescriptor(16).getDatatypeCoder().decodeTime(fieldData)); + fieldData = fieldValues.getFieldData(17); + assertEquals(testTimestamp, + statement.getFieldDescriptor().getFieldDescriptor(17).getDatatypeCoder().decodeTimestamp(fieldData)); + fieldData = fieldValues.getFieldData(18); + blobID = statement.getFieldDescriptor().getFieldDescriptor(18).getDatatypeCoder().decodeLong(fieldData); + checkBlob(blobID, INSERT_QUERY_WITH_BLOBS.getBytes()); + fieldData = fieldValues.getFieldData(19); + blobID = statement.getFieldDescriptor().getFieldDescriptor(19).getDatatypeCoder().decodeLong(fieldData); + checkBlob(blobID, INSERT_QUERY_WITH_BLOBS.getBytes()); + fieldData = fieldValues.getFieldData(20); + blobID = statement.getFieldDescriptor().getFieldDescriptor(20).getDatatypeCoder().decodeLong(fieldData); + checkBlob(blobID, INSERT_QUERY_WITH_BLOBS.getBytes()); + } + + @Test + public void testMultipleMessagesBatchWithoutBlobs() throws SQLException { + allocateTransaction(); + BatchParameterBuffer buffer = new BatchParameterBufferImpl(); + buffer.addArgument(FbInterface.IBatch.TAG_RECORD_COUNTS, 1); + FbBatch batch = db.createBatch(transaction, INSERT_QUERY_WITHOUT_BLOBS, buffer); + + int testInteger = 42; + String testVarchar = "test varchar"; + long testBigInteger = 123456789234L; + short testShort = 24; + float testFloat = 42.42f; + double testDouble = 42.4242d; + double testSmallintNumeric = 42.4d; + double testIntNumeric = 42.42d; + double testIntNumeric2 = 42.424d; + double testBigintNumeric = 4242.4242d; + double testBigintNumeric2 = 4242.424242424d; + DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); + DateFormat timeFormat = new SimpleDateFormat("HH:mm:ss"); + DateFormat timestampFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Calendar cal = Calendar.getInstance(); + Date testDate = Date.valueOf(dateFormat.format(cal.getTime())); + Time testTime = Time.valueOf(timeFormat.format(cal.getTime())); + Timestamp testTimestamp = Timestamp.valueOf(timestampFormat.format(cal.getTime())); + + FbMessageBuilder builder = new IMessageBuilderImpl(batch); + + builder.addInteger(0, testInteger); + builder.addVarchar(1, testVarchar); + builder.addVarchar(2, testVarchar); + builder.addVarchar(3, testVarchar); + builder.addBigint(4, testBigInteger); + builder.addInteger(5, testInteger); + builder.addSmallint(6, testShort); + builder.addFloat(7, testFloat); + builder.addDouble(8, testDouble); + builder.addNumeric(9, testSmallintNumeric); + builder.addDecimal(10, testSmallintNumeric); + builder.addNumeric(11, testIntNumeric); + builder.addDecimal(12, testIntNumeric2); + builder.addNumeric(13, testBigintNumeric); + builder.addDecimal(14, testBigintNumeric2); + builder.addDate(15, testDate); + builder.addTime(16, testTime); + builder.addTimestamp(17, testTimestamp); + batch.add(1, builder.getData()); + // clear data for add next message + builder.clear(); + + builder.addInteger(0, ++testInteger); + builder.addVarchar(1, testVarchar); + builder.addVarchar(2, testVarchar); + builder.addVarchar(3, testVarchar); + builder.addBigint(4, testBigInteger); + builder.addInteger(5, testInteger); + builder.addSmallint(6, testShort); + builder.addFloat(7, testFloat); + builder.addDouble(8, testDouble); + builder.addNumeric(9, testSmallintNumeric); + builder.addDecimal(10, testSmallintNumeric); + builder.addNumeric(11, testIntNumeric); + builder.addDecimal(12, testIntNumeric2); + builder.addNumeric(13, testBigintNumeric); + builder.addDecimal(14, testBigintNumeric2); + builder.addDate(15, testDate); + builder.addTime(16, testTime); + builder.addTimestamp(17, testTimestamp); + batch.add(1, builder.getData()); + // clear data for add next message + builder.clear(); + + builder.addInteger(0, ++testInteger); + builder.addVarchar(1, testVarchar); + builder.addVarchar(2, testVarchar); + builder.addVarchar(3, testVarchar); + builder.addBigint(4, testBigInteger); + builder.addInteger(5, testInteger); + builder.addSmallint(6, testShort); + builder.addFloat(7, testFloat); + builder.addDouble(8, testDouble); + builder.addNumeric(9, testSmallintNumeric); + builder.addDecimal(10, testSmallintNumeric); + builder.addNumeric(11, testIntNumeric); + builder.addDecimal(12, testIntNumeric2); + builder.addNumeric(13, testBigintNumeric); + builder.addDecimal(14, testBigintNumeric2); + builder.addDate(15, testDate); + builder.addTime(16, testTime); + builder.addTimestamp(17, testTimestamp); + batch.add(1, builder.getData()); + // clear data for add next message + builder.clear(); + + FbBatchCompletionState execute = batch.execute(); + + System.out.println(execute.getAllStates()); + + assertThat("Expected successful batch execution", execute.getAllStates(), allOf( + startsWith("Message Status"), + containsString("total=3 success=3"), + endsWith("0\n"))); + + batch.getTransaction().commit(); + + allocateTransaction(); + + FbStatement statement = db.createStatement(transaction); + final SimpleStatementListener statementListener = new SimpleStatementListener(); + statement.addStatementListener(statementListener); + statement.prepare(SELECT_QUERY_WITHOUT_BLOBS); + statement.execute(RowValue.EMPTY_ROW_VALUE); + statement.fetchRows(1); + statement.fetchRows(1); + statement.fetchRows(1); + RowValue fieldValues = statementListener.getRows().get(2); + byte[] fieldData = fieldValues.getFieldData(0); + assertEquals(testInteger, + statement.getFieldDescriptor().getFieldDescriptor(0).getDatatypeCoder().decodeInt(fieldData)); + fieldData = fieldValues.getFieldData(1); + assertEquals(testVarchar, + statement.getFieldDescriptor().getFieldDescriptor(1).getDatatypeCoder().decodeString(fieldData)); + fieldData = fieldValues.getFieldData(2); + assertEquals(testVarchar, + statement.getFieldDescriptor().getFieldDescriptor(2).getDatatypeCoder().decodeString(fieldData)); + fieldData = fieldValues.getFieldData(3); + assertEquals(testVarchar, + statement.getFieldDescriptor().getFieldDescriptor(3).getDatatypeCoder().decodeString(fieldData)); + fieldData = fieldValues.getFieldData(4); + assertEquals(testBigInteger, + statement.getFieldDescriptor().getFieldDescriptor(4).getDatatypeCoder().decodeLong(fieldData)); + fieldData = fieldValues.getFieldData(5); + assertEquals(testInteger, + statement.getFieldDescriptor().getFieldDescriptor(5).getDatatypeCoder().decodeInt(fieldData)); + fieldData = fieldValues.getFieldData(6); + assertEquals(testShort, + statement.getFieldDescriptor().getFieldDescriptor(6).getDatatypeCoder().decodeShort(fieldData)); + fieldData = fieldValues.getFieldData(7); + assertEquals(testFloat, + statement.getFieldDescriptor().getFieldDescriptor(7).getDatatypeCoder().decodeFloat(fieldData), + 0); + fieldData = fieldValues.getFieldData(8); + assertEquals(testDouble, + statement.getFieldDescriptor().getFieldDescriptor(8).getDatatypeCoder().decodeDouble(fieldData), + 0); + fieldData = fieldValues.getFieldData(9); + short decodeShort = statement.getFieldDescriptor().getFieldDescriptor(9).getDatatypeCoder().decodeShort(fieldData); + BigDecimal decimal = BigDecimal.valueOf(decodeShort, -statement.getFieldDescriptor().getFieldDescriptor(9).getScale()); + float floatValue = decimal.floatValue(); + assertEquals(testSmallintNumeric, + floatValue, + 0.001); + fieldData = fieldValues.getFieldData(10); + int decodeInt = statement.getFieldDescriptor().getFieldDescriptor(10).getDatatypeCoder().decodeInt(fieldData); + decimal = BigDecimal.valueOf(decodeInt, -statement.getFieldDescriptor().getFieldDescriptor(10).getScale()); + double doubleValue = decimal.doubleValue(); + assertEquals(testSmallintNumeric, + doubleValue, + 0.001); + fieldData = fieldValues.getFieldData(11); + decodeInt = statement.getFieldDescriptor().getFieldDescriptor(11).getDatatypeCoder().decodeInt(fieldData); + decimal = BigDecimal.valueOf(decodeInt, -statement.getFieldDescriptor().getFieldDescriptor(11).getScale()); + doubleValue = decimal.doubleValue(); + assertEquals(testIntNumeric, + doubleValue, + 0); + fieldData = fieldValues.getFieldData(12); + decodeInt = statement.getFieldDescriptor().getFieldDescriptor(12).getDatatypeCoder().decodeInt(fieldData); + decimal = BigDecimal.valueOf(decodeInt, -statement.getFieldDescriptor().getFieldDescriptor(12).getScale()); + doubleValue = decimal.doubleValue(); + assertEquals(testIntNumeric2, + doubleValue, + 0); + fieldData = fieldValues.getFieldData(13); + long decodeLong = statement.getFieldDescriptor().getFieldDescriptor(13).getDatatypeCoder().decodeLong(fieldData); + decimal = BigDecimal.valueOf(decodeLong, -statement.getFieldDescriptor().getFieldDescriptor(13).getScale()); + doubleValue = decimal.doubleValue(); + assertEquals(testBigintNumeric, + doubleValue, + 0); + fieldData = fieldValues.getFieldData(14); + decodeLong = statement.getFieldDescriptor().getFieldDescriptor(14).getDatatypeCoder().decodeLong(fieldData); + decimal = BigDecimal.valueOf(decodeLong, -statement.getFieldDescriptor().getFieldDescriptor(14).getScale()); + doubleValue = decimal.doubleValue(); + assertEquals(testBigintNumeric2, + doubleValue, + 0); + fieldData = fieldValues.getFieldData(15); + assertEquals(testDate, + statement.getFieldDescriptor().getFieldDescriptor(15).getDatatypeCoder().decodeDate(fieldData)); + fieldData = fieldValues.getFieldData(16); + assertEquals(testTime, + statement.getFieldDescriptor().getFieldDescriptor(16).getDatatypeCoder().decodeTime(fieldData)); + fieldData = fieldValues.getFieldData(17); + assertEquals(testTimestamp, + statement.getFieldDescriptor().getFieldDescriptor(17).getDatatypeCoder().decodeTimestamp(fieldData)); + } + + @Test + public void testMultipleMessagesBatchWithBlobs() throws Exception { + allocateTransaction(); + BatchParameterBuffer buffer = new BatchParameterBufferImpl(); + buffer.addArgument(FbInterface.IBatch.TAG_RECORD_COUNTS, 1); + // continue batch processing in case of errors in some messages + buffer.addArgument(FbBatch.TAG_MULTIERROR, 1); + // enable blobs processing - IDs generated by firebird engine + buffer.addArgument(FbBatch.TAG_BLOB_POLICY, FbBatch.BLOB_ID_ENGINE); + FbBatch batch = db.createBatch(transaction, INSERT_QUERY_WITH_BLOBS, buffer); + + int testInteger = 42; + String testVarchar = "test varchar"; + long testBigInteger = 123456789234L; + short testShort = 24; + float testFloat = 42.42f; + double testDouble = 42.4242d; + double testSmallintNumeric = 42.4d; + double testIntNumeric = 42.42d; + double testIntNumeric2 = 42.424d; + double testBigintNumeric = 4242.4242d; + double testBigintNumeric2 = 4242.424242424d; + DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); + DateFormat timeFormat = new SimpleDateFormat("HH:mm:ss"); + DateFormat timestampFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Calendar cal = Calendar.getInstance(); + Date testDate = Date.valueOf(dateFormat.format(cal.getTime())); + Time testTime = Time.valueOf(timeFormat.format(cal.getTime())); + Timestamp testTimestamp = Timestamp.valueOf(timestampFormat.format(cal.getTime())); + + FbMessageBuilder builder = new IMessageBuilderImpl(batch); + + builder.addInteger(0, testInteger); + builder.addVarchar(1, testVarchar); + builder.addVarchar(2, testVarchar); + builder.addVarchar(3, testVarchar); + builder.addBigint(4, testBigInteger); + builder.addInteger(5, testInteger); + builder.addSmallint(6, testShort); + builder.addFloat(7, testFloat); + builder.addDouble(8, testDouble); + builder.addNumeric(9, testSmallintNumeric); + builder.addDecimal(10, testSmallintNumeric); + builder.addNumeric(11, testIntNumeric); + builder.addDecimal(12, testIntNumeric2); + builder.addNumeric(13, testBigintNumeric); + builder.addDecimal(14, testBigintNumeric2); + builder.addDate(15, testDate); + builder.addTime(16, testTime); + builder.addTimestamp(17, testTimestamp); + FbBlob blob18 = batch.addBlob(INSERT_QUERY_WITH_BLOBS.getBytes(), null); + builder.addBlob(18, blob18.getBlobId()); + FbBlob blob19 = batch.addBlob(INSERT_QUERY_WITH_BLOBS.getBytes(), null); + builder.addBlob(19, blob19.getBlobId()); + FbBlob blob20 = batch.addBlob(INSERT_QUERY_WITH_BLOBS.getBytes(), null); + builder.addBlob(20, blob20.getBlobId()); + batch.add(1, builder.getData()); + // clear data for add next message + builder.clear(); + + builder.addInteger(0, ++testInteger); + builder.addVarchar(1, testVarchar); + builder.addVarchar(2, testVarchar); + builder.addVarchar(3, testVarchar); + builder.addBigint(4, testBigInteger); + builder.addInteger(5, testInteger); + builder.addSmallint(6, testShort); + builder.addFloat(7, testFloat); + builder.addDouble(8, testDouble); + builder.addNumeric(9, testSmallintNumeric); + builder.addDecimal(10, testSmallintNumeric); + builder.addNumeric(11, testIntNumeric); + builder.addDecimal(12, testIntNumeric2); + builder.addNumeric(13, testBigintNumeric); + builder.addDecimal(14, testBigintNumeric2); + builder.addDate(15, testDate); + builder.addTime(16, testTime); + builder.addTimestamp(17, testTimestamp); + byte[] testBytes = (INSERT_QUERY_WITH_BLOBS + INSERT_QUERY_WITH_BLOBS).getBytes(); + blob18 = batch.addBlob(testBytes, null); + builder.addBlob(18, blob18.getBlobId()); + blob19 = batch.addBlob(testBytes, null); + builder.addBlob(19, blob19.getBlobId()); + blob20 = batch.addBlob(testBytes, null); + builder.addBlob(20, blob20.getBlobId()); + batch.add(1, builder.getData()); + // clear data for add next message + builder.clear(); + + builder.addInteger(0, ++testInteger); + builder.addVarchar(1, testVarchar); + builder.addVarchar(2, testVarchar); + builder.addVarchar(3, testVarchar); + builder.addBigint(4, testBigInteger); + builder.addInteger(5, testInteger); + builder.addSmallint(6, testShort); + builder.addFloat(7, testFloat); + builder.addDouble(8, testDouble); + builder.addNumeric(9, testSmallintNumeric); + builder.addDecimal(10, testSmallintNumeric); + builder.addNumeric(11, testIntNumeric); + builder.addDecimal(12, testIntNumeric2); + builder.addNumeric(13, testBigintNumeric); + builder.addDecimal(14, testBigintNumeric2); + builder.addDate(15, testDate); + builder.addTime(16, testTime); + builder.addTimestamp(17, testTimestamp); + testBytes = (INSERT_QUERY_WITH_BLOBS + INSERT_QUERY_WITH_BLOBS + INSERT_QUERY_WITH_BLOBS).getBytes(); + blob18 = batch.addBlob(testBytes, null); + builder.addBlob(18, blob18.getBlobId()); + blob19 = batch.addBlob(testBytes, null); + builder.addBlob(19, blob19.getBlobId()); + blob20 = batch.addBlob(testBytes, null); + builder.addBlob(20, blob20.getBlobId()); + batch.add(1, builder.getData()); + // clear data for add next message + builder.clear(); + + FbBatchCompletionState execute = batch.execute(); + + System.out.println(execute.getAllStates()); + + assertThat("Expected successful batch execution", execute.getAllStates(), allOf( + startsWith("Message Status"), + containsString("total=3 success=3"), + endsWith("0\n"))); + + batch.getTransaction().commit(); + + allocateTransaction(); + + FbStatement statement = db.createStatement(transaction); + final SimpleStatementListener statementListener = new SimpleStatementListener(); + statement.addStatementListener(statementListener); + statement.prepare(SELECT_QUERY_WITH_BLOBS); + statement.execute(RowValue.EMPTY_ROW_VALUE); + statement.fetchRows(1); + statement.fetchRows(1); + statement.fetchRows(1); + RowValue fieldValues = statementListener.getRows().get(2); + byte[] fieldData = fieldValues.getFieldData(0); + assertEquals(testInteger, + statement.getFieldDescriptor().getFieldDescriptor(0).getDatatypeCoder().decodeInt(fieldData)); + fieldData = fieldValues.getFieldData(1); + assertEquals(testVarchar, + statement.getFieldDescriptor().getFieldDescriptor(1).getDatatypeCoder().decodeString(fieldData)); + fieldData = fieldValues.getFieldData(2); + assertEquals(testVarchar, + statement.getFieldDescriptor().getFieldDescriptor(2).getDatatypeCoder().decodeString(fieldData)); + fieldData = fieldValues.getFieldData(3); + assertEquals(testVarchar, + statement.getFieldDescriptor().getFieldDescriptor(3).getDatatypeCoder().decodeString(fieldData)); + fieldData = fieldValues.getFieldData(4); + assertEquals(testBigInteger, + statement.getFieldDescriptor().getFieldDescriptor(4).getDatatypeCoder().decodeLong(fieldData)); + fieldData = fieldValues.getFieldData(5); + assertEquals(testInteger, + statement.getFieldDescriptor().getFieldDescriptor(5).getDatatypeCoder().decodeInt(fieldData)); + fieldData = fieldValues.getFieldData(6); + assertEquals(testShort, + statement.getFieldDescriptor().getFieldDescriptor(6).getDatatypeCoder().decodeShort(fieldData)); + fieldData = fieldValues.getFieldData(7); + assertEquals(testFloat, + statement.getFieldDescriptor().getFieldDescriptor(7).getDatatypeCoder().decodeFloat(fieldData), + 0); + fieldData = fieldValues.getFieldData(8); + assertEquals(testDouble, + statement.getFieldDescriptor().getFieldDescriptor(8).getDatatypeCoder().decodeDouble(fieldData), + 0); + fieldData = fieldValues.getFieldData(9); + short decodeShort = statement.getFieldDescriptor().getFieldDescriptor(9).getDatatypeCoder().decodeShort(fieldData); + BigDecimal decimal = BigDecimal.valueOf(decodeShort, -statement.getFieldDescriptor().getFieldDescriptor(9).getScale()); + float floatValue = decimal.floatValue(); + assertEquals(testSmallintNumeric, + floatValue, + 0.001); + fieldData = fieldValues.getFieldData(10); + int decodeInt = statement.getFieldDescriptor().getFieldDescriptor(10).getDatatypeCoder().decodeInt(fieldData); + decimal = BigDecimal.valueOf(decodeInt, -statement.getFieldDescriptor().getFieldDescriptor(10).getScale()); + double doubleValue = decimal.doubleValue(); + assertEquals(testSmallintNumeric, + doubleValue, + 0.001); + fieldData = fieldValues.getFieldData(11); + decodeInt = statement.getFieldDescriptor().getFieldDescriptor(11).getDatatypeCoder().decodeInt(fieldData); + decimal = BigDecimal.valueOf(decodeInt, -statement.getFieldDescriptor().getFieldDescriptor(11).getScale()); + doubleValue = decimal.doubleValue(); + assertEquals(testIntNumeric, + doubleValue, + 0); + fieldData = fieldValues.getFieldData(12); + decodeInt = statement.getFieldDescriptor().getFieldDescriptor(12).getDatatypeCoder().decodeInt(fieldData); + decimal = BigDecimal.valueOf(decodeInt, -statement.getFieldDescriptor().getFieldDescriptor(12).getScale()); + doubleValue = decimal.doubleValue(); + assertEquals(testIntNumeric2, + doubleValue, + 0); + fieldData = fieldValues.getFieldData(13); + long decodeLong = statement.getFieldDescriptor().getFieldDescriptor(13).getDatatypeCoder().decodeLong(fieldData); + decimal = BigDecimal.valueOf(decodeLong, -statement.getFieldDescriptor().getFieldDescriptor(13).getScale()); + doubleValue = decimal.doubleValue(); + assertEquals(testBigintNumeric, + doubleValue, + 0); + fieldData = fieldValues.getFieldData(14); + decodeLong = statement.getFieldDescriptor().getFieldDescriptor(14).getDatatypeCoder().decodeLong(fieldData); + decimal = BigDecimal.valueOf(decodeLong, -statement.getFieldDescriptor().getFieldDescriptor(14).getScale()); + doubleValue = decimal.doubleValue(); + assertEquals(testBigintNumeric2, + doubleValue, + 0); + fieldData = fieldValues.getFieldData(15); + assertEquals(testDate, + statement.getFieldDescriptor().getFieldDescriptor(15).getDatatypeCoder().decodeDate(fieldData)); + fieldData = fieldValues.getFieldData(16); + assertEquals(testTime, + statement.getFieldDescriptor().getFieldDescriptor(16).getDatatypeCoder().decodeTime(fieldData)); + fieldData = fieldValues.getFieldData(17); + assertEquals(testTimestamp, + statement.getFieldDescriptor().getFieldDescriptor(17).getDatatypeCoder().decodeTimestamp(fieldData)); + fieldData = fieldValues.getFieldData(18); + long blobID = statement.getFieldDescriptor().getFieldDescriptor(18).getDatatypeCoder().decodeLong(fieldData); + checkBlob(blobID, testBytes); + fieldData = fieldValues.getFieldData(19); + blobID = statement.getFieldDescriptor().getFieldDescriptor(19).getDatatypeCoder().decodeLong(fieldData); + checkBlob(blobID, testBytes); + fieldData = fieldValues.getFieldData(20); + blobID = statement.getFieldDescriptor().getFieldDescriptor(20).getDatatypeCoder().decodeLong(fieldData); + checkBlob(blobID, testBytes); + } + + @Test + public void testBatchWithBlobStream() throws Exception { + allocateTransaction(); + BatchParameterBuffer buffer = new BatchParameterBufferImpl(); + // Blobs are placed in a stream + buffer.addArgument(FbBatch.TAG_BLOB_POLICY, FbBatch.BLOB_STREAM); + FbBatch batch = db.createBatch(transaction, INSERT_QUERY_ONLY_BLOBS, buffer); + + GDSHelper h = new GDSHelper(db); + h.setCurrentTransaction(batch.getTransaction()); + + FBBlob b1 = new FBBlob(h, 1); + FBBlob b2 = new FBBlob(h, 2); + FBBlob b3 = new FBBlob(h, 3); + + FbMessageBuilder builder = new IMessageBuilderImpl(batch); + + builder.addBlob(0, b1.getBlobId()); + builder.addBlob(1, b2.getBlobId()); + builder.addBlob(2, b3.getBlobId()); + + // blobs + String d1 = "1111111111111111111"; + String d2 = "22222222222222222222"; + String d3 = "333333333333333333333333333333333333333333333333333333333333333"; + + builder.addBlobData(d1.getBytes(), b1.getBlobId()); + builder.addBlobData(d2.getBytes(), b2.getBlobId()); + builder.addBlobData(d3.getBytes(), b3.getBlobId()); + + batch.add(1, builder.getData()); + batch.addBlobStream(builder.getBlobStreamData()); + builder.clear(); + + FbBatchCompletionState execute = batch.execute(); + + System.out.println(execute.getAllStates()); + + assertThat("Expected successful batch execution", execute.getAllStates(), allOf( + startsWith("Summary"), + containsString("total=1 success=0 success(but no update info)=1"), + endsWith("\n"))); + + batch.getTransaction().commit(); + + allocateTransaction(); + + FbStatement statement = db.createStatement(transaction); + final SimpleStatementListener statementListener = new SimpleStatementListener(); + statement.addStatementListener(statementListener); + statement.prepare(SELECT_QUERY_ONLY_BLOBS); + statement.execute(RowValue.EMPTY_ROW_VALUE); + statement.fetchRows(1); + RowValue fieldValues = statementListener.getRows().get(0); + byte[] fieldData = fieldValues.getFieldData(0); + long blobID = statement.getFieldDescriptor().getFieldDescriptor(0).getDatatypeCoder().decodeLong(fieldData); + checkBlob(blobID, d1.getBytes()); + fieldData = fieldValues.getFieldData(1); + blobID = statement.getFieldDescriptor().getFieldDescriptor(1).getDatatypeCoder().decodeLong(fieldData); + checkBlob(blobID, d2.getBytes()); + fieldData = fieldValues.getFieldData(2); + blobID = statement.getFieldDescriptor().getFieldDescriptor(2).getDatatypeCoder().decodeLong(fieldData); + checkBlob(blobID, d3.getBytes()); + } + + @Test + public void testBatchWithSegmentedBlobs() throws Exception { + allocateTransaction(); + BatchParameterBuffer buffer = new BatchParameterBufferImpl(); + // Blobs are placed in a stream + buffer.addArgument(FbBatch.TAG_BLOB_POLICY, FbBatch.BLOB_STREAM); + FbBatch batch = db.createBatch(transaction, INSERT_QUERY_ONLY_BLOBS, buffer); + + GDSHelper h = new GDSHelper(db); + h.setCurrentTransaction(batch.getTransaction()); + + // Create blobs + FBBlob b1 = new FBBlob(h, 4242); + FBBlob b2 = new FBBlob(h, 242); + FBBlob b3 = new FBBlob(h, 42); + + FbMessageBuilder builder = new IMessageBuilderImpl(batch); + + // blobs + String blobSegment1 = INSERT_QUERY_WITHOUT_BLOBS; + String blobSegment2 = INSERT_QUERY_WITH_BLOBS; + String blobSegment3 = INSERT_QUERY_ONLY_BLOBS; + + BlobParameterBuffer bpb = new BlobParameterBufferImp(); + bpb.addArgument(ISCConstants.isc_bpb_type, ISCConstants.isc_bpb_type_segmented); + + long offset = builder.addBlobHeader(b1.getBlobId(), bpb); + builder.addBlobSegment(blobSegment1.getBytes(), offset, false); + builder.addBlobSegment("\n".getBytes(), offset, false); + builder.addBlobSegment(blobSegment2.getBytes(), offset, false); + builder.addBlobSegment("\n".getBytes(), offset, false); + builder.addBlobSegment(blobSegment3.getBytes(), offset, true); + + batch.addBlobStream(builder.getBlobStreamData()); + builder.clearBlobStream(); + + offset = builder.addBlobHeader(b2.getBlobId(), bpb); + builder.addBlobSegment(blobSegment1.getBytes(), offset, false); + builder.addBlobSegment("\n".getBytes(), offset, false); + builder.addBlobSegment(blobSegment2.getBytes(), offset, false); + builder.addBlobSegment("\n".getBytes(), offset, false); + builder.addBlobSegment(blobSegment3.getBytes(), offset, true); + + batch.addBlobStream(builder.getBlobStreamData()); + builder.clearBlobStream(); + + offset = builder.addBlobHeader(b3.getBlobId(), bpb); + builder.addBlobSegment(blobSegment1.getBytes(), offset, false); + builder.addBlobSegment("\n".getBytes(), offset, false); + builder.addBlobSegment(blobSegment2.getBytes(), offset, false); + builder.addBlobSegment("\n".getBytes(), offset, false); + builder.addBlobSegment(blobSegment3.getBytes(), offset, true); + + builder.addBlob(0, b1.getBlobId()); + builder.addBlob(1, b2.getBlobId()); + builder.addBlob(2, b3.getBlobId()); + + batch.addBlobStream(builder.getBlobStreamData()); + batch.add(1, builder.getData()); + builder.clear(); + + FbBatchCompletionState execute = batch.execute(); + + System.out.println(execute.getAllStates()); + + assertThat("Expected successful batch execution", execute.getAllStates(), allOf( + startsWith("Summary"), + containsString("total=1 success=0 success(but no update info)=1"), + endsWith("\n"))); + + batch.getTransaction().commit(); + + allocateTransaction(); + + FbStatement statement = db.createStatement(transaction); + final SimpleStatementListener statementListener = new SimpleStatementListener(); + statement.addStatementListener(statementListener); + statement.prepare(SELECT_QUERY_ONLY_BLOBS); + statement.execute(RowValue.EMPTY_ROW_VALUE); + statement.fetchRows(1); + + String allSegments = blobSegment1 + "\n" + blobSegment2 + "\n" + blobSegment3; + + RowValue fieldValues = statementListener.getRows().get(0); + byte[] fieldData = fieldValues.getFieldData(0); + long blobID = statement.getFieldDescriptor().getFieldDescriptor(0).getDatatypeCoder().decodeLong(fieldData); + checkBlob(blobID, allSegments.getBytes()); + fieldData = fieldValues.getFieldData(1); + blobID = statement.getFieldDescriptor().getFieldDescriptor(1).getDatatypeCoder().decodeLong(fieldData); + checkBlob(blobID, allSegments.getBytes()); + fieldData = fieldValues.getFieldData(2); + blobID = statement.getFieldDescriptor().getFieldDescriptor(2).getDatatypeCoder().decodeLong(fieldData); + checkBlob(blobID, allSegments.getBytes()); + } + + @Test + public void testMultipleMessagesBatchWithSegmentedBlobs() throws Exception { + allocateTransaction(); + BatchParameterBuffer buffer = new BatchParameterBufferImpl(); + // Blobs are placed in a stream + buffer.addArgument(FbBatch.TAG_BLOB_POLICY, FbBatch.BLOB_STREAM); + FbBatch batch = db.createBatch(transaction, INSERT_QUERY_ONLY_BLOBS, buffer); + + GDSHelper h = new GDSHelper(db); + h.setCurrentTransaction(batch.getTransaction()); + + // Create blobs + FBBlob b1 = new FBBlob(h, 4242); + FBBlob b2 = new FBBlob(h, 242); + FBBlob b3 = new FBBlob(h, 42); + + FbMessageBuilder builder = new IMessageBuilderImpl(batch); + + // blobs + String blobSegment1 = INSERT_QUERY_WITHOUT_BLOBS; + String blobSegment2 = INSERT_QUERY_WITH_BLOBS; + String blobSegment3 = INSERT_QUERY_ONLY_BLOBS; + + BlobParameterBuffer bpb = new BlobParameterBufferImp(); + bpb.addArgument(ISCConstants.isc_bpb_type, ISCConstants.isc_bpb_type_segmented); + + long offset = builder.addBlobHeader(b1.getBlobId(), bpb); + builder.addBlobSegment(blobSegment1.getBytes(), offset, false); + builder.addBlobSegment("\n".getBytes(), offset, false); + builder.addBlobSegment(blobSegment2.getBytes(), offset, false); + builder.addBlobSegment("\n".getBytes(), offset, false); + builder.addBlobSegment(blobSegment3.getBytes(), offset, true); + + batch.addBlobStream(builder.getBlobStreamData()); + builder.clearBlobStream(); + + offset = builder.addBlobHeader(b2.getBlobId(), bpb); + builder.addBlobSegment(blobSegment1.getBytes(), offset, false); + builder.addBlobSegment("\n".getBytes(), offset, false); + builder.addBlobSegment(blobSegment2.getBytes(), offset, false); + builder.addBlobSegment("\n".getBytes(), offset, false); + builder.addBlobSegment(blobSegment3.getBytes(), offset, true); + + batch.addBlobStream(builder.getBlobStreamData()); + builder.clearBlobStream(); + + offset = builder.addBlobHeader(b3.getBlobId(), bpb); + builder.addBlobSegment(blobSegment1.getBytes(), offset, false); + builder.addBlobSegment("\n".getBytes(), offset, false); + builder.addBlobSegment(blobSegment2.getBytes(), offset, false); + builder.addBlobSegment("\n".getBytes(), offset, false); + builder.addBlobSegment(blobSegment3.getBytes(), offset, true); + + builder.addBlob(0, b1.getBlobId()); + builder.addBlob(1, b2.getBlobId()); + builder.addBlob(2, b3.getBlobId()); + + batch.addBlobStream(builder.getBlobStreamData()); + batch.add(1, builder.getData()); + builder.clearBlobStream(); + builder.clear(); + + // Create blobs + FBBlob b4 = new FBBlob(h, 34242); + FBBlob b5 = new FBBlob(h, 3242); + FBBlob b6 = new FBBlob(h, 342); + + offset = builder.addBlobHeader(b4.getBlobId(), bpb); + builder.addBlobSegment(blobSegment1.getBytes(), offset, false); + builder.addBlobSegment("\n".getBytes(), offset, false); + builder.addBlobSegment(blobSegment2.getBytes(), offset, false); + builder.addBlobSegment("\n".getBytes(), offset, false); + builder.addBlobSegment(blobSegment3.getBytes(), offset, true); + + batch.addBlobStream(builder.getBlobStreamData()); + builder.clearBlobStream(); + + offset = builder.addBlobHeader(b5.getBlobId(), bpb); + builder.addBlobSegment(blobSegment1.getBytes(), offset, false); + builder.addBlobSegment("\n".getBytes(), offset, false); + builder.addBlobSegment(blobSegment2.getBytes(), offset, false); + builder.addBlobSegment("\n".getBytes(), offset, false); + builder.addBlobSegment(blobSegment3.getBytes(), offset, true); + + batch.addBlobStream(builder.getBlobStreamData()); + builder.clearBlobStream(); + + offset = builder.addBlobHeader(b6.getBlobId(), bpb); + builder.addBlobSegment(blobSegment1.getBytes(), offset, false); + builder.addBlobSegment("\n".getBytes(), offset, false); + builder.addBlobSegment(blobSegment2.getBytes(), offset, false); + builder.addBlobSegment("\n".getBytes(), offset, false); + builder.addBlobSegment(blobSegment3.getBytes(), offset, true); + + builder.addBlob(0, b4.getBlobId()); + builder.addBlob(1, b5.getBlobId()); + builder.addBlob(2, b6.getBlobId()); + + batch.addBlobStream(builder.getBlobStreamData()); + batch.add(1, builder.getData()); + builder.clear(); + builder.clearBlobStream(); + + // Create blobs + FBBlob b7 = new FBBlob(h, 14242); + FBBlob b8 = new FBBlob(h, 1242); + FBBlob b9 = new FBBlob(h, 142); + + offset = builder.addBlobHeader(b7.getBlobId(), bpb); + builder.addBlobSegment(blobSegment1.getBytes(), offset, false); + builder.addBlobSegment("\n".getBytes(), offset, false); + builder.addBlobSegment(blobSegment2.getBytes(), offset, false); + builder.addBlobSegment("\n".getBytes(), offset, false); + builder.addBlobSegment(blobSegment3.getBytes(), offset, true); + + batch.addBlobStream(builder.getBlobStreamData()); + builder.clearBlobStream(); + + offset = builder.addBlobHeader(b8.getBlobId(), bpb); + builder.addBlobSegment(blobSegment1.getBytes(), offset, false); + builder.addBlobSegment("\n".getBytes(), offset, false); + builder.addBlobSegment(blobSegment2.getBytes(), offset, false); + builder.addBlobSegment("\n".getBytes(), offset, false); + builder.addBlobSegment(blobSegment3.getBytes(), offset, true); + + batch.addBlobStream(builder.getBlobStreamData()); + builder.clearBlobStream(); + + offset = builder.addBlobHeader(b9.getBlobId(), bpb); + builder.addBlobSegment(blobSegment1.getBytes(), offset, false); + builder.addBlobSegment("\n".getBytes(), offset, false); + builder.addBlobSegment(blobSegment2.getBytes(), offset, false); + builder.addBlobSegment("\n".getBytes(), offset, false); + builder.addBlobSegment(blobSegment3.getBytes(), offset, true); + + builder.addBlob(0, b7.getBlobId()); + builder.addBlob(1, b8.getBlobId()); + builder.addBlob(2, b9.getBlobId()); + + batch.addBlobStream(builder.getBlobStreamData()); + batch.add(1, builder.getData()); + builder.clear(); + builder.clearBlobStream(); + + FbBatchCompletionState execute = batch.execute(); + + System.out.println(execute.getAllStates()); + + assertThat("Expected successful batch execution", execute.getAllStates(), allOf( + startsWith("Summary"), + containsString("total=3 success=0 success(but no update info)=3"), + endsWith("\n"))); + + batch.getTransaction().commit(); + + allocateTransaction(); + + FbStatement statement = db.createStatement(transaction); + final SimpleStatementListener statementListener = new SimpleStatementListener(); + statement.addStatementListener(statementListener); + statement.prepare(SELECT_QUERY_ONLY_BLOBS); + statement.execute(RowValue.EMPTY_ROW_VALUE); + statement.fetchRows(1); + statement.fetchRows(1); + + String allSegments = blobSegment1 + "\n" + blobSegment2 + "\n" + blobSegment3; + + RowValue fieldValues = statementListener.getRows().get(1); + byte[] fieldData = fieldValues.getFieldData(0); + long blobID = statement.getFieldDescriptor().getFieldDescriptor(0).getDatatypeCoder().decodeLong(fieldData); + checkBlob(blobID, allSegments.getBytes()); + fieldData = fieldValues.getFieldData(1); + blobID = statement.getFieldDescriptor().getFieldDescriptor(1).getDatatypeCoder().decodeLong(fieldData); + checkBlob(blobID, allSegments.getBytes()); + fieldData = fieldValues.getFieldData(2); + blobID = statement.getFieldDescriptor().getFieldDescriptor(2).getDatatypeCoder().decodeLong(fieldData); + checkBlob(blobID, allSegments.getBytes()); + } + + @Test + public void testBatchWithRegisteredBlobs() throws Exception { + allocateTransaction(); + BatchParameterBuffer buffer = new BatchParameterBufferImpl(); + // Blobs are placed in a stream + buffer.addArgument(FbBatch.TAG_BLOB_POLICY, FbBatch.BLOB_STREAM); + FbBatch batch = db.createBatch(transaction, INSERT_QUERY_ONLY_BLOBS, buffer); + + GDSHelper h = new GDSHelper(db); + h.setCurrentTransaction(batch.getTransaction()); + + // Create blobs + FBBlob b1 = new FBBlob(h, 4242); + FBBlob b2 = new FBBlob(h, 242); + FBBlob b3 = new FBBlob(h, 42); + + FbBlob regBlob1 = h.createBlob(false); + FbBlob regBlob2 = h.createBlob(false); + FbBlob regBlob3 = h.createBlob(false); + + regBlob1.putSegment(INSERT_QUERY_WITH_BLOBS.getBytes()); + regBlob1.close(); + regBlob2.putSegment(INSERT_QUERY_WITHOUT_BLOBS.getBytes()); + regBlob2.close(); + regBlob3.putSegment(INSERT_QUERY_ONLY_BLOBS.getBytes()); + regBlob3.close(); + + FbMessageBuilder builder = new IMessageBuilderImpl(batch); + + builder.addBlob(0, b1.getBlobId()); + builder.addBlob(1, b2.getBlobId()); + builder.addBlob(2, b3.getBlobId()); + + // Register blobs + batch.registerBlob(regBlob1.getBlobId(), b1.getBlobId()); + batch.registerBlob(regBlob2.getBlobId(), b2.getBlobId()); + batch.registerBlob(regBlob3.getBlobId(), b3.getBlobId()); + + batch.add(1, builder.getData()); + builder.clear(); + + FbBatchCompletionState execute = batch.execute(); + + System.out.println(execute.getAllStates()); + + assertThat("Expected successful batch execution", execute.getAllStates(), allOf( + startsWith("Summary"), + containsString("total=1 success=0 success(but no update info)=1"), + endsWith("\n"))); + + batch.getTransaction().commit(); + + allocateTransaction(); + + FbStatement statement = db.createStatement(transaction); + final SimpleStatementListener statementListener = new SimpleStatementListener(); + statement.addStatementListener(statementListener); + statement.prepare(SELECT_QUERY_ONLY_BLOBS); + statement.execute(RowValue.EMPTY_ROW_VALUE); + statement.fetchRows(1); + + RowValue fieldValues = statementListener.getRows().get(0); + byte[] fieldData = fieldValues.getFieldData(0); + long blobID = statement.getFieldDescriptor().getFieldDescriptor(0).getDatatypeCoder().decodeLong(fieldData); + checkBlob(blobID, INSERT_QUERY_WITH_BLOBS.getBytes()); + fieldData = fieldValues.getFieldData(1); + blobID = statement.getFieldDescriptor().getFieldDescriptor(1).getDatatypeCoder().decodeLong(fieldData); + checkBlob(blobID, INSERT_QUERY_WITHOUT_BLOBS.getBytes()); + fieldData = fieldValues.getFieldData(2); + blobID = statement.getFieldDescriptor().getFieldDescriptor(2).getDatatypeCoder().decodeLong(fieldData); + checkBlob(blobID, INSERT_QUERY_ONLY_BLOBS.getBytes()); + } + + public void checkBlob(long blobID, byte[] originalContent) throws Exception { + // Use sufficiently large value so that multiple segments are used + final int requiredSize = originalContent.length; + final FbBlob blob = db.createBlobForInput(transaction, null, blobID); + blob.open(); + ByteArrayOutputStream bos = new ByteArrayOutputStream(requiredSize); + while (!blob.isEof()) { + bos.write(blob.getSegment(blob.getMaximumSegmentSize())); + } + blob.close(); + byte[] result = bos.toByteArray(); + assertEquals("Unexpected length read from blob", originalContent.length, result.length); + assertTrue("Unexpected blob content", validateBlobContent(result, originalContent, requiredSize)); + } + + /** + * Checks if the blob content is of the required size and matches the expected content based on baseContent. + * + * @param blobContent Blob content + * @param baseContent Base content + * @param requiredSize Required size + * @return true content matches, false otherwise + */ + protected boolean validateBlobContent(byte[] blobContent, byte[] baseContent, int requiredSize) { + if (blobContent.length != requiredSize) return false; + for (int index = 0; index < blobContent.length; index++) { + if (blobContent[index] != baseContent[index % baseContent.length]) return false; + } + return true; + } +} diff --git a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/TestIBlobImpl.java b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/TestIBlobImpl.java new file mode 100644 index 0000000000..4d73796f9d --- /dev/null +++ b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/TestIBlobImpl.java @@ -0,0 +1,449 @@ +/* + * Firebird Open Source JavaEE Connector - JDBC Driver + * + * Distributable under LGPL license. + * You may obtain a copy of the License at http://www.gnu.org/copyleft/lgpl.html + * + * This program 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 + * LGPL License for more details. + * + * This file was created by members of the firebird development team. + * All individual contributions remain the Copyright (C) of those + * individuals. Contributors to this file are either listed here or + * can be obtained from a source control history command. + * + * All rights reserved. + */ +package org.firebirdsql.nativeoo.gds.ng; + +import org.firebirdsql.gds.BlobParameterBuffer; +import org.firebirdsql.gds.ISCConstants; +import org.firebirdsql.gds.impl.GDSFactory; +import org.firebirdsql.gds.impl.GDSType; +import org.firebirdsql.gds.ng.*; +import org.firebirdsql.gds.ng.fields.RowValue; +import org.firebirdsql.gds.ng.jna.AbstractNativeDatabaseFactory; +import org.firebirdsql.gds.ng.wire.SimpleStatementListener; +import org.junit.*; +import org.junit.rules.ExpectedException; + +import java.io.ByteArrayOutputStream; +import java.sql.SQLException; +import java.sql.SQLNonTransientException; +import java.util.Arrays; + +import static org.firebirdsql.common.matchers.SQLExceptionMatchers.*; +import static org.hamcrest.CoreMatchers.allOf; +import static org.hamcrest.CoreMatchers.startsWith; +import static org.junit.Assert.*; +import static org.junit.Assume.assumeTrue; + +/** + * Test for blobs in the OO API implementation {@link org.firebirdsql.nativeoo.gds.ng.IBlobImpl}. + *

+ * This class has copied tests from {@link org.firebirdsql.gds.ng.wire.version10.TestV10OutputBlob} and + * {@link org.firebirdsql.gds.ng.wire.version10.TestV10InputBlob}. + *

+ * + * @author Mark Rotteveel + * @since 4.0 + */ +public class TestIBlobImpl extends BaseTestBlob { + + private static final String gdsType = "FBOONATIVE"; + + @Rule + public final ExpectedException expectedException = ExpectedException.none(); + + private AbstractNativeOODatabaseFactory factory; + + @Before + public void setFactory() { + factory = (AbstractNativeOODatabaseFactory) GDSFactory.getDatabaseFactoryForType(GDSType.getType(gdsType)); + } + + /** + * Tests retrieval of a blob (what goes in is what comes out). + */ + @Test + public void testInputBlobRetrieval() throws Exception { + final int testId = 1; + final byte[] baseContent = generateBaseContent(); + // Use sufficiently large value so that multiple segments are used + final int requiredSize = 4 * Short.MAX_VALUE; + populateBlob(testId, baseContent, requiredSize); + + try (FbDatabase db = createDatabaseConnection()) { + try { + long blobId = getBlobId(testId, db); + + final FbBlob blob = db.createBlobForInput(transaction, null, blobId); + blob.open(); + ByteArrayOutputStream bos = new ByteArrayOutputStream(requiredSize); + while (!blob.isEof()) { + bos.write(blob.getSegment(blob.getMaximumSegmentSize())); + } + blob.close(); + statement.close(); + byte[] result = bos.toByteArray(); + assertEquals("Unexpected length read from blob", requiredSize, result.length); + assertTrue("Unexpected blob content", validateBlobContent(result, baseContent, requiredSize)); + } finally { + if (transaction != null) transaction.commit(); + } + } + } + + /** + * Tests absolute seek on a segmented blob. Expectation: fails with an exception + */ + @Test + public void testInputBlobSeek_segmented() throws Exception { + final int testId = 1; + final byte[] baseContent = generateBaseContent(); + // Use sufficiently large value so that multiple segments are used + final int requiredSize = 4 * Short.MAX_VALUE; + populateBlob(testId, baseContent, requiredSize); + + try (IDatabaseImpl db = createDatabaseConnection()) { + try { + long blobId = getBlobId(testId, db); + + // NOTE: What matters is if the blob on the server is stream or segment + final FbBlob blob = db.createBlobForInput(transaction, null, blobId); + blob.open(); + int offset = baseContent.length / 2; + + expectedException.expect(SQLException.class); + expectedException.expect(allOf( + errorCodeEquals(ISCConstants.isc_bad_segstr_type), + message(startsWith(getFbMessage(ISCConstants.isc_bad_segstr_type))) + )); + + blob.seek(offset, FbBlob.SeekMode.ABSOLUTE); + } finally { + if (transaction != null) transaction.commit(); + } + } + } + + /** + * Tests absolute seek on a stream blob. + */ + @Test + public void testInputBlobSeek_streamed() throws Exception { + final int testId = 1; + final byte[] baseContent = generateBaseContent(); + // Use sufficiently large value so that multiple segments are used + final int requiredSize = 200; + populateStreamBlob(testId, baseContent, requiredSize); + + try (IDatabaseImpl db = createDatabaseConnection()) { + try { + long blobId = getBlobId(testId, db); + + // NOTE: What matters is if the blob on the server is stream or segment + final FbBlob blob = db.createBlobForInput(transaction, null, blobId); + blob.open(); + final int offset = requiredSize / 2; + + blob.seek(offset, FbBlob.SeekMode.ABSOLUTE); + byte[] segment = blob.getSegment(100); + byte[] expected = Arrays.copyOfRange(baseContent, offset, offset + 100); + + blob.close(); + statement.close(); + assertEquals("Unexpected length read from blob", 100, segment.length); + assertArrayEquals("Unexpected segment content", expected, segment); + } finally { + if (transaction != null) transaction.commit(); + } + } + } + + /** + * Tests reopen of input blob is allowed. + */ + @Test + public void testInputBlobReopen() throws Exception { + final int testId = 1; + final byte[] baseContent = generateBaseContent(); + final int requiredSize = 256; + populateBlob(testId, baseContent, requiredSize); + + try (IDatabaseImpl db = createDatabaseConnection()) { + try { + long blobId = getBlobId(testId, db); + + final FbBlob blob = db.createBlobForInput(transaction, null, blobId); + blob.open(); + ByteArrayOutputStream bos = new ByteArrayOutputStream(requiredSize); + while (!blob.isEof()) { + bos.write(blob.getSegment(blob.getMaximumSegmentSize())); + } + blob.close(); + // Reopen + blob.open(); + bos = new ByteArrayOutputStream(requiredSize); + while (!blob.isEof()) { + bos.write(blob.getSegment(blob.getMaximumSegmentSize())); + } + blob.close(); + + statement.close(); + byte[] result = bos.toByteArray(); + assertEquals("Unexpected length read from blob", requiredSize, result.length); + assertTrue("Unexpected blob content", validateBlobContent(result, baseContent, requiredSize)); + } finally { + if (transaction != null) transaction.commit(); + } + } + } + + /** + * Tests double open of input blob is not allowed. + */ + @Test + public void testInputBlobDoubleOpen() throws Exception { + expectedException.expect(SQLNonTransientException.class); + expectedException.expect(allOf( + errorCodeEquals(ISCConstants.isc_no_segstr_close), + fbMessageStartsWith(ISCConstants.isc_no_segstr_close) + )); + + final int testId = 1; + final byte[] baseContent = generateBaseContent(); + final int requiredSize = 256; + populateBlob(testId, baseContent, requiredSize); + + try (IDatabaseImpl db = createDatabaseConnection()) { + try { + long blobId = getBlobId(testId, db); + + final FbBlob blob = db.createBlobForInput(transaction, null, blobId); + blob.open(); + // Double open + blob.open(); + } finally { + if (transaction != null) transaction.commit(); + } + } + } + + /** + * Tests storage of a blob (what goes in is what comes out). + */ + @Test + public void testOutputBlobStorage() throws Exception { + final int testId = 1; + final byte[] baseContent = generateBaseContent(); + // Use sufficiently large value so that multiple segments are used + final int requiredSize = 4 * Short.MAX_VALUE; + final byte[] testBytes = generateBlobContent(baseContent, requiredSize); + + try (IDatabaseImpl db = createDatabaseConnection()) { + writeBlob(testId, testBytes, db, null); + } + + assertTrue("Unexpected blob content", validateBlob(testId, baseContent, requiredSize)); + } + + /** + * Tests storage of a stream blob (what goes in is what comes out). + */ + @Test + public void testOutputBlobStorage_Stream() throws Exception { + final int testId = 1; + final byte[] baseContent = generateBaseContent(); + // Use sufficiently large value so that multiple segments are used + final int requiredSize = 4 * Short.MAX_VALUE; + final byte[] testBytes = generateBlobContent(baseContent, requiredSize); + + try (IDatabaseImpl db = createDatabaseConnection()) { + final BlobParameterBuffer blobParameterBuffer = db.createBlobParameterBuffer(); + blobParameterBuffer.addArgument(BlobParameterBuffer.TYPE, BlobParameterBuffer.TYPE_STREAM); + writeBlob(testId, testBytes, db, blobParameterBuffer); + } + + assertTrue("Unexpected blob content", validateBlob(testId, baseContent, requiredSize)); + } + + /** + * Test if blob is not eof after open. + */ + @Test + public void testOutputBlobIsEof_afterOpen() throws Exception { + try (IDatabaseImpl db = createDatabaseConnection()) { + final FbTransaction transaction = getTransaction(db); + try { + FbBlob blob = db.createBlobForOutput(transaction, null); + assumeTrue("Output blob before open should be eof", blob.isEof()); + + blob.open(); + assertFalse("Output blob after open should not be eof", blob.isEof()); + } finally { + transaction.commit(); + } + } + } + + /** + * Test if blob is eof after close. + */ + @Test + public void testOutputBlobIsEof_afterClose() throws Exception { + try (IDatabaseImpl db = createDatabaseConnection()) { + final FbTransaction transaction = getTransaction(db); + try { + FbBlob blob = db.createBlobForOutput(transaction, null); + assumeTrue("Output blob before open should be eof", blob.isEof()); + blob.open(); + + blob.close(); + assertTrue("Output blob after close should be eof", blob.isEof()); + } finally { + transaction.commit(); + } + } + } + + /** + * Test if blob is eof after cancel. + */ + @Test + public void testOutputBlobIsEof_afterCancel() throws Exception { + try (IDatabaseImpl db = createDatabaseConnection()) { + final FbTransaction transaction = getTransaction(db); + try { + FbBlob blob = db.createBlobForOutput(transaction, null); + assumeTrue("Output blob before open should be eof", blob.isEof()); + blob.open(); + + blob.cancel(); + assertTrue("Output blob after cancel should be eof", blob.isEof()); + } finally { + transaction.commit(); + } + } + } + + /** + * Test whether a cancelled blob cannot be used (indicating it was indeed cancelled). + */ + @Test + public void testOutputBlobUsingCancelledBlob() throws Exception { + expectedException.expect(SQLException.class); + expectedException.expect(allOf( + errorCodeEquals(ISCConstants.isc_bad_segstr_id), + message(startsWith(getFbMessage(ISCConstants.isc_bad_segstr_id))) + )); + + final int testId = 1; + final byte[] baseContent = generateBaseContent(); + final int requiredSize = 256; + final byte[] testBytes = generateBlobContent(baseContent, requiredSize); + + try (IDatabaseImpl db = createDatabaseConnection()) { + final SimpleStatementListener listener = new SimpleStatementListener(); + final FbTransaction transaction = getTransaction(db); + try { + final FbStatement statement = db.createStatement(transaction); + statement.addStatementListener(listener); + final FbBlob blob = db.createBlobForOutput(transaction, null); + blob.open(); + int bytesWritten = 0; + while (bytesWritten < testBytes.length) { + // TODO the interface for writing blobs should be simpler + byte[] buffer = new byte[Math.min(blob.getMaximumSegmentSize(), testBytes.length - bytesWritten)]; + System.arraycopy(testBytes, bytesWritten, buffer, 0, buffer.length); + blob.putSegment(buffer); + bytesWritten += buffer.length; + } + + blob.cancel(); + + statement.prepare(INSERT_BLOB_TABLE); + final DatatypeCoder datatypeCoder = db.getDatatypeCoder(); + statement.execute(RowValue.of(datatypeCoder.encodeInt(testId), datatypeCoder.encodeLong(blob.getBlobId()))); + statement.close(); + } finally { + transaction.commit(); + } + } + } + + /** + * Test reopen is not allowed. + */ + @Test + public void testOutputBlobReopen() throws Exception { + expectedException.expect(SQLNonTransientException.class); + expectedException.expect(allOf( + errorCodeEquals(ISCConstants.isc_segstr_no_op), + fbMessageStartsWith(ISCConstants.isc_segstr_no_op) + )); + + final byte[] baseContent = generateBaseContent(); + final int requiredSize = 256; + final byte[] testBytes = generateBlobContent(baseContent, requiredSize); + + try (IDatabaseImpl db = createDatabaseConnection()) { + final FbTransaction transaction = getTransaction(db); + try { + final FbBlob blob = db.createBlobForOutput(transaction, null); + blob.open(); + int bytesWritten = 0; + while (bytesWritten < testBytes.length) { + // TODO the interface for writing blobs should be simpler + byte[] buffer = new byte[Math.min(blob.getMaximumSegmentSize(), testBytes.length - bytesWritten)]; + System.arraycopy(testBytes, bytesWritten, buffer, 0, buffer.length); + blob.putSegment(buffer); + bytesWritten += buffer.length; + } + blob.close(); + + // Reopen + blob.open(); + } finally { + transaction.commit(); + } + } + } + + /** + * Test double open is not allowed. + */ + @Test + public void testOutputBlobDoubleOpen() throws Exception { + expectedException.expect(SQLNonTransientException.class); + expectedException.expect(allOf( + errorCodeEquals(ISCConstants.isc_segstr_no_op), + fbMessageStartsWith(ISCConstants.isc_segstr_no_op) + )); + + try (IDatabaseImpl db = createDatabaseConnection()) { + final FbTransaction transaction = getTransaction(db); + try { + final FbBlob blob = db.createBlobForOutput(transaction, null); + blob.open(); + blob.open(); + } finally { + transaction.commit(); + } + } + } + + @Override + protected IDatabaseImpl createFbDatabase(FbConnectionProperties connectionInfo) throws SQLException { + final IDatabaseImpl db = (IDatabaseImpl) factory.connect(connectionInfo); + db.attach(); + return db; + } + + @Override + protected IDatabaseImpl createDatabaseConnection() throws SQLException { + return (IDatabaseImpl) super.createDatabaseConnection(); + } +} diff --git a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/TestIDatabaseImpl.java b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/TestIDatabaseImpl.java new file mode 100644 index 0000000000..b8d3b72a12 --- /dev/null +++ b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/TestIDatabaseImpl.java @@ -0,0 +1,304 @@ +package org.firebirdsql.nativeoo.gds.ng; + +import org.firebirdsql.common.FBTestProperties; +import org.firebirdsql.gds.ISCConstants; +import org.firebirdsql.gds.TransactionParameterBuffer; +import org.firebirdsql.gds.impl.GDSFactory; +import org.firebirdsql.gds.impl.GDSServerVersion; +import org.firebirdsql.gds.impl.GDSType; +import org.firebirdsql.gds.impl.TransactionParameterBufferImpl; +import org.firebirdsql.gds.impl.nativeoo.FbOOEmbeddedGDSFactoryPlugin; +import org.firebirdsql.gds.ng.FbConnectionProperties; +import org.firebirdsql.gds.ng.FbDatabase; +import org.firebirdsql.gds.ng.FbTransaction; +import org.firebirdsql.gds.ng.TransactionState; +import org.firebirdsql.gds.ng.jna.AbstractNativeDatabaseFactory; +import org.firebirdsql.jdbc.SQLStateConstants; +import org.firebirdsql.management.FBManager; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; + +import java.io.File; +import java.sql.SQLException; + +import static org.firebirdsql.common.FBTestProperties.*; +import static org.firebirdsql.common.FBTestProperties.DB_PASSWORD; +import static org.firebirdsql.common.FBTestProperties.getDatabasePath; +import static org.firebirdsql.common.matchers.SQLExceptionMatchers.*; +import static org.firebirdsql.common.matchers.SQLExceptionMatchers.getFbMessage; +import static org.firebirdsql.util.FirebirdSupportInfo.supportInfoFor; +import static org.hamcrest.CoreMatchers.*; +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.CoreMatchers.not; +import static org.junit.Assert.*; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assume.assumeThat; +import static org.junit.Assume.assumeTrue; + +public class TestIDatabaseImpl { + + // TODO Assert in tests need to be checked (and more need to be added) + + @Rule + public final ExpectedException expectedException = ExpectedException.none(); + + private static final String gdsType = "FBOONATIVE"; + + private final AbstractNativeOODatabaseFactory factory = + (AbstractNativeOODatabaseFactory) GDSFactory.getDatabaseFactoryForType(GDSType.getType(gdsType)); + private final FbConnectionProperties connectionInfo; + { + connectionInfo = new FbConnectionProperties(); + connectionInfo.setServerName(FBTestProperties.DB_SERVER_URL); + connectionInfo.setPortNumber(FBTestProperties.DB_SERVER_PORT); + connectionInfo.setUser(DB_USER); + connectionInfo.setPassword(DB_PASSWORD); + connectionInfo.setDatabaseName(FBTestProperties.getDatabasePath()); + connectionInfo.setEncoding("NONE"); + } + + public static FBManager createFBManager() { + return new FBManager(GDSType.getType(gdsType)); + } + + @Test + public void testBasicAttach() throws Exception { + FBManager fbManager = createFBManager(); + defaultDatabaseSetUp(fbManager); + try (IDatabaseImpl db = (IDatabaseImpl) factory.connect(connectionInfo)) { + db.attach(); + + assertTrue("Expected isAttached() to return true", db.isAttached()); + assertNotNull("Expected version string to be not null", db.getServerVersion()); + assertNotEquals("Expected version should not be invalid", GDSServerVersion.INVALID_VERSION, db.getServerVersion()); + } finally { + defaultDatabaseTearDown(fbManager); + } + } + + @Test + public void doubleAttach() throws Exception { + expectedException.expect(SQLException.class); + expectedException.expectMessage(equalTo("Already attached to a database")); + + FBManager fbManager = createFBManager(); + defaultDatabaseSetUp(fbManager); + + try (IDatabaseImpl db = (IDatabaseImpl) factory.connect(connectionInfo)) { + db.attach(); + + //Second attach should throw exception + db.attach(); + } finally { + defaultDatabaseTearDown(fbManager); + } + } + + @Test + public void basicStatusProcessing_wrongLogin() throws Exception { + assumeThat("Embedded on windows does not use authentication", + FBTestProperties.GDS_TYPE, is(not(FbOOEmbeddedGDSFactoryPlugin.EMBEDDED_TYPE_NAME))); + // set invalid password + connectionInfo.setPassword("abcd"); + try (IDatabaseImpl db = (IDatabaseImpl) factory.connect(connectionInfo)) { + + expectedException.expect(allOf( + isA(FbException.class), + message(startsWith(getFbMessage(ISCConstants.isc_login))), + errorCode(equalTo(ISCConstants.isc_login)) + )); + + db.attach(); + } + } + + @Test + public void testBasicStatusProcessing_wrongDatabase() throws Exception { + // set invalid database + final String invalidDatabaseName = FBTestProperties.getDatabasePath() + "doesnotexist"; + connectionInfo.setDatabaseName(invalidDatabaseName); + try (IDatabaseImpl db = (IDatabaseImpl) factory.connect(connectionInfo)) { + + expectedException.expect(allOf( + isA(SQLException.class), + // TODO Error parameter is platform dependent + anyOf( + message(startsWith(getFbMessage(ISCConstants.isc_io_error, "CreateFile (open)", + invalidDatabaseName))), + message(startsWith(getFbMessage(ISCConstants.isc_io_error, "CreateFile (open)", + invalidDatabaseName.toUpperCase()))), + message(startsWith(getFbMessage(ISCConstants.isc_io_error, "open", + invalidDatabaseName))), + message(startsWith(getFbMessage(ISCConstants.isc_io_error, "open", + invalidDatabaseName.toUpperCase()))) + ), + errorCode(equalTo(ISCConstants.isc_io_error)) + )); + + db.attach(); + } + } + + /** + * Tests creating and subsequently dropping a database + */ + @Test + public void testBasicCreateAndDrop() throws Exception { + connectionInfo.getExtraDatabaseParameters() + .addArgument(ISCConstants.isc_dpb_sql_dialect, 3); + IDatabaseImpl db = (IDatabaseImpl) factory.connect(connectionInfo); + File dbFile = new File(connectionInfo.getDatabaseName()); + try { + db.createDatabase(); + assertTrue("Database should be attached after create", db.isAttached()); + assertTrue("Expected database file to exist (NOTE: only works on localhost)", + dbFile.exists() || !FBTestProperties.DB_SERVER_URL.equalsIgnoreCase("localhost") ); + + db.dropDatabase(); + assertFalse("Database should be detached after drop", db.isAttached()); + assertFalse("Expected database file to have been removed after drop", dbFile.exists()); + } finally { + safelyClose(db); + if (dbFile.exists()) { + dbFile.delete(); + } + } + } + + @Test + public void testDrop_NotAttached() throws Exception { + expectedException.expect(SQLException.class); + expectedException.expectMessage(startsWith("The connection is not attached to a database")); + expectedException.expect(sqlStateEquals(SQLStateConstants.SQL_STATE_CONNECTION_ERROR)); + + FBManager fbManager = createFBManager(); + defaultDatabaseSetUp(fbManager); + try { + IDatabaseImpl db = (IDatabaseImpl) factory.connect(connectionInfo); + db.dropDatabase(); + } finally { + defaultDatabaseTearDown(fbManager); + } + } + + @Test + public void testDetach_NotConnected() throws Exception { + IDatabaseImpl db = (IDatabaseImpl) factory.connect(connectionInfo); + + // Note: the error is different from the one in the pure java implementation as we cannot discern between + // not connected and not attached + expectedException.expect(SQLException.class); + expectedException.expectMessage(startsWith("The connection is not attached to a database")); + expectedException.expect(sqlStateEquals(SQLStateConstants.SQL_STATE_CONNECTION_ERROR)); + + db.close(); + } + + @Test + public void testBasicDetach() throws Exception { + FBManager fbManager = createFBManager(); + defaultDatabaseSetUp(fbManager); + try { + IDatabaseImpl db = (IDatabaseImpl) factory.connect(connectionInfo); + try { + db.attach(); + + db.close(); + + assertFalse("Expected database not attached", db.isAttached()); + } finally { + safelyClose(db); + } + } finally { + defaultDatabaseTearDown(fbManager); + } + } + + @Test + public void testDetach_openTransactions() throws Exception { + FBManager fbManager = createFBManager(); + defaultDatabaseSetUp(fbManager); + + try { + IDatabaseImpl db = (IDatabaseImpl) factory.connect(connectionInfo); + FbTransaction transaction = null; + try { + db.attach(); + // Starting an active transaction + transaction = getTransaction(db); + + expectedException.expect(allOf( + errorCodeEquals(ISCConstants.isc_open_trans), + message(startsWith(getFbMessage(ISCConstants.isc_open_trans, "1"))) + )); + + db.close(); + } finally { + if (transaction != null && transaction.getState() == TransactionState.ACTIVE) { + transaction.commit(); + } + safelyClose(db); + } + } finally { + defaultDatabaseTearDown(fbManager); + } + } + + @Test + public void testCancelOperation_abortSupported() throws Exception { + FBManager fbManager = createFBManager(); + defaultDatabaseSetUp(fbManager); + try { + IDatabaseImpl db = (IDatabaseImpl) factory.connect(connectionInfo); + try { + db.attach(); + assumeTrue("expected database attached", db.isAttached()); + assumeTrue("Test requires cancel support", supportInfoFor(db).supportsCancelOperation()); + + db.cancelOperation(ISCConstants.fb_cancel_abort); + + assertFalse("Expected database not attached after abort", db.isAttached()); + } finally { + safelyClose(db); + } + } finally { + defaultDatabaseTearDown(fbManager); + } + } + + @Test + public void testExecuteImmediate_createDatabase() throws Exception { + IDatabaseImpl db = (IDatabaseImpl) factory.connect(connectionInfo); + try { + String createDb = String.format("CREATE DATABASE '%s' USER '%s' PASSWORD '%s'", + getDatabasePath(), DB_USER, DB_PASSWORD); + db.executeImmediate(createDb, null); + assertTrue("Expected to be attached after create database", db.isAttached()); + db.dropDatabase(); + } finally { + safelyClose(db); + new File(getDatabasePath()).delete(); + } + } + + private FbTransaction getTransaction(FbDatabase db) throws SQLException { + TransactionParameterBuffer tpb = new TransactionParameterBufferImpl(); + tpb.addArgument(ISCConstants.isc_tpb_read_committed); + tpb.addArgument(ISCConstants.isc_tpb_rec_version); + tpb.addArgument(ISCConstants.isc_tpb_write); + tpb.addArgument(ISCConstants.isc_tpb_wait); + return db.startTransaction(tpb); + } + + private static void safelyClose(FbDatabase db) { + if (db == null) return; + try { + db.close(); + } catch (SQLException ex) { + ex.printStackTrace(); + // ignore + } + } +} diff --git a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/TestIEventBlockImpl.java b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/TestIEventBlockImpl.java new file mode 100644 index 0000000000..58ee11e8a9 --- /dev/null +++ b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/TestIEventBlockImpl.java @@ -0,0 +1,163 @@ +package org.firebirdsql.nativeoo.gds.ng; + +import org.firebirdsql.common.FBJUnit4TestBase; +import org.firebirdsql.common.FBTestProperties; +import org.firebirdsql.gds.EventHandle; +import org.firebirdsql.gds.EventHandler; +import org.firebirdsql.gds.ISCConstants; +import org.firebirdsql.gds.TransactionParameterBuffer; +import org.firebirdsql.gds.impl.GDSFactory; +import org.firebirdsql.gds.impl.GDSType; +import org.firebirdsql.gds.impl.TransactionParameterBufferImpl; +import org.firebirdsql.gds.ng.*; +import org.firebirdsql.gds.ng.fields.RowValue; +import org.firebirdsql.gds.ng.jna.AbstractNativeDatabaseFactory; +import org.junit.After; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; + +import java.sql.SQLException; + +import static org.firebirdsql.common.FBTestProperties.DB_PASSWORD; +import static org.firebirdsql.common.FBTestProperties.DB_USER; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +public class TestIEventBlockImpl extends FBJUnit4TestBase { + + private static final String gdsType = "FBOONATIVE"; + + @Rule + public final ExpectedException expectedException = ExpectedException.none(); + + private AbstractNativeOODatabaseFactory factory = + (AbstractNativeOODatabaseFactory) GDSFactory.getDatabaseFactoryForType(GDSType.getType(gdsType)); + //@formatter:off + public static final String TABLE_DEF = + "CREATE TABLE TEST (" + + " TESTVAL INTEGER NOT NULL" + + ")"; + + public static final String TRIGGER_DEF = + "CREATE TRIGGER INSERT_TRIG " + + " FOR TEST AFTER INSERT " + + "AS BEGIN " + + " POST_EVENT 'TEST_EVENT_A';" + + " POST_EVENT 'TEST_EVENT_B';" + + "END"; + //@formatter:on + + private final FbConnectionProperties connectionInfo; + { + connectionInfo = new FbConnectionProperties(); + connectionInfo.setServerName(FBTestProperties.DB_SERVER_URL); + connectionInfo.setPortNumber(FBTestProperties.DB_SERVER_PORT); + connectionInfo.setUser(DB_USER); + connectionInfo.setPassword(DB_PASSWORD); + connectionInfo.setDatabaseName(FBTestProperties.getDatabasePath()); + connectionInfo.setEncoding("NONE"); + } + + private IDatabaseImpl db; + + @After + public final void tearDown() throws Exception { + if (db != null && db.isAttached()) { + try { + db.close(); + } catch (SQLException ex) { + log.debug("Exception on detach", ex); + } + } + } + + @Test + public void testCreateEventHandle() throws Exception { + db = (IDatabaseImpl) factory.connect(connectionInfo); + db.attach(); + + IEventBlockImpl eventBlock = (IEventBlockImpl)db.createEventHandle("TEST_EVENT", new EventHandler() { + @Override + public void eventOccurred(EventHandle eventHandle) { + } + }); + + assertTrue("Event handle should have a size set", eventBlock.getSize() > 0); + } + + @Test + public void testQueueEvent_andNotification() throws Exception { + db = (IDatabaseImpl) factory.connect(connectionInfo); + db.attach(); + + FbTransaction transaction = getTransaction(db); + final FbStatement statement = db.createStatement(transaction); + statement.prepare(TABLE_DEF); + statement.execute(RowValue.EMPTY_ROW_VALUE); + statement.prepare(TRIGGER_DEF); + statement.execute(RowValue.EMPTY_ROW_VALUE); + transaction.commit(); + + SimpleEventHandler eventHandler = new SimpleEventHandler(); + + EventHandle eventHandleA = db.createEventHandle("TEST_EVENT_A", eventHandler); + EventHandle eventHandleB = db.createEventHandle("TEST_EVENT_B", eventHandler); + + // Initial queue will return events immediately + db.queueEvent(eventHandleA); + db.queueEvent(eventHandleB); + int retry = 0; + while (!(eventHandler.getReceivedEventHandles().contains(eventHandleA) + && eventHandler.getReceivedEventHandles().contains(eventHandleB)) + && retry++ < 10) { + Thread.sleep(50); + } + db.countEvents(eventHandleA); + db.countEvents(eventHandleB); + + eventHandler.clearEvents(); + + db.queueEvent(eventHandleA); + db.queueEvent(eventHandleB); + + Thread.sleep(50); + assertTrue("Expected events to not have been triggered", eventHandler.getReceivedEventHandles().isEmpty()); + + transaction = getTransaction(db); + statement.setTransaction(transaction); + statement.prepare("INSERT INTO TEST VALUES (1)"); + statement.execute(RowValue.EMPTY_ROW_VALUE); + transaction.commit(); + + retry = 0; + while (!(eventHandler.getReceivedEventHandles().contains(eventHandleA) + && eventHandler.getReceivedEventHandles().contains(eventHandleB)) + && retry++ < 10) { + Thread.sleep(50); + } + assertEquals("Unexpected number of events received", 2, eventHandler.getReceivedEventHandles().size()); + + db.countEvents(eventHandleA); + db.countEvents(eventHandleB); + assertEquals(1, eventHandleA.getEventCount()); + assertEquals(1, eventHandleB.getEventCount()); + + // TODO Workaround for CORE-4794 + db.queueEvent(eventHandleA); + db.queueEvent(eventHandleB); + + db.cancelEvent(eventHandleA); + db.cancelEvent(eventHandleB); + } + + + private FbTransaction getTransaction(FbDatabase db) throws SQLException { + TransactionParameterBuffer tpb = new TransactionParameterBufferImpl(); + tpb.addArgument(ISCConstants.isc_tpb_read_committed); + tpb.addArgument(ISCConstants.isc_tpb_rec_version); + tpb.addArgument(ISCConstants.isc_tpb_write); + tpb.addArgument(ISCConstants.isc_tpb_wait); + return db.startTransaction(tpb); + } +} diff --git a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/TestIServiceConnectionImpl.java b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/TestIServiceConnectionImpl.java new file mode 100644 index 0000000000..cf8f3b6f80 --- /dev/null +++ b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/TestIServiceConnectionImpl.java @@ -0,0 +1,60 @@ +package org.firebirdsql.nativeoo.gds.ng; + +import org.firebirdsql.common.FBTestProperties; +import org.firebirdsql.gds.impl.GDSFactory; +import org.firebirdsql.gds.impl.GDSType; +import org.firebirdsql.gds.ng.FbService; +import org.firebirdsql.gds.ng.FbServiceProperties; +import org.firebirdsql.gds.ng.jna.AbstractNativeDatabaseFactory; +import org.firebirdsql.jna.fbclient.FbClientLibrary; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; + +import static org.firebirdsql.common.FBTestProperties.DB_PASSWORD; +import static org.firebirdsql.common.FBTestProperties.DB_USER; +import static org.junit.Assert.*; +import static org.junit.Assert.assertNull; + +public class TestIServiceConnectionImpl { + @Rule + public final ExpectedException expectedException = ExpectedException.none(); + + private AbstractNativeOODatabaseFactory factory = + (AbstractNativeOODatabaseFactory) GDSFactory.getDatabaseFactoryForType(GDSType.getType("FBOONATIVE")); + + private final FbServiceProperties connectionInfo; + { + connectionInfo = new FbServiceProperties(); + connectionInfo.setServerName(FBTestProperties.DB_SERVER_URL); + connectionInfo.setPortNumber(FBTestProperties.DB_SERVER_PORT); + connectionInfo.setUser(DB_USER); + connectionInfo.setPassword(DB_PASSWORD); + } + + @Test + public void construct_clientLibraryNull_IllegalArgument() throws Exception { + expectedException.expect(NullPointerException.class); + + new IServiceConnectionImpl(null, connectionInfo); + } + + @Test + public void getClientLibrary_returnsSuppliedLibrary() throws Exception { + final FbClientLibrary clientLibrary = factory.getClientLibrary(); + IServiceConnectionImpl connection = new IServiceConnectionImpl(clientLibrary, connectionInfo); + + assertSame("Expected returned client library to be identical", clientLibrary, connection.getClientLibrary()); + } + + @Test + public void identify_unconnected() throws Exception { + IServiceConnectionImpl connection = new IServiceConnectionImpl(factory.getClientLibrary(), connectionInfo); + + FbService db = connection.identify(); + + assertFalse("Expected isAttached() to return false", db.isAttached()); + assertNull("Expected version string to be null", db.getServerVersion()); + assertNull("Expected version should be null", db.getServerVersion()); + } +} diff --git a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/TestIServiceImpl.java b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/TestIServiceImpl.java new file mode 100644 index 0000000000..19cc9d0a3d --- /dev/null +++ b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/TestIServiceImpl.java @@ -0,0 +1,170 @@ +package org.firebirdsql.nativeoo.gds.ng; + +import org.firebirdsql.common.FBTestProperties; +import org.firebirdsql.gds.ISCConstants; +import org.firebirdsql.gds.ServiceRequestBuffer; +import org.firebirdsql.gds.impl.GDSFactory; +import org.firebirdsql.gds.impl.GDSServerVersion; +import org.firebirdsql.gds.impl.GDSType; +import org.firebirdsql.gds.impl.nativeoo.FbOOEmbeddedGDSFactoryPlugin; +import org.firebirdsql.gds.ng.FbServiceProperties; +import org.firebirdsql.gds.ng.jna.AbstractNativeDatabaseFactory; +import org.firebirdsql.management.FBManager; +import org.firebirdsql.management.FBStatisticsManager; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; + +import java.io.ByteArrayOutputStream; +import java.sql.SQLException; + +import static org.firebirdsql.common.FBTestProperties.*; +import static org.firebirdsql.common.FBTestProperties.defaultDatabaseTearDown; +import static org.firebirdsql.common.FBTestProperties.getDatabasePath; +import static org.firebirdsql.common.matchers.SQLExceptionMatchers.*; +import static org.firebirdsql.gds.ISCConstants.*; +import static org.firebirdsql.gds.ISCConstants.isc_info_end; +import static org.firebirdsql.gds.VaxEncoding.iscVaxInteger2; +import static org.hamcrest.CoreMatchers.*; +import static org.hamcrest.CoreMatchers.containsString; +import static org.hamcrest.CoreMatchers.endsWith; +import static org.junit.Assert.*; +import static org.junit.Assert.assertThat; +import static org.junit.Assume.assumeThat; + +public class TestIServiceImpl { + + private static final String gdsType = "FBOONATIVE"; + + @Rule + public final ExpectedException expectedException = ExpectedException.none(); + + private AbstractNativeOODatabaseFactory factory = + (AbstractNativeOODatabaseFactory) GDSFactory.getDatabaseFactoryForType(GDSType.getType(gdsType)); + + private final FbServiceProperties connectionInfo; + { + connectionInfo = new FbServiceProperties(); + connectionInfo.setServerName(FBTestProperties.DB_SERVER_URL); + connectionInfo.setPortNumber(FBTestProperties.DB_SERVER_PORT); + connectionInfo.setUser(DB_USER); + connectionInfo.setPassword(DB_PASSWORD); + } + + @Test + public void testBasicAttach() throws Exception { + try (IServiceImpl service = (IServiceImpl)factory.serviceConnect(connectionInfo)) { + service.attach(); + + assertTrue("Expected isAttached() to return true", service.isAttached()); + assertNotNull("Expected version string to be not null", service.getServerVersion()); + assertNotEquals("Expected version should not be invalid", GDSServerVersion.INVALID_VERSION, service.getServerVersion()); + } + } + + @Test + public void doubleAttach() throws Exception { + expectedException.expect(SQLException.class); + expectedException.expectMessage(equalTo("Already attached to a service")); + + try (IServiceImpl service = (IServiceImpl)factory.serviceConnect(connectionInfo)) { + service.attach(); + + //Second attach should throw exception + service.attach(); + } + } + + @Test + public void basicStatusVectorProcessing_wrongLogin() throws Exception { + assumeThat("Embedded on windows does not use authentication", + FBTestProperties.GDS_TYPE, is(not(FbOOEmbeddedGDSFactoryPlugin.EMBEDDED_TYPE_NAME))); + // set invalid password + connectionInfo.setPassword("abcd"); + try (IServiceImpl service = (IServiceImpl)factory.serviceConnect(connectionInfo)) { + + expectedException.expect(allOf( + isA(SQLException.class), + message(startsWith(getFbMessage(ISCConstants.isc_login))), + errorCode(equalTo(ISCConstants.isc_login)) + )); + + service.attach(); + } + } + + @Test + public void testBasicStatusVectorProcessing_wrongService() throws Exception { + // set invalid database + final String invalidServiceName = "doesnotexist"; + connectionInfo.setServiceName(invalidServiceName); + try (IServiceImpl service = (IServiceImpl)factory.serviceConnect(connectionInfo)) { + + expectedException.expect(allOf( + isA(SQLException.class), + fbMessageStartsWith(ISCConstants.isc_service_att_err)) + ); + + service.attach(); + } + } + + /** + * Test for service action. + *

+ * Replicates the behavior of {@link FBStatisticsManager#getHeaderPage()}. + *

+ */ + @Test + public void testStartServiceAction() throws Exception { + FBManager fbManager = createFBManager(); + defaultDatabaseSetUp(fbManager); + try (IServiceImpl service = (IServiceImpl)factory.serviceConnect(connectionInfo)) { + service.attach(); + + ServiceRequestBuffer actionSrb = service.createServiceRequestBuffer(); + actionSrb.addArgument(isc_action_svc_db_stats); + actionSrb.addArgument(isc_spb_dbname, getDatabasePath()); + actionSrb.addArgument(isc_spb_options, isc_spb_sts_hdr_pages); + + service.startServiceAction(actionSrb); + + ServiceRequestBuffer infoSrb = service.createServiceRequestBuffer(); + infoSrb.addArgument(isc_info_svc_to_eof); + int bufferSize = 1024; + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + boolean processing = true; + while (processing) { + byte[] buffer = service.getServiceInfo(null, infoSrb, bufferSize); + + switch (buffer[0]) { + case isc_info_svc_to_eof: + int dataLength = iscVaxInteger2(buffer, 1); + if (dataLength == 0) { + if (buffer[3] != isc_info_end) { + throw new SQLException("Unexpected end of stream reached."); + } else { + processing = false; + break; + } + } + bos.write(buffer, 3, dataLength); + break; + case isc_info_truncated: + bufferSize = bufferSize * 2; + break; + case isc_info_end: + processing = false; + break; + } + } + String headerPage = service.getEncoding().decodeFromCharset(bos.toByteArray()); + assertThat("Expected database header page content", headerPage, allOf( + startsWith("\nDatabase"), + containsString("Database header page information"), + endsWith("\n"))); + } finally { + defaultDatabaseTearDown(fbManager); + } + } +} diff --git a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/TestIStatementImpl.java b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/TestIStatementImpl.java new file mode 100644 index 0000000000..b9d150511d --- /dev/null +++ b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/TestIStatementImpl.java @@ -0,0 +1,273 @@ +/* + * Firebird Open Source JavaEE Connector - JDBC Driver + * + * Distributable under LGPL license. + * You may obtain a copy of the License at http://www.gnu.org/copyleft/lgpl.html + * + * This program 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 + * LGPL License for more details. + * + * This file was created by members of the firebird development team. + * All individual contributions remain the Copyright (C) of those + * individuals. Contributors to this file are either listed here or + * can be obtained from a source control history command. + * + * All rights reserved. + */ +package org.firebirdsql.nativeoo.gds.ng; + +import org.firebirdsql.gds.impl.GDSFactory; +import org.firebirdsql.gds.impl.GDSType; +import org.firebirdsql.gds.ng.AbstractStatementTest; +import org.firebirdsql.gds.ng.DatatypeCoder; +import org.firebirdsql.gds.ng.FbDatabase; +import org.firebirdsql.gds.ng.fields.RowValue; +import org.firebirdsql.gds.ng.jna.AbstractNativeDatabaseFactory; +import org.firebirdsql.gds.ng.wire.SimpleStatementListener; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; + +import java.sql.SQLException; +import java.sql.SQLNonTransientException; + +import static org.junit.Assert.*; + +/** + * Tests for OO API statement. + * {@link org.firebirdsql.nativeoo.gds.ng.IStatementImpl}. + * + * @since 4.0 + */ +public class TestIStatementImpl extends AbstractStatementTest { + + private static final String gdsType = "FBOONATIVE"; + + @Rule + public final ExpectedException expectedException = ExpectedException.none(); + + private final AbstractNativeOODatabaseFactory factory = + (AbstractNativeOODatabaseFactory) GDSFactory.getDatabaseFactoryForType(GDSType.getType(gdsType)); + + @Override + protected Class getExpectedDatabaseType() { + return IDatabaseImpl.class; + } + + @Override + protected FbDatabase createDatabase() throws SQLException { + return factory.connect(connectionInfo); + } + + @Test + public void testSelect_NoParameters_Execute_and_Fetch() throws Exception { + allocateStatement(); + statement.prepare( + "SELECT RDB$DESCRIPTION AS \"Description\", RDB$RELATION_ID, RDB$SECURITY_CLASS, RDB$CHARACTER_SET_NAME " + + "FROM RDB$DATABASE"); + + final SimpleStatementListener statementListener = new SimpleStatementListener(); + statement.addStatementListener(statementListener); + + statement.execute(RowValue.EMPTY_ROW_VALUE); + + assertEquals("Expected hasResultSet to be set to true", Boolean.TRUE, statementListener.hasResultSet()); + assertEquals("Expected hasSingletonResult to be set to false", Boolean.FALSE, statementListener.hasSingletonResult()); + assertNull("Expected allRowsFetched not set yet", statementListener.isAllRowsFetched()); + assertEquals("Expected no rows to be fetched yet", 0, statementListener.getRows().size()); + + // JNAStatement only executes a single fetch to prevent problems with positioned updates, + // so this doesn't get all rows fetched immediately + statement.fetchRows(10); + + assertEquals("Expected allRowsFetched to haven't been called yet", null, statementListener.isAllRowsFetched()); + assertEquals("Expected a single row to have been fetched", 1, statementListener.getRows().size()); + + statement.fetchRows(1); + + assertEquals("Expected allRowsFetched to be set to true", Boolean.TRUE, statementListener.isAllRowsFetched()); + assertEquals("Expected a single row to have been fetched", 1, statementListener.getRows().size()); + } + + @Test + public void testMultipleExecute() throws Exception { + allocateStatement(); + statement.prepare( + "SELECT RDB$DESCRIPTION AS \"Description\", RDB$RELATION_ID, RDB$SECURITY_CLASS, RDB$CHARACTER_SET_NAME " + + "FROM RDB$DATABASE"); + + final SimpleStatementListener statementListener = new SimpleStatementListener(); + statement.addStatementListener(statementListener); + + statement.execute(RowValue.EMPTY_ROW_VALUE); + + assertEquals("Expected hasResultSet to be set to true", Boolean.TRUE, statementListener.hasResultSet()); + assertEquals("Expected hasSingletonResult to be set to false", Boolean.FALSE, statementListener.hasSingletonResult()); + assertNull("Expected allRowsFetched not set yet", statementListener.isAllRowsFetched()); + assertEquals("Expected no rows to be fetched yet", 0, statementListener.getRows().size()); + + // JNAStatement only executes a single fetch to prevent problems with positioned updates, + // so this doesn't get all rows fetched immediately + statement.fetchRows(10); + + assertEquals("Expected allRowsFetched to haven't been called yet", null, statementListener.isAllRowsFetched()); + assertEquals("Expected a single row to have been fetched", 1, statementListener.getRows().size()); + + statement.fetchRows(1); + + assertEquals("Expected allRowsFetched to be set to true", Boolean.TRUE, statementListener.isAllRowsFetched()); + assertEquals("Expected a single row to have been fetched", 1, statementListener.getRows().size()); + + statement.closeCursor(); + final SimpleStatementListener statementListener2 = new SimpleStatementListener(); + statement.addStatementListener(statementListener2); + + statement.execute(RowValue.EMPTY_ROW_VALUE); + + assertEquals("Expected hasResultSet to be set to true", Boolean.TRUE, statementListener2.hasResultSet()); + assertEquals("Expected hasSingletonResult to be set to false", Boolean.FALSE, statementListener2.hasSingletonResult()); + assertNull("Expected allRowsFetched not set yet", statementListener2.isAllRowsFetched()); + assertEquals("Expected no rows to be fetched yet", 0, statementListener2.getRows().size()); + + // JNAStatement only executes a single fetch to prevent problems with positioned updates, + // so this doesn't get all rows fetched immediately + statement.fetchRows(10); + + assertEquals("Expected allRowsFetched to haven't been called yet", null, statementListener2.isAllRowsFetched()); + assertEquals("Expected a single row to have been fetched", 1, statementListener2.getRows().size()); + + statement.fetchRows(1); + + assertEquals("Expected allRowsFetched to be set to true", Boolean.TRUE, statementListener2.isAllRowsFetched()); + assertEquals("Expected a single row to have been fetched", 1, statementListener2.getRows().size()); + } + + @Test + public void testMultiplePrepare() throws Exception { + allocateStatement(); + statement.prepare( + "SELECT RDB$DESCRIPTION AS \"Description\", RDB$RELATION_ID, RDB$SECURITY_CLASS, RDB$CHARACTER_SET_NAME " + + "FROM RDB$DATABASE"); + + final SimpleStatementListener statementListener = new SimpleStatementListener(); + statement.addStatementListener(statementListener); + + statement.execute(RowValue.EMPTY_ROW_VALUE); + + assertEquals("Expected hasResultSet to be set to true", Boolean.TRUE, statementListener.hasResultSet()); + assertEquals("Expected hasSingletonResult to be set to false", Boolean.FALSE, statementListener.hasSingletonResult()); + assertNull("Expected allRowsFetched not set yet", statementListener.isAllRowsFetched()); + assertEquals("Expected no rows to be fetched yet", 0, statementListener.getRows().size()); + + // JNAStatement only executes a single fetch to prevent problems with positioned updates, + // so this doesn't get all rows fetched immediately + statement.fetchRows(10); + + assertEquals("Expected allRowsFetched to haven't been called yet", null, statementListener.isAllRowsFetched()); + assertEquals("Expected a single row to have been fetched", 1, statementListener.getRows().size()); + + statement.fetchRows(1); + + assertEquals("Expected allRowsFetched to be set to true", Boolean.TRUE, statementListener.isAllRowsFetched()); + assertEquals("Expected a single row to have been fetched", 1, statementListener.getRows().size()); + + statement.closeCursor(); + + statement.prepare( + "SELECT RDB$DESCRIPTION AS \"Description\", RDB$RELATION_ID, RDB$SECURITY_CLASS, RDB$CHARACTER_SET_NAME " + + "FROM RDB$DATABASE"); + + final SimpleStatementListener statementListener2 = new SimpleStatementListener(); + statement.addStatementListener(statementListener2); + statement.execute(RowValue.EMPTY_ROW_VALUE); + + assertEquals("Expected hasResultSet to be set to true", Boolean.TRUE, statementListener2.hasResultSet()); + assertEquals("Expected hasSingletonResult to be set to false", Boolean.FALSE, statementListener2.hasSingletonResult()); + assertNull("Expected allRowsFetched not set yet", statementListener2.isAllRowsFetched()); + assertEquals("Expected no rows to be fetched yet", 0, statementListener2.getRows().size()); + + // JNAStatement only executes a single fetch to prevent problems with positioned updates, + // so this doesn't get all rows fetched immediately + statement.fetchRows(10); + + assertEquals("Expected allRowsFetched to haven't been called yet", null, statementListener2.isAllRowsFetched()); + assertEquals("Expected a single row to have been fetched", 1, statementListener2.getRows().size()); + + statement.fetchRows(1); + + assertEquals("Expected allRowsFetched to be set to true", Boolean.TRUE, statementListener2.isAllRowsFetched()); + assertEquals("Expected a single row to have been fetched", 1, statementListener2.getRows().size()); + } + + @Test + public void testSelect_WithParameters_Execute_and_Fetch() throws Exception { + allocateStatement(); + statement.addStatementListener(listener); + statement.prepare( + "SELECT a.RDB$CHARACTER_SET_NAME " + + "FROM RDB$CHARACTER_SETS a " + + "WHERE a.RDB$CHARACTER_SET_ID = ? OR a.RDB$BYTES_PER_CHARACTER = ?"); + + final DatatypeCoder coder = db.getDatatypeCoder(); + RowValue rowValue = RowValue.of( + coder.encodeShort(3), // smallint = 3 (id of UNICODE_FSS) + coder.encodeShort(1)); // smallint = 1 (single byte character sets) + + statement.execute(rowValue); + + assertEquals("Expected hasResultSet to be set to true", Boolean.TRUE, listener.hasResultSet()); + assertEquals("Expected hasSingletonResult to be set to false", Boolean.FALSE, listener.hasSingletonResult()); + assertNull("Expected allRowsFetched not set yet", listener.isAllRowsFetched()); + assertEquals("Expected no rows to be fetched yet", 0, listener.getRows().size()); + assertNull("Expected no SQL counts yet", listener.getSqlCounts()); + + // JNAStatement only executes a single fetch to prevent problems with positioned updates, + // so this doesn't get all rows fetched immediately + statement.fetchRows(100); + + assertEquals("Expected allRowsFetched to haven't been called yet", null, listener.isAllRowsFetched()); + assertEquals("Expected a single row to have been fetched", 1, listener.getRows().size()); + + // 100 should be sufficient to fetch all character sets; limit to prevent infinite loop with bugs in fetchRows + int count = 0; + while(listener.isAllRowsFetched() != Boolean.TRUE && count < 100) { + statement.fetchRows(1); + count++; + } + + assertEquals("Expected allRowsFetched to be set to true", Boolean.TRUE, listener.isAllRowsFetched()); + // Number is database dependent (unicode_fss + all single byte character sets) + assertTrue("Expected more than two rows", listener.getRows().size() > 2); + + assertNull("expected no SQL counts immediately after retrieving all rows", listener.getSqlCounts()); + + statement.getSqlCounts(); + + assertNotNull("Expected SQL counts", listener.getSqlCounts()); + assertEquals("Unexpected select count", listener.getRows().size(), listener.getSqlCounts().getLongSelectCount()); + } + + @Test + public void test_GetExecutionPlan_noStatementPrepared() throws Exception { + allocateStatement(); + expectedException.expect(SQLNonTransientException.class); + expectedException.expectMessage("Statement not yet allocated"); + + statement.getExecutionPlan(); + } + + @Test + public void test_GetExecutionPlan_StatementClosed() throws Exception { + expectedException.expect(SQLNonTransientException.class); + expectedException.expectMessage("Statement closed"); + allocateStatement(); + statement.prepare( + "SELECT RDB$DESCRIPTION AS \"Description\", RDB$RELATION_ID, RDB$SECURITY_CLASS, RDB$CHARACTER_SET_NAME " + + "FROM RDB$DATABASE"); + statement.close(); + + statement.getExecutionPlan(); + } +} diff --git a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/TestITransactionImpl.java b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/TestITransactionImpl.java new file mode 100644 index 0000000000..f3c6c745fe --- /dev/null +++ b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/TestITransactionImpl.java @@ -0,0 +1,37 @@ +package org.firebirdsql.nativeoo.gds.ng; + +import org.firebirdsql.gds.impl.GDSFactory; +import org.firebirdsql.gds.impl.GDSType; +import org.firebirdsql.gds.ng.AbstractTransactionTest; +import org.firebirdsql.gds.ng.FbDatabase; +import org.firebirdsql.gds.ng.jna.AbstractNativeDatabaseFactory; +import org.junit.Rule; +import org.junit.rules.ExpectedException; + +import java.sql.SQLException; + +/** + * Tests for {@link org.firebirdsql.nativeoo.gds.ng.ITransactionImpl}. + * + * @since 4.0 + */ +public class TestITransactionImpl extends AbstractTransactionTest { + + private static final String gdsType = "FBOONATIVE"; + + @Rule + public final ExpectedException expectedException = ExpectedException.none(); + + private AbstractNativeOODatabaseFactory factory = + (AbstractNativeOODatabaseFactory) GDSFactory.getDatabaseFactoryForType(GDSType.getType(gdsType)); + + @Override + protected FbDatabase createDatabase() throws SQLException { + return factory.connect(connectionInfo); + } + + @Override + protected Class getExpectedDatabaseType() { + return IDatabaseImpl.class; + } +} diff --git a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/TestNativeDatabaseConnection.java b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/TestNativeDatabaseConnection.java new file mode 100644 index 0000000000..5118708549 --- /dev/null +++ b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/TestNativeDatabaseConnection.java @@ -0,0 +1,61 @@ +package org.firebirdsql.nativeoo.gds.ng; + +import org.firebirdsql.common.FBTestProperties; +import org.firebirdsql.gds.impl.GDSFactory; +import org.firebirdsql.gds.impl.GDSType; +import org.firebirdsql.gds.ng.FbConnectionProperties; +import org.firebirdsql.gds.ng.FbDatabase; +import org.firebirdsql.jna.fbclient.FbClientLibrary; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; + +import static org.firebirdsql.common.FBTestProperties.DB_PASSWORD; +import static org.firebirdsql.common.FBTestProperties.DB_USER; +import static org.junit.Assert.*; + +public class TestNativeDatabaseConnection { + + @Rule + public final ExpectedException expectedException = ExpectedException.none(); + + private final AbstractNativeOODatabaseFactory factory = + (AbstractNativeOODatabaseFactory) GDSFactory.getDatabaseFactoryForType(GDSType.getType("FBOONATIVE")); + private final FbConnectionProperties connectionInfo; + { + connectionInfo = new FbConnectionProperties(); + connectionInfo.setServerName(FBTestProperties.DB_SERVER_URL); + connectionInfo.setPortNumber(FBTestProperties.DB_SERVER_PORT); + connectionInfo.setUser(DB_USER); + connectionInfo.setPassword(DB_PASSWORD); + connectionInfo.setDatabaseName(FBTestProperties.getDatabasePath()); + connectionInfo.setEncoding("NONE"); + } + + @Test + public void construct_clientLibraryNull_IllegalArgument() throws Exception { + expectedException.expect(NullPointerException.class); + + new NativeDatabaseConnection(null, connectionInfo); + } + + @Test + public void getClientLibrary_returnsSuppliedLibrary() throws Exception { + final FbClientLibrary clientLibrary = factory.getClientLibrary(); + NativeDatabaseConnection connection = new NativeDatabaseConnection(clientLibrary, connectionInfo); + + assertSame("Expected returned client library to be identical", clientLibrary, connection.getClientLibrary()); + } + + @Test + public void identify_unconnected() throws Exception { + NativeDatabaseConnection connection = new NativeDatabaseConnection(factory.getClientLibrary(), connectionInfo); + + FbDatabase db = connection.identify(); + + assertFalse("Expected isAttached() to return false", db.isAttached()); + assertNull("Expected version string to be null", db.getServerVersion()); + assertNull("Expected version should be null", db.getServerVersion()); + } + +} diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/AbstractNativeConnection.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/AbstractNativeConnection.java new file mode 100644 index 0000000000..e28b6d4a66 --- /dev/null +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/AbstractNativeConnection.java @@ -0,0 +1,87 @@ +package org.firebirdsql.nativeoo.gds.ng; + +import org.firebirdsql.encodings.IEncodingFactory; +import org.firebirdsql.gds.ng.AbstractConnection; +import org.firebirdsql.gds.ng.DatatypeCoder; +import org.firebirdsql.gds.ng.FbAttachment; +import org.firebirdsql.gds.ng.IAttachProperties; +import org.firebirdsql.gds.ng.jna.BigEndianDatatypeCoder; +import org.firebirdsql.gds.ng.jna.LittleEndianDatatypeCoder; +import org.firebirdsql.jna.fbclient.FbClientLibrary; +import org.firebirdsql.logging.Logger; +import org.firebirdsql.logging.LoggerFactory; + +import java.nio.ByteOrder; +import java.sql.SQLException; + +import static java.util.Objects.requireNonNull; + +/** + * Class handling the initial setup of the native connection. + * That's using for native OO API. + * + * @param + * Type of attach properties + * @param + * Type of connection handle + * @since 4.0 + */ +public abstract class AbstractNativeConnection , C extends FbAttachment> + extends AbstractConnection { + private static final Logger log = LoggerFactory.getLogger(AbstractNativeConnection.class); + private static final boolean bigEndian = ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN; + + private final FbClientLibrary clientLibrary; + + /** + * Creates a AbstractNativeConnection (without establishing a connection to the server). + * + * @param clientLibrary + * Client library to use + * @param attachProperties + * Attach properties + * @param encodingFactory + * Encoding factory + */ + protected AbstractNativeConnection(FbClientLibrary clientLibrary, T attachProperties, IEncodingFactory encodingFactory) + throws SQLException { + super(attachProperties, encodingFactory); + this.clientLibrary = requireNonNull(clientLibrary, "parameter clientLibrary cannot be null"); + } + + /** + * @return The client library instance associated with the connection. + */ + public final FbClientLibrary getClientLibrary() { + return clientLibrary; + } + + public final DatatypeCoder createDatatypeCoder() { + if (bigEndian) { + return BigEndianDatatypeCoder.forEncodingFactory(getEncodingFactory()); + } + return LittleEndianDatatypeCoder.forEncodingFactory(getEncodingFactory()); + } + + /** + * Builds the attach URL for the library. + * + * @return Attach URL + */ + public String getAttachUrl() { + StringBuilder sb = new StringBuilder(); + if (getServerName() != null) { + boolean ipv6 = getServerName().indexOf(':') != -1; + if (ipv6) { + sb.append('[').append(getServerName()).append(']'); + } else { + sb.append(getServerName()); + } + sb.append('/') + .append(getPortNumber()) + .append(':'); + } + sb.append(getAttachObjectName()); + return sb.toString(); + } +} diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/AbstractNativeOODatabaseFactory.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/AbstractNativeOODatabaseFactory.java new file mode 100644 index 0000000000..c2d94008a4 --- /dev/null +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/AbstractNativeOODatabaseFactory.java @@ -0,0 +1,39 @@ +package org.firebirdsql.nativeoo.gds.ng; + +import org.firebirdsql.gds.ng.*; +import org.firebirdsql.jna.fbclient.FbClientLibrary; + +import java.sql.SQLException; + +public abstract class AbstractNativeOODatabaseFactory implements FbDatabaseFactory { + @Override + public FbDatabase connect(IConnectionProperties connectionProperties) throws SQLException { + final NativeDatabaseConnection databaseConnection = new NativeDatabaseConnection(getClientLibrary(), + filterProperties(connectionProperties)); + return databaseConnection.identify(); + } + + @Override + public FbService serviceConnect(IServiceProperties serviceProperties) throws SQLException { + final IServiceConnectionImpl serviceConnection = new IServiceConnectionImpl(getClientLibrary(), + filterProperties(serviceProperties)); + return serviceConnection.identify(); + } + + protected abstract FbClientLibrary getClientLibrary(); + + /** + * Allows the database factory to perform modification of the attach properties before use. + *

+ * Implementations should be prepared to handle immutable attach properties. Implementations are strongly + * advised to copy the attach properties before modification and return this copy. + *

+ * + * @param attachProperties Attach properties + * @param Type of attach properties + * @return Filtered properties + */ + protected > T filterProperties(T attachProperties) { + return attachProperties; + } +} diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/CloseableMemory.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/CloseableMemory.java new file mode 100644 index 0000000000..1ac1ccc006 --- /dev/null +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/CloseableMemory.java @@ -0,0 +1,21 @@ +package org.firebirdsql.nativeoo.gds.ng; + +import com.sun.jna.Memory; + +/** + * Memory class for send and receive native messages using OO API. + * + * @since 4.0 + */ +public class CloseableMemory extends Memory implements AutoCloseable { + + public CloseableMemory(long size) + { + super(size); + } + + @Override + public void close() { + dispose(); + } +} diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbException.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbException.java new file mode 100644 index 0000000000..a2bd0fa52a --- /dev/null +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbException.java @@ -0,0 +1,131 @@ +package org.firebirdsql.nativeoo.gds.ng; + +import com.sun.jna.Pointer; +import org.firebirdsql.gds.ISCConstants; +import org.firebirdsql.gds.ng.FbExceptionBuilder; +import org.firebirdsql.nativeoo.gds.ng.FbInterface.IStatus; + +import java.io.PrintWriter; +import java.io.StringWriter; +import java.sql.SQLException; + +import static org.firebirdsql.gds.ISCConstants.*; +import static org.firebirdsql.gds.ISCConstants.isc_arg_number; + +/** + * Class for handling exceptions from native OO API. + * + * @since 4.0 + */ +public class FbException extends SQLException { + + private static final long serialVersionUID = 1L; + + public FbException(Throwable t) { + super(t); + } + + public FbException(String msg) { + super(msg); + } + + public FbException(String msg, Throwable t) { + super(msg, t); + } + + public FbException(String reason, String sqlState, int vendorCode, Throwable cause) { + super(reason, sqlState, vendorCode, cause); + } + + public static void rethrow(Throwable t) throws FbException { + throw new FbException(null, t); + } + + public static void catchException(IStatus status, Throwable t) { + + while (t != null && t instanceof FbException && t.getMessage() == null) + t = t.getCause(); + + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw); + t.printStackTrace(pw); + String msg = sw.toString(); + + try (CloseableMemory memory = new CloseableMemory(msg.length() + 1)) { + memory.setString(0, msg); + + Pointer[] vector = new Pointer[]{ + new Pointer(ISCConstants.isc_arg_gds), + new Pointer(ISCConstants.isc_random), + new Pointer(ISCConstants.isc_arg_cstring), + new Pointer(msg.length()), + memory, + new Pointer(ISCConstants.isc_arg_end) + }; + + status.setErrors2(vector.length, vector); + } + } + + public static void checkException(IStatus status) throws FbException { + if ((status.getState() & IStatus.STATE_ERRORS) != 0) { + FbExceptionBuilder builder = new FbExceptionBuilder(); + + int offset = 0; + + processingLoop: + while (status.getErrors().getInt(offset) != isc_arg_end) { + + int arg = status.getErrors().getInt(offset); + + switch (arg) { + case isc_arg_gds: + offset += 8; + int iscCode = status.getErrors().getInt(offset); + builder.exception(iscCode); + break; + case isc_arg_interpreted: + case isc_arg_string: + case isc_arg_sql_state: + offset += 8; + long stringPointerAddress = status.getErrors().getLong(offset); + if (stringPointerAddress == 0L) { + break processingLoop; + } + Pointer stringPointer = new Pointer(stringPointerAddress); + String stringValue = stringPointer.getString(0); + if (arg != isc_arg_sql_state) { + builder.messageParameter(stringValue); + } else { + builder.sqlState(stringValue); + } + break; + case isc_arg_cstring: + offset += 8; + int stringLength = status.getErrors().getInt(offset); + offset += 8; + long cStringPointerAddress = status.getErrors().getLong(offset); + Pointer cStringPointer = new Pointer(cStringPointerAddress); + byte[] stringData = cStringPointer.getByteArray(0, stringLength); + String cStringValue = new String(stringData); + builder.messageParameter(cStringValue); + break; + case isc_arg_number: + offset += 8; + int intValue = status.getErrors().getInt(offset); + builder.messageParameter(intValue); + break; + } + + offset += 8; + } + + + if (!builder.isEmpty()) { + SQLException exception = builder.toSQLException(); + throw new FbException(exception.getMessage(), exception.getSQLState(), exception.getErrorCode(), + exception); + } + } + } +} diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbInterface.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbInterface.java new file mode 100644 index 0000000000..fbbfaad512 --- /dev/null +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbInterface.java @@ -0,0 +1,19473 @@ +// This file was autogenerated by cloop - Cross Language Object Oriented Programming + +package org.firebirdsql.nativeoo.gds.ng; + + +import org.firebirdsql.jna.fbclient.*; + + +/** + * JNA Wrapper for library implementing interface.h. + * + * @since 4.0 + */ +public interface FbInterface extends FbClientLibrary +{ + public static interface IVersionedIntf + { + } + + public static interface IReferenceCountedIntf extends IVersionedIntf + { + public void addRef(); + public int release(); + } + + public static interface IDisposableIntf extends IVersionedIntf + { + public void dispose(); + } + + public static interface IStatusIntf extends IDisposableIntf + { + public static int STATE_WARNINGS = 1; + public static int STATE_ERRORS = 2; + public static int RESULT_ERROR = -1; + public static int RESULT_OK = 0; + public static int RESULT_NO_DATA = 1; + public static int RESULT_SEGMENT = 2; + + public void init(); + public int getState(); + public void setErrors2(int length, com.sun.jna.Pointer[] value); + public void setWarnings2(int length, com.sun.jna.Pointer[] value); + public void setErrors(com.sun.jna.Pointer[] value); + public void setWarnings(com.sun.jna.Pointer[] value); + public com.sun.jna.Pointer getErrors(); + public com.sun.jna.Pointer getWarnings(); + public IStatus clone(); + } + + public static interface IMasterIntf extends IVersionedIntf + { + public IStatus getStatus(); + public IProvider getDispatcher(); + public IPluginManager getPluginManager(); + public ITimerControl getTimerControl(); + public IDtc getDtc(); + public IAttachment registerAttachment(IProvider provider, IAttachment attachment); + public ITransaction registerTransaction(IAttachment attachment, ITransaction transaction); + public IMetadataBuilder getMetadataBuilder(IStatus status, int fieldCount) throws FbException; + public int serverMode(int mode); + public IUtil getUtilInterface(); + public IConfigManager getConfigManager(); + public boolean getProcessExiting(); + } + + public static interface IPluginBaseIntf extends IReferenceCountedIntf + { + public void setOwner(IReferenceCounted r); + public IReferenceCounted getOwner(); + } + + public static interface IPluginSetIntf extends IReferenceCountedIntf + { + public String getName(); + public String getModuleName(); + public IPluginBase getPlugin(IStatus status) throws FbException; + public void next(IStatus status) throws FbException; + public void set(IStatus status, String s) throws FbException; + } + + public static interface IConfigEntryIntf extends IReferenceCountedIntf + { + public String getName(); + public String getValue(); + public long getIntValue(); + public boolean getBoolValue(); + public IConfig getSubConfig(IStatus status) throws FbException; + } + + public static interface IConfigIntf extends IReferenceCountedIntf + { + public IConfigEntry find(IStatus status, String name) throws FbException; + public IConfigEntry findValue(IStatus status, String name, String value) throws FbException; + public IConfigEntry findPos(IStatus status, String name, int pos) throws FbException; + } + + public static interface IFirebirdConfIntf extends IReferenceCountedIntf + { + public int getKey(String name); + public long asInteger(int key); + public String asString(int key); + public boolean asBoolean(int key); + } + + public static interface IPluginConfigIntf extends IReferenceCountedIntf + { + public String getConfigFileName(); + public IConfig getDefaultConfig(IStatus status) throws FbException; + public IFirebirdConf getFirebirdConf(IStatus status) throws FbException; + public void setReleaseDelay(IStatus status, long microSeconds) throws FbException; + } + + public static interface IPluginFactoryIntf extends IVersionedIntf + { + public IPluginBase createPlugin(IStatus status, IPluginConfig factoryParameter) throws FbException; + } + + public static interface IPluginModuleIntf extends IVersionedIntf + { + public void doClean(); + public void threadDetach(); + } + + public static interface IPluginManagerIntf extends IVersionedIntf + { + public static int TYPE_PROVIDER = 1; + public static int TYPE_FIRST_NON_LIB = 2; + public static int TYPE_AUTH_SERVER = 3; + public static int TYPE_AUTH_CLIENT = 4; + public static int TYPE_AUTH_USER_MANAGEMENT = 5; + public static int TYPE_EXTERNAL_ENGINE = 6; + public static int TYPE_TRACE = 7; + public static int TYPE_WIRE_CRYPT = 8; + public static int TYPE_DB_CRYPT = 9; + public static int TYPE_KEY_HOLDER = 10; + public static int TYPE_CRYPTO_API = 11; + public static int TYPE_COUNT = 12; + + public void registerPluginFactory(int pluginType, String defaultName, IPluginFactory factory); + public void registerModule(IPluginModule cleanup); + public void unregisterModule(IPluginModule cleanup); + public IPluginSet getPlugins(IStatus status, int pluginType, String namesList, IFirebirdConf firebirdConf) throws FbException; + public IConfig getConfig(IStatus status, String filename) throws FbException; + public void releasePlugin(IPluginBase plugin); + } + + public static interface ICryptKeyIntf extends IVersionedIntf + { + public void setSymmetric(IStatus status, String type, int keyLength, com.sun.jna.Pointer key) throws FbException; + public void setAsymmetric(IStatus status, String type, int encryptKeyLength, com.sun.jna.Pointer encryptKey, int decryptKeyLength, com.sun.jna.Pointer decryptKey) throws FbException; + public com.sun.jna.Pointer getEncryptKey(com.sun.jna.Pointer length); + public com.sun.jna.Pointer getDecryptKey(com.sun.jna.Pointer length); + } + + public static interface IConfigManagerIntf extends IVersionedIntf + { + public static int DIR_BIN = 0; + public static int DIR_SBIN = 1; + public static int DIR_CONF = 2; + public static int DIR_LIB = 3; + public static int DIR_INC = 4; + public static int DIR_DOC = 5; + public static int DIR_UDF = 6; + public static int DIR_SAMPLE = 7; + public static int DIR_SAMPLEDB = 8; + public static int DIR_HELP = 9; + public static int DIR_INTL = 10; + public static int DIR_MISC = 11; + public static int DIR_SECDB = 12; + public static int DIR_MSG = 13; + public static int DIR_LOG = 14; + public static int DIR_GUARD = 15; + public static int DIR_PLUGINS = 16; + public static int DIR_COUNT = 17; + + public String getDirectory(int code); + public IFirebirdConf getFirebirdConf(); + public IFirebirdConf getDatabaseConf(String dbName); + public IConfig getPluginConfig(String configuredPlugin); + public String getInstallDirectory(); + public String getRootDirectory(); + } + + public static interface IEventCallbackIntf extends IReferenceCountedIntf + { + public void eventCallbackFunction(int length, com.sun.jna.Pointer events); + } + + public static interface IBlobIntf extends IReferenceCountedIntf + { + public void getInfo(IStatus status, int itemsLength, byte[] items, int bufferLength, byte[] buffer) throws FbException; + public int getSegment(IStatus status, int bufferLength, com.sun.jna.Pointer buffer, com.sun.jna.Pointer segmentLength) throws FbException; + public void putSegment(IStatus status, int length, com.sun.jna.Pointer buffer) throws FbException; + public void cancel(IStatus status) throws FbException; + public void close(IStatus status) throws FbException; + public int seek(IStatus status, int mode, int offset) throws FbException; + } + + public static interface ITransactionIntf extends IReferenceCountedIntf + { + public void getInfo(IStatus status, int itemsLength, byte[] items, int bufferLength, byte[] buffer) throws FbException; + public void prepare(IStatus status, int msgLength, byte[] message) throws FbException; + public void commit(IStatus status) throws FbException; + public void commitRetaining(IStatus status) throws FbException; + public void rollback(IStatus status) throws FbException; + public void rollbackRetaining(IStatus status) throws FbException; + public void disconnect(IStatus status) throws FbException; + public ITransaction join(IStatus status, ITransaction transaction) throws FbException; + public ITransaction validate(IStatus status, IAttachment attachment) throws FbException; + public ITransaction enterDtc(IStatus status) throws FbException; + } + + public static interface IMessageMetadataIntf extends IReferenceCountedIntf + { + public int getCount(IStatus status) throws FbException; + public String getField(IStatus status, int index) throws FbException; + public String getRelation(IStatus status, int index) throws FbException; + public String getOwner(IStatus status, int index) throws FbException; + public String getAlias(IStatus status, int index) throws FbException; + public int getType(IStatus status, int index) throws FbException; + public boolean isNullable(IStatus status, int index) throws FbException; + public int getSubType(IStatus status, int index) throws FbException; + public int getLength(IStatus status, int index) throws FbException; + public int getScale(IStatus status, int index) throws FbException; + public int getCharSet(IStatus status, int index) throws FbException; + public int getOffset(IStatus status, int index) throws FbException; + public int getNullOffset(IStatus status, int index) throws FbException; + public IMetadataBuilder getBuilder(IStatus status) throws FbException; + public int getMessageLength(IStatus status) throws FbException; + public int getAlignment(IStatus status) throws FbException; + public int getAlignedLength(IStatus status) throws FbException; + } + + public static interface IMetadataBuilderIntf extends IReferenceCountedIntf + { + public void setType(IStatus status, int index, int type) throws FbException; + public void setSubType(IStatus status, int index, int subType) throws FbException; + public void setLength(IStatus status, int index, int length) throws FbException; + public void setCharSet(IStatus status, int index, int charSet) throws FbException; + public void setScale(IStatus status, int index, int scale) throws FbException; + public void truncate(IStatus status, int count) throws FbException; + public void moveNameToIndex(IStatus status, String name, int index) throws FbException; + public void remove(IStatus status, int index) throws FbException; + public int addField(IStatus status) throws FbException; + public IMessageMetadata getMetadata(IStatus status) throws FbException; + } + + public static interface IResultSetIntf extends IReferenceCountedIntf + { + public int fetchNext(IStatus status, com.sun.jna.Pointer message) throws FbException; + public int fetchPrior(IStatus status, com.sun.jna.Pointer message) throws FbException; + public int fetchFirst(IStatus status, com.sun.jna.Pointer message) throws FbException; + public int fetchLast(IStatus status, com.sun.jna.Pointer message) throws FbException; + public int fetchAbsolute(IStatus status, int position, com.sun.jna.Pointer message) throws FbException; + public int fetchRelative(IStatus status, int offset, com.sun.jna.Pointer message) throws FbException; + public boolean isEof(IStatus status) throws FbException; + public boolean isBof(IStatus status) throws FbException; + public IMessageMetadata getMetadata(IStatus status) throws FbException; + public void close(IStatus status) throws FbException; + public void setDelayedOutputFormat(IStatus status, IMessageMetadata format) throws FbException; + } + + public static interface IStatementIntf extends IReferenceCountedIntf + { + public static int PREPARE_PREFETCH_NONE = 0; + public static int PREPARE_PREFETCH_TYPE = 1; + public static int PREPARE_PREFETCH_INPUT_PARAMETERS = 2; + public static int PREPARE_PREFETCH_OUTPUT_PARAMETERS = 4; + public static int PREPARE_PREFETCH_LEGACY_PLAN = 8; + public static int PREPARE_PREFETCH_DETAILED_PLAN = 16; + public static int PREPARE_PREFETCH_AFFECTED_RECORDS = 32; + public static int PREPARE_PREFETCH_FLAGS = 64; + public static int PREPARE_PREFETCH_METADATA = IStatementIntf.PREPARE_PREFETCH_TYPE | IStatementIntf.PREPARE_PREFETCH_FLAGS | IStatementIntf.PREPARE_PREFETCH_INPUT_PARAMETERS | IStatementIntf.PREPARE_PREFETCH_OUTPUT_PARAMETERS; + public static int PREPARE_PREFETCH_ALL = IStatementIntf.PREPARE_PREFETCH_METADATA | IStatementIntf.PREPARE_PREFETCH_LEGACY_PLAN | IStatementIntf.PREPARE_PREFETCH_DETAILED_PLAN | IStatementIntf.PREPARE_PREFETCH_AFFECTED_RECORDS; + public static int FLAG_HAS_CURSOR = 1; + public static int FLAG_REPEAT_EXECUTE = 2; + public static int CURSOR_TYPE_SCROLLABLE = 1; + + public void getInfo(IStatus status, int itemsLength, byte[] items, int bufferLength, byte[] buffer) throws FbException; + public int getType(IStatus status) throws FbException; + public String getPlan(IStatus status, boolean detailed) throws FbException; + public long getAffectedRecords(IStatus status) throws FbException; + public IMessageMetadata getInputMetadata(IStatus status) throws FbException; + public IMessageMetadata getOutputMetadata(IStatus status) throws FbException; + public ITransaction execute(IStatus status, ITransaction transaction, IMessageMetadata inMetadata, com.sun.jna.Pointer inBuffer, IMessageMetadata outMetadata, com.sun.jna.Pointer outBuffer) throws FbException; + public IResultSet openCursor(IStatus status, ITransaction transaction, IMessageMetadata inMetadata, com.sun.jna.Pointer inBuffer, IMessageMetadata outMetadata, int flags) throws FbException; + public void setCursorName(IStatus status, String name) throws FbException; + public void free(IStatus status) throws FbException; + public int getFlags(IStatus status) throws FbException; + public int getTimeout(IStatus status) throws FbException; + public void setTimeout(IStatus status, int timeOut) throws FbException; + public IBatch createBatch(IStatus status, IMessageMetadata inMetadata, int parLength, byte[] par) throws FbException; + } + + public static interface IBatchIntf extends IReferenceCountedIntf + { + public static byte VERSION1 = 1; + public static byte TAG_MULTIERROR = 1; + public static byte TAG_RECORD_COUNTS = 2; + public static byte TAG_BUFFER_BYTES_SIZE = 3; + public static byte TAG_BLOB_POLICY = 4; + public static byte TAG_DETAILED_ERRORS = 5; + public static byte BLOB_NONE = 0; + public static byte BLOB_ID_ENGINE = 1; + public static byte BLOB_ID_USER = 2; + public static byte BLOB_STREAM = 3; + public static int BLOB_SEGHDR_ALIGN = 2; + + public void add(IStatus status, int count, com.sun.jna.Pointer inBuffer) throws FbException; + public void addBlob(IStatus status, int length, com.sun.jna.Pointer inBuffer, com.sun.jna.ptr.LongByReference blobId, int parLength, byte[] par) throws FbException; + public void appendBlobData(IStatus status, int length, com.sun.jna.Pointer inBuffer) throws FbException; + public void addBlobStream(IStatus status, int length, com.sun.jna.Pointer inBuffer) throws FbException; + public void registerBlob(IStatus status, com.sun.jna.ptr.LongByReference existingBlob, com.sun.jna.ptr.LongByReference blobId) throws FbException; + public IBatchCompletionState execute(IStatus status, ITransaction transaction) throws FbException; + public void cancel(IStatus status) throws FbException; + public int getBlobAlignment(IStatus status) throws FbException; + public IMessageMetadata getMetadata(IStatus status) throws FbException; + public void setDefaultBpb(IStatus status, int parLength, byte[] par) throws FbException; + } + + public static interface IBatchCompletionStateIntf extends IDisposableIntf + { + public static int EXECUTE_FAILED = -1; + public static int SUCCESS_NO_INFO = -2; + public static int NO_MORE_ERRORS = -1; + + public int getSize(IStatus status) throws FbException; + public int getState(IStatus status, int pos) throws FbException; + public int findError(IStatus status, int pos) throws FbException; + public void getStatus(IStatus status, IStatus to, int pos) throws FbException; + } + + public static interface IRequestIntf extends IReferenceCountedIntf + { + public void receive(IStatus status, int level, int msgType, int length, com.sun.jna.Pointer message) throws FbException; + public void send(IStatus status, int level, int msgType, int length, com.sun.jna.Pointer message) throws FbException; + public void getInfo(IStatus status, int level, int itemsLength, byte[] items, int bufferLength, byte[] buffer) throws FbException; + public void start(IStatus status, ITransaction tra, int level) throws FbException; + public void startAndSend(IStatus status, ITransaction tra, int level, int msgType, int length, com.sun.jna.Pointer message) throws FbException; + public void unwind(IStatus status, int level) throws FbException; + public void free(IStatus status) throws FbException; + } + + public static interface IEventsIntf extends IReferenceCountedIntf + { + public void cancel(IStatus status) throws FbException; + } + + public static interface IEventBlockIntf extends IDisposableIntf + { + public int getLength(); + public com.sun.jna.Pointer getValues(); + public com.sun.jna.Pointer getBuffer(); + public int getCount(); + public com.sun.jna.Pointer getCounters(); + public void counts(); + } + + public static interface IAttachmentIntf extends IReferenceCountedIntf + { + public void getInfo(IStatus status, int itemsLength, byte[] items, int bufferLength, byte[] buffer) throws FbException; + public ITransaction startTransaction(IStatus status, int tpbLength, byte[] tpb) throws FbException; + public ITransaction reconnectTransaction(IStatus status, int length, byte[] id) throws FbException; + public IRequest compileRequest(IStatus status, int blrLength, byte[] blr) throws FbException; + public void transactRequest(IStatus status, ITransaction transaction, int blrLength, byte[] blr, int inMsgLength, byte[] inMsg, int outMsgLength, byte[] outMsg) throws FbException; + public IBlob createBlob(IStatus status, ITransaction transaction, com.sun.jna.ptr.LongByReference id, int bpbLength, byte[] bpb) throws FbException; + public IBlob openBlob(IStatus status, ITransaction transaction, com.sun.jna.ptr.LongByReference id, int bpbLength, byte[] bpb) throws FbException; + public int getSlice(IStatus status, ITransaction transaction, com.sun.jna.ptr.LongByReference id, int sdlLength, byte[] sdl, int paramLength, byte[] param, int sliceLength, byte[] slice) throws FbException; + public void putSlice(IStatus status, ITransaction transaction, com.sun.jna.ptr.LongByReference id, int sdlLength, byte[] sdl, int paramLength, byte[] param, int sliceLength, byte[] slice) throws FbException; + public void executeDyn(IStatus status, ITransaction transaction, int length, byte[] dyn) throws FbException; + public IStatement prepare(IStatus status, ITransaction tra, int stmtLength, String sqlStmt, int dialect, int flags) throws FbException; + public ITransaction execute(IStatus status, ITransaction transaction, int stmtLength, String sqlStmt, int dialect, IMessageMetadata inMetadata, com.sun.jna.Pointer inBuffer, IMessageMetadata outMetadata, com.sun.jna.Pointer outBuffer) throws FbException; + public IResultSet openCursor(IStatus status, ITransaction transaction, int stmtLength, String sqlStmt, int dialect, IMessageMetadata inMetadata, com.sun.jna.Pointer inBuffer, IMessageMetadata outMetadata, String cursorName, int cursorFlags) throws FbException; + public IEvents queEvents(IStatus status, IEventCallback callback, int length, byte[] events) throws FbException; + public void cancelOperation(IStatus status, int option) throws FbException; + public void ping(IStatus status) throws FbException; + public void detach(IStatus status) throws FbException; + public void dropDatabase(IStatus status) throws FbException; + public int getIdleTimeout(IStatus status) throws FbException; + public void setIdleTimeout(IStatus status, int timeOut) throws FbException; + public int getStatementTimeout(IStatus status) throws FbException; + public void setStatementTimeout(IStatus status, int timeOut) throws FbException; + public IBatch createBatch(IStatus status, ITransaction transaction, int stmtLength, String sqlStmt, int dialect, IMessageMetadata inMetadata, int parLength, byte[] par) throws FbException; + } + + public static interface IServiceIntf extends IReferenceCountedIntf + { + public void detach(IStatus status) throws FbException; + public void query(IStatus status, int sendLength, byte[] sendItems, int receiveLength, byte[] receiveItems, int bufferLength, byte[] buffer) throws FbException; + public void start(IStatus status, int spbLength, byte[] spb) throws FbException; + } + + public static interface IProviderIntf extends IPluginBaseIntf + { + public IAttachment attachDatabase(IStatus status, String fileName, int dpbLength, byte[] dpb) throws FbException; + public IAttachment createDatabase(IStatus status, String fileName, int dpbLength, byte[] dpb) throws FbException; + public IService attachServiceManager(IStatus status, String service, int spbLength, byte[] spb) throws FbException; + public void shutdown(IStatus status, int timeout, int reason) throws FbException; + public void setDbCryptCallback(IStatus status, ICryptKeyCallback cryptCallback) throws FbException; + } + + public static interface IDtcStartIntf extends IDisposableIntf + { + public void addAttachment(IStatus status, IAttachment att) throws FbException; + public void addWithTpb(IStatus status, IAttachment att, int length, byte[] tpb) throws FbException; + public ITransaction start(IStatus status) throws FbException; + } + + public static interface IDtcIntf extends IVersionedIntf + { + public ITransaction join(IStatus status, ITransaction one, ITransaction two) throws FbException; + public IDtcStart startBuilder(IStatus status) throws FbException; + } + + public static interface IAuthIntf extends IPluginBaseIntf + { + public static int AUTH_FAILED = -1; + public static int AUTH_SUCCESS = 0; + public static int AUTH_MORE_DATA = 1; + public static int AUTH_CONTINUE = 2; + + } + + public static interface IWriterIntf extends IVersionedIntf + { + public void reset(); + public void add(IStatus status, String name) throws FbException; + public void setType(IStatus status, String value) throws FbException; + public void setDb(IStatus status, String value) throws FbException; + } + + public static interface IServerBlockIntf extends IVersionedIntf + { + public String getLogin(); + public com.sun.jna.Pointer getData(com.sun.jna.Pointer length); + public void putData(IStatus status, int length, com.sun.jna.Pointer data) throws FbException; + public ICryptKey newKey(IStatus status) throws FbException; + } + + public static interface IClientBlockIntf extends IReferenceCountedIntf + { + public String getLogin(); + public String getPassword(); + public String getCertificate(); + public String getRepositoryPin(); + public com.sun.jna.Pointer getData(com.sun.jna.Pointer length); + public void putData(IStatus status, int length, com.sun.jna.Pointer data) throws FbException; + public ICryptKey newKey(IStatus status) throws FbException; + public IAuthBlock getAuthBlock(IStatus status) throws FbException; + } + + public static interface IServerIntf extends IAuthIntf + { + public int authenticate(IStatus status, IServerBlock sBlock, IWriter writerInterface) throws FbException; + public void setDbCryptCallback(IStatus status, ICryptKeyCallback cryptCallback) throws FbException; + } + + public static interface IClientIntf extends IAuthIntf + { + public int authenticate(IStatus status, IClientBlock cBlock) throws FbException; + } + + public static interface IUserFieldIntf extends IVersionedIntf + { + public int entered(); + public int specified(); + public void setEntered(IStatus status, int newValue) throws FbException; + } + + public static interface ICharUserFieldIntf extends IUserFieldIntf + { + public String get(); + public void set(IStatus status, String newValue) throws FbException; + } + + public static interface IIntUserFieldIntf extends IUserFieldIntf + { + public int get(); + public void set(IStatus status, int newValue) throws FbException; + } + + public static interface IUserIntf extends IVersionedIntf + { + public static int OP_USER_ADD = 1; + public static int OP_USER_MODIFY = 2; + public static int OP_USER_DELETE = 3; + public static int OP_USER_DISPLAY = 4; + public static int OP_USER_SET_MAP = 5; + public static int OP_USER_DROP_MAP = 6; + + public int operation(); + public ICharUserField userName(); + public ICharUserField password(); + public ICharUserField firstName(); + public ICharUserField lastName(); + public ICharUserField middleName(); + public ICharUserField comment(); + public ICharUserField attributes(); + public IIntUserField active(); + public IIntUserField admin(); + public void clear(IStatus status) throws FbException; + } + + public static interface IListUsersIntf extends IVersionedIntf + { + public void list(IStatus status, IUser user) throws FbException; + } + + public static interface ILogonInfoIntf extends IVersionedIntf + { + public String name(); + public String role(); + public String networkProtocol(); + public String remoteAddress(); + public com.sun.jna.Pointer authBlock(com.sun.jna.Pointer length); + } + + public static interface IManagementIntf extends IPluginBaseIntf + { + public void start(IStatus status, ILogonInfo logonInfo) throws FbException; + public int execute(IStatus status, IUser user, IListUsers callback) throws FbException; + public void commit(IStatus status) throws FbException; + public void rollback(IStatus status) throws FbException; + } + + public static interface IAuthBlockIntf extends IVersionedIntf + { + public String getType(); + public String getName(); + public String getPlugin(); + public String getSecurityDb(); + public String getOriginalPlugin(); + public boolean next(IStatus status) throws FbException; + public boolean first(IStatus status) throws FbException; + } + + public static interface IWireCryptPluginIntf extends IPluginBaseIntf + { + public String getKnownTypes(IStatus status) throws FbException; + public void setKey(IStatus status, ICryptKey key) throws FbException; + public void encrypt(IStatus status, int length, com.sun.jna.Pointer from, com.sun.jna.Pointer to) throws FbException; + public void decrypt(IStatus status, int length, com.sun.jna.Pointer from, com.sun.jna.Pointer to) throws FbException; + } + + public static interface ICryptKeyCallbackIntf extends IVersionedIntf + { + public int callback(int dataLength, com.sun.jna.Pointer data, int bufferLength, com.sun.jna.Pointer buffer); + } + + public static interface IKeyHolderPluginIntf extends IPluginBaseIntf + { + public int keyCallback(IStatus status, ICryptKeyCallback callback) throws FbException; + public ICryptKeyCallback keyHandle(IStatus status, String keyName) throws FbException; + public boolean useOnlyOwnKeys(IStatus status) throws FbException; + public ICryptKeyCallback chainHandle(IStatus status) throws FbException; + } + + public static interface IDbCryptInfoIntf extends IReferenceCountedIntf + { + public String getDatabaseFullPath(IStatus status) throws FbException; + } + + public static interface IDbCryptPluginIntf extends IPluginBaseIntf + { + public void setKey(IStatus status, int length, IKeyHolderPlugin[] sources, String keyName) throws FbException; + public void encrypt(IStatus status, int length, com.sun.jna.Pointer from, com.sun.jna.Pointer to) throws FbException; + public void decrypt(IStatus status, int length, com.sun.jna.Pointer from, com.sun.jna.Pointer to) throws FbException; + public void setInfo(IStatus status, IDbCryptInfo info) throws FbException; + } + + public static interface IExternalContextIntf extends IVersionedIntf + { + public IMaster getMaster(); + public IExternalEngine getEngine(IStatus status) throws FbException; + public IAttachment getAttachment(IStatus status) throws FbException; + public ITransaction getTransaction(IStatus status) throws FbException; + public String getUserName(); + public String getDatabaseName(); + public String getClientCharSet(); + public int obtainInfoCode(); + public com.sun.jna.Pointer getInfo(int code); + public com.sun.jna.Pointer setInfo(int code, com.sun.jna.Pointer value); + } + + public static interface IExternalResultSetIntf extends IDisposableIntf + { + public boolean fetch(IStatus status) throws FbException; + } + + public static interface IExternalFunctionIntf extends IDisposableIntf + { + public void getCharSet(IStatus status, IExternalContext context, com.sun.jna.Pointer name, int nameSize) throws FbException; + public void execute(IStatus status, IExternalContext context, com.sun.jna.Pointer inMsg, com.sun.jna.Pointer outMsg) throws FbException; + } + + public static interface IExternalProcedureIntf extends IDisposableIntf + { + public void getCharSet(IStatus status, IExternalContext context, com.sun.jna.Pointer name, int nameSize) throws FbException; + public IExternalResultSet open(IStatus status, IExternalContext context, com.sun.jna.Pointer inMsg, com.sun.jna.Pointer outMsg) throws FbException; + } + + public static interface IExternalTriggerIntf extends IDisposableIntf + { + public static int TYPE_BEFORE = 1; + public static int TYPE_AFTER = 2; + public static int TYPE_DATABASE = 3; + public static int ACTION_INSERT = 1; + public static int ACTION_UPDATE = 2; + public static int ACTION_DELETE = 3; + public static int ACTION_CONNECT = 4; + public static int ACTION_DISCONNECT = 5; + public static int ACTION_TRANS_START = 6; + public static int ACTION_TRANS_COMMIT = 7; + public static int ACTION_TRANS_ROLLBACK = 8; + public static int ACTION_DDL = 9; + + public void getCharSet(IStatus status, IExternalContext context, com.sun.jna.Pointer name, int nameSize) throws FbException; + public void execute(IStatus status, IExternalContext context, int action, com.sun.jna.Pointer oldMsg, com.sun.jna.Pointer newMsg, com.sun.jna.Pointer oldDbKey, com.sun.jna.Pointer newDbKey) throws FbException; + } + + public static interface IRoutineMetadataIntf extends IVersionedIntf + { + public String getPackage(IStatus status) throws FbException; + public String getName(IStatus status) throws FbException; + public String getEntryPoint(IStatus status) throws FbException; + public String getBody(IStatus status) throws FbException; + public IMessageMetadata getInputMetadata(IStatus status) throws FbException; + public IMessageMetadata getOutputMetadata(IStatus status) throws FbException; + public IMessageMetadata getTriggerMetadata(IStatus status) throws FbException; + public String getTriggerTable(IStatus status) throws FbException; + public int getTriggerType(IStatus status) throws FbException; + } + + public static interface IExternalEngineIntf extends IPluginBaseIntf + { + public void open(IStatus status, IExternalContext context, com.sun.jna.Pointer charSet, int charSetSize) throws FbException; + public void openAttachment(IStatus status, IExternalContext context) throws FbException; + public void closeAttachment(IStatus status, IExternalContext context) throws FbException; + public IExternalFunction makeFunction(IStatus status, IExternalContext context, IRoutineMetadata metadata, IMetadataBuilder inBuilder, IMetadataBuilder outBuilder) throws FbException; + public IExternalProcedure makeProcedure(IStatus status, IExternalContext context, IRoutineMetadata metadata, IMetadataBuilder inBuilder, IMetadataBuilder outBuilder) throws FbException; + public IExternalTrigger makeTrigger(IStatus status, IExternalContext context, IRoutineMetadata metadata, IMetadataBuilder fieldsBuilder) throws FbException; + } + + public static interface ITimerIntf extends IReferenceCountedIntf + { + public void handler(); + } + + public static interface ITimerControlIntf extends IVersionedIntf + { + public void start(IStatus status, ITimer timer, long microSeconds) throws FbException; + public void stop(IStatus status, ITimer timer) throws FbException; + } + + public static interface IVersionCallbackIntf extends IVersionedIntf + { + public void callback(IStatus status, String text) throws FbException; + } + + public static interface IUtilIntf extends IVersionedIntf + { + public void getFbVersion(IStatus status, IAttachment att, IVersionCallback callback) throws FbException; + public void loadBlob(IStatus status, com.sun.jna.ptr.LongByReference blobId, IAttachment att, ITransaction tra, String file, boolean txt) throws FbException; + public void dumpBlob(IStatus status, com.sun.jna.ptr.LongByReference blobId, IAttachment att, ITransaction tra, String file, boolean txt) throws FbException; + public void getPerfCounters(IStatus status, IAttachment att, String countersSet, long[] counters) throws FbException; + public IAttachment executeCreateDatabase(IStatus status, int stmtLength, String creatDBstatement, int dialect, boolean[] stmtIsCreateDb) throws FbException; + public void decodeDate(ISC_DATE date, com.sun.jna.Pointer year, com.sun.jna.Pointer month, com.sun.jna.Pointer day); + public void decodeTime(ISC_TIME time, com.sun.jna.Pointer hours, com.sun.jna.Pointer minutes, com.sun.jna.Pointer seconds, com.sun.jna.Pointer fractions); + public ISC_DATE encodeDate(int year, int month, int day); + public ISC_TIME encodeTime(int hours, int minutes, int seconds, int fractions); + public int formatStatus(com.sun.jna.Pointer buffer, int bufferSize, IStatus status); + public int getClientVersion(); + public IXpbBuilder getXpbBuilder(IStatus status, int kind, byte[] buf, int len) throws FbException; + public int setOffsets(IStatus status, IMessageMetadata metadata, IOffsetsCallback callback) throws FbException; + public IEventBlock createEventBlock(IStatus status, String[] events) throws FbException; + public IDecFloat16 getDecFloat16(IStatus status) throws FbException; + public IDecFloat34 getDecFloat34(IStatus status) throws FbException; + public ITransaction getTransactionByHandle(IStatus status, com.sun.jna.ptr.LongByReference hndlPtr) throws FbException; + public IStatement getStatementByHandle(IStatus status, com.sun.jna.ptr.LongByReference hndlPtr) throws FbException; + } + + public static interface IOffsetsCallbackIntf extends IVersionedIntf + { + public void setOffset(IStatus status, int index, int offset, int nullOffset) throws FbException; + } + + public static interface IXpbBuilderIntf extends IDisposableIntf + { + public static int DPB = 1; + public static int SPB_ATTACH = 2; + public static int SPB_START = 3; + public static int TPB = 4; + public static int BATCH = 5; + public static int BPB = 6; + + public void clear(IStatus status) throws FbException; + public void removeCurrent(IStatus status) throws FbException; + public void insertInt(IStatus status, byte tag, int value) throws FbException; + public void insertBigInt(IStatus status, byte tag, long value) throws FbException; + public void insertBytes(IStatus status, byte tag, com.sun.jna.Pointer bytes, int length) throws FbException; + public void insertString(IStatus status, byte tag, String str) throws FbException; + public void insertTag(IStatus status, byte tag) throws FbException; + public boolean isEof(IStatus status) throws FbException; + public void moveNext(IStatus status) throws FbException; + public void rewind(IStatus status) throws FbException; + public boolean findFirst(IStatus status, byte tag) throws FbException; + public boolean findNext(IStatus status) throws FbException; + public byte getTag(IStatus status) throws FbException; + public int getLength(IStatus status) throws FbException; + public int getInt(IStatus status) throws FbException; + public long getBigInt(IStatus status) throws FbException; + public String getString(IStatus status) throws FbException; + public com.sun.jna.Pointer getBytes(IStatus status) throws FbException; + public int getBufferLength(IStatus status) throws FbException; + public com.sun.jna.Pointer getBuffer(IStatus status) throws FbException; + } + + public static interface ITraceConnectionIntf extends IVersionedIntf + { + public static int KIND_DATABASE = 1; + public static int KIND_SERVICE = 2; + + public int getKind(); + public int getProcessID(); + public String getUserName(); + public String getRoleName(); + public String getCharSet(); + public String getRemoteProtocol(); + public String getRemoteAddress(); + public String getRemoteHwAddress(); + public int getRemoteProcessID(); + public String getRemoteProcessName(); + } + + public static interface ITraceDatabaseConnectionIntf extends ITraceConnectionIntf + { + public long getConnectionID(); + public String getDatabaseName(); + } + + public static interface ITraceTransactionIntf extends IVersionedIntf + { + public static int ISOLATION_CONSISTENCY = 1; + public static int ISOLATION_CONCURRENCY = 2; + public static int ISOLATION_READ_COMMITTED_RECVER = 3; + public static int ISOLATION_READ_COMMITTED_NORECVER = 4; + public static int ISOLATION_READ_COMMITTED_READ_CONSISTENCY = 5; + + public long getTransactionID(); + public boolean getReadOnly(); + public int getWait(); + public int getIsolation(); + public com.sun.jna.Pointer getPerf(); + } + + public static interface ITraceParamsIntf extends IVersionedIntf + { + public int getCount(); + public com.sun.jna.Pointer getParam(int idx); + public String getTextUTF8(IStatus status, int idx) throws FbException; + } + + public static interface ITraceStatementIntf extends IVersionedIntf + { + public long getStmtID(); + public com.sun.jna.Pointer getPerf(); + } + + public static interface ITraceSQLStatementIntf extends ITraceStatementIntf + { + public String getText(); + public String getPlan(); + public ITraceParams getInputs(); + public String getTextUTF8(); + public String getExplainedPlan(); + } + + public static interface ITraceBLRStatementIntf extends ITraceStatementIntf + { + public com.sun.jna.Pointer getData(); + public int getDataLength(); + public String getText(); + } + + public static interface ITraceDYNRequestIntf extends IVersionedIntf + { + public com.sun.jna.Pointer getData(); + public int getDataLength(); + public String getText(); + } + + public static interface ITraceContextVariableIntf extends IVersionedIntf + { + public String getNameSpace(); + public String getVarName(); + public String getVarValue(); + } + + public static interface ITraceProcedureIntf extends IVersionedIntf + { + public String getProcName(); + public ITraceParams getInputs(); + public com.sun.jna.Pointer getPerf(); + } + + public static interface ITraceFunctionIntf extends IVersionedIntf + { + public String getFuncName(); + public ITraceParams getInputs(); + public ITraceParams getResult(); + public com.sun.jna.Pointer getPerf(); + } + + public static interface ITraceTriggerIntf extends IVersionedIntf + { + public static int TYPE_ALL = 0; + public static int TYPE_BEFORE = 1; + public static int TYPE_AFTER = 2; + + public String getTriggerName(); + public String getRelationName(); + public int getAction(); + public int getWhich(); + public com.sun.jna.Pointer getPerf(); + } + + public static interface ITraceServiceConnectionIntf extends ITraceConnectionIntf + { + public com.sun.jna.Pointer getServiceID(); + public String getServiceMgr(); + public String getServiceName(); + } + + public static interface ITraceStatusVectorIntf extends IVersionedIntf + { + public boolean hasError(); + public boolean hasWarning(); + public IStatus getStatus(); + public String getText(); + } + + public static interface ITraceSweepInfoIntf extends IVersionedIntf + { + public long getOIT(); + public long getOST(); + public long getOAT(); + public long getNext(); + public com.sun.jna.Pointer getPerf(); + } + + public static interface ITraceLogWriterIntf extends IReferenceCountedIntf + { + public int write(com.sun.jna.Pointer buf, int size); + } + + public static interface ITraceInitInfoIntf extends IVersionedIntf + { + public String getConfigText(); + public int getTraceSessionID(); + public String getTraceSessionName(); + public int getTraceSessionFlags(); + public String getFirebirdRootDirectory(); + public String getDatabaseName(); + public ITraceDatabaseConnection getConnection(); + public ITraceServiceConnection getService(); + public ITraceLogWriter getLogWriter(); + } + + public static interface ITracePluginIntf extends IReferenceCountedIntf + { + public static int RESULT_SUCCESS = 0; + public static int RESULT_FAILED = 1; + public static int RESULT_UNAUTHORIZED = 2; + public static int SWEEP_STATE_STARTED = 1; + public static int SWEEP_STATE_FINISHED = 2; + public static int SWEEP_STATE_FAILED = 3; + public static int SWEEP_STATE_PROGRESS = 4; + + public String trace_get_error(); + public boolean trace_attach(ITraceDatabaseConnection connection, boolean create_db, int dpb_length, byte[] dpb, int att_result); + public boolean trace_detach(ITraceDatabaseConnection connection, boolean drop_db); + public boolean trace_transaction_start(ITraceDatabaseConnection connection, ITraceTransaction transaction, int tpb_length, byte[] tpb, int tra_result); + public boolean trace_transaction_end(ITraceDatabaseConnection connection, ITraceTransaction transaction, boolean commit, boolean retain_context, int tra_result); + public boolean trace_proc_execute(ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceProcedure procedure, boolean started, int proc_result); + public boolean trace_trigger_execute(ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceTrigger trigger, boolean started, int trig_result); + public boolean trace_set_context(ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceContextVariable variable); + public boolean trace_dsql_prepare(ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceSQLStatement statement, long time_millis, int req_result); + public boolean trace_dsql_free(ITraceDatabaseConnection connection, ITraceSQLStatement statement, int option); + public boolean trace_dsql_execute(ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceSQLStatement statement, boolean started, int req_result); + public boolean trace_blr_compile(ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceBLRStatement statement, long time_millis, int req_result); + public boolean trace_blr_execute(ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceBLRStatement statement, int req_result); + public boolean trace_dyn_execute(ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceDYNRequest request, long time_millis, int req_result); + public boolean trace_service_attach(ITraceServiceConnection service, int spb_length, byte[] spb, int att_result); + public boolean trace_service_start(ITraceServiceConnection service, int switches_length, String switches, int start_result); + public boolean trace_service_query(ITraceServiceConnection service, int send_item_length, byte[] send_items, int recv_item_length, byte[] recv_items, int query_result); + public boolean trace_service_detach(ITraceServiceConnection service, int detach_result); + public boolean trace_event_error(ITraceConnection connection, ITraceStatusVector status, String function); + public boolean trace_event_sweep(ITraceDatabaseConnection connection, ITraceSweepInfo sweep, int sweep_state); + public boolean trace_func_execute(ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceFunction function, boolean started, int func_result); + public boolean trace_privilege_change(ITraceDatabaseConnection connection, ITraceTransaction transaction, String executor, String grantor, boolean is_grant, String object_name, String field_name, String user_name, String privileges, int options, int change_result); + } + + public static interface ITraceFactoryIntf extends IPluginBaseIntf + { + public static int TRACE_EVENT_ATTACH = 0; + public static int TRACE_EVENT_DETACH = 1; + public static int TRACE_EVENT_TRANSACTION_START = 2; + public static int TRACE_EVENT_TRANSACTION_END = 3; + public static int TRACE_EVENT_SET_CONTEXT = 4; + public static int TRACE_EVENT_PROC_EXECUTE = 5; + public static int TRACE_EVENT_TRIGGER_EXECUTE = 6; + public static int TRACE_EVENT_DSQL_PREPARE = 7; + public static int TRACE_EVENT_DSQL_FREE = 8; + public static int TRACE_EVENT_DSQL_EXECUTE = 9; + public static int TRACE_EVENT_BLR_COMPILE = 10; + public static int TRACE_EVENT_BLR_EXECUTE = 11; + public static int TRACE_EVENT_DYN_EXECUTE = 12; + public static int TRACE_EVENT_SERVICE_ATTACH = 13; + public static int TRACE_EVENT_SERVICE_START = 14; + public static int TRACE_EVENT_SERVICE_QUERY = 15; + public static int TRACE_EVENT_SERVICE_DETACH = 16; + public static int TRACE_EVENT_ERROR = 17; + public static int TRACE_EVENT_SWEEP = 18; + public static int TRACE_EVENT_FUNC_EXECUTE = 19; + public static int TRACE_EVENT_PRIVILEGE_CHANGE = 20; + public static int TRACE_EVENT_MAX = 21; + + public long trace_needs(); + public ITracePlugin trace_create(IStatus status, ITraceInitInfo init_info) throws FbException; + } + + public static interface IUdrFunctionFactoryIntf extends IDisposableIntf + { + public void setup(IStatus status, IExternalContext context, IRoutineMetadata metadata, IMetadataBuilder inBuilder, IMetadataBuilder outBuilder) throws FbException; + public IExternalFunction newItem(IStatus status, IExternalContext context, IRoutineMetadata metadata) throws FbException; + } + + public static interface IUdrProcedureFactoryIntf extends IDisposableIntf + { + public void setup(IStatus status, IExternalContext context, IRoutineMetadata metadata, IMetadataBuilder inBuilder, IMetadataBuilder outBuilder) throws FbException; + public IExternalProcedure newItem(IStatus status, IExternalContext context, IRoutineMetadata metadata) throws FbException; + } + + public static interface IUdrTriggerFactoryIntf extends IDisposableIntf + { + public void setup(IStatus status, IExternalContext context, IRoutineMetadata metadata, IMetadataBuilder fieldsBuilder) throws FbException; + public IExternalTrigger newItem(IStatus status, IExternalContext context, IRoutineMetadata metadata) throws FbException; + } + + public static interface IUdrPluginIntf extends IVersionedIntf + { + public IMaster getMaster(); + public void registerFunction(IStatus status, String name, IUdrFunctionFactory factory) throws FbException; + public void registerProcedure(IStatus status, String name, IUdrProcedureFactory factory) throws FbException; + public void registerTrigger(IStatus status, String name, IUdrTriggerFactory factory) throws FbException; + } + + public static interface IDecFloat16Intf extends IVersionedIntf + { + public static int BCD_SIZE = 16; + public static int STRING_SIZE = 24; + + public void toBcd(FB_DEC16[] from, com.sun.jna.Pointer sign, byte[] bcd, com.sun.jna.Pointer exp); + public void toString(IStatus status, FB_DEC16[] from, int bufferLength, com.sun.jna.Pointer buffer) throws FbException; + public void fromBcd(int sign, byte[] bcd, int exp, FB_DEC16[] to); + public void fromString(IStatus status, String from, FB_DEC16[] to) throws FbException; + } + + public static interface IDecFloat34Intf extends IVersionedIntf + { + public static int BCD_SIZE = 34; + public static int STRING_SIZE = 43; + + public void toBcd(FB_DEC34[] from, com.sun.jna.Pointer sign, byte[] bcd, com.sun.jna.Pointer exp); + public void toString(IStatus status, FB_DEC34[] from, int bufferLength, com.sun.jna.Pointer buffer) throws FbException; + public void fromBcd(int sign, byte[] bcd, int exp, FB_DEC34[] to); + public void fromString(IStatus status, String from, FB_DEC34[] to) throws FbException; + } + + public static interface ICryptoKeyIntf extends IVersionedIntf + { + public com.sun.jna.Pointer getObjectInfo(); + public int loadFromFile(String fileName); + public int loadFromBuffer(com.sun.jna.Pointer buffer, int length); + public int loadFromCurrentRepository(); + public int saveToFile(String fileName); + public int saveToBuffer(com.sun.jna.Pointer buffer, int length, com.sun.jna.Pointer realLength); + public int saveToRepository(ICryptoRepository repository, String name); + public int setAgreeKeyFromRepository(ICryptoRepository repository); + public int setExchangeKey(ICryptoKey key); + public int generateKey(); + public int getIV(byte[] iv, int length, com.sun.jna.Pointer realLength); + public int setIV(byte[] iv, int length); + public int createFromBuffer(byte[] buffer, int length); + } + + public static interface ICryptoKeyPairIntf extends IVersionedIntf + { + public com.sun.jna.Pointer getObjectInfo(); + public int loadFromFile(String fileName); + public int loadFromBuffer(com.sun.jna.Pointer buffer, int length); + public int loadFromRepository(ICryptoRepository repository, String name); + public int loadFromCurrentRepository(); + public int saveToFile(String fileName); + public int saveToBuffer(com.sun.jna.Pointer buffer, int length, com.sun.jna.Pointer realLength); + public int saveToRepository(ICryptoRepository repository, String name); + public int setAgreeKeyFromRepository(ICryptoRepository repository); + public int setExchangeKey(ICryptoKey key); + public int generateKeyPair(); + public int getPublicKey(ICryptoKey key); + public int createPublicKey(ICryptoKey[] key); + public int deletePublicKey(ICryptoKey key); + } + + public static interface ICryptoRandomFactoryIntf extends IVersionedIntf + { + public com.sun.jna.Pointer getObjectInfo(); + public int generateRandom(byte[] buffer, int length, ICryptoProvider providerName); + } + + public static interface ICryptoHashFactoryIntf extends IVersionedIntf + { + public com.sun.jna.Pointer getObjectInfo(); + public int createHash(byte[] buffer, int bufferLength, byte[] hash, int hashLength, com.sun.jna.Pointer realHashLength, boolean asString); + public int setKeyForHash(ICryptoKey key); + } + + public static interface ICryptoSymmetricFactoryIntf extends IVersionedIntf + { + public com.sun.jna.Pointer getObjectInfo(); + public int encrypt(byte[] data, int dataLength, byte[] cryptData, int cryptDataLength, com.sun.jna.Pointer realCryptDataLength, ICryptoKey key); + public int decrypt(byte[] cryptData, int cryptDataLength, byte[] data, int dataLength, com.sun.jna.Pointer realDataLength, ICryptoKey key); + public int createKey(ICryptoRepository repository, ICryptoKey[] key); + public int deleteKey(ICryptoKey key); + } + + public static interface ICryptoSignatureFactoryIntf extends IVersionedIntf + { + public com.sun.jna.Pointer getObjectInfo(); + public int createKeyPair(ICryptoRepository repository, ICryptoKeyPair[] key); + public int deleteKeyPair(ICryptoKeyPair keyPair); + public int sign(byte[] data, int dataLength, ICryptoSignature signature, ICryptoKeyPair privateKey); + public int verifySign(byte[] data, int dataLength, ICryptoSignature signature, ICryptoKey publicKey); + public int createSignature(ICryptoSignature[] signature); + public int deleteSignature(ICryptoSignature signature); + } + + public static interface ICryptoSignatureIntf extends IVersionedIntf + { + public com.sun.jna.Pointer getObjectInfo(); + public int saveToFile(String fileName); + public int saveToBuffer(com.sun.jna.Pointer buffer, int length, com.sun.jna.Pointer realLength); + public int loadFromFile(String fileName); + public int loadFromBuffer(com.sun.jna.Pointer buffer, int length); + } + + public static interface ICryptoCertificateFactoryIntf extends IVersionedIntf + { + public com.sun.jna.Pointer getObjectInfo(); + public int createCertificate(ICryptoRepository repository, ICryptoCertificate[] certificate); + public int deleteCertificate(ICryptoCertificate certificate); + public int encrypt(byte[] data, int dataLength, byte[] cryptData, int cryptDataLength, com.sun.jna.Pointer realCryptDataLength, ICryptoCertificate certificate); + public int decrypt(byte[] cryptData, int cryptDataLength, byte[] data, int dataLength, com.sun.jna.Pointer realDataLength, ICryptoRepository repository); + } + + public static interface ICryptoCertificateIntf extends IVersionedIntf + { + public com.sun.jna.Pointer getObjectInfo(); + public int loadFromFile(String fileName); + public int loadFromBuffer(com.sun.jna.Pointer buffer, int length); + public int loadFromBinaryBuffer(com.sun.jna.Pointer buffer, int length); + public int loadFromRepository(ICryptoRepository repository, String name); + public int saveToFile(String fileName); + public int saveToBuffer(com.sun.jna.Pointer buffer, int length, com.sun.jna.Pointer realLength); + public int saveToBinaryBuffer(com.sun.jna.Pointer buffer, int length, com.sun.jna.Pointer realLength); + public int verifyCertificate(ICryptoCertificate certificate); + public int getId(byte[] id, com.sun.jna.Pointer length); + public int getIssuerName(byte[] issuerName, com.sun.jna.Pointer length); + public int getPublicKey(ICryptoKey key); + public int getPublicKeyMethod(com.sun.jna.Pointer method, com.sun.jna.Pointer length); + public int createPublicKeyFromCertificate(ICryptoRepository repository, ICryptoKey[] key); + public int deleteCertificatePublicKey(ICryptoKey key); + public int getSerialNumber(byte[] serialNumber, com.sun.jna.Pointer length); + public int getOwnerName(com.sun.jna.Pointer ownerName, com.sun.jna.Pointer length, String user_dn); + public int getKeyContainer(com.sun.jna.Pointer container, com.sun.jna.Pointer length); + } + + public static interface ICryptoRepositoryIntf extends IVersionedIntf + { + public com.sun.jna.Pointer getObjectInfo(); + public int getRepositoryName(com.sun.jna.Pointer name, int length, com.sun.jna.Pointer realLength); + public int open(String path, int openMode, int repositoryLocation, int providerType); + public int close(); + public int createPublicKey(int method, ICryptoKey[] key); + public int getPublicKey(ICryptoKey key); + public int deletePublicKey(ICryptoKey key); + public boolean isOpened(); + } + + public static interface ICryptoProviderIntf extends IVersionedIntf + { + public com.sun.jna.Pointer getObjectInfo(); + public int createRepository(ICryptoRepository[] repository, int type, String pin); + public int deleteRepository(ICryptoRepository repository); + } + + public static interface IListCryptoObjectsIntf extends IVersionedIntf + { + public void list(CryptoObjectInfo[] objInfo); + } + + public static interface ICryptoFactoryIntf extends IPluginBaseIntf + { + public void setTrace(boolean need); + public ICryptoProvider getCryptoProvider(CryptoObjectInfo[] objInfo); + public ICryptoRandomFactory getCryptoRandomFactory(CryptoObjectInfo[] objInfo); + public ICryptoHashFactory getCryptoHashFactory(CryptoObjectInfo[] objInfo); + public ICryptoSymmetricFactory getCryptoSymmetricFactory(CryptoObjectInfo[] objInfo); + public ICryptoSignatureFactory getCryptoSignatureFactory(CryptoObjectInfo[] objInfo); + public ICryptoCertificateFactory getCryptoCertificateFactory(CryptoObjectInfo[] objInfo); + public int getCryptoObjects(int type, IListCryptoObjects callback); + } + + public static class IVersioned extends com.sun.jna.Structure implements IVersionedIntf + { + public static class VTable extends com.sun.jna.Structure implements com.sun.jna.Structure.ByReference + { + public com.sun.jna.Pointer cloopDummy; + public com.sun.jna.Pointer version; + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IVersionedIntf obj) + { + } + + public VTable() + { + } + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = new java.util.ArrayList(); + fields.addAll(java.util.Arrays.asList("cloopDummy", "version")); + return fields; + } + } + + public com.sun.jna.Pointer cloopDummy; + public com.sun.jna.Pointer cloopVTable; + protected volatile VTable vTable; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = new java.util.ArrayList(); + fields.addAll(java.util.Arrays.asList("cloopDummy", "cloopVTable")); + return fields; + } + + @SuppressWarnings("unchecked") + public final T getVTable() + { + if (vTable == null) + { + synchronized (cloopVTable) + { + if (vTable == null) + { + vTable = createVTable(); + vTable.read(); + } + } + } + + return (T) vTable; + } + + public IVersioned() + { + } + + public IVersioned(final IVersionedIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + } + + public static class IReferenceCounted extends IVersioned implements IReferenceCountedIntf + { + public static class VTable extends IVersioned.VTable + { + public static interface Callback_addRef extends com.sun.jna.Callback + { + public void invoke(IReferenceCounted self); + } + + public static interface Callback_release extends com.sun.jna.Callback + { + public int invoke(IReferenceCounted self); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IReferenceCountedIntf obj) + { + super(obj); + + addRef = new Callback_addRef() { + @Override + public void invoke(IReferenceCounted self) + { + obj.addRef(); + } + }; + + release = new Callback_release() { + @Override + public int invoke(IReferenceCounted self) + { + return obj.release(); + } + }; + } + + public VTable() + { + } + + public Callback_addRef addRef; + public Callback_release release; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("addRef", "release")); + return fields; + } + } + + public IReferenceCounted() + { + } + + public IReferenceCounted(final IReferenceCountedIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public void addRef() + { + VTable vTable = getVTable(); + vTable.addRef.invoke(this); + } + + public int release() + { + VTable vTable = getVTable(); + int result = vTable.release.invoke(this); + return result; + } + } + + public static class IDisposable extends IVersioned implements IDisposableIntf + { + public static class VTable extends IVersioned.VTable + { + public static interface Callback_dispose extends com.sun.jna.Callback + { + public void invoke(IDisposable self); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IDisposableIntf obj) + { + super(obj); + + dispose = new Callback_dispose() { + @Override + public void invoke(IDisposable self) + { + obj.dispose(); + } + }; + } + + public VTable() + { + } + + public Callback_dispose dispose; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("dispose")); + return fields; + } + } + + public IDisposable() + { + } + + public IDisposable(final IDisposableIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public void dispose() + { + VTable vTable = getVTable(); + vTable.dispose.invoke(this); + } + } + + public static class IStatus extends IDisposable implements IStatusIntf + { + public static class VTable extends IDisposable.VTable + { + public static interface Callback_init extends com.sun.jna.Callback + { + public void invoke(IStatus self); + } + + public static interface Callback_getState extends com.sun.jna.Callback + { + public int invoke(IStatus self); + } + + public static interface Callback_setErrors2 extends com.sun.jna.Callback + { + public void invoke(IStatus self, int length, com.sun.jna.Pointer[] value); + } + + public static interface Callback_setWarnings2 extends com.sun.jna.Callback + { + public void invoke(IStatus self, int length, com.sun.jna.Pointer[] value); + } + + public static interface Callback_setErrors extends com.sun.jna.Callback + { + public void invoke(IStatus self, com.sun.jna.Pointer[] value); + } + + public static interface Callback_setWarnings extends com.sun.jna.Callback + { + public void invoke(IStatus self, com.sun.jna.Pointer[] value); + } + + public static interface Callback_getErrors extends com.sun.jna.Callback + { + public com.sun.jna.Pointer invoke(IStatus self); + } + + public static interface Callback_getWarnings extends com.sun.jna.Callback + { + public com.sun.jna.Pointer invoke(IStatus self); + } + + public static interface Callback_clone extends com.sun.jna.Callback + { + public IStatus invoke(IStatus self); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IStatusIntf obj) + { + super(obj); + + init = new Callback_init() { + @Override + public void invoke(IStatus self) + { + obj.init(); + } + }; + + getState = new Callback_getState() { + @Override + public int invoke(IStatus self) + { + return obj.getState(); + } + }; + + setErrors2 = new Callback_setErrors2() { + @Override + public void invoke(IStatus self, int length, com.sun.jna.Pointer[] value) + { + obj.setErrors2(length, value); + } + }; + + setWarnings2 = new Callback_setWarnings2() { + @Override + public void invoke(IStatus self, int length, com.sun.jna.Pointer[] value) + { + obj.setWarnings2(length, value); + } + }; + + setErrors = new Callback_setErrors() { + @Override + public void invoke(IStatus self, com.sun.jna.Pointer[] value) + { + obj.setErrors(value); + } + }; + + setWarnings = new Callback_setWarnings() { + @Override + public void invoke(IStatus self, com.sun.jna.Pointer[] value) + { + obj.setWarnings(value); + } + }; + + getErrors = new Callback_getErrors() { + @Override + public com.sun.jna.Pointer invoke(IStatus self) + { + return obj.getErrors(); + } + }; + + getWarnings = new Callback_getWarnings() { + @Override + public com.sun.jna.Pointer invoke(IStatus self) + { + return obj.getWarnings(); + } + }; + + clone = new Callback_clone() { + @Override + public IStatus invoke(IStatus self) + { + return obj.clone(); + } + }; + } + + public VTable() + { + } + + public Callback_init init; + public Callback_getState getState; + public Callback_setErrors2 setErrors2; + public Callback_setWarnings2 setWarnings2; + public Callback_setErrors setErrors; + public Callback_setWarnings setWarnings; + public Callback_getErrors getErrors; + public Callback_getWarnings getWarnings; + public Callback_clone clone; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("init", "getState", "setErrors2", "setWarnings2", "setErrors", "setWarnings", "getErrors", "getWarnings", "clone")); + return fields; + } + } + + public IStatus() + { + } + + public IStatus(final IStatusIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public void init() + { + VTable vTable = getVTable(); + vTable.init.invoke(this); + } + + public int getState() + { + VTable vTable = getVTable(); + int result = vTable.getState.invoke(this); + return result; + } + + public void setErrors2(int length, com.sun.jna.Pointer[] value) + { + VTable vTable = getVTable(); + vTable.setErrors2.invoke(this, length, value); + } + + public void setWarnings2(int length, com.sun.jna.Pointer[] value) + { + VTable vTable = getVTable(); + vTable.setWarnings2.invoke(this, length, value); + } + + public void setErrors(com.sun.jna.Pointer[] value) + { + VTable vTable = getVTable(); + vTable.setErrors.invoke(this, value); + } + + public void setWarnings(com.sun.jna.Pointer[] value) + { + VTable vTable = getVTable(); + vTable.setWarnings.invoke(this, value); + } + + public com.sun.jna.Pointer getErrors() + { + VTable vTable = getVTable(); + com.sun.jna.Pointer result = vTable.getErrors.invoke(this); + return result; + } + + public com.sun.jna.Pointer getWarnings() + { + VTable vTable = getVTable(); + com.sun.jna.Pointer result = vTable.getWarnings.invoke(this); + return result; + } + + public IStatus clone() + { + VTable vTable = getVTable(); + IStatus result = vTable.clone.invoke(this); + return result; + } + } + + public static class IMaster extends IVersioned implements IMasterIntf + { + public static class VTable extends IVersioned.VTable + { + public static interface Callback_getStatus extends com.sun.jna.Callback + { + public IStatus invoke(IMaster self); + } + + public static interface Callback_getDispatcher extends com.sun.jna.Callback + { + public IProvider invoke(IMaster self); + } + + public static interface Callback_getPluginManager extends com.sun.jna.Callback + { + public IPluginManager invoke(IMaster self); + } + + public static interface Callback_getTimerControl extends com.sun.jna.Callback + { + public ITimerControl invoke(IMaster self); + } + + public static interface Callback_getDtc extends com.sun.jna.Callback + { + public IDtc invoke(IMaster self); + } + + public static interface Callback_registerAttachment extends com.sun.jna.Callback + { + public IAttachment invoke(IMaster self, IProvider provider, IAttachment attachment); + } + + public static interface Callback_registerTransaction extends com.sun.jna.Callback + { + public ITransaction invoke(IMaster self, IAttachment attachment, ITransaction transaction); + } + + public static interface Callback_getMetadataBuilder extends com.sun.jna.Callback + { + public IMetadataBuilder invoke(IMaster self, IStatus status, int fieldCount); + } + + public static interface Callback_serverMode extends com.sun.jna.Callback + { + public int invoke(IMaster self, int mode); + } + + public static interface Callback_getUtilInterface extends com.sun.jna.Callback + { + public IUtil invoke(IMaster self); + } + + public static interface Callback_getConfigManager extends com.sun.jna.Callback + { + public IConfigManager invoke(IMaster self); + } + + public static interface Callback_getProcessExiting extends com.sun.jna.Callback + { + public boolean invoke(IMaster self); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IMasterIntf obj) + { + super(obj); + + getStatus = new Callback_getStatus() { + @Override + public IStatus invoke(IMaster self) + { + return obj.getStatus(); + } + }; + + getDispatcher = new Callback_getDispatcher() { + @Override + public IProvider invoke(IMaster self) + { + return obj.getDispatcher(); + } + }; + + getPluginManager = new Callback_getPluginManager() { + @Override + public IPluginManager invoke(IMaster self) + { + return obj.getPluginManager(); + } + }; + + getTimerControl = new Callback_getTimerControl() { + @Override + public ITimerControl invoke(IMaster self) + { + return obj.getTimerControl(); + } + }; + + getDtc = new Callback_getDtc() { + @Override + public IDtc invoke(IMaster self) + { + return obj.getDtc(); + } + }; + + registerAttachment = new Callback_registerAttachment() { + @Override + public IAttachment invoke(IMaster self, IProvider provider, IAttachment attachment) + { + return obj.registerAttachment(provider, attachment); + } + }; + + registerTransaction = new Callback_registerTransaction() { + @Override + public ITransaction invoke(IMaster self, IAttachment attachment, ITransaction transaction) + { + return obj.registerTransaction(attachment, transaction); + } + }; + + getMetadataBuilder = new Callback_getMetadataBuilder() { + @Override + public IMetadataBuilder invoke(IMaster self, IStatus status, int fieldCount) + { + try + { + return obj.getMetadataBuilder(status, fieldCount); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + + serverMode = new Callback_serverMode() { + @Override + public int invoke(IMaster self, int mode) + { + return obj.serverMode(mode); + } + }; + + getUtilInterface = new Callback_getUtilInterface() { + @Override + public IUtil invoke(IMaster self) + { + return obj.getUtilInterface(); + } + }; + + getConfigManager = new Callback_getConfigManager() { + @Override + public IConfigManager invoke(IMaster self) + { + return obj.getConfigManager(); + } + }; + + getProcessExiting = new Callback_getProcessExiting() { + @Override + public boolean invoke(IMaster self) + { + return obj.getProcessExiting(); + } + }; + } + + public VTable() + { + } + + public Callback_getStatus getStatus; + public Callback_getDispatcher getDispatcher; + public Callback_getPluginManager getPluginManager; + public Callback_getTimerControl getTimerControl; + public Callback_getDtc getDtc; + public Callback_registerAttachment registerAttachment; + public Callback_registerTransaction registerTransaction; + public Callback_getMetadataBuilder getMetadataBuilder; + public Callback_serverMode serverMode; + public Callback_getUtilInterface getUtilInterface; + public Callback_getConfigManager getConfigManager; + public Callback_getProcessExiting getProcessExiting; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("getStatus", "getDispatcher", "getPluginManager", "getTimerControl", "getDtc", "registerAttachment", "registerTransaction", "getMetadataBuilder", "serverMode", "getUtilInterface", "getConfigManager", "getProcessExiting")); + return fields; + } + } + + public IMaster() + { + } + + public IMaster(final IMasterIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public IStatus getStatus() + { + VTable vTable = getVTable(); + IStatus result = vTable.getStatus.invoke(this); + return result; + } + + public IProvider getDispatcher() + { + VTable vTable = getVTable(); + IProvider result = vTable.getDispatcher.invoke(this); + return result; + } + + public IPluginManager getPluginManager() + { + VTable vTable = getVTable(); + IPluginManager result = vTable.getPluginManager.invoke(this); + return result; + } + + public ITimerControl getTimerControl() + { + VTable vTable = getVTable(); + ITimerControl result = vTable.getTimerControl.invoke(this); + return result; + } + + public IDtc getDtc() + { + VTable vTable = getVTable(); + IDtc result = vTable.getDtc.invoke(this); + return result; + } + + public IAttachment registerAttachment(IProvider provider, IAttachment attachment) + { + VTable vTable = getVTable(); + IAttachment result = vTable.registerAttachment.invoke(this, provider, attachment); + return result; + } + + public ITransaction registerTransaction(IAttachment attachment, ITransaction transaction) + { + VTable vTable = getVTable(); + ITransaction result = vTable.registerTransaction.invoke(this, attachment, transaction); + return result; + } + + public IMetadataBuilder getMetadataBuilder(IStatus status, int fieldCount) throws FbException + { + VTable vTable = getVTable(); + IMetadataBuilder result = vTable.getMetadataBuilder.invoke(this, status, fieldCount); + FbException.checkException(status); + return result; + } + + public int serverMode(int mode) + { + VTable vTable = getVTable(); + int result = vTable.serverMode.invoke(this, mode); + return result; + } + + public IUtil getUtilInterface() + { + VTable vTable = getVTable(); + IUtil result = vTable.getUtilInterface.invoke(this); + return result; + } + + public IConfigManager getConfigManager() + { + VTable vTable = getVTable(); + IConfigManager result = vTable.getConfigManager.invoke(this); + return result; + } + + public boolean getProcessExiting() + { + VTable vTable = getVTable(); + boolean result = vTable.getProcessExiting.invoke(this); + return result; + } + } + + public static class IPluginBase extends IReferenceCounted implements IPluginBaseIntf + { + public static class VTable extends IReferenceCounted.VTable + { + public static interface Callback_setOwner extends com.sun.jna.Callback + { + public void invoke(IPluginBase self, IReferenceCounted r); + } + + public static interface Callback_getOwner extends com.sun.jna.Callback + { + public IReferenceCounted invoke(IPluginBase self); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IPluginBaseIntf obj) + { + super(obj); + + setOwner = new Callback_setOwner() { + @Override + public void invoke(IPluginBase self, IReferenceCounted r) + { + obj.setOwner(r); + } + }; + + getOwner = new Callback_getOwner() { + @Override + public IReferenceCounted invoke(IPluginBase self) + { + return obj.getOwner(); + } + }; + } + + public VTable() + { + } + + public Callback_setOwner setOwner; + public Callback_getOwner getOwner; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("setOwner", "getOwner")); + return fields; + } + } + + public IPluginBase() + { + } + + public IPluginBase(final IPluginBaseIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public void setOwner(IReferenceCounted r) + { + VTable vTable = getVTable(); + vTable.setOwner.invoke(this, r); + } + + public IReferenceCounted getOwner() + { + VTable vTable = getVTable(); + IReferenceCounted result = vTable.getOwner.invoke(this); + return result; + } + } + + public static class IPluginSet extends IReferenceCounted implements IPluginSetIntf + { + public static class VTable extends IReferenceCounted.VTable + { + public static interface Callback_getName extends com.sun.jna.Callback + { + public String invoke(IPluginSet self); + } + + public static interface Callback_getModuleName extends com.sun.jna.Callback + { + public String invoke(IPluginSet self); + } + + public static interface Callback_getPlugin extends com.sun.jna.Callback + { + public IPluginBase invoke(IPluginSet self, IStatus status); + } + + public static interface Callback_next extends com.sun.jna.Callback + { + public void invoke(IPluginSet self, IStatus status); + } + + public static interface Callback_set extends com.sun.jna.Callback + { + public void invoke(IPluginSet self, IStatus status, String s); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IPluginSetIntf obj) + { + super(obj); + + getName = new Callback_getName() { + @Override + public String invoke(IPluginSet self) + { + return obj.getName(); + } + }; + + getModuleName = new Callback_getModuleName() { + @Override + public String invoke(IPluginSet self) + { + return obj.getModuleName(); + } + }; + + getPlugin = new Callback_getPlugin() { + @Override + public IPluginBase invoke(IPluginSet self, IStatus status) + { + try + { + return obj.getPlugin(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + + next = new Callback_next() { + @Override + public void invoke(IPluginSet self, IStatus status) + { + try + { + obj.next(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + set = new Callback_set() { + @Override + public void invoke(IPluginSet self, IStatus status, String s) + { + try + { + obj.set(status, s); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + } + + public VTable() + { + } + + public Callback_getName getName; + public Callback_getModuleName getModuleName; + public Callback_getPlugin getPlugin; + public Callback_next next; + public Callback_set set; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("getName", "getModuleName", "getPlugin", "next", "set")); + return fields; + } + } + + public IPluginSet() + { + } + + public IPluginSet(final IPluginSetIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public String getName() + { + VTable vTable = getVTable(); + String result = vTable.getName.invoke(this); + return result; + } + + public String getModuleName() + { + VTable vTable = getVTable(); + String result = vTable.getModuleName.invoke(this); + return result; + } + + public IPluginBase getPlugin(IStatus status) throws FbException + { + VTable vTable = getVTable(); + IPluginBase result = vTable.getPlugin.invoke(this, status); + FbException.checkException(status); + return result; + } + + public void next(IStatus status) throws FbException + { + VTable vTable = getVTable(); + vTable.next.invoke(this, status); + FbException.checkException(status); + } + + public void set(IStatus status, String s) throws FbException + { + VTable vTable = getVTable(); + vTable.set.invoke(this, status, s); + FbException.checkException(status); + } + } + + public static class IConfigEntry extends IReferenceCounted implements IConfigEntryIntf + { + public static class VTable extends IReferenceCounted.VTable + { + public static interface Callback_getName extends com.sun.jna.Callback + { + public String invoke(IConfigEntry self); + } + + public static interface Callback_getValue extends com.sun.jna.Callback + { + public String invoke(IConfigEntry self); + } + + public static interface Callback_getIntValue extends com.sun.jna.Callback + { + public long invoke(IConfigEntry self); + } + + public static interface Callback_getBoolValue extends com.sun.jna.Callback + { + public boolean invoke(IConfigEntry self); + } + + public static interface Callback_getSubConfig extends com.sun.jna.Callback + { + public IConfig invoke(IConfigEntry self, IStatus status); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IConfigEntryIntf obj) + { + super(obj); + + getName = new Callback_getName() { + @Override + public String invoke(IConfigEntry self) + { + return obj.getName(); + } + }; + + getValue = new Callback_getValue() { + @Override + public String invoke(IConfigEntry self) + { + return obj.getValue(); + } + }; + + getIntValue = new Callback_getIntValue() { + @Override + public long invoke(IConfigEntry self) + { + return obj.getIntValue(); + } + }; + + getBoolValue = new Callback_getBoolValue() { + @Override + public boolean invoke(IConfigEntry self) + { + return obj.getBoolValue(); + } + }; + + getSubConfig = new Callback_getSubConfig() { + @Override + public IConfig invoke(IConfigEntry self, IStatus status) + { + try + { + return obj.getSubConfig(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + } + + public VTable() + { + } + + public Callback_getName getName; + public Callback_getValue getValue; + public Callback_getIntValue getIntValue; + public Callback_getBoolValue getBoolValue; + public Callback_getSubConfig getSubConfig; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("getName", "getValue", "getIntValue", "getBoolValue", "getSubConfig")); + return fields; + } + } + + public IConfigEntry() + { + } + + public IConfigEntry(final IConfigEntryIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public String getName() + { + VTable vTable = getVTable(); + String result = vTable.getName.invoke(this); + return result; + } + + public String getValue() + { + VTable vTable = getVTable(); + String result = vTable.getValue.invoke(this); + return result; + } + + public long getIntValue() + { + VTable vTable = getVTable(); + long result = vTable.getIntValue.invoke(this); + return result; + } + + public boolean getBoolValue() + { + VTable vTable = getVTable(); + boolean result = vTable.getBoolValue.invoke(this); + return result; + } + + public IConfig getSubConfig(IStatus status) throws FbException + { + VTable vTable = getVTable(); + IConfig result = vTable.getSubConfig.invoke(this, status); + FbException.checkException(status); + return result; + } + } + + public static class IConfig extends IReferenceCounted implements IConfigIntf + { + public static class VTable extends IReferenceCounted.VTable + { + public static interface Callback_find extends com.sun.jna.Callback + { + public IConfigEntry invoke(IConfig self, IStatus status, String name); + } + + public static interface Callback_findValue extends com.sun.jna.Callback + { + public IConfigEntry invoke(IConfig self, IStatus status, String name, String value); + } + + public static interface Callback_findPos extends com.sun.jna.Callback + { + public IConfigEntry invoke(IConfig self, IStatus status, String name, int pos); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IConfigIntf obj) + { + super(obj); + + find = new Callback_find() { + @Override + public IConfigEntry invoke(IConfig self, IStatus status, String name) + { + try + { + return obj.find(status, name); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + + findValue = new Callback_findValue() { + @Override + public IConfigEntry invoke(IConfig self, IStatus status, String name, String value) + { + try + { + return obj.findValue(status, name, value); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + + findPos = new Callback_findPos() { + @Override + public IConfigEntry invoke(IConfig self, IStatus status, String name, int pos) + { + try + { + return obj.findPos(status, name, pos); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + } + + public VTable() + { + } + + public Callback_find find; + public Callback_findValue findValue; + public Callback_findPos findPos; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("find", "findValue", "findPos")); + return fields; + } + } + + public IConfig() + { + } + + public IConfig(final IConfigIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public IConfigEntry find(IStatus status, String name) throws FbException + { + VTable vTable = getVTable(); + IConfigEntry result = vTable.find.invoke(this, status, name); + FbException.checkException(status); + return result; + } + + public IConfigEntry findValue(IStatus status, String name, String value) throws FbException + { + VTable vTable = getVTable(); + IConfigEntry result = vTable.findValue.invoke(this, status, name, value); + FbException.checkException(status); + return result; + } + + public IConfigEntry findPos(IStatus status, String name, int pos) throws FbException + { + VTable vTable = getVTable(); + IConfigEntry result = vTable.findPos.invoke(this, status, name, pos); + FbException.checkException(status); + return result; + } + } + + public static class IFirebirdConf extends IReferenceCounted implements IFirebirdConfIntf + { + public static class VTable extends IReferenceCounted.VTable + { + public static interface Callback_getKey extends com.sun.jna.Callback + { + public int invoke(IFirebirdConf self, String name); + } + + public static interface Callback_asInteger extends com.sun.jna.Callback + { + public long invoke(IFirebirdConf self, int key); + } + + public static interface Callback_asString extends com.sun.jna.Callback + { + public String invoke(IFirebirdConf self, int key); + } + + public static interface Callback_asBoolean extends com.sun.jna.Callback + { + public boolean invoke(IFirebirdConf self, int key); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IFirebirdConfIntf obj) + { + super(obj); + + getKey = new Callback_getKey() { + @Override + public int invoke(IFirebirdConf self, String name) + { + return obj.getKey(name); + } + }; + + asInteger = new Callback_asInteger() { + @Override + public long invoke(IFirebirdConf self, int key) + { + return obj.asInteger(key); + } + }; + + asString = new Callback_asString() { + @Override + public String invoke(IFirebirdConf self, int key) + { + return obj.asString(key); + } + }; + + asBoolean = new Callback_asBoolean() { + @Override + public boolean invoke(IFirebirdConf self, int key) + { + return obj.asBoolean(key); + } + }; + } + + public VTable() + { + } + + public Callback_getKey getKey; + public Callback_asInteger asInteger; + public Callback_asString asString; + public Callback_asBoolean asBoolean; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("getKey", "asInteger", "asString", "asBoolean")); + return fields; + } + } + + public IFirebirdConf() + { + } + + public IFirebirdConf(final IFirebirdConfIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public int getKey(String name) + { + VTable vTable = getVTable(); + int result = vTable.getKey.invoke(this, name); + return result; + } + + public long asInteger(int key) + { + VTable vTable = getVTable(); + long result = vTable.asInteger.invoke(this, key); + return result; + } + + public String asString(int key) + { + VTable vTable = getVTable(); + String result = vTable.asString.invoke(this, key); + return result; + } + + public boolean asBoolean(int key) + { + VTable vTable = getVTable(); + boolean result = vTable.asBoolean.invoke(this, key); + return result; + } + } + + public static class IPluginConfig extends IReferenceCounted implements IPluginConfigIntf + { + public static class VTable extends IReferenceCounted.VTable + { + public static interface Callback_getConfigFileName extends com.sun.jna.Callback + { + public String invoke(IPluginConfig self); + } + + public static interface Callback_getDefaultConfig extends com.sun.jna.Callback + { + public IConfig invoke(IPluginConfig self, IStatus status); + } + + public static interface Callback_getFirebirdConf extends com.sun.jna.Callback + { + public IFirebirdConf invoke(IPluginConfig self, IStatus status); + } + + public static interface Callback_setReleaseDelay extends com.sun.jna.Callback + { + public void invoke(IPluginConfig self, IStatus status, long microSeconds); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IPluginConfigIntf obj) + { + super(obj); + + getConfigFileName = new Callback_getConfigFileName() { + @Override + public String invoke(IPluginConfig self) + { + return obj.getConfigFileName(); + } + }; + + getDefaultConfig = new Callback_getDefaultConfig() { + @Override + public IConfig invoke(IPluginConfig self, IStatus status) + { + try + { + return obj.getDefaultConfig(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + + getFirebirdConf = new Callback_getFirebirdConf() { + @Override + public IFirebirdConf invoke(IPluginConfig self, IStatus status) + { + try + { + return obj.getFirebirdConf(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + + setReleaseDelay = new Callback_setReleaseDelay() { + @Override + public void invoke(IPluginConfig self, IStatus status, long microSeconds) + { + try + { + obj.setReleaseDelay(status, microSeconds); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + } + + public VTable() + { + } + + public Callback_getConfigFileName getConfigFileName; + public Callback_getDefaultConfig getDefaultConfig; + public Callback_getFirebirdConf getFirebirdConf; + public Callback_setReleaseDelay setReleaseDelay; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("getConfigFileName", "getDefaultConfig", "getFirebirdConf", "setReleaseDelay")); + return fields; + } + } + + public IPluginConfig() + { + } + + public IPluginConfig(final IPluginConfigIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public String getConfigFileName() + { + VTable vTable = getVTable(); + String result = vTable.getConfigFileName.invoke(this); + return result; + } + + public IConfig getDefaultConfig(IStatus status) throws FbException + { + VTable vTable = getVTable(); + IConfig result = vTable.getDefaultConfig.invoke(this, status); + FbException.checkException(status); + return result; + } + + public IFirebirdConf getFirebirdConf(IStatus status) throws FbException + { + VTable vTable = getVTable(); + IFirebirdConf result = vTable.getFirebirdConf.invoke(this, status); + FbException.checkException(status); + return result; + } + + public void setReleaseDelay(IStatus status, long microSeconds) throws FbException + { + VTable vTable = getVTable(); + vTable.setReleaseDelay.invoke(this, status, microSeconds); + FbException.checkException(status); + } + } + + public static class IPluginFactory extends IVersioned implements IPluginFactoryIntf + { + public static class VTable extends IVersioned.VTable + { + public static interface Callback_createPlugin extends com.sun.jna.Callback + { + public IPluginBase invoke(IPluginFactory self, IStatus status, IPluginConfig factoryParameter); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IPluginFactoryIntf obj) + { + super(obj); + + createPlugin = new Callback_createPlugin() { + @Override + public IPluginBase invoke(IPluginFactory self, IStatus status, IPluginConfig factoryParameter) + { + try + { + return obj.createPlugin(status, factoryParameter); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + } + + public VTable() + { + } + + public Callback_createPlugin createPlugin; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("createPlugin")); + return fields; + } + } + + public IPluginFactory() + { + } + + public IPluginFactory(final IPluginFactoryIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public IPluginBase createPlugin(IStatus status, IPluginConfig factoryParameter) throws FbException + { + VTable vTable = getVTable(); + IPluginBase result = vTable.createPlugin.invoke(this, status, factoryParameter); + FbException.checkException(status); + return result; + } + } + + public static class IPluginModule extends IVersioned implements IPluginModuleIntf + { + public static class VTable extends IVersioned.VTable + { + public static interface Callback_doClean extends com.sun.jna.Callback + { + public void invoke(IPluginModule self); + } + + public static interface Callback_threadDetach extends com.sun.jna.Callback + { + public void invoke(IPluginModule self); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IPluginModuleIntf obj) + { + super(obj); + + doClean = new Callback_doClean() { + @Override + public void invoke(IPluginModule self) + { + obj.doClean(); + } + }; + + threadDetach = new Callback_threadDetach() { + @Override + public void invoke(IPluginModule self) + { + obj.threadDetach(); + } + }; + } + + public VTable() + { + } + + public Callback_doClean doClean; + public Callback_threadDetach threadDetach; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("doClean", "threadDetach")); + return fields; + } + } + + public IPluginModule() + { + } + + public IPluginModule(final IPluginModuleIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public void doClean() + { + VTable vTable = getVTable(); + vTable.doClean.invoke(this); + } + + public void threadDetach() + { + VTable vTable = getVTable(); + vTable.threadDetach.invoke(this); + } + } + + public static class IPluginManager extends IVersioned implements IPluginManagerIntf + { + public static class VTable extends IVersioned.VTable + { + public static interface Callback_registerPluginFactory extends com.sun.jna.Callback + { + public void invoke(IPluginManager self, int pluginType, String defaultName, IPluginFactory factory); + } + + public static interface Callback_registerModule extends com.sun.jna.Callback + { + public void invoke(IPluginManager self, IPluginModule cleanup); + } + + public static interface Callback_unregisterModule extends com.sun.jna.Callback + { + public void invoke(IPluginManager self, IPluginModule cleanup); + } + + public static interface Callback_getPlugins extends com.sun.jna.Callback + { + public IPluginSet invoke(IPluginManager self, IStatus status, int pluginType, String namesList, IFirebirdConf firebirdConf); + } + + public static interface Callback_getConfig extends com.sun.jna.Callback + { + public IConfig invoke(IPluginManager self, IStatus status, String filename); + } + + public static interface Callback_releasePlugin extends com.sun.jna.Callback + { + public void invoke(IPluginManager self, IPluginBase plugin); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IPluginManagerIntf obj) + { + super(obj); + + registerPluginFactory = new Callback_registerPluginFactory() { + @Override + public void invoke(IPluginManager self, int pluginType, String defaultName, IPluginFactory factory) + { + obj.registerPluginFactory(pluginType, defaultName, factory); + } + }; + + registerModule = new Callback_registerModule() { + @Override + public void invoke(IPluginManager self, IPluginModule cleanup) + { + obj.registerModule(cleanup); + } + }; + + unregisterModule = new Callback_unregisterModule() { + @Override + public void invoke(IPluginManager self, IPluginModule cleanup) + { + obj.unregisterModule(cleanup); + } + }; + + getPlugins = new Callback_getPlugins() { + @Override + public IPluginSet invoke(IPluginManager self, IStatus status, int pluginType, String namesList, IFirebirdConf firebirdConf) + { + try + { + return obj.getPlugins(status, pluginType, namesList, firebirdConf); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + + getConfig = new Callback_getConfig() { + @Override + public IConfig invoke(IPluginManager self, IStatus status, String filename) + { + try + { + return obj.getConfig(status, filename); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + + releasePlugin = new Callback_releasePlugin() { + @Override + public void invoke(IPluginManager self, IPluginBase plugin) + { + obj.releasePlugin(plugin); + } + }; + } + + public VTable() + { + } + + public Callback_registerPluginFactory registerPluginFactory; + public Callback_registerModule registerModule; + public Callback_unregisterModule unregisterModule; + public Callback_getPlugins getPlugins; + public Callback_getConfig getConfig; + public Callback_releasePlugin releasePlugin; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("registerPluginFactory", "registerModule", "unregisterModule", "getPlugins", "getConfig", "releasePlugin")); + return fields; + } + } + + public IPluginManager() + { + } + + public IPluginManager(final IPluginManagerIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public void registerPluginFactory(int pluginType, String defaultName, IPluginFactory factory) + { + VTable vTable = getVTable(); + vTable.registerPluginFactory.invoke(this, pluginType, defaultName, factory); + } + + public void registerModule(IPluginModule cleanup) + { + VTable vTable = getVTable(); + vTable.registerModule.invoke(this, cleanup); + } + + public void unregisterModule(IPluginModule cleanup) + { + VTable vTable = getVTable(); + vTable.unregisterModule.invoke(this, cleanup); + } + + public IPluginSet getPlugins(IStatus status, int pluginType, String namesList, IFirebirdConf firebirdConf) throws FbException + { + VTable vTable = getVTable(); + IPluginSet result = vTable.getPlugins.invoke(this, status, pluginType, namesList, firebirdConf); + FbException.checkException(status); + return result; + } + + public IConfig getConfig(IStatus status, String filename) throws FbException + { + VTable vTable = getVTable(); + IConfig result = vTable.getConfig.invoke(this, status, filename); + FbException.checkException(status); + return result; + } + + public void releasePlugin(IPluginBase plugin) + { + VTable vTable = getVTable(); + vTable.releasePlugin.invoke(this, plugin); + } + } + + public static class ICryptKey extends IVersioned implements ICryptKeyIntf + { + public static class VTable extends IVersioned.VTable + { + public static interface Callback_setSymmetric extends com.sun.jna.Callback + { + public void invoke(ICryptKey self, IStatus status, String type, int keyLength, com.sun.jna.Pointer key); + } + + public static interface Callback_setAsymmetric extends com.sun.jna.Callback + { + public void invoke(ICryptKey self, IStatus status, String type, int encryptKeyLength, com.sun.jna.Pointer encryptKey, int decryptKeyLength, com.sun.jna.Pointer decryptKey); + } + + public static interface Callback_getEncryptKey extends com.sun.jna.Callback + { + public com.sun.jna.Pointer invoke(ICryptKey self, com.sun.jna.Pointer length); + } + + public static interface Callback_getDecryptKey extends com.sun.jna.Callback + { + public com.sun.jna.Pointer invoke(ICryptKey self, com.sun.jna.Pointer length); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final ICryptKeyIntf obj) + { + super(obj); + + setSymmetric = new Callback_setSymmetric() { + @Override + public void invoke(ICryptKey self, IStatus status, String type, int keyLength, com.sun.jna.Pointer key) + { + try + { + obj.setSymmetric(status, type, keyLength, key); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + setAsymmetric = new Callback_setAsymmetric() { + @Override + public void invoke(ICryptKey self, IStatus status, String type, int encryptKeyLength, com.sun.jna.Pointer encryptKey, int decryptKeyLength, com.sun.jna.Pointer decryptKey) + { + try + { + obj.setAsymmetric(status, type, encryptKeyLength, encryptKey, decryptKeyLength, decryptKey); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + getEncryptKey = new Callback_getEncryptKey() { + @Override + public com.sun.jna.Pointer invoke(ICryptKey self, com.sun.jna.Pointer length) + { + return obj.getEncryptKey(length); + } + }; + + getDecryptKey = new Callback_getDecryptKey() { + @Override + public com.sun.jna.Pointer invoke(ICryptKey self, com.sun.jna.Pointer length) + { + return obj.getDecryptKey(length); + } + }; + } + + public VTable() + { + } + + public Callback_setSymmetric setSymmetric; + public Callback_setAsymmetric setAsymmetric; + public Callback_getEncryptKey getEncryptKey; + public Callback_getDecryptKey getDecryptKey; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("setSymmetric", "setAsymmetric", "getEncryptKey", "getDecryptKey")); + return fields; + } + } + + public ICryptKey() + { + } + + public ICryptKey(final ICryptKeyIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public void setSymmetric(IStatus status, String type, int keyLength, com.sun.jna.Pointer key) throws FbException + { + VTable vTable = getVTable(); + vTable.setSymmetric.invoke(this, status, type, keyLength, key); + FbException.checkException(status); + } + + public void setAsymmetric(IStatus status, String type, int encryptKeyLength, com.sun.jna.Pointer encryptKey, int decryptKeyLength, com.sun.jna.Pointer decryptKey) throws FbException + { + VTable vTable = getVTable(); + vTable.setAsymmetric.invoke(this, status, type, encryptKeyLength, encryptKey, decryptKeyLength, decryptKey); + FbException.checkException(status); + } + + public com.sun.jna.Pointer getEncryptKey(com.sun.jna.Pointer length) + { + VTable vTable = getVTable(); + com.sun.jna.Pointer result = vTable.getEncryptKey.invoke(this, length); + return result; + } + + public com.sun.jna.Pointer getDecryptKey(com.sun.jna.Pointer length) + { + VTable vTable = getVTable(); + com.sun.jna.Pointer result = vTable.getDecryptKey.invoke(this, length); + return result; + } + } + + public static class IConfigManager extends IVersioned implements IConfigManagerIntf + { + public static class VTable extends IVersioned.VTable + { + public static interface Callback_getDirectory extends com.sun.jna.Callback + { + public String invoke(IConfigManager self, int code); + } + + public static interface Callback_getFirebirdConf extends com.sun.jna.Callback + { + public IFirebirdConf invoke(IConfigManager self); + } + + public static interface Callback_getDatabaseConf extends com.sun.jna.Callback + { + public IFirebirdConf invoke(IConfigManager self, String dbName); + } + + public static interface Callback_getPluginConfig extends com.sun.jna.Callback + { + public IConfig invoke(IConfigManager self, String configuredPlugin); + } + + public static interface Callback_getInstallDirectory extends com.sun.jna.Callback + { + public String invoke(IConfigManager self); + } + + public static interface Callback_getRootDirectory extends com.sun.jna.Callback + { + public String invoke(IConfigManager self); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IConfigManagerIntf obj) + { + super(obj); + + getDirectory = new Callback_getDirectory() { + @Override + public String invoke(IConfigManager self, int code) + { + return obj.getDirectory(code); + } + }; + + getFirebirdConf = new Callback_getFirebirdConf() { + @Override + public IFirebirdConf invoke(IConfigManager self) + { + return obj.getFirebirdConf(); + } + }; + + getDatabaseConf = new Callback_getDatabaseConf() { + @Override + public IFirebirdConf invoke(IConfigManager self, String dbName) + { + return obj.getDatabaseConf(dbName); + } + }; + + getPluginConfig = new Callback_getPluginConfig() { + @Override + public IConfig invoke(IConfigManager self, String configuredPlugin) + { + return obj.getPluginConfig(configuredPlugin); + } + }; + + getInstallDirectory = new Callback_getInstallDirectory() { + @Override + public String invoke(IConfigManager self) + { + return obj.getInstallDirectory(); + } + }; + + getRootDirectory = new Callback_getRootDirectory() { + @Override + public String invoke(IConfigManager self) + { + return obj.getRootDirectory(); + } + }; + } + + public VTable() + { + } + + public Callback_getDirectory getDirectory; + public Callback_getFirebirdConf getFirebirdConf; + public Callback_getDatabaseConf getDatabaseConf; + public Callback_getPluginConfig getPluginConfig; + public Callback_getInstallDirectory getInstallDirectory; + public Callback_getRootDirectory getRootDirectory; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("getDirectory", "getFirebirdConf", "getDatabaseConf", "getPluginConfig", "getInstallDirectory", "getRootDirectory")); + return fields; + } + } + + public IConfigManager() + { + } + + public IConfigManager(final IConfigManagerIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public String getDirectory(int code) + { + VTable vTable = getVTable(); + String result = vTable.getDirectory.invoke(this, code); + return result; + } + + public IFirebirdConf getFirebirdConf() + { + VTable vTable = getVTable(); + IFirebirdConf result = vTable.getFirebirdConf.invoke(this); + return result; + } + + public IFirebirdConf getDatabaseConf(String dbName) + { + VTable vTable = getVTable(); + IFirebirdConf result = vTable.getDatabaseConf.invoke(this, dbName); + return result; + } + + public IConfig getPluginConfig(String configuredPlugin) + { + VTable vTable = getVTable(); + IConfig result = vTable.getPluginConfig.invoke(this, configuredPlugin); + return result; + } + + public String getInstallDirectory() + { + VTable vTable = getVTable(); + String result = vTable.getInstallDirectory.invoke(this); + return result; + } + + public String getRootDirectory() + { + VTable vTable = getVTable(); + String result = vTable.getRootDirectory.invoke(this); + return result; + } + } + + public static class IEventCallback extends IReferenceCounted implements IEventCallbackIntf + { + public static class VTable extends IReferenceCounted.VTable + { + public static interface Callback_eventCallbackFunction extends com.sun.jna.Callback + { + public void invoke(IEventCallback self, int length, com.sun.jna.Pointer events); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IEventCallbackIntf obj) + { + super(obj); + + eventCallbackFunction = new Callback_eventCallbackFunction() { + @Override + public void invoke(IEventCallback self, int length, com.sun.jna.Pointer events) + { + obj.eventCallbackFunction(length, events); + } + }; + } + + public VTable() + { + } + + public Callback_eventCallbackFunction eventCallbackFunction; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("eventCallbackFunction")); + return fields; + } + } + + public IEventCallback() + { + } + + public IEventCallback(final IEventCallbackIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public void eventCallbackFunction(int length, com.sun.jna.Pointer events) + { + VTable vTable = getVTable(); + vTable.eventCallbackFunction.invoke(this, length, events); + } + } + + public static class IBlob extends IReferenceCounted implements IBlobIntf + { + public static class VTable extends IReferenceCounted.VTable + { + public static interface Callback_getInfo extends com.sun.jna.Callback + { + public void invoke(IBlob self, IStatus status, int itemsLength, byte[] items, int bufferLength, byte[] buffer); + } + + public static interface Callback_getSegment extends com.sun.jna.Callback + { + public int invoke(IBlob self, IStatus status, int bufferLength, com.sun.jna.Pointer buffer, com.sun.jna.Pointer segmentLength); + } + + public static interface Callback_putSegment extends com.sun.jna.Callback + { + public void invoke(IBlob self, IStatus status, int length, com.sun.jna.Pointer buffer); + } + + public static interface Callback_cancel extends com.sun.jna.Callback + { + public void invoke(IBlob self, IStatus status); + } + + public static interface Callback_close extends com.sun.jna.Callback + { + public void invoke(IBlob self, IStatus status); + } + + public static interface Callback_seek extends com.sun.jna.Callback + { + public int invoke(IBlob self, IStatus status, int mode, int offset); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IBlobIntf obj) + { + super(obj); + + getInfo = new Callback_getInfo() { + @Override + public void invoke(IBlob self, IStatus status, int itemsLength, byte[] items, int bufferLength, byte[] buffer) + { + try + { + obj.getInfo(status, itemsLength, items, bufferLength, buffer); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + getSegment = new Callback_getSegment() { + @Override + public int invoke(IBlob self, IStatus status, int bufferLength, com.sun.jna.Pointer buffer, com.sun.jna.Pointer segmentLength) + { + try + { + return obj.getSegment(status, bufferLength, buffer, segmentLength); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return 0; + } + } + }; + + putSegment = new Callback_putSegment() { + @Override + public void invoke(IBlob self, IStatus status, int length, com.sun.jna.Pointer buffer) + { + try + { + obj.putSegment(status, length, buffer); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + cancel = new Callback_cancel() { + @Override + public void invoke(IBlob self, IStatus status) + { + try + { + obj.cancel(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + close = new Callback_close() { + @Override + public void invoke(IBlob self, IStatus status) + { + try + { + obj.close(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + seek = new Callback_seek() { + @Override + public int invoke(IBlob self, IStatus status, int mode, int offset) + { + try + { + return obj.seek(status, mode, offset); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return 0; + } + } + }; + } + + public VTable() + { + } + + public Callback_getInfo getInfo; + public Callback_getSegment getSegment; + public Callback_putSegment putSegment; + public Callback_cancel cancel; + public Callback_close close; + public Callback_seek seek; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("getInfo", "getSegment", "putSegment", "cancel", "close", "seek")); + return fields; + } + } + + public IBlob() + { + } + + public IBlob(final IBlobIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public void getInfo(IStatus status, int itemsLength, byte[] items, int bufferLength, byte[] buffer) throws FbException + { + VTable vTable = getVTable(); + vTable.getInfo.invoke(this, status, itemsLength, items, bufferLength, buffer); + FbException.checkException(status); + } + + public int getSegment(IStatus status, int bufferLength, com.sun.jna.Pointer buffer, com.sun.jna.Pointer segmentLength) throws FbException + { + VTable vTable = getVTable(); + int result = vTable.getSegment.invoke(this, status, bufferLength, buffer, segmentLength); + FbException.checkException(status); + return result; + } + + public void putSegment(IStatus status, int length, com.sun.jna.Pointer buffer) throws FbException + { + VTable vTable = getVTable(); + vTable.putSegment.invoke(this, status, length, buffer); + FbException.checkException(status); + } + + public void cancel(IStatus status) throws FbException + { + VTable vTable = getVTable(); + vTable.cancel.invoke(this, status); + FbException.checkException(status); + } + + public void close(IStatus status) throws FbException + { + VTable vTable = getVTable(); + vTable.close.invoke(this, status); + FbException.checkException(status); + } + + public int seek(IStatus status, int mode, int offset) throws FbException + { + VTable vTable = getVTable(); + int result = vTable.seek.invoke(this, status, mode, offset); + FbException.checkException(status); + return result; + } + } + + public static class ITransaction extends IReferenceCounted implements ITransactionIntf + { + public static class VTable extends IReferenceCounted.VTable + { + public static interface Callback_getInfo extends com.sun.jna.Callback + { + public void invoke(ITransaction self, IStatus status, int itemsLength, byte[] items, int bufferLength, byte[] buffer); + } + + public static interface Callback_prepare extends com.sun.jna.Callback + { + public void invoke(ITransaction self, IStatus status, int msgLength, byte[] message); + } + + public static interface Callback_commit extends com.sun.jna.Callback + { + public void invoke(ITransaction self, IStatus status); + } + + public static interface Callback_commitRetaining extends com.sun.jna.Callback + { + public void invoke(ITransaction self, IStatus status); + } + + public static interface Callback_rollback extends com.sun.jna.Callback + { + public void invoke(ITransaction self, IStatus status); + } + + public static interface Callback_rollbackRetaining extends com.sun.jna.Callback + { + public void invoke(ITransaction self, IStatus status); + } + + public static interface Callback_disconnect extends com.sun.jna.Callback + { + public void invoke(ITransaction self, IStatus status); + } + + public static interface Callback_join extends com.sun.jna.Callback + { + public ITransaction invoke(ITransaction self, IStatus status, ITransaction transaction); + } + + public static interface Callback_validate extends com.sun.jna.Callback + { + public ITransaction invoke(ITransaction self, IStatus status, IAttachment attachment); + } + + public static interface Callback_enterDtc extends com.sun.jna.Callback + { + public ITransaction invoke(ITransaction self, IStatus status); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final ITransactionIntf obj) + { + super(obj); + + getInfo = new Callback_getInfo() { + @Override + public void invoke(ITransaction self, IStatus status, int itemsLength, byte[] items, int bufferLength, byte[] buffer) + { + try + { + obj.getInfo(status, itemsLength, items, bufferLength, buffer); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + prepare = new Callback_prepare() { + @Override + public void invoke(ITransaction self, IStatus status, int msgLength, byte[] message) + { + try + { + obj.prepare(status, msgLength, message); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + commit = new Callback_commit() { + @Override + public void invoke(ITransaction self, IStatus status) + { + try + { + obj.commit(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + commitRetaining = new Callback_commitRetaining() { + @Override + public void invoke(ITransaction self, IStatus status) + { + try + { + obj.commitRetaining(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + rollback = new Callback_rollback() { + @Override + public void invoke(ITransaction self, IStatus status) + { + try + { + obj.rollback(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + rollbackRetaining = new Callback_rollbackRetaining() { + @Override + public void invoke(ITransaction self, IStatus status) + { + try + { + obj.rollbackRetaining(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + disconnect = new Callback_disconnect() { + @Override + public void invoke(ITransaction self, IStatus status) + { + try + { + obj.disconnect(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + join = new Callback_join() { + @Override + public ITransaction invoke(ITransaction self, IStatus status, ITransaction transaction) + { + try + { + return obj.join(status, transaction); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + + validate = new Callback_validate() { + @Override + public ITransaction invoke(ITransaction self, IStatus status, IAttachment attachment) + { + try + { + return obj.validate(status, attachment); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + + enterDtc = new Callback_enterDtc() { + @Override + public ITransaction invoke(ITransaction self, IStatus status) + { + try + { + return obj.enterDtc(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + } + + public VTable() + { + } + + public Callback_getInfo getInfo; + public Callback_prepare prepare; + public Callback_commit commit; + public Callback_commitRetaining commitRetaining; + public Callback_rollback rollback; + public Callback_rollbackRetaining rollbackRetaining; + public Callback_disconnect disconnect; + public Callback_join join; + public Callback_validate validate; + public Callback_enterDtc enterDtc; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("getInfo", "prepare", "commit", "commitRetaining", "rollback", "rollbackRetaining", "disconnect", "join", "validate", "enterDtc")); + return fields; + } + } + + public ITransaction() + { + } + + public ITransaction(final ITransactionIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public void getInfo(IStatus status, int itemsLength, byte[] items, int bufferLength, byte[] buffer) throws FbException + { + VTable vTable = getVTable(); + vTable.getInfo.invoke(this, status, itemsLength, items, bufferLength, buffer); + FbException.checkException(status); + } + + public void prepare(IStatus status, int msgLength, byte[] message) throws FbException + { + VTable vTable = getVTable(); + vTable.prepare.invoke(this, status, msgLength, message); + FbException.checkException(status); + } + + public void commit(IStatus status) throws FbException + { + VTable vTable = getVTable(); + vTable.commit.invoke(this, status); + FbException.checkException(status); + } + + public void commitRetaining(IStatus status) throws FbException + { + VTable vTable = getVTable(); + vTable.commitRetaining.invoke(this, status); + FbException.checkException(status); + } + + public void rollback(IStatus status) throws FbException + { + VTable vTable = getVTable(); + vTable.rollback.invoke(this, status); + FbException.checkException(status); + } + + public void rollbackRetaining(IStatus status) throws FbException + { + VTable vTable = getVTable(); + vTable.rollbackRetaining.invoke(this, status); + FbException.checkException(status); + } + + public void disconnect(IStatus status) throws FbException + { + VTable vTable = getVTable(); + vTable.disconnect.invoke(this, status); + FbException.checkException(status); + } + + public ITransaction join(IStatus status, ITransaction transaction) throws FbException + { + VTable vTable = getVTable(); + ITransaction result = vTable.join.invoke(this, status, transaction); + FbException.checkException(status); + return result; + } + + public ITransaction validate(IStatus status, IAttachment attachment) throws FbException + { + VTable vTable = getVTable(); + ITransaction result = vTable.validate.invoke(this, status, attachment); + FbException.checkException(status); + return result; + } + + public ITransaction enterDtc(IStatus status) throws FbException + { + VTable vTable = getVTable(); + ITransaction result = vTable.enterDtc.invoke(this, status); + FbException.checkException(status); + return result; + } + } + + public static class IMessageMetadata extends IReferenceCounted implements IMessageMetadataIntf + { + public static class VTable extends IReferenceCounted.VTable + { + public static interface Callback_getCount extends com.sun.jna.Callback + { + public int invoke(IMessageMetadata self, IStatus status); + } + + public static interface Callback_getField extends com.sun.jna.Callback + { + public String invoke(IMessageMetadata self, IStatus status, int index); + } + + public static interface Callback_getRelation extends com.sun.jna.Callback + { + public String invoke(IMessageMetadata self, IStatus status, int index); + } + + public static interface Callback_getOwner extends com.sun.jna.Callback + { + public String invoke(IMessageMetadata self, IStatus status, int index); + } + + public static interface Callback_getAlias extends com.sun.jna.Callback + { + public String invoke(IMessageMetadata self, IStatus status, int index); + } + + public static interface Callback_getType extends com.sun.jna.Callback + { + public int invoke(IMessageMetadata self, IStatus status, int index); + } + + public static interface Callback_isNullable extends com.sun.jna.Callback + { + public boolean invoke(IMessageMetadata self, IStatus status, int index); + } + + public static interface Callback_getSubType extends com.sun.jna.Callback + { + public int invoke(IMessageMetadata self, IStatus status, int index); + } + + public static interface Callback_getLength extends com.sun.jna.Callback + { + public int invoke(IMessageMetadata self, IStatus status, int index); + } + + public static interface Callback_getScale extends com.sun.jna.Callback + { + public int invoke(IMessageMetadata self, IStatus status, int index); + } + + public static interface Callback_getCharSet extends com.sun.jna.Callback + { + public int invoke(IMessageMetadata self, IStatus status, int index); + } + + public static interface Callback_getOffset extends com.sun.jna.Callback + { + public int invoke(IMessageMetadata self, IStatus status, int index); + } + + public static interface Callback_getNullOffset extends com.sun.jna.Callback + { + public int invoke(IMessageMetadata self, IStatus status, int index); + } + + public static interface Callback_getBuilder extends com.sun.jna.Callback + { + public IMetadataBuilder invoke(IMessageMetadata self, IStatus status); + } + + public static interface Callback_getMessageLength extends com.sun.jna.Callback + { + public int invoke(IMessageMetadata self, IStatus status); + } + + public static interface Callback_getAlignment extends com.sun.jna.Callback + { + public int invoke(IMessageMetadata self, IStatus status); + } + + public static interface Callback_getAlignedLength extends com.sun.jna.Callback + { + public int invoke(IMessageMetadata self, IStatus status); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IMessageMetadataIntf obj) + { + super(obj); + + getCount = new Callback_getCount() { + @Override + public int invoke(IMessageMetadata self, IStatus status) + { + try + { + return obj.getCount(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return 0; + } + } + }; + + getField = new Callback_getField() { + @Override + public String invoke(IMessageMetadata self, IStatus status, int index) + { + try + { + return obj.getField(status, index); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + + getRelation = new Callback_getRelation() { + @Override + public String invoke(IMessageMetadata self, IStatus status, int index) + { + try + { + return obj.getRelation(status, index); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + + getOwner = new Callback_getOwner() { + @Override + public String invoke(IMessageMetadata self, IStatus status, int index) + { + try + { + return obj.getOwner(status, index); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + + getAlias = new Callback_getAlias() { + @Override + public String invoke(IMessageMetadata self, IStatus status, int index) + { + try + { + return obj.getAlias(status, index); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + + getType = new Callback_getType() { + @Override + public int invoke(IMessageMetadata self, IStatus status, int index) + { + try + { + return obj.getType(status, index); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return 0; + } + } + }; + + isNullable = new Callback_isNullable() { + @Override + public boolean invoke(IMessageMetadata self, IStatus status, int index) + { + try + { + return obj.isNullable(status, index); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return false; + } + } + }; + + getSubType = new Callback_getSubType() { + @Override + public int invoke(IMessageMetadata self, IStatus status, int index) + { + try + { + return obj.getSubType(status, index); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return 0; + } + } + }; + + getLength = new Callback_getLength() { + @Override + public int invoke(IMessageMetadata self, IStatus status, int index) + { + try + { + return obj.getLength(status, index); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return 0; + } + } + }; + + getScale = new Callback_getScale() { + @Override + public int invoke(IMessageMetadata self, IStatus status, int index) + { + try + { + return obj.getScale(status, index); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return 0; + } + } + }; + + getCharSet = new Callback_getCharSet() { + @Override + public int invoke(IMessageMetadata self, IStatus status, int index) + { + try + { + return obj.getCharSet(status, index); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return 0; + } + } + }; + + getOffset = new Callback_getOffset() { + @Override + public int invoke(IMessageMetadata self, IStatus status, int index) + { + try + { + return obj.getOffset(status, index); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return 0; + } + } + }; + + getNullOffset = new Callback_getNullOffset() { + @Override + public int invoke(IMessageMetadata self, IStatus status, int index) + { + try + { + return obj.getNullOffset(status, index); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return 0; + } + } + }; + + getBuilder = new Callback_getBuilder() { + @Override + public IMetadataBuilder invoke(IMessageMetadata self, IStatus status) + { + try + { + return obj.getBuilder(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + + getMessageLength = new Callback_getMessageLength() { + @Override + public int invoke(IMessageMetadata self, IStatus status) + { + try + { + return obj.getMessageLength(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return 0; + } + } + }; + + getAlignment = new Callback_getAlignment() { + @Override + public int invoke(IMessageMetadata self, IStatus status) + { + try + { + return obj.getAlignment(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return 0; + } + } + }; + + getAlignedLength = new Callback_getAlignedLength() { + @Override + public int invoke(IMessageMetadata self, IStatus status) + { + try + { + return obj.getAlignedLength(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return 0; + } + } + }; + } + + public VTable() + { + } + + public Callback_getCount getCount; + public Callback_getField getField; + public Callback_getRelation getRelation; + public Callback_getOwner getOwner; + public Callback_getAlias getAlias; + public Callback_getType getType; + public Callback_isNullable isNullable; + public Callback_getSubType getSubType; + public Callback_getLength getLength; + public Callback_getScale getScale; + public Callback_getCharSet getCharSet; + public Callback_getOffset getOffset; + public Callback_getNullOffset getNullOffset; + public Callback_getBuilder getBuilder; + public Callback_getMessageLength getMessageLength; + public Callback_getAlignment getAlignment; + public Callback_getAlignedLength getAlignedLength; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("getCount", "getField", "getRelation", "getOwner", "getAlias", "getType", "isNullable", "getSubType", "getLength", "getScale", "getCharSet", "getOffset", "getNullOffset", "getBuilder", "getMessageLength", "getAlignment", "getAlignedLength")); + return fields; + } + } + + public IMessageMetadata() + { + } + + public IMessageMetadata(final IMessageMetadataIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public int getCount(IStatus status) throws FbException + { + VTable vTable = getVTable(); + int result = vTable.getCount.invoke(this, status); + FbException.checkException(status); + return result; + } + + public String getField(IStatus status, int index) throws FbException + { + VTable vTable = getVTable(); + String result = vTable.getField.invoke(this, status, index); + FbException.checkException(status); + return result; + } + + public String getRelation(IStatus status, int index) throws FbException + { + VTable vTable = getVTable(); + String result = vTable.getRelation.invoke(this, status, index); + FbException.checkException(status); + return result; + } + + public String getOwner(IStatus status, int index) throws FbException + { + VTable vTable = getVTable(); + String result = vTable.getOwner.invoke(this, status, index); + FbException.checkException(status); + return result; + } + + public String getAlias(IStatus status, int index) throws FbException + { + VTable vTable = getVTable(); + String result = vTable.getAlias.invoke(this, status, index); + FbException.checkException(status); + return result; + } + + public int getType(IStatus status, int index) throws FbException + { + VTable vTable = getVTable(); + int result = vTable.getType.invoke(this, status, index); + FbException.checkException(status); + return result; + } + + public boolean isNullable(IStatus status, int index) throws FbException + { + VTable vTable = getVTable(); + boolean result = vTable.isNullable.invoke(this, status, index); + FbException.checkException(status); + return result; + } + + public int getSubType(IStatus status, int index) throws FbException + { + VTable vTable = getVTable(); + int result = vTable.getSubType.invoke(this, status, index); + FbException.checkException(status); + return result; + } + + public int getLength(IStatus status, int index) throws FbException + { + VTable vTable = getVTable(); + int result = vTable.getLength.invoke(this, status, index); + FbException.checkException(status); + return result; + } + + public int getScale(IStatus status, int index) throws FbException + { + VTable vTable = getVTable(); + int result = vTable.getScale.invoke(this, status, index); + FbException.checkException(status); + return result; + } + + public int getCharSet(IStatus status, int index) throws FbException + { + VTable vTable = getVTable(); + int result = vTable.getCharSet.invoke(this, status, index); + FbException.checkException(status); + return result; + } + + public int getOffset(IStatus status, int index) throws FbException + { + VTable vTable = getVTable(); + int result = vTable.getOffset.invoke(this, status, index); + FbException.checkException(status); + return result; + } + + public int getNullOffset(IStatus status, int index) throws FbException + { + VTable vTable = getVTable(); + int result = vTable.getNullOffset.invoke(this, status, index); + FbException.checkException(status); + return result; + } + + public IMetadataBuilder getBuilder(IStatus status) throws FbException + { + VTable vTable = getVTable(); + IMetadataBuilder result = vTable.getBuilder.invoke(this, status); + FbException.checkException(status); + return result; + } + + public int getMessageLength(IStatus status) throws FbException + { + VTable vTable = getVTable(); + int result = vTable.getMessageLength.invoke(this, status); + FbException.checkException(status); + return result; + } + + public int getAlignment(IStatus status) throws FbException + { + VTable vTable = getVTable(); + int result = vTable.getAlignment.invoke(this, status); + FbException.checkException(status); + return result; + } + + public int getAlignedLength(IStatus status) throws FbException + { + VTable vTable = getVTable(); + int result = vTable.getAlignedLength.invoke(this, status); + FbException.checkException(status); + return result; + } + } + + public static class IMetadataBuilder extends IReferenceCounted implements IMetadataBuilderIntf + { + public static class VTable extends IReferenceCounted.VTable + { + public static interface Callback_setType extends com.sun.jna.Callback + { + public void invoke(IMetadataBuilder self, IStatus status, int index, int type); + } + + public static interface Callback_setSubType extends com.sun.jna.Callback + { + public void invoke(IMetadataBuilder self, IStatus status, int index, int subType); + } + + public static interface Callback_setLength extends com.sun.jna.Callback + { + public void invoke(IMetadataBuilder self, IStatus status, int index, int length); + } + + public static interface Callback_setCharSet extends com.sun.jna.Callback + { + public void invoke(IMetadataBuilder self, IStatus status, int index, int charSet); + } + + public static interface Callback_setScale extends com.sun.jna.Callback + { + public void invoke(IMetadataBuilder self, IStatus status, int index, int scale); + } + + public static interface Callback_truncate extends com.sun.jna.Callback + { + public void invoke(IMetadataBuilder self, IStatus status, int count); + } + + public static interface Callback_moveNameToIndex extends com.sun.jna.Callback + { + public void invoke(IMetadataBuilder self, IStatus status, String name, int index); + } + + public static interface Callback_remove extends com.sun.jna.Callback + { + public void invoke(IMetadataBuilder self, IStatus status, int index); + } + + public static interface Callback_addField extends com.sun.jna.Callback + { + public int invoke(IMetadataBuilder self, IStatus status); + } + + public static interface Callback_getMetadata extends com.sun.jna.Callback + { + public IMessageMetadata invoke(IMetadataBuilder self, IStatus status); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IMetadataBuilderIntf obj) + { + super(obj); + + setType = new Callback_setType() { + @Override + public void invoke(IMetadataBuilder self, IStatus status, int index, int type) + { + try + { + obj.setType(status, index, type); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + setSubType = new Callback_setSubType() { + @Override + public void invoke(IMetadataBuilder self, IStatus status, int index, int subType) + { + try + { + obj.setSubType(status, index, subType); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + setLength = new Callback_setLength() { + @Override + public void invoke(IMetadataBuilder self, IStatus status, int index, int length) + { + try + { + obj.setLength(status, index, length); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + setCharSet = new Callback_setCharSet() { + @Override + public void invoke(IMetadataBuilder self, IStatus status, int index, int charSet) + { + try + { + obj.setCharSet(status, index, charSet); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + setScale = new Callback_setScale() { + @Override + public void invoke(IMetadataBuilder self, IStatus status, int index, int scale) + { + try + { + obj.setScale(status, index, scale); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + truncate = new Callback_truncate() { + @Override + public void invoke(IMetadataBuilder self, IStatus status, int count) + { + try + { + obj.truncate(status, count); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + moveNameToIndex = new Callback_moveNameToIndex() { + @Override + public void invoke(IMetadataBuilder self, IStatus status, String name, int index) + { + try + { + obj.moveNameToIndex(status, name, index); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + remove = new Callback_remove() { + @Override + public void invoke(IMetadataBuilder self, IStatus status, int index) + { + try + { + obj.remove(status, index); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + addField = new Callback_addField() { + @Override + public int invoke(IMetadataBuilder self, IStatus status) + { + try + { + return obj.addField(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return 0; + } + } + }; + + getMetadata = new Callback_getMetadata() { + @Override + public IMessageMetadata invoke(IMetadataBuilder self, IStatus status) + { + try + { + return obj.getMetadata(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + } + + public VTable() + { + } + + public Callback_setType setType; + public Callback_setSubType setSubType; + public Callback_setLength setLength; + public Callback_setCharSet setCharSet; + public Callback_setScale setScale; + public Callback_truncate truncate; + public Callback_moveNameToIndex moveNameToIndex; + public Callback_remove remove; + public Callback_addField addField; + public Callback_getMetadata getMetadata; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("setType", "setSubType", "setLength", "setCharSet", "setScale", "truncate", "moveNameToIndex", "remove", "addField", "getMetadata")); + return fields; + } + } + + public IMetadataBuilder() + { + } + + public IMetadataBuilder(final IMetadataBuilderIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public void setType(IStatus status, int index, int type) throws FbException + { + VTable vTable = getVTable(); + vTable.setType.invoke(this, status, index, type); + FbException.checkException(status); + } + + public void setSubType(IStatus status, int index, int subType) throws FbException + { + VTable vTable = getVTable(); + vTable.setSubType.invoke(this, status, index, subType); + FbException.checkException(status); + } + + public void setLength(IStatus status, int index, int length) throws FbException + { + VTable vTable = getVTable(); + vTable.setLength.invoke(this, status, index, length); + FbException.checkException(status); + } + + public void setCharSet(IStatus status, int index, int charSet) throws FbException + { + VTable vTable = getVTable(); + vTable.setCharSet.invoke(this, status, index, charSet); + FbException.checkException(status); + } + + public void setScale(IStatus status, int index, int scale) throws FbException + { + VTable vTable = getVTable(); + vTable.setScale.invoke(this, status, index, scale); + FbException.checkException(status); + } + + public void truncate(IStatus status, int count) throws FbException + { + VTable vTable = getVTable(); + vTable.truncate.invoke(this, status, count); + FbException.checkException(status); + } + + public void moveNameToIndex(IStatus status, String name, int index) throws FbException + { + VTable vTable = getVTable(); + vTable.moveNameToIndex.invoke(this, status, name, index); + FbException.checkException(status); + } + + public void remove(IStatus status, int index) throws FbException + { + VTable vTable = getVTable(); + vTable.remove.invoke(this, status, index); + FbException.checkException(status); + } + + public int addField(IStatus status) throws FbException + { + VTable vTable = getVTable(); + int result = vTable.addField.invoke(this, status); + FbException.checkException(status); + return result; + } + + public IMessageMetadata getMetadata(IStatus status) throws FbException + { + VTable vTable = getVTable(); + IMessageMetadata result = vTable.getMetadata.invoke(this, status); + FbException.checkException(status); + return result; + } + } + + public static class IResultSet extends IReferenceCounted implements IResultSetIntf + { + public static class VTable extends IReferenceCounted.VTable + { + public static interface Callback_fetchNext extends com.sun.jna.Callback + { + public int invoke(IResultSet self, IStatus status, com.sun.jna.Pointer message); + } + + public static interface Callback_fetchPrior extends com.sun.jna.Callback + { + public int invoke(IResultSet self, IStatus status, com.sun.jna.Pointer message); + } + + public static interface Callback_fetchFirst extends com.sun.jna.Callback + { + public int invoke(IResultSet self, IStatus status, com.sun.jna.Pointer message); + } + + public static interface Callback_fetchLast extends com.sun.jna.Callback + { + public int invoke(IResultSet self, IStatus status, com.sun.jna.Pointer message); + } + + public static interface Callback_fetchAbsolute extends com.sun.jna.Callback + { + public int invoke(IResultSet self, IStatus status, int position, com.sun.jna.Pointer message); + } + + public static interface Callback_fetchRelative extends com.sun.jna.Callback + { + public int invoke(IResultSet self, IStatus status, int offset, com.sun.jna.Pointer message); + } + + public static interface Callback_isEof extends com.sun.jna.Callback + { + public boolean invoke(IResultSet self, IStatus status); + } + + public static interface Callback_isBof extends com.sun.jna.Callback + { + public boolean invoke(IResultSet self, IStatus status); + } + + public static interface Callback_getMetadata extends com.sun.jna.Callback + { + public IMessageMetadata invoke(IResultSet self, IStatus status); + } + + public static interface Callback_close extends com.sun.jna.Callback + { + public void invoke(IResultSet self, IStatus status); + } + + public static interface Callback_setDelayedOutputFormat extends com.sun.jna.Callback + { + public void invoke(IResultSet self, IStatus status, IMessageMetadata format); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IResultSetIntf obj) + { + super(obj); + + fetchNext = new Callback_fetchNext() { + @Override + public int invoke(IResultSet self, IStatus status, com.sun.jna.Pointer message) + { + try + { + return obj.fetchNext(status, message); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return 0; + } + } + }; + + fetchPrior = new Callback_fetchPrior() { + @Override + public int invoke(IResultSet self, IStatus status, com.sun.jna.Pointer message) + { + try + { + return obj.fetchPrior(status, message); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return 0; + } + } + }; + + fetchFirst = new Callback_fetchFirst() { + @Override + public int invoke(IResultSet self, IStatus status, com.sun.jna.Pointer message) + { + try + { + return obj.fetchFirst(status, message); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return 0; + } + } + }; + + fetchLast = new Callback_fetchLast() { + @Override + public int invoke(IResultSet self, IStatus status, com.sun.jna.Pointer message) + { + try + { + return obj.fetchLast(status, message); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return 0; + } + } + }; + + fetchAbsolute = new Callback_fetchAbsolute() { + @Override + public int invoke(IResultSet self, IStatus status, int position, com.sun.jna.Pointer message) + { + try + { + return obj.fetchAbsolute(status, position, message); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return 0; + } + } + }; + + fetchRelative = new Callback_fetchRelative() { + @Override + public int invoke(IResultSet self, IStatus status, int offset, com.sun.jna.Pointer message) + { + try + { + return obj.fetchRelative(status, offset, message); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return 0; + } + } + }; + + isEof = new Callback_isEof() { + @Override + public boolean invoke(IResultSet self, IStatus status) + { + try + { + return obj.isEof(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return false; + } + } + }; + + isBof = new Callback_isBof() { + @Override + public boolean invoke(IResultSet self, IStatus status) + { + try + { + return obj.isBof(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return false; + } + } + }; + + getMetadata = new Callback_getMetadata() { + @Override + public IMessageMetadata invoke(IResultSet self, IStatus status) + { + try + { + return obj.getMetadata(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + + close = new Callback_close() { + @Override + public void invoke(IResultSet self, IStatus status) + { + try + { + obj.close(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + setDelayedOutputFormat = new Callback_setDelayedOutputFormat() { + @Override + public void invoke(IResultSet self, IStatus status, IMessageMetadata format) + { + try + { + obj.setDelayedOutputFormat(status, format); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + } + + public VTable() + { + } + + public Callback_fetchNext fetchNext; + public Callback_fetchPrior fetchPrior; + public Callback_fetchFirst fetchFirst; + public Callback_fetchLast fetchLast; + public Callback_fetchAbsolute fetchAbsolute; + public Callback_fetchRelative fetchRelative; + public Callback_isEof isEof; + public Callback_isBof isBof; + public Callback_getMetadata getMetadata; + public Callback_close close; + public Callback_setDelayedOutputFormat setDelayedOutputFormat; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("fetchNext", "fetchPrior", "fetchFirst", "fetchLast", "fetchAbsolute", "fetchRelative", "isEof", "isBof", "getMetadata", "close", "setDelayedOutputFormat")); + return fields; + } + } + + public IResultSet() + { + } + + public IResultSet(final IResultSetIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public int fetchNext(IStatus status, com.sun.jna.Pointer message) throws FbException + { + VTable vTable = getVTable(); + int result = vTable.fetchNext.invoke(this, status, message); + FbException.checkException(status); + return result; + } + + public int fetchPrior(IStatus status, com.sun.jna.Pointer message) throws FbException + { + VTable vTable = getVTable(); + int result = vTable.fetchPrior.invoke(this, status, message); + FbException.checkException(status); + return result; + } + + public int fetchFirst(IStatus status, com.sun.jna.Pointer message) throws FbException + { + VTable vTable = getVTable(); + int result = vTable.fetchFirst.invoke(this, status, message); + FbException.checkException(status); + return result; + } + + public int fetchLast(IStatus status, com.sun.jna.Pointer message) throws FbException + { + VTable vTable = getVTable(); + int result = vTable.fetchLast.invoke(this, status, message); + FbException.checkException(status); + return result; + } + + public int fetchAbsolute(IStatus status, int position, com.sun.jna.Pointer message) throws FbException + { + VTable vTable = getVTable(); + int result = vTable.fetchAbsolute.invoke(this, status, position, message); + FbException.checkException(status); + return result; + } + + public int fetchRelative(IStatus status, int offset, com.sun.jna.Pointer message) throws FbException + { + VTable vTable = getVTable(); + int result = vTable.fetchRelative.invoke(this, status, offset, message); + FbException.checkException(status); + return result; + } + + public boolean isEof(IStatus status) throws FbException + { + VTable vTable = getVTable(); + boolean result = vTable.isEof.invoke(this, status); + FbException.checkException(status); + return result; + } + + public boolean isBof(IStatus status) throws FbException + { + VTable vTable = getVTable(); + boolean result = vTable.isBof.invoke(this, status); + FbException.checkException(status); + return result; + } + + public IMessageMetadata getMetadata(IStatus status) throws FbException + { + VTable vTable = getVTable(); + IMessageMetadata result = vTable.getMetadata.invoke(this, status); + FbException.checkException(status); + return result; + } + + public void close(IStatus status) throws FbException + { + VTable vTable = getVTable(); + vTable.close.invoke(this, status); + FbException.checkException(status); + } + + public void setDelayedOutputFormat(IStatus status, IMessageMetadata format) throws FbException + { + VTable vTable = getVTable(); + vTable.setDelayedOutputFormat.invoke(this, status, format); + FbException.checkException(status); + } + } + + public static class IStatement extends IReferenceCounted implements IStatementIntf + { + public static class VTable extends IReferenceCounted.VTable + { + public static interface Callback_getInfo extends com.sun.jna.Callback + { + public void invoke(IStatement self, IStatus status, int itemsLength, byte[] items, int bufferLength, byte[] buffer); + } + + public static interface Callback_getType extends com.sun.jna.Callback + { + public int invoke(IStatement self, IStatus status); + } + + public static interface Callback_getPlan extends com.sun.jna.Callback + { + public String invoke(IStatement self, IStatus status, boolean detailed); + } + + public static interface Callback_getAffectedRecords extends com.sun.jna.Callback + { + public long invoke(IStatement self, IStatus status); + } + + public static interface Callback_getInputMetadata extends com.sun.jna.Callback + { + public IMessageMetadata invoke(IStatement self, IStatus status); + } + + public static interface Callback_getOutputMetadata extends com.sun.jna.Callback + { + public IMessageMetadata invoke(IStatement self, IStatus status); + } + + public static interface Callback_execute extends com.sun.jna.Callback + { + public ITransaction invoke(IStatement self, IStatus status, ITransaction transaction, IMessageMetadata inMetadata, com.sun.jna.Pointer inBuffer, IMessageMetadata outMetadata, com.sun.jna.Pointer outBuffer); + } + + public static interface Callback_openCursor extends com.sun.jna.Callback + { + public IResultSet invoke(IStatement self, IStatus status, ITransaction transaction, IMessageMetadata inMetadata, com.sun.jna.Pointer inBuffer, IMessageMetadata outMetadata, int flags); + } + + public static interface Callback_setCursorName extends com.sun.jna.Callback + { + public void invoke(IStatement self, IStatus status, String name); + } + + public static interface Callback_free extends com.sun.jna.Callback + { + public void invoke(IStatement self, IStatus status); + } + + public static interface Callback_getFlags extends com.sun.jna.Callback + { + public int invoke(IStatement self, IStatus status); + } + + public static interface Callback_getTimeout extends com.sun.jna.Callback + { + public int invoke(IStatement self, IStatus status); + } + + public static interface Callback_setTimeout extends com.sun.jna.Callback + { + public void invoke(IStatement self, IStatus status, int timeOut); + } + + public static interface Callback_createBatch extends com.sun.jna.Callback + { + public IBatch invoke(IStatement self, IStatus status, IMessageMetadata inMetadata, int parLength, byte[] par); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IStatementIntf obj) + { + super(obj); + + getInfo = new Callback_getInfo() { + @Override + public void invoke(IStatement self, IStatus status, int itemsLength, byte[] items, int bufferLength, byte[] buffer) + { + try + { + obj.getInfo(status, itemsLength, items, bufferLength, buffer); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + getType = new Callback_getType() { + @Override + public int invoke(IStatement self, IStatus status) + { + try + { + return obj.getType(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return 0; + } + } + }; + + getPlan = new Callback_getPlan() { + @Override + public String invoke(IStatement self, IStatus status, boolean detailed) + { + try + { + return obj.getPlan(status, detailed); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + + getAffectedRecords = new Callback_getAffectedRecords() { + @Override + public long invoke(IStatement self, IStatus status) + { + try + { + return obj.getAffectedRecords(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return 0; + } + } + }; + + getInputMetadata = new Callback_getInputMetadata() { + @Override + public IMessageMetadata invoke(IStatement self, IStatus status) + { + try + { + return obj.getInputMetadata(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + + getOutputMetadata = new Callback_getOutputMetadata() { + @Override + public IMessageMetadata invoke(IStatement self, IStatus status) + { + try + { + return obj.getOutputMetadata(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + + execute = new Callback_execute() { + @Override + public ITransaction invoke(IStatement self, IStatus status, ITransaction transaction, IMessageMetadata inMetadata, com.sun.jna.Pointer inBuffer, IMessageMetadata outMetadata, com.sun.jna.Pointer outBuffer) + { + try + { + return obj.execute(status, transaction, inMetadata, inBuffer, outMetadata, outBuffer); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + + openCursor = new Callback_openCursor() { + @Override + public IResultSet invoke(IStatement self, IStatus status, ITransaction transaction, IMessageMetadata inMetadata, com.sun.jna.Pointer inBuffer, IMessageMetadata outMetadata, int flags) + { + try + { + return obj.openCursor(status, transaction, inMetadata, inBuffer, outMetadata, flags); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + + setCursorName = new Callback_setCursorName() { + @Override + public void invoke(IStatement self, IStatus status, String name) + { + try + { + obj.setCursorName(status, name); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + free = new Callback_free() { + @Override + public void invoke(IStatement self, IStatus status) + { + try + { + obj.free(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + getFlags = new Callback_getFlags() { + @Override + public int invoke(IStatement self, IStatus status) + { + try + { + return obj.getFlags(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return 0; + } + } + }; + + getTimeout = new Callback_getTimeout() { + @Override + public int invoke(IStatement self, IStatus status) + { + try + { + return obj.getTimeout(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return 0; + } + } + }; + + setTimeout = new Callback_setTimeout() { + @Override + public void invoke(IStatement self, IStatus status, int timeOut) + { + try + { + obj.setTimeout(status, timeOut); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + createBatch = new Callback_createBatch() { + @Override + public IBatch invoke(IStatement self, IStatus status, IMessageMetadata inMetadata, int parLength, byte[] par) + { + try + { + return obj.createBatch(status, inMetadata, parLength, par); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + } + + public VTable() + { + } + + public Callback_getInfo getInfo; + public Callback_getType getType; + public Callback_getPlan getPlan; + public Callback_getAffectedRecords getAffectedRecords; + public Callback_getInputMetadata getInputMetadata; + public Callback_getOutputMetadata getOutputMetadata; + public Callback_execute execute; + public Callback_openCursor openCursor; + public Callback_setCursorName setCursorName; + public Callback_free free; + public Callback_getFlags getFlags; + public Callback_getTimeout getTimeout; + public Callback_setTimeout setTimeout; + public Callback_createBatch createBatch; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("getInfo", "getType", "getPlan", "getAffectedRecords", "getInputMetadata", "getOutputMetadata", "execute", "openCursor", "setCursorName", "free", "getFlags", "getTimeout", "setTimeout", "createBatch")); + return fields; + } + } + + public IStatement() + { + } + + public IStatement(final IStatementIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public void getInfo(IStatus status, int itemsLength, byte[] items, int bufferLength, byte[] buffer) throws FbException + { + VTable vTable = getVTable(); + vTable.getInfo.invoke(this, status, itemsLength, items, bufferLength, buffer); + FbException.checkException(status); + } + + public int getType(IStatus status) throws FbException + { + VTable vTable = getVTable(); + int result = vTable.getType.invoke(this, status); + FbException.checkException(status); + return result; + } + + public String getPlan(IStatus status, boolean detailed) throws FbException + { + VTable vTable = getVTable(); + String result = vTable.getPlan.invoke(this, status, detailed); + FbException.checkException(status); + return result; + } + + public long getAffectedRecords(IStatus status) throws FbException + { + VTable vTable = getVTable(); + long result = vTable.getAffectedRecords.invoke(this, status); + FbException.checkException(status); + return result; + } + + public IMessageMetadata getInputMetadata(IStatus status) throws FbException + { + VTable vTable = getVTable(); + IMessageMetadata result = vTable.getInputMetadata.invoke(this, status); + FbException.checkException(status); + return result; + } + + public IMessageMetadata getOutputMetadata(IStatus status) throws FbException + { + VTable vTable = getVTable(); + IMessageMetadata result = vTable.getOutputMetadata.invoke(this, status); + FbException.checkException(status); + return result; + } + + public ITransaction execute(IStatus status, ITransaction transaction, IMessageMetadata inMetadata, com.sun.jna.Pointer inBuffer, IMessageMetadata outMetadata, com.sun.jna.Pointer outBuffer) throws FbException + { + VTable vTable = getVTable(); + ITransaction result = vTable.execute.invoke(this, status, transaction, inMetadata, inBuffer, outMetadata, outBuffer); + FbException.checkException(status); + return result; + } + + public IResultSet openCursor(IStatus status, ITransaction transaction, IMessageMetadata inMetadata, com.sun.jna.Pointer inBuffer, IMessageMetadata outMetadata, int flags) throws FbException + { + VTable vTable = getVTable(); + IResultSet result = vTable.openCursor.invoke(this, status, transaction, inMetadata, inBuffer, outMetadata, flags); + FbException.checkException(status); + return result; + } + + public void setCursorName(IStatus status, String name) throws FbException + { + VTable vTable = getVTable(); + vTable.setCursorName.invoke(this, status, name); + FbException.checkException(status); + } + + public void free(IStatus status) throws FbException + { + VTable vTable = getVTable(); + vTable.free.invoke(this, status); + FbException.checkException(status); + } + + public int getFlags(IStatus status) throws FbException + { + VTable vTable = getVTable(); + int result = vTable.getFlags.invoke(this, status); + FbException.checkException(status); + return result; + } + + public int getTimeout(IStatus status) throws FbException + { + VTable vTable = getVTable(); + int result = vTable.getTimeout.invoke(this, status); + FbException.checkException(status); + return result; + } + + public void setTimeout(IStatus status, int timeOut) throws FbException + { + VTable vTable = getVTable(); + vTable.setTimeout.invoke(this, status, timeOut); + FbException.checkException(status); + } + + public IBatch createBatch(IStatus status, IMessageMetadata inMetadata, int parLength, byte[] par) throws FbException + { + VTable vTable = getVTable(); + IBatch result = vTable.createBatch.invoke(this, status, inMetadata, parLength, par); + FbException.checkException(status); + return result; + } + } + + public static class IBatch extends IReferenceCounted implements IBatchIntf + { + public static class VTable extends IReferenceCounted.VTable + { + public static interface Callback_add extends com.sun.jna.Callback + { + public void invoke(IBatch self, IStatus status, int count, com.sun.jna.Pointer inBuffer); + } + + public static interface Callback_addBlob extends com.sun.jna.Callback + { + public void invoke(IBatch self, IStatus status, int length, com.sun.jna.Pointer inBuffer, com.sun.jna.ptr.LongByReference blobId, int parLength, byte[] par); + } + + public static interface Callback_appendBlobData extends com.sun.jna.Callback + { + public void invoke(IBatch self, IStatus status, int length, com.sun.jna.Pointer inBuffer); + } + + public static interface Callback_addBlobStream extends com.sun.jna.Callback + { + public void invoke(IBatch self, IStatus status, int length, com.sun.jna.Pointer inBuffer); + } + + public static interface Callback_registerBlob extends com.sun.jna.Callback + { + public void invoke(IBatch self, IStatus status, com.sun.jna.ptr.LongByReference existingBlob, com.sun.jna.ptr.LongByReference blobId); + } + + public static interface Callback_execute extends com.sun.jna.Callback + { + public IBatchCompletionState invoke(IBatch self, IStatus status, ITransaction transaction); + } + + public static interface Callback_cancel extends com.sun.jna.Callback + { + public void invoke(IBatch self, IStatus status); + } + + public static interface Callback_getBlobAlignment extends com.sun.jna.Callback + { + public int invoke(IBatch self, IStatus status); + } + + public static interface Callback_getMetadata extends com.sun.jna.Callback + { + public IMessageMetadata invoke(IBatch self, IStatus status); + } + + public static interface Callback_setDefaultBpb extends com.sun.jna.Callback + { + public void invoke(IBatch self, IStatus status, int parLength, byte[] par); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IBatchIntf obj) + { + super(obj); + + add = new Callback_add() { + @Override + public void invoke(IBatch self, IStatus status, int count, com.sun.jna.Pointer inBuffer) + { + try + { + obj.add(status, count, inBuffer); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + addBlob = new Callback_addBlob() { + @Override + public void invoke(IBatch self, IStatus status, int length, com.sun.jna.Pointer inBuffer, com.sun.jna.ptr.LongByReference blobId, int parLength, byte[] par) + { + try + { + obj.addBlob(status, length, inBuffer, blobId, parLength, par); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + appendBlobData = new Callback_appendBlobData() { + @Override + public void invoke(IBatch self, IStatus status, int length, com.sun.jna.Pointer inBuffer) + { + try + { + obj.appendBlobData(status, length, inBuffer); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + addBlobStream = new Callback_addBlobStream() { + @Override + public void invoke(IBatch self, IStatus status, int length, com.sun.jna.Pointer inBuffer) + { + try + { + obj.addBlobStream(status, length, inBuffer); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + registerBlob = new Callback_registerBlob() { + @Override + public void invoke(IBatch self, IStatus status, com.sun.jna.ptr.LongByReference existingBlob, com.sun.jna.ptr.LongByReference blobId) + { + try + { + obj.registerBlob(status, existingBlob, blobId); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + execute = new Callback_execute() { + @Override + public IBatchCompletionState invoke(IBatch self, IStatus status, ITransaction transaction) + { + try + { + return obj.execute(status, transaction); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + + cancel = new Callback_cancel() { + @Override + public void invoke(IBatch self, IStatus status) + { + try + { + obj.cancel(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + getBlobAlignment = new Callback_getBlobAlignment() { + @Override + public int invoke(IBatch self, IStatus status) + { + try + { + return obj.getBlobAlignment(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return 0; + } + } + }; + + getMetadata = new Callback_getMetadata() { + @Override + public IMessageMetadata invoke(IBatch self, IStatus status) + { + try + { + return obj.getMetadata(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + + setDefaultBpb = new Callback_setDefaultBpb() { + @Override + public void invoke(IBatch self, IStatus status, int parLength, byte[] par) + { + try + { + obj.setDefaultBpb(status, parLength, par); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + } + + public VTable() + { + } + + public Callback_add add; + public Callback_addBlob addBlob; + public Callback_appendBlobData appendBlobData; + public Callback_addBlobStream addBlobStream; + public Callback_registerBlob registerBlob; + public Callback_execute execute; + public Callback_cancel cancel; + public Callback_getBlobAlignment getBlobAlignment; + public Callback_getMetadata getMetadata; + public Callback_setDefaultBpb setDefaultBpb; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("add", "addBlob", "appendBlobData", "addBlobStream", "registerBlob", "execute", "cancel", "getBlobAlignment", "getMetadata", "setDefaultBpb")); + return fields; + } + } + + public IBatch() + { + } + + public IBatch(final IBatchIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public void add(IStatus status, int count, com.sun.jna.Pointer inBuffer) throws FbException + { + VTable vTable = getVTable(); + vTable.add.invoke(this, status, count, inBuffer); + FbException.checkException(status); + } + + public void addBlob(IStatus status, int length, com.sun.jna.Pointer inBuffer, com.sun.jna.ptr.LongByReference blobId, int parLength, byte[] par) throws FbException + { + VTable vTable = getVTable(); + vTable.addBlob.invoke(this, status, length, inBuffer, blobId, parLength, par); + FbException.checkException(status); + } + + public void appendBlobData(IStatus status, int length, com.sun.jna.Pointer inBuffer) throws FbException + { + VTable vTable = getVTable(); + vTable.appendBlobData.invoke(this, status, length, inBuffer); + FbException.checkException(status); + } + + public void addBlobStream(IStatus status, int length, com.sun.jna.Pointer inBuffer) throws FbException + { + VTable vTable = getVTable(); + vTable.addBlobStream.invoke(this, status, length, inBuffer); + FbException.checkException(status); + } + + public void registerBlob(IStatus status, com.sun.jna.ptr.LongByReference existingBlob, com.sun.jna.ptr.LongByReference blobId) throws FbException + { + VTable vTable = getVTable(); + vTable.registerBlob.invoke(this, status, existingBlob, blobId); + FbException.checkException(status); + } + + public IBatchCompletionState execute(IStatus status, ITransaction transaction) throws FbException + { + VTable vTable = getVTable(); + IBatchCompletionState result = vTable.execute.invoke(this, status, transaction); + FbException.checkException(status); + return result; + } + + public void cancel(IStatus status) throws FbException + { + VTable vTable = getVTable(); + vTable.cancel.invoke(this, status); + FbException.checkException(status); + } + + public int getBlobAlignment(IStatus status) throws FbException + { + VTable vTable = getVTable(); + int result = vTable.getBlobAlignment.invoke(this, status); + FbException.checkException(status); + return result; + } + + public IMessageMetadata getMetadata(IStatus status) throws FbException + { + VTable vTable = getVTable(); + IMessageMetadata result = vTable.getMetadata.invoke(this, status); + FbException.checkException(status); + return result; + } + + public void setDefaultBpb(IStatus status, int parLength, byte[] par) throws FbException + { + VTable vTable = getVTable(); + vTable.setDefaultBpb.invoke(this, status, parLength, par); + FbException.checkException(status); + } + } + + public static class IBatchCompletionState extends IDisposable implements IBatchCompletionStateIntf + { + public static class VTable extends IDisposable.VTable + { + public static interface Callback_getSize extends com.sun.jna.Callback + { + public int invoke(IBatchCompletionState self, IStatus status); + } + + public static interface Callback_getState extends com.sun.jna.Callback + { + public int invoke(IBatchCompletionState self, IStatus status, int pos); + } + + public static interface Callback_findError extends com.sun.jna.Callback + { + public int invoke(IBatchCompletionState self, IStatus status, int pos); + } + + public static interface Callback_getStatus extends com.sun.jna.Callback + { + public void invoke(IBatchCompletionState self, IStatus status, IStatus to, int pos); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IBatchCompletionStateIntf obj) + { + super(obj); + + getSize = new Callback_getSize() { + @Override + public int invoke(IBatchCompletionState self, IStatus status) + { + try + { + return obj.getSize(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return 0; + } + } + }; + + getState = new Callback_getState() { + @Override + public int invoke(IBatchCompletionState self, IStatus status, int pos) + { + try + { + return obj.getState(status, pos); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return 0; + } + } + }; + + findError = new Callback_findError() { + @Override + public int invoke(IBatchCompletionState self, IStatus status, int pos) + { + try + { + return obj.findError(status, pos); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return 0; + } + } + }; + + getStatus = new Callback_getStatus() { + @Override + public void invoke(IBatchCompletionState self, IStatus status, IStatus to, int pos) + { + try + { + obj.getStatus(status, to, pos); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + } + + public VTable() + { + } + + public Callback_getSize getSize; + public Callback_getState getState; + public Callback_findError findError; + public Callback_getStatus getStatus; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("getSize", "getState", "findError", "getStatus")); + return fields; + } + } + + public IBatchCompletionState() + { + } + + public IBatchCompletionState(final IBatchCompletionStateIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public int getSize(IStatus status) throws FbException + { + VTable vTable = getVTable(); + int result = vTable.getSize.invoke(this, status); + FbException.checkException(status); + return result; + } + + public int getState(IStatus status, int pos) throws FbException + { + VTable vTable = getVTable(); + int result = vTable.getState.invoke(this, status, pos); + FbException.checkException(status); + return result; + } + + public int findError(IStatus status, int pos) throws FbException + { + VTable vTable = getVTable(); + int result = vTable.findError.invoke(this, status, pos); + FbException.checkException(status); + return result; + } + + public void getStatus(IStatus status, IStatus to, int pos) throws FbException + { + VTable vTable = getVTable(); + vTable.getStatus.invoke(this, status, to, pos); + FbException.checkException(status); + } + } + + public static class IRequest extends IReferenceCounted implements IRequestIntf + { + public static class VTable extends IReferenceCounted.VTable + { + public static interface Callback_receive extends com.sun.jna.Callback + { + public void invoke(IRequest self, IStatus status, int level, int msgType, int length, com.sun.jna.Pointer message); + } + + public static interface Callback_send extends com.sun.jna.Callback + { + public void invoke(IRequest self, IStatus status, int level, int msgType, int length, com.sun.jna.Pointer message); + } + + public static interface Callback_getInfo extends com.sun.jna.Callback + { + public void invoke(IRequest self, IStatus status, int level, int itemsLength, byte[] items, int bufferLength, byte[] buffer); + } + + public static interface Callback_start extends com.sun.jna.Callback + { + public void invoke(IRequest self, IStatus status, ITransaction tra, int level); + } + + public static interface Callback_startAndSend extends com.sun.jna.Callback + { + public void invoke(IRequest self, IStatus status, ITransaction tra, int level, int msgType, int length, com.sun.jna.Pointer message); + } + + public static interface Callback_unwind extends com.sun.jna.Callback + { + public void invoke(IRequest self, IStatus status, int level); + } + + public static interface Callback_free extends com.sun.jna.Callback + { + public void invoke(IRequest self, IStatus status); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IRequestIntf obj) + { + super(obj); + + receive = new Callback_receive() { + @Override + public void invoke(IRequest self, IStatus status, int level, int msgType, int length, com.sun.jna.Pointer message) + { + try + { + obj.receive(status, level, msgType, length, message); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + send = new Callback_send() { + @Override + public void invoke(IRequest self, IStatus status, int level, int msgType, int length, com.sun.jna.Pointer message) + { + try + { + obj.send(status, level, msgType, length, message); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + getInfo = new Callback_getInfo() { + @Override + public void invoke(IRequest self, IStatus status, int level, int itemsLength, byte[] items, int bufferLength, byte[] buffer) + { + try + { + obj.getInfo(status, level, itemsLength, items, bufferLength, buffer); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + start = new Callback_start() { + @Override + public void invoke(IRequest self, IStatus status, ITransaction tra, int level) + { + try + { + obj.start(status, tra, level); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + startAndSend = new Callback_startAndSend() { + @Override + public void invoke(IRequest self, IStatus status, ITransaction tra, int level, int msgType, int length, com.sun.jna.Pointer message) + { + try + { + obj.startAndSend(status, tra, level, msgType, length, message); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + unwind = new Callback_unwind() { + @Override + public void invoke(IRequest self, IStatus status, int level) + { + try + { + obj.unwind(status, level); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + free = new Callback_free() { + @Override + public void invoke(IRequest self, IStatus status) + { + try + { + obj.free(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + } + + public VTable() + { + } + + public Callback_receive receive; + public Callback_send send; + public Callback_getInfo getInfo; + public Callback_start start; + public Callback_startAndSend startAndSend; + public Callback_unwind unwind; + public Callback_free free; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("receive", "send", "getInfo", "start", "startAndSend", "unwind", "free")); + return fields; + } + } + + public IRequest() + { + } + + public IRequest(final IRequestIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public void receive(IStatus status, int level, int msgType, int length, com.sun.jna.Pointer message) throws FbException + { + VTable vTable = getVTable(); + vTable.receive.invoke(this, status, level, msgType, length, message); + FbException.checkException(status); + } + + public void send(IStatus status, int level, int msgType, int length, com.sun.jna.Pointer message) throws FbException + { + VTable vTable = getVTable(); + vTable.send.invoke(this, status, level, msgType, length, message); + FbException.checkException(status); + } + + public void getInfo(IStatus status, int level, int itemsLength, byte[] items, int bufferLength, byte[] buffer) throws FbException + { + VTable vTable = getVTable(); + vTable.getInfo.invoke(this, status, level, itemsLength, items, bufferLength, buffer); + FbException.checkException(status); + } + + public void start(IStatus status, ITransaction tra, int level) throws FbException + { + VTable vTable = getVTable(); + vTable.start.invoke(this, status, tra, level); + FbException.checkException(status); + } + + public void startAndSend(IStatus status, ITransaction tra, int level, int msgType, int length, com.sun.jna.Pointer message) throws FbException + { + VTable vTable = getVTable(); + vTable.startAndSend.invoke(this, status, tra, level, msgType, length, message); + FbException.checkException(status); + } + + public void unwind(IStatus status, int level) throws FbException + { + VTable vTable = getVTable(); + vTable.unwind.invoke(this, status, level); + FbException.checkException(status); + } + + public void free(IStatus status) throws FbException + { + VTable vTable = getVTable(); + vTable.free.invoke(this, status); + FbException.checkException(status); + } + } + + public static class IEvents extends IReferenceCounted implements IEventsIntf + { + public static class VTable extends IReferenceCounted.VTable + { + public static interface Callback_cancel extends com.sun.jna.Callback + { + public void invoke(IEvents self, IStatus status); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IEventsIntf obj) + { + super(obj); + + cancel = new Callback_cancel() { + @Override + public void invoke(IEvents self, IStatus status) + { + try + { + obj.cancel(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + } + + public VTable() + { + } + + public Callback_cancel cancel; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("cancel")); + return fields; + } + } + + public IEvents() + { + } + + public IEvents(final IEventsIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public void cancel(IStatus status) throws FbException + { + VTable vTable = getVTable(); + vTable.cancel.invoke(this, status); + FbException.checkException(status); + } + } + + public static class IEventBlock extends IDisposable implements IEventBlockIntf + { + public static class VTable extends IDisposable.VTable + { + public static interface Callback_getLength extends com.sun.jna.Callback + { + public int invoke(IEventBlock self); + } + + public static interface Callback_getValues extends com.sun.jna.Callback + { + public com.sun.jna.Pointer invoke(IEventBlock self); + } + + public static interface Callback_getBuffer extends com.sun.jna.Callback + { + public com.sun.jna.Pointer invoke(IEventBlock self); + } + + public static interface Callback_getCount extends com.sun.jna.Callback + { + public int invoke(IEventBlock self); + } + + public static interface Callback_getCounters extends com.sun.jna.Callback + { + public com.sun.jna.Pointer invoke(IEventBlock self); + } + + public static interface Callback_counts extends com.sun.jna.Callback + { + public void invoke(IEventBlock self); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IEventBlockIntf obj) + { + super(obj); + + getLength = new Callback_getLength() { + @Override + public int invoke(IEventBlock self) + { + return obj.getLength(); + } + }; + + getValues = new Callback_getValues() { + @Override + public com.sun.jna.Pointer invoke(IEventBlock self) + { + return obj.getValues(); + } + }; + + getBuffer = new Callback_getBuffer() { + @Override + public com.sun.jna.Pointer invoke(IEventBlock self) + { + return obj.getBuffer(); + } + }; + + getCount = new Callback_getCount() { + @Override + public int invoke(IEventBlock self) + { + return obj.getCount(); + } + }; + + getCounters = new Callback_getCounters() { + @Override + public com.sun.jna.Pointer invoke(IEventBlock self) + { + return obj.getCounters(); + } + }; + + counts = new Callback_counts() { + @Override + public void invoke(IEventBlock self) + { + obj.counts(); + } + }; + } + + public VTable() + { + } + + public Callback_getLength getLength; + public Callback_getValues getValues; + public Callback_getBuffer getBuffer; + public Callback_getCount getCount; + public Callback_getCounters getCounters; + public Callback_counts counts; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("getLength", "getValues", "getBuffer", "getCount", "getCounters", "counts")); + return fields; + } + } + + public IEventBlock() + { + } + + public IEventBlock(final IEventBlockIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public int getLength() + { + VTable vTable = getVTable(); + int result = vTable.getLength.invoke(this); + return result; + } + + public com.sun.jna.Pointer getValues() + { + VTable vTable = getVTable(); + com.sun.jna.Pointer result = vTable.getValues.invoke(this); + return result; + } + + public com.sun.jna.Pointer getBuffer() + { + VTable vTable = getVTable(); + com.sun.jna.Pointer result = vTable.getBuffer.invoke(this); + return result; + } + + public int getCount() + { + VTable vTable = getVTable(); + int result = vTable.getCount.invoke(this); + return result; + } + + public com.sun.jna.Pointer getCounters() + { + VTable vTable = getVTable(); + com.sun.jna.Pointer result = vTable.getCounters.invoke(this); + return result; + } + + public void counts() + { + VTable vTable = getVTable(); + vTable.counts.invoke(this); + } + } + + public static class IAttachment extends IReferenceCounted implements IAttachmentIntf + { + public static class VTable extends IReferenceCounted.VTable + { + public static interface Callback_getInfo extends com.sun.jna.Callback + { + public void invoke(IAttachment self, IStatus status, int itemsLength, byte[] items, int bufferLength, byte[] buffer); + } + + public static interface Callback_startTransaction extends com.sun.jna.Callback + { + public ITransaction invoke(IAttachment self, IStatus status, int tpbLength, byte[] tpb); + } + + public static interface Callback_reconnectTransaction extends com.sun.jna.Callback + { + public ITransaction invoke(IAttachment self, IStatus status, int length, byte[] id); + } + + public static interface Callback_compileRequest extends com.sun.jna.Callback + { + public IRequest invoke(IAttachment self, IStatus status, int blrLength, byte[] blr); + } + + public static interface Callback_transactRequest extends com.sun.jna.Callback + { + public void invoke(IAttachment self, IStatus status, ITransaction transaction, int blrLength, byte[] blr, int inMsgLength, byte[] inMsg, int outMsgLength, byte[] outMsg); + } + + public static interface Callback_createBlob extends com.sun.jna.Callback + { + public IBlob invoke(IAttachment self, IStatus status, ITransaction transaction, com.sun.jna.ptr.LongByReference id, int bpbLength, byte[] bpb); + } + + public static interface Callback_openBlob extends com.sun.jna.Callback + { + public IBlob invoke(IAttachment self, IStatus status, ITransaction transaction, com.sun.jna.ptr.LongByReference id, int bpbLength, byte[] bpb); + } + + public static interface Callback_getSlice extends com.sun.jna.Callback + { + public int invoke(IAttachment self, IStatus status, ITransaction transaction, com.sun.jna.ptr.LongByReference id, int sdlLength, byte[] sdl, int paramLength, byte[] param, int sliceLength, byte[] slice); + } + + public static interface Callback_putSlice extends com.sun.jna.Callback + { + public void invoke(IAttachment self, IStatus status, ITransaction transaction, com.sun.jna.ptr.LongByReference id, int sdlLength, byte[] sdl, int paramLength, byte[] param, int sliceLength, byte[] slice); + } + + public static interface Callback_executeDyn extends com.sun.jna.Callback + { + public void invoke(IAttachment self, IStatus status, ITransaction transaction, int length, byte[] dyn); + } + + public static interface Callback_prepare extends com.sun.jna.Callback + { + public IStatement invoke(IAttachment self, IStatus status, ITransaction tra, int stmtLength, String sqlStmt, int dialect, int flags); + } + + public static interface Callback_execute extends com.sun.jna.Callback + { + public ITransaction invoke(IAttachment self, IStatus status, ITransaction transaction, int stmtLength, String sqlStmt, int dialect, IMessageMetadata inMetadata, com.sun.jna.Pointer inBuffer, IMessageMetadata outMetadata, com.sun.jna.Pointer outBuffer); + } + + public static interface Callback_openCursor extends com.sun.jna.Callback + { + public IResultSet invoke(IAttachment self, IStatus status, ITransaction transaction, int stmtLength, String sqlStmt, int dialect, IMessageMetadata inMetadata, com.sun.jna.Pointer inBuffer, IMessageMetadata outMetadata, String cursorName, int cursorFlags); + } + + public static interface Callback_queEvents extends com.sun.jna.Callback + { + public IEvents invoke(IAttachment self, IStatus status, IEventCallback callback, int length, byte[] events); + } + + public static interface Callback_cancelOperation extends com.sun.jna.Callback + { + public void invoke(IAttachment self, IStatus status, int option); + } + + public static interface Callback_ping extends com.sun.jna.Callback + { + public void invoke(IAttachment self, IStatus status); + } + + public static interface Callback_detach extends com.sun.jna.Callback + { + public void invoke(IAttachment self, IStatus status); + } + + public static interface Callback_dropDatabase extends com.sun.jna.Callback + { + public void invoke(IAttachment self, IStatus status); + } + + public static interface Callback_getIdleTimeout extends com.sun.jna.Callback + { + public int invoke(IAttachment self, IStatus status); + } + + public static interface Callback_setIdleTimeout extends com.sun.jna.Callback + { + public void invoke(IAttachment self, IStatus status, int timeOut); + } + + public static interface Callback_getStatementTimeout extends com.sun.jna.Callback + { + public int invoke(IAttachment self, IStatus status); + } + + public static interface Callback_setStatementTimeout extends com.sun.jna.Callback + { + public void invoke(IAttachment self, IStatus status, int timeOut); + } + + public static interface Callback_createBatch extends com.sun.jna.Callback + { + public IBatch invoke(IAttachment self, IStatus status, ITransaction transaction, int stmtLength, String sqlStmt, int dialect, IMessageMetadata inMetadata, int parLength, byte[] par); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IAttachmentIntf obj) + { + super(obj); + + getInfo = new Callback_getInfo() { + @Override + public void invoke(IAttachment self, IStatus status, int itemsLength, byte[] items, int bufferLength, byte[] buffer) + { + try + { + obj.getInfo(status, itemsLength, items, bufferLength, buffer); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + startTransaction = new Callback_startTransaction() { + @Override + public ITransaction invoke(IAttachment self, IStatus status, int tpbLength, byte[] tpb) + { + try + { + return obj.startTransaction(status, tpbLength, tpb); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + + reconnectTransaction = new Callback_reconnectTransaction() { + @Override + public ITransaction invoke(IAttachment self, IStatus status, int length, byte[] id) + { + try + { + return obj.reconnectTransaction(status, length, id); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + + compileRequest = new Callback_compileRequest() { + @Override + public IRequest invoke(IAttachment self, IStatus status, int blrLength, byte[] blr) + { + try + { + return obj.compileRequest(status, blrLength, blr); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + + transactRequest = new Callback_transactRequest() { + @Override + public void invoke(IAttachment self, IStatus status, ITransaction transaction, int blrLength, byte[] blr, int inMsgLength, byte[] inMsg, int outMsgLength, byte[] outMsg) + { + try + { + obj.transactRequest(status, transaction, blrLength, blr, inMsgLength, inMsg, outMsgLength, outMsg); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + createBlob = new Callback_createBlob() { + @Override + public IBlob invoke(IAttachment self, IStatus status, ITransaction transaction, com.sun.jna.ptr.LongByReference id, int bpbLength, byte[] bpb) + { + try + { + return obj.createBlob(status, transaction, id, bpbLength, bpb); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + + openBlob = new Callback_openBlob() { + @Override + public IBlob invoke(IAttachment self, IStatus status, ITransaction transaction, com.sun.jna.ptr.LongByReference id, int bpbLength, byte[] bpb) + { + try + { + return obj.openBlob(status, transaction, id, bpbLength, bpb); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + + getSlice = new Callback_getSlice() { + @Override + public int invoke(IAttachment self, IStatus status, ITransaction transaction, com.sun.jna.ptr.LongByReference id, int sdlLength, byte[] sdl, int paramLength, byte[] param, int sliceLength, byte[] slice) + { + try + { + return obj.getSlice(status, transaction, id, sdlLength, sdl, paramLength, param, sliceLength, slice); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return 0; + } + } + }; + + putSlice = new Callback_putSlice() { + @Override + public void invoke(IAttachment self, IStatus status, ITransaction transaction, com.sun.jna.ptr.LongByReference id, int sdlLength, byte[] sdl, int paramLength, byte[] param, int sliceLength, byte[] slice) + { + try + { + obj.putSlice(status, transaction, id, sdlLength, sdl, paramLength, param, sliceLength, slice); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + executeDyn = new Callback_executeDyn() { + @Override + public void invoke(IAttachment self, IStatus status, ITransaction transaction, int length, byte[] dyn) + { + try + { + obj.executeDyn(status, transaction, length, dyn); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + prepare = new Callback_prepare() { + @Override + public IStatement invoke(IAttachment self, IStatus status, ITransaction tra, int stmtLength, String sqlStmt, int dialect, int flags) + { + try + { + return obj.prepare(status, tra, stmtLength, sqlStmt, dialect, flags); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + + execute = new Callback_execute() { + @Override + public ITransaction invoke(IAttachment self, IStatus status, ITransaction transaction, int stmtLength, String sqlStmt, int dialect, IMessageMetadata inMetadata, com.sun.jna.Pointer inBuffer, IMessageMetadata outMetadata, com.sun.jna.Pointer outBuffer) + { + try + { + return obj.execute(status, transaction, stmtLength, sqlStmt, dialect, inMetadata, inBuffer, outMetadata, outBuffer); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + + openCursor = new Callback_openCursor() { + @Override + public IResultSet invoke(IAttachment self, IStatus status, ITransaction transaction, int stmtLength, String sqlStmt, int dialect, IMessageMetadata inMetadata, com.sun.jna.Pointer inBuffer, IMessageMetadata outMetadata, String cursorName, int cursorFlags) + { + try + { + return obj.openCursor(status, transaction, stmtLength, sqlStmt, dialect, inMetadata, inBuffer, outMetadata, cursorName, cursorFlags); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + + queEvents = new Callback_queEvents() { + @Override + public IEvents invoke(IAttachment self, IStatus status, IEventCallback callback, int length, byte[] events) + { + try + { + return obj.queEvents(status, callback, length, events); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + + cancelOperation = new Callback_cancelOperation() { + @Override + public void invoke(IAttachment self, IStatus status, int option) + { + try + { + obj.cancelOperation(status, option); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + ping = new Callback_ping() { + @Override + public void invoke(IAttachment self, IStatus status) + { + try + { + obj.ping(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + detach = new Callback_detach() { + @Override + public void invoke(IAttachment self, IStatus status) + { + try + { + obj.detach(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + dropDatabase = new Callback_dropDatabase() { + @Override + public void invoke(IAttachment self, IStatus status) + { + try + { + obj.dropDatabase(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + getIdleTimeout = new Callback_getIdleTimeout() { + @Override + public int invoke(IAttachment self, IStatus status) + { + try + { + return obj.getIdleTimeout(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return 0; + } + } + }; + + setIdleTimeout = new Callback_setIdleTimeout() { + @Override + public void invoke(IAttachment self, IStatus status, int timeOut) + { + try + { + obj.setIdleTimeout(status, timeOut); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + getStatementTimeout = new Callback_getStatementTimeout() { + @Override + public int invoke(IAttachment self, IStatus status) + { + try + { + return obj.getStatementTimeout(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return 0; + } + } + }; + + setStatementTimeout = new Callback_setStatementTimeout() { + @Override + public void invoke(IAttachment self, IStatus status, int timeOut) + { + try + { + obj.setStatementTimeout(status, timeOut); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + createBatch = new Callback_createBatch() { + @Override + public IBatch invoke(IAttachment self, IStatus status, ITransaction transaction, int stmtLength, String sqlStmt, int dialect, IMessageMetadata inMetadata, int parLength, byte[] par) + { + try + { + return obj.createBatch(status, transaction, stmtLength, sqlStmt, dialect, inMetadata, parLength, par); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + } + + public VTable() + { + } + + public Callback_getInfo getInfo; + public Callback_startTransaction startTransaction; + public Callback_reconnectTransaction reconnectTransaction; + public Callback_compileRequest compileRequest; + public Callback_transactRequest transactRequest; + public Callback_createBlob createBlob; + public Callback_openBlob openBlob; + public Callback_getSlice getSlice; + public Callback_putSlice putSlice; + public Callback_executeDyn executeDyn; + public Callback_prepare prepare; + public Callback_execute execute; + public Callback_openCursor openCursor; + public Callback_queEvents queEvents; + public Callback_cancelOperation cancelOperation; + public Callback_ping ping; + public Callback_detach detach; + public Callback_dropDatabase dropDatabase; + public Callback_getIdleTimeout getIdleTimeout; + public Callback_setIdleTimeout setIdleTimeout; + public Callback_getStatementTimeout getStatementTimeout; + public Callback_setStatementTimeout setStatementTimeout; + public Callback_createBatch createBatch; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("getInfo", "startTransaction", "reconnectTransaction", "compileRequest", "transactRequest", "createBlob", "openBlob", "getSlice", "putSlice", "executeDyn", "prepare", "execute", "openCursor", "queEvents", "cancelOperation", "ping", "detach", "dropDatabase", "getIdleTimeout", "setIdleTimeout", "getStatementTimeout", "setStatementTimeout", "createBatch")); + return fields; + } + } + + public IAttachment() + { + } + + public IAttachment(final IAttachmentIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public void getInfo(IStatus status, int itemsLength, byte[] items, int bufferLength, byte[] buffer) throws FbException + { + VTable vTable = getVTable(); + vTable.getInfo.invoke(this, status, itemsLength, items, bufferLength, buffer); + FbException.checkException(status); + } + + public ITransaction startTransaction(IStatus status, int tpbLength, byte[] tpb) throws FbException + { + VTable vTable = getVTable(); + ITransaction result = vTable.startTransaction.invoke(this, status, tpbLength, tpb); + FbException.checkException(status); + return result; + } + + public ITransaction reconnectTransaction(IStatus status, int length, byte[] id) throws FbException + { + VTable vTable = getVTable(); + ITransaction result = vTable.reconnectTransaction.invoke(this, status, length, id); + FbException.checkException(status); + return result; + } + + public IRequest compileRequest(IStatus status, int blrLength, byte[] blr) throws FbException + { + VTable vTable = getVTable(); + IRequest result = vTable.compileRequest.invoke(this, status, blrLength, blr); + FbException.checkException(status); + return result; + } + + public void transactRequest(IStatus status, ITransaction transaction, int blrLength, byte[] blr, int inMsgLength, byte[] inMsg, int outMsgLength, byte[] outMsg) throws FbException + { + VTable vTable = getVTable(); + vTable.transactRequest.invoke(this, status, transaction, blrLength, blr, inMsgLength, inMsg, outMsgLength, outMsg); + FbException.checkException(status); + } + + public IBlob createBlob(IStatus status, ITransaction transaction, com.sun.jna.ptr.LongByReference id, int bpbLength, byte[] bpb) throws FbException + { + VTable vTable = getVTable(); + IBlob result = vTable.createBlob.invoke(this, status, transaction, id, bpbLength, bpb); + FbException.checkException(status); + return result; + } + + public IBlob openBlob(IStatus status, ITransaction transaction, com.sun.jna.ptr.LongByReference id, int bpbLength, byte[] bpb) throws FbException + { + VTable vTable = getVTable(); + IBlob result = vTable.openBlob.invoke(this, status, transaction, id, bpbLength, bpb); + FbException.checkException(status); + return result; + } + + public int getSlice(IStatus status, ITransaction transaction, com.sun.jna.ptr.LongByReference id, int sdlLength, byte[] sdl, int paramLength, byte[] param, int sliceLength, byte[] slice) throws FbException + { + VTable vTable = getVTable(); + int result = vTable.getSlice.invoke(this, status, transaction, id, sdlLength, sdl, paramLength, param, sliceLength, slice); + FbException.checkException(status); + return result; + } + + public void putSlice(IStatus status, ITransaction transaction, com.sun.jna.ptr.LongByReference id, int sdlLength, byte[] sdl, int paramLength, byte[] param, int sliceLength, byte[] slice) throws FbException + { + VTable vTable = getVTable(); + vTable.putSlice.invoke(this, status, transaction, id, sdlLength, sdl, paramLength, param, sliceLength, slice); + FbException.checkException(status); + } + + public void executeDyn(IStatus status, ITransaction transaction, int length, byte[] dyn) throws FbException + { + VTable vTable = getVTable(); + vTable.executeDyn.invoke(this, status, transaction, length, dyn); + FbException.checkException(status); + } + + public IStatement prepare(IStatus status, ITransaction tra, int stmtLength, String sqlStmt, int dialect, int flags) throws FbException + { + VTable vTable = getVTable(); + IStatement result = vTable.prepare.invoke(this, status, tra, stmtLength, sqlStmt, dialect, flags); + FbException.checkException(status); + return result; + } + + public ITransaction execute(IStatus status, ITransaction transaction, int stmtLength, String sqlStmt, int dialect, IMessageMetadata inMetadata, com.sun.jna.Pointer inBuffer, IMessageMetadata outMetadata, com.sun.jna.Pointer outBuffer) throws FbException + { + VTable vTable = getVTable(); + ITransaction result = vTable.execute.invoke(this, status, transaction, stmtLength, sqlStmt, dialect, inMetadata, inBuffer, outMetadata, outBuffer); + FbException.checkException(status); + return result; + } + + public IResultSet openCursor(IStatus status, ITransaction transaction, int stmtLength, String sqlStmt, int dialect, IMessageMetadata inMetadata, com.sun.jna.Pointer inBuffer, IMessageMetadata outMetadata, String cursorName, int cursorFlags) throws FbException + { + VTable vTable = getVTable(); + IResultSet result = vTable.openCursor.invoke(this, status, transaction, stmtLength, sqlStmt, dialect, inMetadata, inBuffer, outMetadata, cursorName, cursorFlags); + FbException.checkException(status); + return result; + } + + public IEvents queEvents(IStatus status, IEventCallback callback, int length, byte[] events) throws FbException + { + VTable vTable = getVTable(); + IEvents result = vTable.queEvents.invoke(this, status, callback, length, events); + FbException.checkException(status); + return result; + } + + public void cancelOperation(IStatus status, int option) throws FbException + { + VTable vTable = getVTable(); + vTable.cancelOperation.invoke(this, status, option); + FbException.checkException(status); + } + + public void ping(IStatus status) throws FbException + { + VTable vTable = getVTable(); + vTable.ping.invoke(this, status); + FbException.checkException(status); + } + + public void detach(IStatus status) throws FbException + { + VTable vTable = getVTable(); + vTable.detach.invoke(this, status); + FbException.checkException(status); + } + + public void dropDatabase(IStatus status) throws FbException + { + VTable vTable = getVTable(); + vTable.dropDatabase.invoke(this, status); + FbException.checkException(status); + } + + public int getIdleTimeout(IStatus status) throws FbException + { + VTable vTable = getVTable(); + int result = vTable.getIdleTimeout.invoke(this, status); + FbException.checkException(status); + return result; + } + + public void setIdleTimeout(IStatus status, int timeOut) throws FbException + { + VTable vTable = getVTable(); + vTable.setIdleTimeout.invoke(this, status, timeOut); + FbException.checkException(status); + } + + public int getStatementTimeout(IStatus status) throws FbException + { + VTable vTable = getVTable(); + int result = vTable.getStatementTimeout.invoke(this, status); + FbException.checkException(status); + return result; + } + + public void setStatementTimeout(IStatus status, int timeOut) throws FbException + { + VTable vTable = getVTable(); + vTable.setStatementTimeout.invoke(this, status, timeOut); + FbException.checkException(status); + } + + public IBatch createBatch(IStatus status, ITransaction transaction, int stmtLength, String sqlStmt, int dialect, IMessageMetadata inMetadata, int parLength, byte[] par) throws FbException + { + VTable vTable = getVTable(); + IBatch result = vTable.createBatch.invoke(this, status, transaction, stmtLength, sqlStmt, dialect, inMetadata, parLength, par); + FbException.checkException(status); + return result; + } + } + + public static class IService extends IReferenceCounted implements IServiceIntf + { + public static class VTable extends IReferenceCounted.VTable + { + public static interface Callback_detach extends com.sun.jna.Callback + { + public void invoke(IService self, IStatus status); + } + + public static interface Callback_query extends com.sun.jna.Callback + { + public void invoke(IService self, IStatus status, int sendLength, byte[] sendItems, int receiveLength, byte[] receiveItems, int bufferLength, byte[] buffer); + } + + public static interface Callback_start extends com.sun.jna.Callback + { + public void invoke(IService self, IStatus status, int spbLength, byte[] spb); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IServiceIntf obj) + { + super(obj); + + detach = new Callback_detach() { + @Override + public void invoke(IService self, IStatus status) + { + try + { + obj.detach(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + query = new Callback_query() { + @Override + public void invoke(IService self, IStatus status, int sendLength, byte[] sendItems, int receiveLength, byte[] receiveItems, int bufferLength, byte[] buffer) + { + try + { + obj.query(status, sendLength, sendItems, receiveLength, receiveItems, bufferLength, buffer); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + start = new Callback_start() { + @Override + public void invoke(IService self, IStatus status, int spbLength, byte[] spb) + { + try + { + obj.start(status, spbLength, spb); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + } + + public VTable() + { + } + + public Callback_detach detach; + public Callback_query query; + public Callback_start start; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("detach", "query", "start")); + return fields; + } + } + + public IService() + { + } + + public IService(final IServiceIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public void detach(IStatus status) throws FbException + { + VTable vTable = getVTable(); + vTable.detach.invoke(this, status); + FbException.checkException(status); + } + + public void query(IStatus status, int sendLength, byte[] sendItems, int receiveLength, byte[] receiveItems, int bufferLength, byte[] buffer) throws FbException + { + VTable vTable = getVTable(); + vTable.query.invoke(this, status, sendLength, sendItems, receiveLength, receiveItems, bufferLength, buffer); + FbException.checkException(status); + } + + public void start(IStatus status, int spbLength, byte[] spb) throws FbException + { + VTable vTable = getVTable(); + vTable.start.invoke(this, status, spbLength, spb); + FbException.checkException(status); + } + } + + public static class IProvider extends IPluginBase implements IProviderIntf + { + public static class VTable extends IPluginBase.VTable + { + public static interface Callback_attachDatabase extends com.sun.jna.Callback + { + public IAttachment invoke(IProvider self, IStatus status, String fileName, int dpbLength, byte[] dpb); + } + + public static interface Callback_createDatabase extends com.sun.jna.Callback + { + public IAttachment invoke(IProvider self, IStatus status, String fileName, int dpbLength, byte[] dpb); + } + + public static interface Callback_attachServiceManager extends com.sun.jna.Callback + { + public IService invoke(IProvider self, IStatus status, String service, int spbLength, byte[] spb); + } + + public static interface Callback_shutdown extends com.sun.jna.Callback + { + public void invoke(IProvider self, IStatus status, int timeout, int reason); + } + + public static interface Callback_setDbCryptCallback extends com.sun.jna.Callback + { + public void invoke(IProvider self, IStatus status, ICryptKeyCallback cryptCallback); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IProviderIntf obj) + { + super(obj); + + attachDatabase = new Callback_attachDatabase() { + @Override + public IAttachment invoke(IProvider self, IStatus status, String fileName, int dpbLength, byte[] dpb) + { + try + { + return obj.attachDatabase(status, fileName, dpbLength, dpb); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + + createDatabase = new Callback_createDatabase() { + @Override + public IAttachment invoke(IProvider self, IStatus status, String fileName, int dpbLength, byte[] dpb) + { + try + { + return obj.createDatabase(status, fileName, dpbLength, dpb); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + + attachServiceManager = new Callback_attachServiceManager() { + @Override + public IService invoke(IProvider self, IStatus status, String service, int spbLength, byte[] spb) + { + try + { + return obj.attachServiceManager(status, service, spbLength, spb); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + + shutdown = new Callback_shutdown() { + @Override + public void invoke(IProvider self, IStatus status, int timeout, int reason) + { + try + { + obj.shutdown(status, timeout, reason); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + setDbCryptCallback = new Callback_setDbCryptCallback() { + @Override + public void invoke(IProvider self, IStatus status, ICryptKeyCallback cryptCallback) + { + try + { + obj.setDbCryptCallback(status, cryptCallback); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + } + + public VTable() + { + } + + public Callback_attachDatabase attachDatabase; + public Callback_createDatabase createDatabase; + public Callback_attachServiceManager attachServiceManager; + public Callback_shutdown shutdown; + public Callback_setDbCryptCallback setDbCryptCallback; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("attachDatabase", "createDatabase", "attachServiceManager", "shutdown", "setDbCryptCallback")); + return fields; + } + } + + public IProvider() + { + } + + public IProvider(final IProviderIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public IAttachment attachDatabase(IStatus status, String fileName, int dpbLength, byte[] dpb) throws FbException + { + VTable vTable = getVTable(); + IAttachment result = vTable.attachDatabase.invoke(this, status, fileName, dpbLength, dpb); + FbException.checkException(status); + return result; + } + + public IAttachment createDatabase(IStatus status, String fileName, int dpbLength, byte[] dpb) throws FbException + { + VTable vTable = getVTable(); + IAttachment result = vTable.createDatabase.invoke(this, status, fileName, dpbLength, dpb); + FbException.checkException(status); + return result; + } + + public IService attachServiceManager(IStatus status, String service, int spbLength, byte[] spb) throws FbException + { + VTable vTable = getVTable(); + IService result = vTable.attachServiceManager.invoke(this, status, service, spbLength, spb); + FbException.checkException(status); + return result; + } + + public void shutdown(IStatus status, int timeout, int reason) throws FbException + { + VTable vTable = getVTable(); + vTable.shutdown.invoke(this, status, timeout, reason); + FbException.checkException(status); + } + + public void setDbCryptCallback(IStatus status, ICryptKeyCallback cryptCallback) throws FbException + { + VTable vTable = getVTable(); + vTable.setDbCryptCallback.invoke(this, status, cryptCallback); + FbException.checkException(status); + } + } + + public static class IDtcStart extends IDisposable implements IDtcStartIntf + { + public static class VTable extends IDisposable.VTable + { + public static interface Callback_addAttachment extends com.sun.jna.Callback + { + public void invoke(IDtcStart self, IStatus status, IAttachment att); + } + + public static interface Callback_addWithTpb extends com.sun.jna.Callback + { + public void invoke(IDtcStart self, IStatus status, IAttachment att, int length, byte[] tpb); + } + + public static interface Callback_start extends com.sun.jna.Callback + { + public ITransaction invoke(IDtcStart self, IStatus status); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IDtcStartIntf obj) + { + super(obj); + + addAttachment = new Callback_addAttachment() { + @Override + public void invoke(IDtcStart self, IStatus status, IAttachment att) + { + try + { + obj.addAttachment(status, att); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + addWithTpb = new Callback_addWithTpb() { + @Override + public void invoke(IDtcStart self, IStatus status, IAttachment att, int length, byte[] tpb) + { + try + { + obj.addWithTpb(status, att, length, tpb); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + start = new Callback_start() { + @Override + public ITransaction invoke(IDtcStart self, IStatus status) + { + try + { + return obj.start(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + } + + public VTable() + { + } + + public Callback_addAttachment addAttachment; + public Callback_addWithTpb addWithTpb; + public Callback_start start; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("addAttachment", "addWithTpb", "start")); + return fields; + } + } + + public IDtcStart() + { + } + + public IDtcStart(final IDtcStartIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public void addAttachment(IStatus status, IAttachment att) throws FbException + { + VTable vTable = getVTable(); + vTable.addAttachment.invoke(this, status, att); + FbException.checkException(status); + } + + public void addWithTpb(IStatus status, IAttachment att, int length, byte[] tpb) throws FbException + { + VTable vTable = getVTable(); + vTable.addWithTpb.invoke(this, status, att, length, tpb); + FbException.checkException(status); + } + + public ITransaction start(IStatus status) throws FbException + { + VTable vTable = getVTable(); + ITransaction result = vTable.start.invoke(this, status); + FbException.checkException(status); + return result; + } + } + + public static class IDtc extends IVersioned implements IDtcIntf + { + public static class VTable extends IVersioned.VTable + { + public static interface Callback_join extends com.sun.jna.Callback + { + public ITransaction invoke(IDtc self, IStatus status, ITransaction one, ITransaction two); + } + + public static interface Callback_startBuilder extends com.sun.jna.Callback + { + public IDtcStart invoke(IDtc self, IStatus status); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IDtcIntf obj) + { + super(obj); + + join = new Callback_join() { + @Override + public ITransaction invoke(IDtc self, IStatus status, ITransaction one, ITransaction two) + { + try + { + return obj.join(status, one, two); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + + startBuilder = new Callback_startBuilder() { + @Override + public IDtcStart invoke(IDtc self, IStatus status) + { + try + { + return obj.startBuilder(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + } + + public VTable() + { + } + + public Callback_join join; + public Callback_startBuilder startBuilder; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("join", "startBuilder")); + return fields; + } + } + + public IDtc() + { + } + + public IDtc(final IDtcIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public ITransaction join(IStatus status, ITransaction one, ITransaction two) throws FbException + { + VTable vTable = getVTable(); + ITransaction result = vTable.join.invoke(this, status, one, two); + FbException.checkException(status); + return result; + } + + public IDtcStart startBuilder(IStatus status) throws FbException + { + VTable vTable = getVTable(); + IDtcStart result = vTable.startBuilder.invoke(this, status); + FbException.checkException(status); + return result; + } + } + + public static class IAuth extends IPluginBase implements IAuthIntf + { + public static class VTable extends IPluginBase.VTable + { + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IAuthIntf obj) + { + super(obj); + + } + + public VTable() + { + } + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + return fields; + } + } + + public IAuth() + { + } + + public IAuth(final IAuthIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + } + + public static class IWriter extends IVersioned implements IWriterIntf + { + public static class VTable extends IVersioned.VTable + { + public static interface Callback_reset extends com.sun.jna.Callback + { + public void invoke(IWriter self); + } + + public static interface Callback_add extends com.sun.jna.Callback + { + public void invoke(IWriter self, IStatus status, String name); + } + + public static interface Callback_setType extends com.sun.jna.Callback + { + public void invoke(IWriter self, IStatus status, String value); + } + + public static interface Callback_setDb extends com.sun.jna.Callback + { + public void invoke(IWriter self, IStatus status, String value); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IWriterIntf obj) + { + super(obj); + + reset = new Callback_reset() { + @Override + public void invoke(IWriter self) + { + obj.reset(); + } + }; + + add = new Callback_add() { + @Override + public void invoke(IWriter self, IStatus status, String name) + { + try + { + obj.add(status, name); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + setType = new Callback_setType() { + @Override + public void invoke(IWriter self, IStatus status, String value) + { + try + { + obj.setType(status, value); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + setDb = new Callback_setDb() { + @Override + public void invoke(IWriter self, IStatus status, String value) + { + try + { + obj.setDb(status, value); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + } + + public VTable() + { + } + + public Callback_reset reset; + public Callback_add add; + public Callback_setType setType; + public Callback_setDb setDb; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("reset", "add", "setType", "setDb")); + return fields; + } + } + + public IWriter() + { + } + + public IWriter(final IWriterIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public void reset() + { + VTable vTable = getVTable(); + vTable.reset.invoke(this); + } + + public void add(IStatus status, String name) throws FbException + { + VTable vTable = getVTable(); + vTable.add.invoke(this, status, name); + FbException.checkException(status); + } + + public void setType(IStatus status, String value) throws FbException + { + VTable vTable = getVTable(); + vTable.setType.invoke(this, status, value); + FbException.checkException(status); + } + + public void setDb(IStatus status, String value) throws FbException + { + VTable vTable = getVTable(); + vTable.setDb.invoke(this, status, value); + FbException.checkException(status); + } + } + + public static class IServerBlock extends IVersioned implements IServerBlockIntf + { + public static class VTable extends IVersioned.VTable + { + public static interface Callback_getLogin extends com.sun.jna.Callback + { + public String invoke(IServerBlock self); + } + + public static interface Callback_getData extends com.sun.jna.Callback + { + public com.sun.jna.Pointer invoke(IServerBlock self, com.sun.jna.Pointer length); + } + + public static interface Callback_putData extends com.sun.jna.Callback + { + public void invoke(IServerBlock self, IStatus status, int length, com.sun.jna.Pointer data); + } + + public static interface Callback_newKey extends com.sun.jna.Callback + { + public ICryptKey invoke(IServerBlock self, IStatus status); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IServerBlockIntf obj) + { + super(obj); + + getLogin = new Callback_getLogin() { + @Override + public String invoke(IServerBlock self) + { + return obj.getLogin(); + } + }; + + getData = new Callback_getData() { + @Override + public com.sun.jna.Pointer invoke(IServerBlock self, com.sun.jna.Pointer length) + { + return obj.getData(length); + } + }; + + putData = new Callback_putData() { + @Override + public void invoke(IServerBlock self, IStatus status, int length, com.sun.jna.Pointer data) + { + try + { + obj.putData(status, length, data); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + newKey = new Callback_newKey() { + @Override + public ICryptKey invoke(IServerBlock self, IStatus status) + { + try + { + return obj.newKey(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + } + + public VTable() + { + } + + public Callback_getLogin getLogin; + public Callback_getData getData; + public Callback_putData putData; + public Callback_newKey newKey; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("getLogin", "getData", "putData", "newKey")); + return fields; + } + } + + public IServerBlock() + { + } + + public IServerBlock(final IServerBlockIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public String getLogin() + { + VTable vTable = getVTable(); + String result = vTable.getLogin.invoke(this); + return result; + } + + public com.sun.jna.Pointer getData(com.sun.jna.Pointer length) + { + VTable vTable = getVTable(); + com.sun.jna.Pointer result = vTable.getData.invoke(this, length); + return result; + } + + public void putData(IStatus status, int length, com.sun.jna.Pointer data) throws FbException + { + VTable vTable = getVTable(); + vTable.putData.invoke(this, status, length, data); + FbException.checkException(status); + } + + public ICryptKey newKey(IStatus status) throws FbException + { + VTable vTable = getVTable(); + ICryptKey result = vTable.newKey.invoke(this, status); + FbException.checkException(status); + return result; + } + } + + public static class IClientBlock extends IReferenceCounted implements IClientBlockIntf + { + public static class VTable extends IReferenceCounted.VTable + { + public static interface Callback_getLogin extends com.sun.jna.Callback + { + public String invoke(IClientBlock self); + } + + public static interface Callback_getPassword extends com.sun.jna.Callback + { + public String invoke(IClientBlock self); + } + + public static interface Callback_getCertificate extends com.sun.jna.Callback + { + public String invoke(IClientBlock self); + } + + public static interface Callback_getRepositoryPin extends com.sun.jna.Callback + { + public String invoke(IClientBlock self); + } + + public static interface Callback_getData extends com.sun.jna.Callback + { + public com.sun.jna.Pointer invoke(IClientBlock self, com.sun.jna.Pointer length); + } + + public static interface Callback_putData extends com.sun.jna.Callback + { + public void invoke(IClientBlock self, IStatus status, int length, com.sun.jna.Pointer data); + } + + public static interface Callback_newKey extends com.sun.jna.Callback + { + public ICryptKey invoke(IClientBlock self, IStatus status); + } + + public static interface Callback_getAuthBlock extends com.sun.jna.Callback + { + public IAuthBlock invoke(IClientBlock self, IStatus status); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IClientBlockIntf obj) + { + super(obj); + + getLogin = new Callback_getLogin() { + @Override + public String invoke(IClientBlock self) + { + return obj.getLogin(); + } + }; + + getPassword = new Callback_getPassword() { + @Override + public String invoke(IClientBlock self) + { + return obj.getPassword(); + } + }; + + getCertificate = new Callback_getCertificate() { + @Override + public String invoke(IClientBlock self) + { + return obj.getCertificate(); + } + }; + + getRepositoryPin = new Callback_getRepositoryPin() { + @Override + public String invoke(IClientBlock self) + { + return obj.getRepositoryPin(); + } + }; + + getData = new Callback_getData() { + @Override + public com.sun.jna.Pointer invoke(IClientBlock self, com.sun.jna.Pointer length) + { + return obj.getData(length); + } + }; + + putData = new Callback_putData() { + @Override + public void invoke(IClientBlock self, IStatus status, int length, com.sun.jna.Pointer data) + { + try + { + obj.putData(status, length, data); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + newKey = new Callback_newKey() { + @Override + public ICryptKey invoke(IClientBlock self, IStatus status) + { + try + { + return obj.newKey(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + + getAuthBlock = new Callback_getAuthBlock() { + @Override + public IAuthBlock invoke(IClientBlock self, IStatus status) + { + try + { + return obj.getAuthBlock(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + } + + public VTable() + { + } + + public Callback_getLogin getLogin; + public Callback_getPassword getPassword; + public Callback_getCertificate getCertificate; + public Callback_getRepositoryPin getRepositoryPin; + public Callback_getData getData; + public Callback_putData putData; + public Callback_newKey newKey; + public Callback_getAuthBlock getAuthBlock; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("getLogin", "getPassword", "getCertificate", "getRepositoryPin", "getData", "putData", "newKey", "getAuthBlock")); + return fields; + } + } + + public IClientBlock() + { + } + + public IClientBlock(final IClientBlockIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public String getLogin() + { + VTable vTable = getVTable(); + String result = vTable.getLogin.invoke(this); + return result; + } + + public String getPassword() + { + VTable vTable = getVTable(); + String result = vTable.getPassword.invoke(this); + return result; + } + + public String getCertificate() + { + VTable vTable = getVTable(); + String result = vTable.getCertificate.invoke(this); + return result; + } + + public String getRepositoryPin() + { + VTable vTable = getVTable(); + String result = vTable.getRepositoryPin.invoke(this); + return result; + } + + public com.sun.jna.Pointer getData(com.sun.jna.Pointer length) + { + VTable vTable = getVTable(); + com.sun.jna.Pointer result = vTable.getData.invoke(this, length); + return result; + } + + public void putData(IStatus status, int length, com.sun.jna.Pointer data) throws FbException + { + VTable vTable = getVTable(); + vTable.putData.invoke(this, status, length, data); + FbException.checkException(status); + } + + public ICryptKey newKey(IStatus status) throws FbException + { + VTable vTable = getVTable(); + ICryptKey result = vTable.newKey.invoke(this, status); + FbException.checkException(status); + return result; + } + + public IAuthBlock getAuthBlock(IStatus status) throws FbException + { + VTable vTable = getVTable(); + IAuthBlock result = vTable.getAuthBlock.invoke(this, status); + FbException.checkException(status); + return result; + } + } + + public static class IServer extends IAuth implements IServerIntf + { + public static class VTable extends IAuth.VTable + { + public static interface Callback_authenticate extends com.sun.jna.Callback + { + public int invoke(IServer self, IStatus status, IServerBlock sBlock, IWriter writerInterface); + } + + public static interface Callback_setDbCryptCallback extends com.sun.jna.Callback + { + public void invoke(IServer self, IStatus status, ICryptKeyCallback cryptCallback); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IServerIntf obj) + { + super(obj); + + authenticate = new Callback_authenticate() { + @Override + public int invoke(IServer self, IStatus status, IServerBlock sBlock, IWriter writerInterface) + { + try + { + return obj.authenticate(status, sBlock, writerInterface); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return 0; + } + } + }; + + setDbCryptCallback = new Callback_setDbCryptCallback() { + @Override + public void invoke(IServer self, IStatus status, ICryptKeyCallback cryptCallback) + { + try + { + obj.setDbCryptCallback(status, cryptCallback); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + } + + public VTable() + { + } + + public Callback_authenticate authenticate; + public Callback_setDbCryptCallback setDbCryptCallback; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("authenticate", "setDbCryptCallback")); + return fields; + } + } + + public IServer() + { + } + + public IServer(final IServerIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public int authenticate(IStatus status, IServerBlock sBlock, IWriter writerInterface) throws FbException + { + VTable vTable = getVTable(); + int result = vTable.authenticate.invoke(this, status, sBlock, writerInterface); + FbException.checkException(status); + return result; + } + + public void setDbCryptCallback(IStatus status, ICryptKeyCallback cryptCallback) throws FbException + { + VTable vTable = getVTable(); + vTable.setDbCryptCallback.invoke(this, status, cryptCallback); + FbException.checkException(status); + } + } + + public static class IClient extends IAuth implements IClientIntf + { + public static class VTable extends IAuth.VTable + { + public static interface Callback_authenticate extends com.sun.jna.Callback + { + public int invoke(IClient self, IStatus status, IClientBlock cBlock); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IClientIntf obj) + { + super(obj); + + authenticate = new Callback_authenticate() { + @Override + public int invoke(IClient self, IStatus status, IClientBlock cBlock) + { + try + { + return obj.authenticate(status, cBlock); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return 0; + } + } + }; + } + + public VTable() + { + } + + public Callback_authenticate authenticate; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("authenticate")); + return fields; + } + } + + public IClient() + { + } + + public IClient(final IClientIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public int authenticate(IStatus status, IClientBlock cBlock) throws FbException + { + VTable vTable = getVTable(); + int result = vTable.authenticate.invoke(this, status, cBlock); + FbException.checkException(status); + return result; + } + } + + public static class IUserField extends IVersioned implements IUserFieldIntf + { + public static class VTable extends IVersioned.VTable + { + public static interface Callback_entered extends com.sun.jna.Callback + { + public int invoke(IUserField self); + } + + public static interface Callback_specified extends com.sun.jna.Callback + { + public int invoke(IUserField self); + } + + public static interface Callback_setEntered extends com.sun.jna.Callback + { + public void invoke(IUserField self, IStatus status, int newValue); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IUserFieldIntf obj) + { + super(obj); + + entered = new Callback_entered() { + @Override + public int invoke(IUserField self) + { + return obj.entered(); + } + }; + + specified = new Callback_specified() { + @Override + public int invoke(IUserField self) + { + return obj.specified(); + } + }; + + setEntered = new Callback_setEntered() { + @Override + public void invoke(IUserField self, IStatus status, int newValue) + { + try + { + obj.setEntered(status, newValue); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + } + + public VTable() + { + } + + public Callback_entered entered; + public Callback_specified specified; + public Callback_setEntered setEntered; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("entered", "specified", "setEntered")); + return fields; + } + } + + public IUserField() + { + } + + public IUserField(final IUserFieldIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public int entered() + { + VTable vTable = getVTable(); + int result = vTable.entered.invoke(this); + return result; + } + + public int specified() + { + VTable vTable = getVTable(); + int result = vTable.specified.invoke(this); + return result; + } + + public void setEntered(IStatus status, int newValue) throws FbException + { + VTable vTable = getVTable(); + vTable.setEntered.invoke(this, status, newValue); + FbException.checkException(status); + } + } + + public static class ICharUserField extends IUserField implements ICharUserFieldIntf + { + public static class VTable extends IUserField.VTable + { + public static interface Callback_get extends com.sun.jna.Callback + { + public String invoke(ICharUserField self); + } + + public static interface Callback_set extends com.sun.jna.Callback + { + public void invoke(ICharUserField self, IStatus status, String newValue); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final ICharUserFieldIntf obj) + { + super(obj); + + get = new Callback_get() { + @Override + public String invoke(ICharUserField self) + { + return obj.get(); + } + }; + + set = new Callback_set() { + @Override + public void invoke(ICharUserField self, IStatus status, String newValue) + { + try + { + obj.set(status, newValue); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + } + + public VTable() + { + } + + public Callback_get get; + public Callback_set set; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("get", "set")); + return fields; + } + } + + public ICharUserField() + { + } + + public ICharUserField(final ICharUserFieldIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public String get() + { + VTable vTable = getVTable(); + String result = vTable.get.invoke(this); + return result; + } + + public void set(IStatus status, String newValue) throws FbException + { + VTable vTable = getVTable(); + vTable.set.invoke(this, status, newValue); + FbException.checkException(status); + } + } + + public static class IIntUserField extends IUserField implements IIntUserFieldIntf + { + public static class VTable extends IUserField.VTable + { + public static interface Callback_get extends com.sun.jna.Callback + { + public int invoke(IIntUserField self); + } + + public static interface Callback_set extends com.sun.jna.Callback + { + public void invoke(IIntUserField self, IStatus status, int newValue); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IIntUserFieldIntf obj) + { + super(obj); + + get = new Callback_get() { + @Override + public int invoke(IIntUserField self) + { + return obj.get(); + } + }; + + set = new Callback_set() { + @Override + public void invoke(IIntUserField self, IStatus status, int newValue) + { + try + { + obj.set(status, newValue); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + } + + public VTable() + { + } + + public Callback_get get; + public Callback_set set; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("get", "set")); + return fields; + } + } + + public IIntUserField() + { + } + + public IIntUserField(final IIntUserFieldIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public int get() + { + VTable vTable = getVTable(); + int result = vTable.get.invoke(this); + return result; + } + + public void set(IStatus status, int newValue) throws FbException + { + VTable vTable = getVTable(); + vTable.set.invoke(this, status, newValue); + FbException.checkException(status); + } + } + + public static class IUser extends IVersioned implements IUserIntf + { + public static class VTable extends IVersioned.VTable + { + public static interface Callback_operation extends com.sun.jna.Callback + { + public int invoke(IUser self); + } + + public static interface Callback_userName extends com.sun.jna.Callback + { + public ICharUserField invoke(IUser self); + } + + public static interface Callback_password extends com.sun.jna.Callback + { + public ICharUserField invoke(IUser self); + } + + public static interface Callback_firstName extends com.sun.jna.Callback + { + public ICharUserField invoke(IUser self); + } + + public static interface Callback_lastName extends com.sun.jna.Callback + { + public ICharUserField invoke(IUser self); + } + + public static interface Callback_middleName extends com.sun.jna.Callback + { + public ICharUserField invoke(IUser self); + } + + public static interface Callback_comment extends com.sun.jna.Callback + { + public ICharUserField invoke(IUser self); + } + + public static interface Callback_attributes extends com.sun.jna.Callback + { + public ICharUserField invoke(IUser self); + } + + public static interface Callback_active extends com.sun.jna.Callback + { + public IIntUserField invoke(IUser self); + } + + public static interface Callback_admin extends com.sun.jna.Callback + { + public IIntUserField invoke(IUser self); + } + + public static interface Callback_clear extends com.sun.jna.Callback + { + public void invoke(IUser self, IStatus status); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IUserIntf obj) + { + super(obj); + + operation = new Callback_operation() { + @Override + public int invoke(IUser self) + { + return obj.operation(); + } + }; + + userName = new Callback_userName() { + @Override + public ICharUserField invoke(IUser self) + { + return obj.userName(); + } + }; + + password = new Callback_password() { + @Override + public ICharUserField invoke(IUser self) + { + return obj.password(); + } + }; + + firstName = new Callback_firstName() { + @Override + public ICharUserField invoke(IUser self) + { + return obj.firstName(); + } + }; + + lastName = new Callback_lastName() { + @Override + public ICharUserField invoke(IUser self) + { + return obj.lastName(); + } + }; + + middleName = new Callback_middleName() { + @Override + public ICharUserField invoke(IUser self) + { + return obj.middleName(); + } + }; + + comment = new Callback_comment() { + @Override + public ICharUserField invoke(IUser self) + { + return obj.comment(); + } + }; + + attributes = new Callback_attributes() { + @Override + public ICharUserField invoke(IUser self) + { + return obj.attributes(); + } + }; + + active = new Callback_active() { + @Override + public IIntUserField invoke(IUser self) + { + return obj.active(); + } + }; + + admin = new Callback_admin() { + @Override + public IIntUserField invoke(IUser self) + { + return obj.admin(); + } + }; + + clear = new Callback_clear() { + @Override + public void invoke(IUser self, IStatus status) + { + try + { + obj.clear(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + } + + public VTable() + { + } + + public Callback_operation operation; + public Callback_userName userName; + public Callback_password password; + public Callback_firstName firstName; + public Callback_lastName lastName; + public Callback_middleName middleName; + public Callback_comment comment; + public Callback_attributes attributes; + public Callback_active active; + public Callback_admin admin; + public Callback_clear clear; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("operation", "userName", "password", "firstName", "lastName", "middleName", "comment", "attributes", "active", "admin", "clear")); + return fields; + } + } + + public IUser() + { + } + + public IUser(final IUserIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public int operation() + { + VTable vTable = getVTable(); + int result = vTable.operation.invoke(this); + return result; + } + + public ICharUserField userName() + { + VTable vTable = getVTable(); + ICharUserField result = vTable.userName.invoke(this); + return result; + } + + public ICharUserField password() + { + VTable vTable = getVTable(); + ICharUserField result = vTable.password.invoke(this); + return result; + } + + public ICharUserField firstName() + { + VTable vTable = getVTable(); + ICharUserField result = vTable.firstName.invoke(this); + return result; + } + + public ICharUserField lastName() + { + VTable vTable = getVTable(); + ICharUserField result = vTable.lastName.invoke(this); + return result; + } + + public ICharUserField middleName() + { + VTable vTable = getVTable(); + ICharUserField result = vTable.middleName.invoke(this); + return result; + } + + public ICharUserField comment() + { + VTable vTable = getVTable(); + ICharUserField result = vTable.comment.invoke(this); + return result; + } + + public ICharUserField attributes() + { + VTable vTable = getVTable(); + ICharUserField result = vTable.attributes.invoke(this); + return result; + } + + public IIntUserField active() + { + VTable vTable = getVTable(); + IIntUserField result = vTable.active.invoke(this); + return result; + } + + public IIntUserField admin() + { + VTable vTable = getVTable(); + IIntUserField result = vTable.admin.invoke(this); + return result; + } + + public void clear(IStatus status) throws FbException + { + VTable vTable = getVTable(); + vTable.clear.invoke(this, status); + FbException.checkException(status); + } + } + + public static class IListUsers extends IVersioned implements IListUsersIntf + { + public static class VTable extends IVersioned.VTable + { + public static interface Callback_list extends com.sun.jna.Callback + { + public void invoke(IListUsers self, IStatus status, IUser user); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IListUsersIntf obj) + { + super(obj); + + list = new Callback_list() { + @Override + public void invoke(IListUsers self, IStatus status, IUser user) + { + try + { + obj.list(status, user); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + } + + public VTable() + { + } + + public Callback_list list; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("list")); + return fields; + } + } + + public IListUsers() + { + } + + public IListUsers(final IListUsersIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public void list(IStatus status, IUser user) throws FbException + { + VTable vTable = getVTable(); + vTable.list.invoke(this, status, user); + FbException.checkException(status); + } + } + + public static class ILogonInfo extends IVersioned implements ILogonInfoIntf + { + public static class VTable extends IVersioned.VTable + { + public static interface Callback_name extends com.sun.jna.Callback + { + public String invoke(ILogonInfo self); + } + + public static interface Callback_role extends com.sun.jna.Callback + { + public String invoke(ILogonInfo self); + } + + public static interface Callback_networkProtocol extends com.sun.jna.Callback + { + public String invoke(ILogonInfo self); + } + + public static interface Callback_remoteAddress extends com.sun.jna.Callback + { + public String invoke(ILogonInfo self); + } + + public static interface Callback_authBlock extends com.sun.jna.Callback + { + public com.sun.jna.Pointer invoke(ILogonInfo self, com.sun.jna.Pointer length); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final ILogonInfoIntf obj) + { + super(obj); + + name = new Callback_name() { + @Override + public String invoke(ILogonInfo self) + { + return obj.name(); + } + }; + + role = new Callback_role() { + @Override + public String invoke(ILogonInfo self) + { + return obj.role(); + } + }; + + networkProtocol = new Callback_networkProtocol() { + @Override + public String invoke(ILogonInfo self) + { + return obj.networkProtocol(); + } + }; + + remoteAddress = new Callback_remoteAddress() { + @Override + public String invoke(ILogonInfo self) + { + return obj.remoteAddress(); + } + }; + + authBlock = new Callback_authBlock() { + @Override + public com.sun.jna.Pointer invoke(ILogonInfo self, com.sun.jna.Pointer length) + { + return obj.authBlock(length); + } + }; + } + + public VTable() + { + } + + public Callback_name name; + public Callback_role role; + public Callback_networkProtocol networkProtocol; + public Callback_remoteAddress remoteAddress; + public Callback_authBlock authBlock; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("name", "role", "networkProtocol", "remoteAddress", "authBlock")); + return fields; + } + } + + public ILogonInfo() + { + } + + public ILogonInfo(final ILogonInfoIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public String name() + { + VTable vTable = getVTable(); + String result = vTable.name.invoke(this); + return result; + } + + public String role() + { + VTable vTable = getVTable(); + String result = vTable.role.invoke(this); + return result; + } + + public String networkProtocol() + { + VTable vTable = getVTable(); + String result = vTable.networkProtocol.invoke(this); + return result; + } + + public String remoteAddress() + { + VTable vTable = getVTable(); + String result = vTable.remoteAddress.invoke(this); + return result; + } + + public com.sun.jna.Pointer authBlock(com.sun.jna.Pointer length) + { + VTable vTable = getVTable(); + com.sun.jna.Pointer result = vTable.authBlock.invoke(this, length); + return result; + } + } + + public static class IManagement extends IPluginBase implements IManagementIntf + { + public static class VTable extends IPluginBase.VTable + { + public static interface Callback_start extends com.sun.jna.Callback + { + public void invoke(IManagement self, IStatus status, ILogonInfo logonInfo); + } + + public static interface Callback_execute extends com.sun.jna.Callback + { + public int invoke(IManagement self, IStatus status, IUser user, IListUsers callback); + } + + public static interface Callback_commit extends com.sun.jna.Callback + { + public void invoke(IManagement self, IStatus status); + } + + public static interface Callback_rollback extends com.sun.jna.Callback + { + public void invoke(IManagement self, IStatus status); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IManagementIntf obj) + { + super(obj); + + start = new Callback_start() { + @Override + public void invoke(IManagement self, IStatus status, ILogonInfo logonInfo) + { + try + { + obj.start(status, logonInfo); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + execute = new Callback_execute() { + @Override + public int invoke(IManagement self, IStatus status, IUser user, IListUsers callback) + { + try + { + return obj.execute(status, user, callback); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return 0; + } + } + }; + + commit = new Callback_commit() { + @Override + public void invoke(IManagement self, IStatus status) + { + try + { + obj.commit(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + rollback = new Callback_rollback() { + @Override + public void invoke(IManagement self, IStatus status) + { + try + { + obj.rollback(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + } + + public VTable() + { + } + + public Callback_start start; + public Callback_execute execute; + public Callback_commit commit; + public Callback_rollback rollback; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("start", "execute", "commit", "rollback")); + return fields; + } + } + + public IManagement() + { + } + + public IManagement(final IManagementIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public void start(IStatus status, ILogonInfo logonInfo) throws FbException + { + VTable vTable = getVTable(); + vTable.start.invoke(this, status, logonInfo); + FbException.checkException(status); + } + + public int execute(IStatus status, IUser user, IListUsers callback) throws FbException + { + VTable vTable = getVTable(); + int result = vTable.execute.invoke(this, status, user, callback); + FbException.checkException(status); + return result; + } + + public void commit(IStatus status) throws FbException + { + VTable vTable = getVTable(); + vTable.commit.invoke(this, status); + FbException.checkException(status); + } + + public void rollback(IStatus status) throws FbException + { + VTable vTable = getVTable(); + vTable.rollback.invoke(this, status); + FbException.checkException(status); + } + } + + public static class IAuthBlock extends IVersioned implements IAuthBlockIntf + { + public static class VTable extends IVersioned.VTable + { + public static interface Callback_getType extends com.sun.jna.Callback + { + public String invoke(IAuthBlock self); + } + + public static interface Callback_getName extends com.sun.jna.Callback + { + public String invoke(IAuthBlock self); + } + + public static interface Callback_getPlugin extends com.sun.jna.Callback + { + public String invoke(IAuthBlock self); + } + + public static interface Callback_getSecurityDb extends com.sun.jna.Callback + { + public String invoke(IAuthBlock self); + } + + public static interface Callback_getOriginalPlugin extends com.sun.jna.Callback + { + public String invoke(IAuthBlock self); + } + + public static interface Callback_next extends com.sun.jna.Callback + { + public boolean invoke(IAuthBlock self, IStatus status); + } + + public static interface Callback_first extends com.sun.jna.Callback + { + public boolean invoke(IAuthBlock self, IStatus status); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IAuthBlockIntf obj) + { + super(obj); + + getType = new Callback_getType() { + @Override + public String invoke(IAuthBlock self) + { + return obj.getType(); + } + }; + + getName = new Callback_getName() { + @Override + public String invoke(IAuthBlock self) + { + return obj.getName(); + } + }; + + getPlugin = new Callback_getPlugin() { + @Override + public String invoke(IAuthBlock self) + { + return obj.getPlugin(); + } + }; + + getSecurityDb = new Callback_getSecurityDb() { + @Override + public String invoke(IAuthBlock self) + { + return obj.getSecurityDb(); + } + }; + + getOriginalPlugin = new Callback_getOriginalPlugin() { + @Override + public String invoke(IAuthBlock self) + { + return obj.getOriginalPlugin(); + } + }; + + next = new Callback_next() { + @Override + public boolean invoke(IAuthBlock self, IStatus status) + { + try + { + return obj.next(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return false; + } + } + }; + + first = new Callback_first() { + @Override + public boolean invoke(IAuthBlock self, IStatus status) + { + try + { + return obj.first(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return false; + } + } + }; + } + + public VTable() + { + } + + public Callback_getType getType; + public Callback_getName getName; + public Callback_getPlugin getPlugin; + public Callback_getSecurityDb getSecurityDb; + public Callback_getOriginalPlugin getOriginalPlugin; + public Callback_next next; + public Callback_first first; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("getType", "getName", "getPlugin", "getSecurityDb", "getOriginalPlugin", "next", "first")); + return fields; + } + } + + public IAuthBlock() + { + } + + public IAuthBlock(final IAuthBlockIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public String getType() + { + VTable vTable = getVTable(); + String result = vTable.getType.invoke(this); + return result; + } + + public String getName() + { + VTable vTable = getVTable(); + String result = vTable.getName.invoke(this); + return result; + } + + public String getPlugin() + { + VTable vTable = getVTable(); + String result = vTable.getPlugin.invoke(this); + return result; + } + + public String getSecurityDb() + { + VTable vTable = getVTable(); + String result = vTable.getSecurityDb.invoke(this); + return result; + } + + public String getOriginalPlugin() + { + VTable vTable = getVTable(); + String result = vTable.getOriginalPlugin.invoke(this); + return result; + } + + public boolean next(IStatus status) throws FbException + { + VTable vTable = getVTable(); + boolean result = vTable.next.invoke(this, status); + FbException.checkException(status); + return result; + } + + public boolean first(IStatus status) throws FbException + { + VTable vTable = getVTable(); + boolean result = vTable.first.invoke(this, status); + FbException.checkException(status); + return result; + } + } + + public static class IWireCryptPlugin extends IPluginBase implements IWireCryptPluginIntf + { + public static class VTable extends IPluginBase.VTable + { + public static interface Callback_getKnownTypes extends com.sun.jna.Callback + { + public String invoke(IWireCryptPlugin self, IStatus status); + } + + public static interface Callback_setKey extends com.sun.jna.Callback + { + public void invoke(IWireCryptPlugin self, IStatus status, ICryptKey key); + } + + public static interface Callback_encrypt extends com.sun.jna.Callback + { + public void invoke(IWireCryptPlugin self, IStatus status, int length, com.sun.jna.Pointer from, com.sun.jna.Pointer to); + } + + public static interface Callback_decrypt extends com.sun.jna.Callback + { + public void invoke(IWireCryptPlugin self, IStatus status, int length, com.sun.jna.Pointer from, com.sun.jna.Pointer to); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IWireCryptPluginIntf obj) + { + super(obj); + + getKnownTypes = new Callback_getKnownTypes() { + @Override + public String invoke(IWireCryptPlugin self, IStatus status) + { + try + { + return obj.getKnownTypes(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + + setKey = new Callback_setKey() { + @Override + public void invoke(IWireCryptPlugin self, IStatus status, ICryptKey key) + { + try + { + obj.setKey(status, key); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + encrypt = new Callback_encrypt() { + @Override + public void invoke(IWireCryptPlugin self, IStatus status, int length, com.sun.jna.Pointer from, com.sun.jna.Pointer to) + { + try + { + obj.encrypt(status, length, from, to); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + decrypt = new Callback_decrypt() { + @Override + public void invoke(IWireCryptPlugin self, IStatus status, int length, com.sun.jna.Pointer from, com.sun.jna.Pointer to) + { + try + { + obj.decrypt(status, length, from, to); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + } + + public VTable() + { + } + + public Callback_getKnownTypes getKnownTypes; + public Callback_setKey setKey; + public Callback_encrypt encrypt; + public Callback_decrypt decrypt; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("getKnownTypes", "setKey", "encrypt", "decrypt")); + return fields; + } + } + + public IWireCryptPlugin() + { + } + + public IWireCryptPlugin(final IWireCryptPluginIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public String getKnownTypes(IStatus status) throws FbException + { + VTable vTable = getVTable(); + String result = vTable.getKnownTypes.invoke(this, status); + FbException.checkException(status); + return result; + } + + public void setKey(IStatus status, ICryptKey key) throws FbException + { + VTable vTable = getVTable(); + vTable.setKey.invoke(this, status, key); + FbException.checkException(status); + } + + public void encrypt(IStatus status, int length, com.sun.jna.Pointer from, com.sun.jna.Pointer to) throws FbException + { + VTable vTable = getVTable(); + vTable.encrypt.invoke(this, status, length, from, to); + FbException.checkException(status); + } + + public void decrypt(IStatus status, int length, com.sun.jna.Pointer from, com.sun.jna.Pointer to) throws FbException + { + VTable vTable = getVTable(); + vTable.decrypt.invoke(this, status, length, from, to); + FbException.checkException(status); + } + } + + public static class ICryptKeyCallback extends IVersioned implements ICryptKeyCallbackIntf + { + public static class VTable extends IVersioned.VTable + { + public static interface Callback_callback extends com.sun.jna.Callback + { + public int invoke(ICryptKeyCallback self, int dataLength, com.sun.jna.Pointer data, int bufferLength, com.sun.jna.Pointer buffer); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final ICryptKeyCallbackIntf obj) + { + super(obj); + + callback = new Callback_callback() { + @Override + public int invoke(ICryptKeyCallback self, int dataLength, com.sun.jna.Pointer data, int bufferLength, com.sun.jna.Pointer buffer) + { + return obj.callback(dataLength, data, bufferLength, buffer); + } + }; + } + + public VTable() + { + } + + public Callback_callback callback; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("callback")); + return fields; + } + } + + public ICryptKeyCallback() + { + } + + public ICryptKeyCallback(final ICryptKeyCallbackIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public int callback(int dataLength, com.sun.jna.Pointer data, int bufferLength, com.sun.jna.Pointer buffer) + { + VTable vTable = getVTable(); + int result = vTable.callback.invoke(this, dataLength, data, bufferLength, buffer); + return result; + } + } + + public static class IKeyHolderPlugin extends IPluginBase implements IKeyHolderPluginIntf + { + public static class VTable extends IPluginBase.VTable + { + public static interface Callback_keyCallback extends com.sun.jna.Callback + { + public int invoke(IKeyHolderPlugin self, IStatus status, ICryptKeyCallback callback); + } + + public static interface Callback_keyHandle extends com.sun.jna.Callback + { + public ICryptKeyCallback invoke(IKeyHolderPlugin self, IStatus status, String keyName); + } + + public static interface Callback_useOnlyOwnKeys extends com.sun.jna.Callback + { + public boolean invoke(IKeyHolderPlugin self, IStatus status); + } + + public static interface Callback_chainHandle extends com.sun.jna.Callback + { + public ICryptKeyCallback invoke(IKeyHolderPlugin self, IStatus status); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IKeyHolderPluginIntf obj) + { + super(obj); + + keyCallback = new Callback_keyCallback() { + @Override + public int invoke(IKeyHolderPlugin self, IStatus status, ICryptKeyCallback callback) + { + try + { + return obj.keyCallback(status, callback); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return 0; + } + } + }; + + keyHandle = new Callback_keyHandle() { + @Override + public ICryptKeyCallback invoke(IKeyHolderPlugin self, IStatus status, String keyName) + { + try + { + return obj.keyHandle(status, keyName); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + + useOnlyOwnKeys = new Callback_useOnlyOwnKeys() { + @Override + public boolean invoke(IKeyHolderPlugin self, IStatus status) + { + try + { + return obj.useOnlyOwnKeys(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return false; + } + } + }; + + chainHandle = new Callback_chainHandle() { + @Override + public ICryptKeyCallback invoke(IKeyHolderPlugin self, IStatus status) + { + try + { + return obj.chainHandle(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + } + + public VTable() + { + } + + public Callback_keyCallback keyCallback; + public Callback_keyHandle keyHandle; + public Callback_useOnlyOwnKeys useOnlyOwnKeys; + public Callback_chainHandle chainHandle; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("keyCallback", "keyHandle", "useOnlyOwnKeys", "chainHandle")); + return fields; + } + } + + public IKeyHolderPlugin() + { + } + + public IKeyHolderPlugin(final IKeyHolderPluginIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public int keyCallback(IStatus status, ICryptKeyCallback callback) throws FbException + { + VTable vTable = getVTable(); + int result = vTable.keyCallback.invoke(this, status, callback); + FbException.checkException(status); + return result; + } + + public ICryptKeyCallback keyHandle(IStatus status, String keyName) throws FbException + { + VTable vTable = getVTable(); + ICryptKeyCallback result = vTable.keyHandle.invoke(this, status, keyName); + FbException.checkException(status); + return result; + } + + public boolean useOnlyOwnKeys(IStatus status) throws FbException + { + VTable vTable = getVTable(); + boolean result = vTable.useOnlyOwnKeys.invoke(this, status); + FbException.checkException(status); + return result; + } + + public ICryptKeyCallback chainHandle(IStatus status) throws FbException + { + VTable vTable = getVTable(); + ICryptKeyCallback result = vTable.chainHandle.invoke(this, status); + FbException.checkException(status); + return result; + } + } + + public static class IDbCryptInfo extends IReferenceCounted implements IDbCryptInfoIntf + { + public static class VTable extends IReferenceCounted.VTable + { + public static interface Callback_getDatabaseFullPath extends com.sun.jna.Callback + { + public String invoke(IDbCryptInfo self, IStatus status); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IDbCryptInfoIntf obj) + { + super(obj); + + getDatabaseFullPath = new Callback_getDatabaseFullPath() { + @Override + public String invoke(IDbCryptInfo self, IStatus status) + { + try + { + return obj.getDatabaseFullPath(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + } + + public VTable() + { + } + + public Callback_getDatabaseFullPath getDatabaseFullPath; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("getDatabaseFullPath")); + return fields; + } + } + + public IDbCryptInfo() + { + } + + public IDbCryptInfo(final IDbCryptInfoIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public String getDatabaseFullPath(IStatus status) throws FbException + { + VTable vTable = getVTable(); + String result = vTable.getDatabaseFullPath.invoke(this, status); + FbException.checkException(status); + return result; + } + } + + public static class IDbCryptPlugin extends IPluginBase implements IDbCryptPluginIntf + { + public static class VTable extends IPluginBase.VTable + { + public static interface Callback_setKey extends com.sun.jna.Callback + { + public void invoke(IDbCryptPlugin self, IStatus status, int length, IKeyHolderPlugin[] sources, String keyName); + } + + public static interface Callback_encrypt extends com.sun.jna.Callback + { + public void invoke(IDbCryptPlugin self, IStatus status, int length, com.sun.jna.Pointer from, com.sun.jna.Pointer to); + } + + public static interface Callback_decrypt extends com.sun.jna.Callback + { + public void invoke(IDbCryptPlugin self, IStatus status, int length, com.sun.jna.Pointer from, com.sun.jna.Pointer to); + } + + public static interface Callback_setInfo extends com.sun.jna.Callback + { + public void invoke(IDbCryptPlugin self, IStatus status, IDbCryptInfo info); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IDbCryptPluginIntf obj) + { + super(obj); + + setKey = new Callback_setKey() { + @Override + public void invoke(IDbCryptPlugin self, IStatus status, int length, IKeyHolderPlugin[] sources, String keyName) + { + try + { + obj.setKey(status, length, sources, keyName); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + encrypt = new Callback_encrypt() { + @Override + public void invoke(IDbCryptPlugin self, IStatus status, int length, com.sun.jna.Pointer from, com.sun.jna.Pointer to) + { + try + { + obj.encrypt(status, length, from, to); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + decrypt = new Callback_decrypt() { + @Override + public void invoke(IDbCryptPlugin self, IStatus status, int length, com.sun.jna.Pointer from, com.sun.jna.Pointer to) + { + try + { + obj.decrypt(status, length, from, to); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + setInfo = new Callback_setInfo() { + @Override + public void invoke(IDbCryptPlugin self, IStatus status, IDbCryptInfo info) + { + try + { + obj.setInfo(status, info); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + } + + public VTable() + { + } + + public Callback_setKey setKey; + public Callback_encrypt encrypt; + public Callback_decrypt decrypt; + public Callback_setInfo setInfo; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("setKey", "encrypt", "decrypt", "setInfo")); + return fields; + } + } + + public IDbCryptPlugin() + { + } + + public IDbCryptPlugin(final IDbCryptPluginIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public void setKey(IStatus status, int length, IKeyHolderPlugin[] sources, String keyName) throws FbException + { + VTable vTable = getVTable(); + vTable.setKey.invoke(this, status, length, sources, keyName); + FbException.checkException(status); + } + + public void encrypt(IStatus status, int length, com.sun.jna.Pointer from, com.sun.jna.Pointer to) throws FbException + { + VTable vTable = getVTable(); + vTable.encrypt.invoke(this, status, length, from, to); + FbException.checkException(status); + } + + public void decrypt(IStatus status, int length, com.sun.jna.Pointer from, com.sun.jna.Pointer to) throws FbException + { + VTable vTable = getVTable(); + vTable.decrypt.invoke(this, status, length, from, to); + FbException.checkException(status); + } + + public void setInfo(IStatus status, IDbCryptInfo info) throws FbException + { + VTable vTable = getVTable(); + vTable.setInfo.invoke(this, status, info); + FbException.checkException(status); + } + } + + public static class IExternalContext extends IVersioned implements IExternalContextIntf + { + public static class VTable extends IVersioned.VTable + { + public static interface Callback_getMaster extends com.sun.jna.Callback + { + public IMaster invoke(IExternalContext self); + } + + public static interface Callback_getEngine extends com.sun.jna.Callback + { + public IExternalEngine invoke(IExternalContext self, IStatus status); + } + + public static interface Callback_getAttachment extends com.sun.jna.Callback + { + public IAttachment invoke(IExternalContext self, IStatus status); + } + + public static interface Callback_getTransaction extends com.sun.jna.Callback + { + public ITransaction invoke(IExternalContext self, IStatus status); + } + + public static interface Callback_getUserName extends com.sun.jna.Callback + { + public String invoke(IExternalContext self); + } + + public static interface Callback_getDatabaseName extends com.sun.jna.Callback + { + public String invoke(IExternalContext self); + } + + public static interface Callback_getClientCharSet extends com.sun.jna.Callback + { + public String invoke(IExternalContext self); + } + + public static interface Callback_obtainInfoCode extends com.sun.jna.Callback + { + public int invoke(IExternalContext self); + } + + public static interface Callback_getInfo extends com.sun.jna.Callback + { + public com.sun.jna.Pointer invoke(IExternalContext self, int code); + } + + public static interface Callback_setInfo extends com.sun.jna.Callback + { + public com.sun.jna.Pointer invoke(IExternalContext self, int code, com.sun.jna.Pointer value); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IExternalContextIntf obj) + { + super(obj); + + getMaster = new Callback_getMaster() { + @Override + public IMaster invoke(IExternalContext self) + { + return obj.getMaster(); + } + }; + + getEngine = new Callback_getEngine() { + @Override + public IExternalEngine invoke(IExternalContext self, IStatus status) + { + try + { + return obj.getEngine(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + + getAttachment = new Callback_getAttachment() { + @Override + public IAttachment invoke(IExternalContext self, IStatus status) + { + try + { + return obj.getAttachment(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + + getTransaction = new Callback_getTransaction() { + @Override + public ITransaction invoke(IExternalContext self, IStatus status) + { + try + { + return obj.getTransaction(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + + getUserName = new Callback_getUserName() { + @Override + public String invoke(IExternalContext self) + { + return obj.getUserName(); + } + }; + + getDatabaseName = new Callback_getDatabaseName() { + @Override + public String invoke(IExternalContext self) + { + return obj.getDatabaseName(); + } + }; + + getClientCharSet = new Callback_getClientCharSet() { + @Override + public String invoke(IExternalContext self) + { + return obj.getClientCharSet(); + } + }; + + obtainInfoCode = new Callback_obtainInfoCode() { + @Override + public int invoke(IExternalContext self) + { + return obj.obtainInfoCode(); + } + }; + + getInfo = new Callback_getInfo() { + @Override + public com.sun.jna.Pointer invoke(IExternalContext self, int code) + { + return obj.getInfo(code); + } + }; + + setInfo = new Callback_setInfo() { + @Override + public com.sun.jna.Pointer invoke(IExternalContext self, int code, com.sun.jna.Pointer value) + { + return obj.setInfo(code, value); + } + }; + } + + public VTable() + { + } + + public Callback_getMaster getMaster; + public Callback_getEngine getEngine; + public Callback_getAttachment getAttachment; + public Callback_getTransaction getTransaction; + public Callback_getUserName getUserName; + public Callback_getDatabaseName getDatabaseName; + public Callback_getClientCharSet getClientCharSet; + public Callback_obtainInfoCode obtainInfoCode; + public Callback_getInfo getInfo; + public Callback_setInfo setInfo; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("getMaster", "getEngine", "getAttachment", "getTransaction", "getUserName", "getDatabaseName", "getClientCharSet", "obtainInfoCode", "getInfo", "setInfo")); + return fields; + } + } + + public IExternalContext() + { + } + + public IExternalContext(final IExternalContextIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public IMaster getMaster() + { + VTable vTable = getVTable(); + IMaster result = vTable.getMaster.invoke(this); + return result; + } + + public IExternalEngine getEngine(IStatus status) throws FbException + { + VTable vTable = getVTable(); + IExternalEngine result = vTable.getEngine.invoke(this, status); + FbException.checkException(status); + return result; + } + + public IAttachment getAttachment(IStatus status) throws FbException + { + VTable vTable = getVTable(); + IAttachment result = vTable.getAttachment.invoke(this, status); + FbException.checkException(status); + return result; + } + + public ITransaction getTransaction(IStatus status) throws FbException + { + VTable vTable = getVTable(); + ITransaction result = vTable.getTransaction.invoke(this, status); + FbException.checkException(status); + return result; + } + + public String getUserName() + { + VTable vTable = getVTable(); + String result = vTable.getUserName.invoke(this); + return result; + } + + public String getDatabaseName() + { + VTable vTable = getVTable(); + String result = vTable.getDatabaseName.invoke(this); + return result; + } + + public String getClientCharSet() + { + VTable vTable = getVTable(); + String result = vTable.getClientCharSet.invoke(this); + return result; + } + + public int obtainInfoCode() + { + VTable vTable = getVTable(); + int result = vTable.obtainInfoCode.invoke(this); + return result; + } + + public com.sun.jna.Pointer getInfo(int code) + { + VTable vTable = getVTable(); + com.sun.jna.Pointer result = vTable.getInfo.invoke(this, code); + return result; + } + + public com.sun.jna.Pointer setInfo(int code, com.sun.jna.Pointer value) + { + VTable vTable = getVTable(); + com.sun.jna.Pointer result = vTable.setInfo.invoke(this, code, value); + return result; + } + } + + public static class IExternalResultSet extends IDisposable implements IExternalResultSetIntf + { + public static class VTable extends IDisposable.VTable + { + public static interface Callback_fetch extends com.sun.jna.Callback + { + public boolean invoke(IExternalResultSet self, IStatus status); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IExternalResultSetIntf obj) + { + super(obj); + + fetch = new Callback_fetch() { + @Override + public boolean invoke(IExternalResultSet self, IStatus status) + { + try + { + return obj.fetch(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return false; + } + } + }; + } + + public VTable() + { + } + + public Callback_fetch fetch; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("fetch")); + return fields; + } + } + + public IExternalResultSet() + { + } + + public IExternalResultSet(final IExternalResultSetIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public boolean fetch(IStatus status) throws FbException + { + VTable vTable = getVTable(); + boolean result = vTable.fetch.invoke(this, status); + FbException.checkException(status); + return result; + } + } + + public static class IExternalFunction extends IDisposable implements IExternalFunctionIntf + { + public static class VTable extends IDisposable.VTable + { + public static interface Callback_getCharSet extends com.sun.jna.Callback + { + public void invoke(IExternalFunction self, IStatus status, IExternalContext context, com.sun.jna.Pointer name, int nameSize); + } + + public static interface Callback_execute extends com.sun.jna.Callback + { + public void invoke(IExternalFunction self, IStatus status, IExternalContext context, com.sun.jna.Pointer inMsg, com.sun.jna.Pointer outMsg); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IExternalFunctionIntf obj) + { + super(obj); + + getCharSet = new Callback_getCharSet() { + @Override + public void invoke(IExternalFunction self, IStatus status, IExternalContext context, com.sun.jna.Pointer name, int nameSize) + { + try + { + obj.getCharSet(status, context, name, nameSize); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + execute = new Callback_execute() { + @Override + public void invoke(IExternalFunction self, IStatus status, IExternalContext context, com.sun.jna.Pointer inMsg, com.sun.jna.Pointer outMsg) + { + try + { + obj.execute(status, context, inMsg, outMsg); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + } + + public VTable() + { + } + + public Callback_getCharSet getCharSet; + public Callback_execute execute; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("getCharSet", "execute")); + return fields; + } + } + + public IExternalFunction() + { + } + + public IExternalFunction(final IExternalFunctionIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public void getCharSet(IStatus status, IExternalContext context, com.sun.jna.Pointer name, int nameSize) throws FbException + { + VTable vTable = getVTable(); + vTable.getCharSet.invoke(this, status, context, name, nameSize); + FbException.checkException(status); + } + + public void execute(IStatus status, IExternalContext context, com.sun.jna.Pointer inMsg, com.sun.jna.Pointer outMsg) throws FbException + { + VTable vTable = getVTable(); + vTable.execute.invoke(this, status, context, inMsg, outMsg); + FbException.checkException(status); + } + } + + public static class IExternalProcedure extends IDisposable implements IExternalProcedureIntf + { + public static class VTable extends IDisposable.VTable + { + public static interface Callback_getCharSet extends com.sun.jna.Callback + { + public void invoke(IExternalProcedure self, IStatus status, IExternalContext context, com.sun.jna.Pointer name, int nameSize); + } + + public static interface Callback_open extends com.sun.jna.Callback + { + public IExternalResultSet invoke(IExternalProcedure self, IStatus status, IExternalContext context, com.sun.jna.Pointer inMsg, com.sun.jna.Pointer outMsg); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IExternalProcedureIntf obj) + { + super(obj); + + getCharSet = new Callback_getCharSet() { + @Override + public void invoke(IExternalProcedure self, IStatus status, IExternalContext context, com.sun.jna.Pointer name, int nameSize) + { + try + { + obj.getCharSet(status, context, name, nameSize); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + open = new Callback_open() { + @Override + public IExternalResultSet invoke(IExternalProcedure self, IStatus status, IExternalContext context, com.sun.jna.Pointer inMsg, com.sun.jna.Pointer outMsg) + { + try + { + return obj.open(status, context, inMsg, outMsg); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + } + + public VTable() + { + } + + public Callback_getCharSet getCharSet; + public Callback_open open; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("getCharSet", "open")); + return fields; + } + } + + public IExternalProcedure() + { + } + + public IExternalProcedure(final IExternalProcedureIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public void getCharSet(IStatus status, IExternalContext context, com.sun.jna.Pointer name, int nameSize) throws FbException + { + VTable vTable = getVTable(); + vTable.getCharSet.invoke(this, status, context, name, nameSize); + FbException.checkException(status); + } + + public IExternalResultSet open(IStatus status, IExternalContext context, com.sun.jna.Pointer inMsg, com.sun.jna.Pointer outMsg) throws FbException + { + VTable vTable = getVTable(); + IExternalResultSet result = vTable.open.invoke(this, status, context, inMsg, outMsg); + FbException.checkException(status); + return result; + } + } + + public static class IExternalTrigger extends IDisposable implements IExternalTriggerIntf + { + public static class VTable extends IDisposable.VTable + { + public static interface Callback_getCharSet extends com.sun.jna.Callback + { + public void invoke(IExternalTrigger self, IStatus status, IExternalContext context, com.sun.jna.Pointer name, int nameSize); + } + + public static interface Callback_execute extends com.sun.jna.Callback + { + public void invoke(IExternalTrigger self, IStatus status, IExternalContext context, int action, com.sun.jna.Pointer oldMsg, com.sun.jna.Pointer newMsg, com.sun.jna.Pointer oldDbKey, com.sun.jna.Pointer newDbKey); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IExternalTriggerIntf obj) + { + super(obj); + + getCharSet = new Callback_getCharSet() { + @Override + public void invoke(IExternalTrigger self, IStatus status, IExternalContext context, com.sun.jna.Pointer name, int nameSize) + { + try + { + obj.getCharSet(status, context, name, nameSize); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + execute = new Callback_execute() { + @Override + public void invoke(IExternalTrigger self, IStatus status, IExternalContext context, int action, com.sun.jna.Pointer oldMsg, com.sun.jna.Pointer newMsg, com.sun.jna.Pointer oldDbKey, com.sun.jna.Pointer newDbKey) + { + try + { + obj.execute(status, context, action, oldMsg, newMsg, oldDbKey, newDbKey); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + } + + public VTable() + { + } + + public Callback_getCharSet getCharSet; + public Callback_execute execute; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("getCharSet", "execute")); + return fields; + } + } + + public IExternalTrigger() + { + } + + public IExternalTrigger(final IExternalTriggerIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public void getCharSet(IStatus status, IExternalContext context, com.sun.jna.Pointer name, int nameSize) throws FbException + { + VTable vTable = getVTable(); + vTable.getCharSet.invoke(this, status, context, name, nameSize); + FbException.checkException(status); + } + + public void execute(IStatus status, IExternalContext context, int action, com.sun.jna.Pointer oldMsg, com.sun.jna.Pointer newMsg, com.sun.jna.Pointer oldDbKey, com.sun.jna.Pointer newDbKey) throws FbException + { + VTable vTable = getVTable(); + vTable.execute.invoke(this, status, context, action, oldMsg, newMsg, oldDbKey, newDbKey); + FbException.checkException(status); + } + } + + public static class IRoutineMetadata extends IVersioned implements IRoutineMetadataIntf + { + public static class VTable extends IVersioned.VTable + { + public static interface Callback_getPackage extends com.sun.jna.Callback + { + public String invoke(IRoutineMetadata self, IStatus status); + } + + public static interface Callback_getName extends com.sun.jna.Callback + { + public String invoke(IRoutineMetadata self, IStatus status); + } + + public static interface Callback_getEntryPoint extends com.sun.jna.Callback + { + public String invoke(IRoutineMetadata self, IStatus status); + } + + public static interface Callback_getBody extends com.sun.jna.Callback + { + public String invoke(IRoutineMetadata self, IStatus status); + } + + public static interface Callback_getInputMetadata extends com.sun.jna.Callback + { + public IMessageMetadata invoke(IRoutineMetadata self, IStatus status); + } + + public static interface Callback_getOutputMetadata extends com.sun.jna.Callback + { + public IMessageMetadata invoke(IRoutineMetadata self, IStatus status); + } + + public static interface Callback_getTriggerMetadata extends com.sun.jna.Callback + { + public IMessageMetadata invoke(IRoutineMetadata self, IStatus status); + } + + public static interface Callback_getTriggerTable extends com.sun.jna.Callback + { + public String invoke(IRoutineMetadata self, IStatus status); + } + + public static interface Callback_getTriggerType extends com.sun.jna.Callback + { + public int invoke(IRoutineMetadata self, IStatus status); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IRoutineMetadataIntf obj) + { + super(obj); + + getPackage = new Callback_getPackage() { + @Override + public String invoke(IRoutineMetadata self, IStatus status) + { + try + { + return obj.getPackage(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + + getName = new Callback_getName() { + @Override + public String invoke(IRoutineMetadata self, IStatus status) + { + try + { + return obj.getName(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + + getEntryPoint = new Callback_getEntryPoint() { + @Override + public String invoke(IRoutineMetadata self, IStatus status) + { + try + { + return obj.getEntryPoint(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + + getBody = new Callback_getBody() { + @Override + public String invoke(IRoutineMetadata self, IStatus status) + { + try + { + return obj.getBody(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + + getInputMetadata = new Callback_getInputMetadata() { + @Override + public IMessageMetadata invoke(IRoutineMetadata self, IStatus status) + { + try + { + return obj.getInputMetadata(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + + getOutputMetadata = new Callback_getOutputMetadata() { + @Override + public IMessageMetadata invoke(IRoutineMetadata self, IStatus status) + { + try + { + return obj.getOutputMetadata(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + + getTriggerMetadata = new Callback_getTriggerMetadata() { + @Override + public IMessageMetadata invoke(IRoutineMetadata self, IStatus status) + { + try + { + return obj.getTriggerMetadata(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + + getTriggerTable = new Callback_getTriggerTable() { + @Override + public String invoke(IRoutineMetadata self, IStatus status) + { + try + { + return obj.getTriggerTable(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + + getTriggerType = new Callback_getTriggerType() { + @Override + public int invoke(IRoutineMetadata self, IStatus status) + { + try + { + return obj.getTriggerType(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return 0; + } + } + }; + } + + public VTable() + { + } + + public Callback_getPackage getPackage; + public Callback_getName getName; + public Callback_getEntryPoint getEntryPoint; + public Callback_getBody getBody; + public Callback_getInputMetadata getInputMetadata; + public Callback_getOutputMetadata getOutputMetadata; + public Callback_getTriggerMetadata getTriggerMetadata; + public Callback_getTriggerTable getTriggerTable; + public Callback_getTriggerType getTriggerType; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("getPackage", "getName", "getEntryPoint", "getBody", "getInputMetadata", "getOutputMetadata", "getTriggerMetadata", "getTriggerTable", "getTriggerType")); + return fields; + } + } + + public IRoutineMetadata() + { + } + + public IRoutineMetadata(final IRoutineMetadataIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public String getPackage(IStatus status) throws FbException + { + VTable vTable = getVTable(); + String result = vTable.getPackage.invoke(this, status); + FbException.checkException(status); + return result; + } + + public String getName(IStatus status) throws FbException + { + VTable vTable = getVTable(); + String result = vTable.getName.invoke(this, status); + FbException.checkException(status); + return result; + } + + public String getEntryPoint(IStatus status) throws FbException + { + VTable vTable = getVTable(); + String result = vTable.getEntryPoint.invoke(this, status); + FbException.checkException(status); + return result; + } + + public String getBody(IStatus status) throws FbException + { + VTable vTable = getVTable(); + String result = vTable.getBody.invoke(this, status); + FbException.checkException(status); + return result; + } + + public IMessageMetadata getInputMetadata(IStatus status) throws FbException + { + VTable vTable = getVTable(); + IMessageMetadata result = vTable.getInputMetadata.invoke(this, status); + FbException.checkException(status); + return result; + } + + public IMessageMetadata getOutputMetadata(IStatus status) throws FbException + { + VTable vTable = getVTable(); + IMessageMetadata result = vTable.getOutputMetadata.invoke(this, status); + FbException.checkException(status); + return result; + } + + public IMessageMetadata getTriggerMetadata(IStatus status) throws FbException + { + VTable vTable = getVTable(); + IMessageMetadata result = vTable.getTriggerMetadata.invoke(this, status); + FbException.checkException(status); + return result; + } + + public String getTriggerTable(IStatus status) throws FbException + { + VTable vTable = getVTable(); + String result = vTable.getTriggerTable.invoke(this, status); + FbException.checkException(status); + return result; + } + + public int getTriggerType(IStatus status) throws FbException + { + VTable vTable = getVTable(); + int result = vTable.getTriggerType.invoke(this, status); + FbException.checkException(status); + return result; + } + } + + public static class IExternalEngine extends IPluginBase implements IExternalEngineIntf + { + public static class VTable extends IPluginBase.VTable + { + public static interface Callback_open extends com.sun.jna.Callback + { + public void invoke(IExternalEngine self, IStatus status, IExternalContext context, com.sun.jna.Pointer charSet, int charSetSize); + } + + public static interface Callback_openAttachment extends com.sun.jna.Callback + { + public void invoke(IExternalEngine self, IStatus status, IExternalContext context); + } + + public static interface Callback_closeAttachment extends com.sun.jna.Callback + { + public void invoke(IExternalEngine self, IStatus status, IExternalContext context); + } + + public static interface Callback_makeFunction extends com.sun.jna.Callback + { + public IExternalFunction invoke(IExternalEngine self, IStatus status, IExternalContext context, IRoutineMetadata metadata, IMetadataBuilder inBuilder, IMetadataBuilder outBuilder); + } + + public static interface Callback_makeProcedure extends com.sun.jna.Callback + { + public IExternalProcedure invoke(IExternalEngine self, IStatus status, IExternalContext context, IRoutineMetadata metadata, IMetadataBuilder inBuilder, IMetadataBuilder outBuilder); + } + + public static interface Callback_makeTrigger extends com.sun.jna.Callback + { + public IExternalTrigger invoke(IExternalEngine self, IStatus status, IExternalContext context, IRoutineMetadata metadata, IMetadataBuilder fieldsBuilder); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IExternalEngineIntf obj) + { + super(obj); + + open = new Callback_open() { + @Override + public void invoke(IExternalEngine self, IStatus status, IExternalContext context, com.sun.jna.Pointer charSet, int charSetSize) + { + try + { + obj.open(status, context, charSet, charSetSize); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + openAttachment = new Callback_openAttachment() { + @Override + public void invoke(IExternalEngine self, IStatus status, IExternalContext context) + { + try + { + obj.openAttachment(status, context); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + closeAttachment = new Callback_closeAttachment() { + @Override + public void invoke(IExternalEngine self, IStatus status, IExternalContext context) + { + try + { + obj.closeAttachment(status, context); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + makeFunction = new Callback_makeFunction() { + @Override + public IExternalFunction invoke(IExternalEngine self, IStatus status, IExternalContext context, IRoutineMetadata metadata, IMetadataBuilder inBuilder, IMetadataBuilder outBuilder) + { + try + { + return obj.makeFunction(status, context, metadata, inBuilder, outBuilder); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + + makeProcedure = new Callback_makeProcedure() { + @Override + public IExternalProcedure invoke(IExternalEngine self, IStatus status, IExternalContext context, IRoutineMetadata metadata, IMetadataBuilder inBuilder, IMetadataBuilder outBuilder) + { + try + { + return obj.makeProcedure(status, context, metadata, inBuilder, outBuilder); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + + makeTrigger = new Callback_makeTrigger() { + @Override + public IExternalTrigger invoke(IExternalEngine self, IStatus status, IExternalContext context, IRoutineMetadata metadata, IMetadataBuilder fieldsBuilder) + { + try + { + return obj.makeTrigger(status, context, metadata, fieldsBuilder); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + } + + public VTable() + { + } + + public Callback_open open; + public Callback_openAttachment openAttachment; + public Callback_closeAttachment closeAttachment; + public Callback_makeFunction makeFunction; + public Callback_makeProcedure makeProcedure; + public Callback_makeTrigger makeTrigger; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("open", "openAttachment", "closeAttachment", "makeFunction", "makeProcedure", "makeTrigger")); + return fields; + } + } + + public IExternalEngine() + { + } + + public IExternalEngine(final IExternalEngineIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public void open(IStatus status, IExternalContext context, com.sun.jna.Pointer charSet, int charSetSize) throws FbException + { + VTable vTable = getVTable(); + vTable.open.invoke(this, status, context, charSet, charSetSize); + FbException.checkException(status); + } + + public void openAttachment(IStatus status, IExternalContext context) throws FbException + { + VTable vTable = getVTable(); + vTable.openAttachment.invoke(this, status, context); + FbException.checkException(status); + } + + public void closeAttachment(IStatus status, IExternalContext context) throws FbException + { + VTable vTable = getVTable(); + vTable.closeAttachment.invoke(this, status, context); + FbException.checkException(status); + } + + public IExternalFunction makeFunction(IStatus status, IExternalContext context, IRoutineMetadata metadata, IMetadataBuilder inBuilder, IMetadataBuilder outBuilder) throws FbException + { + VTable vTable = getVTable(); + IExternalFunction result = vTable.makeFunction.invoke(this, status, context, metadata, inBuilder, outBuilder); + FbException.checkException(status); + return result; + } + + public IExternalProcedure makeProcedure(IStatus status, IExternalContext context, IRoutineMetadata metadata, IMetadataBuilder inBuilder, IMetadataBuilder outBuilder) throws FbException + { + VTable vTable = getVTable(); + IExternalProcedure result = vTable.makeProcedure.invoke(this, status, context, metadata, inBuilder, outBuilder); + FbException.checkException(status); + return result; + } + + public IExternalTrigger makeTrigger(IStatus status, IExternalContext context, IRoutineMetadata metadata, IMetadataBuilder fieldsBuilder) throws FbException + { + VTable vTable = getVTable(); + IExternalTrigger result = vTable.makeTrigger.invoke(this, status, context, metadata, fieldsBuilder); + FbException.checkException(status); + return result; + } + } + + public static class ITimer extends IReferenceCounted implements ITimerIntf + { + public static class VTable extends IReferenceCounted.VTable + { + public static interface Callback_handler extends com.sun.jna.Callback + { + public void invoke(ITimer self); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final ITimerIntf obj) + { + super(obj); + + handler = new Callback_handler() { + @Override + public void invoke(ITimer self) + { + obj.handler(); + } + }; + } + + public VTable() + { + } + + public Callback_handler handler; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("handler")); + return fields; + } + } + + public ITimer() + { + } + + public ITimer(final ITimerIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public void handler() + { + VTable vTable = getVTable(); + vTable.handler.invoke(this); + } + } + + public static class ITimerControl extends IVersioned implements ITimerControlIntf + { + public static class VTable extends IVersioned.VTable + { + public static interface Callback_start extends com.sun.jna.Callback + { + public void invoke(ITimerControl self, IStatus status, ITimer timer, long microSeconds); + } + + public static interface Callback_stop extends com.sun.jna.Callback + { + public void invoke(ITimerControl self, IStatus status, ITimer timer); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final ITimerControlIntf obj) + { + super(obj); + + start = new Callback_start() { + @Override + public void invoke(ITimerControl self, IStatus status, ITimer timer, long microSeconds) + { + try + { + obj.start(status, timer, microSeconds); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + stop = new Callback_stop() { + @Override + public void invoke(ITimerControl self, IStatus status, ITimer timer) + { + try + { + obj.stop(status, timer); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + } + + public VTable() + { + } + + public Callback_start start; + public Callback_stop stop; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("start", "stop")); + return fields; + } + } + + public ITimerControl() + { + } + + public ITimerControl(final ITimerControlIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public void start(IStatus status, ITimer timer, long microSeconds) throws FbException + { + VTable vTable = getVTable(); + vTable.start.invoke(this, status, timer, microSeconds); + FbException.checkException(status); + } + + public void stop(IStatus status, ITimer timer) throws FbException + { + VTable vTable = getVTable(); + vTable.stop.invoke(this, status, timer); + FbException.checkException(status); + } + } + + public static class IVersionCallback extends IVersioned implements IVersionCallbackIntf + { + public static class VTable extends IVersioned.VTable + { + public static interface Callback_callback extends com.sun.jna.Callback + { + public void invoke(IVersionCallback self, IStatus status, String text); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IVersionCallbackIntf obj) + { + super(obj); + + callback = new Callback_callback() { + @Override + public void invoke(IVersionCallback self, IStatus status, String text) + { + try + { + obj.callback(status, text); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + } + + public VTable() + { + } + + public Callback_callback callback; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("callback")); + return fields; + } + } + + public IVersionCallback() + { + } + + public IVersionCallback(final IVersionCallbackIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public void callback(IStatus status, String text) throws FbException + { + VTable vTable = getVTable(); + vTable.callback.invoke(this, status, text); + FbException.checkException(status); + } + } + + public static class IUtil extends IVersioned implements IUtilIntf + { + public static class VTable extends IVersioned.VTable + { + public static interface Callback_getFbVersion extends com.sun.jna.Callback + { + public void invoke(IUtil self, IStatus status, IAttachment att, IVersionCallback callback); + } + + public static interface Callback_loadBlob extends com.sun.jna.Callback + { + public void invoke(IUtil self, IStatus status, com.sun.jna.ptr.LongByReference blobId, IAttachment att, ITransaction tra, String file, boolean txt); + } + + public static interface Callback_dumpBlob extends com.sun.jna.Callback + { + public void invoke(IUtil self, IStatus status, com.sun.jna.ptr.LongByReference blobId, IAttachment att, ITransaction tra, String file, boolean txt); + } + + public static interface Callback_getPerfCounters extends com.sun.jna.Callback + { + public void invoke(IUtil self, IStatus status, IAttachment att, String countersSet, long[] counters); + } + + public static interface Callback_executeCreateDatabase extends com.sun.jna.Callback + { + public IAttachment invoke(IUtil self, IStatus status, int stmtLength, String creatDBstatement, int dialect, boolean[] stmtIsCreateDb); + } + + public static interface Callback_decodeDate extends com.sun.jna.Callback + { + public void invoke(IUtil self, ISC_DATE date, com.sun.jna.Pointer year, com.sun.jna.Pointer month, com.sun.jna.Pointer day); + } + + public static interface Callback_decodeTime extends com.sun.jna.Callback + { + public void invoke(IUtil self, ISC_TIME time, com.sun.jna.Pointer hours, com.sun.jna.Pointer minutes, com.sun.jna.Pointer seconds, com.sun.jna.Pointer fractions); + } + + public static interface Callback_encodeDate extends com.sun.jna.Callback + { + public ISC_DATE invoke(IUtil self, int year, int month, int day); + } + + public static interface Callback_encodeTime extends com.sun.jna.Callback + { + public ISC_TIME invoke(IUtil self, int hours, int minutes, int seconds, int fractions); + } + + public static interface Callback_formatStatus extends com.sun.jna.Callback + { + public int invoke(IUtil self, com.sun.jna.Pointer buffer, int bufferSize, IStatus status); + } + + public static interface Callback_getClientVersion extends com.sun.jna.Callback + { + public int invoke(IUtil self); + } + + public static interface Callback_getXpbBuilder extends com.sun.jna.Callback + { + public IXpbBuilder invoke(IUtil self, IStatus status, int kind, byte[] buf, int len); + } + + public static interface Callback_setOffsets extends com.sun.jna.Callback + { + public int invoke(IUtil self, IStatus status, IMessageMetadata metadata, IOffsetsCallback callback); + } + + public static interface Callback_createEventBlock extends com.sun.jna.Callback + { + public IEventBlock invoke(IUtil self, IStatus status, String[] events); + } + + public static interface Callback_getDecFloat16 extends com.sun.jna.Callback + { + public IDecFloat16 invoke(IUtil self, IStatus status); + } + + public static interface Callback_getDecFloat34 extends com.sun.jna.Callback + { + public IDecFloat34 invoke(IUtil self, IStatus status); + } + + public static interface Callback_getTransactionByHandle extends com.sun.jna.Callback + { + public ITransaction invoke(IUtil self, IStatus status, com.sun.jna.ptr.LongByReference hndlPtr); + } + + public static interface Callback_getStatementByHandle extends com.sun.jna.Callback + { + public IStatement invoke(IUtil self, IStatus status, com.sun.jna.ptr.LongByReference hndlPtr); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IUtilIntf obj) + { + super(obj); + + getFbVersion = new Callback_getFbVersion() { + @Override + public void invoke(IUtil self, IStatus status, IAttachment att, IVersionCallback callback) + { + try + { + obj.getFbVersion(status, att, callback); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + loadBlob = new Callback_loadBlob() { + @Override + public void invoke(IUtil self, IStatus status, com.sun.jna.ptr.LongByReference blobId, IAttachment att, ITransaction tra, String file, boolean txt) + { + try + { + obj.loadBlob(status, blobId, att, tra, file, txt); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + dumpBlob = new Callback_dumpBlob() { + @Override + public void invoke(IUtil self, IStatus status, com.sun.jna.ptr.LongByReference blobId, IAttachment att, ITransaction tra, String file, boolean txt) + { + try + { + obj.dumpBlob(status, blobId, att, tra, file, txt); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + getPerfCounters = new Callback_getPerfCounters() { + @Override + public void invoke(IUtil self, IStatus status, IAttachment att, String countersSet, long[] counters) + { + try + { + obj.getPerfCounters(status, att, countersSet, counters); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + executeCreateDatabase = new Callback_executeCreateDatabase() { + @Override + public IAttachment invoke(IUtil self, IStatus status, int stmtLength, String creatDBstatement, int dialect, boolean[] stmtIsCreateDb) + { + try + { + return obj.executeCreateDatabase(status, stmtLength, creatDBstatement, dialect, stmtIsCreateDb); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + + decodeDate = new Callback_decodeDate() { + @Override + public void invoke(IUtil self, ISC_DATE date, com.sun.jna.Pointer year, com.sun.jna.Pointer month, com.sun.jna.Pointer day) + { + obj.decodeDate(date, year, month, day); + } + }; + + decodeTime = new Callback_decodeTime() { + @Override + public void invoke(IUtil self, ISC_TIME time, com.sun.jna.Pointer hours, com.sun.jna.Pointer minutes, com.sun.jna.Pointer seconds, com.sun.jna.Pointer fractions) + { + obj.decodeTime(time, hours, minutes, seconds, fractions); + } + }; + + encodeDate = new Callback_encodeDate() { + @Override + public ISC_DATE invoke(IUtil self, int year, int month, int day) + { + return obj.encodeDate(year, month, day); + } + }; + + encodeTime = new Callback_encodeTime() { + @Override + public ISC_TIME invoke(IUtil self, int hours, int minutes, int seconds, int fractions) + { + return obj.encodeTime(hours, minutes, seconds, fractions); + } + }; + + formatStatus = new Callback_formatStatus() { + @Override + public int invoke(IUtil self, com.sun.jna.Pointer buffer, int bufferSize, IStatus status) + { + return obj.formatStatus(buffer, bufferSize, status); + } + }; + + getClientVersion = new Callback_getClientVersion() { + @Override + public int invoke(IUtil self) + { + return obj.getClientVersion(); + } + }; + + getXpbBuilder = new Callback_getXpbBuilder() { + @Override + public IXpbBuilder invoke(IUtil self, IStatus status, int kind, byte[] buf, int len) + { + try + { + return obj.getXpbBuilder(status, kind, buf, len); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + + setOffsets = new Callback_setOffsets() { + @Override + public int invoke(IUtil self, IStatus status, IMessageMetadata metadata, IOffsetsCallback callback) + { + try + { + return obj.setOffsets(status, metadata, callback); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return 0; + } + } + }; + + createEventBlock = new Callback_createEventBlock() { + @Override + public IEventBlock invoke(IUtil self, IStatus status, String[] events) + { + try + { + return obj.createEventBlock(status, events); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + + getDecFloat16 = new Callback_getDecFloat16() { + @Override + public IDecFloat16 invoke(IUtil self, IStatus status) + { + try + { + return obj.getDecFloat16(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + + getDecFloat34 = new Callback_getDecFloat34() { + @Override + public IDecFloat34 invoke(IUtil self, IStatus status) + { + try + { + return obj.getDecFloat34(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + + getTransactionByHandle = new Callback_getTransactionByHandle() { + @Override + public ITransaction invoke(IUtil self, IStatus status, com.sun.jna.ptr.LongByReference hndlPtr) + { + try + { + return obj.getTransactionByHandle(status, hndlPtr); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + + getStatementByHandle = new Callback_getStatementByHandle() { + @Override + public IStatement invoke(IUtil self, IStatus status, com.sun.jna.ptr.LongByReference hndlPtr) + { + try + { + return obj.getStatementByHandle(status, hndlPtr); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + } + + public VTable() + { + } + + public Callback_getFbVersion getFbVersion; + public Callback_loadBlob loadBlob; + public Callback_dumpBlob dumpBlob; + public Callback_getPerfCounters getPerfCounters; + public Callback_executeCreateDatabase executeCreateDatabase; + public Callback_decodeDate decodeDate; + public Callback_decodeTime decodeTime; + public Callback_encodeDate encodeDate; + public Callback_encodeTime encodeTime; + public Callback_formatStatus formatStatus; + public Callback_getClientVersion getClientVersion; + public Callback_getXpbBuilder getXpbBuilder; + public Callback_setOffsets setOffsets; + public Callback_createEventBlock createEventBlock; + public Callback_getDecFloat16 getDecFloat16; + public Callback_getDecFloat34 getDecFloat34; + public Callback_getTransactionByHandle getTransactionByHandle; + public Callback_getStatementByHandle getStatementByHandle; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("getFbVersion", "loadBlob", "dumpBlob", "getPerfCounters", "executeCreateDatabase", "decodeDate", "decodeTime", "encodeDate", "encodeTime", "formatStatus", "getClientVersion", "getXpbBuilder", "setOffsets", "createEventBlock", "getDecFloat16", "getDecFloat34", "getTransactionByHandle", "getStatementByHandle")); + return fields; + } + } + + public IUtil() + { + } + + public IUtil(final IUtilIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public void getFbVersion(IStatus status, IAttachment att, IVersionCallback callback) throws FbException + { + VTable vTable = getVTable(); + vTable.getFbVersion.invoke(this, status, att, callback); + FbException.checkException(status); + } + + public void loadBlob(IStatus status, com.sun.jna.ptr.LongByReference blobId, IAttachment att, ITransaction tra, String file, boolean txt) throws FbException + { + VTable vTable = getVTable(); + vTable.loadBlob.invoke(this, status, blobId, att, tra, file, txt); + FbException.checkException(status); + } + + public void dumpBlob(IStatus status, com.sun.jna.ptr.LongByReference blobId, IAttachment att, ITransaction tra, String file, boolean txt) throws FbException + { + VTable vTable = getVTable(); + vTable.dumpBlob.invoke(this, status, blobId, att, tra, file, txt); + FbException.checkException(status); + } + + public void getPerfCounters(IStatus status, IAttachment att, String countersSet, long[] counters) throws FbException + { + VTable vTable = getVTable(); + vTable.getPerfCounters.invoke(this, status, att, countersSet, counters); + FbException.checkException(status); + } + + public IAttachment executeCreateDatabase(IStatus status, int stmtLength, String creatDBstatement, int dialect, boolean[] stmtIsCreateDb) throws FbException + { + VTable vTable = getVTable(); + IAttachment result = vTable.executeCreateDatabase.invoke(this, status, stmtLength, creatDBstatement, dialect, stmtIsCreateDb); + FbException.checkException(status); + return result; + } + + public void decodeDate(ISC_DATE date, com.sun.jna.Pointer year, com.sun.jna.Pointer month, com.sun.jna.Pointer day) + { + VTable vTable = getVTable(); + vTable.decodeDate.invoke(this, date, year, month, day); + } + + public void decodeTime(ISC_TIME time, com.sun.jna.Pointer hours, com.sun.jna.Pointer minutes, com.sun.jna.Pointer seconds, com.sun.jna.Pointer fractions) + { + VTable vTable = getVTable(); + vTable.decodeTime.invoke(this, time, hours, minutes, seconds, fractions); + } + + public ISC_DATE encodeDate(int year, int month, int day) + { + VTable vTable = getVTable(); + ISC_DATE result = vTable.encodeDate.invoke(this, year, month, day); + return result; + } + + public ISC_TIME encodeTime(int hours, int minutes, int seconds, int fractions) + { + VTable vTable = getVTable(); + ISC_TIME result = vTable.encodeTime.invoke(this, hours, minutes, seconds, fractions); + return result; + } + + public int formatStatus(com.sun.jna.Pointer buffer, int bufferSize, IStatus status) + { + VTable vTable = getVTable(); + int result = vTable.formatStatus.invoke(this, buffer, bufferSize, status); + return result; + } + + public int getClientVersion() + { + VTable vTable = getVTable(); + int result = vTable.getClientVersion.invoke(this); + return result; + } + + public IXpbBuilder getXpbBuilder(IStatus status, int kind, byte[] buf, int len) throws FbException + { + VTable vTable = getVTable(); + IXpbBuilder result = vTable.getXpbBuilder.invoke(this, status, kind, buf, len); + FbException.checkException(status); + return result; + } + + public int setOffsets(IStatus status, IMessageMetadata metadata, IOffsetsCallback callback) throws FbException + { + VTable vTable = getVTable(); + int result = vTable.setOffsets.invoke(this, status, metadata, callback); + FbException.checkException(status); + return result; + } + + public IEventBlock createEventBlock(IStatus status, String[] events) throws FbException + { + VTable vTable = getVTable(); + IEventBlock result = vTable.createEventBlock.invoke(this, status, events); + FbException.checkException(status); + return result; + } + + public IDecFloat16 getDecFloat16(IStatus status) throws FbException + { + VTable vTable = getVTable(); + IDecFloat16 result = vTable.getDecFloat16.invoke(this, status); + FbException.checkException(status); + return result; + } + + public IDecFloat34 getDecFloat34(IStatus status) throws FbException + { + VTable vTable = getVTable(); + IDecFloat34 result = vTable.getDecFloat34.invoke(this, status); + FbException.checkException(status); + return result; + } + + public ITransaction getTransactionByHandle(IStatus status, com.sun.jna.ptr.LongByReference hndlPtr) throws FbException + { + VTable vTable = getVTable(); + ITransaction result = vTable.getTransactionByHandle.invoke(this, status, hndlPtr); + FbException.checkException(status); + return result; + } + + public IStatement getStatementByHandle(IStatus status, com.sun.jna.ptr.LongByReference hndlPtr) throws FbException + { + VTable vTable = getVTable(); + IStatement result = vTable.getStatementByHandle.invoke(this, status, hndlPtr); + FbException.checkException(status); + return result; + } + } + + public static class IOffsetsCallback extends IVersioned implements IOffsetsCallbackIntf + { + public static class VTable extends IVersioned.VTable + { + public static interface Callback_setOffset extends com.sun.jna.Callback + { + public void invoke(IOffsetsCallback self, IStatus status, int index, int offset, int nullOffset); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IOffsetsCallbackIntf obj) + { + super(obj); + + setOffset = new Callback_setOffset() { + @Override + public void invoke(IOffsetsCallback self, IStatus status, int index, int offset, int nullOffset) + { + try + { + obj.setOffset(status, index, offset, nullOffset); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + } + + public VTable() + { + } + + public Callback_setOffset setOffset; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("setOffset")); + return fields; + } + } + + public IOffsetsCallback() + { + } + + public IOffsetsCallback(final IOffsetsCallbackIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public void setOffset(IStatus status, int index, int offset, int nullOffset) throws FbException + { + VTable vTable = getVTable(); + vTable.setOffset.invoke(this, status, index, offset, nullOffset); + FbException.checkException(status); + } + } + + public static class IXpbBuilder extends IDisposable implements IXpbBuilderIntf + { + public static class VTable extends IDisposable.VTable + { + public static interface Callback_clear extends com.sun.jna.Callback + { + public void invoke(IXpbBuilder self, IStatus status); + } + + public static interface Callback_removeCurrent extends com.sun.jna.Callback + { + public void invoke(IXpbBuilder self, IStatus status); + } + + public static interface Callback_insertInt extends com.sun.jna.Callback + { + public void invoke(IXpbBuilder self, IStatus status, byte tag, int value); + } + + public static interface Callback_insertBigInt extends com.sun.jna.Callback + { + public void invoke(IXpbBuilder self, IStatus status, byte tag, long value); + } + + public static interface Callback_insertBytes extends com.sun.jna.Callback + { + public void invoke(IXpbBuilder self, IStatus status, byte tag, com.sun.jna.Pointer bytes, int length); + } + + public static interface Callback_insertString extends com.sun.jna.Callback + { + public void invoke(IXpbBuilder self, IStatus status, byte tag, String str); + } + + public static interface Callback_insertTag extends com.sun.jna.Callback + { + public void invoke(IXpbBuilder self, IStatus status, byte tag); + } + + public static interface Callback_isEof extends com.sun.jna.Callback + { + public boolean invoke(IXpbBuilder self, IStatus status); + } + + public static interface Callback_moveNext extends com.sun.jna.Callback + { + public void invoke(IXpbBuilder self, IStatus status); + } + + public static interface Callback_rewind extends com.sun.jna.Callback + { + public void invoke(IXpbBuilder self, IStatus status); + } + + public static interface Callback_findFirst extends com.sun.jna.Callback + { + public boolean invoke(IXpbBuilder self, IStatus status, byte tag); + } + + public static interface Callback_findNext extends com.sun.jna.Callback + { + public boolean invoke(IXpbBuilder self, IStatus status); + } + + public static interface Callback_getTag extends com.sun.jna.Callback + { + public byte invoke(IXpbBuilder self, IStatus status); + } + + public static interface Callback_getLength extends com.sun.jna.Callback + { + public int invoke(IXpbBuilder self, IStatus status); + } + + public static interface Callback_getInt extends com.sun.jna.Callback + { + public int invoke(IXpbBuilder self, IStatus status); + } + + public static interface Callback_getBigInt extends com.sun.jna.Callback + { + public long invoke(IXpbBuilder self, IStatus status); + } + + public static interface Callback_getString extends com.sun.jna.Callback + { + public String invoke(IXpbBuilder self, IStatus status); + } + + public static interface Callback_getBytes extends com.sun.jna.Callback + { + public com.sun.jna.Pointer invoke(IXpbBuilder self, IStatus status); + } + + public static interface Callback_getBufferLength extends com.sun.jna.Callback + { + public int invoke(IXpbBuilder self, IStatus status); + } + + public static interface Callback_getBuffer extends com.sun.jna.Callback + { + public com.sun.jna.Pointer invoke(IXpbBuilder self, IStatus status); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IXpbBuilderIntf obj) + { + super(obj); + + clear = new Callback_clear() { + @Override + public void invoke(IXpbBuilder self, IStatus status) + { + try + { + obj.clear(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + removeCurrent = new Callback_removeCurrent() { + @Override + public void invoke(IXpbBuilder self, IStatus status) + { + try + { + obj.removeCurrent(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + insertInt = new Callback_insertInt() { + @Override + public void invoke(IXpbBuilder self, IStatus status, byte tag, int value) + { + try + { + obj.insertInt(status, tag, value); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + insertBigInt = new Callback_insertBigInt() { + @Override + public void invoke(IXpbBuilder self, IStatus status, byte tag, long value) + { + try + { + obj.insertBigInt(status, tag, value); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + insertBytes = new Callback_insertBytes() { + @Override + public void invoke(IXpbBuilder self, IStatus status, byte tag, com.sun.jna.Pointer bytes, int length) + { + try + { + obj.insertBytes(status, tag, bytes, length); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + insertString = new Callback_insertString() { + @Override + public void invoke(IXpbBuilder self, IStatus status, byte tag, String str) + { + try + { + obj.insertString(status, tag, str); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + insertTag = new Callback_insertTag() { + @Override + public void invoke(IXpbBuilder self, IStatus status, byte tag) + { + try + { + obj.insertTag(status, tag); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + isEof = new Callback_isEof() { + @Override + public boolean invoke(IXpbBuilder self, IStatus status) + { + try + { + return obj.isEof(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return false; + } + } + }; + + moveNext = new Callback_moveNext() { + @Override + public void invoke(IXpbBuilder self, IStatus status) + { + try + { + obj.moveNext(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + rewind = new Callback_rewind() { + @Override + public void invoke(IXpbBuilder self, IStatus status) + { + try + { + obj.rewind(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + findFirst = new Callback_findFirst() { + @Override + public boolean invoke(IXpbBuilder self, IStatus status, byte tag) + { + try + { + return obj.findFirst(status, tag); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return false; + } + } + }; + + findNext = new Callback_findNext() { + @Override + public boolean invoke(IXpbBuilder self, IStatus status) + { + try + { + return obj.findNext(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return false; + } + } + }; + + getTag = new Callback_getTag() { + @Override + public byte invoke(IXpbBuilder self, IStatus status) + { + try + { + return obj.getTag(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return (byte) 0; + } + } + }; + + getLength = new Callback_getLength() { + @Override + public int invoke(IXpbBuilder self, IStatus status) + { + try + { + return obj.getLength(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return 0; + } + } + }; + + getInt = new Callback_getInt() { + @Override + public int invoke(IXpbBuilder self, IStatus status) + { + try + { + return obj.getInt(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return 0; + } + } + }; + + getBigInt = new Callback_getBigInt() { + @Override + public long invoke(IXpbBuilder self, IStatus status) + { + try + { + return obj.getBigInt(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return 0; + } + } + }; + + getString = new Callback_getString() { + @Override + public String invoke(IXpbBuilder self, IStatus status) + { + try + { + return obj.getString(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + + getBytes = new Callback_getBytes() { + @Override + public com.sun.jna.Pointer invoke(IXpbBuilder self, IStatus status) + { + try + { + return obj.getBytes(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + + getBufferLength = new Callback_getBufferLength() { + @Override + public int invoke(IXpbBuilder self, IStatus status) + { + try + { + return obj.getBufferLength(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return 0; + } + } + }; + + getBuffer = new Callback_getBuffer() { + @Override + public com.sun.jna.Pointer invoke(IXpbBuilder self, IStatus status) + { + try + { + return obj.getBuffer(status); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + } + + public VTable() + { + } + + public Callback_clear clear; + public Callback_removeCurrent removeCurrent; + public Callback_insertInt insertInt; + public Callback_insertBigInt insertBigInt; + public Callback_insertBytes insertBytes; + public Callback_insertString insertString; + public Callback_insertTag insertTag; + public Callback_isEof isEof; + public Callback_moveNext moveNext; + public Callback_rewind rewind; + public Callback_findFirst findFirst; + public Callback_findNext findNext; + public Callback_getTag getTag; + public Callback_getLength getLength; + public Callback_getInt getInt; + public Callback_getBigInt getBigInt; + public Callback_getString getString; + public Callback_getBytes getBytes; + public Callback_getBufferLength getBufferLength; + public Callback_getBuffer getBuffer; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("clear", "removeCurrent", "insertInt", "insertBigInt", "insertBytes", "insertString", "insertTag", "isEof", "moveNext", "rewind", "findFirst", "findNext", "getTag", "getLength", "getInt", "getBigInt", "getString", "getBytes", "getBufferLength", "getBuffer")); + return fields; + } + } + + public IXpbBuilder() + { + } + + public IXpbBuilder(final IXpbBuilderIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public void clear(IStatus status) throws FbException + { + VTable vTable = getVTable(); + vTable.clear.invoke(this, status); + FbException.checkException(status); + } + + public void removeCurrent(IStatus status) throws FbException + { + VTable vTable = getVTable(); + vTable.removeCurrent.invoke(this, status); + FbException.checkException(status); + } + + public void insertInt(IStatus status, byte tag, int value) throws FbException + { + VTable vTable = getVTable(); + vTable.insertInt.invoke(this, status, tag, value); + FbException.checkException(status); + } + + public void insertBigInt(IStatus status, byte tag, long value) throws FbException + { + VTable vTable = getVTable(); + vTable.insertBigInt.invoke(this, status, tag, value); + FbException.checkException(status); + } + + public void insertBytes(IStatus status, byte tag, com.sun.jna.Pointer bytes, int length) throws FbException + { + VTable vTable = getVTable(); + vTable.insertBytes.invoke(this, status, tag, bytes, length); + FbException.checkException(status); + } + + public void insertString(IStatus status, byte tag, String str) throws FbException + { + VTable vTable = getVTable(); + vTable.insertString.invoke(this, status, tag, str); + FbException.checkException(status); + } + + public void insertTag(IStatus status, byte tag) throws FbException + { + VTable vTable = getVTable(); + vTable.insertTag.invoke(this, status, tag); + FbException.checkException(status); + } + + public boolean isEof(IStatus status) throws FbException + { + VTable vTable = getVTable(); + boolean result = vTable.isEof.invoke(this, status); + FbException.checkException(status); + return result; + } + + public void moveNext(IStatus status) throws FbException + { + VTable vTable = getVTable(); + vTable.moveNext.invoke(this, status); + FbException.checkException(status); + } + + public void rewind(IStatus status) throws FbException + { + VTable vTable = getVTable(); + vTable.rewind.invoke(this, status); + FbException.checkException(status); + } + + public boolean findFirst(IStatus status, byte tag) throws FbException + { + VTable vTable = getVTable(); + boolean result = vTable.findFirst.invoke(this, status, tag); + FbException.checkException(status); + return result; + } + + public boolean findNext(IStatus status) throws FbException + { + VTable vTable = getVTable(); + boolean result = vTable.findNext.invoke(this, status); + FbException.checkException(status); + return result; + } + + public byte getTag(IStatus status) throws FbException + { + VTable vTable = getVTable(); + byte result = vTable.getTag.invoke(this, status); + FbException.checkException(status); + return result; + } + + public int getLength(IStatus status) throws FbException + { + VTable vTable = getVTable(); + int result = vTable.getLength.invoke(this, status); + FbException.checkException(status); + return result; + } + + public int getInt(IStatus status) throws FbException + { + VTable vTable = getVTable(); + int result = vTable.getInt.invoke(this, status); + FbException.checkException(status); + return result; + } + + public long getBigInt(IStatus status) throws FbException + { + VTable vTable = getVTable(); + long result = vTable.getBigInt.invoke(this, status); + FbException.checkException(status); + return result; + } + + public String getString(IStatus status) throws FbException + { + VTable vTable = getVTable(); + String result = vTable.getString.invoke(this, status); + FbException.checkException(status); + return result; + } + + public com.sun.jna.Pointer getBytes(IStatus status) throws FbException + { + VTable vTable = getVTable(); + com.sun.jna.Pointer result = vTable.getBytes.invoke(this, status); + FbException.checkException(status); + return result; + } + + public int getBufferLength(IStatus status) throws FbException + { + VTable vTable = getVTable(); + int result = vTable.getBufferLength.invoke(this, status); + FbException.checkException(status); + return result; + } + + public com.sun.jna.Pointer getBuffer(IStatus status) throws FbException + { + VTable vTable = getVTable(); + com.sun.jna.Pointer result = vTable.getBuffer.invoke(this, status); + FbException.checkException(status); + return result; + } + } + + public static class ITraceConnection extends IVersioned implements ITraceConnectionIntf + { + public static class VTable extends IVersioned.VTable + { + public static interface Callback_getKind extends com.sun.jna.Callback + { + public int invoke(ITraceConnection self); + } + + public static interface Callback_getProcessID extends com.sun.jna.Callback + { + public int invoke(ITraceConnection self); + } + + public static interface Callback_getUserName extends com.sun.jna.Callback + { + public String invoke(ITraceConnection self); + } + + public static interface Callback_getRoleName extends com.sun.jna.Callback + { + public String invoke(ITraceConnection self); + } + + public static interface Callback_getCharSet extends com.sun.jna.Callback + { + public String invoke(ITraceConnection self); + } + + public static interface Callback_getRemoteProtocol extends com.sun.jna.Callback + { + public String invoke(ITraceConnection self); + } + + public static interface Callback_getRemoteAddress extends com.sun.jna.Callback + { + public String invoke(ITraceConnection self); + } + + public static interface Callback_getRemoteHwAddress extends com.sun.jna.Callback + { + public String invoke(ITraceConnection self); + } + + public static interface Callback_getRemoteProcessID extends com.sun.jna.Callback + { + public int invoke(ITraceConnection self); + } + + public static interface Callback_getRemoteProcessName extends com.sun.jna.Callback + { + public String invoke(ITraceConnection self); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final ITraceConnectionIntf obj) + { + super(obj); + + getKind = new Callback_getKind() { + @Override + public int invoke(ITraceConnection self) + { + return obj.getKind(); + } + }; + + getProcessID = new Callback_getProcessID() { + @Override + public int invoke(ITraceConnection self) + { + return obj.getProcessID(); + } + }; + + getUserName = new Callback_getUserName() { + @Override + public String invoke(ITraceConnection self) + { + return obj.getUserName(); + } + }; + + getRoleName = new Callback_getRoleName() { + @Override + public String invoke(ITraceConnection self) + { + return obj.getRoleName(); + } + }; + + getCharSet = new Callback_getCharSet() { + @Override + public String invoke(ITraceConnection self) + { + return obj.getCharSet(); + } + }; + + getRemoteProtocol = new Callback_getRemoteProtocol() { + @Override + public String invoke(ITraceConnection self) + { + return obj.getRemoteProtocol(); + } + }; + + getRemoteAddress = new Callback_getRemoteAddress() { + @Override + public String invoke(ITraceConnection self) + { + return obj.getRemoteAddress(); + } + }; + + getRemoteHwAddress = new Callback_getRemoteHwAddress() { + @Override + public String invoke(ITraceConnection self) + { + return obj.getRemoteHwAddress(); + } + }; + + getRemoteProcessID = new Callback_getRemoteProcessID() { + @Override + public int invoke(ITraceConnection self) + { + return obj.getRemoteProcessID(); + } + }; + + getRemoteProcessName = new Callback_getRemoteProcessName() { + @Override + public String invoke(ITraceConnection self) + { + return obj.getRemoteProcessName(); + } + }; + } + + public VTable() + { + } + + public Callback_getKind getKind; + public Callback_getProcessID getProcessID; + public Callback_getUserName getUserName; + public Callback_getRoleName getRoleName; + public Callback_getCharSet getCharSet; + public Callback_getRemoteProtocol getRemoteProtocol; + public Callback_getRemoteAddress getRemoteAddress; + public Callback_getRemoteHwAddress getRemoteHwAddress; + public Callback_getRemoteProcessID getRemoteProcessID; + public Callback_getRemoteProcessName getRemoteProcessName; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("getKind", "getProcessID", "getUserName", "getRoleName", "getCharSet", "getRemoteProtocol", "getRemoteAddress", "getRemoteHwAddress", "getRemoteProcessID", "getRemoteProcessName")); + return fields; + } + } + + public ITraceConnection() + { + } + + public ITraceConnection(final ITraceConnectionIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public int getKind() + { + VTable vTable = getVTable(); + int result = vTable.getKind.invoke(this); + return result; + } + + public int getProcessID() + { + VTable vTable = getVTable(); + int result = vTable.getProcessID.invoke(this); + return result; + } + + public String getUserName() + { + VTable vTable = getVTable(); + String result = vTable.getUserName.invoke(this); + return result; + } + + public String getRoleName() + { + VTable vTable = getVTable(); + String result = vTable.getRoleName.invoke(this); + return result; + } + + public String getCharSet() + { + VTable vTable = getVTable(); + String result = vTable.getCharSet.invoke(this); + return result; + } + + public String getRemoteProtocol() + { + VTable vTable = getVTable(); + String result = vTable.getRemoteProtocol.invoke(this); + return result; + } + + public String getRemoteAddress() + { + VTable vTable = getVTable(); + String result = vTable.getRemoteAddress.invoke(this); + return result; + } + + public String getRemoteHwAddress() + { + VTable vTable = getVTable(); + String result = vTable.getRemoteHwAddress.invoke(this); + return result; + } + + public int getRemoteProcessID() + { + VTable vTable = getVTable(); + int result = vTable.getRemoteProcessID.invoke(this); + return result; + } + + public String getRemoteProcessName() + { + VTable vTable = getVTable(); + String result = vTable.getRemoteProcessName.invoke(this); + return result; + } + } + + public static class ITraceDatabaseConnection extends ITraceConnection implements ITraceDatabaseConnectionIntf + { + public static class VTable extends ITraceConnection.VTable + { + public static interface Callback_getConnectionID extends com.sun.jna.Callback + { + public long invoke(ITraceDatabaseConnection self); + } + + public static interface Callback_getDatabaseName extends com.sun.jna.Callback + { + public String invoke(ITraceDatabaseConnection self); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final ITraceDatabaseConnectionIntf obj) + { + super(obj); + + getConnectionID = new Callback_getConnectionID() { + @Override + public long invoke(ITraceDatabaseConnection self) + { + return obj.getConnectionID(); + } + }; + + getDatabaseName = new Callback_getDatabaseName() { + @Override + public String invoke(ITraceDatabaseConnection self) + { + return obj.getDatabaseName(); + } + }; + } + + public VTable() + { + } + + public Callback_getConnectionID getConnectionID; + public Callback_getDatabaseName getDatabaseName; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("getConnectionID", "getDatabaseName")); + return fields; + } + } + + public ITraceDatabaseConnection() + { + } + + public ITraceDatabaseConnection(final ITraceDatabaseConnectionIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public long getConnectionID() + { + VTable vTable = getVTable(); + long result = vTable.getConnectionID.invoke(this); + return result; + } + + public String getDatabaseName() + { + VTable vTable = getVTable(); + String result = vTable.getDatabaseName.invoke(this); + return result; + } + } + + public static class ITraceTransaction extends IVersioned implements ITraceTransactionIntf + { + public static class VTable extends IVersioned.VTable + { + public static interface Callback_getTransactionID extends com.sun.jna.Callback + { + public long invoke(ITraceTransaction self); + } + + public static interface Callback_getReadOnly extends com.sun.jna.Callback + { + public boolean invoke(ITraceTransaction self); + } + + public static interface Callback_getWait extends com.sun.jna.Callback + { + public int invoke(ITraceTransaction self); + } + + public static interface Callback_getIsolation extends com.sun.jna.Callback + { + public int invoke(ITraceTransaction self); + } + + public static interface Callback_getPerf extends com.sun.jna.Callback + { + public com.sun.jna.Pointer invoke(ITraceTransaction self); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final ITraceTransactionIntf obj) + { + super(obj); + + getTransactionID = new Callback_getTransactionID() { + @Override + public long invoke(ITraceTransaction self) + { + return obj.getTransactionID(); + } + }; + + getReadOnly = new Callback_getReadOnly() { + @Override + public boolean invoke(ITraceTransaction self) + { + return obj.getReadOnly(); + } + }; + + getWait = new Callback_getWait() { + @Override + public int invoke(ITraceTransaction self) + { + return obj.getWait(); + } + }; + + getIsolation = new Callback_getIsolation() { + @Override + public int invoke(ITraceTransaction self) + { + return obj.getIsolation(); + } + }; + + getPerf = new Callback_getPerf() { + @Override + public com.sun.jna.Pointer invoke(ITraceTransaction self) + { + return obj.getPerf(); + } + }; + } + + public VTable() + { + } + + public Callback_getTransactionID getTransactionID; + public Callback_getReadOnly getReadOnly; + public Callback_getWait getWait; + public Callback_getIsolation getIsolation; + public Callback_getPerf getPerf; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("getTransactionID", "getReadOnly", "getWait", "getIsolation", "getPerf")); + return fields; + } + } + + public ITraceTransaction() + { + } + + public ITraceTransaction(final ITraceTransactionIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public long getTransactionID() + { + VTable vTable = getVTable(); + long result = vTable.getTransactionID.invoke(this); + return result; + } + + public boolean getReadOnly() + { + VTable vTable = getVTable(); + boolean result = vTable.getReadOnly.invoke(this); + return result; + } + + public int getWait() + { + VTable vTable = getVTable(); + int result = vTable.getWait.invoke(this); + return result; + } + + public int getIsolation() + { + VTable vTable = getVTable(); + int result = vTable.getIsolation.invoke(this); + return result; + } + + public com.sun.jna.Pointer getPerf() + { + VTable vTable = getVTable(); + com.sun.jna.Pointer result = vTable.getPerf.invoke(this); + return result; + } + } + + public static class ITraceParams extends IVersioned implements ITraceParamsIntf + { + public static class VTable extends IVersioned.VTable + { + public static interface Callback_getCount extends com.sun.jna.Callback + { + public int invoke(ITraceParams self); + } + + public static interface Callback_getParam extends com.sun.jna.Callback + { + public com.sun.jna.Pointer invoke(ITraceParams self, int idx); + } + + public static interface Callback_getTextUTF8 extends com.sun.jna.Callback + { + public String invoke(ITraceParams self, IStatus status, int idx); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final ITraceParamsIntf obj) + { + super(obj); + + getCount = new Callback_getCount() { + @Override + public int invoke(ITraceParams self) + { + return obj.getCount(); + } + }; + + getParam = new Callback_getParam() { + @Override + public com.sun.jna.Pointer invoke(ITraceParams self, int idx) + { + return obj.getParam(idx); + } + }; + + getTextUTF8 = new Callback_getTextUTF8() { + @Override + public String invoke(ITraceParams self, IStatus status, int idx) + { + try + { + return obj.getTextUTF8(status, idx); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + } + + public VTable() + { + } + + public Callback_getCount getCount; + public Callback_getParam getParam; + public Callback_getTextUTF8 getTextUTF8; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("getCount", "getParam", "getTextUTF8")); + return fields; + } + } + + public ITraceParams() + { + } + + public ITraceParams(final ITraceParamsIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public int getCount() + { + VTable vTable = getVTable(); + int result = vTable.getCount.invoke(this); + return result; + } + + public com.sun.jna.Pointer getParam(int idx) + { + VTable vTable = getVTable(); + com.sun.jna.Pointer result = vTable.getParam.invoke(this, idx); + return result; + } + + public String getTextUTF8(IStatus status, int idx) throws FbException + { + VTable vTable = getVTable(); + String result = vTable.getTextUTF8.invoke(this, status, idx); + FbException.checkException(status); + return result; + } + } + + public static class ITraceStatement extends IVersioned implements ITraceStatementIntf + { + public static class VTable extends IVersioned.VTable + { + public static interface Callback_getStmtID extends com.sun.jna.Callback + { + public long invoke(ITraceStatement self); + } + + public static interface Callback_getPerf extends com.sun.jna.Callback + { + public com.sun.jna.Pointer invoke(ITraceStatement self); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final ITraceStatementIntf obj) + { + super(obj); + + getStmtID = new Callback_getStmtID() { + @Override + public long invoke(ITraceStatement self) + { + return obj.getStmtID(); + } + }; + + getPerf = new Callback_getPerf() { + @Override + public com.sun.jna.Pointer invoke(ITraceStatement self) + { + return obj.getPerf(); + } + }; + } + + public VTable() + { + } + + public Callback_getStmtID getStmtID; + public Callback_getPerf getPerf; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("getStmtID", "getPerf")); + return fields; + } + } + + public ITraceStatement() + { + } + + public ITraceStatement(final ITraceStatementIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public long getStmtID() + { + VTable vTable = getVTable(); + long result = vTable.getStmtID.invoke(this); + return result; + } + + public com.sun.jna.Pointer getPerf() + { + VTable vTable = getVTable(); + com.sun.jna.Pointer result = vTable.getPerf.invoke(this); + return result; + } + } + + public static class ITraceSQLStatement extends ITraceStatement implements ITraceSQLStatementIntf + { + public static class VTable extends ITraceStatement.VTable + { + public static interface Callback_getText extends com.sun.jna.Callback + { + public String invoke(ITraceSQLStatement self); + } + + public static interface Callback_getPlan extends com.sun.jna.Callback + { + public String invoke(ITraceSQLStatement self); + } + + public static interface Callback_getInputs extends com.sun.jna.Callback + { + public ITraceParams invoke(ITraceSQLStatement self); + } + + public static interface Callback_getTextUTF8 extends com.sun.jna.Callback + { + public String invoke(ITraceSQLStatement self); + } + + public static interface Callback_getExplainedPlan extends com.sun.jna.Callback + { + public String invoke(ITraceSQLStatement self); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final ITraceSQLStatementIntf obj) + { + super(obj); + + getText = new Callback_getText() { + @Override + public String invoke(ITraceSQLStatement self) + { + return obj.getText(); + } + }; + + getPlan = new Callback_getPlan() { + @Override + public String invoke(ITraceSQLStatement self) + { + return obj.getPlan(); + } + }; + + getInputs = new Callback_getInputs() { + @Override + public ITraceParams invoke(ITraceSQLStatement self) + { + return obj.getInputs(); + } + }; + + getTextUTF8 = new Callback_getTextUTF8() { + @Override + public String invoke(ITraceSQLStatement self) + { + return obj.getTextUTF8(); + } + }; + + getExplainedPlan = new Callback_getExplainedPlan() { + @Override + public String invoke(ITraceSQLStatement self) + { + return obj.getExplainedPlan(); + } + }; + } + + public VTable() + { + } + + public Callback_getText getText; + public Callback_getPlan getPlan; + public Callback_getInputs getInputs; + public Callback_getTextUTF8 getTextUTF8; + public Callback_getExplainedPlan getExplainedPlan; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("getText", "getPlan", "getInputs", "getTextUTF8", "getExplainedPlan")); + return fields; + } + } + + public ITraceSQLStatement() + { + } + + public ITraceSQLStatement(final ITraceSQLStatementIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public String getText() + { + VTable vTable = getVTable(); + String result = vTable.getText.invoke(this); + return result; + } + + public String getPlan() + { + VTable vTable = getVTable(); + String result = vTable.getPlan.invoke(this); + return result; + } + + public ITraceParams getInputs() + { + VTable vTable = getVTable(); + ITraceParams result = vTable.getInputs.invoke(this); + return result; + } + + public String getTextUTF8() + { + VTable vTable = getVTable(); + String result = vTable.getTextUTF8.invoke(this); + return result; + } + + public String getExplainedPlan() + { + VTable vTable = getVTable(); + String result = vTable.getExplainedPlan.invoke(this); + return result; + } + } + + public static class ITraceBLRStatement extends ITraceStatement implements ITraceBLRStatementIntf + { + public static class VTable extends ITraceStatement.VTable + { + public static interface Callback_getData extends com.sun.jna.Callback + { + public com.sun.jna.Pointer invoke(ITraceBLRStatement self); + } + + public static interface Callback_getDataLength extends com.sun.jna.Callback + { + public int invoke(ITraceBLRStatement self); + } + + public static interface Callback_getText extends com.sun.jna.Callback + { + public String invoke(ITraceBLRStatement self); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final ITraceBLRStatementIntf obj) + { + super(obj); + + getData = new Callback_getData() { + @Override + public com.sun.jna.Pointer invoke(ITraceBLRStatement self) + { + return obj.getData(); + } + }; + + getDataLength = new Callback_getDataLength() { + @Override + public int invoke(ITraceBLRStatement self) + { + return obj.getDataLength(); + } + }; + + getText = new Callback_getText() { + @Override + public String invoke(ITraceBLRStatement self) + { + return obj.getText(); + } + }; + } + + public VTable() + { + } + + public Callback_getData getData; + public Callback_getDataLength getDataLength; + public Callback_getText getText; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("getData", "getDataLength", "getText")); + return fields; + } + } + + public ITraceBLRStatement() + { + } + + public ITraceBLRStatement(final ITraceBLRStatementIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public com.sun.jna.Pointer getData() + { + VTable vTable = getVTable(); + com.sun.jna.Pointer result = vTable.getData.invoke(this); + return result; + } + + public int getDataLength() + { + VTable vTable = getVTable(); + int result = vTable.getDataLength.invoke(this); + return result; + } + + public String getText() + { + VTable vTable = getVTable(); + String result = vTable.getText.invoke(this); + return result; + } + } + + public static class ITraceDYNRequest extends IVersioned implements ITraceDYNRequestIntf + { + public static class VTable extends IVersioned.VTable + { + public static interface Callback_getData extends com.sun.jna.Callback + { + public com.sun.jna.Pointer invoke(ITraceDYNRequest self); + } + + public static interface Callback_getDataLength extends com.sun.jna.Callback + { + public int invoke(ITraceDYNRequest self); + } + + public static interface Callback_getText extends com.sun.jna.Callback + { + public String invoke(ITraceDYNRequest self); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final ITraceDYNRequestIntf obj) + { + super(obj); + + getData = new Callback_getData() { + @Override + public com.sun.jna.Pointer invoke(ITraceDYNRequest self) + { + return obj.getData(); + } + }; + + getDataLength = new Callback_getDataLength() { + @Override + public int invoke(ITraceDYNRequest self) + { + return obj.getDataLength(); + } + }; + + getText = new Callback_getText() { + @Override + public String invoke(ITraceDYNRequest self) + { + return obj.getText(); + } + }; + } + + public VTable() + { + } + + public Callback_getData getData; + public Callback_getDataLength getDataLength; + public Callback_getText getText; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("getData", "getDataLength", "getText")); + return fields; + } + } + + public ITraceDYNRequest() + { + } + + public ITraceDYNRequest(final ITraceDYNRequestIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public com.sun.jna.Pointer getData() + { + VTable vTable = getVTable(); + com.sun.jna.Pointer result = vTable.getData.invoke(this); + return result; + } + + public int getDataLength() + { + VTable vTable = getVTable(); + int result = vTable.getDataLength.invoke(this); + return result; + } + + public String getText() + { + VTable vTable = getVTable(); + String result = vTable.getText.invoke(this); + return result; + } + } + + public static class ITraceContextVariable extends IVersioned implements ITraceContextVariableIntf + { + public static class VTable extends IVersioned.VTable + { + public static interface Callback_getNameSpace extends com.sun.jna.Callback + { + public String invoke(ITraceContextVariable self); + } + + public static interface Callback_getVarName extends com.sun.jna.Callback + { + public String invoke(ITraceContextVariable self); + } + + public static interface Callback_getVarValue extends com.sun.jna.Callback + { + public String invoke(ITraceContextVariable self); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final ITraceContextVariableIntf obj) + { + super(obj); + + getNameSpace = new Callback_getNameSpace() { + @Override + public String invoke(ITraceContextVariable self) + { + return obj.getNameSpace(); + } + }; + + getVarName = new Callback_getVarName() { + @Override + public String invoke(ITraceContextVariable self) + { + return obj.getVarName(); + } + }; + + getVarValue = new Callback_getVarValue() { + @Override + public String invoke(ITraceContextVariable self) + { + return obj.getVarValue(); + } + }; + } + + public VTable() + { + } + + public Callback_getNameSpace getNameSpace; + public Callback_getVarName getVarName; + public Callback_getVarValue getVarValue; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("getNameSpace", "getVarName", "getVarValue")); + return fields; + } + } + + public ITraceContextVariable() + { + } + + public ITraceContextVariable(final ITraceContextVariableIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public String getNameSpace() + { + VTable vTable = getVTable(); + String result = vTable.getNameSpace.invoke(this); + return result; + } + + public String getVarName() + { + VTable vTable = getVTable(); + String result = vTable.getVarName.invoke(this); + return result; + } + + public String getVarValue() + { + VTable vTable = getVTable(); + String result = vTable.getVarValue.invoke(this); + return result; + } + } + + public static class ITraceProcedure extends IVersioned implements ITraceProcedureIntf + { + public static class VTable extends IVersioned.VTable + { + public static interface Callback_getProcName extends com.sun.jna.Callback + { + public String invoke(ITraceProcedure self); + } + + public static interface Callback_getInputs extends com.sun.jna.Callback + { + public ITraceParams invoke(ITraceProcedure self); + } + + public static interface Callback_getPerf extends com.sun.jna.Callback + { + public com.sun.jna.Pointer invoke(ITraceProcedure self); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final ITraceProcedureIntf obj) + { + super(obj); + + getProcName = new Callback_getProcName() { + @Override + public String invoke(ITraceProcedure self) + { + return obj.getProcName(); + } + }; + + getInputs = new Callback_getInputs() { + @Override + public ITraceParams invoke(ITraceProcedure self) + { + return obj.getInputs(); + } + }; + + getPerf = new Callback_getPerf() { + @Override + public com.sun.jna.Pointer invoke(ITraceProcedure self) + { + return obj.getPerf(); + } + }; + } + + public VTable() + { + } + + public Callback_getProcName getProcName; + public Callback_getInputs getInputs; + public Callback_getPerf getPerf; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("getProcName", "getInputs", "getPerf")); + return fields; + } + } + + public ITraceProcedure() + { + } + + public ITraceProcedure(final ITraceProcedureIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public String getProcName() + { + VTable vTable = getVTable(); + String result = vTable.getProcName.invoke(this); + return result; + } + + public ITraceParams getInputs() + { + VTable vTable = getVTable(); + ITraceParams result = vTable.getInputs.invoke(this); + return result; + } + + public com.sun.jna.Pointer getPerf() + { + VTable vTable = getVTable(); + com.sun.jna.Pointer result = vTable.getPerf.invoke(this); + return result; + } + } + + public static class ITraceFunction extends IVersioned implements ITraceFunctionIntf + { + public static class VTable extends IVersioned.VTable + { + public static interface Callback_getFuncName extends com.sun.jna.Callback + { + public String invoke(ITraceFunction self); + } + + public static interface Callback_getInputs extends com.sun.jna.Callback + { + public ITraceParams invoke(ITraceFunction self); + } + + public static interface Callback_getResult extends com.sun.jna.Callback + { + public ITraceParams invoke(ITraceFunction self); + } + + public static interface Callback_getPerf extends com.sun.jna.Callback + { + public com.sun.jna.Pointer invoke(ITraceFunction self); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final ITraceFunctionIntf obj) + { + super(obj); + + getFuncName = new Callback_getFuncName() { + @Override + public String invoke(ITraceFunction self) + { + return obj.getFuncName(); + } + }; + + getInputs = new Callback_getInputs() { + @Override + public ITraceParams invoke(ITraceFunction self) + { + return obj.getInputs(); + } + }; + + getResult = new Callback_getResult() { + @Override + public ITraceParams invoke(ITraceFunction self) + { + return obj.getResult(); + } + }; + + getPerf = new Callback_getPerf() { + @Override + public com.sun.jna.Pointer invoke(ITraceFunction self) + { + return obj.getPerf(); + } + }; + } + + public VTable() + { + } + + public Callback_getFuncName getFuncName; + public Callback_getInputs getInputs; + public Callback_getResult getResult; + public Callback_getPerf getPerf; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("getFuncName", "getInputs", "getResult", "getPerf")); + return fields; + } + } + + public ITraceFunction() + { + } + + public ITraceFunction(final ITraceFunctionIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public String getFuncName() + { + VTable vTable = getVTable(); + String result = vTable.getFuncName.invoke(this); + return result; + } + + public ITraceParams getInputs() + { + VTable vTable = getVTable(); + ITraceParams result = vTable.getInputs.invoke(this); + return result; + } + + public ITraceParams getResult() + { + VTable vTable = getVTable(); + ITraceParams result = vTable.getResult.invoke(this); + return result; + } + + public com.sun.jna.Pointer getPerf() + { + VTable vTable = getVTable(); + com.sun.jna.Pointer result = vTable.getPerf.invoke(this); + return result; + } + } + + public static class ITraceTrigger extends IVersioned implements ITraceTriggerIntf + { + public static class VTable extends IVersioned.VTable + { + public static interface Callback_getTriggerName extends com.sun.jna.Callback + { + public String invoke(ITraceTrigger self); + } + + public static interface Callback_getRelationName extends com.sun.jna.Callback + { + public String invoke(ITraceTrigger self); + } + + public static interface Callback_getAction extends com.sun.jna.Callback + { + public int invoke(ITraceTrigger self); + } + + public static interface Callback_getWhich extends com.sun.jna.Callback + { + public int invoke(ITraceTrigger self); + } + + public static interface Callback_getPerf extends com.sun.jna.Callback + { + public com.sun.jna.Pointer invoke(ITraceTrigger self); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final ITraceTriggerIntf obj) + { + super(obj); + + getTriggerName = new Callback_getTriggerName() { + @Override + public String invoke(ITraceTrigger self) + { + return obj.getTriggerName(); + } + }; + + getRelationName = new Callback_getRelationName() { + @Override + public String invoke(ITraceTrigger self) + { + return obj.getRelationName(); + } + }; + + getAction = new Callback_getAction() { + @Override + public int invoke(ITraceTrigger self) + { + return obj.getAction(); + } + }; + + getWhich = new Callback_getWhich() { + @Override + public int invoke(ITraceTrigger self) + { + return obj.getWhich(); + } + }; + + getPerf = new Callback_getPerf() { + @Override + public com.sun.jna.Pointer invoke(ITraceTrigger self) + { + return obj.getPerf(); + } + }; + } + + public VTable() + { + } + + public Callback_getTriggerName getTriggerName; + public Callback_getRelationName getRelationName; + public Callback_getAction getAction; + public Callback_getWhich getWhich; + public Callback_getPerf getPerf; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("getTriggerName", "getRelationName", "getAction", "getWhich", "getPerf")); + return fields; + } + } + + public ITraceTrigger() + { + } + + public ITraceTrigger(final ITraceTriggerIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public String getTriggerName() + { + VTable vTable = getVTable(); + String result = vTable.getTriggerName.invoke(this); + return result; + } + + public String getRelationName() + { + VTable vTable = getVTable(); + String result = vTable.getRelationName.invoke(this); + return result; + } + + public int getAction() + { + VTable vTable = getVTable(); + int result = vTable.getAction.invoke(this); + return result; + } + + public int getWhich() + { + VTable vTable = getVTable(); + int result = vTable.getWhich.invoke(this); + return result; + } + + public com.sun.jna.Pointer getPerf() + { + VTable vTable = getVTable(); + com.sun.jna.Pointer result = vTable.getPerf.invoke(this); + return result; + } + } + + public static class ITraceServiceConnection extends ITraceConnection implements ITraceServiceConnectionIntf + { + public static class VTable extends ITraceConnection.VTable + { + public static interface Callback_getServiceID extends com.sun.jna.Callback + { + public com.sun.jna.Pointer invoke(ITraceServiceConnection self); + } + + public static interface Callback_getServiceMgr extends com.sun.jna.Callback + { + public String invoke(ITraceServiceConnection self); + } + + public static interface Callback_getServiceName extends com.sun.jna.Callback + { + public String invoke(ITraceServiceConnection self); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final ITraceServiceConnectionIntf obj) + { + super(obj); + + getServiceID = new Callback_getServiceID() { + @Override + public com.sun.jna.Pointer invoke(ITraceServiceConnection self) + { + return obj.getServiceID(); + } + }; + + getServiceMgr = new Callback_getServiceMgr() { + @Override + public String invoke(ITraceServiceConnection self) + { + return obj.getServiceMgr(); + } + }; + + getServiceName = new Callback_getServiceName() { + @Override + public String invoke(ITraceServiceConnection self) + { + return obj.getServiceName(); + } + }; + } + + public VTable() + { + } + + public Callback_getServiceID getServiceID; + public Callback_getServiceMgr getServiceMgr; + public Callback_getServiceName getServiceName; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("getServiceID", "getServiceMgr", "getServiceName")); + return fields; + } + } + + public ITraceServiceConnection() + { + } + + public ITraceServiceConnection(final ITraceServiceConnectionIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public com.sun.jna.Pointer getServiceID() + { + VTable vTable = getVTable(); + com.sun.jna.Pointer result = vTable.getServiceID.invoke(this); + return result; + } + + public String getServiceMgr() + { + VTable vTable = getVTable(); + String result = vTable.getServiceMgr.invoke(this); + return result; + } + + public String getServiceName() + { + VTable vTable = getVTable(); + String result = vTable.getServiceName.invoke(this); + return result; + } + } + + public static class ITraceStatusVector extends IVersioned implements ITraceStatusVectorIntf + { + public static class VTable extends IVersioned.VTable + { + public static interface Callback_hasError extends com.sun.jna.Callback + { + public boolean invoke(ITraceStatusVector self); + } + + public static interface Callback_hasWarning extends com.sun.jna.Callback + { + public boolean invoke(ITraceStatusVector self); + } + + public static interface Callback_getStatus extends com.sun.jna.Callback + { + public IStatus invoke(ITraceStatusVector self); + } + + public static interface Callback_getText extends com.sun.jna.Callback + { + public String invoke(ITraceStatusVector self); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final ITraceStatusVectorIntf obj) + { + super(obj); + + hasError = new Callback_hasError() { + @Override + public boolean invoke(ITraceStatusVector self) + { + return obj.hasError(); + } + }; + + hasWarning = new Callback_hasWarning() { + @Override + public boolean invoke(ITraceStatusVector self) + { + return obj.hasWarning(); + } + }; + + getStatus = new Callback_getStatus() { + @Override + public IStatus invoke(ITraceStatusVector self) + { + return obj.getStatus(); + } + }; + + getText = new Callback_getText() { + @Override + public String invoke(ITraceStatusVector self) + { + return obj.getText(); + } + }; + } + + public VTable() + { + } + + public Callback_hasError hasError; + public Callback_hasWarning hasWarning; + public Callback_getStatus getStatus; + public Callback_getText getText; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("hasError", "hasWarning", "getStatus", "getText")); + return fields; + } + } + + public ITraceStatusVector() + { + } + + public ITraceStatusVector(final ITraceStatusVectorIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public boolean hasError() + { + VTable vTable = getVTable(); + boolean result = vTable.hasError.invoke(this); + return result; + } + + public boolean hasWarning() + { + VTable vTable = getVTable(); + boolean result = vTable.hasWarning.invoke(this); + return result; + } + + public IStatus getStatus() + { + VTable vTable = getVTable(); + IStatus result = vTable.getStatus.invoke(this); + return result; + } + + public String getText() + { + VTable vTable = getVTable(); + String result = vTable.getText.invoke(this); + return result; + } + } + + public static class ITraceSweepInfo extends IVersioned implements ITraceSweepInfoIntf + { + public static class VTable extends IVersioned.VTable + { + public static interface Callback_getOIT extends com.sun.jna.Callback + { + public long invoke(ITraceSweepInfo self); + } + + public static interface Callback_getOST extends com.sun.jna.Callback + { + public long invoke(ITraceSweepInfo self); + } + + public static interface Callback_getOAT extends com.sun.jna.Callback + { + public long invoke(ITraceSweepInfo self); + } + + public static interface Callback_getNext extends com.sun.jna.Callback + { + public long invoke(ITraceSweepInfo self); + } + + public static interface Callback_getPerf extends com.sun.jna.Callback + { + public com.sun.jna.Pointer invoke(ITraceSweepInfo self); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final ITraceSweepInfoIntf obj) + { + super(obj); + + getOIT = new Callback_getOIT() { + @Override + public long invoke(ITraceSweepInfo self) + { + return obj.getOIT(); + } + }; + + getOST = new Callback_getOST() { + @Override + public long invoke(ITraceSweepInfo self) + { + return obj.getOST(); + } + }; + + getOAT = new Callback_getOAT() { + @Override + public long invoke(ITraceSweepInfo self) + { + return obj.getOAT(); + } + }; + + getNext = new Callback_getNext() { + @Override + public long invoke(ITraceSweepInfo self) + { + return obj.getNext(); + } + }; + + getPerf = new Callback_getPerf() { + @Override + public com.sun.jna.Pointer invoke(ITraceSweepInfo self) + { + return obj.getPerf(); + } + }; + } + + public VTable() + { + } + + public Callback_getOIT getOIT; + public Callback_getOST getOST; + public Callback_getOAT getOAT; + public Callback_getNext getNext; + public Callback_getPerf getPerf; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("getOIT", "getOST", "getOAT", "getNext", "getPerf")); + return fields; + } + } + + public ITraceSweepInfo() + { + } + + public ITraceSweepInfo(final ITraceSweepInfoIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public long getOIT() + { + VTable vTable = getVTable(); + long result = vTable.getOIT.invoke(this); + return result; + } + + public long getOST() + { + VTable vTable = getVTable(); + long result = vTable.getOST.invoke(this); + return result; + } + + public long getOAT() + { + VTable vTable = getVTable(); + long result = vTable.getOAT.invoke(this); + return result; + } + + public long getNext() + { + VTable vTable = getVTable(); + long result = vTable.getNext.invoke(this); + return result; + } + + public com.sun.jna.Pointer getPerf() + { + VTable vTable = getVTable(); + com.sun.jna.Pointer result = vTable.getPerf.invoke(this); + return result; + } + } + + public static class ITraceLogWriter extends IReferenceCounted implements ITraceLogWriterIntf + { + public static class VTable extends IReferenceCounted.VTable + { + public static interface Callback_write extends com.sun.jna.Callback + { + public int invoke(ITraceLogWriter self, com.sun.jna.Pointer buf, int size); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final ITraceLogWriterIntf obj) + { + super(obj); + + write = new Callback_write() { + @Override + public int invoke(ITraceLogWriter self, com.sun.jna.Pointer buf, int size) + { + return obj.write(buf, size); + } + }; + } + + public VTable() + { + } + + public Callback_write write; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("write")); + return fields; + } + } + + public ITraceLogWriter() + { + } + + public ITraceLogWriter(final ITraceLogWriterIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public int write(com.sun.jna.Pointer buf, int size) + { + VTable vTable = getVTable(); + int result = vTable.write.invoke(this, buf, size); + return result; + } + } + + public static class ITraceInitInfo extends IVersioned implements ITraceInitInfoIntf + { + public static class VTable extends IVersioned.VTable + { + public static interface Callback_getConfigText extends com.sun.jna.Callback + { + public String invoke(ITraceInitInfo self); + } + + public static interface Callback_getTraceSessionID extends com.sun.jna.Callback + { + public int invoke(ITraceInitInfo self); + } + + public static interface Callback_getTraceSessionName extends com.sun.jna.Callback + { + public String invoke(ITraceInitInfo self); + } + + public static interface Callback_getTraceSessionFlags extends com.sun.jna.Callback + { + public int invoke(ITraceInitInfo self); + } + + public static interface Callback_getFirebirdRootDirectory extends com.sun.jna.Callback + { + public String invoke(ITraceInitInfo self); + } + + public static interface Callback_getDatabaseName extends com.sun.jna.Callback + { + public String invoke(ITraceInitInfo self); + } + + public static interface Callback_getConnection extends com.sun.jna.Callback + { + public ITraceDatabaseConnection invoke(ITraceInitInfo self); + } + + public static interface Callback_getService extends com.sun.jna.Callback + { + public ITraceServiceConnection invoke(ITraceInitInfo self); + } + + public static interface Callback_getLogWriter extends com.sun.jna.Callback + { + public ITraceLogWriter invoke(ITraceInitInfo self); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final ITraceInitInfoIntf obj) + { + super(obj); + + getConfigText = new Callback_getConfigText() { + @Override + public String invoke(ITraceInitInfo self) + { + return obj.getConfigText(); + } + }; + + getTraceSessionID = new Callback_getTraceSessionID() { + @Override + public int invoke(ITraceInitInfo self) + { + return obj.getTraceSessionID(); + } + }; + + getTraceSessionName = new Callback_getTraceSessionName() { + @Override + public String invoke(ITraceInitInfo self) + { + return obj.getTraceSessionName(); + } + }; + + getTraceSessionFlags = new Callback_getTraceSessionFlags() { + @Override + public int invoke(ITraceInitInfo self) + { + return obj.getTraceSessionFlags(); + } + }; + + getFirebirdRootDirectory = new Callback_getFirebirdRootDirectory() { + @Override + public String invoke(ITraceInitInfo self) + { + return obj.getFirebirdRootDirectory(); + } + }; + + getDatabaseName = new Callback_getDatabaseName() { + @Override + public String invoke(ITraceInitInfo self) + { + return obj.getDatabaseName(); + } + }; + + getConnection = new Callback_getConnection() { + @Override + public ITraceDatabaseConnection invoke(ITraceInitInfo self) + { + return obj.getConnection(); + } + }; + + getService = new Callback_getService() { + @Override + public ITraceServiceConnection invoke(ITraceInitInfo self) + { + return obj.getService(); + } + }; + + getLogWriter = new Callback_getLogWriter() { + @Override + public ITraceLogWriter invoke(ITraceInitInfo self) + { + return obj.getLogWriter(); + } + }; + } + + public VTable() + { + } + + public Callback_getConfigText getConfigText; + public Callback_getTraceSessionID getTraceSessionID; + public Callback_getTraceSessionName getTraceSessionName; + public Callback_getTraceSessionFlags getTraceSessionFlags; + public Callback_getFirebirdRootDirectory getFirebirdRootDirectory; + public Callback_getDatabaseName getDatabaseName; + public Callback_getConnection getConnection; + public Callback_getService getService; + public Callback_getLogWriter getLogWriter; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("getConfigText", "getTraceSessionID", "getTraceSessionName", "getTraceSessionFlags", "getFirebirdRootDirectory", "getDatabaseName", "getConnection", "getService", "getLogWriter")); + return fields; + } + } + + public ITraceInitInfo() + { + } + + public ITraceInitInfo(final ITraceInitInfoIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public String getConfigText() + { + VTable vTable = getVTable(); + String result = vTable.getConfigText.invoke(this); + return result; + } + + public int getTraceSessionID() + { + VTable vTable = getVTable(); + int result = vTable.getTraceSessionID.invoke(this); + return result; + } + + public String getTraceSessionName() + { + VTable vTable = getVTable(); + String result = vTable.getTraceSessionName.invoke(this); + return result; + } + + public int getTraceSessionFlags() + { + VTable vTable = getVTable(); + int result = vTable.getTraceSessionFlags.invoke(this); + return result; + } + + public String getFirebirdRootDirectory() + { + VTable vTable = getVTable(); + String result = vTable.getFirebirdRootDirectory.invoke(this); + return result; + } + + public String getDatabaseName() + { + VTable vTable = getVTable(); + String result = vTable.getDatabaseName.invoke(this); + return result; + } + + public ITraceDatabaseConnection getConnection() + { + VTable vTable = getVTable(); + ITraceDatabaseConnection result = vTable.getConnection.invoke(this); + return result; + } + + public ITraceServiceConnection getService() + { + VTable vTable = getVTable(); + ITraceServiceConnection result = vTable.getService.invoke(this); + return result; + } + + public ITraceLogWriter getLogWriter() + { + VTable vTable = getVTable(); + ITraceLogWriter result = vTable.getLogWriter.invoke(this); + return result; + } + } + + public static class ITracePlugin extends IReferenceCounted implements ITracePluginIntf + { + public static class VTable extends IReferenceCounted.VTable + { + public static interface Callback_trace_get_error extends com.sun.jna.Callback + { + public String invoke(ITracePlugin self); + } + + public static interface Callback_trace_attach extends com.sun.jna.Callback + { + public boolean invoke(ITracePlugin self, ITraceDatabaseConnection connection, boolean create_db, int dpb_length, byte[] dpb, int att_result); + } + + public static interface Callback_trace_detach extends com.sun.jna.Callback + { + public boolean invoke(ITracePlugin self, ITraceDatabaseConnection connection, boolean drop_db); + } + + public static interface Callback_trace_transaction_start extends com.sun.jna.Callback + { + public boolean invoke(ITracePlugin self, ITraceDatabaseConnection connection, ITraceTransaction transaction, int tpb_length, byte[] tpb, int tra_result); + } + + public static interface Callback_trace_transaction_end extends com.sun.jna.Callback + { + public boolean invoke(ITracePlugin self, ITraceDatabaseConnection connection, ITraceTransaction transaction, boolean commit, boolean retain_context, int tra_result); + } + + public static interface Callback_trace_proc_execute extends com.sun.jna.Callback + { + public boolean invoke(ITracePlugin self, ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceProcedure procedure, boolean started, int proc_result); + } + + public static interface Callback_trace_trigger_execute extends com.sun.jna.Callback + { + public boolean invoke(ITracePlugin self, ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceTrigger trigger, boolean started, int trig_result); + } + + public static interface Callback_trace_set_context extends com.sun.jna.Callback + { + public boolean invoke(ITracePlugin self, ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceContextVariable variable); + } + + public static interface Callback_trace_dsql_prepare extends com.sun.jna.Callback + { + public boolean invoke(ITracePlugin self, ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceSQLStatement statement, long time_millis, int req_result); + } + + public static interface Callback_trace_dsql_free extends com.sun.jna.Callback + { + public boolean invoke(ITracePlugin self, ITraceDatabaseConnection connection, ITraceSQLStatement statement, int option); + } + + public static interface Callback_trace_dsql_execute extends com.sun.jna.Callback + { + public boolean invoke(ITracePlugin self, ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceSQLStatement statement, boolean started, int req_result); + } + + public static interface Callback_trace_blr_compile extends com.sun.jna.Callback + { + public boolean invoke(ITracePlugin self, ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceBLRStatement statement, long time_millis, int req_result); + } + + public static interface Callback_trace_blr_execute extends com.sun.jna.Callback + { + public boolean invoke(ITracePlugin self, ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceBLRStatement statement, int req_result); + } + + public static interface Callback_trace_dyn_execute extends com.sun.jna.Callback + { + public boolean invoke(ITracePlugin self, ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceDYNRequest request, long time_millis, int req_result); + } + + public static interface Callback_trace_service_attach extends com.sun.jna.Callback + { + public boolean invoke(ITracePlugin self, ITraceServiceConnection service, int spb_length, byte[] spb, int att_result); + } + + public static interface Callback_trace_service_start extends com.sun.jna.Callback + { + public boolean invoke(ITracePlugin self, ITraceServiceConnection service, int switches_length, String switches, int start_result); + } + + public static interface Callback_trace_service_query extends com.sun.jna.Callback + { + public boolean invoke(ITracePlugin self, ITraceServiceConnection service, int send_item_length, byte[] send_items, int recv_item_length, byte[] recv_items, int query_result); + } + + public static interface Callback_trace_service_detach extends com.sun.jna.Callback + { + public boolean invoke(ITracePlugin self, ITraceServiceConnection service, int detach_result); + } + + public static interface Callback_trace_event_error extends com.sun.jna.Callback + { + public boolean invoke(ITracePlugin self, ITraceConnection connection, ITraceStatusVector status, String function); + } + + public static interface Callback_trace_event_sweep extends com.sun.jna.Callback + { + public boolean invoke(ITracePlugin self, ITraceDatabaseConnection connection, ITraceSweepInfo sweep, int sweep_state); + } + + public static interface Callback_trace_func_execute extends com.sun.jna.Callback + { + public boolean invoke(ITracePlugin self, ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceFunction function, boolean started, int func_result); + } + + public static interface Callback_trace_privilege_change extends com.sun.jna.Callback + { + public boolean invoke(ITracePlugin self, ITraceDatabaseConnection connection, ITraceTransaction transaction, String executor, String grantor, boolean is_grant, String object_name, String field_name, String user_name, String privileges, int options, int change_result); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final ITracePluginIntf obj) + { + super(obj); + + trace_get_error = new Callback_trace_get_error() { + @Override + public String invoke(ITracePlugin self) + { + return obj.trace_get_error(); + } + }; + + trace_attach = new Callback_trace_attach() { + @Override + public boolean invoke(ITracePlugin self, ITraceDatabaseConnection connection, boolean create_db, int dpb_length, byte[] dpb, int att_result) + { + return obj.trace_attach(connection, create_db, dpb_length, dpb, att_result); + } + }; + + trace_detach = new Callback_trace_detach() { + @Override + public boolean invoke(ITracePlugin self, ITraceDatabaseConnection connection, boolean drop_db) + { + return obj.trace_detach(connection, drop_db); + } + }; + + trace_transaction_start = new Callback_trace_transaction_start() { + @Override + public boolean invoke(ITracePlugin self, ITraceDatabaseConnection connection, ITraceTransaction transaction, int tpb_length, byte[] tpb, int tra_result) + { + return obj.trace_transaction_start(connection, transaction, tpb_length, tpb, tra_result); + } + }; + + trace_transaction_end = new Callback_trace_transaction_end() { + @Override + public boolean invoke(ITracePlugin self, ITraceDatabaseConnection connection, ITraceTransaction transaction, boolean commit, boolean retain_context, int tra_result) + { + return obj.trace_transaction_end(connection, transaction, commit, retain_context, tra_result); + } + }; + + trace_proc_execute = new Callback_trace_proc_execute() { + @Override + public boolean invoke(ITracePlugin self, ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceProcedure procedure, boolean started, int proc_result) + { + return obj.trace_proc_execute(connection, transaction, procedure, started, proc_result); + } + }; + + trace_trigger_execute = new Callback_trace_trigger_execute() { + @Override + public boolean invoke(ITracePlugin self, ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceTrigger trigger, boolean started, int trig_result) + { + return obj.trace_trigger_execute(connection, transaction, trigger, started, trig_result); + } + }; + + trace_set_context = new Callback_trace_set_context() { + @Override + public boolean invoke(ITracePlugin self, ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceContextVariable variable) + { + return obj.trace_set_context(connection, transaction, variable); + } + }; + + trace_dsql_prepare = new Callback_trace_dsql_prepare() { + @Override + public boolean invoke(ITracePlugin self, ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceSQLStatement statement, long time_millis, int req_result) + { + return obj.trace_dsql_prepare(connection, transaction, statement, time_millis, req_result); + } + }; + + trace_dsql_free = new Callback_trace_dsql_free() { + @Override + public boolean invoke(ITracePlugin self, ITraceDatabaseConnection connection, ITraceSQLStatement statement, int option) + { + return obj.trace_dsql_free(connection, statement, option); + } + }; + + trace_dsql_execute = new Callback_trace_dsql_execute() { + @Override + public boolean invoke(ITracePlugin self, ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceSQLStatement statement, boolean started, int req_result) + { + return obj.trace_dsql_execute(connection, transaction, statement, started, req_result); + } + }; + + trace_blr_compile = new Callback_trace_blr_compile() { + @Override + public boolean invoke(ITracePlugin self, ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceBLRStatement statement, long time_millis, int req_result) + { + return obj.trace_blr_compile(connection, transaction, statement, time_millis, req_result); + } + }; + + trace_blr_execute = new Callback_trace_blr_execute() { + @Override + public boolean invoke(ITracePlugin self, ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceBLRStatement statement, int req_result) + { + return obj.trace_blr_execute(connection, transaction, statement, req_result); + } + }; + + trace_dyn_execute = new Callback_trace_dyn_execute() { + @Override + public boolean invoke(ITracePlugin self, ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceDYNRequest request, long time_millis, int req_result) + { + return obj.trace_dyn_execute(connection, transaction, request, time_millis, req_result); + } + }; + + trace_service_attach = new Callback_trace_service_attach() { + @Override + public boolean invoke(ITracePlugin self, ITraceServiceConnection service, int spb_length, byte[] spb, int att_result) + { + return obj.trace_service_attach(service, spb_length, spb, att_result); + } + }; + + trace_service_start = new Callback_trace_service_start() { + @Override + public boolean invoke(ITracePlugin self, ITraceServiceConnection service, int switches_length, String switches, int start_result) + { + return obj.trace_service_start(service, switches_length, switches, start_result); + } + }; + + trace_service_query = new Callback_trace_service_query() { + @Override + public boolean invoke(ITracePlugin self, ITraceServiceConnection service, int send_item_length, byte[] send_items, int recv_item_length, byte[] recv_items, int query_result) + { + return obj.trace_service_query(service, send_item_length, send_items, recv_item_length, recv_items, query_result); + } + }; + + trace_service_detach = new Callback_trace_service_detach() { + @Override + public boolean invoke(ITracePlugin self, ITraceServiceConnection service, int detach_result) + { + return obj.trace_service_detach(service, detach_result); + } + }; + + trace_event_error = new Callback_trace_event_error() { + @Override + public boolean invoke(ITracePlugin self, ITraceConnection connection, ITraceStatusVector status, String function) + { + return obj.trace_event_error(connection, status, function); + } + }; + + trace_event_sweep = new Callback_trace_event_sweep() { + @Override + public boolean invoke(ITracePlugin self, ITraceDatabaseConnection connection, ITraceSweepInfo sweep, int sweep_state) + { + return obj.trace_event_sweep(connection, sweep, sweep_state); + } + }; + + trace_func_execute = new Callback_trace_func_execute() { + @Override + public boolean invoke(ITracePlugin self, ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceFunction function, boolean started, int func_result) + { + return obj.trace_func_execute(connection, transaction, function, started, func_result); + } + }; + + trace_privilege_change = new Callback_trace_privilege_change() { + @Override + public boolean invoke(ITracePlugin self, ITraceDatabaseConnection connection, ITraceTransaction transaction, String executor, String grantor, boolean is_grant, String object_name, String field_name, String user_name, String privileges, int options, int change_result) + { + return obj.trace_privilege_change(connection, transaction, executor, grantor, is_grant, object_name, field_name, user_name, privileges, options, change_result); + } + }; + } + + public VTable() + { + } + + public Callback_trace_get_error trace_get_error; + public Callback_trace_attach trace_attach; + public Callback_trace_detach trace_detach; + public Callback_trace_transaction_start trace_transaction_start; + public Callback_trace_transaction_end trace_transaction_end; + public Callback_trace_proc_execute trace_proc_execute; + public Callback_trace_trigger_execute trace_trigger_execute; + public Callback_trace_set_context trace_set_context; + public Callback_trace_dsql_prepare trace_dsql_prepare; + public Callback_trace_dsql_free trace_dsql_free; + public Callback_trace_dsql_execute trace_dsql_execute; + public Callback_trace_blr_compile trace_blr_compile; + public Callback_trace_blr_execute trace_blr_execute; + public Callback_trace_dyn_execute trace_dyn_execute; + public Callback_trace_service_attach trace_service_attach; + public Callback_trace_service_start trace_service_start; + public Callback_trace_service_query trace_service_query; + public Callback_trace_service_detach trace_service_detach; + public Callback_trace_event_error trace_event_error; + public Callback_trace_event_sweep trace_event_sweep; + public Callback_trace_func_execute trace_func_execute; + public Callback_trace_privilege_change trace_privilege_change; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("trace_get_error", "trace_attach", "trace_detach", "trace_transaction_start", "trace_transaction_end", "trace_proc_execute", "trace_trigger_execute", "trace_set_context", "trace_dsql_prepare", "trace_dsql_free", "trace_dsql_execute", "trace_blr_compile", "trace_blr_execute", "trace_dyn_execute", "trace_service_attach", "trace_service_start", "trace_service_query", "trace_service_detach", "trace_event_error", "trace_event_sweep", "trace_func_execute", "trace_privilege_change")); + return fields; + } + } + + public ITracePlugin() + { + } + + public ITracePlugin(final ITracePluginIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public String trace_get_error() + { + VTable vTable = getVTable(); + String result = vTable.trace_get_error.invoke(this); + return result; + } + + public boolean trace_attach(ITraceDatabaseConnection connection, boolean create_db, int dpb_length, byte[] dpb, int att_result) + { + VTable vTable = getVTable(); + boolean result = vTable.trace_attach.invoke(this, connection, create_db, dpb_length, dpb, att_result); + return result; + } + + public boolean trace_detach(ITraceDatabaseConnection connection, boolean drop_db) + { + VTable vTable = getVTable(); + boolean result = vTable.trace_detach.invoke(this, connection, drop_db); + return result; + } + + public boolean trace_transaction_start(ITraceDatabaseConnection connection, ITraceTransaction transaction, int tpb_length, byte[] tpb, int tra_result) + { + VTable vTable = getVTable(); + boolean result = vTable.trace_transaction_start.invoke(this, connection, transaction, tpb_length, tpb, tra_result); + return result; + } + + public boolean trace_transaction_end(ITraceDatabaseConnection connection, ITraceTransaction transaction, boolean commit, boolean retain_context, int tra_result) + { + VTable vTable = getVTable(); + boolean result = vTable.trace_transaction_end.invoke(this, connection, transaction, commit, retain_context, tra_result); + return result; + } + + public boolean trace_proc_execute(ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceProcedure procedure, boolean started, int proc_result) + { + VTable vTable = getVTable(); + boolean result = vTable.trace_proc_execute.invoke(this, connection, transaction, procedure, started, proc_result); + return result; + } + + public boolean trace_trigger_execute(ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceTrigger trigger, boolean started, int trig_result) + { + VTable vTable = getVTable(); + boolean result = vTable.trace_trigger_execute.invoke(this, connection, transaction, trigger, started, trig_result); + return result; + } + + public boolean trace_set_context(ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceContextVariable variable) + { + VTable vTable = getVTable(); + boolean result = vTable.trace_set_context.invoke(this, connection, transaction, variable); + return result; + } + + public boolean trace_dsql_prepare(ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceSQLStatement statement, long time_millis, int req_result) + { + VTable vTable = getVTable(); + boolean result = vTable.trace_dsql_prepare.invoke(this, connection, transaction, statement, time_millis, req_result); + return result; + } + + public boolean trace_dsql_free(ITraceDatabaseConnection connection, ITraceSQLStatement statement, int option) + { + VTable vTable = getVTable(); + boolean result = vTable.trace_dsql_free.invoke(this, connection, statement, option); + return result; + } + + public boolean trace_dsql_execute(ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceSQLStatement statement, boolean started, int req_result) + { + VTable vTable = getVTable(); + boolean result = vTable.trace_dsql_execute.invoke(this, connection, transaction, statement, started, req_result); + return result; + } + + public boolean trace_blr_compile(ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceBLRStatement statement, long time_millis, int req_result) + { + VTable vTable = getVTable(); + boolean result = vTable.trace_blr_compile.invoke(this, connection, transaction, statement, time_millis, req_result); + return result; + } + + public boolean trace_blr_execute(ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceBLRStatement statement, int req_result) + { + VTable vTable = getVTable(); + boolean result = vTable.trace_blr_execute.invoke(this, connection, transaction, statement, req_result); + return result; + } + + public boolean trace_dyn_execute(ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceDYNRequest request, long time_millis, int req_result) + { + VTable vTable = getVTable(); + boolean result = vTable.trace_dyn_execute.invoke(this, connection, transaction, request, time_millis, req_result); + return result; + } + + public boolean trace_service_attach(ITraceServiceConnection service, int spb_length, byte[] spb, int att_result) + { + VTable vTable = getVTable(); + boolean result = vTable.trace_service_attach.invoke(this, service, spb_length, spb, att_result); + return result; + } + + public boolean trace_service_start(ITraceServiceConnection service, int switches_length, String switches, int start_result) + { + VTable vTable = getVTable(); + boolean result = vTable.trace_service_start.invoke(this, service, switches_length, switches, start_result); + return result; + } + + public boolean trace_service_query(ITraceServiceConnection service, int send_item_length, byte[] send_items, int recv_item_length, byte[] recv_items, int query_result) + { + VTable vTable = getVTable(); + boolean result = vTable.trace_service_query.invoke(this, service, send_item_length, send_items, recv_item_length, recv_items, query_result); + return result; + } + + public boolean trace_service_detach(ITraceServiceConnection service, int detach_result) + { + VTable vTable = getVTable(); + boolean result = vTable.trace_service_detach.invoke(this, service, detach_result); + return result; + } + + public boolean trace_event_error(ITraceConnection connection, ITraceStatusVector status, String function) + { + VTable vTable = getVTable(); + boolean result = vTable.trace_event_error.invoke(this, connection, status, function); + return result; + } + + public boolean trace_event_sweep(ITraceDatabaseConnection connection, ITraceSweepInfo sweep, int sweep_state) + { + VTable vTable = getVTable(); + boolean result = vTable.trace_event_sweep.invoke(this, connection, sweep, sweep_state); + return result; + } + + public boolean trace_func_execute(ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceFunction function, boolean started, int func_result) + { + VTable vTable = getVTable(); + boolean result = vTable.trace_func_execute.invoke(this, connection, transaction, function, started, func_result); + return result; + } + + public boolean trace_privilege_change(ITraceDatabaseConnection connection, ITraceTransaction transaction, String executor, String grantor, boolean is_grant, String object_name, String field_name, String user_name, String privileges, int options, int change_result) + { + VTable vTable = getVTable(); + boolean result = vTable.trace_privilege_change.invoke(this, connection, transaction, executor, grantor, is_grant, object_name, field_name, user_name, privileges, options, change_result); + return result; + } + } + + public static class ITraceFactory extends IPluginBase implements ITraceFactoryIntf + { + public static class VTable extends IPluginBase.VTable + { + public static interface Callback_trace_needs extends com.sun.jna.Callback + { + public long invoke(ITraceFactory self); + } + + public static interface Callback_trace_create extends com.sun.jna.Callback + { + public ITracePlugin invoke(ITraceFactory self, IStatus status, ITraceInitInfo init_info); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final ITraceFactoryIntf obj) + { + super(obj); + + trace_needs = new Callback_trace_needs() { + @Override + public long invoke(ITraceFactory self) + { + return obj.trace_needs(); + } + }; + + trace_create = new Callback_trace_create() { + @Override + public ITracePlugin invoke(ITraceFactory self, IStatus status, ITraceInitInfo init_info) + { + try + { + return obj.trace_create(status, init_info); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + } + + public VTable() + { + } + + public Callback_trace_needs trace_needs; + public Callback_trace_create trace_create; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("trace_needs", "trace_create")); + return fields; + } + } + + public ITraceFactory() + { + } + + public ITraceFactory(final ITraceFactoryIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public long trace_needs() + { + VTable vTable = getVTable(); + long result = vTable.trace_needs.invoke(this); + return result; + } + + public ITracePlugin trace_create(IStatus status, ITraceInitInfo init_info) throws FbException + { + VTable vTable = getVTable(); + ITracePlugin result = vTable.trace_create.invoke(this, status, init_info); + FbException.checkException(status); + return result; + } + } + + public static class IUdrFunctionFactory extends IDisposable implements IUdrFunctionFactoryIntf + { + public static class VTable extends IDisposable.VTable + { + public static interface Callback_setup extends com.sun.jna.Callback + { + public void invoke(IUdrFunctionFactory self, IStatus status, IExternalContext context, IRoutineMetadata metadata, IMetadataBuilder inBuilder, IMetadataBuilder outBuilder); + } + + public static interface Callback_newItem extends com.sun.jna.Callback + { + public IExternalFunction invoke(IUdrFunctionFactory self, IStatus status, IExternalContext context, IRoutineMetadata metadata); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IUdrFunctionFactoryIntf obj) + { + super(obj); + + setup = new Callback_setup() { + @Override + public void invoke(IUdrFunctionFactory self, IStatus status, IExternalContext context, IRoutineMetadata metadata, IMetadataBuilder inBuilder, IMetadataBuilder outBuilder) + { + try + { + obj.setup(status, context, metadata, inBuilder, outBuilder); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + newItem = new Callback_newItem() { + @Override + public IExternalFunction invoke(IUdrFunctionFactory self, IStatus status, IExternalContext context, IRoutineMetadata metadata) + { + try + { + return obj.newItem(status, context, metadata); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + } + + public VTable() + { + } + + public Callback_setup setup; + public Callback_newItem newItem; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("setup", "newItem")); + return fields; + } + } + + public IUdrFunctionFactory() + { + } + + public IUdrFunctionFactory(final IUdrFunctionFactoryIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public void setup(IStatus status, IExternalContext context, IRoutineMetadata metadata, IMetadataBuilder inBuilder, IMetadataBuilder outBuilder) throws FbException + { + VTable vTable = getVTable(); + vTable.setup.invoke(this, status, context, metadata, inBuilder, outBuilder); + FbException.checkException(status); + } + + public IExternalFunction newItem(IStatus status, IExternalContext context, IRoutineMetadata metadata) throws FbException + { + VTable vTable = getVTable(); + IExternalFunction result = vTable.newItem.invoke(this, status, context, metadata); + FbException.checkException(status); + return result; + } + } + + public static class IUdrProcedureFactory extends IDisposable implements IUdrProcedureFactoryIntf + { + public static class VTable extends IDisposable.VTable + { + public static interface Callback_setup extends com.sun.jna.Callback + { + public void invoke(IUdrProcedureFactory self, IStatus status, IExternalContext context, IRoutineMetadata metadata, IMetadataBuilder inBuilder, IMetadataBuilder outBuilder); + } + + public static interface Callback_newItem extends com.sun.jna.Callback + { + public IExternalProcedure invoke(IUdrProcedureFactory self, IStatus status, IExternalContext context, IRoutineMetadata metadata); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IUdrProcedureFactoryIntf obj) + { + super(obj); + + setup = new Callback_setup() { + @Override + public void invoke(IUdrProcedureFactory self, IStatus status, IExternalContext context, IRoutineMetadata metadata, IMetadataBuilder inBuilder, IMetadataBuilder outBuilder) + { + try + { + obj.setup(status, context, metadata, inBuilder, outBuilder); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + newItem = new Callback_newItem() { + @Override + public IExternalProcedure invoke(IUdrProcedureFactory self, IStatus status, IExternalContext context, IRoutineMetadata metadata) + { + try + { + return obj.newItem(status, context, metadata); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + } + + public VTable() + { + } + + public Callback_setup setup; + public Callback_newItem newItem; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("setup", "newItem")); + return fields; + } + } + + public IUdrProcedureFactory() + { + } + + public IUdrProcedureFactory(final IUdrProcedureFactoryIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public void setup(IStatus status, IExternalContext context, IRoutineMetadata metadata, IMetadataBuilder inBuilder, IMetadataBuilder outBuilder) throws FbException + { + VTable vTable = getVTable(); + vTable.setup.invoke(this, status, context, metadata, inBuilder, outBuilder); + FbException.checkException(status); + } + + public IExternalProcedure newItem(IStatus status, IExternalContext context, IRoutineMetadata metadata) throws FbException + { + VTable vTable = getVTable(); + IExternalProcedure result = vTable.newItem.invoke(this, status, context, metadata); + FbException.checkException(status); + return result; + } + } + + public static class IUdrTriggerFactory extends IDisposable implements IUdrTriggerFactoryIntf + { + public static class VTable extends IDisposable.VTable + { + public static interface Callback_setup extends com.sun.jna.Callback + { + public void invoke(IUdrTriggerFactory self, IStatus status, IExternalContext context, IRoutineMetadata metadata, IMetadataBuilder fieldsBuilder); + } + + public static interface Callback_newItem extends com.sun.jna.Callback + { + public IExternalTrigger invoke(IUdrTriggerFactory self, IStatus status, IExternalContext context, IRoutineMetadata metadata); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IUdrTriggerFactoryIntf obj) + { + super(obj); + + setup = new Callback_setup() { + @Override + public void invoke(IUdrTriggerFactory self, IStatus status, IExternalContext context, IRoutineMetadata metadata, IMetadataBuilder fieldsBuilder) + { + try + { + obj.setup(status, context, metadata, fieldsBuilder); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + newItem = new Callback_newItem() { + @Override + public IExternalTrigger invoke(IUdrTriggerFactory self, IStatus status, IExternalContext context, IRoutineMetadata metadata) + { + try + { + return obj.newItem(status, context, metadata); + } + catch (Throwable t) + { + FbException.catchException(status, t); + return null; + } + } + }; + } + + public VTable() + { + } + + public Callback_setup setup; + public Callback_newItem newItem; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("setup", "newItem")); + return fields; + } + } + + public IUdrTriggerFactory() + { + } + + public IUdrTriggerFactory(final IUdrTriggerFactoryIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public void setup(IStatus status, IExternalContext context, IRoutineMetadata metadata, IMetadataBuilder fieldsBuilder) throws FbException + { + VTable vTable = getVTable(); + vTable.setup.invoke(this, status, context, metadata, fieldsBuilder); + FbException.checkException(status); + } + + public IExternalTrigger newItem(IStatus status, IExternalContext context, IRoutineMetadata metadata) throws FbException + { + VTable vTable = getVTable(); + IExternalTrigger result = vTable.newItem.invoke(this, status, context, metadata); + FbException.checkException(status); + return result; + } + } + + public static class IUdrPlugin extends IVersioned implements IUdrPluginIntf + { + public static class VTable extends IVersioned.VTable + { + public static interface Callback_getMaster extends com.sun.jna.Callback + { + public IMaster invoke(IUdrPlugin self); + } + + public static interface Callback_registerFunction extends com.sun.jna.Callback + { + public void invoke(IUdrPlugin self, IStatus status, String name, IUdrFunctionFactory factory); + } + + public static interface Callback_registerProcedure extends com.sun.jna.Callback + { + public void invoke(IUdrPlugin self, IStatus status, String name, IUdrProcedureFactory factory); + } + + public static interface Callback_registerTrigger extends com.sun.jna.Callback + { + public void invoke(IUdrPlugin self, IStatus status, String name, IUdrTriggerFactory factory); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IUdrPluginIntf obj) + { + super(obj); + + getMaster = new Callback_getMaster() { + @Override + public IMaster invoke(IUdrPlugin self) + { + return obj.getMaster(); + } + }; + + registerFunction = new Callback_registerFunction() { + @Override + public void invoke(IUdrPlugin self, IStatus status, String name, IUdrFunctionFactory factory) + { + try + { + obj.registerFunction(status, name, factory); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + registerProcedure = new Callback_registerProcedure() { + @Override + public void invoke(IUdrPlugin self, IStatus status, String name, IUdrProcedureFactory factory) + { + try + { + obj.registerProcedure(status, name, factory); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + registerTrigger = new Callback_registerTrigger() { + @Override + public void invoke(IUdrPlugin self, IStatus status, String name, IUdrTriggerFactory factory) + { + try + { + obj.registerTrigger(status, name, factory); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + } + + public VTable() + { + } + + public Callback_getMaster getMaster; + public Callback_registerFunction registerFunction; + public Callback_registerProcedure registerProcedure; + public Callback_registerTrigger registerTrigger; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("getMaster", "registerFunction", "registerProcedure", "registerTrigger")); + return fields; + } + } + + public IUdrPlugin() + { + } + + public IUdrPlugin(final IUdrPluginIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public IMaster getMaster() + { + VTable vTable = getVTable(); + IMaster result = vTable.getMaster.invoke(this); + return result; + } + + public void registerFunction(IStatus status, String name, IUdrFunctionFactory factory) throws FbException + { + VTable vTable = getVTable(); + vTable.registerFunction.invoke(this, status, name, factory); + FbException.checkException(status); + } + + public void registerProcedure(IStatus status, String name, IUdrProcedureFactory factory) throws FbException + { + VTable vTable = getVTable(); + vTable.registerProcedure.invoke(this, status, name, factory); + FbException.checkException(status); + } + + public void registerTrigger(IStatus status, String name, IUdrTriggerFactory factory) throws FbException + { + VTable vTable = getVTable(); + vTable.registerTrigger.invoke(this, status, name, factory); + FbException.checkException(status); + } + } + + public static class IDecFloat16 extends IVersioned implements IDecFloat16Intf + { + public static class VTable extends IVersioned.VTable + { + public static interface Callback_toBcd extends com.sun.jna.Callback + { + public void invoke(IDecFloat16 self, FB_DEC16[] from, com.sun.jna.Pointer sign, byte[] bcd, com.sun.jna.Pointer exp); + } + + public static interface Callback_toString extends com.sun.jna.Callback + { + public void invoke(IDecFloat16 self, IStatus status, FB_DEC16[] from, int bufferLength, com.sun.jna.Pointer buffer); + } + + public static interface Callback_fromBcd extends com.sun.jna.Callback + { + public void invoke(IDecFloat16 self, int sign, byte[] bcd, int exp, FB_DEC16[] to); + } + + public static interface Callback_fromString extends com.sun.jna.Callback + { + public void invoke(IDecFloat16 self, IStatus status, String from, FB_DEC16[] to); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IDecFloat16Intf obj) + { + super(obj); + + toBcd = new Callback_toBcd() { + @Override + public void invoke(IDecFloat16 self, FB_DEC16[] from, com.sun.jna.Pointer sign, byte[] bcd, com.sun.jna.Pointer exp) + { + obj.toBcd(from, sign, bcd, exp); + } + }; + + toString = new Callback_toString() { + @Override + public void invoke(IDecFloat16 self, IStatus status, FB_DEC16[] from, int bufferLength, com.sun.jna.Pointer buffer) + { + try + { + obj.toString(status, from, bufferLength, buffer); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + fromBcd = new Callback_fromBcd() { + @Override + public void invoke(IDecFloat16 self, int sign, byte[] bcd, int exp, FB_DEC16[] to) + { + obj.fromBcd(sign, bcd, exp, to); + } + }; + + fromString = new Callback_fromString() { + @Override + public void invoke(IDecFloat16 self, IStatus status, String from, FB_DEC16[] to) + { + try + { + obj.fromString(status, from, to); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + } + + public VTable() + { + } + + public Callback_toBcd toBcd; + public Callback_toString toString; + public Callback_fromBcd fromBcd; + public Callback_fromString fromString; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("toBcd", "toString", "fromBcd", "fromString")); + return fields; + } + } + + public IDecFloat16() + { + } + + public IDecFloat16(final IDecFloat16Intf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public void toBcd(FB_DEC16[] from, com.sun.jna.Pointer sign, byte[] bcd, com.sun.jna.Pointer exp) + { + VTable vTable = getVTable(); + vTable.toBcd.invoke(this, from, sign, bcd, exp); + } + + public void toString(IStatus status, FB_DEC16[] from, int bufferLength, com.sun.jna.Pointer buffer) throws FbException + { + VTable vTable = getVTable(); + vTable.toString.invoke(this, status, from, bufferLength, buffer); + FbException.checkException(status); + } + + public void fromBcd(int sign, byte[] bcd, int exp, FB_DEC16[] to) + { + VTable vTable = getVTable(); + vTable.fromBcd.invoke(this, sign, bcd, exp, to); + } + + public void fromString(IStatus status, String from, FB_DEC16[] to) throws FbException + { + VTable vTable = getVTable(); + vTable.fromString.invoke(this, status, from, to); + FbException.checkException(status); + } + } + + public static class IDecFloat34 extends IVersioned implements IDecFloat34Intf + { + public static class VTable extends IVersioned.VTable + { + public static interface Callback_toBcd extends com.sun.jna.Callback + { + public void invoke(IDecFloat34 self, FB_DEC34[] from, com.sun.jna.Pointer sign, byte[] bcd, com.sun.jna.Pointer exp); + } + + public static interface Callback_toString extends com.sun.jna.Callback + { + public void invoke(IDecFloat34 self, IStatus status, FB_DEC34[] from, int bufferLength, com.sun.jna.Pointer buffer); + } + + public static interface Callback_fromBcd extends com.sun.jna.Callback + { + public void invoke(IDecFloat34 self, int sign, byte[] bcd, int exp, FB_DEC34[] to); + } + + public static interface Callback_fromString extends com.sun.jna.Callback + { + public void invoke(IDecFloat34 self, IStatus status, String from, FB_DEC34[] to); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IDecFloat34Intf obj) + { + super(obj); + + toBcd = new Callback_toBcd() { + @Override + public void invoke(IDecFloat34 self, FB_DEC34[] from, com.sun.jna.Pointer sign, byte[] bcd, com.sun.jna.Pointer exp) + { + obj.toBcd(from, sign, bcd, exp); + } + }; + + toString = new Callback_toString() { + @Override + public void invoke(IDecFloat34 self, IStatus status, FB_DEC34[] from, int bufferLength, com.sun.jna.Pointer buffer) + { + try + { + obj.toString(status, from, bufferLength, buffer); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + + fromBcd = new Callback_fromBcd() { + @Override + public void invoke(IDecFloat34 self, int sign, byte[] bcd, int exp, FB_DEC34[] to) + { + obj.fromBcd(sign, bcd, exp, to); + } + }; + + fromString = new Callback_fromString() { + @Override + public void invoke(IDecFloat34 self, IStatus status, String from, FB_DEC34[] to) + { + try + { + obj.fromString(status, from, to); + } + catch (Throwable t) + { + FbException.catchException(status, t); + } + } + }; + } + + public VTable() + { + } + + public Callback_toBcd toBcd; + public Callback_toString toString; + public Callback_fromBcd fromBcd; + public Callback_fromString fromString; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("toBcd", "toString", "fromBcd", "fromString")); + return fields; + } + } + + public IDecFloat34() + { + } + + public IDecFloat34(final IDecFloat34Intf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public void toBcd(FB_DEC34[] from, com.sun.jna.Pointer sign, byte[] bcd, com.sun.jna.Pointer exp) + { + VTable vTable = getVTable(); + vTable.toBcd.invoke(this, from, sign, bcd, exp); + } + + public void toString(IStatus status, FB_DEC34[] from, int bufferLength, com.sun.jna.Pointer buffer) throws FbException + { + VTable vTable = getVTable(); + vTable.toString.invoke(this, status, from, bufferLength, buffer); + FbException.checkException(status); + } + + public void fromBcd(int sign, byte[] bcd, int exp, FB_DEC34[] to) + { + VTable vTable = getVTable(); + vTable.fromBcd.invoke(this, sign, bcd, exp, to); + } + + public void fromString(IStatus status, String from, FB_DEC34[] to) throws FbException + { + VTable vTable = getVTable(); + vTable.fromString.invoke(this, status, from, to); + FbException.checkException(status); + } + } + + public static class ICryptoKey extends IVersioned implements ICryptoKeyIntf + { + public static class VTable extends IVersioned.VTable + { + public static interface Callback_getObjectInfo extends com.sun.jna.Callback + { + public com.sun.jna.Pointer invoke(ICryptoKey self); + } + + public static interface Callback_loadFromFile extends com.sun.jna.Callback + { + public int invoke(ICryptoKey self, String fileName); + } + + public static interface Callback_loadFromBuffer extends com.sun.jna.Callback + { + public int invoke(ICryptoKey self, com.sun.jna.Pointer buffer, int length); + } + + public static interface Callback_loadFromCurrentRepository extends com.sun.jna.Callback + { + public int invoke(ICryptoKey self); + } + + public static interface Callback_saveToFile extends com.sun.jna.Callback + { + public int invoke(ICryptoKey self, String fileName); + } + + public static interface Callback_saveToBuffer extends com.sun.jna.Callback + { + public int invoke(ICryptoKey self, com.sun.jna.Pointer buffer, int length, com.sun.jna.Pointer realLength); + } + + public static interface Callback_saveToRepository extends com.sun.jna.Callback + { + public int invoke(ICryptoKey self, ICryptoRepository repository, String name); + } + + public static interface Callback_setAgreeKeyFromRepository extends com.sun.jna.Callback + { + public int invoke(ICryptoKey self, ICryptoRepository repository); + } + + public static interface Callback_setExchangeKey extends com.sun.jna.Callback + { + public int invoke(ICryptoKey self, ICryptoKey key); + } + + public static interface Callback_generateKey extends com.sun.jna.Callback + { + public int invoke(ICryptoKey self); + } + + public static interface Callback_getIV extends com.sun.jna.Callback + { + public int invoke(ICryptoKey self, byte[] iv, int length, com.sun.jna.Pointer realLength); + } + + public static interface Callback_setIV extends com.sun.jna.Callback + { + public int invoke(ICryptoKey self, byte[] iv, int length); + } + + public static interface Callback_createFromBuffer extends com.sun.jna.Callback + { + public int invoke(ICryptoKey self, byte[] buffer, int length); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final ICryptoKeyIntf obj) + { + super(obj); + + getObjectInfo = new Callback_getObjectInfo() { + @Override + public com.sun.jna.Pointer invoke(ICryptoKey self) + { + return obj.getObjectInfo(); + } + }; + + loadFromFile = new Callback_loadFromFile() { + @Override + public int invoke(ICryptoKey self, String fileName) + { + return obj.loadFromFile(fileName); + } + }; + + loadFromBuffer = new Callback_loadFromBuffer() { + @Override + public int invoke(ICryptoKey self, com.sun.jna.Pointer buffer, int length) + { + return obj.loadFromBuffer(buffer, length); + } + }; + + loadFromCurrentRepository = new Callback_loadFromCurrentRepository() { + @Override + public int invoke(ICryptoKey self) + { + return obj.loadFromCurrentRepository(); + } + }; + + saveToFile = new Callback_saveToFile() { + @Override + public int invoke(ICryptoKey self, String fileName) + { + return obj.saveToFile(fileName); + } + }; + + saveToBuffer = new Callback_saveToBuffer() { + @Override + public int invoke(ICryptoKey self, com.sun.jna.Pointer buffer, int length, com.sun.jna.Pointer realLength) + { + return obj.saveToBuffer(buffer, length, realLength); + } + }; + + saveToRepository = new Callback_saveToRepository() { + @Override + public int invoke(ICryptoKey self, ICryptoRepository repository, String name) + { + return obj.saveToRepository(repository, name); + } + }; + + setAgreeKeyFromRepository = new Callback_setAgreeKeyFromRepository() { + @Override + public int invoke(ICryptoKey self, ICryptoRepository repository) + { + return obj.setAgreeKeyFromRepository(repository); + } + }; + + setExchangeKey = new Callback_setExchangeKey() { + @Override + public int invoke(ICryptoKey self, ICryptoKey key) + { + return obj.setExchangeKey(key); + } + }; + + generateKey = new Callback_generateKey() { + @Override + public int invoke(ICryptoKey self) + { + return obj.generateKey(); + } + }; + + getIV = new Callback_getIV() { + @Override + public int invoke(ICryptoKey self, byte[] iv, int length, com.sun.jna.Pointer realLength) + { + return obj.getIV(iv, length, realLength); + } + }; + + setIV = new Callback_setIV() { + @Override + public int invoke(ICryptoKey self, byte[] iv, int length) + { + return obj.setIV(iv, length); + } + }; + + createFromBuffer = new Callback_createFromBuffer() { + @Override + public int invoke(ICryptoKey self, byte[] buffer, int length) + { + return obj.createFromBuffer(buffer, length); + } + }; + } + + public VTable() + { + } + + public Callback_getObjectInfo getObjectInfo; + public Callback_loadFromFile loadFromFile; + public Callback_loadFromBuffer loadFromBuffer; + public Callback_loadFromCurrentRepository loadFromCurrentRepository; + public Callback_saveToFile saveToFile; + public Callback_saveToBuffer saveToBuffer; + public Callback_saveToRepository saveToRepository; + public Callback_setAgreeKeyFromRepository setAgreeKeyFromRepository; + public Callback_setExchangeKey setExchangeKey; + public Callback_generateKey generateKey; + public Callback_getIV getIV; + public Callback_setIV setIV; + public Callback_createFromBuffer createFromBuffer; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("getObjectInfo", "loadFromFile", "loadFromBuffer", "loadFromCurrentRepository", "saveToFile", "saveToBuffer", "saveToRepository", "setAgreeKeyFromRepository", "setExchangeKey", "generateKey", "getIV", "setIV", "createFromBuffer")); + return fields; + } + } + + public ICryptoKey() + { + } + + public ICryptoKey(final ICryptoKeyIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public com.sun.jna.Pointer getObjectInfo() + { + VTable vTable = getVTable(); + com.sun.jna.Pointer result = vTable.getObjectInfo.invoke(this); + return result; + } + + public int loadFromFile(String fileName) + { + VTable vTable = getVTable(); + int result = vTable.loadFromFile.invoke(this, fileName); + return result; + } + + public int loadFromBuffer(com.sun.jna.Pointer buffer, int length) + { + VTable vTable = getVTable(); + int result = vTable.loadFromBuffer.invoke(this, buffer, length); + return result; + } + + public int loadFromCurrentRepository() + { + VTable vTable = getVTable(); + int result = vTable.loadFromCurrentRepository.invoke(this); + return result; + } + + public int saveToFile(String fileName) + { + VTable vTable = getVTable(); + int result = vTable.saveToFile.invoke(this, fileName); + return result; + } + + public int saveToBuffer(com.sun.jna.Pointer buffer, int length, com.sun.jna.Pointer realLength) + { + VTable vTable = getVTable(); + int result = vTable.saveToBuffer.invoke(this, buffer, length, realLength); + return result; + } + + public int saveToRepository(ICryptoRepository repository, String name) + { + VTable vTable = getVTable(); + int result = vTable.saveToRepository.invoke(this, repository, name); + return result; + } + + public int setAgreeKeyFromRepository(ICryptoRepository repository) + { + VTable vTable = getVTable(); + int result = vTable.setAgreeKeyFromRepository.invoke(this, repository); + return result; + } + + public int setExchangeKey(ICryptoKey key) + { + VTable vTable = getVTable(); + int result = vTable.setExchangeKey.invoke(this, key); + return result; + } + + public int generateKey() + { + VTable vTable = getVTable(); + int result = vTable.generateKey.invoke(this); + return result; + } + + public int getIV(byte[] iv, int length, com.sun.jna.Pointer realLength) + { + VTable vTable = getVTable(); + int result = vTable.getIV.invoke(this, iv, length, realLength); + return result; + } + + public int setIV(byte[] iv, int length) + { + VTable vTable = getVTable(); + int result = vTable.setIV.invoke(this, iv, length); + return result; + } + + public int createFromBuffer(byte[] buffer, int length) + { + VTable vTable = getVTable(); + int result = vTable.createFromBuffer.invoke(this, buffer, length); + return result; + } + } + + public static class ICryptoKeyPair extends IVersioned implements ICryptoKeyPairIntf + { + public static class VTable extends IVersioned.VTable + { + public static interface Callback_getObjectInfo extends com.sun.jna.Callback + { + public com.sun.jna.Pointer invoke(ICryptoKeyPair self); + } + + public static interface Callback_loadFromFile extends com.sun.jna.Callback + { + public int invoke(ICryptoKeyPair self, String fileName); + } + + public static interface Callback_loadFromBuffer extends com.sun.jna.Callback + { + public int invoke(ICryptoKeyPair self, com.sun.jna.Pointer buffer, int length); + } + + public static interface Callback_loadFromRepository extends com.sun.jna.Callback + { + public int invoke(ICryptoKeyPair self, ICryptoRepository repository, String name); + } + + public static interface Callback_loadFromCurrentRepository extends com.sun.jna.Callback + { + public int invoke(ICryptoKeyPair self); + } + + public static interface Callback_saveToFile extends com.sun.jna.Callback + { + public int invoke(ICryptoKeyPair self, String fileName); + } + + public static interface Callback_saveToBuffer extends com.sun.jna.Callback + { + public int invoke(ICryptoKeyPair self, com.sun.jna.Pointer buffer, int length, com.sun.jna.Pointer realLength); + } + + public static interface Callback_saveToRepository extends com.sun.jna.Callback + { + public int invoke(ICryptoKeyPair self, ICryptoRepository repository, String name); + } + + public static interface Callback_setAgreeKeyFromRepository extends com.sun.jna.Callback + { + public int invoke(ICryptoKeyPair self, ICryptoRepository repository); + } + + public static interface Callback_setExchangeKey extends com.sun.jna.Callback + { + public int invoke(ICryptoKeyPair self, ICryptoKey key); + } + + public static interface Callback_generateKeyPair extends com.sun.jna.Callback + { + public int invoke(ICryptoKeyPair self); + } + + public static interface Callback_getPublicKey extends com.sun.jna.Callback + { + public int invoke(ICryptoKeyPair self, ICryptoKey key); + } + + public static interface Callback_createPublicKey extends com.sun.jna.Callback + { + public int invoke(ICryptoKeyPair self, ICryptoKey[] key); + } + + public static interface Callback_deletePublicKey extends com.sun.jna.Callback + { + public int invoke(ICryptoKeyPair self, ICryptoKey key); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final ICryptoKeyPairIntf obj) + { + super(obj); + + getObjectInfo = new Callback_getObjectInfo() { + @Override + public com.sun.jna.Pointer invoke(ICryptoKeyPair self) + { + return obj.getObjectInfo(); + } + }; + + loadFromFile = new Callback_loadFromFile() { + @Override + public int invoke(ICryptoKeyPair self, String fileName) + { + return obj.loadFromFile(fileName); + } + }; + + loadFromBuffer = new Callback_loadFromBuffer() { + @Override + public int invoke(ICryptoKeyPair self, com.sun.jna.Pointer buffer, int length) + { + return obj.loadFromBuffer(buffer, length); + } + }; + + loadFromRepository = new Callback_loadFromRepository() { + @Override + public int invoke(ICryptoKeyPair self, ICryptoRepository repository, String name) + { + return obj.loadFromRepository(repository, name); + } + }; + + loadFromCurrentRepository = new Callback_loadFromCurrentRepository() { + @Override + public int invoke(ICryptoKeyPair self) + { + return obj.loadFromCurrentRepository(); + } + }; + + saveToFile = new Callback_saveToFile() { + @Override + public int invoke(ICryptoKeyPair self, String fileName) + { + return obj.saveToFile(fileName); + } + }; + + saveToBuffer = new Callback_saveToBuffer() { + @Override + public int invoke(ICryptoKeyPair self, com.sun.jna.Pointer buffer, int length, com.sun.jna.Pointer realLength) + { + return obj.saveToBuffer(buffer, length, realLength); + } + }; + + saveToRepository = new Callback_saveToRepository() { + @Override + public int invoke(ICryptoKeyPair self, ICryptoRepository repository, String name) + { + return obj.saveToRepository(repository, name); + } + }; + + setAgreeKeyFromRepository = new Callback_setAgreeKeyFromRepository() { + @Override + public int invoke(ICryptoKeyPair self, ICryptoRepository repository) + { + return obj.setAgreeKeyFromRepository(repository); + } + }; + + setExchangeKey = new Callback_setExchangeKey() { + @Override + public int invoke(ICryptoKeyPair self, ICryptoKey key) + { + return obj.setExchangeKey(key); + } + }; + + generateKeyPair = new Callback_generateKeyPair() { + @Override + public int invoke(ICryptoKeyPair self) + { + return obj.generateKeyPair(); + } + }; + + getPublicKey = new Callback_getPublicKey() { + @Override + public int invoke(ICryptoKeyPair self, ICryptoKey key) + { + return obj.getPublicKey(key); + } + }; + + createPublicKey = new Callback_createPublicKey() { + @Override + public int invoke(ICryptoKeyPair self, ICryptoKey[] key) + { + return obj.createPublicKey(key); + } + }; + + deletePublicKey = new Callback_deletePublicKey() { + @Override + public int invoke(ICryptoKeyPair self, ICryptoKey key) + { + return obj.deletePublicKey(key); + } + }; + } + + public VTable() + { + } + + public Callback_getObjectInfo getObjectInfo; + public Callback_loadFromFile loadFromFile; + public Callback_loadFromBuffer loadFromBuffer; + public Callback_loadFromRepository loadFromRepository; + public Callback_loadFromCurrentRepository loadFromCurrentRepository; + public Callback_saveToFile saveToFile; + public Callback_saveToBuffer saveToBuffer; + public Callback_saveToRepository saveToRepository; + public Callback_setAgreeKeyFromRepository setAgreeKeyFromRepository; + public Callback_setExchangeKey setExchangeKey; + public Callback_generateKeyPair generateKeyPair; + public Callback_getPublicKey getPublicKey; + public Callback_createPublicKey createPublicKey; + public Callback_deletePublicKey deletePublicKey; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("getObjectInfo", "loadFromFile", "loadFromBuffer", "loadFromRepository", "loadFromCurrentRepository", "saveToFile", "saveToBuffer", "saveToRepository", "setAgreeKeyFromRepository", "setExchangeKey", "generateKeyPair", "getPublicKey", "createPublicKey", "deletePublicKey")); + return fields; + } + } + + public ICryptoKeyPair() + { + } + + public ICryptoKeyPair(final ICryptoKeyPairIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public com.sun.jna.Pointer getObjectInfo() + { + VTable vTable = getVTable(); + com.sun.jna.Pointer result = vTable.getObjectInfo.invoke(this); + return result; + } + + public int loadFromFile(String fileName) + { + VTable vTable = getVTable(); + int result = vTable.loadFromFile.invoke(this, fileName); + return result; + } + + public int loadFromBuffer(com.sun.jna.Pointer buffer, int length) + { + VTable vTable = getVTable(); + int result = vTable.loadFromBuffer.invoke(this, buffer, length); + return result; + } + + public int loadFromRepository(ICryptoRepository repository, String name) + { + VTable vTable = getVTable(); + int result = vTable.loadFromRepository.invoke(this, repository, name); + return result; + } + + public int loadFromCurrentRepository() + { + VTable vTable = getVTable(); + int result = vTable.loadFromCurrentRepository.invoke(this); + return result; + } + + public int saveToFile(String fileName) + { + VTable vTable = getVTable(); + int result = vTable.saveToFile.invoke(this, fileName); + return result; + } + + public int saveToBuffer(com.sun.jna.Pointer buffer, int length, com.sun.jna.Pointer realLength) + { + VTable vTable = getVTable(); + int result = vTable.saveToBuffer.invoke(this, buffer, length, realLength); + return result; + } + + public int saveToRepository(ICryptoRepository repository, String name) + { + VTable vTable = getVTable(); + int result = vTable.saveToRepository.invoke(this, repository, name); + return result; + } + + public int setAgreeKeyFromRepository(ICryptoRepository repository) + { + VTable vTable = getVTable(); + int result = vTable.setAgreeKeyFromRepository.invoke(this, repository); + return result; + } + + public int setExchangeKey(ICryptoKey key) + { + VTable vTable = getVTable(); + int result = vTable.setExchangeKey.invoke(this, key); + return result; + } + + public int generateKeyPair() + { + VTable vTable = getVTable(); + int result = vTable.generateKeyPair.invoke(this); + return result; + } + + public int getPublicKey(ICryptoKey key) + { + VTable vTable = getVTable(); + int result = vTable.getPublicKey.invoke(this, key); + return result; + } + + public int createPublicKey(ICryptoKey[] key) + { + VTable vTable = getVTable(); + int result = vTable.createPublicKey.invoke(this, key); + return result; + } + + public int deletePublicKey(ICryptoKey key) + { + VTable vTable = getVTable(); + int result = vTable.deletePublicKey.invoke(this, key); + return result; + } + } + + public static class ICryptoRandomFactory extends IVersioned implements ICryptoRandomFactoryIntf + { + public static class VTable extends IVersioned.VTable + { + public static interface Callback_getObjectInfo extends com.sun.jna.Callback + { + public com.sun.jna.Pointer invoke(ICryptoRandomFactory self); + } + + public static interface Callback_generateRandom extends com.sun.jna.Callback + { + public int invoke(ICryptoRandomFactory self, byte[] buffer, int length, ICryptoProvider providerName); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final ICryptoRandomFactoryIntf obj) + { + super(obj); + + getObjectInfo = new Callback_getObjectInfo() { + @Override + public com.sun.jna.Pointer invoke(ICryptoRandomFactory self) + { + return obj.getObjectInfo(); + } + }; + + generateRandom = new Callback_generateRandom() { + @Override + public int invoke(ICryptoRandomFactory self, byte[] buffer, int length, ICryptoProvider providerName) + { + return obj.generateRandom(buffer, length, providerName); + } + }; + } + + public VTable() + { + } + + public Callback_getObjectInfo getObjectInfo; + public Callback_generateRandom generateRandom; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("getObjectInfo", "generateRandom")); + return fields; + } + } + + public ICryptoRandomFactory() + { + } + + public ICryptoRandomFactory(final ICryptoRandomFactoryIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public com.sun.jna.Pointer getObjectInfo() + { + VTable vTable = getVTable(); + com.sun.jna.Pointer result = vTable.getObjectInfo.invoke(this); + return result; + } + + public int generateRandom(byte[] buffer, int length, ICryptoProvider providerName) + { + VTable vTable = getVTable(); + int result = vTable.generateRandom.invoke(this, buffer, length, providerName); + return result; + } + } + + public static class ICryptoHashFactory extends IVersioned implements ICryptoHashFactoryIntf + { + public static class VTable extends IVersioned.VTable + { + public static interface Callback_getObjectInfo extends com.sun.jna.Callback + { + public com.sun.jna.Pointer invoke(ICryptoHashFactory self); + } + + public static interface Callback_createHash extends com.sun.jna.Callback + { + public int invoke(ICryptoHashFactory self, byte[] buffer, int bufferLength, byte[] hash, int hashLength, com.sun.jna.Pointer realHashLength, boolean asString); + } + + public static interface Callback_setKeyForHash extends com.sun.jna.Callback + { + public int invoke(ICryptoHashFactory self, ICryptoKey key); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final ICryptoHashFactoryIntf obj) + { + super(obj); + + getObjectInfo = new Callback_getObjectInfo() { + @Override + public com.sun.jna.Pointer invoke(ICryptoHashFactory self) + { + return obj.getObjectInfo(); + } + }; + + createHash = new Callback_createHash() { + @Override + public int invoke(ICryptoHashFactory self, byte[] buffer, int bufferLength, byte[] hash, int hashLength, com.sun.jna.Pointer realHashLength, boolean asString) + { + return obj.createHash(buffer, bufferLength, hash, hashLength, realHashLength, asString); + } + }; + + setKeyForHash = new Callback_setKeyForHash() { + @Override + public int invoke(ICryptoHashFactory self, ICryptoKey key) + { + return obj.setKeyForHash(key); + } + }; + } + + public VTable() + { + } + + public Callback_getObjectInfo getObjectInfo; + public Callback_createHash createHash; + public Callback_setKeyForHash setKeyForHash; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("getObjectInfo", "createHash", "setKeyForHash")); + return fields; + } + } + + public ICryptoHashFactory() + { + } + + public ICryptoHashFactory(final ICryptoHashFactoryIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public com.sun.jna.Pointer getObjectInfo() + { + VTable vTable = getVTable(); + com.sun.jna.Pointer result = vTable.getObjectInfo.invoke(this); + return result; + } + + public int createHash(byte[] buffer, int bufferLength, byte[] hash, int hashLength, com.sun.jna.Pointer realHashLength, boolean asString) + { + VTable vTable = getVTable(); + int result = vTable.createHash.invoke(this, buffer, bufferLength, hash, hashLength, realHashLength, asString); + return result; + } + + public int setKeyForHash(ICryptoKey key) + { + VTable vTable = getVTable(); + int result = vTable.setKeyForHash.invoke(this, key); + return result; + } + } + + public static class ICryptoSymmetricFactory extends IVersioned implements ICryptoSymmetricFactoryIntf + { + public static class VTable extends IVersioned.VTable + { + public static interface Callback_getObjectInfo extends com.sun.jna.Callback + { + public com.sun.jna.Pointer invoke(ICryptoSymmetricFactory self); + } + + public static interface Callback_encrypt extends com.sun.jna.Callback + { + public int invoke(ICryptoSymmetricFactory self, byte[] data, int dataLength, byte[] cryptData, int cryptDataLength, com.sun.jna.Pointer realCryptDataLength, ICryptoKey key); + } + + public static interface Callback_decrypt extends com.sun.jna.Callback + { + public int invoke(ICryptoSymmetricFactory self, byte[] cryptData, int cryptDataLength, byte[] data, int dataLength, com.sun.jna.Pointer realDataLength, ICryptoKey key); + } + + public static interface Callback_createKey extends com.sun.jna.Callback + { + public int invoke(ICryptoSymmetricFactory self, ICryptoRepository repository, ICryptoKey[] key); + } + + public static interface Callback_deleteKey extends com.sun.jna.Callback + { + public int invoke(ICryptoSymmetricFactory self, ICryptoKey key); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final ICryptoSymmetricFactoryIntf obj) + { + super(obj); + + getObjectInfo = new Callback_getObjectInfo() { + @Override + public com.sun.jna.Pointer invoke(ICryptoSymmetricFactory self) + { + return obj.getObjectInfo(); + } + }; + + encrypt = new Callback_encrypt() { + @Override + public int invoke(ICryptoSymmetricFactory self, byte[] data, int dataLength, byte[] cryptData, int cryptDataLength, com.sun.jna.Pointer realCryptDataLength, ICryptoKey key) + { + return obj.encrypt(data, dataLength, cryptData, cryptDataLength, realCryptDataLength, key); + } + }; + + decrypt = new Callback_decrypt() { + @Override + public int invoke(ICryptoSymmetricFactory self, byte[] cryptData, int cryptDataLength, byte[] data, int dataLength, com.sun.jna.Pointer realDataLength, ICryptoKey key) + { + return obj.decrypt(cryptData, cryptDataLength, data, dataLength, realDataLength, key); + } + }; + + createKey = new Callback_createKey() { + @Override + public int invoke(ICryptoSymmetricFactory self, ICryptoRepository repository, ICryptoKey[] key) + { + return obj.createKey(repository, key); + } + }; + + deleteKey = new Callback_deleteKey() { + @Override + public int invoke(ICryptoSymmetricFactory self, ICryptoKey key) + { + return obj.deleteKey(key); + } + }; + } + + public VTable() + { + } + + public Callback_getObjectInfo getObjectInfo; + public Callback_encrypt encrypt; + public Callback_decrypt decrypt; + public Callback_createKey createKey; + public Callback_deleteKey deleteKey; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("getObjectInfo", "encrypt", "decrypt", "createKey", "deleteKey")); + return fields; + } + } + + public ICryptoSymmetricFactory() + { + } + + public ICryptoSymmetricFactory(final ICryptoSymmetricFactoryIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public com.sun.jna.Pointer getObjectInfo() + { + VTable vTable = getVTable(); + com.sun.jna.Pointer result = vTable.getObjectInfo.invoke(this); + return result; + } + + public int encrypt(byte[] data, int dataLength, byte[] cryptData, int cryptDataLength, com.sun.jna.Pointer realCryptDataLength, ICryptoKey key) + { + VTable vTable = getVTable(); + int result = vTable.encrypt.invoke(this, data, dataLength, cryptData, cryptDataLength, realCryptDataLength, key); + return result; + } + + public int decrypt(byte[] cryptData, int cryptDataLength, byte[] data, int dataLength, com.sun.jna.Pointer realDataLength, ICryptoKey key) + { + VTable vTable = getVTable(); + int result = vTable.decrypt.invoke(this, cryptData, cryptDataLength, data, dataLength, realDataLength, key); + return result; + } + + public int createKey(ICryptoRepository repository, ICryptoKey[] key) + { + VTable vTable = getVTable(); + int result = vTable.createKey.invoke(this, repository, key); + return result; + } + + public int deleteKey(ICryptoKey key) + { + VTable vTable = getVTable(); + int result = vTable.deleteKey.invoke(this, key); + return result; + } + } + + public static class ICryptoSignatureFactory extends IVersioned implements ICryptoSignatureFactoryIntf + { + public static class VTable extends IVersioned.VTable + { + public static interface Callback_getObjectInfo extends com.sun.jna.Callback + { + public com.sun.jna.Pointer invoke(ICryptoSignatureFactory self); + } + + public static interface Callback_createKeyPair extends com.sun.jna.Callback + { + public int invoke(ICryptoSignatureFactory self, ICryptoRepository repository, ICryptoKeyPair[] key); + } + + public static interface Callback_deleteKeyPair extends com.sun.jna.Callback + { + public int invoke(ICryptoSignatureFactory self, ICryptoKeyPair keyPair); + } + + public static interface Callback_sign extends com.sun.jna.Callback + { + public int invoke(ICryptoSignatureFactory self, byte[] data, int dataLength, ICryptoSignature signature, ICryptoKeyPair privateKey); + } + + public static interface Callback_verifySign extends com.sun.jna.Callback + { + public int invoke(ICryptoSignatureFactory self, byte[] data, int dataLength, ICryptoSignature signature, ICryptoKey publicKey); + } + + public static interface Callback_createSignature extends com.sun.jna.Callback + { + public int invoke(ICryptoSignatureFactory self, ICryptoSignature[] signature); + } + + public static interface Callback_deleteSignature extends com.sun.jna.Callback + { + public int invoke(ICryptoSignatureFactory self, ICryptoSignature signature); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final ICryptoSignatureFactoryIntf obj) + { + super(obj); + + getObjectInfo = new Callback_getObjectInfo() { + @Override + public com.sun.jna.Pointer invoke(ICryptoSignatureFactory self) + { + return obj.getObjectInfo(); + } + }; + + createKeyPair = new Callback_createKeyPair() { + @Override + public int invoke(ICryptoSignatureFactory self, ICryptoRepository repository, ICryptoKeyPair[] key) + { + return obj.createKeyPair(repository, key); + } + }; + + deleteKeyPair = new Callback_deleteKeyPair() { + @Override + public int invoke(ICryptoSignatureFactory self, ICryptoKeyPair keyPair) + { + return obj.deleteKeyPair(keyPair); + } + }; + + sign = new Callback_sign() { + @Override + public int invoke(ICryptoSignatureFactory self, byte[] data, int dataLength, ICryptoSignature signature, ICryptoKeyPair privateKey) + { + return obj.sign(data, dataLength, signature, privateKey); + } + }; + + verifySign = new Callback_verifySign() { + @Override + public int invoke(ICryptoSignatureFactory self, byte[] data, int dataLength, ICryptoSignature signature, ICryptoKey publicKey) + { + return obj.verifySign(data, dataLength, signature, publicKey); + } + }; + + createSignature = new Callback_createSignature() { + @Override + public int invoke(ICryptoSignatureFactory self, ICryptoSignature[] signature) + { + return obj.createSignature(signature); + } + }; + + deleteSignature = new Callback_deleteSignature() { + @Override + public int invoke(ICryptoSignatureFactory self, ICryptoSignature signature) + { + return obj.deleteSignature(signature); + } + }; + } + + public VTable() + { + } + + public Callback_getObjectInfo getObjectInfo; + public Callback_createKeyPair createKeyPair; + public Callback_deleteKeyPair deleteKeyPair; + public Callback_sign sign; + public Callback_verifySign verifySign; + public Callback_createSignature createSignature; + public Callback_deleteSignature deleteSignature; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("getObjectInfo", "createKeyPair", "deleteKeyPair", "sign", "verifySign", "createSignature", "deleteSignature")); + return fields; + } + } + + public ICryptoSignatureFactory() + { + } + + public ICryptoSignatureFactory(final ICryptoSignatureFactoryIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public com.sun.jna.Pointer getObjectInfo() + { + VTable vTable = getVTable(); + com.sun.jna.Pointer result = vTable.getObjectInfo.invoke(this); + return result; + } + + public int createKeyPair(ICryptoRepository repository, ICryptoKeyPair[] key) + { + VTable vTable = getVTable(); + int result = vTable.createKeyPair.invoke(this, repository, key); + return result; + } + + public int deleteKeyPair(ICryptoKeyPair keyPair) + { + VTable vTable = getVTable(); + int result = vTable.deleteKeyPair.invoke(this, keyPair); + return result; + } + + public int sign(byte[] data, int dataLength, ICryptoSignature signature, ICryptoKeyPair privateKey) + { + VTable vTable = getVTable(); + int result = vTable.sign.invoke(this, data, dataLength, signature, privateKey); + return result; + } + + public int verifySign(byte[] data, int dataLength, ICryptoSignature signature, ICryptoKey publicKey) + { + VTable vTable = getVTable(); + int result = vTable.verifySign.invoke(this, data, dataLength, signature, publicKey); + return result; + } + + public int createSignature(ICryptoSignature[] signature) + { + VTable vTable = getVTable(); + int result = vTable.createSignature.invoke(this, signature); + return result; + } + + public int deleteSignature(ICryptoSignature signature) + { + VTable vTable = getVTable(); + int result = vTable.deleteSignature.invoke(this, signature); + return result; + } + } + + public static class ICryptoSignature extends IVersioned implements ICryptoSignatureIntf + { + public static class VTable extends IVersioned.VTable + { + public static interface Callback_getObjectInfo extends com.sun.jna.Callback + { + public com.sun.jna.Pointer invoke(ICryptoSignature self); + } + + public static interface Callback_saveToFile extends com.sun.jna.Callback + { + public int invoke(ICryptoSignature self, String fileName); + } + + public static interface Callback_saveToBuffer extends com.sun.jna.Callback + { + public int invoke(ICryptoSignature self, com.sun.jna.Pointer buffer, int length, com.sun.jna.Pointer realLength); + } + + public static interface Callback_loadFromFile extends com.sun.jna.Callback + { + public int invoke(ICryptoSignature self, String fileName); + } + + public static interface Callback_loadFromBuffer extends com.sun.jna.Callback + { + public int invoke(ICryptoSignature self, com.sun.jna.Pointer buffer, int length); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final ICryptoSignatureIntf obj) + { + super(obj); + + getObjectInfo = new Callback_getObjectInfo() { + @Override + public com.sun.jna.Pointer invoke(ICryptoSignature self) + { + return obj.getObjectInfo(); + } + }; + + saveToFile = new Callback_saveToFile() { + @Override + public int invoke(ICryptoSignature self, String fileName) + { + return obj.saveToFile(fileName); + } + }; + + saveToBuffer = new Callback_saveToBuffer() { + @Override + public int invoke(ICryptoSignature self, com.sun.jna.Pointer buffer, int length, com.sun.jna.Pointer realLength) + { + return obj.saveToBuffer(buffer, length, realLength); + } + }; + + loadFromFile = new Callback_loadFromFile() { + @Override + public int invoke(ICryptoSignature self, String fileName) + { + return obj.loadFromFile(fileName); + } + }; + + loadFromBuffer = new Callback_loadFromBuffer() { + @Override + public int invoke(ICryptoSignature self, com.sun.jna.Pointer buffer, int length) + { + return obj.loadFromBuffer(buffer, length); + } + }; + } + + public VTable() + { + } + + public Callback_getObjectInfo getObjectInfo; + public Callback_saveToFile saveToFile; + public Callback_saveToBuffer saveToBuffer; + public Callback_loadFromFile loadFromFile; + public Callback_loadFromBuffer loadFromBuffer; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("getObjectInfo", "saveToFile", "saveToBuffer", "loadFromFile", "loadFromBuffer")); + return fields; + } + } + + public ICryptoSignature() + { + } + + public ICryptoSignature(final ICryptoSignatureIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public com.sun.jna.Pointer getObjectInfo() + { + VTable vTable = getVTable(); + com.sun.jna.Pointer result = vTable.getObjectInfo.invoke(this); + return result; + } + + public int saveToFile(String fileName) + { + VTable vTable = getVTable(); + int result = vTable.saveToFile.invoke(this, fileName); + return result; + } + + public int saveToBuffer(com.sun.jna.Pointer buffer, int length, com.sun.jna.Pointer realLength) + { + VTable vTable = getVTable(); + int result = vTable.saveToBuffer.invoke(this, buffer, length, realLength); + return result; + } + + public int loadFromFile(String fileName) + { + VTable vTable = getVTable(); + int result = vTable.loadFromFile.invoke(this, fileName); + return result; + } + + public int loadFromBuffer(com.sun.jna.Pointer buffer, int length) + { + VTable vTable = getVTable(); + int result = vTable.loadFromBuffer.invoke(this, buffer, length); + return result; + } + } + + public static class ICryptoCertificateFactory extends IVersioned implements ICryptoCertificateFactoryIntf + { + public static class VTable extends IVersioned.VTable + { + public static interface Callback_getObjectInfo extends com.sun.jna.Callback + { + public com.sun.jna.Pointer invoke(ICryptoCertificateFactory self); + } + + public static interface Callback_createCertificate extends com.sun.jna.Callback + { + public int invoke(ICryptoCertificateFactory self, ICryptoRepository repository, ICryptoCertificate[] certificate); + } + + public static interface Callback_deleteCertificate extends com.sun.jna.Callback + { + public int invoke(ICryptoCertificateFactory self, ICryptoCertificate certificate); + } + + public static interface Callback_encrypt extends com.sun.jna.Callback + { + public int invoke(ICryptoCertificateFactory self, byte[] data, int dataLength, byte[] cryptData, int cryptDataLength, com.sun.jna.Pointer realCryptDataLength, ICryptoCertificate certificate); + } + + public static interface Callback_decrypt extends com.sun.jna.Callback + { + public int invoke(ICryptoCertificateFactory self, byte[] cryptData, int cryptDataLength, byte[] data, int dataLength, com.sun.jna.Pointer realDataLength, ICryptoRepository repository); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final ICryptoCertificateFactoryIntf obj) + { + super(obj); + + getObjectInfo = new Callback_getObjectInfo() { + @Override + public com.sun.jna.Pointer invoke(ICryptoCertificateFactory self) + { + return obj.getObjectInfo(); + } + }; + + createCertificate = new Callback_createCertificate() { + @Override + public int invoke(ICryptoCertificateFactory self, ICryptoRepository repository, ICryptoCertificate[] certificate) + { + return obj.createCertificate(repository, certificate); + } + }; + + deleteCertificate = new Callback_deleteCertificate() { + @Override + public int invoke(ICryptoCertificateFactory self, ICryptoCertificate certificate) + { + return obj.deleteCertificate(certificate); + } + }; + + encrypt = new Callback_encrypt() { + @Override + public int invoke(ICryptoCertificateFactory self, byte[] data, int dataLength, byte[] cryptData, int cryptDataLength, com.sun.jna.Pointer realCryptDataLength, ICryptoCertificate certificate) + { + return obj.encrypt(data, dataLength, cryptData, cryptDataLength, realCryptDataLength, certificate); + } + }; + + decrypt = new Callback_decrypt() { + @Override + public int invoke(ICryptoCertificateFactory self, byte[] cryptData, int cryptDataLength, byte[] data, int dataLength, com.sun.jna.Pointer realDataLength, ICryptoRepository repository) + { + return obj.decrypt(cryptData, cryptDataLength, data, dataLength, realDataLength, repository); + } + }; + } + + public VTable() + { + } + + public Callback_getObjectInfo getObjectInfo; + public Callback_createCertificate createCertificate; + public Callback_deleteCertificate deleteCertificate; + public Callback_encrypt encrypt; + public Callback_decrypt decrypt; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("getObjectInfo", "createCertificate", "deleteCertificate", "encrypt", "decrypt")); + return fields; + } + } + + public ICryptoCertificateFactory() + { + } + + public ICryptoCertificateFactory(final ICryptoCertificateFactoryIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public com.sun.jna.Pointer getObjectInfo() + { + VTable vTable = getVTable(); + com.sun.jna.Pointer result = vTable.getObjectInfo.invoke(this); + return result; + } + + public int createCertificate(ICryptoRepository repository, ICryptoCertificate[] certificate) + { + VTable vTable = getVTable(); + int result = vTable.createCertificate.invoke(this, repository, certificate); + return result; + } + + public int deleteCertificate(ICryptoCertificate certificate) + { + VTable vTable = getVTable(); + int result = vTable.deleteCertificate.invoke(this, certificate); + return result; + } + + public int encrypt(byte[] data, int dataLength, byte[] cryptData, int cryptDataLength, com.sun.jna.Pointer realCryptDataLength, ICryptoCertificate certificate) + { + VTable vTable = getVTable(); + int result = vTable.encrypt.invoke(this, data, dataLength, cryptData, cryptDataLength, realCryptDataLength, certificate); + return result; + } + + public int decrypt(byte[] cryptData, int cryptDataLength, byte[] data, int dataLength, com.sun.jna.Pointer realDataLength, ICryptoRepository repository) + { + VTable vTable = getVTable(); + int result = vTable.decrypt.invoke(this, cryptData, cryptDataLength, data, dataLength, realDataLength, repository); + return result; + } + } + + public static class ICryptoCertificate extends IVersioned implements ICryptoCertificateIntf + { + public static class VTable extends IVersioned.VTable + { + public static interface Callback_getObjectInfo extends com.sun.jna.Callback + { + public com.sun.jna.Pointer invoke(ICryptoCertificate self); + } + + public static interface Callback_loadFromFile extends com.sun.jna.Callback + { + public int invoke(ICryptoCertificate self, String fileName); + } + + public static interface Callback_loadFromBuffer extends com.sun.jna.Callback + { + public int invoke(ICryptoCertificate self, com.sun.jna.Pointer buffer, int length); + } + + public static interface Callback_loadFromBinaryBuffer extends com.sun.jna.Callback + { + public int invoke(ICryptoCertificate self, com.sun.jna.Pointer buffer, int length); + } + + public static interface Callback_loadFromRepository extends com.sun.jna.Callback + { + public int invoke(ICryptoCertificate self, ICryptoRepository repository, String name); + } + + public static interface Callback_saveToFile extends com.sun.jna.Callback + { + public int invoke(ICryptoCertificate self, String fileName); + } + + public static interface Callback_saveToBuffer extends com.sun.jna.Callback + { + public int invoke(ICryptoCertificate self, com.sun.jna.Pointer buffer, int length, com.sun.jna.Pointer realLength); + } + + public static interface Callback_saveToBinaryBuffer extends com.sun.jna.Callback + { + public int invoke(ICryptoCertificate self, com.sun.jna.Pointer buffer, int length, com.sun.jna.Pointer realLength); + } + + public static interface Callback_verifyCertificate extends com.sun.jna.Callback + { + public int invoke(ICryptoCertificate self, ICryptoCertificate certificate); + } + + public static interface Callback_getId extends com.sun.jna.Callback + { + public int invoke(ICryptoCertificate self, byte[] id, com.sun.jna.Pointer length); + } + + public static interface Callback_getIssuerName extends com.sun.jna.Callback + { + public int invoke(ICryptoCertificate self, byte[] issuerName, com.sun.jna.Pointer length); + } + + public static interface Callback_getPublicKey extends com.sun.jna.Callback + { + public int invoke(ICryptoCertificate self, ICryptoKey key); + } + + public static interface Callback_getPublicKeyMethod extends com.sun.jna.Callback + { + public int invoke(ICryptoCertificate self, com.sun.jna.Pointer method, com.sun.jna.Pointer length); + } + + public static interface Callback_createPublicKeyFromCertificate extends com.sun.jna.Callback + { + public int invoke(ICryptoCertificate self, ICryptoRepository repository, ICryptoKey[] key); + } + + public static interface Callback_deleteCertificatePublicKey extends com.sun.jna.Callback + { + public int invoke(ICryptoCertificate self, ICryptoKey key); + } + + public static interface Callback_getSerialNumber extends com.sun.jna.Callback + { + public int invoke(ICryptoCertificate self, byte[] serialNumber, com.sun.jna.Pointer length); + } + + public static interface Callback_getOwnerName extends com.sun.jna.Callback + { + public int invoke(ICryptoCertificate self, com.sun.jna.Pointer ownerName, com.sun.jna.Pointer length, String user_dn); + } + + public static interface Callback_getKeyContainer extends com.sun.jna.Callback + { + public int invoke(ICryptoCertificate self, com.sun.jna.Pointer container, com.sun.jna.Pointer length); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final ICryptoCertificateIntf obj) + { + super(obj); + + getObjectInfo = new Callback_getObjectInfo() { + @Override + public com.sun.jna.Pointer invoke(ICryptoCertificate self) + { + return obj.getObjectInfo(); + } + }; + + loadFromFile = new Callback_loadFromFile() { + @Override + public int invoke(ICryptoCertificate self, String fileName) + { + return obj.loadFromFile(fileName); + } + }; + + loadFromBuffer = new Callback_loadFromBuffer() { + @Override + public int invoke(ICryptoCertificate self, com.sun.jna.Pointer buffer, int length) + { + return obj.loadFromBuffer(buffer, length); + } + }; + + loadFromBinaryBuffer = new Callback_loadFromBinaryBuffer() { + @Override + public int invoke(ICryptoCertificate self, com.sun.jna.Pointer buffer, int length) + { + return obj.loadFromBinaryBuffer(buffer, length); + } + }; + + loadFromRepository = new Callback_loadFromRepository() { + @Override + public int invoke(ICryptoCertificate self, ICryptoRepository repository, String name) + { + return obj.loadFromRepository(repository, name); + } + }; + + saveToFile = new Callback_saveToFile() { + @Override + public int invoke(ICryptoCertificate self, String fileName) + { + return obj.saveToFile(fileName); + } + }; + + saveToBuffer = new Callback_saveToBuffer() { + @Override + public int invoke(ICryptoCertificate self, com.sun.jna.Pointer buffer, int length, com.sun.jna.Pointer realLength) + { + return obj.saveToBuffer(buffer, length, realLength); + } + }; + + saveToBinaryBuffer = new Callback_saveToBinaryBuffer() { + @Override + public int invoke(ICryptoCertificate self, com.sun.jna.Pointer buffer, int length, com.sun.jna.Pointer realLength) + { + return obj.saveToBinaryBuffer(buffer, length, realLength); + } + }; + + verifyCertificate = new Callback_verifyCertificate() { + @Override + public int invoke(ICryptoCertificate self, ICryptoCertificate certificate) + { + return obj.verifyCertificate(certificate); + } + }; + + getId = new Callback_getId() { + @Override + public int invoke(ICryptoCertificate self, byte[] id, com.sun.jna.Pointer length) + { + return obj.getId(id, length); + } + }; + + getIssuerName = new Callback_getIssuerName() { + @Override + public int invoke(ICryptoCertificate self, byte[] issuerName, com.sun.jna.Pointer length) + { + return obj.getIssuerName(issuerName, length); + } + }; + + getPublicKey = new Callback_getPublicKey() { + @Override + public int invoke(ICryptoCertificate self, ICryptoKey key) + { + return obj.getPublicKey(key); + } + }; + + getPublicKeyMethod = new Callback_getPublicKeyMethod() { + @Override + public int invoke(ICryptoCertificate self, com.sun.jna.Pointer method, com.sun.jna.Pointer length) + { + return obj.getPublicKeyMethod(method, length); + } + }; + + createPublicKeyFromCertificate = new Callback_createPublicKeyFromCertificate() { + @Override + public int invoke(ICryptoCertificate self, ICryptoRepository repository, ICryptoKey[] key) + { + return obj.createPublicKeyFromCertificate(repository, key); + } + }; + + deleteCertificatePublicKey = new Callback_deleteCertificatePublicKey() { + @Override + public int invoke(ICryptoCertificate self, ICryptoKey key) + { + return obj.deleteCertificatePublicKey(key); + } + }; + + getSerialNumber = new Callback_getSerialNumber() { + @Override + public int invoke(ICryptoCertificate self, byte[] serialNumber, com.sun.jna.Pointer length) + { + return obj.getSerialNumber(serialNumber, length); + } + }; + + getOwnerName = new Callback_getOwnerName() { + @Override + public int invoke(ICryptoCertificate self, com.sun.jna.Pointer ownerName, com.sun.jna.Pointer length, String user_dn) + { + return obj.getOwnerName(ownerName, length, user_dn); + } + }; + + getKeyContainer = new Callback_getKeyContainer() { + @Override + public int invoke(ICryptoCertificate self, com.sun.jna.Pointer container, com.sun.jna.Pointer length) + { + return obj.getKeyContainer(container, length); + } + }; + } + + public VTable() + { + } + + public Callback_getObjectInfo getObjectInfo; + public Callback_loadFromFile loadFromFile; + public Callback_loadFromBuffer loadFromBuffer; + public Callback_loadFromBinaryBuffer loadFromBinaryBuffer; + public Callback_loadFromRepository loadFromRepository; + public Callback_saveToFile saveToFile; + public Callback_saveToBuffer saveToBuffer; + public Callback_saveToBinaryBuffer saveToBinaryBuffer; + public Callback_verifyCertificate verifyCertificate; + public Callback_getId getId; + public Callback_getIssuerName getIssuerName; + public Callback_getPublicKey getPublicKey; + public Callback_getPublicKeyMethod getPublicKeyMethod; + public Callback_createPublicKeyFromCertificate createPublicKeyFromCertificate; + public Callback_deleteCertificatePublicKey deleteCertificatePublicKey; + public Callback_getSerialNumber getSerialNumber; + public Callback_getOwnerName getOwnerName; + public Callback_getKeyContainer getKeyContainer; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("getObjectInfo", "loadFromFile", "loadFromBuffer", "loadFromBinaryBuffer", "loadFromRepository", "saveToFile", "saveToBuffer", "saveToBinaryBuffer", "verifyCertificate", "getId", "getIssuerName", "getPublicKey", "getPublicKeyMethod", "createPublicKeyFromCertificate", "deleteCertificatePublicKey", "getSerialNumber", "getOwnerName", "getKeyContainer")); + return fields; + } + } + + public ICryptoCertificate() + { + } + + public ICryptoCertificate(final ICryptoCertificateIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public com.sun.jna.Pointer getObjectInfo() + { + VTable vTable = getVTable(); + com.sun.jna.Pointer result = vTable.getObjectInfo.invoke(this); + return result; + } + + public int loadFromFile(String fileName) + { + VTable vTable = getVTable(); + int result = vTable.loadFromFile.invoke(this, fileName); + return result; + } + + public int loadFromBuffer(com.sun.jna.Pointer buffer, int length) + { + VTable vTable = getVTable(); + int result = vTable.loadFromBuffer.invoke(this, buffer, length); + return result; + } + + public int loadFromBinaryBuffer(com.sun.jna.Pointer buffer, int length) + { + VTable vTable = getVTable(); + int result = vTable.loadFromBinaryBuffer.invoke(this, buffer, length); + return result; + } + + public int loadFromRepository(ICryptoRepository repository, String name) + { + VTable vTable = getVTable(); + int result = vTable.loadFromRepository.invoke(this, repository, name); + return result; + } + + public int saveToFile(String fileName) + { + VTable vTable = getVTable(); + int result = vTable.saveToFile.invoke(this, fileName); + return result; + } + + public int saveToBuffer(com.sun.jna.Pointer buffer, int length, com.sun.jna.Pointer realLength) + { + VTable vTable = getVTable(); + int result = vTable.saveToBuffer.invoke(this, buffer, length, realLength); + return result; + } + + public int saveToBinaryBuffer(com.sun.jna.Pointer buffer, int length, com.sun.jna.Pointer realLength) + { + VTable vTable = getVTable(); + int result = vTable.saveToBinaryBuffer.invoke(this, buffer, length, realLength); + return result; + } + + public int verifyCertificate(ICryptoCertificate certificate) + { + VTable vTable = getVTable(); + int result = vTable.verifyCertificate.invoke(this, certificate); + return result; + } + + public int getId(byte[] id, com.sun.jna.Pointer length) + { + VTable vTable = getVTable(); + int result = vTable.getId.invoke(this, id, length); + return result; + } + + public int getIssuerName(byte[] issuerName, com.sun.jna.Pointer length) + { + VTable vTable = getVTable(); + int result = vTable.getIssuerName.invoke(this, issuerName, length); + return result; + } + + public int getPublicKey(ICryptoKey key) + { + VTable vTable = getVTable(); + int result = vTable.getPublicKey.invoke(this, key); + return result; + } + + public int getPublicKeyMethod(com.sun.jna.Pointer method, com.sun.jna.Pointer length) + { + VTable vTable = getVTable(); + int result = vTable.getPublicKeyMethod.invoke(this, method, length); + return result; + } + + public int createPublicKeyFromCertificate(ICryptoRepository repository, ICryptoKey[] key) + { + VTable vTable = getVTable(); + int result = vTable.createPublicKeyFromCertificate.invoke(this, repository, key); + return result; + } + + public int deleteCertificatePublicKey(ICryptoKey key) + { + VTable vTable = getVTable(); + int result = vTable.deleteCertificatePublicKey.invoke(this, key); + return result; + } + + public int getSerialNumber(byte[] serialNumber, com.sun.jna.Pointer length) + { + VTable vTable = getVTable(); + int result = vTable.getSerialNumber.invoke(this, serialNumber, length); + return result; + } + + public int getOwnerName(com.sun.jna.Pointer ownerName, com.sun.jna.Pointer length, String user_dn) + { + VTable vTable = getVTable(); + int result = vTable.getOwnerName.invoke(this, ownerName, length, user_dn); + return result; + } + + public int getKeyContainer(com.sun.jna.Pointer container, com.sun.jna.Pointer length) + { + VTable vTable = getVTable(); + int result = vTable.getKeyContainer.invoke(this, container, length); + return result; + } + } + + public static class ICryptoRepository extends IVersioned implements ICryptoRepositoryIntf + { + public static class VTable extends IVersioned.VTable + { + public static interface Callback_getObjectInfo extends com.sun.jna.Callback + { + public com.sun.jna.Pointer invoke(ICryptoRepository self); + } + + public static interface Callback_getRepositoryName extends com.sun.jna.Callback + { + public int invoke(ICryptoRepository self, com.sun.jna.Pointer name, int length, com.sun.jna.Pointer realLength); + } + + public static interface Callback_open extends com.sun.jna.Callback + { + public int invoke(ICryptoRepository self, String path, int openMode, int repositoryLocation, int providerType); + } + + public static interface Callback_close extends com.sun.jna.Callback + { + public int invoke(ICryptoRepository self); + } + + public static interface Callback_createPublicKey extends com.sun.jna.Callback + { + public int invoke(ICryptoRepository self, int method, ICryptoKey[] key); + } + + public static interface Callback_getPublicKey extends com.sun.jna.Callback + { + public int invoke(ICryptoRepository self, ICryptoKey key); + } + + public static interface Callback_deletePublicKey extends com.sun.jna.Callback + { + public int invoke(ICryptoRepository self, ICryptoKey key); + } + + public static interface Callback_isOpened extends com.sun.jna.Callback + { + public boolean invoke(ICryptoRepository self); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final ICryptoRepositoryIntf obj) + { + super(obj); + + getObjectInfo = new Callback_getObjectInfo() { + @Override + public com.sun.jna.Pointer invoke(ICryptoRepository self) + { + return obj.getObjectInfo(); + } + }; + + getRepositoryName = new Callback_getRepositoryName() { + @Override + public int invoke(ICryptoRepository self, com.sun.jna.Pointer name, int length, com.sun.jna.Pointer realLength) + { + return obj.getRepositoryName(name, length, realLength); + } + }; + + open = new Callback_open() { + @Override + public int invoke(ICryptoRepository self, String path, int openMode, int repositoryLocation, int providerType) + { + return obj.open(path, openMode, repositoryLocation, providerType); + } + }; + + close = new Callback_close() { + @Override + public int invoke(ICryptoRepository self) + { + return obj.close(); + } + }; + + createPublicKey = new Callback_createPublicKey() { + @Override + public int invoke(ICryptoRepository self, int method, ICryptoKey[] key) + { + return obj.createPublicKey(method, key); + } + }; + + getPublicKey = new Callback_getPublicKey() { + @Override + public int invoke(ICryptoRepository self, ICryptoKey key) + { + return obj.getPublicKey(key); + } + }; + + deletePublicKey = new Callback_deletePublicKey() { + @Override + public int invoke(ICryptoRepository self, ICryptoKey key) + { + return obj.deletePublicKey(key); + } + }; + + isOpened = new Callback_isOpened() { + @Override + public boolean invoke(ICryptoRepository self) + { + return obj.isOpened(); + } + }; + } + + public VTable() + { + } + + public Callback_getObjectInfo getObjectInfo; + public Callback_getRepositoryName getRepositoryName; + public Callback_open open; + public Callback_close close; + public Callback_createPublicKey createPublicKey; + public Callback_getPublicKey getPublicKey; + public Callback_deletePublicKey deletePublicKey; + public Callback_isOpened isOpened; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("getObjectInfo", "getRepositoryName", "open", "close", "createPublicKey", "getPublicKey", "deletePublicKey", "isOpened")); + return fields; + } + } + + public ICryptoRepository() + { + } + + public ICryptoRepository(final ICryptoRepositoryIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public com.sun.jna.Pointer getObjectInfo() + { + VTable vTable = getVTable(); + com.sun.jna.Pointer result = vTable.getObjectInfo.invoke(this); + return result; + } + + public int getRepositoryName(com.sun.jna.Pointer name, int length, com.sun.jna.Pointer realLength) + { + VTable vTable = getVTable(); + int result = vTable.getRepositoryName.invoke(this, name, length, realLength); + return result; + } + + public int open(String path, int openMode, int repositoryLocation, int providerType) + { + VTable vTable = getVTable(); + int result = vTable.open.invoke(this, path, openMode, repositoryLocation, providerType); + return result; + } + + public int close() + { + VTable vTable = getVTable(); + int result = vTable.close.invoke(this); + return result; + } + + public int createPublicKey(int method, ICryptoKey[] key) + { + VTable vTable = getVTable(); + int result = vTable.createPublicKey.invoke(this, method, key); + return result; + } + + public int getPublicKey(ICryptoKey key) + { + VTable vTable = getVTable(); + int result = vTable.getPublicKey.invoke(this, key); + return result; + } + + public int deletePublicKey(ICryptoKey key) + { + VTable vTable = getVTable(); + int result = vTable.deletePublicKey.invoke(this, key); + return result; + } + + public boolean isOpened() + { + VTable vTable = getVTable(); + boolean result = vTable.isOpened.invoke(this); + return result; + } + } + + public static class ICryptoProvider extends IVersioned implements ICryptoProviderIntf + { + public static class VTable extends IVersioned.VTable + { + public static interface Callback_getObjectInfo extends com.sun.jna.Callback + { + public com.sun.jna.Pointer invoke(ICryptoProvider self); + } + + public static interface Callback_createRepository extends com.sun.jna.Callback + { + public int invoke(ICryptoProvider self, ICryptoRepository[] repository, int type, String pin); + } + + public static interface Callback_deleteRepository extends com.sun.jna.Callback + { + public int invoke(ICryptoProvider self, ICryptoRepository repository); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final ICryptoProviderIntf obj) + { + super(obj); + + getObjectInfo = new Callback_getObjectInfo() { + @Override + public com.sun.jna.Pointer invoke(ICryptoProvider self) + { + return obj.getObjectInfo(); + } + }; + + createRepository = new Callback_createRepository() { + @Override + public int invoke(ICryptoProvider self, ICryptoRepository[] repository, int type, String pin) + { + return obj.createRepository(repository, type, pin); + } + }; + + deleteRepository = new Callback_deleteRepository() { + @Override + public int invoke(ICryptoProvider self, ICryptoRepository repository) + { + return obj.deleteRepository(repository); + } + }; + } + + public VTable() + { + } + + public Callback_getObjectInfo getObjectInfo; + public Callback_createRepository createRepository; + public Callback_deleteRepository deleteRepository; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("getObjectInfo", "createRepository", "deleteRepository")); + return fields; + } + } + + public ICryptoProvider() + { + } + + public ICryptoProvider(final ICryptoProviderIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public com.sun.jna.Pointer getObjectInfo() + { + VTable vTable = getVTable(); + com.sun.jna.Pointer result = vTable.getObjectInfo.invoke(this); + return result; + } + + public int createRepository(ICryptoRepository[] repository, int type, String pin) + { + VTable vTable = getVTable(); + int result = vTable.createRepository.invoke(this, repository, type, pin); + return result; + } + + public int deleteRepository(ICryptoRepository repository) + { + VTable vTable = getVTable(); + int result = vTable.deleteRepository.invoke(this, repository); + return result; + } + } + + public static class IListCryptoObjects extends IVersioned implements IListCryptoObjectsIntf + { + public static class VTable extends IVersioned.VTable + { + public static interface Callback_list extends com.sun.jna.Callback + { + public void invoke(IListCryptoObjects self, CryptoObjectInfo[] objInfo); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IListCryptoObjectsIntf obj) + { + super(obj); + + list = new Callback_list() { + @Override + public void invoke(IListCryptoObjects self, CryptoObjectInfo[] objInfo) + { + obj.list(objInfo); + } + }; + } + + public VTable() + { + } + + public Callback_list list; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("list")); + return fields; + } + } + + public IListCryptoObjects() + { + } + + public IListCryptoObjects(final IListCryptoObjectsIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public void list(CryptoObjectInfo[] objInfo) + { + VTable vTable = getVTable(); + vTable.list.invoke(this, objInfo); + } + } + + public static class ICryptoFactory extends IPluginBase implements ICryptoFactoryIntf + { + public static class VTable extends IPluginBase.VTable + { + public static interface Callback_setTrace extends com.sun.jna.Callback + { + public void invoke(ICryptoFactory self, boolean need); + } + + public static interface Callback_getCryptoProvider extends com.sun.jna.Callback + { + public ICryptoProvider invoke(ICryptoFactory self, CryptoObjectInfo[] objInfo); + } + + public static interface Callback_getCryptoRandomFactory extends com.sun.jna.Callback + { + public ICryptoRandomFactory invoke(ICryptoFactory self, CryptoObjectInfo[] objInfo); + } + + public static interface Callback_getCryptoHashFactory extends com.sun.jna.Callback + { + public ICryptoHashFactory invoke(ICryptoFactory self, CryptoObjectInfo[] objInfo); + } + + public static interface Callback_getCryptoSymmetricFactory extends com.sun.jna.Callback + { + public ICryptoSymmetricFactory invoke(ICryptoFactory self, CryptoObjectInfo[] objInfo); + } + + public static interface Callback_getCryptoSignatureFactory extends com.sun.jna.Callback + { + public ICryptoSignatureFactory invoke(ICryptoFactory self, CryptoObjectInfo[] objInfo); + } + + public static interface Callback_getCryptoCertificateFactory extends com.sun.jna.Callback + { + public ICryptoCertificateFactory invoke(ICryptoFactory self, CryptoObjectInfo[] objInfo); + } + + public static interface Callback_getCryptoObjects extends com.sun.jna.Callback + { + public int invoke(ICryptoFactory self, int type, IListCryptoObjects callback); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final ICryptoFactoryIntf obj) + { + super(obj); + + setTrace = new Callback_setTrace() { + @Override + public void invoke(ICryptoFactory self, boolean need) + { + obj.setTrace(need); + } + }; + + getCryptoProvider = new Callback_getCryptoProvider() { + @Override + public ICryptoProvider invoke(ICryptoFactory self, CryptoObjectInfo[] objInfo) + { + return obj.getCryptoProvider(objInfo); + } + }; + + getCryptoRandomFactory = new Callback_getCryptoRandomFactory() { + @Override + public ICryptoRandomFactory invoke(ICryptoFactory self, CryptoObjectInfo[] objInfo) + { + return obj.getCryptoRandomFactory(objInfo); + } + }; + + getCryptoHashFactory = new Callback_getCryptoHashFactory() { + @Override + public ICryptoHashFactory invoke(ICryptoFactory self, CryptoObjectInfo[] objInfo) + { + return obj.getCryptoHashFactory(objInfo); + } + }; + + getCryptoSymmetricFactory = new Callback_getCryptoSymmetricFactory() { + @Override + public ICryptoSymmetricFactory invoke(ICryptoFactory self, CryptoObjectInfo[] objInfo) + { + return obj.getCryptoSymmetricFactory(objInfo); + } + }; + + getCryptoSignatureFactory = new Callback_getCryptoSignatureFactory() { + @Override + public ICryptoSignatureFactory invoke(ICryptoFactory self, CryptoObjectInfo[] objInfo) + { + return obj.getCryptoSignatureFactory(objInfo); + } + }; + + getCryptoCertificateFactory = new Callback_getCryptoCertificateFactory() { + @Override + public ICryptoCertificateFactory invoke(ICryptoFactory self, CryptoObjectInfo[] objInfo) + { + return obj.getCryptoCertificateFactory(objInfo); + } + }; + + getCryptoObjects = new Callback_getCryptoObjects() { + @Override + public int invoke(ICryptoFactory self, int type, IListCryptoObjects callback) + { + return obj.getCryptoObjects(type, callback); + } + }; + } + + public VTable() + { + } + + public Callback_setTrace setTrace; + public Callback_getCryptoProvider getCryptoProvider; + public Callback_getCryptoRandomFactory getCryptoRandomFactory; + public Callback_getCryptoHashFactory getCryptoHashFactory; + public Callback_getCryptoSymmetricFactory getCryptoSymmetricFactory; + public Callback_getCryptoSignatureFactory getCryptoSignatureFactory; + public Callback_getCryptoCertificateFactory getCryptoCertificateFactory; + public Callback_getCryptoObjects getCryptoObjects; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("setTrace", "getCryptoProvider", "getCryptoRandomFactory", "getCryptoHashFactory", "getCryptoSymmetricFactory", "getCryptoSignatureFactory", "getCryptoCertificateFactory", "getCryptoObjects")); + return fields; + } + } + + public ICryptoFactory() + { + } + + public ICryptoFactory(final ICryptoFactoryIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public void setTrace(boolean need) + { + VTable vTable = getVTable(); + vTable.setTrace.invoke(this, need); + } + + public ICryptoProvider getCryptoProvider(CryptoObjectInfo[] objInfo) + { + VTable vTable = getVTable(); + ICryptoProvider result = vTable.getCryptoProvider.invoke(this, objInfo); + return result; + } + + public ICryptoRandomFactory getCryptoRandomFactory(CryptoObjectInfo[] objInfo) + { + VTable vTable = getVTable(); + ICryptoRandomFactory result = vTable.getCryptoRandomFactory.invoke(this, objInfo); + return result; + } + + public ICryptoHashFactory getCryptoHashFactory(CryptoObjectInfo[] objInfo) + { + VTable vTable = getVTable(); + ICryptoHashFactory result = vTable.getCryptoHashFactory.invoke(this, objInfo); + return result; + } + + public ICryptoSymmetricFactory getCryptoSymmetricFactory(CryptoObjectInfo[] objInfo) + { + VTable vTable = getVTable(); + ICryptoSymmetricFactory result = vTable.getCryptoSymmetricFactory.invoke(this, objInfo); + return result; + } + + public ICryptoSignatureFactory getCryptoSignatureFactory(CryptoObjectInfo[] objInfo) + { + VTable vTable = getVTable(); + ICryptoSignatureFactory result = vTable.getCryptoSignatureFactory.invoke(this, objInfo); + return result; + } + + public ICryptoCertificateFactory getCryptoCertificateFactory(CryptoObjectInfo[] objInfo) + { + VTable vTable = getVTable(); + ICryptoCertificateFactory result = vTable.getCryptoCertificateFactory.invoke(this, objInfo); + return result; + } + + public int getCryptoObjects(int type, IListCryptoObjects callback) + { + VTable vTable = getVTable(); + int result = vTable.getCryptoObjects.invoke(this, type, callback); + return result; + } + } +} diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbInterfaceImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbInterfaceImpl.java new file mode 100644 index 0000000000..6f50bd4c27 --- /dev/null +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbInterfaceImpl.java @@ -0,0 +1,9 @@ +package org.firebirdsql.nativeoo.gds.ng; + +import org.firebirdsql.nativeoo.gds.ng.FbInterface.IMaster; + +public class FbInterfaceImpl { + public static IMaster getMasterInterface() { + return FbOOClientDatabaseFactory.getInstance().getClientLibrary().fb_get_master_interface(); + } +} diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbOOClientDatabaseFactory.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbOOClientDatabaseFactory.java new file mode 100644 index 0000000000..1d9a48b4fa --- /dev/null +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbOOClientDatabaseFactory.java @@ -0,0 +1,37 @@ +package org.firebirdsql.nativeoo.gds.ng; + +import com.sun.jna.Native; +import org.firebirdsql.gds.JaybirdSystemProperties; +import org.firebirdsql.jna.fbclient.FbClientLibrary; + +public class FbOOClientDatabaseFactory extends AbstractNativeOODatabaseFactory { + private static final FbOOClientDatabaseFactory INSTANCE = new FbOOClientDatabaseFactory(); + + @Override + protected FbClientLibrary getClientLibrary() { + return FbOOClientDatabaseFactory.ClientHolder.clientLibrary; + } + + public static FbOOClientDatabaseFactory getInstance() { + return INSTANCE; + } + + /** + * Initialization-on-demand depending on classloading behavior specified in JLS 12.4 + */ + private static final class ClientHolder { + + private static final FbClientLibrary clientLibrary = syncWrapIfNecessary(initClientLibrary()); + + private static FbClientLibrary initClientLibrary() { + return Native.loadLibrary("fbclient", FbInterface.class); + } + + private static FbClientLibrary syncWrapIfNecessary(FbClientLibrary clientLibrary) { + if (JaybirdSystemProperties.isSyncWrapNativeLibrary()) { + return (FbClientLibrary) Native.synchronizedLibrary(clientLibrary); + } + return clientLibrary; + } + } +} diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbOOEmbeddedDatabaseFactory.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbOOEmbeddedDatabaseFactory.java new file mode 100644 index 0000000000..bb76ece7b4 --- /dev/null +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbOOEmbeddedDatabaseFactory.java @@ -0,0 +1,74 @@ +package org.firebirdsql.nativeoo.gds.ng; + +import com.sun.jna.Native; +import org.firebirdsql.gds.JaybirdSystemProperties; +import org.firebirdsql.gds.ng.*; +import org.firebirdsql.jna.fbclient.FbClientLibrary; +import org.firebirdsql.logging.Logger; +import org.firebirdsql.logging.LoggerFactory; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +public class FbOOEmbeddedDatabaseFactory extends AbstractNativeOODatabaseFactory { + + private static final Logger log = LoggerFactory.getLogger(FbOOEmbeddedDatabaseFactory.class); + private static final FbOOEmbeddedDatabaseFactory INSTANCE = new FbOOEmbeddedDatabaseFactory(); + + @Override + protected FbClientLibrary getClientLibrary() { + return ClientHolder.clientLibrary; + } + + @Override + protected > T filterProperties(T attachProperties) { + T attachPropertiesCopy = attachProperties.asNewMutable(); + // Clear server name + attachPropertiesCopy.setServerName(null); + return attachPropertiesCopy; + } + + public static FbOOEmbeddedDatabaseFactory getInstance() { + return INSTANCE; + } + + /** + * Initialization-on-demand depending on classloading behavior specified in JLS 12.4 + */ + private static final class ClientHolder { + + // Note Firebird 3 embedded is fbclient + engine12 + private static final List LIBRARIES_TO_TRY = + Collections.unmodifiableList(Arrays.asList("fbembed", "fbclient")); + + private static final FbClientLibrary clientLibrary = syncWrapIfNecessary(initClientLibrary()); + + private static FbClientLibrary initClientLibrary() { + final List throwables = new ArrayList<>(); + for (String libraryName : LIBRARIES_TO_TRY) { + try { + return Native.loadLibrary(libraryName, FbClientLibrary.class); + } catch (UnsatisfiedLinkError e) { + throwables.add(e); + log.debug("Attempt to load " + libraryName + " failed", e); + // continue with next + } + } + assert throwables.size() == LIBRARIES_TO_TRY.size(); + log.error("Could not load any of the libraries in " + LIBRARIES_TO_TRY + ":"); + for (int idx = 0; idx < LIBRARIES_TO_TRY.size(); idx++) { + log.error("Loading " + LIBRARIES_TO_TRY.get(idx) + " failed", throwables.get(idx)); + } + throw new ExceptionInInitializerError(throwables.get(0)); + } + + private static FbClientLibrary syncWrapIfNecessary(FbClientLibrary clientLibrary) { + if (JaybirdSystemProperties.isSyncWrapNativeLibrary()) { + return (FbClientLibrary) Native.synchronizedLibrary(clientLibrary); + } + return clientLibrary; + } + } +} \ No newline at end of file diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbOOLocalDatabaseFactory.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbOOLocalDatabaseFactory.java new file mode 100644 index 0000000000..e3dd0b73ee --- /dev/null +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbOOLocalDatabaseFactory.java @@ -0,0 +1,26 @@ +package org.firebirdsql.nativeoo.gds.ng; + +import org.firebirdsql.gds.ng.*; +import org.firebirdsql.jna.fbclient.FbClientLibrary; + +public class FbOOLocalDatabaseFactory extends AbstractNativeOODatabaseFactory { + + private static final FbOOLocalDatabaseFactory INSTANCE = new FbOOLocalDatabaseFactory(); + + @Override + protected FbClientLibrary getClientLibrary() { + return FbOOClientDatabaseFactory.getInstance().getClientLibrary(); + } + + @Override + protected > T filterProperties(T attachProperties) { + T attachPropertiesCopy = attachProperties.asNewMutable(); + // Clear server name + attachPropertiesCopy.setServerName(null); + return attachPropertiesCopy; + } + + public static FbOOLocalDatabaseFactory getInstance() { + return INSTANCE; + } +} diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IBatchCompletionStateImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IBatchCompletionStateImpl.java new file mode 100644 index 0000000000..51174a13ea --- /dev/null +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IBatchCompletionStateImpl.java @@ -0,0 +1,112 @@ +package org.firebirdsql.nativeoo.gds.ng; + +import org.firebirdsql.gds.ng.FbBatchCompletionState; +import org.firebirdsql.nativeoo.gds.ng.FbInterface.*; + +/** + * + * @author Vasiliy Yashkov + * @since 4.0 + */ +public class IBatchCompletionStateImpl implements FbBatchCompletionState { + + private IBatchCompletionState state; + private IDatabaseImpl database; + private IUtil util; + private IStatus status; + + public IBatchCompletionStateImpl(IDatabaseImpl database, IBatchCompletionState state, IStatus status) { + this.database = database; + this.state = state; + this.status = status; + } + + @Override + public int getSize() throws FbException { + return state.getSize(status); + } + + @Override + public int getState(int index) throws FbException { + return state.getState(status, index); + } + + @Override + public String getError(int index) throws FbException { + if (state.findError(status, index) != FbBatchCompletionState.NO_MORE_ERRORS) { + StringBuilder builder = new StringBuilder(); + IStatus errorStatus = database.getMaster().getStatus(); + state.getStatus(status, errorStatus, index); + + try (CloseableMemory memory = new CloseableMemory(1024)) { + util.formatStatus(memory, (int) memory.size() - 1, errorStatus); + builder.append(memory.getString(0)); + return builder.toString(); + } + } + return ""; + } + + @Override + public String getAllStates() throws FbException { + + StringBuilder builder = new StringBuilder(); + + boolean print1 = false; + boolean print2 = false; + + util = database.getMaster().getUtilInterface(); + + int updateCount = state.getSize(status); + int unknownCount = 0; + int successCount = 0; + for (int p = 0; p < updateCount; ++p) { + int s = state.getState(status, p); + switch (s) { + case FbBatchCompletionState.EXECUTE_FAILED: + if (!print1) { + builder.append(String.format("Message Status\n", p)); + print1 = true; + } + builder.append(String.format("%5d Execute failed\n", p)); + break; + + case FbBatchCompletionState.SUCCESS_NO_INFO: + ++unknownCount; + break; + + default: + if (!print1) { + builder.append(String.format("Message Status\n", p)); + print1 = true; + } + builder.append(String.format("%5d Updated %d record(s)\n", p, s)); + ++successCount; + break; + } + } + builder.append(String.format("Summary: total=%d success=%d success(but no update info)=%d\n", + updateCount, successCount, unknownCount)); + + IStatus errorStatus = database.getMaster().getStatus(); + for (int p = 0; (p = state.findError(status, p)) != FbBatchCompletionState.NO_MORE_ERRORS; ++p) { + state.getStatus(status, errorStatus, p); + + try (CloseableMemory memory = new CloseableMemory(1024)) { + + util.formatStatus(memory, (int) memory.size() - 1, errorStatus); + if (!print2) { + builder.append(String.format("\nDetailed errors status:\n", p)); + print2 = true; + } + builder.append(String.format("Message %d: %s\n", p, memory.getString(0))); + } + } + + if (errorStatus != null) + errorStatus.dispose(); + + return builder.toString(); + } + +} diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IBatchImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IBatchImpl.java new file mode 100644 index 0000000000..2df27f0c48 --- /dev/null +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IBatchImpl.java @@ -0,0 +1,160 @@ +package org.firebirdsql.nativeoo.gds.ng; + +import com.sun.jna.ptr.LongByReference; +import org.firebirdsql.gds.BatchParameterBuffer; +import org.firebirdsql.gds.BlobParameterBuffer; +import org.firebirdsql.gds.ng.*; +import org.firebirdsql.nativeoo.gds.ng.FbInterface.*; + +import java.sql.SQLException; + +/** + * + * @author Vasiliy Yashkov + * @since 4.0 + */ +public class IBatchImpl extends AbstractFbBatch { + + private IDatabaseImpl database = null; + private IAttachment attachment = null; + private FbTransaction transaction = null; + private String statement = null; + private IMessageMetadataImpl metadata = null; + private BatchParameterBuffer parameterBuffer; + private IBatch batch = null; + + public IBatchImpl(FbDatabase database, FbTransaction transaction, String statement, FbMessageMetadata metadata, BatchParameterBuffer parameters) throws SQLException { + super(database, transaction, statement, metadata, parameters); + + this.transaction = transaction; + this.database = (IDatabaseImpl)database; + this.attachment = this.database.getAttachment(); + this.statement = statement; + this.metadata = (IMessageMetadataImpl) metadata; + this.parameterBuffer = parameters; + + init(); + } + + public IBatchImpl(FbDatabase database, FbTransaction transaction, String statement, BatchParameterBuffer parameters) throws SQLException { + super(database, transaction, statement, parameters); + + this.transaction = transaction; + this.database = (IDatabaseImpl)database; + this.attachment = this.database.getAttachment(); + this.statement = statement; + this.parameterBuffer = parameters; + + init(); + } + + private void init() throws SQLException { + if (metadata == null) { + IStatementImpl statementImpl = new IStatementImpl(database); + statementImpl.setTransaction(transaction); + statementImpl.prepare(statement); + metadata = (IMessageMetadataImpl) statementImpl.getInputMetadata(); + } + + if (parameterBuffer == null) { + batch = attachment.createBatch(database.getStatus(), ((ITransactionImpl) transaction).getTransaction(), statement.length(), + statement, database.getDatabaseDialect(), + metadata.getMetadata(), 0, null); + } else { + batch = attachment.createBatch(database.getStatus(), ((ITransactionImpl) transaction).getTransaction(), statement.length(), + statement, database.getDatabaseDialect(), + metadata.getMetadata(), parameterBuffer.toBytesWithType().length, parameterBuffer.toBytesWithType()); + } + } + + @Override + public FbTransaction getTransaction() { + return super.getTransaction(); + } + + @Override + public FbDatabase getDatabase() { + return super.getDatabase(); + } + + @Override + public void add(int count, byte[] inBuffer) throws SQLException { + try (CloseableMemory memory = new CloseableMemory(inBuffer.length)) { + memory.write(0, inBuffer, 0, inBuffer.length); + batch.add(database.getStatus(), count, memory); + } + } + + /* + * Before use, сheck the buffer contains BLOB_ID_ENGINE that blob ID will be generated by engine + */ + @Override + public FbBlob addBlob(byte[] inBuffer, BlobParameterBuffer buffer) throws SQLException { + return addBlob(inBuffer, 0, buffer); + } + + @Override + public FbBlob addBlob(byte[] inBuffer, long blobId, BlobParameterBuffer buffer) throws SQLException { + try (CloseableMemory memory = new CloseableMemory(inBuffer.length)) { + memory.write(0, inBuffer, 0, inBuffer.length); + LongByReference longByReference = new LongByReference(blobId); + + if (buffer == null) + batch.addBlob(database.getStatus(), inBuffer.length, memory, longByReference, 0, null); + else + batch.addBlob(database.getStatus(), inBuffer.length, memory, longByReference, buffer.toBytesWithType().length, buffer.toBytesWithType()); + + return new IBlobImpl(database, (ITransactionImpl) transaction, buffer, longByReference.getValue()); + } + } + + @Override + public void appendBlobData(byte[] inBuffer) throws SQLException { + try (CloseableMemory memory = new CloseableMemory(inBuffer.length)) { + memory.write(0, inBuffer, 0, inBuffer.length); + batch.appendBlobData(database.getStatus(), inBuffer.length, memory); + } + } + + @Override + public void addBlobStream(byte[] inBuffer) throws SQLException { + try (CloseableMemory memory = new CloseableMemory(inBuffer.length)) { + memory.write(0, inBuffer, 0, inBuffer.length); + batch.addBlobStream(database.getStatus(), inBuffer.length, memory); + } + } + + @Override + public void registerBlob(long existingBlob, long blobId) throws SQLException { + LongByReference longByReference = new LongByReference(blobId); + LongByReference existLong = new LongByReference(existingBlob); + batch.registerBlob(database.getStatus(), existLong, longByReference); + } + + @Override + public FbBatchCompletionState execute() throws SQLException { + IBatchCompletionState execute = batch.execute(database.getStatus(), ((ITransactionImpl)transaction).getTransaction()); + + return new IBatchCompletionStateImpl(database, execute, database.getStatus()); + } + + @Override + public void cancel() throws SQLException { + batch.cancel(database.getStatus()); + } + + @Override + public int getBlobAlignment() throws SQLException { + return batch.getBlobAlignment(database.getStatus()); + } + + @Override + public FbMessageMetadata getMetadata() throws SQLException { + return metadata; + } + + @Override + public void setDefaultBpb(int parLength, byte[] par) throws SQLException { + batch.setDefaultBpb(database.getStatus(), parLength, par); + } +} diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IBlobImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IBlobImpl.java new file mode 100644 index 0000000000..58a32a5b08 --- /dev/null +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IBlobImpl.java @@ -0,0 +1,237 @@ +package org.firebirdsql.nativeoo.gds.ng; + +import com.sun.jna.ptr.LongByReference; +import org.firebirdsql.gds.BlobParameterBuffer; +import org.firebirdsql.gds.ISCConstants; +import org.firebirdsql.gds.ng.AbstractFbBlob; +import org.firebirdsql.gds.ng.FbBlob; +import org.firebirdsql.gds.ng.FbExceptionBuilder; +import org.firebirdsql.gds.ng.listeners.DatabaseListener; +import org.firebirdsql.nativeoo.gds.ng.FbInterface.*; + +import java.nio.ByteBuffer; +import java.sql.SQLException; + +import static org.firebirdsql.gds.JaybirdErrorCodes.jb_blobGetSegmentNegative; +import static org.firebirdsql.gds.JaybirdErrorCodes.jb_blobPutSegmentEmpty; +import static org.firebirdsql.gds.JaybirdErrorCodes.jb_blobPutSegmentTooLong; + +/** + * + * @author Vasiliy Yashkov + * @since 4.0 + */ +public class IBlobImpl extends AbstractFbBlob implements FbBlob, DatabaseListener { + + private final LongByReference blobId; + private final boolean outputBlob; + private ByteBuffer byteBuffer; + private IBlob blob; + + public IBlobImpl(IDatabaseImpl database, ITransactionImpl transaction, BlobParameterBuffer blobParameterBuffer) { + this(database, transaction, blobParameterBuffer, NO_BLOB_ID); + } + + public IBlobImpl(IDatabaseImpl database, ITransactionImpl transaction, BlobParameterBuffer blobParameterBuffer, + long blobId) { + super(database, transaction, blobParameterBuffer); + this.blobId = new LongByReference(blobId); + outputBlob = blobId == NO_BLOB_ID; + } + + @Override + protected void closeImpl() throws SQLException { + synchronized (getSynchronizationObject()) { + try { + IDatabaseImpl database = (IDatabaseImpl)getDatabase(); + blob.close(database.getStatus()); + } finally { + byteBuffer = null; + } + } + } + + @Override + protected void cancelImpl() throws SQLException { + synchronized (getSynchronizationObject()) { + try { + IDatabaseImpl database = (IDatabaseImpl)getDatabase(); + blob.cancel(database.getStatus()); + } finally { + byteBuffer = null; + } + } + } + + @Override + public long getBlobId() { + return blobId.getValue(); + } + + @Override + public int getHandle() { + throw new UnsupportedOperationException( "Native OO API not support blob handle" ); + } + + @Override + public void open() throws SQLException { + try { + if (isOutput() && getBlobId() != NO_BLOB_ID) { + throw new FbExceptionBuilder().nonTransientException(ISCConstants.isc_segstr_no_op).toSQLException(); + } + + final BlobParameterBuffer blobParameterBuffer = getBlobParameterBuffer(); + final byte[] bpb; + if (blobParameterBuffer != null) { + bpb = blobParameterBuffer.toBytesWithType(); + } else { + bpb = new byte[0]; + } + synchronized (getSynchronizationObject()) { + checkDatabaseAttached(); + checkTransactionActive(); + checkBlobClosed(); + + IDatabaseImpl database = (IDatabaseImpl)getDatabase(); + IAttachment attachment = database.getAttachment(); + if (isOutput()) { + blob = attachment.createBlob(database.getStatus(), ((ITransactionImpl)getTransaction()).getTransaction(), + blobId, bpb.length, bpb); + } else { + blob = attachment.openBlob(database.getStatus(), ((ITransactionImpl)getTransaction()).getTransaction(), + blobId, bpb.length, bpb); + } + setOpen(true); + resetEof(); + } + } catch (SQLException e) { + exceptionListenerDispatcher.errorOccurred(e); + throw e; + } + } + + @Override + public boolean isOutput() { + return outputBlob; + } + + @Override + public byte[] getSegment(int sizeRequested) throws SQLException { + try { + if (sizeRequested <= 0) { + throw new FbExceptionBuilder().exception(jb_blobGetSegmentNegative) + .messageParameter(sizeRequested) + .toSQLException(); + } + // TODO Honour request for larger sizes by looping? + sizeRequested = Math.min(sizeRequested, getMaximumSegmentSize()); + final ByteBuffer responseBuffer; + final com.sun.jna.Pointer actualLength = new CloseableMemory(1024); + synchronized (getSynchronizationObject()) { + checkDatabaseAttached(); + checkTransactionActive(); + checkBlobOpen(); + responseBuffer = getByteBuffer(sizeRequested); + try (CloseableMemory memory = new CloseableMemory(sizeRequested)) { + + IDatabaseImpl database = (IDatabaseImpl) getDatabase(); + IStatus status = database.getStatus(); + int result = blob.getSegment(status, sizeRequested, memory, actualLength); + // result 0 means: more to come, isc_segment means: buffer was too small, + // rest will be returned on next call + if (!(IStatus.RESULT_OK == result || result == IStatus.RESULT_SEGMENT)) { + if (result == IStatus.RESULT_NO_DATA) { + setEof(); + } + } + memory.read(0, responseBuffer.array(), 0, sizeRequested); + } + } + final int actualLengthInt = actualLength.getInt(0) & 0xFFFF; + ((CloseableMemory) actualLength).close(); + final byte[] segment = new byte[actualLengthInt]; + responseBuffer.get(segment); + return segment; + } catch (SQLException e) { + exceptionListenerDispatcher.errorOccurred(e); + throw e; + } + } + + @Override + public void putSegment(byte[] segment) throws SQLException { + try { + if (segment.length == 0) { + throw new FbExceptionBuilder().exception(jb_blobPutSegmentEmpty).toSQLException(); + } + // TODO Handle by performing multiple puts? (Wrap in byte buffer, use position to move pointer?) + if (segment.length > getMaximumSegmentSize()) { + throw new FbExceptionBuilder().exception(jb_blobPutSegmentTooLong).toSQLException(); + } + synchronized (getSynchronizationObject()) { + checkDatabaseAttached(); + checkTransactionActive(); + checkBlobOpen(); + + try (CloseableMemory memory = new CloseableMemory(segment.length)) { + memory.write(0, segment, 0, segment.length); + + IDatabaseImpl database = (IDatabaseImpl) getDatabase(); + IStatus status = database.getStatus(); + blob.putSegment(status, segment.length, memory); + } + } + } catch (SQLException e) { + exceptionListenerDispatcher.errorOccurred(e); + throw e; + } + } + + @Override + public void seek(int offset, SeekMode seekMode) throws SQLException { + try { + synchronized (getSynchronizationObject()) { + checkDatabaseAttached(); + checkTransactionActive(); + + IDatabaseImpl database = (IDatabaseImpl)getDatabase(); + IStatus status = database.getStatus(); + // result is the current position in the blob + // We ignore the result + blob.seek(status, seekMode.getSeekModeId(), offset); + } + } catch (SQLException e) { + exceptionListenerDispatcher.errorOccurred(e); + throw e; + } + } + + @Override + public byte[] getBlobInfo(byte[] requestItems, int bufferLength) throws SQLException { + try { + byte[] responseArr = new byte[bufferLength]; + synchronized (getSynchronizationObject()) { + checkDatabaseAttached(); + checkBlobOpen(); + + IDatabaseImpl database = (IDatabaseImpl)getDatabase(); + IStatus status = database.getStatus(); + blob.getInfo(status, requestItems.length, requestItems, bufferLength, responseArr); + } + + return responseArr; + } catch (SQLException e) { + exceptionListenerDispatcher.errorOccurred(e); + throw e; + } + } + + private ByteBuffer getByteBuffer(int requiredSize) { + if (byteBuffer == null || byteBuffer.capacity() < requiredSize) { + byteBuffer = ByteBuffer.allocate(requiredSize); + } else { + byteBuffer.clear(); + } + return byteBuffer; + } +} diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IDatabaseImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IDatabaseImpl.java new file mode 100644 index 0000000000..992cd610a3 --- /dev/null +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IDatabaseImpl.java @@ -0,0 +1,419 @@ +package org.firebirdsql.nativeoo.gds.ng; + +import org.firebirdsql.gds.*; +import org.firebirdsql.gds.impl.DatabaseParameterBufferExtension; +import org.firebirdsql.gds.ng.*; +import org.firebirdsql.gds.ng.listeners.TransactionListener; +import org.firebirdsql.jdbc.SQLStateConstants; +import org.firebirdsql.jna.fbclient.FbClientLibrary; +import org.firebirdsql.nativeoo.gds.ng.FbInterface.*; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.sql.SQLException; +import java.sql.SQLNonTransientException; +import java.sql.SQLTransientException; + +import static org.firebirdsql.gds.ISCConstants.fb_cancel_abort; +import static org.firebirdsql.gds.ng.TransactionHelper.checkTransactionActive; + +/** + * Implementation of {@link org.firebirdsql.gds.ng.FbDatabase} for native OO API. + * + * @author Vasiliy Yashkov + * @since 4.0 + */ +public class IDatabaseImpl extends AbstractFbDatabase + implements FbAttachment, TransactionListener { + + private static final ParameterConverter PARAMETER_CONVERTER = new IParameterConverterImpl(); + + private final FbClientLibrary clientLibrary; + private final IMaster master; + private final IProvider provider; + private final IUtil util; + private IAttachment attachment; + private IEvents events; + + public IDatabaseImpl(NativeDatabaseConnection connection) { + super(connection, connection.createDatatypeCoder()); + clientLibrary = connection.getClientLibrary(); + master = clientLibrary.fb_get_master_interface(); + provider = master.getDispatcher(); + util = master.getUtilInterface(); + attachment = null; + } + + /** + * @return The client library instance associated with the database. + */ + protected final FbClientLibrary getClientLibrary() { + return clientLibrary; + } + + @Override + public void attach() throws SQLException { + try { + final DatabaseParameterBuffer dpb = ((DatabaseParameterBufferExtension) PARAMETER_CONVERTER + .toDatabaseParameterBuffer(connection)) + .removeExtensionParams(); + attachOrCreate(dpb, false); + } catch (SQLException e) { + exceptionListenerDispatcher.errorOccurred(e); + throw e; + } + } + + @Override + protected void internalDetach() throws SQLException { + synchronized (getSynchronizationObject()) { + try { + attachment.detach(getStatus()); + } catch (SQLException e) { + throw e; + } finally { + setDetached(); + } + } + } + + @Override + public void createDatabase() throws SQLException { + try { + final DatabaseParameterBuffer dpb = ((DatabaseParameterBufferExtension) PARAMETER_CONVERTER + .toDatabaseParameterBuffer(connection)) + .removeExtensionParams(); + attachOrCreate(dpb, true); + } catch (SQLException e) { + exceptionListenerDispatcher.errorOccurred(e); + throw e; + } + } + + @Override + public void dropDatabase() throws SQLException { + try { + checkConnected(); + synchronized (getSynchronizationObject()) { + try { + attachment.dropDatabase(getStatus()); + } finally { + setDetached(); + } + } + } catch (SQLException e) { + exceptionListenerDispatcher.errorOccurred(e); + throw e; + } + } + + @Override + public void cancelOperation(int kind) throws SQLException { + try { + checkConnected(); + // No synchronization, otherwise cancel will never work + try { + attachment.cancelOperation(getStatus(), kind); + } finally { + if (kind == fb_cancel_abort) { + attachment.detach(getStatus()); + setDetached(); + } + } + } catch (SQLException e) { + exceptionListenerDispatcher.errorOccurred(e); + throw e; + } + } + + @Override + public FbTransaction startTransaction(TransactionParameterBuffer tpb) throws SQLException { + try { + checkConnected(); + final byte[] tpbArray = tpb.toBytesWithType(); + synchronized (getSynchronizationObject()) { + ITransaction transaction = attachment.startTransaction(getStatus(), tpbArray.length, tpbArray); + + final ITransactionImpl transactionImpl = new ITransactionImpl(this, transaction, + TransactionState.ACTIVE); + transactionAdded(transactionImpl); + return transactionImpl; + } + } catch (SQLException e) { + exceptionListenerDispatcher.errorOccurred(e); + throw e; + } + } + + @Override + public FbTransaction reconnectTransaction(long transactionId) throws SQLException { + try { + checkConnected(); + final byte[] transactionIdBuffer = getTransactionIdBuffer(transactionId); + + synchronized (getSynchronizationObject()) { + ITransaction iTransaction = attachment.reconnectTransaction(getStatus(), transactionIdBuffer.length, + transactionIdBuffer); + + final ITransactionImpl transaction = + new ITransactionImpl(this, iTransaction, TransactionState.PREPARED); + transactionAdded(transaction); + return transaction; + } + } catch (SQLException e) { + exceptionListenerDispatcher.errorOccurred(e); + throw e; + } + } + + protected byte[] getTransactionIdBuffer(long transactionId) { + ByteArrayOutputStream bos = new ByteArrayOutputStream(8); + try { + VaxEncoding.encodeVaxLongWithoutLength(bos, transactionId); + } catch (IOException e) { + // ignored: won't happen with a ByteArrayOutputStream + } + return bos.toByteArray(); + } + + @Override + public FbStatement createStatement(FbTransaction transaction) throws SQLException { + try { + checkConnected(); + final IStatementImpl statement = new IStatementImpl(this); + statement.addExceptionListener(exceptionListenerDispatcher); + statement.setTransaction(transaction); + return statement; + } catch (SQLException e) { + exceptionListenerDispatcher.errorOccurred(e); + throw e; + } + } + + @Override + public FbBlob createBlobForOutput(FbTransaction transaction, BlobParameterBuffer blobParameterBuffer) { + final IBlobImpl blob = new IBlobImpl(this, (ITransactionImpl) transaction, blobParameterBuffer); + blob.addExceptionListener(exceptionListenerDispatcher); + return blob; + } + + @Override + public FbBlob createBlobForInput(FbTransaction transaction, BlobParameterBuffer blobParameterBuffer, long blobId) { + final IBlobImpl blob = new IBlobImpl(this, (ITransactionImpl) transaction, blobParameterBuffer, blobId); + blob.addExceptionListener(exceptionListenerDispatcher); + return blob; + } + + @Override + public byte[] getDatabaseInfo(byte[] requestItems, int maxBufferLength) throws SQLException { + try { + final byte[] responseArray = new byte[maxBufferLength]; + synchronized (getSynchronizationObject()) { + attachment.getInfo(getStatus(), requestItems.length, requestItems, (short) maxBufferLength, responseArray); + } + + return responseArray; + } catch (FbException e) { + exceptionListenerDispatcher.errorOccurred(new SQLException(e)); + throw new SQLException(e); + } + } + + @Override + public void executeImmediate(String statementText, FbTransaction transaction) throws SQLException { + try { + if (isAttached()) { + if (transaction == null) { + throw FbExceptionBuilder + .forException(JaybirdErrorCodes.jb_executeImmediateRequiresTransactionAttached) + .toFlatSQLException(); + } else if (!(transaction instanceof ITransactionImpl)) { + throw new SQLNonTransientException( + String.format("Invalid transaction handle type: %s, expected: %s", + transaction.getClass(), ITransactionImpl.class), + SQLStateConstants.SQL_STATE_GENERAL_ERROR); + } + checkTransactionActive(transaction); + } else if (transaction != null) { + throw FbExceptionBuilder + .forException(JaybirdErrorCodes.jb_executeImmediateRequiresNoTransactionDetached) + .toFlatSQLException(); + } + + synchronized (getSynchronizationObject()) { + if (attachment == null) { + attachment = util.executeCreateDatabase(getStatus(), statementText.length(), + statementText, getConnectionDialect(), new boolean[]{false}); + } else { + attachment.execute(getStatus(), + transaction != null ? ((ITransactionImpl) transaction).getTransaction() : + attachment.startTransaction(getStatus(), 0, null), + statementText.length(), + statementText, getConnectionDialect(), null, null, + null, null); + } + if (!isAttached()) { + setAttached(); + afterAttachActions(); + } + } + } catch (SQLException e) { + exceptionListenerDispatcher.errorOccurred(e); + throw e; + } + } + + @Override + public int getHandle() { + throw new UnsupportedOperationException( "Native OO API not support database handle" ); + } + + protected IEventBlockImpl validateEventHandle(EventHandle eventHandle) throws SQLException { + if (!(eventHandle instanceof IEventBlockImpl)) { + // TODO SQLState and/or Firebird specific error + throw new SQLNonTransientException(String.format("Invalid event handle type: %s, expected: %s", + eventHandle.getClass(), IEventBlockImpl.class)); + } + IEventBlockImpl event = (IEventBlockImpl) eventHandle; + if (event.getSize() == -1) { + // TODO SQLState and/or Firebird specific error + throw new SQLTransientException("Event handle hasn't been initialized"); + } + return event; + } + + @Override + public EventHandle createEventHandle(String eventName, EventHandler eventHandler) throws SQLException { + final IEventBlockImpl eventHandle = new IEventBlockImpl(eventName, eventHandler, getEncoding()); + synchronized (getSynchronizationObject()) { + synchronized (eventHandle) { + IUtil util = master.getUtilInterface(); + IEventBlock eventBlock = util.createEventBlock(getStatus(), new String[]{eventName}); + eventHandle.setEventBlock(eventBlock); + } + } + return eventHandle; + } + + @Override + public void countEvents(EventHandle eventHandle) throws SQLException { + try { + final IEventBlockImpl eventBlock = validateEventHandle(eventHandle); + int count; + synchronized (getSynchronizationObject()) { + synchronized (eventBlock) { + count = eventBlock.getEventBlock().getCount(); + } + } + eventBlock.setEventCount(count); + } catch (SQLException e) { + exceptionListenerDispatcher.errorOccurred(e); + throw e; + } + } + + @Override + public void queueEvent(EventHandle eventHandle) throws SQLException { + try { + checkConnected(); + final IEventBlockImpl eventBlock = validateEventHandle(eventHandle); + + synchronized (getSynchronizationObject()) { + synchronized (eventBlock) { + int length = eventBlock.getEventBlock().getLength(); + byte[] array = eventBlock.getEventBlock().getValues().getByteArray(0, length); + events = attachment.queEvents(getStatus(), eventBlock.getCallback(), + length, + array); + } + } + } catch (SQLException e) { + exceptionListenerDispatcher.errorOccurred(e); + throw e; + } + } + + @Override + public void cancelEvent(EventHandle eventHandle) throws SQLException { + try { + checkConnected(); + final IEventBlockImpl eventBlock = validateEventHandle(eventHandle); + + synchronized (getSynchronizationObject()) { + synchronized (eventBlock) { + try { + events.cancel(getStatus()); + } finally { + eventBlock.releaseMemory(); + } + } + } + } catch (SQLException e) { + exceptionListenerDispatcher.errorOccurred(e); + throw e; + } + } + + @Override + public FbBatch createBatch(FbTransaction transaction, String statement, FbMessageMetadata metadata, BatchParameterBuffer parameters) throws SQLException { + return new IBatchImpl(this, transaction, statement, metadata, parameters); + } + + @Override + public FbBatch createBatch(FbTransaction transaction, String statement, BatchParameterBuffer parameters) throws SQLException { + return new IBatchImpl(this, transaction, statement, parameters); + } + + @Override + public FbMetadataBuilder getMetadataBuilder(int fieldCount) throws SQLException { + return new IMetadataBuilderImpl(this, fieldCount); + } + + + @Override + protected void checkConnected() throws SQLException { + if (!isAttached()) { + throw FbExceptionBuilder.forException(JaybirdErrorCodes.jb_notAttachedToDatabase) + .toFlatSQLException(); + } + } + + protected void attachOrCreate(final DatabaseParameterBuffer dpb, final boolean create) throws SQLException { + if (isAttached()) { + throw new SQLException("Already attached to a database"); + } + final String dbName = connection.getAttachUrl(); + final byte[] dpbArray = dpb.toBytesWithType(); + + synchronized (getSynchronizationObject()) { + try { + if (create) { + attachment = provider.createDatabase(getStatus(), dbName, (short) dpbArray.length, dpbArray); + } else { + attachment = provider.attachDatabase(getStatus(), dbName, (short) dpbArray.length, dpbArray); + } + } catch (SQLException e) { + safelyDetach(); + throw e; + } + setAttached(); + afterAttachActions(); + } + } + + protected void afterAttachActions() throws SQLException { + getDatabaseInfo(getDescribeDatabaseInfoBlock(), 1024, getDatabaseInformationProcessor()); + } + + public IMaster getMaster() { + return master; + } + + public IStatus getStatus() { + return master.getStatus(); + } + + public IAttachment getAttachment() { + return attachment; + } +} diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IEventBlockImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IEventBlockImpl.java new file mode 100644 index 0000000000..df0c7bc140 --- /dev/null +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IEventBlockImpl.java @@ -0,0 +1,134 @@ +package org.firebirdsql.nativeoo.gds.ng; + +import org.firebirdsql.encodings.Encoding; +import org.firebirdsql.gds.EventHandler; +import org.firebirdsql.gds.ng.AbstractEventHandle; +import org.firebirdsql.nativeoo.gds.ng.FbInterface.IEventBlock; +import org.firebirdsql.nativeoo.gds.ng.FbInterface.IEventCallback; +import org.firebirdsql.nativeoo.gds.ng.FbInterface.IEventCallbackIntf; +import org.firebirdsql.logging.Logger; +import org.firebirdsql.logging.LoggerFactory; + +/** + * Event handle for the native OO API. + * + * @author Vasiliy Yashkov + * @since 4.0 + */ +public class IEventBlockImpl extends AbstractEventHandle { + + private static final Logger LOG = LoggerFactory.getLogger(IEventBlockImpl.class); + + private final CloseableMemory eventNameMemory; + private int size = -1; + private IEventBlock eventBlock; + private IEventCallback callback = new IEventCallback(new IEventCallbackImpl()); + private int referenceCount = 0; + + IEventBlockImpl(String eventName, EventHandler eventHandler, Encoding encoding) { + super(eventName, eventHandler); + // Requires null-termination + final byte[] eventNameBytes = encoding.encodeToCharset(eventName + '\0'); + if (eventNameBytes.length > 256) { + throw new IllegalArgumentException("Event name as bytes too long"); + } + eventNameMemory = new CloseableMemory(eventNameBytes.length); + eventNameMemory.write(0, eventNameBytes, 0, eventNameBytes.length); + } + + @Override + protected void setEventCount(int eventCount) { + super.setEventCount(eventCount); + } + + @Override + public int getEventId() { + throw new UnsupportedOperationException( "Native OO API not support event id"); + } + + /** + * @param size Size of the event buffers + */ + void setSize(int size) { + this.size = size; + } + + /** + * @return Size of the event buffers + */ + int getSize() { + return eventBlock.getLength(); + } + + /** + * @return Event callback. + */ + IEventCallback getCallback() { + return callback; + } + + public IEventBlock getEventBlock() { + return eventBlock; + } + + public void setEventBlock(IEventBlock eventBlock) { + this.eventBlock = eventBlock; + } + + public synchronized void releaseMemory() { + if (size == -1) return; + try { + eventNameMemory.close(); + } finally { + size = -1; + } + } + + @Override + protected void finalize() throws Throwable { + try { + releaseMemory(); + } finally { + super.finalize(); + } + } + + private class IEventCallbackImpl implements IEventCallbackIntf { + + @Override + public void addRef() { + synchronized (this) { + ++referenceCount; + } + } + + @Override + public int release() { + synchronized (this) { + return --referenceCount; + } + } + + @Override + public void eventCallbackFunction(int length, com.sun.jna.Pointer events) { + synchronized (this) { + if (events != null) { + eventBlock.getValues().write(0, events.getByteArray(0, length), 0, length); + this.release(); + + onEventOccurred(); + } + } + } + + @Override + protected void finalize() throws Throwable { + try { + release(); + } finally { + super.finalize(); + } + } + } + +} diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IMessageBuilderImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IMessageBuilderImpl.java new file mode 100644 index 0000000000..a6c710abee --- /dev/null +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IMessageBuilderImpl.java @@ -0,0 +1,20 @@ +package org.firebirdsql.nativeoo.gds.ng; + +import org.firebirdsql.gds.ng.AbstractFbMessageBuilder; +import org.firebirdsql.gds.ng.FbBatch; + +import java.sql.SQLException; + +/** + * Implementation of {@link AbstractFbMessageBuilder} + * to build messages for a native connection using OO API. + * + * @author Vasiliy Yashkov + * @since 4.0 + */ +public class IMessageBuilderImpl extends AbstractFbMessageBuilder { + + public IMessageBuilderImpl(FbBatch batch) throws SQLException { + super(batch); + } +} diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IMessageMetadataImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IMessageMetadataImpl.java new file mode 100644 index 0000000000..0077f135c2 --- /dev/null +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IMessageMetadataImpl.java @@ -0,0 +1,101 @@ +package org.firebirdsql.nativeoo.gds.ng; + +import org.firebirdsql.gds.ng.FbMessageMetadata; +import org.firebirdsql.gds.ng.FbMetadataBuilder; +import org.firebirdsql.nativeoo.gds.ng.FbInterface.*; + +/** + * + * @author Vasiliy Yashkov + * @since 4.0 + */ +public class IMessageMetadataImpl implements FbMessageMetadata { + + private IDatabaseImpl database; + private IMetadataBuilderImpl metadataBuilderImpl; + private IMetadataBuilder metadataBuilder; + private IMessageMetadata metadata; + + public IMessageMetadataImpl(FbMetadataBuilder metadataBuilder) throws FbException { + + this.metadataBuilderImpl = (IMetadataBuilderImpl)metadataBuilder; + this.database = (IDatabaseImpl)this.metadataBuilderImpl.getDatabase(); + + this.metadataBuilder = this.metadataBuilderImpl.getMetadataBuilder(); + this.metadata = this.metadataBuilder.getMetadata(database.getStatus()); + } + + public IMessageMetadataImpl(IDatabaseImpl database, IMessageMetadata metadata) throws FbException { + this.database = database; + this.metadata = metadata; + } + + public IMessageMetadata getMetadata() { + return metadata; + } + + public int getOffset(int index) throws FbException { + return metadata.getOffset(database.getStatus(), index); + } + + public int getNullOffset(int index) throws FbException { + return metadata.getNullOffset(database.getStatus(), index); + } + + public int getLength(int index) throws FbException { + return metadata.getLength(database.getStatus(), index); + } + + public String getAlias(int index) throws FbException { + return metadata.getAlias(database.getStatus(), index); + } + + public String getField(int index) throws FbException { + return metadata.getField(database.getStatus(), index); + } + + public String getOwner(int index) throws FbException { + return metadata.getOwner(database.getStatus(), index); + } + + public String getRelation(int index) throws FbException { + return metadata.getRelation(database.getStatus(), index); + } + + public int getAlignedLength() throws FbException { + return metadata.getAlignedLength(database.getStatus()); + } + + public int getAlignment() throws FbException { + return metadata.getAlignment(database.getStatus()); + } + + public int getCount() throws FbException { + return metadata.getCount(database.getStatus()); + } + + public int getCharSet(int index) throws FbException { + return metadata.getCharSet(database.getStatus(), index); + } + + public int getMessageLength() throws FbException { + return metadata.getMessageLength(database.getStatus()); + } + + public int getScale(int index) throws FbException { + return metadata.getScale(database.getStatus(), index); + } + + public int getSubType(int index) throws FbException { + return metadata.getSubType(database.getStatus(), index); + } + + public int getType(int index) throws FbException { + return metadata.getType(database.getStatus(), index); + } + + public IMetadataBuilder getBuilder() throws FbException { + return metadata.getBuilder(database.getStatus()); + } + +} diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IMetadataBuilderImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IMetadataBuilderImpl.java new file mode 100644 index 0000000000..f428cc3fc4 --- /dev/null +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IMetadataBuilderImpl.java @@ -0,0 +1,197 @@ +package org.firebirdsql.nativeoo.gds.ng; + +import org.firebirdsql.gds.ng.FbDatabase; +import org.firebirdsql.gds.ng.FbMessageMetadata; +import org.firebirdsql.gds.ng.FbMetadataBuilder; +import org.firebirdsql.nativeoo.gds.ng.FbInterface.*; + +import static org.firebirdsql.gds.ISCConstants.*; + +/** + * + * @author Vasiliy Yashkov + * @since 4.0 + */ +public class IMetadataBuilderImpl implements FbMetadataBuilder { + + private static final int SUBTYPE_NUMERIC = 1; + private static final int SUBTYPE_DECIMAL = 2; + + private IDatabaseImpl database; + private IMaster master; + private IStatus status; + private int fieldCount; + private IMetadataBuilder metadataBuilder; + private IMessageMetadata messageMetadata; + + public IMetadataBuilderImpl(FbDatabase database, int fieldCount) throws FbException { + this.database = (IDatabaseImpl)database; + this.master = this.database.getMaster(); + this.status = this.database.getStatus(); + this.fieldCount = fieldCount; + this.metadataBuilder = master.getMetadataBuilder(status, fieldCount); + } + + @Override + public FbMessageMetadata getMessageMetadata() throws FbException { + + messageMetadata = metadataBuilder.getMetadata(status); + IMessageMetadataImpl metadata = new IMessageMetadataImpl(this); + + return metadata; + } + + public IMetadataBuilder getMetadataBuilder() { + return this.metadataBuilder; + } + + public FbDatabase getDatabase() { + return this.database; + } + + public int addField() throws FbException { + return this.metadataBuilder.addField(status); + } + + @Override + public void addSmallint(int index) throws FbException { + metadataBuilder.setType(status, index, SQL_SHORT); + metadataBuilder.setLength(status, index, Short.SIZE / Byte.SIZE); + metadataBuilder.setScale(status, index, 0); + } + + @Override + public void addInteger(int index) throws FbException { + metadataBuilder.setType(status, index, SQL_LONG); + metadataBuilder.setLength(status, index, Integer.SIZE / Byte.SIZE); + metadataBuilder.setScale(status, index, 0); + } + + @Override + public void addBigint(int index) throws FbException { + metadataBuilder.setType(status, index, SQL_INT64); + metadataBuilder.setLength(status, index, Long.SIZE / Byte.SIZE); + metadataBuilder.setScale(status, index, 0); + } + + @Override + public void addFloat(int index) throws FbException { + metadataBuilder.setType(status, index, SQL_FLOAT); + metadataBuilder.setLength(status, index, Float.SIZE / Byte.SIZE); + } + + @Override + public void addNumeric(int index, int size, int scale) throws FbException { + metadataBuilder.setType(status, index, SQL_SHORT); + metadataBuilder.setLength(status, index, size); + if (scale > 0) + scale = -scale; + metadataBuilder.setScale(status, index, scale); + metadataBuilder.setSubType(status, index, SUBTYPE_NUMERIC); + } + + @Override + public void addDecimal(int index, int size, int scale) throws FbException { + metadataBuilder.setType(status, index, SQL_LONG); + metadataBuilder.setLength(status, index, size); + metadataBuilder.setScale(status, index, scale); + metadataBuilder.setSubType(status, index, SUBTYPE_DECIMAL); + } + + @Override + public void addDouble(int index) throws FbException { + metadataBuilder.setType(status, index, SQL_DOUBLE); + metadataBuilder.setLength(status, index, Double.SIZE / Byte.SIZE); + } + + @Override + public void addDecfloat16(int index) throws FbException { + metadataBuilder.setType(status, index, SQL_DEC16); + metadataBuilder.setLength(status, index, IDecFloat16.STRING_SIZE); + } + + @Override + public void addDecfloat34(int index) throws FbException { + metadataBuilder.setType(status, index, SQL_DEC34); + metadataBuilder.setLength(status, index, IDecFloat34.STRING_SIZE); + } + + @Override + public void addBlob(int index) throws FbException { + metadataBuilder.setType(status, index, SQL_BLOB); + metadataBuilder.setLength(status, index, (Integer.SIZE / Byte.SIZE) * 2); + } + + @Override + public void addBlob(int index, int subtype) throws FbException { + metadataBuilder.setType(status, index, SQL_BLOB); + metadataBuilder.setLength(status, index, (Integer.SIZE / Byte.SIZE) * 2); + metadataBuilder.setSubType(status, index, subtype); + } + + @Override + public void addBoolean(int index) throws FbException { + metadataBuilder.setType(status, index, SQL_BOOLEAN); + metadataBuilder.setLength(status, index, Short.SIZE / Byte.SIZE); + } + + @Override + public void addDate(int index) throws FbException { + metadataBuilder.setType(status, index, SQL_DATE); + metadataBuilder.setLength(status, index, Long.SIZE / Byte.SIZE); + } + + @Override + public void addTime(int index) throws FbException { + metadataBuilder.setType(status, index, SQL_TYPE_TIME); + metadataBuilder.setLength(status, index, Long.SIZE / Byte.SIZE); + } + + @Override + public void addTimestamp(int index) throws FbException { + metadataBuilder.setType(status, index, SQL_TIMESTAMP); + metadataBuilder.setLength(status, index, Long.SIZE / Byte.SIZE); + } + + @Override + public void addChar(int index, int length) throws FbException { + metadataBuilder.setType(status, index, SQL_TEXT); + metadataBuilder.setLength(status, index, length); + } + + @Override + public void addVarchar(int index, int length) throws FbException { + metadataBuilder.setType(status, index, SQL_VARYING); + metadataBuilder.setLength(status, index, length); + } + + @Override + public void addChar(int index, int length, int charSet) throws FbException { + metadataBuilder.setType(status, index, SQL_TEXT); + metadataBuilder.setLength(status, index, length); + metadataBuilder.setCharSet(status, index, charSet); + } + + @Override + public void addVarchar(int index, int length, int charSet) throws FbException { + metadataBuilder.setType(status, index, SQL_VARYING); + metadataBuilder.setLength(status, index, length); + metadataBuilder.setCharSet(status, index, charSet); + } + + @Override + public void addDecDecimal(int index, int size, int scale) throws FbException { + metadataBuilder.setType(status, index, SQL_DEC_FIXED); + metadataBuilder.setLength(status, index, size); + metadataBuilder.setScale(status, index, scale); + metadataBuilder.setSubType(status, index, SUBTYPE_DECIMAL); + } + + @Override + public void addDecNumeric(int index, int size, int scale) throws FbException { + metadataBuilder.setType(status, index, SQL_DEC_FIXED); + metadataBuilder.setLength(status, index, size); + metadataBuilder.setScale(status, index, scale); + metadataBuilder.setSubType(status, index, SUBTYPE_NUMERIC); + } +} diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IParameterConverterImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IParameterConverterImpl.java new file mode 100644 index 0000000000..9ddc3d7a4c --- /dev/null +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IParameterConverterImpl.java @@ -0,0 +1,33 @@ +package org.firebirdsql.nativeoo.gds.ng; + +import org.firebirdsql.gds.ConnectionParameterBuffer; +import org.firebirdsql.gds.ParameterTagMapping; +import org.firebirdsql.gds.ng.AbstractConnection; +import org.firebirdsql.gds.ng.AbstractParameterConverter; +import org.firebirdsql.gds.ng.IAttachProperties; +import org.firebirdsql.gds.ng.WireCrypt; +import org.firebirdsql.nativeoo.gds.ng.NativeDatabaseConnection; + +import java.sql.SQLException; + +public class IParameterConverterImpl extends AbstractParameterConverter { + + @Override + protected void populateAuthenticationProperties(final AbstractConnection connection, + final ConnectionParameterBuffer pb) throws SQLException { + IAttachProperties props = connection.getAttachProperties(); + ParameterTagMapping tagMapping = pb.getTagMapping(); + if (props.getUser() != null) { + pb.addArgument(tagMapping.getUserNameTag(), props.getUser()); + } + if (props.getPassword() != null) { + pb.addArgument(tagMapping.getPasswordTag(), props.getPassword()); + } + + if (props.getWireCrypt() != WireCrypt.DEFAULT) { + // Need to do this differently when having to add multiple configs + String configString = "WireCrypt = " + props.getWireCrypt(); + pb.addArgument(tagMapping.getConfigTag(), configString); + } + } +} diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IServiceConnectionImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IServiceConnectionImpl.java new file mode 100644 index 0000000000..06c9306c4c --- /dev/null +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IServiceConnectionImpl.java @@ -0,0 +1,55 @@ +package org.firebirdsql.nativeoo.gds.ng; + +import org.firebirdsql.encodings.EncodingFactory; +import org.firebirdsql.encodings.IEncodingFactory; +import org.firebirdsql.gds.ng.IServiceProperties; +import org.firebirdsql.jna.fbclient.FbClientLibrary; + +import java.sql.SQLException; + +/** + * Class handling the initial setup of the native service connection. + * + * @author Vasiliy Yashkov + * @since 4.0 + */ +public class IServiceConnectionImpl extends AbstractNativeConnection { + /** + * Creates a IServiceConnectionImpl (without establishing a connection to the server). + * + * @param clientLibrary + * Client library to use + * @param connectionProperties + * Connection properties + */ + public IServiceConnectionImpl(FbClientLibrary clientLibrary, IServiceProperties connectionProperties) + throws SQLException { + this(clientLibrary, connectionProperties, EncodingFactory.getPlatformDefault()); + } + + /** + * Creates a IServiceConnectionImpl (without establishing a connection to the server). + * + * @param clientLibrary + * Client library to use + * @param connectionProperties + * Connection properties + * @param encodingFactory + * Factory for encoding definitions + */ + public IServiceConnectionImpl(FbClientLibrary clientLibrary, IServiceProperties connectionProperties, + IEncodingFactory encodingFactory) throws SQLException { + super(clientLibrary, connectionProperties, encodingFactory); + } + + /** + * Contrary to the description in the super class, this will simply return an unconnected instance. + * + * @return FbDatabase instance + * @throws SQLException + */ + @Override + public IServiceImpl identify() throws SQLException { + return new IServiceImpl(this); + } +} diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IServiceImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IServiceImpl.java new file mode 100644 index 0000000000..dc4e73d267 --- /dev/null +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IServiceImpl.java @@ -0,0 +1,187 @@ +package org.firebirdsql.nativeoo.gds.ng; + +import org.firebirdsql.gds.ISCConstants; +import org.firebirdsql.gds.JaybirdErrorCodes; +import org.firebirdsql.gds.ServiceParameterBuffer; +import org.firebirdsql.gds.ServiceRequestBuffer; +import org.firebirdsql.gds.impl.ServiceParameterBufferImp; +import org.firebirdsql.gds.impl.ServiceRequestBufferImp; +import org.firebirdsql.gds.ng.AbstractFbService; +import org.firebirdsql.gds.ng.FbAttachment; +import org.firebirdsql.gds.ng.FbExceptionBuilder; +import org.firebirdsql.gds.ng.ParameterConverter; +import org.firebirdsql.jna.fbclient.FbClientLibrary; +import org.firebirdsql.nativeoo.gds.ng.FbInterface.*; + +import java.sql.SQLException; + +/** + * Implementation of {@link FbInterface.IService} for native client access using OO API. + * + * @author Vasiliy Yashkov + * @since 4.0 + */ +public class IServiceImpl extends AbstractFbService implements FbAttachment { + + // TODO Find out if there are any exception from JNA that we need to be prepared to handle. + + private static final ParameterConverter PARAMETER_CONVERTER = new IParameterConverterImpl(); + private final FbClientLibrary clientLibrary; + private final IMaster master; + private final IProvider provider; + private final IStatus status; + private IService service; + + public IServiceImpl(IServiceConnectionImpl connection) { + super(connection, connection.createDatatypeCoder()); + clientLibrary = connection.getClientLibrary(); + master = clientLibrary.fb_get_master_interface(); + status = master.getStatus(); + provider = master.getDispatcher(); + } + + @Override + public ServiceParameterBuffer createServiceParameterBuffer() { + // TODO When Firebird 3, use UTF-8; implement similar mechanism as ProtocolDescriptor of wire? + return new ServiceParameterBufferImp(ServiceParameterBufferImp.SpbMetaData.SPB_VERSION_2, getEncoding()); + } + + @Override + public ServiceRequestBuffer createServiceRequestBuffer() { + // TODO When Firebird 3, use UTF-8; implement similar mechanism as ProtocolDescriptor of wire? + return new ServiceRequestBufferImp(ServiceRequestBufferImp.SrbMetaData.SRB_VERSION_2, getEncoding()); + } + + @Override + protected void checkConnected() throws SQLException { + if (!isAttached()) { + throw FbExceptionBuilder.forException(JaybirdErrorCodes.jb_notAttachedToDatabase) + .toFlatSQLException(); + } + } + + @Override + public byte[] getServiceInfo(ServiceParameterBuffer serviceParameterBuffer, + ServiceRequestBuffer serviceRequestBuffer, int maxBufferLength) throws SQLException { + checkConnected(); + try { + final byte[] serviceParameterBufferBytes = serviceParameterBuffer == null ? null + : serviceParameterBuffer.toBytesWithType(); + final byte[] serviceRequestBufferBytes = + serviceRequestBuffer == null ? null : serviceRequestBuffer.toBytes(); + final byte[] responseBuffer = new byte[maxBufferLength]; + synchronized (getSynchronizationObject()) { + service.query(status, (serviceParameterBufferBytes != null ? serviceParameterBufferBytes.length + : 0), serviceParameterBufferBytes, + (serviceRequestBufferBytes != null ? serviceRequestBufferBytes.length + : 0), serviceRequestBufferBytes, + maxBufferLength, responseBuffer); + } + return responseBuffer; + } catch (SQLException e) { + exceptionListenerDispatcher.errorOccurred(e); + throw e; + } + } + + @Override + public void startServiceAction(ServiceRequestBuffer serviceRequestBuffer) throws SQLException { + checkConnected(); + try { + final byte[] serviceRequestBufferBytes = serviceRequestBuffer == null + ? null + : serviceRequestBuffer.toBytes(); + synchronized (getSynchronizationObject()) { + service.start(status, (serviceRequestBufferBytes != null ? serviceRequestBufferBytes.length : 0), + serviceRequestBufferBytes); + } + } catch (SQLException e) { + exceptionListenerDispatcher.errorOccurred(e); + throw e; + } + } + + @Override + public void attach() throws SQLException { + try { + if (isAttached()) { + throw new SQLException("Already attached to a service"); + } + final ServiceParameterBuffer spb = PARAMETER_CONVERTER.toServiceParameterBuffer(connection); + final byte[] serviceName = getEncoding().encodeToCharset(connection.getAttachUrl()); + final byte[] spbArray = spb.toBytesWithType(); + + synchronized (getSynchronizationObject()) { + try { + service = provider.attachServiceManager(status, connection.getAttachUrl(), spbArray.length, spbArray); + } catch (SQLException ex) { + safelyDetach(); + throw ex; + } catch (Exception ex) { + safelyDetach(); + // TODO Replace with specific error (eg native client error) + throw new FbExceptionBuilder() + .exception(ISCConstants.isc_network_error) + .messageParameter(connection.getServerName()) + .cause(ex) + .toSQLException(); + } + setAttached(); + afterAttachActions(); + } + } catch (SQLException e) { + exceptionListenerDispatcher.errorOccurred(e); + throw e; + } + } + + @Override + public int getHandle() { + throw new UnsupportedOperationException( "Native OO API not support service handle" ); + } + + /** + * Additional tasks to execute directly after attach operation. + *

+ * Implementation retrieves service information like server version. + *

+ * + * @throws SQLException + * For errors reading or writing database information. + */ + protected void afterAttachActions() throws SQLException { + getServiceInfo(null, getDescribeServiceRequestBuffer(), 1024, getServiceInformationProcessor()); + } + + @Override + protected void internalDetach() throws SQLException { + checkConnected(); + synchronized (getSynchronizationObject()) { + try { + service.detach(status); + } catch (SQLException ex) { + throw ex; + } catch (Exception ex) { + // TODO Replace with specific error (eg native client error) + throw new FbExceptionBuilder() + .exception(ISCConstants.isc_network_error) + .messageParameter(connection.getServerName()) + .cause(ex) + .toSQLException(); + } finally { + setDetached(); + } + } + } + + @Override + protected void finalize() throws Throwable { + try { + if (isAttached()) { + safelyDetach(); + } + } finally { + super.finalize(); + } + } +} diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IStatementImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IStatementImpl.java new file mode 100644 index 0000000000..4122862083 --- /dev/null +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IStatementImpl.java @@ -0,0 +1,359 @@ +package org.firebirdsql.nativeoo.gds.ng; + +import com.sun.jna.Memory; +import com.sun.jna.Pointer; +import org.firebirdsql.gds.ISCConstants; +import org.firebirdsql.gds.JaybirdErrorCodes; +import org.firebirdsql.gds.ng.*; +import org.firebirdsql.gds.ng.fields.*; +import org.firebirdsql.gds.ng.jna.JnaDatabase; +import org.firebirdsql.jna.fbclient.FbClientLibrary; +import org.firebirdsql.nativeoo.gds.ng.FbInterface.*; +import org.firebirdsql.jna.fbclient.XSQLVAR; +import org.firebirdsql.logging.Logger; +import org.firebirdsql.logging.LoggerFactory; + +import java.nio.ByteBuffer; +import java.sql.SQLException; +import java.sql.SQLNonTransientException; + +import static org.firebirdsql.gds.ng.TransactionHelper.checkTransactionActive; + +/** + * Implementation of {@link org.firebirdsql.gds.ng.FbStatement} for native client access using OO API. + * + * @author Vasiliy Yashkov + * @since 4.0 + */ +public class IStatementImpl extends AbstractFbStatement { + + private static final Logger log = LoggerFactory.getLogger(IStatementImpl.class); + + private IDatabaseImpl database; + private final FbClientLibrary clientLibrary; + private IStatement statement; + private IResultSet cursor; + private IMessageMetadata inMeta; + private IMessageMetadata outMeta; + private ByteBuffer inMessage; + + public IStatementImpl(IDatabaseImpl database) { + super(database.getSynchronizationObject()); + this.database = database; + clientLibrary = database.getClientLibrary(); + } + + @Override + protected void free(int option) throws SQLException { + synchronized (getSynchronizationObject()) { + if (option == ISCConstants.DSQL_close) + cursor.close(database.getStatus()); + else + statement.free(database.getStatus()); + // Reset statement information + reset(option == ISCConstants.DSQL_drop); + } + } + + @Override + protected boolean isValidTransactionClass(Class transactionClass) { + return ITransactionImpl.class.isAssignableFrom(transactionClass); + } + + @Override + public FbDatabase getDatabase() { + return database; + } + + @Override + public int getHandle() { + throw new UnsupportedOperationException( "Native OO API not support statement handle" ); + } + + @Override + public void prepare(String statementText) throws SQLException { + try { + final byte[] statementArray = getDatabase().getEncoding().encodeToCharset(statementText); + if (statementArray.length > JnaDatabase.MAX_STATEMENT_LENGTH) { + throw FbExceptionBuilder.forException(JaybirdErrorCodes.jb_maxStatementLengthExceeded) + .messageParameter(JnaDatabase.MAX_STATEMENT_LENGTH) + .messageParameter(statementArray.length) + .toFlatSQLException(); + } + synchronized (getSynchronizationObject()) { + checkTransactionActive(getTransaction()); + final StatementState currentState = getState(); + if (!isPrepareAllowed(currentState)) { + throw new SQLNonTransientException(String.format("Current statement state (%s) does not allow call to prepare", currentState)); + } + resetAll(); + + final IDatabaseImpl db = (IDatabaseImpl) getDatabase(); + if (currentState == StatementState.NEW) { + // allocated when prepare call + switchState(StatementState.ALLOCATED); + setType(StatementType.NONE); + } else { + checkStatementValid(); + } + + IStatus status = db.getStatus(); + ITransactionImpl transaction = (ITransactionImpl) getTransaction(); + statement = db.getAttachment().prepare(status, transaction.getTransaction(), statementText.length(), statementText, + db.getConnectionDialect(), IStatement.PREPARE_PREFETCH_METADATA); + + outMeta = statement.getOutputMetadata(status); + inMeta = statement.getInputMetadata(status); + + final byte[] statementInfoRequestItems = getStatementInfoRequestItems(); + final int responseLength = getDefaultSqlInfoSize(); + byte[] statementInfo = getSqlInfo(statementInfoRequestItems, responseLength); + parseStatementInfo(statementInfo); + switchState(StatementState.PREPARED); + } + } catch (SQLException e) { + exceptionListenerDispatcher.errorOccurred(e); + throw e; + } + } + + @Override + public void execute(RowValue parameters) throws SQLException { + final StatementState initialState = getState(); + try { + synchronized (getSynchronizationObject()) { + checkStatementValid(); + checkTransactionActive(getTransaction()); + validateParameters(parameters); + reset(false); + + switchState(StatementState.EXECUTING); + + setMetaData(getParameterDescriptor(), parameters); + + IDatabaseImpl db = (IDatabaseImpl) getDatabase(); + IStatus status = db.getStatus(); + + final StatementType statementType = getType(); + final boolean hasSingletonResult = hasSingletonResult(); + ITransactionImpl transaction = (ITransactionImpl) getTransaction(); + + Pointer inPtr = null; + if (inMessage.array().length > 0) { + inPtr = new Memory(inMessage.array().length); + inPtr.write(0, inMessage.array(), 0, inMessage.array().length); + } + Pointer outPtr = null; + + if ((statement.getFlags(status) & IStatement.FLAG_HAS_CURSOR) == IStatement.FLAG_HAS_CURSOR) { + cursor = statement.openCursor(status, transaction.getTransaction(), inMeta, inPtr, outMeta, 0); + } else { + ByteBuffer outMessage = ByteBuffer.allocate(getMaxSqlInfoSize()); + outPtr = new Memory(outMessage.array().length); + outPtr.write(0, outMessage.array(), 0, outMessage.array().length); + status = db.getStatus(); + statement.execute(status, transaction.getTransaction(), inMeta, inPtr, outMeta, outPtr); + } + + if (hasSingletonResult) { + /* A type with a singleton result (ie an execute procedure with return fields), doesn't actually + * have a result set that will be fetched, instead we have a singleton result if we have fields + */ + statementListenerDispatcher.statementExecuted(this, false, true); + queueRowData(toRowValue(getFieldDescriptor(), outMeta, outPtr)); + setAllRowsFetched(true); + } else { + // A normal execute is never a singleton result (even if it only produces a single result) + statementListenerDispatcher.statementExecuted(this, hasFields(), false); + } + + if (getState() != StatementState.ERROR) { + switchState(statementType.isTypeWithCursor() ? StatementState.CURSOR_OPEN : StatementState.PREPARED); + } + } + } catch (SQLException e) { + if (getState() != StatementState.ERROR) { + switchState(initialState); + } + exceptionListenerDispatcher.errorOccurred(e); + throw e; + } + } + + protected void setMetaData(final RowDescriptor rowDescriptor, final RowValue parameters) throws FbException { + + IMaster master = database.getMaster(); + IStatus status = database.getStatus(); + IMetadataBuilder metadataBuilder = master.getMetadataBuilder(status, parameters.getCount()); + inMessage = ByteBuffer.allocate(inMeta.getMessageLength(status)); + int offset = 0; + byte[] nullShort = {0, 0}; + int align = 0; + + for (int idx = 0; idx < parameters.getCount(); idx++) { + + byte[] fieldData = parameters.getFieldData(idx); + if (fieldData == null) { + // Note this only works because we mark the type as nullable in allocateXSqlDa + + } else { + final FieldDescriptor fieldDescriptor = rowDescriptor.getFieldDescriptor(idx); + offset = inMeta.getOffset(status, idx) - align; + int nullOffset = inMeta.getNullOffset(status, idx); + inMessage.position(offset); + if (fieldDescriptor.isVarying()) { + metadataBuilder.setLength(status, idx, Math.min(fieldDescriptor.getLength(), fieldData.length)); + metadataBuilder.setType(status, idx, ISCConstants.SQL_VARYING); + metadataBuilder.setScale(status, idx, inMeta.getScale(status, idx)); + metadataBuilder.setSubType(status, idx, inMeta.getSubType(status, idx)); + metadataBuilder.setCharSet(status, idx, inMeta.getCharSet(status, idx)); + byte[] encodeShort = fieldDescriptor.getDatatypeCoder().encodeShort(fieldData.length); + inMessage.put(encodeShort); + offset += encodeShort.length; + inMessage.position(offset); + align += inMeta.getLength(status, idx) - fieldData.length; + } else if (fieldDescriptor.isFbType(ISCConstants.SQL_TEXT)) { + metadataBuilder.setLength(status, idx, Math.min(fieldDescriptor.getLength(), fieldData.length)); + metadataBuilder.setType(status, idx, ISCConstants.SQL_TEXT); + metadataBuilder.setScale(status, idx, inMeta.getScale(status, idx)); + metadataBuilder.setSubType(status, idx, inMeta.getSubType(status, idx)); + metadataBuilder.setCharSet(status, idx, inMeta.getCharSet(status, idx)); + align += inMeta.getLength(status, idx) - fieldData.length; + } else { + metadataBuilder.setLength(status, idx, inMeta.getLength(status, idx)); + metadataBuilder.setType(status, idx, fieldDescriptor.getType()); + metadataBuilder.setSubType(status, idx, fieldDescriptor.getSubType()); + metadataBuilder.setSubType(status, idx, inMeta.getSubType(status, idx)); + metadataBuilder.setCharSet(status, idx, inMeta.getCharSet(status, idx)); + } + inMessage.put(fieldData); + inMessage.position(nullOffset - align); + inMessage.put(nullShort); + } + } + + inMeta = metadataBuilder.getMetadata(status); + metadataBuilder.release(); + } + + @Override + public void fetchRows(int fetchSize) throws SQLException { + try { + synchronized (getSynchronizationObject()) { + checkStatementValid(); + if (!getState().isCursorOpen()) { + throw new FbExceptionBuilder().exception(ISCConstants.isc_cursor_not_open).toSQLException(); + } + if (isAllRowsFetched()) return; + + final IDatabaseImpl db = (IDatabaseImpl) getDatabase(); + IStatus status = db.getStatus(); + + ByteBuffer message = ByteBuffer.allocate(outMeta.getMessageLength(status) + 1); + Pointer ptr = new Memory(message.array().length); +// ptr.write(0, message.array(), 0, message.array().length); + int fetchStatus = cursor.fetchNext(status, ptr); + if (fetchStatus == IStatus.RESULT_OK) { + queueRowData(toRowValue(getFieldDescriptor(), outMeta, ptr)); + } else if (fetchStatus == IStatus.RESULT_NO_DATA) { + setAllRowsFetched(true); + // Note: we are not explicitly 'closing' the cursor here + } else { + final String errorMessage = "Unexpected fetch status (expected 0 or 100): " + fetchStatus; + log.error(errorMessage); + throw new SQLException(errorMessage); + } + } + } catch (SQLException e) { + exceptionListenerDispatcher.errorOccurred(e); + throw e; + } + } + + protected RowValue toRowValue(RowDescriptor rowDescriptor, IMessageMetadata meta, Pointer ptr) throws FbException { + final RowValueBuilder row = new RowValueBuilder(rowDescriptor); + + IStatus status = database.getStatus(); + + int columns = meta.getCount(status); + + for (int idx = 0; idx < columns; idx++) { + + row.setFieldIndex(idx); + int nullOffset = meta.getNullOffset(status, idx); + + if (ptr.getShort(nullOffset) == XSQLVAR.SQLIND_NULL) { + row.set(null); + } else { + int bufferLength = meta.getLength(status, idx); + int offset = meta.getOffset(status, idx); + + if (rowDescriptor.getFieldDescriptor(idx).isVarying()) { + bufferLength = ptr.getShort(offset) & 0xffff; + offset += 2; + } + + byte[] data = new byte[bufferLength]; + ptr.read(offset, data, 0, bufferLength); + row.set(data); + } + } + return row.toRowValue(false); + } + + @Override + public byte[] getSqlInfo(byte[] requestItems, int bufferLength) throws SQLException { + try { + final byte[] responseArr = new byte[bufferLength]; + final IDatabaseImpl db = (IDatabaseImpl) getDatabase(); + IStatus status = db.getStatus(); + + synchronized (getSynchronizationObject()) { + checkStatementValid(); + statement.getInfo(status, requestItems.length, requestItems, + bufferLength, responseArr); + } + + return responseArr; + } catch (SQLException e) { + exceptionListenerDispatcher.errorOccurred(e); + throw e; + } + } + + @Override + public int getDefaultSqlInfoSize() { + // TODO Test for an optimal buffer size + return getMaxSqlInfoSize(); + } + + @Override + public int getMaxSqlInfoSize() { + // TODO check this + return 65535; + } + + @Override + public void setCursorName(String cursorName) throws SQLException { + try { + synchronized (getSynchronizationObject()) { + checkStatementValid(); + final IDatabaseImpl db = (IDatabaseImpl) getDatabase(); + IStatus status = db.getStatus(); + statement.setCursorName(status, cursorName + '\0'); + } + } catch (SQLException e) { + exceptionListenerDispatcher.errorOccurred(e); + throw e; + } + } + + @Override + public RowDescriptor emptyRowDescriptor() { + return database.emptyRowDescriptor(); + } + + public FbMessageMetadata getInputMetadata() throws FbException { + return new IMessageMetadataImpl(database, inMeta); + } +} diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/ITransactionImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/ITransactionImpl.java new file mode 100644 index 0000000000..14dd82f5a6 --- /dev/null +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/ITransactionImpl.java @@ -0,0 +1,135 @@ +package org.firebirdsql.nativeoo.gds.ng; + +import org.firebirdsql.gds.ng.AbstractFbTransaction; +import org.firebirdsql.gds.ng.TransactionState; +import org.firebirdsql.jna.fbclient.FbClientLibrary; +import org.firebirdsql.nativeoo.gds.ng.FbInterface.*; +import org.firebirdsql.logging.Logger; +import org.firebirdsql.logging.LoggerFactory; + +import java.sql.SQLException; + +/** + * Implementation of {@link org.firebirdsql.gds.ng.FbTransaction} for native client access using OO API. + * + * @author Vasiliy Yashkov + * @since 4.0 + */ +public class ITransactionImpl extends AbstractFbTransaction { + + private static final Logger log = LoggerFactory.getLogger(ITransactionImpl.class); + + private final FbClientLibrary clientLibrary; + private final ITransaction transaction; + + public ITransactionImpl(IDatabaseImpl database, ITransaction iTransaction, TransactionState initialState) { + super(initialState, database); + transaction = iTransaction; + clientLibrary = database.getClientLibrary(); + } + + @Override + public IDatabaseImpl getDatabase() { + return (IDatabaseImpl)super.getDatabase(); + } + + @Override + public int getHandle() { + throw new UnsupportedOperationException( "Native OO API not support transaction handle" ); + } + + public ITransaction getTransaction() { + return transaction; + } + + @Override + public void commit() throws SQLException { + try { + synchronized (getSynchronizationObject()) { + final IDatabaseImpl db = getDatabase(); + db.checkConnected(); + switchState(TransactionState.COMMITTING); + transaction.commit(db.getStatus()); + switchState(TransactionState.COMMITTED); + } + } catch (SQLException e) { + exceptionListenerDispatcher.errorOccurred(e); + throw e; + } finally { + final TransactionState transactionState = getState(); + if (transactionState != TransactionState.COMMITTED) { + log.warn("Commit not completed, state was " + transactionState, + new RuntimeException("Commit not completed")); + } + } + } + + @Override + public void rollback() throws SQLException { + try { + synchronized (getSynchronizationObject()) { + final IDatabaseImpl db = getDatabase(); + db.checkConnected(); + switchState(TransactionState.ROLLING_BACK); + transaction.rollback(db.getStatus()); + switchState(TransactionState.ROLLED_BACK); + } + } catch (SQLException e) { + exceptionListenerDispatcher.errorOccurred(e); + throw e; + } finally { + final TransactionState transactionState = getState(); + if (transactionState != TransactionState.ROLLED_BACK) { + log.warn("Rollback not completed, state was " + transactionState, + new RuntimeException("Rollback not completed")); + } + } + } + + @Override + public void prepare(byte[] recoveryInformation) throws SQLException { + boolean noRecoveryInfo = recoveryInformation == null || recoveryInformation.length == 0; + try { + synchronized (getSynchronizationObject()) { + final IDatabaseImpl db = getDatabase(); + db.checkConnected(); + switchState(TransactionState.PREPARING); + if (noRecoveryInfo) { + // TODO check for recovery information + transaction.prepare(db.getStatus(), 0, + null); + } else { + transaction.prepare(db.getStatus(), (short) recoveryInformation.length, + recoveryInformation); + } + switchState(TransactionState.PREPARED); + } + } catch (SQLException e) { + exceptionListenerDispatcher.errorOccurred(e); + throw e; + } finally { + if (getState() != TransactionState.PREPARED) { + log.warn("Prepare not completed", new RuntimeException("Prepare not completed")); + } + } + } + + @Override + public byte[] getTransactionInfo(byte[] requestItems, int maxBufferLength) throws SQLException { + try { + final byte[] responseArray = new byte[maxBufferLength]; + synchronized (getSynchronizationObject()) { + final IDatabaseImpl db = getDatabase(); + db.checkConnected(); + transaction.getInfo(db.getStatus(), (short) requestItems.length, requestItems, + (short) maxBufferLength, responseArray); + } + + return responseArray; + } catch (SQLException e) { + exceptionListenerDispatcher.errorOccurred(e); + throw e; + } + } + +} diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/NativeDatabaseConnection.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/NativeDatabaseConnection.java new file mode 100644 index 0000000000..b92f9e65a4 --- /dev/null +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/NativeDatabaseConnection.java @@ -0,0 +1,45 @@ +package org.firebirdsql.nativeoo.gds.ng; + +import org.firebirdsql.encodings.EncodingFactory; +import org.firebirdsql.encodings.IEncodingFactory; +import org.firebirdsql.gds.ng.IConnectionProperties; +import org.firebirdsql.jna.fbclient.FbClientLibrary; + +import java.sql.SQLException; + +/** + * Class handling the initial setup of the native OO API database connection. + * + * @since 4.0 + */ +public class NativeDatabaseConnection extends AbstractNativeConnection { + + /** + * Creates a IDatabaseConnectionImpl (without establishing a connection to the server). + * + * @param clientLibrary + * Client library to use + * @param connectionProperties + * Connection properties + */ + public NativeDatabaseConnection(FbClientLibrary clientLibrary, IConnectionProperties connectionProperties) + throws SQLException { + this(clientLibrary, connectionProperties, EncodingFactory.getPlatformDefault()); + } + + /** + * Creates a IDatabaseConnectionImpl (without establishing a connection to the server). + * + * @param clientLibrary Client library to use + * @param attachProperties Attach properties + * @param encodingFactory + */ + protected NativeDatabaseConnection(FbClientLibrary clientLibrary, IConnectionProperties attachProperties, IEncodingFactory encodingFactory) throws SQLException { + super(clientLibrary, attachProperties, encodingFactory); + } + + @Override + public IDatabaseImpl identify() throws SQLException { + return new IDatabaseImpl(this); + } +} diff --git a/src/resources/META-INF/services/org.firebirdsql.gds.impl.GDSFactoryPlugin b/src/resources/META-INF/services/org.firebirdsql.gds.impl.GDSFactoryPlugin index 9dd6bb10a2..02e49edbbf 100644 --- a/src/resources/META-INF/services/org.firebirdsql.gds.impl.GDSFactoryPlugin +++ b/src/resources/META-INF/services/org.firebirdsql.gds.impl.GDSFactoryPlugin @@ -2,4 +2,7 @@ org.firebirdsql.gds.impl.wire.WireGDSFactoryPlugin org.firebirdsql.gds.impl.jni.NativeGDSFactoryPlugin org.firebirdsql.gds.impl.jni.LocalGDSFactoryPlugin org.firebirdsql.gds.impl.jni.EmbeddedGDSFactoryPlugin +org.firebirdsql.gds.impl.nativeoo.FbOONativeGDSFactoryPlugin +org.firebirdsql.gds.impl.nativeoo.FbOOLocalGDSFactoryPlugin +org.firebirdsql.gds.impl.nativeoo.FbOOEmbeddedGDSFactoryPlugin org.firebirdsql.gds.impl.oo.OOGDSFactoryPlugin diff --git a/src/test/org/firebirdsql/common/FBTestProperties.java b/src/test/org/firebirdsql/common/FBTestProperties.java index 8ed990de8b..6ff796d94a 100644 --- a/src/test/org/firebirdsql/common/FBTestProperties.java +++ b/src/test/org/firebirdsql/common/FBTestProperties.java @@ -166,6 +166,9 @@ public static FirebirdSupportInfo getDefaultSupportInfo() { gdsTypeToUrlPrefixMap.put(GDSType.getType("EMBEDDED"), "jdbc:firebirdsql:embedded:"); gdsTypeToUrlPrefixMap.put(GDSType.getType("NATIVE"), "jdbc:firebirdsql:native:"); gdsTypeToUrlPrefixMap.put(GDSType.getType("LOCAL"), "jdbc:firebirdsql:local:"); + gdsTypeToUrlPrefixMap.put(GDSType.getType("FBOOEMBEDDED"), "jdbc:firebirdsql:fboo:embedded:"); + gdsTypeToUrlPrefixMap.put(GDSType.getType("FBOONATIVE"), "jdbc:firebirdsql:fboo:native:"); + gdsTypeToUrlPrefixMap.put(GDSType.getType("FBOOLOCAL"), "jdbc:firebirdsql:fboo:local:"); gdsTypeToUrlPrefixMap.put(GDSType.getType("OOREMOTE"), "jdbc:firebirdsql:oo:"); // TODO Replace with an external definition/way to add additional types for third party plugins? diff --git a/src/test/org/firebirdsql/common/matchers/GdsTypeMatchers.java b/src/test/org/firebirdsql/common/matchers/GdsTypeMatchers.java index 5a93a4e3c8..346f5d5648 100644 --- a/src/test/org/firebirdsql/common/matchers/GdsTypeMatchers.java +++ b/src/test/org/firebirdsql/common/matchers/GdsTypeMatchers.java @@ -18,9 +18,10 @@ */ package org.firebirdsql.common.matchers; -import org.firebirdsql.gds.impl.jni.EmbeddedGDSFactoryPlugin; -import org.firebirdsql.gds.impl.jni.LocalGDSFactoryPlugin; -import org.firebirdsql.gds.impl.jni.NativeGDSFactoryPlugin; +import org.firebirdsql.gds.impl.jni.*; +import org.firebirdsql.gds.impl.nativeoo.FbOOEmbeddedGDSFactoryPlugin; +import org.firebirdsql.gds.impl.nativeoo.FbOOLocalGDSFactoryPlugin; +import org.firebirdsql.gds.impl.nativeoo.FbOONativeGDSFactoryPlugin; import org.firebirdsql.gds.impl.oo.OOGDSFactoryPlugin; import org.firebirdsql.gds.impl.wire.WireGDSFactoryPlugin; import org.hamcrest.Matcher; @@ -29,7 +30,6 @@ import java.util.Collections; import java.util.List; -import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.isIn; /** @@ -41,8 +41,11 @@ public class GdsTypeMatchers { private static final List PURE_JAVA_TYPES = Collections.unmodifiableList( Arrays.asList(WireGDSFactoryPlugin.PURE_JAVA_TYPE_NAME, OOGDSFactoryPlugin.TYPE_NAME)); + private static final List EMBEDDED_TYPES = Collections.unmodifiableList( + Arrays.asList(EmbeddedGDSFactoryPlugin.EMBEDDED_TYPE_NAME, FbOOEmbeddedGDSFactoryPlugin.EMBEDDED_TYPE_NAME)); private static final List OTHER_NATIVE_TYPES = Collections.unmodifiableList( - Arrays.asList(NativeGDSFactoryPlugin.NATIVE_TYPE_NAME, LocalGDSFactoryPlugin.LOCAL_TYPE_NAME)); + Arrays.asList(NativeGDSFactoryPlugin.NATIVE_TYPE_NAME, LocalGDSFactoryPlugin.LOCAL_TYPE_NAME, + FbOONativeGDSFactoryPlugin.NATIVE_TYPE_NAME, FbOOLocalGDSFactoryPlugin.LOCAL_TYPE_NAME)); /** * @return Matcher for pure java types @@ -55,7 +58,7 @@ public static Matcher isPureJavaType() { * @return Matcher for embedded types */ public static Matcher isEmbeddedType() { - return equalTo(EmbeddedGDSFactoryPlugin.EMBEDDED_TYPE_NAME); + return isIn(EMBEDDED_TYPES); } /** diff --git a/src/test/org/firebirdsql/common/rules/GdsTypeRule.java b/src/test/org/firebirdsql/common/rules/GdsTypeRule.java index 49feb8a23e..708c3a8ed8 100644 --- a/src/test/org/firebirdsql/common/rules/GdsTypeRule.java +++ b/src/test/org/firebirdsql/common/rules/GdsTypeRule.java @@ -21,9 +21,10 @@ package org.firebirdsql.common.rules; import org.firebirdsql.common.FBTestProperties; -import org.firebirdsql.gds.impl.jni.EmbeddedGDSFactoryPlugin; -import org.firebirdsql.gds.impl.jni.LocalGDSFactoryPlugin; -import org.firebirdsql.gds.impl.jni.NativeGDSFactoryPlugin; +import org.firebirdsql.gds.impl.jni.*; +import org.firebirdsql.gds.impl.nativeoo.FbOOEmbeddedGDSFactoryPlugin; +import org.firebirdsql.gds.impl.nativeoo.FbOOLocalGDSFactoryPlugin; +import org.firebirdsql.gds.impl.nativeoo.FbOONativeGDSFactoryPlugin; import org.hamcrest.Matcher; import org.junit.rules.TestRule; import org.junit.runner.Description; @@ -104,7 +105,8 @@ public static GdsTypeRule excludes(String... excludedTypes) { */ public static GdsTypeRule supportsNativeOnly() { return supports(NativeGDSFactoryPlugin.NATIVE_TYPE_NAME, EmbeddedGDSFactoryPlugin.EMBEDDED_TYPE_NAME, - LocalGDSFactoryPlugin.LOCAL_TYPE_NAME); + LocalGDSFactoryPlugin.LOCAL_TYPE_NAME, FbOONativeGDSFactoryPlugin.NATIVE_TYPE_NAME, + FbOOEmbeddedGDSFactoryPlugin.EMBEDDED_TYPE_NAME, FbOOLocalGDSFactoryPlugin.LOCAL_TYPE_NAME); } /** @@ -114,6 +116,7 @@ public static GdsTypeRule supportsNativeOnly() { */ public static GdsTypeRule excludesNativeOnly() { return excludes(NativeGDSFactoryPlugin.NATIVE_TYPE_NAME, EmbeddedGDSFactoryPlugin.EMBEDDED_TYPE_NAME, - LocalGDSFactoryPlugin.LOCAL_TYPE_NAME); + LocalGDSFactoryPlugin.LOCAL_TYPE_NAME, FbOONativeGDSFactoryPlugin.NATIVE_TYPE_NAME, + FbOOEmbeddedGDSFactoryPlugin.EMBEDDED_TYPE_NAME, FbOOLocalGDSFactoryPlugin.LOCAL_TYPE_NAME); } } diff --git a/src/test/org/firebirdsql/gds/impl/jni/TestEmbeddedServicesAPI.java b/src/test/org/firebirdsql/gds/impl/jni/TestEmbeddedServicesAPI.java new file mode 100644 index 0000000000..a680833faf --- /dev/null +++ b/src/test/org/firebirdsql/gds/impl/jni/TestEmbeddedServicesAPI.java @@ -0,0 +1,11 @@ +package org.firebirdsql.gds.impl.jni; + +import org.firebirdsql.gds.impl.GDSType; + +public class TestEmbeddedServicesAPI extends TestServicesAPI { + + public TestEmbeddedServicesAPI() { + gdsType = GDSType.getType(EmbeddedGDSFactoryPlugin.EMBEDDED_TYPE_NAME); + protocol = "jdbc:firebirdsql:embedded:"; + } +} diff --git a/src/test/org/firebirdsql/gds/impl/jni/TestFbOOEmbeddedServicesAPI.java b/src/test/org/firebirdsql/gds/impl/jni/TestFbOOEmbeddedServicesAPI.java new file mode 100644 index 0000000000..c1315c1c83 --- /dev/null +++ b/src/test/org/firebirdsql/gds/impl/jni/TestFbOOEmbeddedServicesAPI.java @@ -0,0 +1,12 @@ +package org.firebirdsql.gds.impl.jni; + +import org.firebirdsql.gds.impl.GDSType; +import org.firebirdsql.gds.impl.nativeoo.FbOOEmbeddedGDSFactoryPlugin; + +public class TestFbOOEmbeddedServicesAPI extends TestServicesAPI { + + public TestFbOOEmbeddedServicesAPI() { + gdsType = GDSType.getType(FbOOEmbeddedGDSFactoryPlugin.EMBEDDED_TYPE_NAME); + protocol = "jdbc:firebirdsql:fboo:embedded:"; + } +} diff --git a/src/test/org/firebirdsql/gds/impl/jni/TestFbOOLocalServicesAPI.java b/src/test/org/firebirdsql/gds/impl/jni/TestFbOOLocalServicesAPI.java new file mode 100644 index 0000000000..9b775b95f1 --- /dev/null +++ b/src/test/org/firebirdsql/gds/impl/jni/TestFbOOLocalServicesAPI.java @@ -0,0 +1,12 @@ +package org.firebirdsql.gds.impl.jni; + +import org.firebirdsql.gds.impl.GDSType; +import org.firebirdsql.gds.impl.nativeoo.FbOOLocalGDSFactoryPlugin; + +public class TestFbOOLocalServicesAPI extends TestServicesAPI { + + public TestFbOOLocalServicesAPI() { + gdsType = GDSType.getType(FbOOLocalGDSFactoryPlugin.LOCAL_TYPE_NAME); + protocol = "jdbc:firebirdsql:fboo:local:"; + } +} diff --git a/src/test/org/firebirdsql/gds/impl/jni/TestFbOONativeServicesAPI.java b/src/test/org/firebirdsql/gds/impl/jni/TestFbOONativeServicesAPI.java new file mode 100644 index 0000000000..959abb348b --- /dev/null +++ b/src/test/org/firebirdsql/gds/impl/jni/TestFbOONativeServicesAPI.java @@ -0,0 +1,13 @@ +package org.firebirdsql.gds.impl.jni; + +import org.firebirdsql.gds.impl.GDSType; +import org.firebirdsql.gds.impl.nativeoo.FbOONativeGDSFactoryPlugin; + +public class TestFbOONativeServicesAPI extends TestServicesAPI { + + public TestFbOONativeServicesAPI() { + gdsType = GDSType.getType(FbOONativeGDSFactoryPlugin.NATIVE_TYPE_NAME); + protocol = "jdbc:firebirdsql:fboo:native:"; + port = 3050; + } +} diff --git a/src/test/org/firebirdsql/gds/impl/jni/TestJaybirdBlobBackupProblem.java b/src/test/org/firebirdsql/gds/impl/jni/TestJaybirdBlobBackupProblem.java index fce5941642..133eb4e997 100644 --- a/src/test/org/firebirdsql/gds/impl/jni/TestJaybirdBlobBackupProblem.java +++ b/src/test/org/firebirdsql/gds/impl/jni/TestJaybirdBlobBackupProblem.java @@ -30,6 +30,7 @@ import org.firebirdsql.gds.ISCConstants; import org.firebirdsql.gds.ServiceRequestBuffer; import org.firebirdsql.gds.impl.GDSType; +import org.firebirdsql.gds.impl.nativeoo.FbOOEmbeddedGDSFactoryPlugin; import org.firebirdsql.gds.ng.FbDatabaseFactory; import org.firebirdsql.gds.ng.FbService; import org.firebirdsql.gds.ng.FbServiceProperties; @@ -93,7 +94,8 @@ public class TestJaybirdBlobBackupProblem { @ClassRule - public static final GdsTypeRule testTypes = GdsTypeRule.supports(EmbeddedGDSFactoryPlugin.EMBEDDED_TYPE_NAME); + public static final GdsTypeRule testTypes = GdsTypeRule.supports(EmbeddedGDSFactoryPlugin.EMBEDDED_TYPE_NAME, + FbOOEmbeddedGDSFactoryPlugin.EMBEDDED_TYPE_NAME); @Rule public final TemporaryFolder temporaryFolder = new TemporaryFolder(); diff --git a/src/test/org/firebirdsql/gds/impl/jni/TestLocalServicesAPI.java b/src/test/org/firebirdsql/gds/impl/jni/TestLocalServicesAPI.java new file mode 100644 index 0000000000..f4dbd5a365 --- /dev/null +++ b/src/test/org/firebirdsql/gds/impl/jni/TestLocalServicesAPI.java @@ -0,0 +1,11 @@ +package org.firebirdsql.gds.impl.jni; + +import org.firebirdsql.gds.impl.GDSType; + +public class TestLocalServicesAPI extends TestServicesAPI { + + public TestLocalServicesAPI() { + gdsType = GDSType.getType(LocalGDSFactoryPlugin.LOCAL_TYPE_NAME); + protocol = "jdbc:firebirdsql:local:"; + } +} diff --git a/src/test/org/firebirdsql/gds/impl/jni/TestNativeServicesAPI.java b/src/test/org/firebirdsql/gds/impl/jni/TestNativeServicesAPI.java new file mode 100644 index 0000000000..a94ecd2755 --- /dev/null +++ b/src/test/org/firebirdsql/gds/impl/jni/TestNativeServicesAPI.java @@ -0,0 +1,12 @@ +package org.firebirdsql.gds.impl.jni; + +import org.firebirdsql.gds.impl.GDSType; + +public class TestNativeServicesAPI extends TestServicesAPI { + + public TestNativeServicesAPI() { + gdsType = GDSType.getType(NativeGDSFactoryPlugin.NATIVE_TYPE_NAME); + protocol = "jdbc:firebirdsql:native:"; + port = 3050; + } +} diff --git a/src/test/org/firebirdsql/gds/impl/jni/TestServicesAPI.java b/src/test/org/firebirdsql/gds/impl/jni/TestServicesAPI.java index 42ebc03c15..e66e7b6d2d 100644 --- a/src/test/org/firebirdsql/gds/impl/jni/TestServicesAPI.java +++ b/src/test/org/firebirdsql/gds/impl/jni/TestServicesAPI.java @@ -45,33 +45,31 @@ * Initial tests for Services API. Currently run only against embedded server. * TODO: Make run against other types */ -public class TestServicesAPI { - - @ClassRule - public static final GdsTypeRule testType = GdsTypeRule.supports(EmbeddedGDSFactoryPlugin.EMBEDDED_TYPE_NAME); +public abstract class TestServicesAPI { @Rule public final TemporaryFolder temporaryFolder = new TemporaryFolder(); private final Logger log = LoggerFactory.getLogger(getClass()); - private String mAbsoluteDatabasePath; - private String mAbsoluteBackupPath; - private FBManager fbManager; - private GDSType gdsType; - private FbDatabaseFactory dbFactory; - private File logFolder; + protected String mAbsoluteDatabasePath; + protected String mAbsoluteBackupPath; + protected FBManager fbManager; + protected String protocol; + protected GDSType gdsType; + protected int port = 5066; + protected FbDatabaseFactory dbFactory; + protected File logFolder; @Before public void setUp() throws Exception { Class.forName(FBDriver.class.getName()); - gdsType = GDSType.getType(EmbeddedGDSFactoryPlugin.EMBEDDED_TYPE_NAME); dbFactory = GDSFactory.getDatabaseFactoryForType(gdsType); fbManager = new FBManager(gdsType); fbManager.setServer("localhost"); - fbManager.setPort(5066); + fbManager.setPort(port); fbManager.start(); File dbFolder = temporaryFolder.newFolder("db"); @@ -119,8 +117,8 @@ public void testBackupAndRestore() throws Exception { connectToDatabase(); } - private void connectToDatabase() throws SQLException { - Connection connection = DriverManager.getConnection("jdbc:firebirdsql:embedded:" + mAbsoluteDatabasePath + "?encoding=NONE", + protected void connectToDatabase() throws SQLException { + Connection connection = DriverManager.getConnection(protocol + mAbsoluteDatabasePath + "?encoding=NONE", "SYSDBA", "masterkey"); connection.close(); } diff --git a/src/test/org/firebirdsql/gds/impl/jni/TestSpecialFbOOEmbeddedServerUrls.java b/src/test/org/firebirdsql/gds/impl/jni/TestSpecialFbOOEmbeddedServerUrls.java new file mode 100644 index 0000000000..8e4ef6b9ea --- /dev/null +++ b/src/test/org/firebirdsql/gds/impl/jni/TestSpecialFbOOEmbeddedServerUrls.java @@ -0,0 +1,119 @@ +/* + * Firebird Open Source JavaEE Connector - JDBC Driver + * + * Distributable under LGPL license. + * You may obtain a copy of the License at http://www.gnu.org/copyleft/lgpl.html + * + * This program 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 + * LGPL License for more details. + * + * This file was created by members of the firebird development team. + * All individual contributions remain the Copyright (C) of those + * individuals. Contributors to this file are either listed here or + * can be obtained from a source control history command. + * + * All rights reserved. + */ +package org.firebirdsql.gds.impl.jni; + +import org.firebirdsql.common.rules.GdsTypeRule; +import org.firebirdsql.gds.impl.GDSType; +import org.firebirdsql.gds.impl.nativeoo.FbOOEmbeddedGDSFactoryPlugin; +import org.firebirdsql.jdbc.FBDriver; +import org.firebirdsql.management.FBManager; +import org.junit.*; +import org.junit.rules.TemporaryFolder; + +import java.io.File; +import java.sql.Connection; +import java.sql.DriverManager; + +public class TestSpecialFbOOEmbeddedServerUrls { + + @ClassRule + public static final GdsTypeRule testType = GdsTypeRule.supports(FbOOEmbeddedGDSFactoryPlugin.EMBEDDED_TYPE_NAME); + + @Rule + public final TemporaryFolder temporaryFolder = new TemporaryFolder(); + + private String mRelativeDatabasePath; + private String mAbsoluteDatabasePath; + private FBManager fbManager; + private GDSType gdsType; + + @Before + public void setUp() throws Exception { + Class.forName(FBDriver.class.getName()); + gdsType = GDSType.getType(FbOOEmbeddedGDSFactoryPlugin.EMBEDDED_TYPE_NAME); + fbManager = new FBManager(gdsType); + + fbManager.setServer("localhost"); + fbManager.setPort(5066); + fbManager.start(); + + File dbFolder = temporaryFolder.newFolder("db"); + + mRelativeDatabasePath = "testES01874.fdb"; + mAbsoluteDatabasePath = new File(dbFolder, mRelativeDatabasePath).getAbsolutePath(); + + fbManager.createDatabase(mAbsoluteDatabasePath, "SYSDBA", "masterkey"); + } + + @After + public void tearDown() throws Exception { + fbManager.dropDatabase(mAbsoluteDatabasePath, "SYSDBA", "masterkey"); + fbManager.stop(); + fbManager = null; + } + + @Test + public void testFBManagerWithoutSettingServerAndPort() throws Exception { + FBManager testFBManager = new FBManager(gdsType); + testFBManager.start(); + + testFBManager.dropDatabase(mAbsoluteDatabasePath, "SYSDBA", "masterkey"); + testFBManager.createDatabase(mAbsoluteDatabasePath, "SYSDBA", "masterkey"); + + testFBManager.stop(); + } + + @Test + public void testFBManagerWithRelativeDatabaseFile() throws Exception { + FBManager testFBManager = new FBManager(gdsType); + testFBManager.setDropOnStop(true); + try { + testFBManager.start(); + + testFBManager.createDatabase(mRelativeDatabasePath, "SYSDBA", "masterkey"); + } finally { + testFBManager.stop(); + } + } + + @Test + public void testDriverManagerGetConnectionWithoutServerAndPortInUrl() throws Exception { + Connection connection = DriverManager.getConnection("jdbc:firebirdsql:fboo:embedded:" + mAbsoluteDatabasePath +"?encoding=NONE", + "SYSDBA", "masterkey"); + connection.close(); + } + + @Test + public void testDriverManagerGetConnectionWithoutServerAndPortInUrlWithRelativeDatabasePath() throws Exception { + FBManager testFBManager = new FBManager(gdsType); + testFBManager.setDropOnStop(true); + try { + testFBManager.start(); + + testFBManager.createDatabase(mRelativeDatabasePath, "SYSDBA", "masterkey"); + + Connection connection = + DriverManager.getConnection("jdbc:firebirdsql:fboo:embedded:" + mRelativeDatabasePath + "?encoding=NONE", + "SYSDBA", "masterkey"); + connection.close(); + } finally { + testFBManager.stop(); + } + } +} diff --git a/src/test/org/firebirdsql/gds/ng/AbstractBatchTest.java b/src/test/org/firebirdsql/gds/ng/AbstractBatchTest.java new file mode 100644 index 0000000000..dd47da0659 --- /dev/null +++ b/src/test/org/firebirdsql/gds/ng/AbstractBatchTest.java @@ -0,0 +1,280 @@ +package org.firebirdsql.gds.ng; + +import org.firebirdsql.common.DdlHelper; +import org.firebirdsql.common.FBTestProperties; +import org.firebirdsql.common.rules.UsesDatabase; +import org.firebirdsql.gds.BatchParameterBuffer; +import org.firebirdsql.gds.ISCConstants; +import org.firebirdsql.gds.TransactionParameterBuffer; +import org.firebirdsql.gds.impl.BatchParameterBufferImpl; +import org.firebirdsql.gds.impl.TransactionParameterBufferImpl; +import org.firebirdsql.jdbc.FirebirdConnection; +import org.firebirdsql.nativeoo.gds.ng.FbInterface; +import org.firebirdsql.management.FBManager; +import org.firebirdsql.util.FirebirdSupportInfo; +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; + +import java.sql.*; + +import static org.firebirdsql.common.FBTestProperties.*; +import static org.firebirdsql.util.FirebirdSupportInfo.supportInfoFor; +import static org.junit.Assert.assertEquals; + +/** + * Generic tests for FbBatch. + *

+ * This abstract class is subclassed by the tests for specific FbBatch implementations. + *

+ * + * @author Vasiliy Yashkov + * @since 4.0 + */ +public abstract class AbstractBatchTest { + //@formatter:off + protected String CREATE_TABLE = + "CREATE TABLE test_p_metadata (" + + " id INTEGER, " + + " simple_field VARCHAR(60) CHARACTER SET WIN1251 COLLATE PXW_CYRL, " + + " two_byte_field VARCHAR(60) CHARACTER SET BIG_5, " + + " three_byte_field VARCHAR(60) CHARACTER SET UNICODE_FSS, " + + " long_field BIGINT, " + + " int_field INTEGER, " + + " short_field SMALLINT, " + + " float_field FLOAT, " + + " double_field DOUBLE PRECISION, " + + " smallint_numeric NUMERIC(3,1), " + + " integer_decimal_1 DECIMAL(3,1), " + + " integer_numeric NUMERIC(5,2), " + + " integer_decimal_2 DECIMAL(9,3), " + + " bigint_numeric NUMERIC(10,4), " + + " bigint_decimal DECIMAL(18,9), " + + " date_field DATE, " + + " time_field TIME, " + + " timestamp_field TIMESTAMP, " + + " blob_field BLOB, " + + " blob_text_field BLOB SUB_TYPE TEXT, " + + " blob_minus_one BLOB SUB_TYPE -1 " + + " /* boolean */ " + + " /* decfloat */ " + + " /* extended numerics */ " + + ")"; + + protected String INSERT_QUERY = "INSERT INTO test_p_metadata (" + + " id, " + + " simple_field, " + + " two_byte_field, " + + " three_byte_field, " + + " long_field, " + + " int_field, " + + " short_field, " + + " float_field, " + + " double_field, " + + " smallint_numeric, " + + " integer_decimal_1, " + + " integer_numeric, " + + " integer_decimal_2, " + + " bigint_numeric, " + + " bigint_decimal, " + + " date_field, " + + " time_field, " + + " timestamp_field, " + + " blob_field, " + + " blob_text_field, " + + " blob_minus_one " + + " /* boolean */ " + + " /* decfloat */ " + + " /* extended numerics */ " + + ") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?/* boolean-param *//* decfloat-param *//* extended numerics-param */)"; + + protected String TEST_QUERY = + "SELECT " + + "simple_field, two_byte_field, three_byte_field, long_field, int_field, short_field," + + "float_field, double_field, smallint_numeric, integer_decimal_1, integer_numeric," + + "integer_decimal_2, bigint_numeric, bigint_decimal, date_field, time_field," + + "timestamp_field, blob_field, blob_text_field, blob_minus_one " + + "/* boolean */ " + + "/* decfloat */ " + + "/* extended numerics */ " + + "FROM test_p_metadata"; + //@formatter:on + + protected FbDatabase db; + protected static FBManager fbManager; + // private Connection connection; + protected FbTransaction transaction; + protected PreparedStatement pstmt; + protected ParameterMetaData parameterMetaData; + protected FirebirdSupportInfo supportInfo; + protected FbMetadataBuilder metadataBuilder; + + // protected FbStatement statement; + protected final FbConnectionProperties connectionInfo; + + { + connectionInfo = new FbConnectionProperties(); + connectionInfo.setServerName(FBTestProperties.DB_SERVER_URL); + connectionInfo.setPortNumber(FBTestProperties.DB_SERVER_PORT); + connectionInfo.setUser(DB_USER); + connectionInfo.setPassword(DB_PASSWORD); + connectionInfo.setDatabaseName(FBTestProperties.getDatabasePath()); + connectionInfo.setEncoding("NONE"); + } + + @Rule + public final ExpectedException expectedException = ExpectedException.none(); + + @Rule + public final UsesDatabase usesDatabase = UsesDatabase.usesDatabase(); + + protected abstract Class getExpectedDatabaseType(); + + @Before + public final void setUp() throws Exception { + + fbManager = createFBManager(); + defaultDatabaseSetUp(fbManager); + + try (Connection con = FBTestProperties.getConnectionViaDriverManager()) { + supportInfo = supportInfoFor(con); + + if (!supportInfo.supportsBigint()) { + // No BIGINT support, replacing type so number of columns remain the same + CREATE_TABLE = CREATE_TABLE.replace("long_field BIGINT,", "long field DOUBLE PRECISION,"); + } + if (supportInfo.supportsBoolean()) { + CREATE_TABLE = CREATE_TABLE.replace("/* boolean */", ", boolean_field BOOLEAN"); + TEST_QUERY = TEST_QUERY.replace("/* boolean */", ", boolean_field").replace("/* boolean-param */", ", ?"); + INSERT_QUERY = INSERT_QUERY.replace("/* boolean */", ", boolean_field") + .replace("/* boolean-param */", ", ?"); + } + if (supportInfo.supportsDecfloat()) { + CREATE_TABLE = CREATE_TABLE.replace("/* decfloat */", + ", decfloat16_field DECFLOAT(16), decfloat34_field DECFLOAT(34)"); + TEST_QUERY = TEST_QUERY.replace("/* decfloat */", ", decfloat16_field, decfloat34_field") + .replace("/* decfloat-param */", ", ?, ?"); + INSERT_QUERY = INSERT_QUERY.replace("/* decfloat */", ", decfloat16_field, decfloat34_field") + .replace("/* decfloat-param */", ", ?, ?"); + } + if (supportInfo.supportsDecimalPrecision(34)) { + CREATE_TABLE = CREATE_TABLE.replace("/* extended numerics */", + ", col_numeric25_20 NUMERIC(25, 20), col_decimal30_5 DECIMAL(30,5)"); + TEST_QUERY = TEST_QUERY.replace("/* extended numerics */", ", col_numeric25_20, col_decimal30_5") + .replace("/* extended-num-param*/", ", ?, ?"); + INSERT_QUERY = INSERT_QUERY.replace("/* extended numerics */", ", col_numeric25_20, col_decimal30_5") + .replace("/* extended numerics-param */", ", ?, ?"); + } + + DdlHelper.executeCreateTable(con, CREATE_TABLE); + + pstmt = con.prepareStatement(TEST_QUERY); + parameterMetaData = pstmt.getParameterMetaData(); + } + + db = createDatabase(); + assertEquals("Unexpected FbDatabase implementation", getExpectedDatabaseType(), db.getClass()); + + db.attach(); + } + + public static FBManager createFBManager() { + return new FBManager(getGdsType()); + } + + public static FirebirdConnection getConnectionViaDriverManager() throws SQLException { + return (FirebirdConnection) DriverManager.getConnection(getUrl(), + getDefaultPropertiesForConnection()); + } + + protected abstract FbDatabase createDatabase() throws SQLException; + + @Test + public void testCreateBatchWithoutMetadata() throws SQLException { + allocateTransaction(); + BatchParameterBuffer buffer = new BatchParameterBufferImpl(); + buffer.addArgument(FbInterface.IBatch.TAG_RECORD_COUNTS, 1); + FbBatch batch = db.createBatch(transaction, INSERT_QUERY, buffer); + } + + @Test + public void testCreateBatchWithMetadata() throws SQLException { + allocateTransaction(); + + metadataBuilder = db.getMetadataBuilder(26); + metadataBuilder.addInteger(0); + metadataBuilder.addVarchar(1, 60); + metadataBuilder.addVarchar(2, 60); + metadataBuilder.addVarchar(3, 60); + metadataBuilder.addBigint(4); + metadataBuilder.addInteger(5); + metadataBuilder.addSmallint(6); + metadataBuilder.addFloat(7); + metadataBuilder.addDouble(8); + metadataBuilder.addNumeric(9, 3, 1); + metadataBuilder.addDecimal(10, 3, 1); + metadataBuilder.addNumeric(11, 5, 2); + metadataBuilder.addDecimal(12, 9, 3); + metadataBuilder.addNumeric(13, 10, 4); + metadataBuilder.addDecimal(14, 18, 9); + metadataBuilder.addDate(15); + metadataBuilder.addTime(16); + metadataBuilder.addTimestamp(17); + metadataBuilder.addBlob(18); + metadataBuilder.addBlob(19, 1); + metadataBuilder.addBlob(20, -1); + final FirebirdSupportInfo supportInfo = getDefaultSupportInfo(); + if (supportInfo.supportsBoolean()) { + metadataBuilder.addBoolean(21); + } + if (supportInfo.supportsDecfloat()) { + metadataBuilder.addDecfloat16(22); + metadataBuilder.addDecfloat34(23); + } + if (supportInfo.supportsDecimalPrecision(34)) { + metadataBuilder.addDecNumeric(24, 25, 20); + metadataBuilder.addDecDecimal(25, 30, 5); + } + + BatchParameterBuffer buffer = new BatchParameterBufferImpl(); + buffer.addArgument(FbInterface.IBatch.TAG_RECORD_COUNTS, 1); + FbBatch batch = db.createBatch(transaction, INSERT_QUERY, metadataBuilder.getMessageMetadata(), buffer); + } + + private FbTransaction getTransaction() throws SQLException { + TransactionParameterBuffer tpb = new TransactionParameterBufferImpl(); + tpb.addArgument(ISCConstants.isc_tpb_read_committed); + tpb.addArgument(ISCConstants.isc_tpb_rec_version); + tpb.addArgument(ISCConstants.isc_tpb_write); + tpb.addArgument(ISCConstants.isc_tpb_wait); + return db.startTransaction(tpb); + } + + protected void allocateTransaction() throws SQLException { + if (transaction == null || transaction.getState() != TransactionState.ACTIVE) { + transaction = getTransaction(); + } + } + + @After + public final void tearDown() throws Exception { + if (transaction != null) { + try { + transaction.commit(); + } catch (SQLException ex) { + System.out.println("Exception on transaction commit"); + ex.printStackTrace(); + } + } + if (db != null) { + try { + db.close(); + } catch (SQLException ex) { + System.out.println("Exception on detach"); + ex.printStackTrace(); + } + } + } +} diff --git a/src/test/org/firebirdsql/gds/ng/wire/version10/TestV10Database.java b/src/test/org/firebirdsql/gds/ng/wire/version10/TestV10Database.java index ba8062eac5..59d6e87614 100644 --- a/src/test/org/firebirdsql/gds/ng/wire/version10/TestV10Database.java +++ b/src/test/org/firebirdsql/gds/ng/wire/version10/TestV10Database.java @@ -434,7 +434,8 @@ private FbTransaction getTransaction(FbDatabase db) throws SQLException { private static void safelyClose(FbDatabase db) { if (db == null) return; try { - db.close(); + if (db.isAttached()) + db.close(); } catch (SQLException ex) { ex.printStackTrace(); } diff --git a/src/test/org/firebirdsql/jdbc/JDBCUrlPrefixTest.java b/src/test/org/firebirdsql/jdbc/JDBCUrlPrefixTest.java index b1d4542f09..5aa0de795f 100644 --- a/src/test/org/firebirdsql/jdbc/JDBCUrlPrefixTest.java +++ b/src/test/org/firebirdsql/jdbc/JDBCUrlPrefixTest.java @@ -20,9 +20,10 @@ import org.firebirdsql.common.FBTestProperties; import org.firebirdsql.common.rules.UsesDatabase; -import org.firebirdsql.gds.impl.jni.EmbeddedGDSFactoryPlugin; -import org.firebirdsql.gds.impl.jni.LocalGDSFactoryPlugin; -import org.firebirdsql.gds.impl.jni.NativeGDSFactoryPlugin; +import org.firebirdsql.gds.impl.jni.*; +import org.firebirdsql.gds.impl.nativeoo.FbOOEmbeddedGDSFactoryPlugin; +import org.firebirdsql.gds.impl.nativeoo.FbOOLocalGDSFactoryPlugin; +import org.firebirdsql.gds.impl.nativeoo.FbOONativeGDSFactoryPlugin; import org.firebirdsql.gds.impl.oo.OOGDSFactoryPlugin; import org.firebirdsql.gds.impl.wire.WireGDSFactoryPlugin; import org.firebirdsql.jca.FBManagedConnectionFactory; @@ -76,10 +77,16 @@ public static List parameters() { testCase("jdbc:firebird:oo:", OOGDSFactoryPlugin.TYPE_NAME), testCase("jdbc:firebirdsql:embedded:", EmbeddedGDSFactoryPlugin.EMBEDDED_TYPE_NAME), testCase("jdbc:firebird:embedded:", EmbeddedGDSFactoryPlugin.EMBEDDED_TYPE_NAME), + testCase("jdbc:firebirdsql:fboo:embedded:", FbOOEmbeddedGDSFactoryPlugin.EMBEDDED_TYPE_NAME), + testCase("jdbc:firebird:fboo:embedded:", FbOOEmbeddedGDSFactoryPlugin.EMBEDDED_TYPE_NAME), testCase("jdbc:firebirdsql:native:", NativeGDSFactoryPlugin.NATIVE_TYPE_NAME), testCase("jdbc:firebird:native:", NativeGDSFactoryPlugin.NATIVE_TYPE_NAME), + testCase("jdbc:firebirdsql:fboo:native:", FbOONativeGDSFactoryPlugin.NATIVE_TYPE_NAME), + testCase("jdbc:firebird:fboo:native:", FbOONativeGDSFactoryPlugin.NATIVE_TYPE_NAME), + testCase("jdbc:firebirdsql:local:", LocalGDSFactoryPlugin.LOCAL_TYPE_NAME), testCase("jdbc:firebird:local:", LocalGDSFactoryPlugin.LOCAL_TYPE_NAME), - testCase("jdbc:firebird:local:", LocalGDSFactoryPlugin.LOCAL_TYPE_NAME) + testCase("jdbc:firebirdsql:fboo:local:", FbOOLocalGDSFactoryPlugin.LOCAL_TYPE_NAME), + testCase("jdbc:firebird:fboo:local:", FbOOLocalGDSFactoryPlugin.LOCAL_TYPE_NAME) ); } diff --git a/src/test/org/firebirdsql/management/TestUserManager.java b/src/test/org/firebirdsql/management/TestUserManager.java index e2a24d5c87..1da19d6052 100644 --- a/src/test/org/firebirdsql/management/TestUserManager.java +++ b/src/test/org/firebirdsql/management/TestUserManager.java @@ -22,6 +22,7 @@ import org.firebirdsql.common.rules.GdsTypeRule; import org.firebirdsql.gds.ISCConstants; import org.firebirdsql.gds.impl.jni.EmbeddedGDSFactoryPlugin; +import org.firebirdsql.gds.impl.nativeoo.FbOOEmbeddedGDSFactoryPlugin; import org.junit.*; import java.sql.Connection; @@ -41,7 +42,8 @@ public class TestUserManager extends FBJUnit4TestBase { @ClassRule - public static final GdsTypeRule testType = GdsTypeRule.excludes(EmbeddedGDSFactoryPlugin.EMBEDDED_TYPE_NAME); + public static final GdsTypeRule testType = GdsTypeRule.excludes(EmbeddedGDSFactoryPlugin.EMBEDDED_TYPE_NAME, + FbOOEmbeddedGDSFactoryPlugin.EMBEDDED_TYPE_NAME); private static final String USER_NAME = "TESTUSER123"; From 48a11882d00aec948062d65916b2c3d44b83d142 Mon Sep 17 00:00:00 2001 From: Vasiliy Yashkov Date: Wed, 5 Dec 2018 16:20:50 +0300 Subject: [PATCH 02/12] Native OO interface fix 1. Removed FbException handling class. Now, to form an exception, the status vector is processed after native methods calls and an SQLException is generated. 2. Exception handling works with the specified database encoding. 3. Methods that do not have batches implementations throw FBDriverNotCapableException instead of SQLException. 4. The batch generation mechanisms is similar to the implementation of prepared statements: 4.1. The batch generates field descriptors based on the prepared statement. 4.2 If the batch is created from external metadata, then it makes field descriptors like a prepared statement. 4.3 The batch uses methods to set the request fields like a prepared statement. The conversion of data of these fields in this case is carried out by FBField class, which uses database encoding and other parameters. 5. Changed test class names. Instead of TestXXX, to XXXTest. 6. Using GdsTypeRule for native tests. 7. Minor bugs fixed. --- .../firebirdsql/gds/ng/jna/JnaDatabase.java | 7 +- .../firebirdsql/gds/BatchParameterBuffer.java | 161 -- .../firebirdsql/gds/ng/AbstractFbBatch.java | 266 +- .../gds/ng/AbstractFbMessageBuilder.java | 327 +-- .../gds/ng/AbstractFbStatement.java | 6 + src/main/org/firebirdsql/gds/ng/FbBatch.java | 39 +- .../gds/ng/FbBatchCompletionState.java | 32 +- .../firebirdsql/gds/ng/FbMessageBuilder.java | 102 +- .../firebirdsql/gds/ng/FbMessageMetadata.java | 36 +- .../firebirdsql/gds/ng/FbMetadataBuilder.java | 48 +- .../org/firebirdsql/gds/ng/FbStatement.java | 11 + .../gds/ng/wire/version10/V10Database.java | 7 +- ...estIBatchImpl.java => IBatchImplTest.java} | 826 +++--- ...{TestIBlobImpl.java => IBlobImplTest.java} | 9 +- ...tabaseImpl.java => IDatabaseImplTest.java} | 19 +- ...lockImpl.java => IEventBlockImplTest.java} | 18 +- ...l.java => IServiceConnectionImplTest.java} | 17 +- ...ServiceImpl.java => IServiceImplTest.java} | 16 +- ...ementImpl.java => IStatementImplTest.java} | 11 +- ...ionImpl.java => ITransactionImplTest.java} | 13 +- ...java => NativeDatabaseConnectionTest.java} | 17 +- .../gds/ng/AbstractNativeConnection.java | 104 +- .../nativeoo/gds/ng/CloseableMemory.java | 3 +- .../nativeoo/gds/ng/FbException.java | 131 - .../nativeoo/gds/ng/FbInterface.java | 2241 +++++++++-------- .../nativeoo/gds/ng/FbInterfaceException.java | 29 + .../nativeoo/gds/ng/FbInterfaceImpl.java | 9 - .../gds/ng/IBatchCompletionStateImpl.java | 69 +- .../nativeoo/gds/ng/IBatchImpl.java | 248 +- .../nativeoo/gds/ng/IBlobImpl.java | 55 +- .../nativeoo/gds/ng/IDatabaseImpl.java | 30 +- .../nativeoo/gds/ng/IEventBlockImpl.java | 2 +- .../nativeoo/gds/ng/IMessageMetadataImpl.java | 133 +- .../nativeoo/gds/ng/IMetadataBuilderImpl.java | 50 +- .../gds/ng/IParameterConverterImpl.java | 1 - .../nativeoo/gds/ng/IServiceImpl.java | 34 +- .../nativeoo/gds/ng/IStatementImpl.java | 120 +- .../nativeoo/gds/ng/ITransactionImpl.java | 25 +- .../gds/impl/jni/TestEmbeddedServicesAPI.java | 11 - .../impl/jni/TestFbOOEmbeddedServicesAPI.java | 12 - .../impl/jni/TestFbOOLocalServicesAPI.java | 12 - .../impl/jni/TestFbOONativeServicesAPI.java | 13 - .../gds/impl/jni/TestLocalServicesAPI.java | 11 - .../gds/impl/jni/TestNativeServicesAPI.java | 12 - .../gds/impl/jni/TestServicesAPI.java | 26 +- .../ng/wire/version10/TestV10Database.java | 3 +- src/test/unit_test_defaults.properties | 4 +- 47 files changed, 2885 insertions(+), 2491 deletions(-) rename src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/{TestIBatchImpl.java => IBatchImplTest.java} (70%) rename src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/{TestIBlobImpl.java => IBlobImplTest.java} (98%) mode change 100644 => 100755 rename src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/{TestIDatabaseImpl.java => IDatabaseImplTest.java} (96%) rename src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/{TestIEventBlockImpl.java => IEventBlockImplTest.java} (93%) rename src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/{TestIServiceConnectionImpl.java => IServiceConnectionImplTest.java} (83%) rename src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/{TestIServiceImpl.java => IServiceImplTest.java} (93%) rename src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/{TestIStatementImpl.java => IStatementImplTest.java} (97%) rename src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/{TestITransactionImpl.java => ITransactionImplTest.java} (64%) rename src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/{TestNativeDatabaseConnection.java => NativeDatabaseConnectionTest.java} (83%) delete mode 100644 src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbException.java create mode 100644 src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbInterfaceException.java delete mode 100644 src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbInterfaceImpl.java delete mode 100644 src/test/org/firebirdsql/gds/impl/jni/TestEmbeddedServicesAPI.java delete mode 100644 src/test/org/firebirdsql/gds/impl/jni/TestFbOOEmbeddedServicesAPI.java delete mode 100644 src/test/org/firebirdsql/gds/impl/jni/TestFbOOLocalServicesAPI.java delete mode 100644 src/test/org/firebirdsql/gds/impl/jni/TestFbOONativeServicesAPI.java delete mode 100644 src/test/org/firebirdsql/gds/impl/jni/TestLocalServicesAPI.java delete mode 100644 src/test/org/firebirdsql/gds/impl/jni/TestNativeServicesAPI.java diff --git a/src/jna-client/org/firebirdsql/gds/ng/jna/JnaDatabase.java b/src/jna-client/org/firebirdsql/gds/ng/jna/JnaDatabase.java index 5c0d7c0baf..74d5908edc 100644 --- a/src/jna-client/org/firebirdsql/gds/ng/jna/JnaDatabase.java +++ b/src/jna-client/org/firebirdsql/gds/ng/jna/JnaDatabase.java @@ -25,6 +25,7 @@ import org.firebirdsql.gds.impl.DatabaseParameterBufferExtension; import org.firebirdsql.gds.ng.*; import org.firebirdsql.gds.ng.listeners.TransactionListener; +import org.firebirdsql.jdbc.FBDriverNotCapableException; import org.firebirdsql.jna.fbclient.FbClientLibrary; import org.firebirdsql.jna.fbclient.ISC_STATUS; import org.firebirdsql.jna.fbclient.WinFbClientLibrary; @@ -473,17 +474,17 @@ public void cancelEvent(EventHandle eventHandle) throws SQLException { @Override public FbBatch createBatch(FbTransaction transaction, String statement, FbMessageMetadata metadata, BatchParameterBuffer parameters) throws SQLException { - throw new SQLException("Not implemented"); + throw new FBDriverNotCapableException(); } @Override public FbBatch createBatch(FbTransaction transaction, String statement, BatchParameterBuffer parameters) throws SQLException { - throw new SQLException("Not implemented"); + throw new FBDriverNotCapableException(); } @Override public FbMetadataBuilder getMetadataBuilder(int fieldCount) throws SQLException { - throw new SQLException("Not implemented"); + throw new FBDriverNotCapableException(); } private void processStatusVector() throws SQLException { diff --git a/src/main/org/firebirdsql/gds/BatchParameterBuffer.java b/src/main/org/firebirdsql/gds/BatchParameterBuffer.java index 1594febfbb..92b6f6f9b3 100644 --- a/src/main/org/firebirdsql/gds/BatchParameterBuffer.java +++ b/src/main/org/firebirdsql/gds/BatchParameterBuffer.java @@ -1,12 +1,5 @@ package org.firebirdsql.gds; -import org.firebirdsql.encodings.Encoding; -import org.firebirdsql.gds.impl.wire.Xdrable; - -import java.io.IOException; -import java.io.OutputStream; -import java.util.Iterator; - /** * * @author Vasiliy Yashkov @@ -14,158 +7,4 @@ */ public interface BatchParameterBuffer extends ParameterBuffer { - /** - * @return The parameter buffer type identifier - */ - int getType(); - - /** - * Add argument with no parameters. - * - * @param argumentType - * type of argument. - */ - void addArgument(int argumentType); - - /** - * Add string argument with the default encoding. - * - * @param argumentType - * type of argument. - * @param value - * string value to add. - */ - void addArgument(int argumentType, String value); - - /** - * Add string argument. - * - * @param argumentType - * type of argument. - * @param value - * string value to add. - * @param encoding - * encoding to use for conversion to bytes - */ - void addArgument(int argumentType, String value, Encoding encoding); - - /** - * Add integer argument. - * - * @param argumentType - * type of argument. - * @param value - * integer value to add. - */ - void addArgument(int argumentType, int value); - - /** - * Add long argument. - * - * @param argumentType - * type of argument. - * @param value - * long value to add. - */ - void addArgument(int argumentType, long value); - - /** - * Add array of bytes. - * - * @param argumentType - * type of argument. - * @param content - * content of argument. - */ - void addArgument(int argumentType, byte[] content); - - /** - * Remove specified argument. - * - * @param argumentType - * type of argument to remove. - */ - void removeArgument(int argumentType); - - /** - * Get argument as string. - * - * @param argumentType - * type of argument to find. - * @return argument as string or null if nothing found. - */ - String getArgumentAsString(int argumentType); - - /** - * Get argument as int. - * - * @param argumentType - * type of argument to find. - * @return argument as string or 0 if nothing found. - */ - int getArgumentAsInt(int argumentType); - - /** - * Check if this parameter buffer has specified argument. - * - * @param argumentType - * type of argument to find. - * @return true if this buffer contains specified argument. - */ - boolean hasArgument(int argumentType); - - /** - * Returns an iterator over a copy of the parameters in this parameter buffer. - *

- * It is safe to iterate over this iterator while modifying the parameter buffer. Changes will not be reflected in - * the iterator. - *

- * - * @return Iterator over the parameters in this parameter buffer. - */ - @Override - Iterator iterator(); - - /** - * Writes the arguments in the implementation specific serialization into the {@code OutputStream}. - * - * @param outputStream - * The {@code OutputStream} to write to - * @throws IOException - * Errors produced by the output stream during writes - */ - void writeArgumentsTo(OutputStream outputStream) throws IOException; - - /** - * @return {@code Xdrable} to write (and optionally read) this instance as Xdr. - */ - Xdrable toXdrable(); - - /** - * Converts this parameter buffer to a byte array. - *

- * This byte array includes the extra header-bytes (if any), but does not include the type information - *

- * - * @return Byte array with serialization of this parameter buffer - * @see #toBytesWithType() - */ - byte[] toBytes(); - - /** - * Converts this parameter buffer to a byte array with type information. - *

- * This byte array includes the type information and the extra header bytes (if any). - *

- * - * @return Byte array with serialization of this parameter buffer - * @see #toBytes() - */ - byte[] toBytesWithType(); - - /** - * @return the number of parameters stored. - */ - int size(); - } diff --git a/src/main/org/firebirdsql/gds/ng/AbstractFbBatch.java b/src/main/org/firebirdsql/gds/ng/AbstractFbBatch.java index d46bf8deae..81cde24b56 100644 --- a/src/main/org/firebirdsql/gds/ng/AbstractFbBatch.java +++ b/src/main/org/firebirdsql/gds/ng/AbstractFbBatch.java @@ -1,11 +1,29 @@ package org.firebirdsql.gds.ng; import org.firebirdsql.gds.BatchParameterBuffer; +import org.firebirdsql.gds.ng.fields.FieldDescriptor; +import org.firebirdsql.gds.ng.fields.RowDescriptor; +import org.firebirdsql.gds.ng.fields.RowValue; import org.firebirdsql.gds.ng.listeners.ExceptionListener; import org.firebirdsql.gds.ng.listeners.ExceptionListenerDispatcher; +import org.firebirdsql.jdbc.FBBlob; +import org.firebirdsql.jdbc.FBClob; +import org.firebirdsql.jdbc.FBDriverNotCapableException; +import org.firebirdsql.jdbc.SQLStateConstants; +import org.firebirdsql.jdbc.field.FBField; +import org.firebirdsql.jdbc.field.FBWorkaroundStringField; +import org.firebirdsql.jdbc.field.FieldDataProvider; import org.firebirdsql.logging.Logger; import org.firebirdsql.logging.LoggerFactory; +import java.io.InputStream; +import java.io.Reader; +import java.math.BigDecimal; +import java.net.URL; +import java.sql.*; +import java.util.ArrayList; +import java.util.List; + /** * * @author Vasiliy Yashkov @@ -13,31 +31,24 @@ */ public abstract class AbstractFbBatch implements FbBatch { - private static final Logger log = LoggerFactory.getLogger(AbstractFbBatch.class); + public static final String METHOD_NOT_SUPPORTED = + "This method is only supported on Statement and not supported on PreparedStatement and CallableStatement"; + private static final String UNICODE_STREAM_NOT_SUPPORTED = "Unicode stream not supported."; private final Object syncObject; protected final ExceptionListenerDispatcher exceptionListenerDispatcher = new ExceptionListenerDispatcher(this); private final BatchParameterBuffer batchParameterBuffer; - private FbTransaction transaction; + protected FbTransaction transaction; private FbDatabase database; - private String statement; - private FbMessageMetadata metadata; - protected AbstractFbBatch(FbDatabase database, FbTransaction transaction, String statement, FbMessageMetadata metadata, BatchParameterBuffer batchParameterBuffer) { - this.syncObject = database.getSynchronizationObject(); - this.database = database; - this.transaction = transaction; - this.batchParameterBuffer = batchParameterBuffer; - this.statement = statement; - this.metadata = metadata; - } + private RowDescriptor rowDescriptor; + private FBField[] fields = null; + private RowValue fieldValues; - protected AbstractFbBatch(FbDatabase database, FbTransaction transaction, String statement, BatchParameterBuffer batchParameterBuffer) { + protected AbstractFbBatch(FbDatabase database, BatchParameterBuffer batchParameterBuffer) { this.syncObject = database.getSynchronizationObject(); this.database = database; - this.transaction = transaction; this.batchParameterBuffer = batchParameterBuffer; - this.statement = statement; } @Override @@ -72,15 +83,230 @@ public FbDatabase getDatabase() { return database; } - public void setDatabase(FbDatabase database) { + public void setDatabase(final FbDatabase database) { this.database = database; } - public String getStatement() { - return statement; + protected RowValue getFieldValues() { + return fieldValues; + } + + /** + * Creating a string descriptor from metadata. + * + * @throws SQLException + */ + protected void prepareBatch() throws SQLException { + + if (getStatement() != null) + rowDescriptor = getStatement().getParameterDescriptor(); + else + rowDescriptor = createRowDescriptor(); + assert rowDescriptor != null : "RowDescriptor should not be null after prepare"; + + int fieldCount = rowDescriptor.getCount(); + fieldValues = rowDescriptor.createDefaultFieldValues(); + fields = new FBField[fieldCount]; + + for (int i = 0; i < fieldCount; i++) { + final int fieldPosition = i; + + FieldDataProvider dataProvider = new FieldDataProvider() { + public byte[] getFieldData() { + return fieldValues.getFieldData(fieldPosition); + } + + public void setFieldData(byte[] data) { + fieldValues.setFieldData(fieldPosition, data); + } + }; + + fields[i] = FBField.createField(getParameterDescriptor(i + 1), + dataProvider, null, false); + } + } + + protected RowDescriptor createRowDescriptor() throws SQLException { + List fieldDescriptors = new ArrayList<>(); + FbMessageMetadata metadata = getMetadata(); + int count = metadata.getCount(); + for (int i = 0; i < count; i++) { + fieldDescriptors.add(new FieldDescriptor(i, + getDatabase().getDatatypeCoder(), + metadata.getType(i), + metadata.getSubType(i), + metadata.getScale(i), + metadata.getLength(i), + metadata.getField(i), + null, + null, + null, + null)); + } + return RowDescriptor.createRowDescriptor(fieldDescriptors.toArray(new FieldDescriptor[0]), + getDatabase().getDatatypeCoder()); + } + + public void setNull(int parameterIndex, int sqlType) throws SQLException { + getField(parameterIndex).setNull(); + } + + public void setBinaryStream(int parameterIndex, InputStream inputStream, int length) throws SQLException { + getField(parameterIndex).setBinaryStream(inputStream, length); + } + + public void setBinaryStream(int parameterIndex, InputStream inputStream, long length) throws SQLException { + getField(parameterIndex).setBinaryStream(inputStream, length); + } + + public void setBinaryStream(int parameterIndex, InputStream inputStream) throws SQLException { + getField(parameterIndex).setBinaryStream(inputStream); + } + + public void setBytes(int parameterIndex, byte[] x) throws SQLException { + getField(parameterIndex).setBytes(x); + } + + public void setBoolean(int parameterIndex, boolean x) throws SQLException { + getField(parameterIndex).setBoolean(x); + } + + public void setByte(int parameterIndex, byte x) throws SQLException { + getField(parameterIndex).setByte(x); + } + + public void setDate(int parameterIndex, Date x) throws SQLException { + getField(parameterIndex).setDate(x); + } + + public void setDouble(int parameterIndex, double x) throws SQLException { + getField(parameterIndex).setDouble(x); + } + + public void setFloat(int parameterIndex, float x) throws SQLException { + getField(parameterIndex).setFloat(x); + } + + public void setInt(int parameterIndex, int x) throws SQLException { + getField(parameterIndex).setInteger(x); + } + + public void setLong(int parameterIndex, long x) throws SQLException { + getField(parameterIndex).setLong(x); + } + + public void setObject(int parameterIndex, Object x) throws SQLException { + getField(parameterIndex).setObject(x); + } + + public void setShort(int parameterIndex, short x) throws SQLException { + getField(parameterIndex).setShort(x); + } + + public void setString(int parameterIndex, String x) throws SQLException { + getField(parameterIndex).setString(x); + } + + public void setTime(int parameterIndex, Time x) throws SQLException { + getField(parameterIndex).setTime(x); + } + + public void setTimestamp(int parameterIndex, Timestamp x) throws SQLException { + getField(parameterIndex).setTimestamp(x); + } + + public void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException { + getField(parameterIndex).setBigDecimal(x); + } + + /** + * Returns the {@link FieldDescriptor} of the specified parameter. + * + * @param columnIndex 1-based index of the parameter + * @return Field descriptor + */ + protected FieldDescriptor getParameterDescriptor(int columnIndex) throws SQLException { + return rowDescriptor.getFieldDescriptor(columnIndex - 1); + } + + /** + * Factory method for the field access objects + */ + protected FBField getField(int columnIndex) throws SQLException { + if (columnIndex > fields.length) { + throw new SQLException("Invalid column index: " + columnIndex, SQLStateConstants.SQL_STATE_INVALID_COLUMN); + } + + return fields[columnIndex - 1]; + } + + /** + *

+ * Implementation note: works identical to {@link #setBinaryStream(int, InputStream, int)}. + *

+ */ + public final void setAsciiStream(int parameterIndex, InputStream x, int length) throws SQLException { + setBinaryStream(parameterIndex, x, length); + } + + /** + *

+ * Implementation note: works identical to {@link #setBinaryStream(int, InputStream, long)}. + *

+ */ + public final void setAsciiStream(int parameterIndex, InputStream x, long length) throws SQLException { + setBinaryStream(parameterIndex, x, length); + } + + /** + *

+ * Implementation note: works identical to {@link #setBinaryStream(int, InputStream)}. + *

+ */ + public final void setAsciiStream(int parameterIndex, InputStream x) throws SQLException { + setBinaryStream(parameterIndex, x); + } + + /** + *

+ * Implementation note: This method behaves exactly the same as {@link #setString(int, String)}. + *

+ */ + public void setNString(int parameterIndex, String value) throws SQLException { + setString(parameterIndex, value); + } + + public void clearParameters() throws SQLException { + if (fieldValues != null) { + fieldValues.reset(); + } + } + + /** + *

+ * Implementation note: ignores {@code scale} and {@code targetSqlType} and works as + * {@link #setObject(int, Object)}. + *

+ */ + public void setObject(int parameterIndex, Object x, int targetSqlType, int scale) throws SQLException { + setObject(parameterIndex, x); + } + + /** + *

+ * Implementation note: ignores {@code targetSqlType} and works as {@link #setObject(int, Object)}. + *

+ */ + public void setObject(int parameterIndex, Object x, int targetSqlType) throws SQLException { + setObject(parameterIndex, x); + } + + + protected void setBlob(int parameterIndex, Blob blob) throws SQLException { + getField(parameterIndex).setBlob((FBBlob) blob); } - public void setStatement(String statement) { - this.statement = statement; + protected void setClob(int parameterIndex, Clob clob) throws SQLException { + getField(parameterIndex).setClob((FBClob) clob); } } diff --git a/src/main/org/firebirdsql/gds/ng/AbstractFbMessageBuilder.java b/src/main/org/firebirdsql/gds/ng/AbstractFbMessageBuilder.java index 3783121beb..f828271cdf 100644 --- a/src/main/org/firebirdsql/gds/ng/AbstractFbMessageBuilder.java +++ b/src/main/org/firebirdsql/gds/ng/AbstractFbMessageBuilder.java @@ -1,28 +1,11 @@ package org.firebirdsql.gds.ng; -import org.firebirdsql.encodings.EncodingFactory; -import org.firebirdsql.extern.decimal.Decimal128; -import org.firebirdsql.extern.decimal.Decimal64; import org.firebirdsql.gds.BlobParameterBuffer; -import org.firebirdsql.gds.ng.FbBatch; -import org.firebirdsql.gds.ng.FbMessageBuilder; -import org.firebirdsql.gds.ng.FbMessageMetadata; -import org.firebirdsql.gds.ng.SeekableByteArrayOutputStream; -import org.firebirdsql.gds.ng.jna.LittleEndianDatatypeCoder; +import org.firebirdsql.gds.ng.fields.FieldDescriptor; import java.io.IOException; -import java.math.BigDecimal; -import java.math.BigInteger; import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.sql.Date; import java.sql.SQLException; -import java.sql.Time; -import java.sql.Timestamp; - -import static org.firebirdsql.gds.ISCConstants.SQL_INT64; -import static org.firebirdsql.gds.ISCConstants.SQL_LONG; -import static org.firebirdsql.gds.ISCConstants.SQL_SHORT; /** * Common implementation of {@link org.firebirdsql.gds.ng.FbMessageBuilder} to build firebird message @@ -32,15 +15,17 @@ */ public abstract class AbstractFbMessageBuilder implements FbMessageBuilder { - private FbMessageMetadata metadata; - private ByteBuffer buffer; - private final LittleEndianDatatypeCoder datatypeCoder = new LittleEndianDatatypeCoder(EncodingFactory.createInstance(StandardCharsets.UTF_8)); + private final FbMessageMetadata metadata; + private final FbStatement statement; + private final ByteBuffer buffer; private final SeekableByteArrayOutputStream stream = new SeekableByteArrayOutputStream(); private final SeekableByteArrayOutputStream blobStream = new SeekableByteArrayOutputStream(); - private int messageAlign; - private int messageLength; - private int blobAlign; + private final int messageAlign; + private final int messageLength; + private final int blobAlign; + private final byte[] nulls = new byte[] {0, 0}; private int segmentedBlobSize = 0; + private int segmentedBlobOffset = 0; private int align(int target, int alignment) { return (((target) + alignment - 1) & ~(alignment - 1)); @@ -48,6 +33,7 @@ private int align(int target, int alignment) { protected AbstractFbMessageBuilder(E batch) throws SQLException { this.metadata = batch.getMetadata(); + this.statement = batch.getStatement(); this.messageLength = metadata.getMessageLength(); this.messageAlign = metadata.getAlignedLength(); this.blobAlign = batch.getBlobAlignment(); @@ -55,267 +41,30 @@ protected AbstractFbMessageBuilder(E batch) throws SQLException { } @Override - public void addSmallint(int index, short value) throws SQLException { - int nullOffset = metadata.getNullOffset(index); - int offset = metadata.getOffset(index); - - byte[] bytes = datatypeCoder.encodeShort(value); - byte[] nullShort = datatypeCoder.encodeShort(0); - - buffer.position(offset); - buffer.put(bytes); - buffer.position(nullOffset); - buffer.put(nullShort); - } - - @Override - public void addInteger(int index, int value) throws SQLException { + public void addData(int index, byte[] data, FieldDescriptor parameterDescriptor) throws SQLException { int nullOffset = metadata.getNullOffset(index); int offset = metadata.getOffset(index); - byte[] bytes = datatypeCoder.encodeInt(value); - byte[] nullShort = datatypeCoder.encodeShort(0); - - buffer.position(offset); - buffer.put(bytes); - buffer.position(nullOffset); - buffer.put(nullShort); - } - - @Override - public void addBigint(int index, long value) throws SQLException { - int nullOffset = metadata.getNullOffset(index); - int offset = metadata.getOffset(index); - - byte[] bytes = datatypeCoder.encodeLong(value); - byte[] nullShort = datatypeCoder.encodeShort(0); - - buffer.position(offset); - buffer.put(bytes); - buffer.position(nullOffset); - buffer.put(nullShort); - } - - @Override - public void addFloat(int index, float value) throws SQLException { - int nullOffset = metadata.getNullOffset(index); - int offset = metadata.getOffset(index); - - byte[] bytes = datatypeCoder.encodeFloat(value); - byte[] nullShort = datatypeCoder.encodeShort(0); - - buffer.position(offset); - buffer.put(bytes); - buffer.position(nullOffset); - buffer.put(nullShort); - } - - @Override - public void addDouble(int index, double value) throws SQLException { - int nullOffset = metadata.getNullOffset(index); - int offset = metadata.getOffset(index); - int type = metadata.getType(index); - byte[] bytes = null; - if (type == SQL_INT64) { - BigDecimal decimal = BigDecimal.valueOf(value); - BigInteger integer = decimal.unscaledValue(); - bytes = datatypeCoder.encodeLong(integer.longValue()); + if (parameterDescriptor.isVarying()) { + byte[] dataLen; + if (data == null) + dataLen = parameterDescriptor.getDatatypeCoder().encodeShort(0); + else + dataLen = parameterDescriptor.getDatatypeCoder().encodeShort(data.length); + buffer.position(offset); + buffer.put(dataLen); + offset += dataLen.length; } - else - bytes = datatypeCoder.encodeDouble(value); - byte[] nullShort = datatypeCoder.encodeShort(0); buffer.position(offset); - buffer.put(bytes); - buffer.position(nullOffset); - buffer.put(nullShort); - } - - @Override - public void addNumeric(int index, double value) throws SQLException { - int nullOffset = metadata.getNullOffset(index); - int offset = metadata.getOffset(index); - int type = metadata.getType(index); - byte[] bytes = null; - if (type == SQL_INT64) { - BigDecimal decimal = BigDecimal.valueOf(value); - BigInteger integer = decimal.unscaledValue(); - bytes = datatypeCoder.encodeLong(integer.longValue()); - } else if (type == SQL_SHORT) { - BigDecimal decimal = BigDecimal.valueOf(value); - short encodedShort = (short)decimal.unscaledValue().intValue(); - bytes = datatypeCoder.encodeShort(encodedShort); - } else if (type == SQL_LONG) { -// long encodedLong = Double.doubleToLongBits(value); - BigDecimal decimal = BigDecimal.valueOf(value); - long encodedLong = (short)decimal.unscaledValue().longValue(); - bytes = datatypeCoder.encodeLong(encodedLong); - } - byte[] nullShort = datatypeCoder.encodeShort(0); - - buffer.position(offset); - buffer.put(bytes); - buffer.position(nullOffset); - buffer.put(nullShort); - } - - @Override - public void addDecimal(int index, double value) throws SQLException { - int nullOffset = metadata.getNullOffset(index); - int offset = metadata.getOffset(index); - int type = metadata.getType(index); - byte[] bytes = null; - if (type == SQL_INT64) { - BigDecimal decimal = BigDecimal.valueOf(value); - BigInteger integer = decimal.unscaledValue(); - bytes = datatypeCoder.encodeLong(integer.longValue()); - } else if (type == SQL_SHORT) { - BigDecimal decimal = BigDecimal.valueOf(value); - short encodedShort = (short)decimal.unscaledValue().intValue(); - bytes = datatypeCoder.encodeShort(encodedShort); - } else if (type == SQL_LONG) { - BigDecimal decimal = BigDecimal.valueOf(value); - long encodedLong = decimal.unscaledValue().longValue(); - bytes = datatypeCoder.encodeLong(encodedLong); + if (data == null) { + buffer.position(nullOffset); + buffer.put(parameterDescriptor.getDatatypeCoder().encodeShort(1)); + } else { + buffer.put(data); + buffer.position(nullOffset); + buffer.put(nulls); } - byte[] nullShort = datatypeCoder.encodeShort(0); - - buffer.position(offset); - buffer.put(bytes); - buffer.position(nullOffset); - buffer.put(nullShort); - } - - @Override - public void addDecfloat16(int index, BigDecimal value) throws SQLException { - final Decimal64 decimal128 = Decimal64.valueOf(value); - int nullOffset = metadata.getNullOffset(index); - int offset = metadata.getOffset(index); - - byte[] bytes = datatypeCoder.encodeDecimal64(decimal128); - byte[] nullShort = datatypeCoder.encodeShort(0); - - buffer.position(offset); - buffer.put(bytes); - buffer.position(nullOffset); - buffer.put(nullShort); - } - - @Override - public void addDecfloat34(int index, BigDecimal value) throws SQLException { - final Decimal128 decimal128 = Decimal128.valueOf(value); - int nullOffset = metadata.getNullOffset(index); - int offset = metadata.getOffset(index); - - byte[] bytes = datatypeCoder.encodeDecimal128(decimal128); - byte[] nullShort = datatypeCoder.encodeShort(0); - - buffer.position(offset); - buffer.put(bytes); - buffer.position(nullOffset); - buffer.put(nullShort); - } - - @Override - public void addBlob(int index, long blobId) throws SQLException { - int nullOffset = metadata.getNullOffset(index); - int offset = metadata.getOffset(index); - - byte[] bytes = datatypeCoder.encodeLong(blobId); - byte[] nullShort = datatypeCoder.encodeShort(0); - - buffer.position(offset); - buffer.put(bytes); - buffer.position(nullOffset); - buffer.put(nullShort); - } - - @Override - public void addBoolean(int index, boolean value) throws SQLException { - int nullOffset = metadata.getNullOffset(index); - int offset = metadata.getOffset(index); - - byte[] bytes = datatypeCoder.encodeBoolean(value); - byte[] nullShort = datatypeCoder.encodeShort(0); - - buffer.position(offset); - buffer.put(bytes); - buffer.position(nullOffset); - buffer.put(nullShort); - } - - @Override - public void addDate(int index, Date value) throws SQLException { - int nullOffset = metadata.getNullOffset(index); - int offset = metadata.getOffset(index); - - byte[] bytes = datatypeCoder.encodeDate(value); - byte[] nullShort = datatypeCoder.encodeShort(0); - - buffer.position(offset); - buffer.put(bytes); - buffer.position(nullOffset); - buffer.put(nullShort); - } - - @Override - public void addTime(int index, Time value) throws SQLException { - int nullOffset = metadata.getNullOffset(index); - int offset = metadata.getOffset(index); - - byte[] bytes = datatypeCoder.encodeTime(value); - byte[] nullShort = datatypeCoder.encodeShort(0); - - buffer.position(offset); - buffer.put(bytes); - buffer.position(nullOffset); - buffer.put(nullShort); - } - - @Override - public void addTimestamp(int index, Timestamp value) throws SQLException { - int nullOffset = metadata.getNullOffset(index); - int offset = metadata.getOffset(index); - - byte[] bytes = datatypeCoder.encodeTimestamp(value); - byte[] nullShort = datatypeCoder.encodeShort(0); - - buffer.position(offset); - buffer.put(bytes); - buffer.position(nullOffset); - buffer.put(nullShort); - } - - @Override - public void addChar(int index, String value) throws SQLException { - int nullOffset = metadata.getNullOffset(index); - int offset = metadata.getOffset(index); - - byte[] bytes = datatypeCoder.encodeString(value); - byte[] nullShort = datatypeCoder.encodeShort(0); - - buffer.position(offset); - buffer.put(bytes); - buffer.position(nullOffset); - buffer.put(nullShort); - } - - @Override - public void addVarchar(int index, String value) throws SQLException { - int nullOffset = metadata.getNullOffset(index); - int offset = metadata.getOffset(index); - - byte[] bytes = datatypeCoder.encodeString(value); - byte[] encodeShort = datatypeCoder.encodeShort(bytes.length); - byte[] nullShort = datatypeCoder.encodeShort(0); - - buffer.position(offset); - buffer.put(encodeShort); - offset += encodeShort.length; - buffer.position(offset); - buffer.put(bytes); - buffer.position(nullOffset); - buffer.put(nullShort); } @Override @@ -359,7 +108,7 @@ public void addBlobData(byte[] data, long blobId) throws IOException { long oldPosition = blobStream.getStreamPosition(); blobStream.seek(position); - blobStream.write(datatypeCoder.encodeInt(data.length)); + blobStream.write(statement.getDatabase().getDatatypeCoder().encodeInt(data.length)); blobStream.seek(oldPosition); @@ -381,39 +130,39 @@ public long addBlobHeader(long blobId, BlobParameterBuffer buffer) throws IOExce blobStream.write(shift); } - blobStream.write(datatypeCoder.encodeLong(blobId)); + blobStream.write(statement.getDatabase().getDatatypeCoder().encodeLong(blobId)); - int rc = blobStream.size(); - segmentedBlobSize = rc; + segmentedBlobOffset = blobStream.size(); + segmentedBlobSize = segmentedBlobOffset; if (buffer != null) { byte[] bytes = buffer.toBytesWithType(); - byte[] bytesLength = datatypeCoder.encodeInt(bytes.length); + byte[] bytesLength = statement.getDatabase().getDatatypeCoder().encodeInt(bytes.length); blobStream.write(bytesLength); blobStream.write(bytesLength); blobStream.write(bytes); } else { - byte[] bytesLength = datatypeCoder.encodeInt(0); + byte[] bytesLength = statement.getDatabase().getDatatypeCoder().encodeInt(0); blobStream.write(bytesLength); blobStream.write(bytesLength); } - return rc; + return segmentedBlobOffset; } @Override - public void addBlobSegment(byte[] data, long offset, boolean lastSegment) throws IOException { + public void addBlobSegment(byte[] data, boolean lastSegment) throws IOException { int align = align(blobStream.size(), FbBatch.BLOB_SEGHDR_ALIGN); if (align != 0 && blobStream.size() - align < 0) { byte[] shift = ByteBuffer.allocate(Math.abs(blobStream.size() - align)).array(); blobStream.write(shift); } long oldPosition = blobStream.getStreamPosition(); - blobStream.seek(offset); + blobStream.seek(segmentedBlobOffset); - byte[] dataLength = datatypeCoder.encodeShort(data.length); + byte[] dataLength = statement.getDatabase().getDatatypeCoder().encodeShort(data.length); segmentedBlobSize += align(data.length + dataLength.length, FbBatch.BLOB_SEGHDR_ALIGN); - blobStream.write(datatypeCoder.encodeShort(segmentedBlobSize)); + blobStream.write(statement.getDatabase().getDatatypeCoder().encodeShort(segmentedBlobSize)); blobStream.seek(oldPosition); diff --git a/src/main/org/firebirdsql/gds/ng/AbstractFbStatement.java b/src/main/org/firebirdsql/gds/ng/AbstractFbStatement.java index bc4374cdf9..48a3e8255f 100644 --- a/src/main/org/firebirdsql/gds/ng/AbstractFbStatement.java +++ b/src/main/org/firebirdsql/gds/ng/AbstractFbStatement.java @@ -18,10 +18,12 @@ */ package org.firebirdsql.gds.ng; +import org.firebirdsql.gds.BatchParameterBuffer; import org.firebirdsql.gds.ISCConstants; import org.firebirdsql.gds.ng.fields.RowDescriptor; import org.firebirdsql.gds.ng.fields.RowValue; import org.firebirdsql.gds.ng.listeners.*; +import org.firebirdsql.jdbc.FBDriverNotCapableException; import org.firebirdsql.jdbc.SQLStateConstants; import org.firebirdsql.logging.Logger; import org.firebirdsql.logging.LoggerFactory; @@ -604,4 +606,8 @@ protected final boolean hasFields() { RowDescriptor fieldDescriptor = getFieldDescriptor(); return fieldDescriptor != null && fieldDescriptor.getCount() > 0; } + + public FbBatch createBatch(BatchParameterBuffer parameters) throws SQLException { + throw new FBDriverNotCapableException(); + } } diff --git a/src/main/org/firebirdsql/gds/ng/FbBatch.java b/src/main/org/firebirdsql/gds/ng/FbBatch.java index 54d110fcfa..d7ed217f24 100644 --- a/src/main/org/firebirdsql/gds/ng/FbBatch.java +++ b/src/main/org/firebirdsql/gds/ng/FbBatch.java @@ -4,6 +4,7 @@ import org.firebirdsql.gds.BlobParameterBuffer; import org.firebirdsql.gds.ng.listeners.ExceptionListenable; +import java.io.IOException; import java.sql.SQLException; /** @@ -19,6 +20,7 @@ public interface FbBatch extends ExceptionListenable { int VERSION1 = 1; + // continue batch executing in case of errors in some messages int TAG_MULTIERROR = 1; int TAG_RECORD_COUNTS = 2; int TAG_BUFFER_BYTES_SIZE = 3; @@ -41,25 +43,45 @@ public interface FbBatch extends ExceptionListenable { FbDatabase getDatabase(); /** - * Add data in this batch for record number. + * Add data in this batch. */ - void add(int count, byte[] inBuffer) throws SQLException; + void addBatch() throws SQLException; + + /** + * Add existing blob in this batch. + */ + void addBlob(int index, long blobId) throws SQLException; /** * Add blob in this batch and ID will be generated by engine. */ - FbBlob addBlob(byte[] inBuffer, BlobParameterBuffer buffer) throws SQLException; + FbBlob addBlob(int index, byte[] inBuffer, BlobParameterBuffer buffer) throws SQLException; + + /** + * Add blob in this batch. + */ + FbBlob addBlob(int index, byte[] inBuffer, long blobId, BlobParameterBuffer buffer) throws SQLException; /** * Add blob in this batch. */ - FbBlob addBlob(byte[] inBuffer, long blobId, BlobParameterBuffer buffer) throws SQLException; + void addSegmentedBlob(int index, long blobId, BlobParameterBuffer buffer) throws SQLException, IOException; /** * Append blob data. */ void appendBlobData(byte[] inBuffer) throws SQLException; + /** + * Add data to existing blob. + */ + void appendBlobData(byte[] data, long blobId) throws IOException; + + /** + * Add data to segmented blob. + */ + void addBlobSegment(byte[] data, boolean lastSegment) throws IOException, SQLException; + /** * Add blob stream. */ @@ -68,11 +90,11 @@ public interface FbBatch extends ExceptionListenable { /** * Register existing blob. */ - void registerBlob(long existingBlob, long blobId) throws SQLException; + void registerBlob(int index, long existingBlob, long blobId) throws SQLException; /** * Execute tis batch and - * @return completion state. + * @return {@link FbBatchCompletionState} completion state. */ FbBatchCompletionState execute() throws SQLException; @@ -95,4 +117,9 @@ public interface FbBatch extends ExceptionListenable { * Set default batch parameters buffer. */ void setDefaultBpb(int parLength, byte[] par) throws SQLException; + + /** + * @return The statement that contains prepared fields info. + */ + FbStatement getStatement() throws SQLException; } diff --git a/src/main/org/firebirdsql/gds/ng/FbBatchCompletionState.java b/src/main/org/firebirdsql/gds/ng/FbBatchCompletionState.java index f746466b62..c43a3bb528 100644 --- a/src/main/org/firebirdsql/gds/ng/FbBatchCompletionState.java +++ b/src/main/org/firebirdsql/gds/ng/FbBatchCompletionState.java @@ -1,8 +1,12 @@ package org.firebirdsql.gds.ng; -import org.firebirdsql.nativeoo.gds.ng.FbException; +import java.sql.SQLException; /** + * Getting a results of statements execution in a batch. + *

+ * Returns after executing the {@link FbBatch} execute method. + *

* * @author Vasiliy Yashkov * @since 4.0 @@ -13,11 +17,29 @@ public interface FbBatchCompletionState { int SUCCESS_NO_INFO = -2; int NO_MORE_ERRORS = -1; - int getSize() throws FbException; + /** + * @return Count of executed statements. + */ + int getSize() throws SQLException; - int getState(int index) throws FbException; + /** + * @return The state of a statement with a specific index. + */ + int getState(int index) throws SQLException; - String getError(int index) throws FbException; + /** + * @return The string with error of a statement with a specific index. + */ + String getError(int index) throws SQLException; - String getAllStates() throws FbException; + /** + * @return Returns a string with the result of all statements, + * including error descriptions. + */ + String printAllStates() throws SQLException; + + /** + * @return Returns a array with the result of all statements. + */ + int[] getAllStates() throws SQLException; } diff --git a/src/main/org/firebirdsql/gds/ng/FbMessageBuilder.java b/src/main/org/firebirdsql/gds/ng/FbMessageBuilder.java index 952d118955..40cabc679a 100644 --- a/src/main/org/firebirdsql/gds/ng/FbMessageBuilder.java +++ b/src/main/org/firebirdsql/gds/ng/FbMessageBuilder.java @@ -1,65 +1,91 @@ package org.firebirdsql.gds.ng; import org.firebirdsql.gds.BlobParameterBuffer; +import org.firebirdsql.gds.ng.fields.FieldDescriptor; import java.io.IOException; -import java.math.BigDecimal; -import java.sql.Date; import java.sql.SQLException; -import java.sql.Time; -import java.sql.Timestamp; +/** + * Interface to building row message for {@link FbBatch}. + * + * @author Vasiliy Yashkov + * @since 4.0 + */ public interface FbMessageBuilder { - void addSmallint(int index, short value) throws SQLException; - - void addInteger(int index, int value) throws SQLException; - - void addBigint(int index, long value) throws SQLException; - - void addFloat(int index, float value) throws SQLException; - - void addDouble(int index, double value) throws SQLException; - - void addNumeric(int index, double value) throws SQLException; - - void addDecimal(int index, double value) throws SQLException; - - void addDecfloat16(int index, BigDecimal value) throws SQLException; - - void addDecfloat34(int index, BigDecimal value) throws SQLException; - - void addBlob(int index, long blobId) throws SQLException; - - void addBoolean(int index, boolean value) throws SQLException; - - void addDate(int index, Date value) throws SQLException; - - void addTime(int index, Time value) throws SQLException; - - void addTimestamp(int index, Timestamp value) throws SQLException; - - void addChar(int index, String value) throws SQLException; - - void addVarchar(int index, String value) throws SQLException; - + /** + * Add field data to message. + * + * @param index of field in statement. + * @param data of field + * @param parameterDescriptor field descriptor + * @throws SQLException + */ + void addData(int index, byte[] data, FieldDescriptor parameterDescriptor) throws SQLException; + + /** + * + * @return batch message. + */ byte[] getData(); + /** + * Clear batch. + */ void clear(); + /** + * Add blob stream to batch. + * @param data stream data. + * @throws IOException + */ void addStreamData(byte[] data) throws IOException; + /** + * Get stream bytes. + * @return + */ byte[] getStreamData(); + /** + * Clear stream data. + */ void clearStream(); + /** + * Add data for blob with id. + * @param data blob data. + * @param blobId blob id. + * @throws IOException + */ void addBlobData(byte[] data, long blobId) throws IOException; + /** + * Add blob header to message if blob is segmented. + * @param blobId blob id. + * @param buffer blob parameters. + * @return + * @throws IOException + */ long addBlobHeader(long blobId, BlobParameterBuffer buffer) throws IOException; - void addBlobSegment(byte[] data, long offset, boolean lastSegment) throws IOException; - + /** + * Add segmented data to segmented blob. + * @param data blob data. + * @param lastSegment indicates whether the added segment is the last portion of the blob. + * @throws IOException + */ + void addBlobSegment(byte[] data, boolean lastSegment) throws IOException; + + /** + * + * @return blob stream bytes. + */ byte[] getBlobStreamData(); + /** + * Clear blob stream data. + */ void clearBlobStream(); } diff --git a/src/main/org/firebirdsql/gds/ng/FbMessageMetadata.java b/src/main/org/firebirdsql/gds/ng/FbMessageMetadata.java index 0e17a8f7bc..8d07d85382 100644 --- a/src/main/org/firebirdsql/gds/ng/FbMessageMetadata.java +++ b/src/main/org/firebirdsql/gds/ng/FbMessageMetadata.java @@ -1,44 +1,46 @@ package org.firebirdsql.gds.ng; -import org.firebirdsql.nativeoo.gds.ng.FbException; import org.firebirdsql.nativeoo.gds.ng.FbInterface.*; +import java.sql.SQLException; + /** + * Interface to access batch fields metadata * * @author Vasiliy Yashkov * @since 4.0 */ public interface FbMessageMetadata { - int getOffset(int index) throws FbException; + int getOffset(int index) throws SQLException; - int getNullOffset(int index) throws FbException; + int getNullOffset(int index) throws SQLException; - int getLength(int index) throws FbException; + int getLength(int index) throws SQLException; - String getAlias(int index) throws FbException; + String getAlias(int index) throws SQLException; - String getField(int index) throws FbException; + String getField(int index) throws SQLException; - String getOwner(int index) throws FbException; + String getOwner(int index) throws SQLException; - String getRelation(int index) throws FbException; + String getRelation(int index) throws SQLException; - int getAlignedLength() throws FbException; + int getAlignedLength() throws SQLException; - int getAlignment() throws FbException; + int getAlignment() throws SQLException; - int getCount() throws FbException; + int getCount() throws SQLException; - int getCharSet(int index) throws FbException; + int getCharSet(int index) throws SQLException; - int getMessageLength() throws FbException; + int getMessageLength() throws SQLException; - int getScale(int index) throws FbException; + int getScale(int index) throws SQLException; - int getSubType(int index) throws FbException; + int getSubType(int index) throws SQLException; - int getType(int index) throws FbException; + int getType(int index) throws SQLException; - IMetadataBuilder getBuilder() throws FbException; + IMetadataBuilder getBuilder() throws SQLException; } diff --git a/src/main/org/firebirdsql/gds/ng/FbMetadataBuilder.java b/src/main/org/firebirdsql/gds/ng/FbMetadataBuilder.java index 9f42588e85..04a154a40c 100644 --- a/src/main/org/firebirdsql/gds/ng/FbMetadataBuilder.java +++ b/src/main/org/firebirdsql/gds/ng/FbMetadataBuilder.java @@ -1,6 +1,6 @@ package org.firebirdsql.gds.ng; -import org.firebirdsql.nativeoo.gds.ng.FbException; +import java.sql.SQLException; /** * @@ -9,49 +9,49 @@ */ public interface FbMetadataBuilder { - FbMessageMetadata getMessageMetadata() throws FbException; + FbMessageMetadata getMessageMetadata() throws SQLException; - int addField() throws FbException; + int addField() throws SQLException; - void addSmallint(int index) throws FbException; + void addSmallint(int index) throws SQLException; - void addInteger(int index) throws FbException; + void addInteger(int index) throws SQLException; - void addBigint(int index) throws FbException; + void addBigint(int index) throws SQLException; - void addFloat(int index) throws FbException; + void addFloat(int index) throws SQLException; - void addNumeric(int index, int size, int scale) throws FbException; + void addNumeric(int index, int size, int scale) throws SQLException; - void addDecimal(int index, int size, int scale) throws FbException; + void addDecimal(int index, int size, int scale) throws SQLException; - void addDouble(int index) throws FbException; + void addDouble(int index) throws SQLException; - void addDecfloat16(int index) throws FbException; + void addDecfloat16(int index) throws SQLException; - void addDecfloat34(int index) throws FbException; + void addDecfloat34(int index) throws SQLException; - void addBlob(int index) throws FbException; + void addBlob(int index) throws SQLException; - void addBlob(int index, int subtype) throws FbException; + void addBlob(int index, int subtype) throws SQLException; - void addBoolean(int index) throws FbException; + void addBoolean(int index) throws SQLException; - void addDate(int index) throws FbException; + void addDate(int index) throws SQLException; - void addTime(int index) throws FbException; + void addTime(int index) throws SQLException; - void addTimestamp(int index) throws FbException; + void addTimestamp(int index) throws SQLException; - void addChar(int index, int length) throws FbException; + void addChar(int index, int length) throws SQLException; - void addVarchar(int index, int length) throws FbException; + void addVarchar(int index, int length) throws SQLException; - void addChar(int index, int length, int charSet) throws FbException; + void addChar(int index, int length, int charSet) throws SQLException; - void addVarchar(int index, int length, int charSet) throws FbException; + void addVarchar(int index, int length, int charSet) throws SQLException; - void addDecDecimal(int index, int size, int scale) throws FbException; + void addDecDecimal(int index, int size, int scale) throws SQLException; - void addDecNumeric(int index, int size, int scale) throws FbException; + void addDecNumeric(int index, int size, int scale) throws SQLException; } diff --git a/src/main/org/firebirdsql/gds/ng/FbStatement.java b/src/main/org/firebirdsql/gds/ng/FbStatement.java index 3f0b82ff88..62a01a94ed 100644 --- a/src/main/org/firebirdsql/gds/ng/FbStatement.java +++ b/src/main/org/firebirdsql/gds/ng/FbStatement.java @@ -24,6 +24,7 @@ */ package org.firebirdsql.gds.ng; +import org.firebirdsql.gds.BatchParameterBuffer; import org.firebirdsql.gds.ng.fields.RowDescriptor; import org.firebirdsql.gds.ng.fields.RowValue; import org.firebirdsql.gds.ng.listeners.ExceptionListenable; @@ -258,4 +259,14 @@ public interface FbStatement extends ExceptionListenable { * @return A potentially cached empty row descriptor for this statement or database. */ RowDescriptor emptyRowDescriptor(); + + /** + * Creates a batch that call prepared statement to get a metadata. + * + * @param parameters + * Batch parameters buffer {@link BatchParameterBuffer} + * @return Instance of {@link FbBatch} + * @throws SQLException + */ + FbBatch createBatch(BatchParameterBuffer parameters) throws SQLException; } diff --git a/src/main/org/firebirdsql/gds/ng/wire/version10/V10Database.java b/src/main/org/firebirdsql/gds/ng/wire/version10/V10Database.java index 84df4b59b6..c077ef5c2f 100644 --- a/src/main/org/firebirdsql/gds/ng/wire/version10/V10Database.java +++ b/src/main/org/firebirdsql/gds/ng/wire/version10/V10Database.java @@ -32,6 +32,7 @@ import org.firebirdsql.gds.ng.dbcrypt.DbCryptCallback; import org.firebirdsql.gds.ng.fields.BlrCalculator; import org.firebirdsql.gds.ng.wire.*; +import org.firebirdsql.jdbc.FBDriverNotCapableException; import org.firebirdsql.jdbc.SQLStateConstants; import org.firebirdsql.logging.Logger; import org.firebirdsql.logging.LoggerFactory; @@ -79,17 +80,17 @@ public final int getHandle() { @Override public FbBatch createBatch(FbTransaction transaction, String statement, FbMessageMetadata metadata, BatchParameterBuffer parameters) throws SQLException { - throw new SQLException("Not implemented"); + throw new FBDriverNotCapableException(); } @Override public FbBatch createBatch(FbTransaction transaction, String statement, BatchParameterBuffer parameters) throws SQLException { - throw new SQLException("Not implemented"); + throw new FBDriverNotCapableException(); } @Override public FbMetadataBuilder getMetadataBuilder(int fieldCount) throws SQLException { - throw new SQLException("Not implemented"); + throw new FBDriverNotCapableException(); } @Override diff --git a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/TestIBatchImpl.java b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IBatchImplTest.java similarity index 70% rename from src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/TestIBatchImpl.java rename to src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IBatchImplTest.java index 01b5f822e3..d08a319854 100644 --- a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/TestIBatchImpl.java +++ b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IBatchImplTest.java @@ -1,5 +1,7 @@ package org.firebirdsql.nativeoo.gds.ng; +import org.firebirdsql.common.FBTestProperties; +import org.firebirdsql.common.rules.GdsTypeRule; import org.firebirdsql.gds.BatchParameterBuffer; import org.firebirdsql.gds.BlobParameterBuffer; import org.firebirdsql.gds.ISCConstants; @@ -9,16 +11,15 @@ import org.firebirdsql.gds.ng.jna.AbstractNativeDatabaseFactory; import org.firebirdsql.gds.ng.wire.SimpleStatementListener; import org.firebirdsql.jdbc.FBBlob; +import org.junit.Before; +import org.junit.ClassRule; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import java.io.ByteArrayOutputStream; import java.math.BigDecimal; -import java.sql.Date; -import java.sql.SQLException; -import java.sql.Time; -import java.sql.Timestamp; +import java.sql.*; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; @@ -36,9 +37,10 @@ * @author Vasiliy Yashkov * @since 4.0 */ -public class TestIBatchImpl extends AbstractBatchTest { +public class IBatchImplTest extends AbstractBatchTest { - private static final String gdsType = "FBOONATIVE"; + @ClassRule + public static final GdsTypeRule testType = GdsTypeRule.supportsNativeOnly(); //@formatter:off protected String INSERT_QUERY_WITHOUT_BLOBS = "INSERT INTO test_p_metadata (" + @@ -118,7 +120,7 @@ public class TestIBatchImpl extends AbstractBatchTest { public final ExpectedException expectedException = ExpectedException.none(); private final AbstractNativeOODatabaseFactory factory = - (AbstractNativeOODatabaseFactory) GDSFactory.getDatabaseFactoryForType(GDSType.getType(gdsType)); + (AbstractNativeOODatabaseFactory) FBTestProperties.getFbDatabaseFactory(); @Override protected Class getExpectedDatabaseType() { @@ -135,7 +137,7 @@ public void testSingleExecuteBatchWithoutBlobs() throws SQLException { allocateTransaction(); BatchParameterBuffer buffer = new BatchParameterBufferImpl(); buffer.addArgument(FbInterface.IBatch.TAG_RECORD_COUNTS, 1); - FbBatch batch = db.createBatch(transaction, INSERT_QUERY_WITHOUT_BLOBS, buffer); + IBatchImpl batch = (IBatchImpl) db.createBatch(transaction, INSERT_QUERY_WITHOUT_BLOBS, buffer); int testInteger = 42; String testVarchar = "test varchar"; @@ -156,34 +158,32 @@ public void testSingleExecuteBatchWithoutBlobs() throws SQLException { Time testTime = Time.valueOf(timeFormat.format(cal.getTime())); Timestamp testTimestamp = Timestamp.valueOf(timestampFormat.format(cal.getTime())); - FbMessageBuilder builder = new IMessageBuilderImpl(batch); - - builder.addInteger(0, testInteger); - builder.addVarchar(1, testVarchar); - builder.addVarchar(2, testVarchar); - builder.addVarchar(3, testVarchar); - builder.addBigint(4, testBigInteger); - builder.addInteger(5, testInteger); - builder.addSmallint(6, testShort); - builder.addFloat(7, testFloat); - builder.addDouble(8, testDouble); - builder.addNumeric(9, testSmallintNumeric); - builder.addDecimal(10, testSmallintNumeric); - builder.addNumeric(11, testIntNumeric); - builder.addDecimal(12, testIntNumeric2); - builder.addNumeric(13, testBigintNumeric); - builder.addDecimal(14, testBigintNumeric2); - builder.addDate(15, testDate); - builder.addTime(16, testTime); - builder.addTimestamp(17, testTimestamp); - - batch.add(1, builder.getData()); + batch.setInt(1, testInteger); + batch.setString(2, testVarchar); + batch.setString(3, testVarchar); + batch.setString(4, testVarchar); + batch.setLong(5, testBigInteger); + batch.setInt(6, testInteger); + batch.setShort(7, testShort); + batch.setFloat(8, testFloat); + batch.setDouble(9, testDouble); + batch.setDouble(10, testSmallintNumeric); + batch.setDouble(11, testSmallintNumeric); + batch.setDouble(12, testIntNumeric); + batch.setDouble(13, testIntNumeric2); + batch.setDouble(14, testBigintNumeric); + batch.setDouble(15, testBigintNumeric2); + batch.setDate(16, testDate); + batch.setTime(17, testTime); + batch.setTimestamp(18, testTimestamp); + + batch.addBatch(); FbBatchCompletionState execute = batch.execute(); - System.out.println(execute.getAllStates()); + System.out.println(execute.printAllStates()); - assertThat("Expected successful batch execution", execute.getAllStates(), allOf( + assertThat("Expected successful batch execution", execute.printAllStates(), allOf( startsWith("Message Status"), containsString("total=1 success=1"), endsWith("0\n"))); @@ -279,6 +279,7 @@ public void testSingleExecuteBatchWithoutBlobs() throws SQLException { fieldData = fieldValues.getFieldData(17); assertEquals(testTimestamp, statement.getFieldDescriptor().getFieldDescriptor(17).getDatatypeCoder().decodeTimestamp(fieldData)); + } @Test @@ -290,7 +291,7 @@ public void testSingleExecuteBatchWithBlobs() throws Exception { buffer.addArgument(FbBatch.TAG_MULTIERROR, 1); // enable blobs processing - IDs generated by firebird engine buffer.addArgument(FbBatch.TAG_BLOB_POLICY, FbBatch.BLOB_ID_ENGINE); - FbBatch batch = db.createBatch(transaction, INSERT_QUERY_WITH_BLOBS, buffer); + IBatchImpl batch = (IBatchImpl) db.createBatch(transaction, INSERT_QUERY_WITH_BLOBS, buffer); int testInteger = 42; String testVarchar = "test varchar"; @@ -311,41 +312,39 @@ public void testSingleExecuteBatchWithBlobs() throws Exception { Time testTime = Time.valueOf(timeFormat.format(cal.getTime())); Timestamp testTimestamp = Timestamp.valueOf(timestampFormat.format(cal.getTime())); - FbMessageBuilder builder = new IMessageBuilderImpl(batch); + batch.setInt(1, testInteger); + batch.setString(2, testVarchar); + batch.setString(3, testVarchar); + batch.setString(4, testVarchar); + batch.setLong(5, testBigInteger); + batch.setInt(6, testInteger); + batch.setShort(7, testShort); + batch.setFloat(8, testFloat); + batch.setDouble(9, testDouble); + batch.setDouble(10, testSmallintNumeric); + batch.setDouble(11, testSmallintNumeric); + batch.setDouble(12, testIntNumeric); + batch.setDouble(13, testIntNumeric2); + batch.setDouble(14, testBigintNumeric); + batch.setDouble(15, testBigintNumeric2); + batch.setDate(16, testDate); + batch.setTime(17, testTime); + batch.setTimestamp(18, testTimestamp); - builder.addInteger(0, testInteger); - builder.addVarchar(1, testVarchar); - builder.addVarchar(2, testVarchar); - builder.addVarchar(3, testVarchar); - builder.addBigint(4, testBigInteger); - builder.addInteger(5, testInteger); - builder.addSmallint(6, testShort); - builder.addFloat(7, testFloat); - builder.addDouble(8, testDouble); - builder.addNumeric(9, testSmallintNumeric); - builder.addDecimal(10, testSmallintNumeric); - builder.addNumeric(11, testIntNumeric); - builder.addDecimal(12, testIntNumeric2); - builder.addNumeric(13, testBigintNumeric); - builder.addDecimal(14, testBigintNumeric2); - builder.addDate(15, testDate); - builder.addTime(16, testTime); - builder.addTimestamp(17, testTimestamp); long blobID = 0; - FbBlob blob18 = batch.addBlob(INSERT_QUERY_WITH_BLOBS.getBytes(), blobID, null); - builder.addBlob(18, blob18.getBlobId()); - FbBlob blob19 = batch.addBlob(INSERT_QUERY_WITH_BLOBS.getBytes(), blobID, null); - builder.addBlob(19, blob19.getBlobId()); - FbBlob blob20 = batch.addBlob(INSERT_QUERY_WITH_BLOBS.getBytes(), blobID, null); - builder.addBlob(20, blob20.getBlobId()); + FbBlob blob19 = batch.addBlob(19, INSERT_QUERY_WITH_BLOBS.getBytes(), blobID, null); + FbBlob blob20 = batch.addBlob(20, INSERT_QUERY_WITH_BLOBS.getBytes(), blobID, null); + FbBlob blob21 = batch.addBlob(21, INSERT_QUERY_WITH_BLOBS.getBytes(), blobID, null); + batch.appendBlobData("\n".getBytes()); + batch.appendBlobData(INSERT_QUERY_ONLY_BLOBS.getBytes()); - batch.add(1, builder.getData()); + batch.addBatch(); FbBatchCompletionState execute = batch.execute(); - System.out.println(execute.getAllStates()); + System.out.println(execute.printAllStates()); - assertThat("Expected successful batch execution", execute.getAllStates(), allOf( + assertThat("Expected successful batch execution", execute.printAllStates(), allOf( startsWith("Message Status"), containsString("total=1 success=1"), endsWith("0\n"))); @@ -449,15 +448,15 @@ public void testSingleExecuteBatchWithBlobs() throws Exception { checkBlob(blobID, INSERT_QUERY_WITH_BLOBS.getBytes()); fieldData = fieldValues.getFieldData(20); blobID = statement.getFieldDescriptor().getFieldDescriptor(20).getDatatypeCoder().decodeLong(fieldData); - checkBlob(blobID, INSERT_QUERY_WITH_BLOBS.getBytes()); + checkBlob(blobID, new String(INSERT_QUERY_WITH_BLOBS + "\n" + INSERT_QUERY_ONLY_BLOBS).getBytes()); } @Test public void testMultipleMessagesBatchWithoutBlobs() throws SQLException { allocateTransaction(); BatchParameterBuffer buffer = new BatchParameterBufferImpl(); - buffer.addArgument(FbInterface.IBatch.TAG_RECORD_COUNTS, 1); - FbBatch batch = db.createBatch(transaction, INSERT_QUERY_WITHOUT_BLOBS, buffer); + buffer.addArgument(FbBatch.TAG_RECORD_COUNTS, 1); + IBatchImpl batch = (IBatchImpl) db.createBatch(transaction, INSERT_QUERY_WITHOUT_BLOBS, buffer); int testInteger = 42; String testVarchar = "test varchar"; @@ -478,79 +477,71 @@ public void testMultipleMessagesBatchWithoutBlobs() throws SQLException { Time testTime = Time.valueOf(timeFormat.format(cal.getTime())); Timestamp testTimestamp = Timestamp.valueOf(timestampFormat.format(cal.getTime())); - FbMessageBuilder builder = new IMessageBuilderImpl(batch); - - builder.addInteger(0, testInteger); - builder.addVarchar(1, testVarchar); - builder.addVarchar(2, testVarchar); - builder.addVarchar(3, testVarchar); - builder.addBigint(4, testBigInteger); - builder.addInteger(5, testInteger); - builder.addSmallint(6, testShort); - builder.addFloat(7, testFloat); - builder.addDouble(8, testDouble); - builder.addNumeric(9, testSmallintNumeric); - builder.addDecimal(10, testSmallintNumeric); - builder.addNumeric(11, testIntNumeric); - builder.addDecimal(12, testIntNumeric2); - builder.addNumeric(13, testBigintNumeric); - builder.addDecimal(14, testBigintNumeric2); - builder.addDate(15, testDate); - builder.addTime(16, testTime); - builder.addTimestamp(17, testTimestamp); - batch.add(1, builder.getData()); - // clear data for add next message - builder.clear(); - - builder.addInteger(0, ++testInteger); - builder.addVarchar(1, testVarchar); - builder.addVarchar(2, testVarchar); - builder.addVarchar(3, testVarchar); - builder.addBigint(4, testBigInteger); - builder.addInteger(5, testInteger); - builder.addSmallint(6, testShort); - builder.addFloat(7, testFloat); - builder.addDouble(8, testDouble); - builder.addNumeric(9, testSmallintNumeric); - builder.addDecimal(10, testSmallintNumeric); - builder.addNumeric(11, testIntNumeric); - builder.addDecimal(12, testIntNumeric2); - builder.addNumeric(13, testBigintNumeric); - builder.addDecimal(14, testBigintNumeric2); - builder.addDate(15, testDate); - builder.addTime(16, testTime); - builder.addTimestamp(17, testTimestamp); - batch.add(1, builder.getData()); - // clear data for add next message - builder.clear(); - - builder.addInteger(0, ++testInteger); - builder.addVarchar(1, testVarchar); - builder.addVarchar(2, testVarchar); - builder.addVarchar(3, testVarchar); - builder.addBigint(4, testBigInteger); - builder.addInteger(5, testInteger); - builder.addSmallint(6, testShort); - builder.addFloat(7, testFloat); - builder.addDouble(8, testDouble); - builder.addNumeric(9, testSmallintNumeric); - builder.addDecimal(10, testSmallintNumeric); - builder.addNumeric(11, testIntNumeric); - builder.addDecimal(12, testIntNumeric2); - builder.addNumeric(13, testBigintNumeric); - builder.addDecimal(14, testBigintNumeric2); - builder.addDate(15, testDate); - builder.addTime(16, testTime); - builder.addTimestamp(17, testTimestamp); - batch.add(1, builder.getData()); - // clear data for add next message - builder.clear(); + batch.setInt(1, testInteger); + batch.setString(2, testVarchar); + batch.setString(3, testVarchar); + batch.setString(4, testVarchar); + batch.setLong(5, testBigInteger); + batch.setInt(6, testInteger); + batch.setShort(7, testShort); + batch.setFloat(8, testFloat); + batch.setDouble(9, testDouble); + batch.setDouble(10, testSmallintNumeric); + batch.setDouble(11, testSmallintNumeric); + batch.setDouble(12, testIntNumeric); + batch.setDouble(13, testIntNumeric2); + batch.setDouble(14, testBigintNumeric); + batch.setDouble(15, testBigintNumeric2); + batch.setDate(16, testDate); + batch.setTime(17, testTime); + batch.setTimestamp(18, testTimestamp); + batch.addBatch(); + + batch.setInt(1, ++testInteger); + batch.setString(2, testVarchar); + batch.setString(3, testVarchar); + batch.setString(4, testVarchar); + batch.setLong(5, testBigInteger); + batch.setInt(6, testInteger); + batch.setShort(7, testShort); + batch.setFloat(8, testFloat); + batch.setDouble(9, testDouble); + batch.setDouble(10, testSmallintNumeric); + batch.setDouble(11, testSmallintNumeric); + batch.setDouble(12, testIntNumeric); + batch.setDouble(13, testIntNumeric2); + batch.setDouble(14, testBigintNumeric); + batch.setDouble(15, testBigintNumeric2); + batch.setDate(16, testDate); + batch.setTime(17, testTime); + batch.setTimestamp(18, testTimestamp); + batch.addBatch(); + + batch.setInt(1, ++testInteger); + batch.setString(2, testVarchar); + batch.setString(3, testVarchar); + batch.setString(4, testVarchar); + batch.setLong(5, testBigInteger); + batch.setInt(6, testInteger); + batch.setShort(7, testShort); + batch.setFloat(8, testFloat); + batch.setDouble(9, testDouble); + batch.setDouble(10, testSmallintNumeric); + batch.setDouble(11, testSmallintNumeric); + batch.setDouble(12, testIntNumeric); + batch.setDouble(13, testIntNumeric2); + batch.setDouble(14, testBigintNumeric); + batch.setDouble(15, testBigintNumeric2); + batch.setDate(16, testDate); + batch.setTime(17, testTime); + batch.setTimestamp(18, testTimestamp); + batch.addBatch(); FbBatchCompletionState execute = batch.execute(); - System.out.println(execute.getAllStates()); + System.out.println(execute.printAllStates()); - assertThat("Expected successful batch execution", execute.getAllStates(), allOf( + assertThat("Expected successful batch execution", execute.printAllStates(), allOf( startsWith("Message Status"), containsString("total=3 success=3"), endsWith("0\n"))); @@ -659,7 +650,7 @@ public void testMultipleMessagesBatchWithBlobs() throws Exception { buffer.addArgument(FbBatch.TAG_MULTIERROR, 1); // enable blobs processing - IDs generated by firebird engine buffer.addArgument(FbBatch.TAG_BLOB_POLICY, FbBatch.BLOB_ID_ENGINE); - FbBatch batch = db.createBatch(transaction, INSERT_QUERY_WITH_BLOBS, buffer); + IBatchImpl batch = (IBatchImpl) db.createBatch(transaction, INSERT_QUERY_WITH_BLOBS, buffer); int testInteger = 42; String testVarchar = "test varchar"; @@ -682,97 +673,85 @@ public void testMultipleMessagesBatchWithBlobs() throws Exception { FbMessageBuilder builder = new IMessageBuilderImpl(batch); - builder.addInteger(0, testInteger); - builder.addVarchar(1, testVarchar); - builder.addVarchar(2, testVarchar); - builder.addVarchar(3, testVarchar); - builder.addBigint(4, testBigInteger); - builder.addInteger(5, testInteger); - builder.addSmallint(6, testShort); - builder.addFloat(7, testFloat); - builder.addDouble(8, testDouble); - builder.addNumeric(9, testSmallintNumeric); - builder.addDecimal(10, testSmallintNumeric); - builder.addNumeric(11, testIntNumeric); - builder.addDecimal(12, testIntNumeric2); - builder.addNumeric(13, testBigintNumeric); - builder.addDecimal(14, testBigintNumeric2); - builder.addDate(15, testDate); - builder.addTime(16, testTime); - builder.addTimestamp(17, testTimestamp); - FbBlob blob18 = batch.addBlob(INSERT_QUERY_WITH_BLOBS.getBytes(), null); - builder.addBlob(18, blob18.getBlobId()); - FbBlob blob19 = batch.addBlob(INSERT_QUERY_WITH_BLOBS.getBytes(), null); - builder.addBlob(19, blob19.getBlobId()); - FbBlob blob20 = batch.addBlob(INSERT_QUERY_WITH_BLOBS.getBytes(), null); - builder.addBlob(20, blob20.getBlobId()); - batch.add(1, builder.getData()); - // clear data for add next message - builder.clear(); - - builder.addInteger(0, ++testInteger); - builder.addVarchar(1, testVarchar); - builder.addVarchar(2, testVarchar); - builder.addVarchar(3, testVarchar); - builder.addBigint(4, testBigInteger); - builder.addInteger(5, testInteger); - builder.addSmallint(6, testShort); - builder.addFloat(7, testFloat); - builder.addDouble(8, testDouble); - builder.addNumeric(9, testSmallintNumeric); - builder.addDecimal(10, testSmallintNumeric); - builder.addNumeric(11, testIntNumeric); - builder.addDecimal(12, testIntNumeric2); - builder.addNumeric(13, testBigintNumeric); - builder.addDecimal(14, testBigintNumeric2); - builder.addDate(15, testDate); - builder.addTime(16, testTime); - builder.addTimestamp(17, testTimestamp); + batch.setInt(1, testInteger); + batch.setString(2, testVarchar); + batch.setString(3, testVarchar); + batch.setString(4, testVarchar); + batch.setLong(5, testBigInteger); + batch.setInt(6, testInteger); + batch.setShort(7, testShort); + batch.setFloat(8, testFloat); + batch.setDouble(9, testDouble); + batch.setDouble(10, testSmallintNumeric); + batch.setDouble(11, testSmallintNumeric); + batch.setDouble(12, testIntNumeric); + batch.setDouble(13, testIntNumeric2); + batch.setDouble(14, testBigintNumeric); + batch.setDouble(15, testBigintNumeric2); + batch.setDate(16, testDate); + batch.setTime(17, testTime); + batch.setTimestamp(18, testTimestamp); + + long blobID = 0; + FbBlob blob19 = batch.addBlob(19, INSERT_QUERY_WITH_BLOBS.getBytes(), blobID, null); + FbBlob blob20 = batch.addBlob(20, INSERT_QUERY_WITH_BLOBS.getBytes(), blobID, null); + FbBlob blob21 = batch.addBlob(21, INSERT_QUERY_WITH_BLOBS.getBytes(), blobID, null); + batch.addBatch(); + + batch.setInt(1, ++testInteger); + batch.setString(2, testVarchar); + batch.setString(3, testVarchar); + batch.setString(4, testVarchar); + batch.setLong(5, testBigInteger); + batch.setInt(6, testInteger); + batch.setShort(7, testShort); + batch.setFloat(8, testFloat); + batch.setDouble(9, testDouble); + batch.setDouble(10, testSmallintNumeric); + batch.setDouble(11, testSmallintNumeric); + batch.setDouble(12, testIntNumeric); + batch.setDouble(13, testIntNumeric2); + batch.setDouble(14, testBigintNumeric); + batch.setDouble(15, testBigintNumeric2); + batch.setDate(16, testDate); + batch.setTime(17, testTime); + batch.setTimestamp(18, testTimestamp); + byte[] testBytes = (INSERT_QUERY_WITH_BLOBS + INSERT_QUERY_WITH_BLOBS).getBytes(); - blob18 = batch.addBlob(testBytes, null); - builder.addBlob(18, blob18.getBlobId()); - blob19 = batch.addBlob(testBytes, null); - builder.addBlob(19, blob19.getBlobId()); - blob20 = batch.addBlob(testBytes, null); - builder.addBlob(20, blob20.getBlobId()); - batch.add(1, builder.getData()); - // clear data for add next message - builder.clear(); - - builder.addInteger(0, ++testInteger); - builder.addVarchar(1, testVarchar); - builder.addVarchar(2, testVarchar); - builder.addVarchar(3, testVarchar); - builder.addBigint(4, testBigInteger); - builder.addInteger(5, testInteger); - builder.addSmallint(6, testShort); - builder.addFloat(7, testFloat); - builder.addDouble(8, testDouble); - builder.addNumeric(9, testSmallintNumeric); - builder.addDecimal(10, testSmallintNumeric); - builder.addNumeric(11, testIntNumeric); - builder.addDecimal(12, testIntNumeric2); - builder.addNumeric(13, testBigintNumeric); - builder.addDecimal(14, testBigintNumeric2); - builder.addDate(15, testDate); - builder.addTime(16, testTime); - builder.addTimestamp(17, testTimestamp); + blob19 = batch.addBlob(19, testBytes, null); + blob20 = batch.addBlob(20, testBytes, null); + blob21 = batch.addBlob(21, testBytes, null); + batch.addBatch(); + + batch.setInt(1, ++testInteger); + batch.setString(2, testVarchar); + batch.setString(3, testVarchar); + batch.setString(4, testVarchar); + batch.setLong(5, testBigInteger); + batch.setInt(6, testInteger); + batch.setShort(7, testShort); + batch.setFloat(8, testFloat); + batch.setDouble(9, testDouble); + batch.setDouble(10, testSmallintNumeric); + batch.setDouble(11, testSmallintNumeric); + batch.setDouble(12, testIntNumeric); + batch.setDouble(13, testIntNumeric2); + batch.setDouble(14, testBigintNumeric); + batch.setDouble(15, testBigintNumeric2); + batch.setDate(16, testDate); + batch.setTime(17, testTime); + batch.setTimestamp(18, testTimestamp); testBytes = (INSERT_QUERY_WITH_BLOBS + INSERT_QUERY_WITH_BLOBS + INSERT_QUERY_WITH_BLOBS).getBytes(); - blob18 = batch.addBlob(testBytes, null); - builder.addBlob(18, blob18.getBlobId()); - blob19 = batch.addBlob(testBytes, null); - builder.addBlob(19, blob19.getBlobId()); - blob20 = batch.addBlob(testBytes, null); - builder.addBlob(20, blob20.getBlobId()); - batch.add(1, builder.getData()); - // clear data for add next message - builder.clear(); + blob19 = batch.addBlob(19, testBytes, null); + blob20 = batch.addBlob(20, testBytes, null); + blob21 = batch.addBlob(21, testBytes, null); + batch.addBatch(); FbBatchCompletionState execute = batch.execute(); - System.out.println(execute.getAllStates()); + System.out.println(execute.printAllStates()); - assertThat("Expected successful batch execution", execute.getAllStates(), allOf( + assertThat("Expected successful batch execution", execute.printAllStates(), allOf( startsWith("Message Status"), containsString("total=3 success=3"), endsWith("0\n"))); @@ -871,7 +850,7 @@ public void testMultipleMessagesBatchWithBlobs() throws Exception { assertEquals(testTimestamp, statement.getFieldDescriptor().getFieldDescriptor(17).getDatatypeCoder().decodeTimestamp(fieldData)); fieldData = fieldValues.getFieldData(18); - long blobID = statement.getFieldDescriptor().getFieldDescriptor(18).getDatatypeCoder().decodeLong(fieldData); + blobID = statement.getFieldDescriptor().getFieldDescriptor(18).getDatatypeCoder().decodeLong(fieldData); checkBlob(blobID, testBytes); fieldData = fieldValues.getFieldData(19); blobID = statement.getFieldDescriptor().getFieldDescriptor(19).getDatatypeCoder().decodeLong(fieldData); @@ -887,7 +866,7 @@ public void testBatchWithBlobStream() throws Exception { BatchParameterBuffer buffer = new BatchParameterBufferImpl(); // Blobs are placed in a stream buffer.addArgument(FbBatch.TAG_BLOB_POLICY, FbBatch.BLOB_STREAM); - FbBatch batch = db.createBatch(transaction, INSERT_QUERY_ONLY_BLOBS, buffer); + IBatchImpl batch = (IBatchImpl) db.createBatch(transaction, INSERT_QUERY_ONLY_BLOBS, buffer); GDSHelper h = new GDSHelper(db); h.setCurrentTransaction(batch.getTransaction()); @@ -896,30 +875,26 @@ public void testBatchWithBlobStream() throws Exception { FBBlob b2 = new FBBlob(h, 2); FBBlob b3 = new FBBlob(h, 3); - FbMessageBuilder builder = new IMessageBuilderImpl(batch); - - builder.addBlob(0, b1.getBlobId()); - builder.addBlob(1, b2.getBlobId()); - builder.addBlob(2, b3.getBlobId()); + batch.addBlob(1, b1.getBlobId()); + batch.addBlob(2, b2.getBlobId()); + batch.addBlob(3, b3.getBlobId()); // blobs String d1 = "1111111111111111111"; String d2 = "22222222222222222222"; String d3 = "333333333333333333333333333333333333333333333333333333333333333"; - builder.addBlobData(d1.getBytes(), b1.getBlobId()); - builder.addBlobData(d2.getBytes(), b2.getBlobId()); - builder.addBlobData(d3.getBytes(), b3.getBlobId()); + batch.appendBlobData(d1.getBytes(), b1.getBlobId()); + batch.appendBlobData(d2.getBytes(), b2.getBlobId()); + batch.appendBlobData(d3.getBytes(), b3.getBlobId()); - batch.add(1, builder.getData()); - batch.addBlobStream(builder.getBlobStreamData()); - builder.clear(); + batch.addBatch(); FbBatchCompletionState execute = batch.execute(); - System.out.println(execute.getAllStates()); + System.out.println(execute.printAllStates()); - assertThat("Expected successful batch execution", execute.getAllStates(), allOf( + assertThat("Expected successful batch execution", execute.printAllStates(), allOf( startsWith("Summary"), containsString("total=1 success=0 success(but no update info)=1"), endsWith("\n"))); @@ -962,8 +937,6 @@ public void testBatchWithSegmentedBlobs() throws Exception { FBBlob b2 = new FBBlob(h, 242); FBBlob b3 = new FBBlob(h, 42); - FbMessageBuilder builder = new IMessageBuilderImpl(batch); - // blobs String blobSegment1 = INSERT_QUERY_WITHOUT_BLOBS; String blobSegment2 = INSERT_QUERY_WITH_BLOBS; @@ -972,46 +945,34 @@ public void testBatchWithSegmentedBlobs() throws Exception { BlobParameterBuffer bpb = new BlobParameterBufferImp(); bpb.addArgument(ISCConstants.isc_bpb_type, ISCConstants.isc_bpb_type_segmented); - long offset = builder.addBlobHeader(b1.getBlobId(), bpb); - builder.addBlobSegment(blobSegment1.getBytes(), offset, false); - builder.addBlobSegment("\n".getBytes(), offset, false); - builder.addBlobSegment(blobSegment2.getBytes(), offset, false); - builder.addBlobSegment("\n".getBytes(), offset, false); - builder.addBlobSegment(blobSegment3.getBytes(), offset, true); - - batch.addBlobStream(builder.getBlobStreamData()); - builder.clearBlobStream(); - - offset = builder.addBlobHeader(b2.getBlobId(), bpb); - builder.addBlobSegment(blobSegment1.getBytes(), offset, false); - builder.addBlobSegment("\n".getBytes(), offset, false); - builder.addBlobSegment(blobSegment2.getBytes(), offset, false); - builder.addBlobSegment("\n".getBytes(), offset, false); - builder.addBlobSegment(blobSegment3.getBytes(), offset, true); - - batch.addBlobStream(builder.getBlobStreamData()); - builder.clearBlobStream(); - - offset = builder.addBlobHeader(b3.getBlobId(), bpb); - builder.addBlobSegment(blobSegment1.getBytes(), offset, false); - builder.addBlobSegment("\n".getBytes(), offset, false); - builder.addBlobSegment(blobSegment2.getBytes(), offset, false); - builder.addBlobSegment("\n".getBytes(), offset, false); - builder.addBlobSegment(blobSegment3.getBytes(), offset, true); - - builder.addBlob(0, b1.getBlobId()); - builder.addBlob(1, b2.getBlobId()); - builder.addBlob(2, b3.getBlobId()); - - batch.addBlobStream(builder.getBlobStreamData()); - batch.add(1, builder.getData()); - builder.clear(); + batch.addSegmentedBlob(1, b1.getBlobId(), bpb); + batch.addBlobSegment(blobSegment1.getBytes(), false); + batch.addBlobSegment("\n".getBytes(), false); + batch.addBlobSegment(blobSegment2.getBytes(), false); + batch.addBlobSegment("\n".getBytes(), false); + batch.addBlobSegment(blobSegment3.getBytes(), true); + + batch.addSegmentedBlob(2, b2.getBlobId(), bpb); + batch.addBlobSegment(blobSegment1.getBytes(), false); + batch.addBlobSegment("\n".getBytes(), false); + batch.addBlobSegment(blobSegment2.getBytes(), false); + batch.addBlobSegment("\n".getBytes(), false); + batch.addBlobSegment(blobSegment3.getBytes(), true); + + batch.addSegmentedBlob(3, b3.getBlobId(), bpb); + batch.addBlobSegment(blobSegment1.getBytes(), false); + batch.addBlobSegment("\n".getBytes(), false); + batch.addBlobSegment(blobSegment2.getBytes(), false); + batch.addBlobSegment("\n".getBytes(), false); + batch.addBlobSegment(blobSegment3.getBytes(), true); + + batch.addBatch(); FbBatchCompletionState execute = batch.execute(); - System.out.println(execute.getAllStates()); + System.out.println(execute.printAllStates()); - assertThat("Expected successful batch execution", execute.getAllStates(), allOf( + assertThat("Expected successful batch execution", execute.printAllStates(), allOf( startsWith("Summary"), containsString("total=1 success=0 success(but no update info)=1"), endsWith("\n"))); @@ -1057,8 +1018,6 @@ public void testMultipleMessagesBatchWithSegmentedBlobs() throws Exception { FBBlob b2 = new FBBlob(h, 242); FBBlob b3 = new FBBlob(h, 42); - FbMessageBuilder builder = new IMessageBuilderImpl(batch); - // blobs String blobSegment1 = INSERT_QUERY_WITHOUT_BLOBS; String blobSegment2 = INSERT_QUERY_WITH_BLOBS; @@ -1067,129 +1026,90 @@ public void testMultipleMessagesBatchWithSegmentedBlobs() throws Exception { BlobParameterBuffer bpb = new BlobParameterBufferImp(); bpb.addArgument(ISCConstants.isc_bpb_type, ISCConstants.isc_bpb_type_segmented); - long offset = builder.addBlobHeader(b1.getBlobId(), bpb); - builder.addBlobSegment(blobSegment1.getBytes(), offset, false); - builder.addBlobSegment("\n".getBytes(), offset, false); - builder.addBlobSegment(blobSegment2.getBytes(), offset, false); - builder.addBlobSegment("\n".getBytes(), offset, false); - builder.addBlobSegment(blobSegment3.getBytes(), offset, true); - - batch.addBlobStream(builder.getBlobStreamData()); - builder.clearBlobStream(); - - offset = builder.addBlobHeader(b2.getBlobId(), bpb); - builder.addBlobSegment(blobSegment1.getBytes(), offset, false); - builder.addBlobSegment("\n".getBytes(), offset, false); - builder.addBlobSegment(blobSegment2.getBytes(), offset, false); - builder.addBlobSegment("\n".getBytes(), offset, false); - builder.addBlobSegment(blobSegment3.getBytes(), offset, true); - - batch.addBlobStream(builder.getBlobStreamData()); - builder.clearBlobStream(); - - offset = builder.addBlobHeader(b3.getBlobId(), bpb); - builder.addBlobSegment(blobSegment1.getBytes(), offset, false); - builder.addBlobSegment("\n".getBytes(), offset, false); - builder.addBlobSegment(blobSegment2.getBytes(), offset, false); - builder.addBlobSegment("\n".getBytes(), offset, false); - builder.addBlobSegment(blobSegment3.getBytes(), offset, true); - - builder.addBlob(0, b1.getBlobId()); - builder.addBlob(1, b2.getBlobId()); - builder.addBlob(2, b3.getBlobId()); - - batch.addBlobStream(builder.getBlobStreamData()); - batch.add(1, builder.getData()); - builder.clearBlobStream(); - builder.clear(); + batch.addSegmentedBlob(1, b1.getBlobId(), bpb); + batch.addBlobSegment(blobSegment1.getBytes(), false); + batch.addBlobSegment("\n".getBytes(), false); + batch.addBlobSegment(blobSegment2.getBytes(), false); + batch.addBlobSegment("\n".getBytes(), false); + batch.addBlobSegment(blobSegment3.getBytes(), true); + + batch.addSegmentedBlob(2, b2.getBlobId(), bpb); + batch.addBlobSegment(blobSegment1.getBytes(), false); + batch.addBlobSegment("\n".getBytes(), false); + batch.addBlobSegment(blobSegment2.getBytes(), false); + batch.addBlobSegment("\n".getBytes(), false); + batch.addBlobSegment(blobSegment3.getBytes(), true); + + batch.addSegmentedBlob(3, b3.getBlobId(), bpb); + batch.addBlobSegment(blobSegment1.getBytes(), false); + batch.addBlobSegment("\n".getBytes(), false); + batch.addBlobSegment(blobSegment2.getBytes(), false); + batch.addBlobSegment("\n".getBytes(), false); + batch.addBlobSegment(blobSegment3.getBytes(), true); + + batch.addBatch(); // Create blobs FBBlob b4 = new FBBlob(h, 34242); FBBlob b5 = new FBBlob(h, 3242); FBBlob b6 = new FBBlob(h, 342); - offset = builder.addBlobHeader(b4.getBlobId(), bpb); - builder.addBlobSegment(blobSegment1.getBytes(), offset, false); - builder.addBlobSegment("\n".getBytes(), offset, false); - builder.addBlobSegment(blobSegment2.getBytes(), offset, false); - builder.addBlobSegment("\n".getBytes(), offset, false); - builder.addBlobSegment(blobSegment3.getBytes(), offset, true); - - batch.addBlobStream(builder.getBlobStreamData()); - builder.clearBlobStream(); - - offset = builder.addBlobHeader(b5.getBlobId(), bpb); - builder.addBlobSegment(blobSegment1.getBytes(), offset, false); - builder.addBlobSegment("\n".getBytes(), offset, false); - builder.addBlobSegment(blobSegment2.getBytes(), offset, false); - builder.addBlobSegment("\n".getBytes(), offset, false); - builder.addBlobSegment(blobSegment3.getBytes(), offset, true); - - batch.addBlobStream(builder.getBlobStreamData()); - builder.clearBlobStream(); - - offset = builder.addBlobHeader(b6.getBlobId(), bpb); - builder.addBlobSegment(blobSegment1.getBytes(), offset, false); - builder.addBlobSegment("\n".getBytes(), offset, false); - builder.addBlobSegment(blobSegment2.getBytes(), offset, false); - builder.addBlobSegment("\n".getBytes(), offset, false); - builder.addBlobSegment(blobSegment3.getBytes(), offset, true); - - builder.addBlob(0, b4.getBlobId()); - builder.addBlob(1, b5.getBlobId()); - builder.addBlob(2, b6.getBlobId()); - - batch.addBlobStream(builder.getBlobStreamData()); - batch.add(1, builder.getData()); - builder.clear(); - builder.clearBlobStream(); + batch.addSegmentedBlob(1, b4.getBlobId(), bpb); + batch.addBlobSegment(blobSegment1.getBytes(), false); + batch.addBlobSegment("\n".getBytes(), false); + batch.addBlobSegment(blobSegment2.getBytes(), false); + batch.addBlobSegment("\n".getBytes(), false); + batch.addBlobSegment(blobSegment3.getBytes(), true); + + batch.addSegmentedBlob(2, b5.getBlobId(), bpb); + batch.addBlobSegment(blobSegment1.getBytes(), false); + batch.addBlobSegment("\n".getBytes(), false); + batch.addBlobSegment(blobSegment2.getBytes(), false); + batch.addBlobSegment("\n".getBytes(), false); + batch.addBlobSegment(blobSegment3.getBytes(), true); + + batch.addSegmentedBlob(3, b6.getBlobId(), bpb); + batch.addBlobSegment(blobSegment1.getBytes(), false); + batch.addBlobSegment("\n".getBytes(), false); + batch.addBlobSegment(blobSegment2.getBytes(), false); + batch.addBlobSegment("\n".getBytes(), false); + batch.addBlobSegment(blobSegment3.getBytes(), true); + + batch.addBatch(); // Create blobs FBBlob b7 = new FBBlob(h, 14242); FBBlob b8 = new FBBlob(h, 1242); FBBlob b9 = new FBBlob(h, 142); - offset = builder.addBlobHeader(b7.getBlobId(), bpb); - builder.addBlobSegment(blobSegment1.getBytes(), offset, false); - builder.addBlobSegment("\n".getBytes(), offset, false); - builder.addBlobSegment(blobSegment2.getBytes(), offset, false); - builder.addBlobSegment("\n".getBytes(), offset, false); - builder.addBlobSegment(blobSegment3.getBytes(), offset, true); - - batch.addBlobStream(builder.getBlobStreamData()); - builder.clearBlobStream(); - - offset = builder.addBlobHeader(b8.getBlobId(), bpb); - builder.addBlobSegment(blobSegment1.getBytes(), offset, false); - builder.addBlobSegment("\n".getBytes(), offset, false); - builder.addBlobSegment(blobSegment2.getBytes(), offset, false); - builder.addBlobSegment("\n".getBytes(), offset, false); - builder.addBlobSegment(blobSegment3.getBytes(), offset, true); - - batch.addBlobStream(builder.getBlobStreamData()); - builder.clearBlobStream(); - - offset = builder.addBlobHeader(b9.getBlobId(), bpb); - builder.addBlobSegment(blobSegment1.getBytes(), offset, false); - builder.addBlobSegment("\n".getBytes(), offset, false); - builder.addBlobSegment(blobSegment2.getBytes(), offset, false); - builder.addBlobSegment("\n".getBytes(), offset, false); - builder.addBlobSegment(blobSegment3.getBytes(), offset, true); - - builder.addBlob(0, b7.getBlobId()); - builder.addBlob(1, b8.getBlobId()); - builder.addBlob(2, b9.getBlobId()); - - batch.addBlobStream(builder.getBlobStreamData()); - batch.add(1, builder.getData()); - builder.clear(); - builder.clearBlobStream(); + batch.addSegmentedBlob(1, b7.getBlobId(), bpb); + batch.addBlobSegment(blobSegment1.getBytes(), false); + batch.addBlobSegment("\n".getBytes(), false); + batch.addBlobSegment(blobSegment2.getBytes(), false); + batch.addBlobSegment("\n".getBytes(), false); + batch.addBlobSegment(blobSegment3.getBytes(), true); + + batch.addSegmentedBlob(2, b8.getBlobId(), bpb); + batch.addBlobSegment(blobSegment1.getBytes(), false); + batch.addBlobSegment("\n".getBytes(), false); + batch.addBlobSegment(blobSegment2.getBytes(), false); + batch.addBlobSegment("\n".getBytes(), false); + batch.addBlobSegment(blobSegment3.getBytes(), true); + + batch.addSegmentedBlob(3, b9.getBlobId(), bpb); + batch.addBlobSegment(blobSegment1.getBytes(), false); + batch.addBlobSegment("\n".getBytes(), false); + batch.addBlobSegment(blobSegment2.getBytes(), false); + batch.addBlobSegment("\n".getBytes(), false); + batch.addBlobSegment(blobSegment3.getBytes(), true); + + batch.addBatch(); FbBatchCompletionState execute = batch.execute(); - System.out.println(execute.getAllStates()); + System.out.println(execute.printAllStates()); - assertThat("Expected successful batch execution", execute.getAllStates(), allOf( + assertThat("Expected successful batch execution", execute.printAllStates(), allOf( startsWith("Summary"), containsString("total=3 success=0 success(but no update info)=3"), endsWith("\n"))); @@ -1247,25 +1167,18 @@ public void testBatchWithRegisteredBlobs() throws Exception { regBlob3.putSegment(INSERT_QUERY_ONLY_BLOBS.getBytes()); regBlob3.close(); - FbMessageBuilder builder = new IMessageBuilderImpl(batch); - - builder.addBlob(0, b1.getBlobId()); - builder.addBlob(1, b2.getBlobId()); - builder.addBlob(2, b3.getBlobId()); - // Register blobs - batch.registerBlob(regBlob1.getBlobId(), b1.getBlobId()); - batch.registerBlob(regBlob2.getBlobId(), b2.getBlobId()); - batch.registerBlob(regBlob3.getBlobId(), b3.getBlobId()); + batch.registerBlob(1, regBlob1.getBlobId(), b1.getBlobId()); + batch.registerBlob(2, regBlob2.getBlobId(), b2.getBlobId()); + batch.registerBlob(3, regBlob3.getBlobId(), b3.getBlobId()); - batch.add(1, builder.getData()); - builder.clear(); + batch.addBatch(); FbBatchCompletionState execute = batch.execute(); - System.out.println(execute.getAllStates()); + System.out.println(execute.printAllStates()); - assertThat("Expected successful batch execution", execute.getAllStates(), allOf( + assertThat("Expected successful batch execution", execute.printAllStates(), allOf( startsWith("Summary"), containsString("total=1 success=0 success(but no update info)=1"), endsWith("\n"))); @@ -1293,9 +1206,132 @@ public void testBatchWithRegisteredBlobs() throws Exception { checkBlob(blobID, INSERT_QUERY_ONLY_BLOBS.getBytes()); } + @Test + public void testBatchWithNulls() throws Exception { + allocateTransaction(); + BatchParameterBuffer buffer = new BatchParameterBufferImpl(); + buffer.addArgument(FbInterface.IBatch.TAG_RECORD_COUNTS, 1); + IBatchImpl batch = (IBatchImpl) db.createBatch(transaction, INSERT_QUERY_WITHOUT_BLOBS, buffer); + + int testInteger = 42; + + batch.setInt(1, testInteger); + batch.setNull(2, Types.VARCHAR); + batch.setNull(3, Types.VARCHAR); + batch.setNull(4, Types.VARCHAR); + batch.setNull(5, Types.BIGINT); + batch.setNull(6, Types.INTEGER); + batch.setNull(7, Types.SMALLINT); + batch.setNull(8, Types.FLOAT); + batch.setNull(9, Types.DOUBLE); + batch.setNull(10, Types.DOUBLE); + batch.setNull(11, Types.DOUBLE); + batch.setNull(12, Types.DOUBLE); + batch.setNull(13, Types.DOUBLE); + batch.setNull(14, Types.DOUBLE); + batch.setNull(15, Types.DOUBLE); + batch.setNull(16, Types.DATE); + batch.setNull(17, Types.TIME); + batch.setNull(18, Types.TIMESTAMP); + + batch.addBatch(); + + FbBatchCompletionState execute = batch.execute(); + + System.out.println(execute.printAllStates()); + + assertThat("Expected successful batch execution", execute.printAllStates(), allOf( + startsWith("Message Status"), + containsString("total=1 success=1"), + endsWith("0\n"))); + + batch.getTransaction().commit(); + + allocateTransaction(); + + FbStatement statement = db.createStatement(transaction); + final SimpleStatementListener statementListener = new SimpleStatementListener(); + statement.addStatementListener(statementListener); + statement.prepare(SELECT_QUERY_WITHOUT_BLOBS); + statement.execute(RowValue.EMPTY_ROW_VALUE); + statement.fetchRows(1); + RowValue fieldValues = statementListener.getRows().get(0); + byte[] fieldData = fieldValues.getFieldData(0); + assertEquals(testInteger, + statement.getFieldDescriptor().getFieldDescriptor(0).getDatatypeCoder().decodeInt(fieldData)); + for (int i = 1; i < statement.getFieldDescriptor().getCount(); i++) { + fieldData = fieldValues.getFieldData(i); + assertEquals(null, fieldData); + } + } + + @Test + public void testBatchWithBlobNulls() throws Exception { + allocateTransaction(); + BatchParameterBuffer buffer = new BatchParameterBufferImpl(); + buffer.addArgument(FbInterface.IBatch.TAG_RECORD_COUNTS, 1); + buffer.addArgument(FbBatch.TAG_MULTIERROR, 1); + buffer.addArgument(FbBatch.TAG_BLOB_POLICY, FbBatch.BLOB_ID_ENGINE); + IBatchImpl batch = (IBatchImpl) db.createBatch(transaction, INSERT_QUERY_WITH_BLOBS, buffer); + + int testInteger = 42; + + batch.setInt(1, testInteger); + batch.setNull(2, Types.VARCHAR); + batch.setNull(3, Types.VARCHAR); + batch.setNull(4, Types.VARCHAR); + batch.setNull(5, Types.BIGINT); + batch.setNull(6, Types.INTEGER); + batch.setNull(7, Types.SMALLINT); + batch.setNull(8, Types.FLOAT); + batch.setNull(9, Types.DOUBLE); + batch.setNull(10, Types.DOUBLE); + batch.setNull(11, Types.DOUBLE); + batch.setNull(12, Types.DOUBLE); + batch.setNull(13, Types.DOUBLE); + batch.setNull(14, Types.DOUBLE); + batch.setNull(15, Types.DOUBLE); + batch.setNull(16, Types.DATE); + batch.setNull(17, Types.TIME); + batch.setNull(18, Types.TIMESTAMP); + batch.setNull(19, Types.LONGVARBINARY); + batch.setNull(20, Types.LONGVARCHAR); + batch.setNull(21, Types.LONGVARBINARY); + + batch.addBatch(); + + FbBatchCompletionState execute = batch.execute(); + + System.out.println(execute.printAllStates()); + + assertThat("Expected successful batch execution", execute.printAllStates(), allOf( + startsWith("Message Status"), + containsString("total=1 success=1"), + endsWith("0\n"))); + + batch.getTransaction().commit(); + + allocateTransaction(); + + FbStatement statement = db.createStatement(transaction); + final SimpleStatementListener statementListener = new SimpleStatementListener(); + statement.addStatementListener(statementListener); + statement.prepare(SELECT_QUERY_WITH_BLOBS); + statement.execute(RowValue.EMPTY_ROW_VALUE); + statement.fetchRows(1); + RowValue fieldValues = statementListener.getRows().get(0); + byte[] fieldData = fieldValues.getFieldData(0); + assertEquals(testInteger, + statement.getFieldDescriptor().getFieldDescriptor(0).getDatatypeCoder().decodeInt(fieldData)); + for (int i = 1; i < statement.getFieldDescriptor().getCount(); i++) { + fieldData = fieldValues.getFieldData(i); + assertEquals(null, fieldData); + } + } + public void checkBlob(long blobID, byte[] originalContent) throws Exception { // Use sufficiently large value so that multiple segments are used - final int requiredSize = originalContent.length; + final int requiredSize = (originalContent == null ? 10 : originalContent.length); final FbBlob blob = db.createBlobForInput(transaction, null, blobID); blob.open(); ByteArrayOutputStream bos = new ByteArrayOutputStream(requiredSize); diff --git a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/TestIBlobImpl.java b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IBlobImplTest.java old mode 100644 new mode 100755 similarity index 98% rename from src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/TestIBlobImpl.java rename to src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IBlobImplTest.java index 4d73796f9d..0add28c991 --- a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/TestIBlobImpl.java +++ b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IBlobImplTest.java @@ -18,6 +18,8 @@ */ package org.firebirdsql.nativeoo.gds.ng; +import org.firebirdsql.common.FBTestProperties; +import org.firebirdsql.common.rules.GdsTypeRule; import org.firebirdsql.gds.BlobParameterBuffer; import org.firebirdsql.gds.ISCConstants; import org.firebirdsql.gds.impl.GDSFactory; @@ -50,9 +52,10 @@ * @author Mark Rotteveel * @since 4.0 */ -public class TestIBlobImpl extends BaseTestBlob { +public class IBlobImplTest extends BaseTestBlob { - private static final String gdsType = "FBOONATIVE"; + @ClassRule + public static final GdsTypeRule testType = GdsTypeRule.supportsNativeOnly(); @Rule public final ExpectedException expectedException = ExpectedException.none(); @@ -61,7 +64,7 @@ public class TestIBlobImpl extends BaseTestBlob { @Before public void setFactory() { - factory = (AbstractNativeOODatabaseFactory) GDSFactory.getDatabaseFactoryForType(GDSType.getType(gdsType)); + factory = (AbstractNativeOODatabaseFactory) FBTestProperties.getFbDatabaseFactory(); } /** diff --git a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/TestIDatabaseImpl.java b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IDatabaseImplTest.java similarity index 96% rename from src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/TestIDatabaseImpl.java rename to src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IDatabaseImplTest.java index b8d3b72a12..8462963c07 100644 --- a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/TestIDatabaseImpl.java +++ b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IDatabaseImplTest.java @@ -1,6 +1,7 @@ package org.firebirdsql.nativeoo.gds.ng; import org.firebirdsql.common.FBTestProperties; +import org.firebirdsql.common.rules.GdsTypeRule; import org.firebirdsql.gds.ISCConstants; import org.firebirdsql.gds.TransactionParameterBuffer; import org.firebirdsql.gds.impl.GDSFactory; @@ -15,6 +16,8 @@ import org.firebirdsql.gds.ng.jna.AbstractNativeDatabaseFactory; import org.firebirdsql.jdbc.SQLStateConstants; import org.firebirdsql.management.FBManager; +import org.junit.Before; +import org.junit.ClassRule; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; @@ -37,17 +40,20 @@ import static org.junit.Assume.assumeThat; import static org.junit.Assume.assumeTrue; -public class TestIDatabaseImpl { +public class IDatabaseImplTest { // TODO Assert in tests need to be checked (and more need to be added) + @ClassRule + public static final GdsTypeRule testType = GdsTypeRule.supportsNativeOnly(); + @Rule public final ExpectedException expectedException = ExpectedException.none(); private static final String gdsType = "FBOONATIVE"; - private final AbstractNativeOODatabaseFactory factory = - (AbstractNativeOODatabaseFactory) GDSFactory.getDatabaseFactoryForType(GDSType.getType(gdsType)); + private AbstractNativeOODatabaseFactory factory; + private final FbConnectionProperties connectionInfo; { connectionInfo = new FbConnectionProperties(); @@ -59,6 +65,11 @@ public class TestIDatabaseImpl { connectionInfo.setEncoding("NONE"); } + @Before + public void setFactory() { + factory = (AbstractNativeOODatabaseFactory) FBTestProperties.getFbDatabaseFactory(); + } + public static FBManager createFBManager() { return new FBManager(GDSType.getType(gdsType)); } @@ -105,7 +116,7 @@ public void basicStatusProcessing_wrongLogin() throws Exception { try (IDatabaseImpl db = (IDatabaseImpl) factory.connect(connectionInfo)) { expectedException.expect(allOf( - isA(FbException.class), + isA(SQLException.class), message(startsWith(getFbMessage(ISCConstants.isc_login))), errorCode(equalTo(ISCConstants.isc_login)) )); diff --git a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/TestIEventBlockImpl.java b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IEventBlockImplTest.java similarity index 93% rename from src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/TestIEventBlockImpl.java rename to src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IEventBlockImplTest.java index 58ee11e8a9..e4b8c5833c 100644 --- a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/TestIEventBlockImpl.java +++ b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IEventBlockImplTest.java @@ -2,6 +2,7 @@ import org.firebirdsql.common.FBJUnit4TestBase; import org.firebirdsql.common.FBTestProperties; +import org.firebirdsql.common.rules.GdsTypeRule; import org.firebirdsql.gds.EventHandle; import org.firebirdsql.gds.EventHandler; import org.firebirdsql.gds.ISCConstants; @@ -12,9 +13,7 @@ import org.firebirdsql.gds.ng.*; import org.firebirdsql.gds.ng.fields.RowValue; import org.firebirdsql.gds.ng.jna.AbstractNativeDatabaseFactory; -import org.junit.After; -import org.junit.Rule; -import org.junit.Test; +import org.junit.*; import org.junit.rules.ExpectedException; import java.sql.SQLException; @@ -24,15 +23,15 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -public class TestIEventBlockImpl extends FBJUnit4TestBase { +public class IEventBlockImplTest extends FBJUnit4TestBase { - private static final String gdsType = "FBOONATIVE"; + @ClassRule + public static final GdsTypeRule testType = GdsTypeRule.supportsNativeOnly(); @Rule public final ExpectedException expectedException = ExpectedException.none(); - private AbstractNativeOODatabaseFactory factory = - (AbstractNativeOODatabaseFactory) GDSFactory.getDatabaseFactoryForType(GDSType.getType(gdsType)); + private AbstractNativeOODatabaseFactory factory; //@formatter:off public static final String TABLE_DEF = "CREATE TABLE TEST (" + @@ -61,6 +60,11 @@ public class TestIEventBlockImpl extends FBJUnit4TestBase { private IDatabaseImpl db; + @Before + public void setFactory() { + factory = (AbstractNativeOODatabaseFactory) FBTestProperties.getFbDatabaseFactory(); + } + @After public final void tearDown() throws Exception { if (db != null && db.isAttached()) { diff --git a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/TestIServiceConnectionImpl.java b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IServiceConnectionImplTest.java similarity index 83% rename from src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/TestIServiceConnectionImpl.java rename to src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IServiceConnectionImplTest.java index cf8f3b6f80..8b955014e7 100644 --- a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/TestIServiceConnectionImpl.java +++ b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IServiceConnectionImplTest.java @@ -1,12 +1,15 @@ package org.firebirdsql.nativeoo.gds.ng; import org.firebirdsql.common.FBTestProperties; +import org.firebirdsql.common.rules.GdsTypeRule; import org.firebirdsql.gds.impl.GDSFactory; import org.firebirdsql.gds.impl.GDSType; import org.firebirdsql.gds.ng.FbService; import org.firebirdsql.gds.ng.FbServiceProperties; import org.firebirdsql.gds.ng.jna.AbstractNativeDatabaseFactory; import org.firebirdsql.jna.fbclient.FbClientLibrary; +import org.junit.Before; +import org.junit.ClassRule; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; @@ -16,12 +19,15 @@ import static org.junit.Assert.*; import static org.junit.Assert.assertNull; -public class TestIServiceConnectionImpl { +public class IServiceConnectionImplTest { + + @ClassRule + public static final GdsTypeRule testType = GdsTypeRule.supportsNativeOnly(); + @Rule public final ExpectedException expectedException = ExpectedException.none(); - private AbstractNativeOODatabaseFactory factory = - (AbstractNativeOODatabaseFactory) GDSFactory.getDatabaseFactoryForType(GDSType.getType("FBOONATIVE")); + private AbstractNativeOODatabaseFactory factory; private final FbServiceProperties connectionInfo; { @@ -32,6 +38,11 @@ public class TestIServiceConnectionImpl { connectionInfo.setPassword(DB_PASSWORD); } + @Before + public void setFactory() { + factory = (AbstractNativeOODatabaseFactory) FBTestProperties.getFbDatabaseFactory(); + } + @Test public void construct_clientLibraryNull_IllegalArgument() throws Exception { expectedException.expect(NullPointerException.class); diff --git a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/TestIServiceImpl.java b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IServiceImplTest.java similarity index 93% rename from src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/TestIServiceImpl.java rename to src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IServiceImplTest.java index 19cc9d0a3d..93056f4da9 100644 --- a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/TestIServiceImpl.java +++ b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IServiceImplTest.java @@ -1,6 +1,7 @@ package org.firebirdsql.nativeoo.gds.ng; import org.firebirdsql.common.FBTestProperties; +import org.firebirdsql.common.rules.GdsTypeRule; import org.firebirdsql.gds.ISCConstants; import org.firebirdsql.gds.ServiceRequestBuffer; import org.firebirdsql.gds.impl.GDSFactory; @@ -11,6 +12,8 @@ import org.firebirdsql.gds.ng.jna.AbstractNativeDatabaseFactory; import org.firebirdsql.management.FBManager; import org.firebirdsql.management.FBStatisticsManager; +import org.junit.Before; +import org.junit.ClassRule; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; @@ -32,15 +35,15 @@ import static org.junit.Assert.assertThat; import static org.junit.Assume.assumeThat; -public class TestIServiceImpl { +public class IServiceImplTest { - private static final String gdsType = "FBOONATIVE"; + @ClassRule + public static final GdsTypeRule testType = GdsTypeRule.supportsNativeOnly(); @Rule public final ExpectedException expectedException = ExpectedException.none(); - private AbstractNativeOODatabaseFactory factory = - (AbstractNativeOODatabaseFactory) GDSFactory.getDatabaseFactoryForType(GDSType.getType(gdsType)); + private AbstractNativeOODatabaseFactory factory; private final FbServiceProperties connectionInfo; { @@ -51,6 +54,11 @@ public class TestIServiceImpl { connectionInfo.setPassword(DB_PASSWORD); } + @Before + public void setFactory() { + factory = (AbstractNativeOODatabaseFactory) FBTestProperties.getFbDatabaseFactory(); + } + @Test public void testBasicAttach() throws Exception { try (IServiceImpl service = (IServiceImpl)factory.serviceConnect(connectionInfo)) { diff --git a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/TestIStatementImpl.java b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IStatementImplTest.java similarity index 97% rename from src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/TestIStatementImpl.java rename to src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IStatementImplTest.java index b9d150511d..a3535908c5 100644 --- a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/TestIStatementImpl.java +++ b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IStatementImplTest.java @@ -18,6 +18,8 @@ */ package org.firebirdsql.nativeoo.gds.ng; +import org.firebirdsql.common.FBTestProperties; +import org.firebirdsql.common.rules.GdsTypeRule; import org.firebirdsql.gds.impl.GDSFactory; import org.firebirdsql.gds.impl.GDSType; import org.firebirdsql.gds.ng.AbstractStatementTest; @@ -26,6 +28,8 @@ import org.firebirdsql.gds.ng.fields.RowValue; import org.firebirdsql.gds.ng.jna.AbstractNativeDatabaseFactory; import org.firebirdsql.gds.ng.wire.SimpleStatementListener; +import org.junit.Before; +import org.junit.ClassRule; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; @@ -41,15 +45,16 @@ * * @since 4.0 */ -public class TestIStatementImpl extends AbstractStatementTest { +public class IStatementImplTest extends AbstractStatementTest { - private static final String gdsType = "FBOONATIVE"; + @ClassRule + public static final GdsTypeRule testType = GdsTypeRule.supportsNativeOnly(); @Rule public final ExpectedException expectedException = ExpectedException.none(); private final AbstractNativeOODatabaseFactory factory = - (AbstractNativeOODatabaseFactory) GDSFactory.getDatabaseFactoryForType(GDSType.getType(gdsType)); + (AbstractNativeOODatabaseFactory) FBTestProperties.getFbDatabaseFactory(); @Override protected Class getExpectedDatabaseType() { diff --git a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/TestITransactionImpl.java b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/ITransactionImplTest.java similarity index 64% rename from src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/TestITransactionImpl.java rename to src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/ITransactionImplTest.java index f3c6c745fe..2cdea3a964 100644 --- a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/TestITransactionImpl.java +++ b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/ITransactionImplTest.java @@ -1,10 +1,14 @@ package org.firebirdsql.nativeoo.gds.ng; +import org.firebirdsql.common.FBTestProperties; +import org.firebirdsql.common.rules.GdsTypeRule; import org.firebirdsql.gds.impl.GDSFactory; import org.firebirdsql.gds.impl.GDSType; import org.firebirdsql.gds.ng.AbstractTransactionTest; import org.firebirdsql.gds.ng.FbDatabase; import org.firebirdsql.gds.ng.jna.AbstractNativeDatabaseFactory; +import org.junit.Before; +import org.junit.ClassRule; import org.junit.Rule; import org.junit.rules.ExpectedException; @@ -15,15 +19,16 @@ * * @since 4.0 */ -public class TestITransactionImpl extends AbstractTransactionTest { +public class ITransactionImplTest extends AbstractTransactionTest { - private static final String gdsType = "FBOONATIVE"; + @ClassRule + public static final GdsTypeRule testType = GdsTypeRule.supportsNativeOnly(); @Rule public final ExpectedException expectedException = ExpectedException.none(); - private AbstractNativeOODatabaseFactory factory = - (AbstractNativeOODatabaseFactory) GDSFactory.getDatabaseFactoryForType(GDSType.getType(gdsType)); + private final AbstractNativeOODatabaseFactory factory = + (AbstractNativeOODatabaseFactory) FBTestProperties.getFbDatabaseFactory(); @Override protected FbDatabase createDatabase() throws SQLException { diff --git a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/TestNativeDatabaseConnection.java b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/NativeDatabaseConnectionTest.java similarity index 83% rename from src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/TestNativeDatabaseConnection.java rename to src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/NativeDatabaseConnectionTest.java index 5118708549..799efcac41 100644 --- a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/TestNativeDatabaseConnection.java +++ b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/NativeDatabaseConnectionTest.java @@ -1,11 +1,14 @@ package org.firebirdsql.nativeoo.gds.ng; import org.firebirdsql.common.FBTestProperties; +import org.firebirdsql.common.rules.GdsTypeRule; import org.firebirdsql.gds.impl.GDSFactory; import org.firebirdsql.gds.impl.GDSType; import org.firebirdsql.gds.ng.FbConnectionProperties; import org.firebirdsql.gds.ng.FbDatabase; import org.firebirdsql.jna.fbclient.FbClientLibrary; +import org.junit.Before; +import org.junit.ClassRule; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; @@ -14,13 +17,16 @@ import static org.firebirdsql.common.FBTestProperties.DB_USER; import static org.junit.Assert.*; -public class TestNativeDatabaseConnection { +public class NativeDatabaseConnectionTest { + + @ClassRule + public static final GdsTypeRule testType = GdsTypeRule.supportsNativeOnly(); @Rule public final ExpectedException expectedException = ExpectedException.none(); - private final AbstractNativeOODatabaseFactory factory = - (AbstractNativeOODatabaseFactory) GDSFactory.getDatabaseFactoryForType(GDSType.getType("FBOONATIVE")); + private AbstractNativeOODatabaseFactory factory; + private final FbConnectionProperties connectionInfo; { connectionInfo = new FbConnectionProperties(); @@ -32,6 +38,11 @@ public class TestNativeDatabaseConnection { connectionInfo.setEncoding("NONE"); } + @Before + public void setFactory() { + factory = (AbstractNativeOODatabaseFactory) FBTestProperties.getFbDatabaseFactory(); + } + @Test public void construct_clientLibraryNull_IllegalArgument() throws Exception { expectedException.expect(NullPointerException.class); diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/AbstractNativeConnection.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/AbstractNativeConnection.java index e28b6d4a66..9ccf75f633 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/AbstractNativeConnection.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/AbstractNativeConnection.java @@ -1,32 +1,33 @@ package org.firebirdsql.nativeoo.gds.ng; +import com.sun.jna.Pointer; +import org.firebirdsql.encodings.DefaultEncodingDefinition; import org.firebirdsql.encodings.IEncodingFactory; -import org.firebirdsql.gds.ng.AbstractConnection; -import org.firebirdsql.gds.ng.DatatypeCoder; -import org.firebirdsql.gds.ng.FbAttachment; -import org.firebirdsql.gds.ng.IAttachProperties; +import org.firebirdsql.gds.ISCConstants; +import org.firebirdsql.gds.ng.*; import org.firebirdsql.gds.ng.jna.BigEndianDatatypeCoder; import org.firebirdsql.gds.ng.jna.LittleEndianDatatypeCoder; import org.firebirdsql.jna.fbclient.FbClientLibrary; import org.firebirdsql.logging.Logger; import org.firebirdsql.logging.LoggerFactory; +import org.firebirdsql.nativeoo.gds.ng.FbInterface.IStatus; import java.nio.ByteOrder; import java.sql.SQLException; import static java.util.Objects.requireNonNull; +import static org.firebirdsql.gds.ISCConstants.*; +import static org.firebirdsql.gds.ISCConstants.isc_arg_end; /** * Class handling the initial setup of the native connection. * That's using for native OO API. * - * @param - * Type of attach properties - * @param - * Type of connection handle + * @param Type of attach properties + * @param Type of connection handle * @since 4.0 */ -public abstract class AbstractNativeConnection , C extends FbAttachment> +public abstract class AbstractNativeConnection, C extends FbAttachment> extends AbstractConnection { private static final Logger log = LoggerFactory.getLogger(AbstractNativeConnection.class); private static final boolean bigEndian = ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN; @@ -36,12 +37,9 @@ public abstract class AbstractNativeConnection , /** * Creates a AbstractNativeConnection (without establishing a connection to the server). * - * @param clientLibrary - * Client library to use - * @param attachProperties - * Attach properties - * @param encodingFactory - * Encoding factory + * @param clientLibrary Client library to use + * @param attachProperties Attach properties + * @param encodingFactory Encoding factory */ protected AbstractNativeConnection(FbClientLibrary clientLibrary, T attachProperties, IEncodingFactory encodingFactory) throws SQLException { @@ -56,6 +54,82 @@ public final FbClientLibrary getClientLibrary() { return clientLibrary; } + /** + * Processing {@link IStatus} to get result of native calling + */ + protected void processStatus(IStatus status, WarningMessageCallback messageCallback) throws SQLException { + Pointer pointer = status.getErrors(); + long[] statusVector = pointer.getLongArray(0, 20); + + boolean debug = log.isDebugEnabled(); + final FbExceptionBuilder builder = new FbExceptionBuilder(); + int vectorIndex = 0; + processingLoop: + while (vectorIndex < statusVector.length) { + int arg = (int) statusVector[vectorIndex++]; + int errorCode; + switch (arg) { + case isc_arg_gds: + errorCode = (int) statusVector[vectorIndex++]; + if (debug) log.debug("readStatusVector arg:isc_arg_gds int: " + errorCode); + if (errorCode != 0) { + builder.exception(errorCode); + } + break; + case isc_arg_warning: + errorCode = (int) statusVector[vectorIndex++]; + if (debug) log.debug("readStatusVector arg:isc_arg_warning int: " + errorCode); + if (errorCode != 0) { + builder.warning(errorCode); + } + break; + case isc_arg_interpreted: + case isc_arg_string: + case isc_arg_sql_state: + long stringPointerAddress = statusVector[vectorIndex++]; + if (stringPointerAddress == 0L) { + log.warn("Received NULL pointer address for isc_arg_interpreted, isc_arg_string or isc_arg_sql_state"); + break processingLoop; + } + Pointer stringPointer = new Pointer(stringPointerAddress); + String stringValue = stringPointer.getString(0, getEncodingDefinition().getJavaEncodingName()); + if (arg != isc_arg_sql_state) { + if (debug) log.debug("readStatusVector string: " + stringValue); + builder.messageParameter(stringValue); + } else { + if (debug) log.debug("readStatusVector sqlstate: " + stringValue); + builder.sqlState(stringValue); + } + break; + case isc_arg_cstring: + int stringLength = (int) statusVector[vectorIndex++]; + long cStringPointerAddress = statusVector[vectorIndex++]; + Pointer cStringPointer = new Pointer(cStringPointerAddress); + byte[] stringData = cStringPointer.getByteArray(0, stringLength); + String cStringValue = getEncoding().decodeFromCharset(stringData); + builder.messageParameter(cStringValue); + break; + case isc_arg_number: + int intValue = (int) statusVector[vectorIndex++]; + if (debug) log.debug("readStatusVector arg:isc_arg_number int: " + intValue); + builder.messageParameter(intValue); + break; + case isc_arg_end: + break processingLoop; + default: + int e = (int) statusVector[vectorIndex++]; + if (debug) log.debug("readStatusVector arg: " + arg + " int: " + e); + builder.messageParameter(e); + break; + } + } + + if (!builder.isEmpty()) { + SQLException exception = builder.toFlatSQLException(); + throw exception; + } + } + public final DatatypeCoder createDatatypeCoder() { if (bigEndian) { return BigEndianDatatypeCoder.forEncodingFactory(getEncodingFactory()); diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/CloseableMemory.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/CloseableMemory.java index 1ac1ccc006..9bf51027d9 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/CloseableMemory.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/CloseableMemory.java @@ -9,8 +9,7 @@ */ public class CloseableMemory extends Memory implements AutoCloseable { - public CloseableMemory(long size) - { + public CloseableMemory(long size) { super(size); } diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbException.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbException.java deleted file mode 100644 index a2bd0fa52a..0000000000 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbException.java +++ /dev/null @@ -1,131 +0,0 @@ -package org.firebirdsql.nativeoo.gds.ng; - -import com.sun.jna.Pointer; -import org.firebirdsql.gds.ISCConstants; -import org.firebirdsql.gds.ng.FbExceptionBuilder; -import org.firebirdsql.nativeoo.gds.ng.FbInterface.IStatus; - -import java.io.PrintWriter; -import java.io.StringWriter; -import java.sql.SQLException; - -import static org.firebirdsql.gds.ISCConstants.*; -import static org.firebirdsql.gds.ISCConstants.isc_arg_number; - -/** - * Class for handling exceptions from native OO API. - * - * @since 4.0 - */ -public class FbException extends SQLException { - - private static final long serialVersionUID = 1L; - - public FbException(Throwable t) { - super(t); - } - - public FbException(String msg) { - super(msg); - } - - public FbException(String msg, Throwable t) { - super(msg, t); - } - - public FbException(String reason, String sqlState, int vendorCode, Throwable cause) { - super(reason, sqlState, vendorCode, cause); - } - - public static void rethrow(Throwable t) throws FbException { - throw new FbException(null, t); - } - - public static void catchException(IStatus status, Throwable t) { - - while (t != null && t instanceof FbException && t.getMessage() == null) - t = t.getCause(); - - StringWriter sw = new StringWriter(); - PrintWriter pw = new PrintWriter(sw); - t.printStackTrace(pw); - String msg = sw.toString(); - - try (CloseableMemory memory = new CloseableMemory(msg.length() + 1)) { - memory.setString(0, msg); - - Pointer[] vector = new Pointer[]{ - new Pointer(ISCConstants.isc_arg_gds), - new Pointer(ISCConstants.isc_random), - new Pointer(ISCConstants.isc_arg_cstring), - new Pointer(msg.length()), - memory, - new Pointer(ISCConstants.isc_arg_end) - }; - - status.setErrors2(vector.length, vector); - } - } - - public static void checkException(IStatus status) throws FbException { - if ((status.getState() & IStatus.STATE_ERRORS) != 0) { - FbExceptionBuilder builder = new FbExceptionBuilder(); - - int offset = 0; - - processingLoop: - while (status.getErrors().getInt(offset) != isc_arg_end) { - - int arg = status.getErrors().getInt(offset); - - switch (arg) { - case isc_arg_gds: - offset += 8; - int iscCode = status.getErrors().getInt(offset); - builder.exception(iscCode); - break; - case isc_arg_interpreted: - case isc_arg_string: - case isc_arg_sql_state: - offset += 8; - long stringPointerAddress = status.getErrors().getLong(offset); - if (stringPointerAddress == 0L) { - break processingLoop; - } - Pointer stringPointer = new Pointer(stringPointerAddress); - String stringValue = stringPointer.getString(0); - if (arg != isc_arg_sql_state) { - builder.messageParameter(stringValue); - } else { - builder.sqlState(stringValue); - } - break; - case isc_arg_cstring: - offset += 8; - int stringLength = status.getErrors().getInt(offset); - offset += 8; - long cStringPointerAddress = status.getErrors().getLong(offset); - Pointer cStringPointer = new Pointer(cStringPointerAddress); - byte[] stringData = cStringPointer.getByteArray(0, stringLength); - String cStringValue = new String(stringData); - builder.messageParameter(cStringValue); - break; - case isc_arg_number: - offset += 8; - int intValue = status.getErrors().getInt(offset); - builder.messageParameter(intValue); - break; - } - - offset += 8; - } - - - if (!builder.isEmpty()) { - SQLException exception = builder.toSQLException(); - throw new FbException(exception.getMessage(), exception.getSQLState(), exception.getErrorCode(), - exception); - } - } - } -} diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbInterface.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbInterface.java index fbbfaad512..2b7faff3a9 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbInterface.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbInterface.java @@ -57,7 +57,7 @@ public static interface IMasterIntf extends IVersionedIntf public IDtc getDtc(); public IAttachment registerAttachment(IProvider provider, IAttachment attachment); public ITransaction registerTransaction(IAttachment attachment, ITransaction transaction); - public IMetadataBuilder getMetadataBuilder(IStatus status, int fieldCount) throws FbException; + public IMetadataBuilder getMetadataBuilder(IStatus status, int fieldCount); public int serverMode(int mode); public IUtil getUtilInterface(); public IConfigManager getConfigManager(); @@ -74,9 +74,9 @@ public static interface IPluginSetIntf extends IReferenceCountedIntf { public String getName(); public String getModuleName(); - public IPluginBase getPlugin(IStatus status) throws FbException; - public void next(IStatus status) throws FbException; - public void set(IStatus status, String s) throws FbException; + public IPluginBase getPlugin(IStatus status); + public void next(IStatus status); + public void set(IStatus status, String s); } public static interface IConfigEntryIntf extends IReferenceCountedIntf @@ -85,14 +85,14 @@ public static interface IConfigEntryIntf extends IReferenceCountedIntf public String getValue(); public long getIntValue(); public boolean getBoolValue(); - public IConfig getSubConfig(IStatus status) throws FbException; + public IConfig getSubConfig(IStatus status); } public static interface IConfigIntf extends IReferenceCountedIntf { - public IConfigEntry find(IStatus status, String name) throws FbException; - public IConfigEntry findValue(IStatus status, String name, String value) throws FbException; - public IConfigEntry findPos(IStatus status, String name, int pos) throws FbException; + public IConfigEntry find(IStatus status, String name); + public IConfigEntry findValue(IStatus status, String name, String value); + public IConfigEntry findPos(IStatus status, String name, int pos); } public static interface IFirebirdConfIntf extends IReferenceCountedIntf @@ -106,14 +106,14 @@ public static interface IFirebirdConfIntf extends IReferenceCountedIntf public static interface IPluginConfigIntf extends IReferenceCountedIntf { public String getConfigFileName(); - public IConfig getDefaultConfig(IStatus status) throws FbException; - public IFirebirdConf getFirebirdConf(IStatus status) throws FbException; - public void setReleaseDelay(IStatus status, long microSeconds) throws FbException; + public IConfig getDefaultConfig(IStatus status); + public IFirebirdConf getFirebirdConf(IStatus status); + public void setReleaseDelay(IStatus status, long microSeconds); } public static interface IPluginFactoryIntf extends IVersionedIntf { - public IPluginBase createPlugin(IStatus status, IPluginConfig factoryParameter) throws FbException; + public IPluginBase createPlugin(IStatus status, IPluginConfig factoryParameter); } public static interface IPluginModuleIntf extends IVersionedIntf @@ -135,20 +135,21 @@ public static interface IPluginManagerIntf extends IVersionedIntf public static int TYPE_DB_CRYPT = 9; public static int TYPE_KEY_HOLDER = 10; public static int TYPE_CRYPTO_API = 11; - public static int TYPE_COUNT = 12; + public static int TYPE_LDAP = 12; + public static int TYPE_COUNT = 13; public void registerPluginFactory(int pluginType, String defaultName, IPluginFactory factory); public void registerModule(IPluginModule cleanup); public void unregisterModule(IPluginModule cleanup); - public IPluginSet getPlugins(IStatus status, int pluginType, String namesList, IFirebirdConf firebirdConf) throws FbException; - public IConfig getConfig(IStatus status, String filename) throws FbException; + public IPluginSet getPlugins(IStatus status, int pluginType, String namesList, IFirebirdConf firebirdConf); + public IConfig getConfig(IStatus status, String filename); public void releasePlugin(IPluginBase plugin); } public static interface ICryptKeyIntf extends IVersionedIntf { - public void setSymmetric(IStatus status, String type, int keyLength, com.sun.jna.Pointer key) throws FbException; - public void setAsymmetric(IStatus status, String type, int encryptKeyLength, com.sun.jna.Pointer encryptKey, int decryptKeyLength, com.sun.jna.Pointer decryptKey) throws FbException; + public void setSymmetric(IStatus status, String type, int keyLength, com.sun.jna.Pointer key); + public void setAsymmetric(IStatus status, String type, int encryptKeyLength, com.sun.jna.Pointer encryptKey, int decryptKeyLength, com.sun.jna.Pointer decryptKey); public com.sun.jna.Pointer getEncryptKey(com.sun.jna.Pointer length); public com.sun.jna.Pointer getDecryptKey(com.sun.jna.Pointer length); } @@ -189,76 +190,76 @@ public static interface IEventCallbackIntf extends IReferenceCountedIntf public static interface IBlobIntf extends IReferenceCountedIntf { - public void getInfo(IStatus status, int itemsLength, byte[] items, int bufferLength, byte[] buffer) throws FbException; - public int getSegment(IStatus status, int bufferLength, com.sun.jna.Pointer buffer, com.sun.jna.Pointer segmentLength) throws FbException; - public void putSegment(IStatus status, int length, com.sun.jna.Pointer buffer) throws FbException; - public void cancel(IStatus status) throws FbException; - public void close(IStatus status) throws FbException; - public int seek(IStatus status, int mode, int offset) throws FbException; + public void getInfo(IStatus status, int itemsLength, byte[] items, int bufferLength, byte[] buffer); + public int getSegment(IStatus status, int bufferLength, com.sun.jna.Pointer buffer, com.sun.jna.Pointer segmentLength); + public void putSegment(IStatus status, int length, com.sun.jna.Pointer buffer); + public void cancel(IStatus status); + public void close(IStatus status); + public int seek(IStatus status, int mode, int offset); } public static interface ITransactionIntf extends IReferenceCountedIntf { - public void getInfo(IStatus status, int itemsLength, byte[] items, int bufferLength, byte[] buffer) throws FbException; - public void prepare(IStatus status, int msgLength, byte[] message) throws FbException; - public void commit(IStatus status) throws FbException; - public void commitRetaining(IStatus status) throws FbException; - public void rollback(IStatus status) throws FbException; - public void rollbackRetaining(IStatus status) throws FbException; - public void disconnect(IStatus status) throws FbException; - public ITransaction join(IStatus status, ITransaction transaction) throws FbException; - public ITransaction validate(IStatus status, IAttachment attachment) throws FbException; - public ITransaction enterDtc(IStatus status) throws FbException; + public void getInfo(IStatus status, int itemsLength, byte[] items, int bufferLength, byte[] buffer); + public void prepare(IStatus status, int msgLength, byte[] message); + public void commit(IStatus status); + public void commitRetaining(IStatus status); + public void rollback(IStatus status); + public void rollbackRetaining(IStatus status); + public void disconnect(IStatus status); + public ITransaction join(IStatus status, ITransaction transaction); + public ITransaction validate(IStatus status, IAttachment attachment); + public ITransaction enterDtc(IStatus status); } public static interface IMessageMetadataIntf extends IReferenceCountedIntf { - public int getCount(IStatus status) throws FbException; - public String getField(IStatus status, int index) throws FbException; - public String getRelation(IStatus status, int index) throws FbException; - public String getOwner(IStatus status, int index) throws FbException; - public String getAlias(IStatus status, int index) throws FbException; - public int getType(IStatus status, int index) throws FbException; - public boolean isNullable(IStatus status, int index) throws FbException; - public int getSubType(IStatus status, int index) throws FbException; - public int getLength(IStatus status, int index) throws FbException; - public int getScale(IStatus status, int index) throws FbException; - public int getCharSet(IStatus status, int index) throws FbException; - public int getOffset(IStatus status, int index) throws FbException; - public int getNullOffset(IStatus status, int index) throws FbException; - public IMetadataBuilder getBuilder(IStatus status) throws FbException; - public int getMessageLength(IStatus status) throws FbException; - public int getAlignment(IStatus status) throws FbException; - public int getAlignedLength(IStatus status) throws FbException; + public int getCount(IStatus status); + public String getField(IStatus status, int index); + public String getRelation(IStatus status, int index); + public String getOwner(IStatus status, int index); + public String getAlias(IStatus status, int index); + public int getType(IStatus status, int index); + public boolean isNullable(IStatus status, int index); + public int getSubType(IStatus status, int index); + public int getLength(IStatus status, int index); + public int getScale(IStatus status, int index); + public int getCharSet(IStatus status, int index); + public int getOffset(IStatus status, int index); + public int getNullOffset(IStatus status, int index); + public IMetadataBuilder getBuilder(IStatus status); + public int getMessageLength(IStatus status); + public int getAlignment(IStatus status); + public int getAlignedLength(IStatus status); } public static interface IMetadataBuilderIntf extends IReferenceCountedIntf { - public void setType(IStatus status, int index, int type) throws FbException; - public void setSubType(IStatus status, int index, int subType) throws FbException; - public void setLength(IStatus status, int index, int length) throws FbException; - public void setCharSet(IStatus status, int index, int charSet) throws FbException; - public void setScale(IStatus status, int index, int scale) throws FbException; - public void truncate(IStatus status, int count) throws FbException; - public void moveNameToIndex(IStatus status, String name, int index) throws FbException; - public void remove(IStatus status, int index) throws FbException; - public int addField(IStatus status) throws FbException; - public IMessageMetadata getMetadata(IStatus status) throws FbException; + public void setType(IStatus status, int index, int type); + public void setSubType(IStatus status, int index, int subType); + public void setLength(IStatus status, int index, int length); + public void setCharSet(IStatus status, int index, int charSet); + public void setScale(IStatus status, int index, int scale); + public void truncate(IStatus status, int count); + public void moveNameToIndex(IStatus status, String name, int index); + public void remove(IStatus status, int index); + public int addField(IStatus status); + public IMessageMetadata getMetadata(IStatus status); } public static interface IResultSetIntf extends IReferenceCountedIntf { - public int fetchNext(IStatus status, com.sun.jna.Pointer message) throws FbException; - public int fetchPrior(IStatus status, com.sun.jna.Pointer message) throws FbException; - public int fetchFirst(IStatus status, com.sun.jna.Pointer message) throws FbException; - public int fetchLast(IStatus status, com.sun.jna.Pointer message) throws FbException; - public int fetchAbsolute(IStatus status, int position, com.sun.jna.Pointer message) throws FbException; - public int fetchRelative(IStatus status, int offset, com.sun.jna.Pointer message) throws FbException; - public boolean isEof(IStatus status) throws FbException; - public boolean isBof(IStatus status) throws FbException; - public IMessageMetadata getMetadata(IStatus status) throws FbException; - public void close(IStatus status) throws FbException; - public void setDelayedOutputFormat(IStatus status, IMessageMetadata format) throws FbException; + public int fetchNext(IStatus status, com.sun.jna.Pointer message); + public int fetchPrior(IStatus status, com.sun.jna.Pointer message); + public int fetchFirst(IStatus status, com.sun.jna.Pointer message); + public int fetchLast(IStatus status, com.sun.jna.Pointer message); + public int fetchAbsolute(IStatus status, int position, com.sun.jna.Pointer message); + public int fetchRelative(IStatus status, int offset, com.sun.jna.Pointer message); + public boolean isEof(IStatus status); + public boolean isBof(IStatus status); + public IMessageMetadata getMetadata(IStatus status); + public void close(IStatus status); + public void setDelayedOutputFormat(IStatus status, IMessageMetadata format); } public static interface IStatementIntf extends IReferenceCountedIntf @@ -277,20 +278,20 @@ public static interface IStatementIntf extends IReferenceCountedIntf public static int FLAG_REPEAT_EXECUTE = 2; public static int CURSOR_TYPE_SCROLLABLE = 1; - public void getInfo(IStatus status, int itemsLength, byte[] items, int bufferLength, byte[] buffer) throws FbException; - public int getType(IStatus status) throws FbException; - public String getPlan(IStatus status, boolean detailed) throws FbException; - public long getAffectedRecords(IStatus status) throws FbException; - public IMessageMetadata getInputMetadata(IStatus status) throws FbException; - public IMessageMetadata getOutputMetadata(IStatus status) throws FbException; - public ITransaction execute(IStatus status, ITransaction transaction, IMessageMetadata inMetadata, com.sun.jna.Pointer inBuffer, IMessageMetadata outMetadata, com.sun.jna.Pointer outBuffer) throws FbException; - public IResultSet openCursor(IStatus status, ITransaction transaction, IMessageMetadata inMetadata, com.sun.jna.Pointer inBuffer, IMessageMetadata outMetadata, int flags) throws FbException; - public void setCursorName(IStatus status, String name) throws FbException; - public void free(IStatus status) throws FbException; - public int getFlags(IStatus status) throws FbException; - public int getTimeout(IStatus status) throws FbException; - public void setTimeout(IStatus status, int timeOut) throws FbException; - public IBatch createBatch(IStatus status, IMessageMetadata inMetadata, int parLength, byte[] par) throws FbException; + public void getInfo(IStatus status, int itemsLength, byte[] items, int bufferLength, byte[] buffer); + public int getType(IStatus status); + public String getPlan(IStatus status, boolean detailed); + public long getAffectedRecords(IStatus status); + public IMessageMetadata getInputMetadata(IStatus status); + public IMessageMetadata getOutputMetadata(IStatus status); + public ITransaction execute(IStatus status, ITransaction transaction, IMessageMetadata inMetadata, com.sun.jna.Pointer inBuffer, IMessageMetadata outMetadata, com.sun.jna.Pointer outBuffer); + public IResultSet openCursor(IStatus status, ITransaction transaction, IMessageMetadata inMetadata, com.sun.jna.Pointer inBuffer, IMessageMetadata outMetadata, int flags); + public void setCursorName(IStatus status, String name); + public void free(IStatus status); + public int getFlags(IStatus status); + public int getTimeout(IStatus status); + public void setTimeout(IStatus status, int timeOut); + public IBatch createBatch(IStatus status, IMessageMetadata inMetadata, int parLength, byte[] par); } public static interface IBatchIntf extends IReferenceCountedIntf @@ -307,16 +308,16 @@ public static interface IBatchIntf extends IReferenceCountedIntf public static byte BLOB_STREAM = 3; public static int BLOB_SEGHDR_ALIGN = 2; - public void add(IStatus status, int count, com.sun.jna.Pointer inBuffer) throws FbException; - public void addBlob(IStatus status, int length, com.sun.jna.Pointer inBuffer, com.sun.jna.ptr.LongByReference blobId, int parLength, byte[] par) throws FbException; - public void appendBlobData(IStatus status, int length, com.sun.jna.Pointer inBuffer) throws FbException; - public void addBlobStream(IStatus status, int length, com.sun.jna.Pointer inBuffer) throws FbException; - public void registerBlob(IStatus status, com.sun.jna.ptr.LongByReference existingBlob, com.sun.jna.ptr.LongByReference blobId) throws FbException; - public IBatchCompletionState execute(IStatus status, ITransaction transaction) throws FbException; - public void cancel(IStatus status) throws FbException; - public int getBlobAlignment(IStatus status) throws FbException; - public IMessageMetadata getMetadata(IStatus status) throws FbException; - public void setDefaultBpb(IStatus status, int parLength, byte[] par) throws FbException; + public void add(IStatus status, int count, com.sun.jna.Pointer inBuffer); + public void addBlob(IStatus status, int length, com.sun.jna.Pointer inBuffer, com.sun.jna.ptr.LongByReference blobId, int parLength, byte[] par); + public void appendBlobData(IStatus status, int length, com.sun.jna.Pointer inBuffer); + public void addBlobStream(IStatus status, int length, com.sun.jna.Pointer inBuffer); + public void registerBlob(IStatus status, com.sun.jna.ptr.LongByReference existingBlob, com.sun.jna.ptr.LongByReference blobId); + public IBatchCompletionState execute(IStatus status, ITransaction transaction); + public void cancel(IStatus status); + public int getBlobAlignment(IStatus status); + public IMessageMetadata getMetadata(IStatus status); + public void setDefaultBpb(IStatus status, int parLength, byte[] par); } public static interface IBatchCompletionStateIntf extends IDisposableIntf @@ -325,26 +326,26 @@ public static interface IBatchCompletionStateIntf extends IDisposableIntf public static int SUCCESS_NO_INFO = -2; public static int NO_MORE_ERRORS = -1; - public int getSize(IStatus status) throws FbException; - public int getState(IStatus status, int pos) throws FbException; - public int findError(IStatus status, int pos) throws FbException; - public void getStatus(IStatus status, IStatus to, int pos) throws FbException; + public int getSize(IStatus status); + public int getState(IStatus status, int pos); + public int findError(IStatus status, int pos); + public void getStatus(IStatus status, IStatus to, int pos); } public static interface IRequestIntf extends IReferenceCountedIntf { - public void receive(IStatus status, int level, int msgType, int length, com.sun.jna.Pointer message) throws FbException; - public void send(IStatus status, int level, int msgType, int length, com.sun.jna.Pointer message) throws FbException; - public void getInfo(IStatus status, int level, int itemsLength, byte[] items, int bufferLength, byte[] buffer) throws FbException; - public void start(IStatus status, ITransaction tra, int level) throws FbException; - public void startAndSend(IStatus status, ITransaction tra, int level, int msgType, int length, com.sun.jna.Pointer message) throws FbException; - public void unwind(IStatus status, int level) throws FbException; - public void free(IStatus status) throws FbException; + public void receive(IStatus status, int level, int msgType, int length, com.sun.jna.Pointer message); + public void send(IStatus status, int level, int msgType, int length, com.sun.jna.Pointer message); + public void getInfo(IStatus status, int level, int itemsLength, byte[] items, int bufferLength, byte[] buffer); + public void start(IStatus status, ITransaction tra, int level); + public void startAndSend(IStatus status, ITransaction tra, int level, int msgType, int length, com.sun.jna.Pointer message); + public void unwind(IStatus status, int level); + public void free(IStatus status); } public static interface IEventsIntf extends IReferenceCountedIntf { - public void cancel(IStatus status) throws FbException; + public void cancel(IStatus status); } public static interface IEventBlockIntf extends IDisposableIntf @@ -359,58 +360,58 @@ public static interface IEventBlockIntf extends IDisposableIntf public static interface IAttachmentIntf extends IReferenceCountedIntf { - public void getInfo(IStatus status, int itemsLength, byte[] items, int bufferLength, byte[] buffer) throws FbException; - public ITransaction startTransaction(IStatus status, int tpbLength, byte[] tpb) throws FbException; - public ITransaction reconnectTransaction(IStatus status, int length, byte[] id) throws FbException; - public IRequest compileRequest(IStatus status, int blrLength, byte[] blr) throws FbException; - public void transactRequest(IStatus status, ITransaction transaction, int blrLength, byte[] blr, int inMsgLength, byte[] inMsg, int outMsgLength, byte[] outMsg) throws FbException; - public IBlob createBlob(IStatus status, ITransaction transaction, com.sun.jna.ptr.LongByReference id, int bpbLength, byte[] bpb) throws FbException; - public IBlob openBlob(IStatus status, ITransaction transaction, com.sun.jna.ptr.LongByReference id, int bpbLength, byte[] bpb) throws FbException; - public int getSlice(IStatus status, ITransaction transaction, com.sun.jna.ptr.LongByReference id, int sdlLength, byte[] sdl, int paramLength, byte[] param, int sliceLength, byte[] slice) throws FbException; - public void putSlice(IStatus status, ITransaction transaction, com.sun.jna.ptr.LongByReference id, int sdlLength, byte[] sdl, int paramLength, byte[] param, int sliceLength, byte[] slice) throws FbException; - public void executeDyn(IStatus status, ITransaction transaction, int length, byte[] dyn) throws FbException; - public IStatement prepare(IStatus status, ITransaction tra, int stmtLength, String sqlStmt, int dialect, int flags) throws FbException; - public ITransaction execute(IStatus status, ITransaction transaction, int stmtLength, String sqlStmt, int dialect, IMessageMetadata inMetadata, com.sun.jna.Pointer inBuffer, IMessageMetadata outMetadata, com.sun.jna.Pointer outBuffer) throws FbException; - public IResultSet openCursor(IStatus status, ITransaction transaction, int stmtLength, String sqlStmt, int dialect, IMessageMetadata inMetadata, com.sun.jna.Pointer inBuffer, IMessageMetadata outMetadata, String cursorName, int cursorFlags) throws FbException; - public IEvents queEvents(IStatus status, IEventCallback callback, int length, byte[] events) throws FbException; - public void cancelOperation(IStatus status, int option) throws FbException; - public void ping(IStatus status) throws FbException; - public void detach(IStatus status) throws FbException; - public void dropDatabase(IStatus status) throws FbException; - public int getIdleTimeout(IStatus status) throws FbException; - public void setIdleTimeout(IStatus status, int timeOut) throws FbException; - public int getStatementTimeout(IStatus status) throws FbException; - public void setStatementTimeout(IStatus status, int timeOut) throws FbException; - public IBatch createBatch(IStatus status, ITransaction transaction, int stmtLength, String sqlStmt, int dialect, IMessageMetadata inMetadata, int parLength, byte[] par) throws FbException; + public void getInfo(IStatus status, int itemsLength, byte[] items, int bufferLength, byte[] buffer); + public ITransaction startTransaction(IStatus status, int tpbLength, byte[] tpb); + public ITransaction reconnectTransaction(IStatus status, int length, byte[] id); + public IRequest compileRequest(IStatus status, int blrLength, byte[] blr); + public void transactRequest(IStatus status, ITransaction transaction, int blrLength, byte[] blr, int inMsgLength, byte[] inMsg, int outMsgLength, byte[] outMsg); + public IBlob createBlob(IStatus status, ITransaction transaction, com.sun.jna.ptr.LongByReference id, int bpbLength, byte[] bpb); + public IBlob openBlob(IStatus status, ITransaction transaction, com.sun.jna.ptr.LongByReference id, int bpbLength, byte[] bpb); + public int getSlice(IStatus status, ITransaction transaction, com.sun.jna.ptr.LongByReference id, int sdlLength, byte[] sdl, int paramLength, byte[] param, int sliceLength, byte[] slice); + public void putSlice(IStatus status, ITransaction transaction, com.sun.jna.ptr.LongByReference id, int sdlLength, byte[] sdl, int paramLength, byte[] param, int sliceLength, byte[] slice); + public void executeDyn(IStatus status, ITransaction transaction, int length, byte[] dyn); + public IStatement prepare(IStatus status, ITransaction tra, int stmtLength, String sqlStmt, int dialect, int flags); + public ITransaction execute(IStatus status, ITransaction transaction, int stmtLength, String sqlStmt, int dialect, IMessageMetadata inMetadata, com.sun.jna.Pointer inBuffer, IMessageMetadata outMetadata, com.sun.jna.Pointer outBuffer); + public IResultSet openCursor(IStatus status, ITransaction transaction, int stmtLength, String sqlStmt, int dialect, IMessageMetadata inMetadata, com.sun.jna.Pointer inBuffer, IMessageMetadata outMetadata, String cursorName, int cursorFlags); + public IEvents queEvents(IStatus status, IEventCallback callback, int length, byte[] events); + public void cancelOperation(IStatus status, int option); + public void ping(IStatus status); + public void detach(IStatus status); + public void dropDatabase(IStatus status); + public int getIdleTimeout(IStatus status); + public void setIdleTimeout(IStatus status, int timeOut); + public int getStatementTimeout(IStatus status); + public void setStatementTimeout(IStatus status, int timeOut); + public IBatch createBatch(IStatus status, ITransaction transaction, int stmtLength, String sqlStmt, int dialect, IMessageMetadata inMetadata, int parLength, byte[] par); } public static interface IServiceIntf extends IReferenceCountedIntf { - public void detach(IStatus status) throws FbException; - public void query(IStatus status, int sendLength, byte[] sendItems, int receiveLength, byte[] receiveItems, int bufferLength, byte[] buffer) throws FbException; - public void start(IStatus status, int spbLength, byte[] spb) throws FbException; + public void detach(IStatus status); + public void query(IStatus status, int sendLength, byte[] sendItems, int receiveLength, byte[] receiveItems, int bufferLength, byte[] buffer); + public void start(IStatus status, int spbLength, byte[] spb); } public static interface IProviderIntf extends IPluginBaseIntf { - public IAttachment attachDatabase(IStatus status, String fileName, int dpbLength, byte[] dpb) throws FbException; - public IAttachment createDatabase(IStatus status, String fileName, int dpbLength, byte[] dpb) throws FbException; - public IService attachServiceManager(IStatus status, String service, int spbLength, byte[] spb) throws FbException; - public void shutdown(IStatus status, int timeout, int reason) throws FbException; - public void setDbCryptCallback(IStatus status, ICryptKeyCallback cryptCallback) throws FbException; + public IAttachment attachDatabase(IStatus status, String fileName, int dpbLength, byte[] dpb); + public IAttachment createDatabase(IStatus status, String fileName, int dpbLength, byte[] dpb); + public IService attachServiceManager(IStatus status, String service, int spbLength, byte[] spb); + public void shutdown(IStatus status, int timeout, int reason); + public void setDbCryptCallback(IStatus status, ICryptKeyCallback cryptCallback); } public static interface IDtcStartIntf extends IDisposableIntf { - public void addAttachment(IStatus status, IAttachment att) throws FbException; - public void addWithTpb(IStatus status, IAttachment att, int length, byte[] tpb) throws FbException; - public ITransaction start(IStatus status) throws FbException; + public void addAttachment(IStatus status, IAttachment att); + public void addWithTpb(IStatus status, IAttachment att, int length, byte[] tpb); + public ITransaction start(IStatus status); } public static interface IDtcIntf extends IVersionedIntf { - public ITransaction join(IStatus status, ITransaction one, ITransaction two) throws FbException; - public IDtcStart startBuilder(IStatus status) throws FbException; + public ITransaction join(IStatus status, ITransaction one, ITransaction two); + public IDtcStart startBuilder(IStatus status); } public static interface IAuthIntf extends IPluginBaseIntf @@ -425,17 +426,17 @@ public static interface IAuthIntf extends IPluginBaseIntf public static interface IWriterIntf extends IVersionedIntf { public void reset(); - public void add(IStatus status, String name) throws FbException; - public void setType(IStatus status, String value) throws FbException; - public void setDb(IStatus status, String value) throws FbException; + public void add(IStatus status, String name); + public void setType(IStatus status, String value); + public void setDb(IStatus status, String value); } public static interface IServerBlockIntf extends IVersionedIntf { public String getLogin(); public com.sun.jna.Pointer getData(com.sun.jna.Pointer length); - public void putData(IStatus status, int length, com.sun.jna.Pointer data) throws FbException; - public ICryptKey newKey(IStatus status) throws FbException; + public void putData(IStatus status, int length, com.sun.jna.Pointer data); + public ICryptKey newKey(IStatus status); } public static interface IClientBlockIntf extends IReferenceCountedIntf @@ -445,39 +446,39 @@ public static interface IClientBlockIntf extends IReferenceCountedIntf public String getCertificate(); public String getRepositoryPin(); public com.sun.jna.Pointer getData(com.sun.jna.Pointer length); - public void putData(IStatus status, int length, com.sun.jna.Pointer data) throws FbException; - public ICryptKey newKey(IStatus status) throws FbException; - public IAuthBlock getAuthBlock(IStatus status) throws FbException; + public void putData(IStatus status, int length, com.sun.jna.Pointer data); + public ICryptKey newKey(IStatus status); + public IAuthBlock getAuthBlock(IStatus status); } public static interface IServerIntf extends IAuthIntf { - public int authenticate(IStatus status, IServerBlock sBlock, IWriter writerInterface) throws FbException; - public void setDbCryptCallback(IStatus status, ICryptKeyCallback cryptCallback) throws FbException; + public int authenticate(IStatus status, IServerBlock sBlock, IWriter writerInterface); + public void setDbCryptCallback(IStatus status, ICryptKeyCallback cryptCallback); } public static interface IClientIntf extends IAuthIntf { - public int authenticate(IStatus status, IClientBlock cBlock) throws FbException; + public int authenticate(IStatus status, IClientBlock cBlock); } public static interface IUserFieldIntf extends IVersionedIntf { public int entered(); public int specified(); - public void setEntered(IStatus status, int newValue) throws FbException; + public void setEntered(IStatus status, int newValue); } public static interface ICharUserFieldIntf extends IUserFieldIntf { public String get(); - public void set(IStatus status, String newValue) throws FbException; + public void set(IStatus status, String newValue); } public static interface IIntUserFieldIntf extends IUserFieldIntf { public int get(); - public void set(IStatus status, int newValue) throws FbException; + public void set(IStatus status, int newValue); } public static interface IUserIntf extends IVersionedIntf @@ -499,12 +500,12 @@ public static interface IUserIntf extends IVersionedIntf public ICharUserField attributes(); public IIntUserField active(); public IIntUserField admin(); - public void clear(IStatus status) throws FbException; + public void clear(IStatus status); } public static interface IListUsersIntf extends IVersionedIntf { - public void list(IStatus status, IUser user) throws FbException; + public void list(IStatus status, IUser user); } public static interface ILogonInfoIntf extends IVersionedIntf @@ -518,10 +519,10 @@ public static interface ILogonInfoIntf extends IVersionedIntf public static interface IManagementIntf extends IPluginBaseIntf { - public void start(IStatus status, ILogonInfo logonInfo) throws FbException; - public int execute(IStatus status, IUser user, IListUsers callback) throws FbException; - public void commit(IStatus status) throws FbException; - public void rollback(IStatus status) throws FbException; + public void start(IStatus status, ILogonInfo logonInfo); + public int execute(IStatus status, IUser user, IListUsers callback); + public void commit(IStatus status); + public void rollback(IStatus status); } public static interface IAuthBlockIntf extends IVersionedIntf @@ -531,16 +532,16 @@ public static interface IAuthBlockIntf extends IVersionedIntf public String getPlugin(); public String getSecurityDb(); public String getOriginalPlugin(); - public boolean next(IStatus status) throws FbException; - public boolean first(IStatus status) throws FbException; + public boolean next(IStatus status); + public boolean first(IStatus status); } public static interface IWireCryptPluginIntf extends IPluginBaseIntf { - public String getKnownTypes(IStatus status) throws FbException; - public void setKey(IStatus status, ICryptKey key) throws FbException; - public void encrypt(IStatus status, int length, com.sun.jna.Pointer from, com.sun.jna.Pointer to) throws FbException; - public void decrypt(IStatus status, int length, com.sun.jna.Pointer from, com.sun.jna.Pointer to) throws FbException; + public String getKnownTypes(IStatus status); + public void setKey(IStatus status, ICryptKey key); + public void encrypt(IStatus status, int length, com.sun.jna.Pointer from, com.sun.jna.Pointer to); + public void decrypt(IStatus status, int length, com.sun.jna.Pointer from, com.sun.jna.Pointer to); } public static interface ICryptKeyCallbackIntf extends IVersionedIntf @@ -550,31 +551,31 @@ public static interface ICryptKeyCallbackIntf extends IVersionedIntf public static interface IKeyHolderPluginIntf extends IPluginBaseIntf { - public int keyCallback(IStatus status, ICryptKeyCallback callback) throws FbException; - public ICryptKeyCallback keyHandle(IStatus status, String keyName) throws FbException; - public boolean useOnlyOwnKeys(IStatus status) throws FbException; - public ICryptKeyCallback chainHandle(IStatus status) throws FbException; + public int keyCallback(IStatus status, ICryptKeyCallback callback); + public ICryptKeyCallback keyHandle(IStatus status, String keyName); + public boolean useOnlyOwnKeys(IStatus status); + public ICryptKeyCallback chainHandle(IStatus status); } public static interface IDbCryptInfoIntf extends IReferenceCountedIntf { - public String getDatabaseFullPath(IStatus status) throws FbException; + public String getDatabaseFullPath(IStatus status); } public static interface IDbCryptPluginIntf extends IPluginBaseIntf { - public void setKey(IStatus status, int length, IKeyHolderPlugin[] sources, String keyName) throws FbException; - public void encrypt(IStatus status, int length, com.sun.jna.Pointer from, com.sun.jna.Pointer to) throws FbException; - public void decrypt(IStatus status, int length, com.sun.jna.Pointer from, com.sun.jna.Pointer to) throws FbException; - public void setInfo(IStatus status, IDbCryptInfo info) throws FbException; + public void setKey(IStatus status, int length, IKeyHolderPlugin[] sources, String keyName); + public void encrypt(IStatus status, int length, com.sun.jna.Pointer from, com.sun.jna.Pointer to); + public void decrypt(IStatus status, int length, com.sun.jna.Pointer from, com.sun.jna.Pointer to); + public void setInfo(IStatus status, IDbCryptInfo info); } public static interface IExternalContextIntf extends IVersionedIntf { public IMaster getMaster(); - public IExternalEngine getEngine(IStatus status) throws FbException; - public IAttachment getAttachment(IStatus status) throws FbException; - public ITransaction getTransaction(IStatus status) throws FbException; + public IExternalEngine getEngine(IStatus status); + public IAttachment getAttachment(IStatus status); + public ITransaction getTransaction(IStatus status); public String getUserName(); public String getDatabaseName(); public String getClientCharSet(); @@ -585,19 +586,19 @@ public static interface IExternalContextIntf extends IVersionedIntf public static interface IExternalResultSetIntf extends IDisposableIntf { - public boolean fetch(IStatus status) throws FbException; + public boolean fetch(IStatus status); } public static interface IExternalFunctionIntf extends IDisposableIntf { - public void getCharSet(IStatus status, IExternalContext context, com.sun.jna.Pointer name, int nameSize) throws FbException; - public void execute(IStatus status, IExternalContext context, com.sun.jna.Pointer inMsg, com.sun.jna.Pointer outMsg) throws FbException; + public void getCharSet(IStatus status, IExternalContext context, com.sun.jna.Pointer name, int nameSize); + public void execute(IStatus status, IExternalContext context, com.sun.jna.Pointer inMsg, com.sun.jna.Pointer outMsg); } public static interface IExternalProcedureIntf extends IDisposableIntf { - public void getCharSet(IStatus status, IExternalContext context, com.sun.jna.Pointer name, int nameSize) throws FbException; - public IExternalResultSet open(IStatus status, IExternalContext context, com.sun.jna.Pointer inMsg, com.sun.jna.Pointer outMsg) throws FbException; + public void getCharSet(IStatus status, IExternalContext context, com.sun.jna.Pointer name, int nameSize); + public IExternalResultSet open(IStatus status, IExternalContext context, com.sun.jna.Pointer inMsg, com.sun.jna.Pointer outMsg); } public static interface IExternalTriggerIntf extends IDisposableIntf @@ -615,31 +616,31 @@ public static interface IExternalTriggerIntf extends IDisposableIntf public static int ACTION_TRANS_ROLLBACK = 8; public static int ACTION_DDL = 9; - public void getCharSet(IStatus status, IExternalContext context, com.sun.jna.Pointer name, int nameSize) throws FbException; - public void execute(IStatus status, IExternalContext context, int action, com.sun.jna.Pointer oldMsg, com.sun.jna.Pointer newMsg, com.sun.jna.Pointer oldDbKey, com.sun.jna.Pointer newDbKey) throws FbException; + public void getCharSet(IStatus status, IExternalContext context, com.sun.jna.Pointer name, int nameSize); + public void execute(IStatus status, IExternalContext context, int action, com.sun.jna.Pointer oldMsg, com.sun.jna.Pointer newMsg, com.sun.jna.Pointer oldDbKey, com.sun.jna.Pointer newDbKey); } public static interface IRoutineMetadataIntf extends IVersionedIntf { - public String getPackage(IStatus status) throws FbException; - public String getName(IStatus status) throws FbException; - public String getEntryPoint(IStatus status) throws FbException; - public String getBody(IStatus status) throws FbException; - public IMessageMetadata getInputMetadata(IStatus status) throws FbException; - public IMessageMetadata getOutputMetadata(IStatus status) throws FbException; - public IMessageMetadata getTriggerMetadata(IStatus status) throws FbException; - public String getTriggerTable(IStatus status) throws FbException; - public int getTriggerType(IStatus status) throws FbException; + public String getPackage(IStatus status); + public String getName(IStatus status); + public String getEntryPoint(IStatus status); + public String getBody(IStatus status); + public IMessageMetadata getInputMetadata(IStatus status); + public IMessageMetadata getOutputMetadata(IStatus status); + public IMessageMetadata getTriggerMetadata(IStatus status); + public String getTriggerTable(IStatus status); + public int getTriggerType(IStatus status); } public static interface IExternalEngineIntf extends IPluginBaseIntf { - public void open(IStatus status, IExternalContext context, com.sun.jna.Pointer charSet, int charSetSize) throws FbException; - public void openAttachment(IStatus status, IExternalContext context) throws FbException; - public void closeAttachment(IStatus status, IExternalContext context) throws FbException; - public IExternalFunction makeFunction(IStatus status, IExternalContext context, IRoutineMetadata metadata, IMetadataBuilder inBuilder, IMetadataBuilder outBuilder) throws FbException; - public IExternalProcedure makeProcedure(IStatus status, IExternalContext context, IRoutineMetadata metadata, IMetadataBuilder inBuilder, IMetadataBuilder outBuilder) throws FbException; - public IExternalTrigger makeTrigger(IStatus status, IExternalContext context, IRoutineMetadata metadata, IMetadataBuilder fieldsBuilder) throws FbException; + public void open(IStatus status, IExternalContext context, com.sun.jna.Pointer charSet, int charSetSize); + public void openAttachment(IStatus status, IExternalContext context); + public void closeAttachment(IStatus status, IExternalContext context); + public IExternalFunction makeFunction(IStatus status, IExternalContext context, IRoutineMetadata metadata, IMetadataBuilder inBuilder, IMetadataBuilder outBuilder); + public IExternalProcedure makeProcedure(IStatus status, IExternalContext context, IRoutineMetadata metadata, IMetadataBuilder inBuilder, IMetadataBuilder outBuilder); + public IExternalTrigger makeTrigger(IStatus status, IExternalContext context, IRoutineMetadata metadata, IMetadataBuilder fieldsBuilder); } public static interface ITimerIntf extends IReferenceCountedIntf @@ -649,40 +650,40 @@ public static interface ITimerIntf extends IReferenceCountedIntf public static interface ITimerControlIntf extends IVersionedIntf { - public void start(IStatus status, ITimer timer, long microSeconds) throws FbException; - public void stop(IStatus status, ITimer timer) throws FbException; + public void start(IStatus status, ITimer timer, long microSeconds); + public void stop(IStatus status, ITimer timer); } public static interface IVersionCallbackIntf extends IVersionedIntf { - public void callback(IStatus status, String text) throws FbException; + public void callback(IStatus status, String text); } public static interface IUtilIntf extends IVersionedIntf { - public void getFbVersion(IStatus status, IAttachment att, IVersionCallback callback) throws FbException; - public void loadBlob(IStatus status, com.sun.jna.ptr.LongByReference blobId, IAttachment att, ITransaction tra, String file, boolean txt) throws FbException; - public void dumpBlob(IStatus status, com.sun.jna.ptr.LongByReference blobId, IAttachment att, ITransaction tra, String file, boolean txt) throws FbException; - public void getPerfCounters(IStatus status, IAttachment att, String countersSet, long[] counters) throws FbException; - public IAttachment executeCreateDatabase(IStatus status, int stmtLength, String creatDBstatement, int dialect, boolean[] stmtIsCreateDb) throws FbException; + public void getFbVersion(IStatus status, IAttachment att, IVersionCallback callback); + public void loadBlob(IStatus status, com.sun.jna.ptr.LongByReference blobId, IAttachment att, ITransaction tra, String file, boolean txt); + public void dumpBlob(IStatus status, com.sun.jna.ptr.LongByReference blobId, IAttachment att, ITransaction tra, String file, boolean txt); + public void getPerfCounters(IStatus status, IAttachment att, String countersSet, long[] counters); + public IAttachment executeCreateDatabase(IStatus status, int stmtLength, String creatDBstatement, int dialect, boolean[] stmtIsCreateDb); public void decodeDate(ISC_DATE date, com.sun.jna.Pointer year, com.sun.jna.Pointer month, com.sun.jna.Pointer day); public void decodeTime(ISC_TIME time, com.sun.jna.Pointer hours, com.sun.jna.Pointer minutes, com.sun.jna.Pointer seconds, com.sun.jna.Pointer fractions); public ISC_DATE encodeDate(int year, int month, int day); public ISC_TIME encodeTime(int hours, int minutes, int seconds, int fractions); public int formatStatus(com.sun.jna.Pointer buffer, int bufferSize, IStatus status); public int getClientVersion(); - public IXpbBuilder getXpbBuilder(IStatus status, int kind, byte[] buf, int len) throws FbException; - public int setOffsets(IStatus status, IMessageMetadata metadata, IOffsetsCallback callback) throws FbException; - public IEventBlock createEventBlock(IStatus status, String[] events) throws FbException; - public IDecFloat16 getDecFloat16(IStatus status) throws FbException; - public IDecFloat34 getDecFloat34(IStatus status) throws FbException; - public ITransaction getTransactionByHandle(IStatus status, com.sun.jna.ptr.LongByReference hndlPtr) throws FbException; - public IStatement getStatementByHandle(IStatus status, com.sun.jna.ptr.LongByReference hndlPtr) throws FbException; + public IXpbBuilder getXpbBuilder(IStatus status, int kind, byte[] buf, int len); + public int setOffsets(IStatus status, IMessageMetadata metadata, IOffsetsCallback callback); + public IEventBlock createEventBlock(IStatus status, String[] events); + public IDecFloat16 getDecFloat16(IStatus status); + public IDecFloat34 getDecFloat34(IStatus status); + public ITransaction getTransactionByHandle(IStatus status, com.sun.jna.ptr.LongByReference hndlPtr); + public IStatement getStatementByHandle(IStatus status, com.sun.jna.ptr.LongByReference hndlPtr); } public static interface IOffsetsCallbackIntf extends IVersionedIntf { - public void setOffset(IStatus status, int index, int offset, int nullOffset) throws FbException; + public void setOffset(IStatus status, int index, int offset, int nullOffset); } public static interface IXpbBuilderIntf extends IDisposableIntf @@ -694,26 +695,26 @@ public static interface IXpbBuilderIntf extends IDisposableIntf public static int BATCH = 5; public static int BPB = 6; - public void clear(IStatus status) throws FbException; - public void removeCurrent(IStatus status) throws FbException; - public void insertInt(IStatus status, byte tag, int value) throws FbException; - public void insertBigInt(IStatus status, byte tag, long value) throws FbException; - public void insertBytes(IStatus status, byte tag, com.sun.jna.Pointer bytes, int length) throws FbException; - public void insertString(IStatus status, byte tag, String str) throws FbException; - public void insertTag(IStatus status, byte tag) throws FbException; - public boolean isEof(IStatus status) throws FbException; - public void moveNext(IStatus status) throws FbException; - public void rewind(IStatus status) throws FbException; - public boolean findFirst(IStatus status, byte tag) throws FbException; - public boolean findNext(IStatus status) throws FbException; - public byte getTag(IStatus status) throws FbException; - public int getLength(IStatus status) throws FbException; - public int getInt(IStatus status) throws FbException; - public long getBigInt(IStatus status) throws FbException; - public String getString(IStatus status) throws FbException; - public com.sun.jna.Pointer getBytes(IStatus status) throws FbException; - public int getBufferLength(IStatus status) throws FbException; - public com.sun.jna.Pointer getBuffer(IStatus status) throws FbException; + public void clear(IStatus status); + public void removeCurrent(IStatus status); + public void insertInt(IStatus status, byte tag, int value); + public void insertBigInt(IStatus status, byte tag, long value); + public void insertBytes(IStatus status, byte tag, com.sun.jna.Pointer bytes, int length); + public void insertString(IStatus status, byte tag, String str); + public void insertTag(IStatus status, byte tag); + public boolean isEof(IStatus status); + public void moveNext(IStatus status); + public void rewind(IStatus status); + public boolean findFirst(IStatus status, byte tag); + public boolean findNext(IStatus status); + public byte getTag(IStatus status); + public int getLength(IStatus status); + public int getInt(IStatus status); + public long getBigInt(IStatus status); + public String getString(IStatus status); + public com.sun.jna.Pointer getBytes(IStatus status); + public int getBufferLength(IStatus status); + public com.sun.jna.Pointer getBuffer(IStatus status); } public static interface ITraceConnectionIntf extends IVersionedIntf @@ -758,7 +759,7 @@ public static interface ITraceParamsIntf extends IVersionedIntf { public int getCount(); public com.sun.jna.Pointer getParam(int idx); - public String getTextUTF8(IStatus status, int idx) throws FbException; + public String getTextUTF8(IStatus status, int idx); } public static interface ITraceStatementIntf extends IVersionedIntf @@ -927,33 +928,33 @@ public static interface ITraceFactoryIntf extends IPluginBaseIntf public static int TRACE_EVENT_MAX = 21; public long trace_needs(); - public ITracePlugin trace_create(IStatus status, ITraceInitInfo init_info) throws FbException; + public ITracePlugin trace_create(IStatus status, ITraceInitInfo init_info); } public static interface IUdrFunctionFactoryIntf extends IDisposableIntf { - public void setup(IStatus status, IExternalContext context, IRoutineMetadata metadata, IMetadataBuilder inBuilder, IMetadataBuilder outBuilder) throws FbException; - public IExternalFunction newItem(IStatus status, IExternalContext context, IRoutineMetadata metadata) throws FbException; + public void setup(IStatus status, IExternalContext context, IRoutineMetadata metadata, IMetadataBuilder inBuilder, IMetadataBuilder outBuilder); + public IExternalFunction newItem(IStatus status, IExternalContext context, IRoutineMetadata metadata); } public static interface IUdrProcedureFactoryIntf extends IDisposableIntf { - public void setup(IStatus status, IExternalContext context, IRoutineMetadata metadata, IMetadataBuilder inBuilder, IMetadataBuilder outBuilder) throws FbException; - public IExternalProcedure newItem(IStatus status, IExternalContext context, IRoutineMetadata metadata) throws FbException; + public void setup(IStatus status, IExternalContext context, IRoutineMetadata metadata, IMetadataBuilder inBuilder, IMetadataBuilder outBuilder); + public IExternalProcedure newItem(IStatus status, IExternalContext context, IRoutineMetadata metadata); } public static interface IUdrTriggerFactoryIntf extends IDisposableIntf { - public void setup(IStatus status, IExternalContext context, IRoutineMetadata metadata, IMetadataBuilder fieldsBuilder) throws FbException; - public IExternalTrigger newItem(IStatus status, IExternalContext context, IRoutineMetadata metadata) throws FbException; + public void setup(IStatus status, IExternalContext context, IRoutineMetadata metadata, IMetadataBuilder fieldsBuilder); + public IExternalTrigger newItem(IStatus status, IExternalContext context, IRoutineMetadata metadata); } public static interface IUdrPluginIntf extends IVersionedIntf { public IMaster getMaster(); - public void registerFunction(IStatus status, String name, IUdrFunctionFactory factory) throws FbException; - public void registerProcedure(IStatus status, String name, IUdrProcedureFactory factory) throws FbException; - public void registerTrigger(IStatus status, String name, IUdrTriggerFactory factory) throws FbException; + public void registerFunction(IStatus status, String name, IUdrFunctionFactory factory); + public void registerProcedure(IStatus status, String name, IUdrProcedureFactory factory); + public void registerTrigger(IStatus status, String name, IUdrTriggerFactory factory); } public static interface IDecFloat16Intf extends IVersionedIntf @@ -962,9 +963,9 @@ public static interface IDecFloat16Intf extends IVersionedIntf public static int STRING_SIZE = 24; public void toBcd(FB_DEC16[] from, com.sun.jna.Pointer sign, byte[] bcd, com.sun.jna.Pointer exp); - public void toString(IStatus status, FB_DEC16[] from, int bufferLength, com.sun.jna.Pointer buffer) throws FbException; + public void toString(IStatus status, FB_DEC16[] from, int bufferLength, com.sun.jna.Pointer buffer); public void fromBcd(int sign, byte[] bcd, int exp, FB_DEC16[] to); - public void fromString(IStatus status, String from, FB_DEC16[] to) throws FbException; + public void fromString(IStatus status, String from, FB_DEC16[] to); } public static interface IDecFloat34Intf extends IVersionedIntf @@ -973,9 +974,9 @@ public static interface IDecFloat34Intf extends IVersionedIntf public static int STRING_SIZE = 43; public void toBcd(FB_DEC34[] from, com.sun.jna.Pointer sign, byte[] bcd, com.sun.jna.Pointer exp); - public void toString(IStatus status, FB_DEC34[] from, int bufferLength, com.sun.jna.Pointer buffer) throws FbException; + public void toString(IStatus status, FB_DEC34[] from, int bufferLength, com.sun.jna.Pointer buffer); public void fromBcd(int sign, byte[] bcd, int exp, FB_DEC34[] to); - public void fromString(IStatus status, String from, FB_DEC34[] to) throws FbException; + public void fromString(IStatus status, String from, FB_DEC34[] to); } public static interface ICryptoKeyIntf extends IVersionedIntf @@ -1122,6 +1123,37 @@ public static interface ICryptoFactoryIntf extends IPluginBaseIntf public int getCryptoObjects(int type, IListCryptoObjects callback); } + public static interface ILdapPluginIntf extends IReferenceCountedIntf + { + public static int SYNC_RESULT_SUCCESS = 0; + public static int SYNC_RESULT_NO_USER = 1; + public static int SYNC_RESULT_ERROR = 2; + public static int CERT_TEXT = 0; + public static int CERT_BINARY = 1; + public static int CERT_ERROR = 2; + + public void connect(); + public boolean is_connected(); + public boolean bind(); + public boolean bind_as(String user, String password); + public boolean find_user(String name, com.sun.jna.Pointer password, com.sun.jna.Pointer mf_password, com.sun.jna.Pointer hash_alg); + public boolean find_srp_user(String name, com.sun.jna.Pointer verifier, com.sun.jna.Pointer salt); + public int get_certificate(String name, com.sun.jna.Pointer buffer, com.sun.jna.Pointer buffer_length, String attr_name); + public boolean get_user_attr(String name, String attr, com.sun.jna.Pointer value); + public boolean get_policy(String name, com.sun.jna.Pointer policy, ISC_TIMESTAMP[] passwd_time, com.sun.jna.Pointer failed_count, ISC_TIMESTAMP[] access_time); + public boolean set_policy(String name, String policy, ISC_TIMESTAMP[] passwd_time, com.sun.jna.Pointer failed_count, ISC_TIMESTAMP[] access_time); + public boolean get_password_history(String name, com.sun.jna.Pointer buffer, com.sun.jna.Pointer buffer_length); + public void find_user_groups(com.sun.jna.Pointer userId); + public int change_legacy_password(String name, String password, boolean[] active); + public int change_mf_password(String name, String password, com.sun.jna.Pointer hash, boolean[] active); + public int change_srp_password(String name, String password, com.sun.jna.Pointer verifier, com.sun.jna.Pointer salt, boolean[] active); + } + + public static interface ILdapFactoryIntf extends IPluginBaseIntf + { + public ILdapPlugin getLdapPlugin(IStatus status); + } + public static class IVersioned extends com.sun.jna.Structure implements IVersionedIntf { public static class VTable extends com.sun.jna.Structure implements com.sun.jna.Structure.ByReference @@ -1724,7 +1756,7 @@ public IMetadataBuilder invoke(IMaster self, IStatus status, int fieldCount) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -1856,11 +1888,10 @@ public ITransaction registerTransaction(IAttachment attachment, ITransaction tra return result; } - public IMetadataBuilder getMetadataBuilder(IStatus status, int fieldCount) throws FbException + public IMetadataBuilder getMetadataBuilder(IStatus status, int fieldCount) { VTable vTable = getVTable(); IMetadataBuilder result = vTable.getMetadataBuilder.invoke(this, status, fieldCount); - FbException.checkException(status); return result; } @@ -2045,7 +2076,7 @@ public IPluginBase invoke(IPluginSet self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -2061,7 +2092,7 @@ public void invoke(IPluginSet self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -2076,7 +2107,7 @@ public void invoke(IPluginSet self, IStatus status, String s) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -2133,26 +2164,23 @@ public String getModuleName() return result; } - public IPluginBase getPlugin(IStatus status) throws FbException + public IPluginBase getPlugin(IStatus status) { VTable vTable = getVTable(); IPluginBase result = vTable.getPlugin.invoke(this, status); - FbException.checkException(status); return result; } - public void next(IStatus status) throws FbException + public void next(IStatus status) { VTable vTable = getVTable(); vTable.next.invoke(this, status); - FbException.checkException(status); } - public void set(IStatus status, String s) throws FbException + public void set(IStatus status, String s) { VTable vTable = getVTable(); vTable.set.invoke(this, status, s); - FbException.checkException(status); } } @@ -2236,7 +2264,7 @@ public IConfig invoke(IConfigEntry self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -2308,11 +2336,10 @@ public boolean getBoolValue() return result; } - public IConfig getSubConfig(IStatus status) throws FbException + public IConfig getSubConfig(IStatus status) { VTable vTable = getVTable(); IConfig result = vTable.getSubConfig.invoke(this, status); - FbException.checkException(status); return result; } } @@ -2355,7 +2382,7 @@ public IConfigEntry invoke(IConfig self, IStatus status, String name) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -2371,7 +2398,7 @@ public IConfigEntry invoke(IConfig self, IStatus status, String name, String val } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -2387,7 +2414,7 @@ public IConfigEntry invoke(IConfig self, IStatus status, String name, int pos) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -2429,27 +2456,24 @@ protected VTable createVTable() return new VTable(cloopVTable); } - public IConfigEntry find(IStatus status, String name) throws FbException + public IConfigEntry find(IStatus status, String name) { VTable vTable = getVTable(); IConfigEntry result = vTable.find.invoke(this, status, name); - FbException.checkException(status); return result; } - public IConfigEntry findValue(IStatus status, String name, String value) throws FbException + public IConfigEntry findValue(IStatus status, String name, String value) { VTable vTable = getVTable(); IConfigEntry result = vTable.findValue.invoke(this, status, name, value); - FbException.checkException(status); return result; } - public IConfigEntry findPos(IStatus status, String name, int pos) throws FbException + public IConfigEntry findPos(IStatus status, String name, int pos) { VTable vTable = getVTable(); IConfigEntry result = vTable.findPos.invoke(this, status, name, pos); - FbException.checkException(status); return result; } } @@ -2636,7 +2660,7 @@ public IConfig invoke(IPluginConfig self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -2652,7 +2676,7 @@ public IFirebirdConf invoke(IPluginConfig self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -2668,7 +2692,7 @@ public void invoke(IPluginConfig self, IStatus status, long microSeconds) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -2717,27 +2741,24 @@ public String getConfigFileName() return result; } - public IConfig getDefaultConfig(IStatus status) throws FbException + public IConfig getDefaultConfig(IStatus status) { VTable vTable = getVTable(); IConfig result = vTable.getDefaultConfig.invoke(this, status); - FbException.checkException(status); return result; } - public IFirebirdConf getFirebirdConf(IStatus status) throws FbException + public IFirebirdConf getFirebirdConf(IStatus status) { VTable vTable = getVTable(); IFirebirdConf result = vTable.getFirebirdConf.invoke(this, status); - FbException.checkException(status); return result; } - public void setReleaseDelay(IStatus status, long microSeconds) throws FbException + public void setReleaseDelay(IStatus status, long microSeconds) { VTable vTable = getVTable(); vTable.setReleaseDelay.invoke(this, status, microSeconds); - FbException.checkException(status); } } @@ -2769,7 +2790,7 @@ public IPluginBase invoke(IPluginFactory self, IStatus status, IPluginConfig fac } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -2809,11 +2830,10 @@ protected VTable createVTable() return new VTable(cloopVTable); } - public IPluginBase createPlugin(IStatus status, IPluginConfig factoryParameter) throws FbException + public IPluginBase createPlugin(IStatus status, IPluginConfig factoryParameter) { VTable vTable = getVTable(); IPluginBase result = vTable.createPlugin.invoke(this, status, factoryParameter); - FbException.checkException(status); return result; } } @@ -2982,7 +3002,7 @@ public IPluginSet invoke(IPluginManager self, IStatus status, int pluginType, St } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -2998,7 +3018,7 @@ public IConfig invoke(IPluginManager self, IStatus status, String filename) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -3069,19 +3089,17 @@ public void unregisterModule(IPluginModule cleanup) vTable.unregisterModule.invoke(this, cleanup); } - public IPluginSet getPlugins(IStatus status, int pluginType, String namesList, IFirebirdConf firebirdConf) throws FbException + public IPluginSet getPlugins(IStatus status, int pluginType, String namesList, IFirebirdConf firebirdConf) { VTable vTable = getVTable(); IPluginSet result = vTable.getPlugins.invoke(this, status, pluginType, namesList, firebirdConf); - FbException.checkException(status); return result; } - public IConfig getConfig(IStatus status, String filename) throws FbException + public IConfig getConfig(IStatus status, String filename) { VTable vTable = getVTable(); IConfig result = vTable.getConfig.invoke(this, status, filename); - FbException.checkException(status); return result; } @@ -3135,7 +3153,7 @@ public void invoke(ICryptKey self, IStatus status, String type, int keyLength, c } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -3150,7 +3168,7 @@ public void invoke(ICryptKey self, IStatus status, String type, int encryptKeyLe } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -3208,18 +3226,16 @@ protected VTable createVTable() return new VTable(cloopVTable); } - public void setSymmetric(IStatus status, String type, int keyLength, com.sun.jna.Pointer key) throws FbException + public void setSymmetric(IStatus status, String type, int keyLength, com.sun.jna.Pointer key) { VTable vTable = getVTable(); vTable.setSymmetric.invoke(this, status, type, keyLength, key); - FbException.checkException(status); } - public void setAsymmetric(IStatus status, String type, int encryptKeyLength, com.sun.jna.Pointer encryptKey, int decryptKeyLength, com.sun.jna.Pointer decryptKey) throws FbException + public void setAsymmetric(IStatus status, String type, int encryptKeyLength, com.sun.jna.Pointer encryptKey, int decryptKeyLength, com.sun.jna.Pointer decryptKey) { VTable vTable = getVTable(); vTable.setAsymmetric.invoke(this, status, type, encryptKeyLength, encryptKey, decryptKeyLength, decryptKey); - FbException.checkException(status); } public com.sun.jna.Pointer getEncryptKey(com.sun.jna.Pointer length) @@ -3530,7 +3546,7 @@ public void invoke(IBlob self, IStatus status, int itemsLength, byte[] items, in } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -3545,7 +3561,7 @@ public int invoke(IBlob self, IStatus status, int bufferLength, com.sun.jna.Poin } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return 0; } } @@ -3561,7 +3577,7 @@ public void invoke(IBlob self, IStatus status, int length, com.sun.jna.Pointer b } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -3576,7 +3592,7 @@ public void invoke(IBlob self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -3591,7 +3607,7 @@ public void invoke(IBlob self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -3606,7 +3622,7 @@ public int invoke(IBlob self, IStatus status, int mode, int offset) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return 0; } } @@ -3651,47 +3667,41 @@ protected VTable createVTable() return new VTable(cloopVTable); } - public void getInfo(IStatus status, int itemsLength, byte[] items, int bufferLength, byte[] buffer) throws FbException + public void getInfo(IStatus status, int itemsLength, byte[] items, int bufferLength, byte[] buffer) { VTable vTable = getVTable(); vTable.getInfo.invoke(this, status, itemsLength, items, bufferLength, buffer); - FbException.checkException(status); } - public int getSegment(IStatus status, int bufferLength, com.sun.jna.Pointer buffer, com.sun.jna.Pointer segmentLength) throws FbException + public int getSegment(IStatus status, int bufferLength, com.sun.jna.Pointer buffer, com.sun.jna.Pointer segmentLength) { VTable vTable = getVTable(); int result = vTable.getSegment.invoke(this, status, bufferLength, buffer, segmentLength); - FbException.checkException(status); return result; } - public void putSegment(IStatus status, int length, com.sun.jna.Pointer buffer) throws FbException + public void putSegment(IStatus status, int length, com.sun.jna.Pointer buffer) { VTable vTable = getVTable(); vTable.putSegment.invoke(this, status, length, buffer); - FbException.checkException(status); } - public void cancel(IStatus status) throws FbException + public void cancel(IStatus status) { VTable vTable = getVTable(); vTable.cancel.invoke(this, status); - FbException.checkException(status); } - public void close(IStatus status) throws FbException + public void close(IStatus status) { VTable vTable = getVTable(); vTable.close.invoke(this, status); - FbException.checkException(status); } - public int seek(IStatus status, int mode, int offset) throws FbException + public int seek(IStatus status, int mode, int offset) { VTable vTable = getVTable(); int result = vTable.seek.invoke(this, status, mode, offset); - FbException.checkException(status); return result; } } @@ -3769,7 +3779,7 @@ public void invoke(ITransaction self, IStatus status, int itemsLength, byte[] it } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -3784,7 +3794,7 @@ public void invoke(ITransaction self, IStatus status, int msgLength, byte[] mess } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -3799,7 +3809,7 @@ public void invoke(ITransaction self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -3814,7 +3824,7 @@ public void invoke(ITransaction self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -3829,7 +3839,7 @@ public void invoke(ITransaction self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -3844,7 +3854,7 @@ public void invoke(ITransaction self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -3859,7 +3869,7 @@ public void invoke(ITransaction self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -3874,7 +3884,7 @@ public ITransaction invoke(ITransaction self, IStatus status, ITransaction trans } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -3890,7 +3900,7 @@ public ITransaction invoke(ITransaction self, IStatus status, IAttachment attach } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -3906,7 +3916,7 @@ public ITransaction invoke(ITransaction self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -3955,76 +3965,66 @@ protected VTable createVTable() return new VTable(cloopVTable); } - public void getInfo(IStatus status, int itemsLength, byte[] items, int bufferLength, byte[] buffer) throws FbException + public void getInfo(IStatus status, int itemsLength, byte[] items, int bufferLength, byte[] buffer) { VTable vTable = getVTable(); vTable.getInfo.invoke(this, status, itemsLength, items, bufferLength, buffer); - FbException.checkException(status); } - public void prepare(IStatus status, int msgLength, byte[] message) throws FbException + public void prepare(IStatus status, int msgLength, byte[] message) { VTable vTable = getVTable(); vTable.prepare.invoke(this, status, msgLength, message); - FbException.checkException(status); } - public void commit(IStatus status) throws FbException + public void commit(IStatus status) { VTable vTable = getVTable(); vTable.commit.invoke(this, status); - FbException.checkException(status); } - public void commitRetaining(IStatus status) throws FbException + public void commitRetaining(IStatus status) { VTable vTable = getVTable(); vTable.commitRetaining.invoke(this, status); - FbException.checkException(status); } - public void rollback(IStatus status) throws FbException + public void rollback(IStatus status) { VTable vTable = getVTable(); vTable.rollback.invoke(this, status); - FbException.checkException(status); } - public void rollbackRetaining(IStatus status) throws FbException + public void rollbackRetaining(IStatus status) { VTable vTable = getVTable(); vTable.rollbackRetaining.invoke(this, status); - FbException.checkException(status); } - public void disconnect(IStatus status) throws FbException + public void disconnect(IStatus status) { VTable vTable = getVTable(); vTable.disconnect.invoke(this, status); - FbException.checkException(status); } - public ITransaction join(IStatus status, ITransaction transaction) throws FbException + public ITransaction join(IStatus status, ITransaction transaction) { VTable vTable = getVTable(); ITransaction result = vTable.join.invoke(this, status, transaction); - FbException.checkException(status); return result; } - public ITransaction validate(IStatus status, IAttachment attachment) throws FbException + public ITransaction validate(IStatus status, IAttachment attachment) { VTable vTable = getVTable(); ITransaction result = vTable.validate.invoke(this, status, attachment); - FbException.checkException(status); return result; } - public ITransaction enterDtc(IStatus status) throws FbException + public ITransaction enterDtc(IStatus status) { VTable vTable = getVTable(); ITransaction result = vTable.enterDtc.invoke(this, status); - FbException.checkException(status); return result; } } @@ -4137,7 +4137,7 @@ public int invoke(IMessageMetadata self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return 0; } } @@ -4153,7 +4153,7 @@ public String invoke(IMessageMetadata self, IStatus status, int index) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -4169,7 +4169,7 @@ public String invoke(IMessageMetadata self, IStatus status, int index) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -4185,7 +4185,7 @@ public String invoke(IMessageMetadata self, IStatus status, int index) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -4201,7 +4201,7 @@ public String invoke(IMessageMetadata self, IStatus status, int index) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -4217,7 +4217,7 @@ public int invoke(IMessageMetadata self, IStatus status, int index) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return 0; } } @@ -4233,7 +4233,7 @@ public boolean invoke(IMessageMetadata self, IStatus status, int index) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return false; } } @@ -4249,7 +4249,7 @@ public int invoke(IMessageMetadata self, IStatus status, int index) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return 0; } } @@ -4265,7 +4265,7 @@ public int invoke(IMessageMetadata self, IStatus status, int index) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return 0; } } @@ -4281,7 +4281,7 @@ public int invoke(IMessageMetadata self, IStatus status, int index) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return 0; } } @@ -4297,7 +4297,7 @@ public int invoke(IMessageMetadata self, IStatus status, int index) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return 0; } } @@ -4313,7 +4313,7 @@ public int invoke(IMessageMetadata self, IStatus status, int index) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return 0; } } @@ -4329,7 +4329,7 @@ public int invoke(IMessageMetadata self, IStatus status, int index) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return 0; } } @@ -4345,7 +4345,7 @@ public IMetadataBuilder invoke(IMessageMetadata self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -4361,7 +4361,7 @@ public int invoke(IMessageMetadata self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return 0; } } @@ -4377,7 +4377,7 @@ public int invoke(IMessageMetadata self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return 0; } } @@ -4393,7 +4393,7 @@ public int invoke(IMessageMetadata self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return 0; } } @@ -4449,139 +4449,122 @@ protected VTable createVTable() return new VTable(cloopVTable); } - public int getCount(IStatus status) throws FbException + public int getCount(IStatus status) { VTable vTable = getVTable(); int result = vTable.getCount.invoke(this, status); - FbException.checkException(status); return result; } - public String getField(IStatus status, int index) throws FbException + public String getField(IStatus status, int index) { VTable vTable = getVTable(); String result = vTable.getField.invoke(this, status, index); - FbException.checkException(status); return result; } - public String getRelation(IStatus status, int index) throws FbException + public String getRelation(IStatus status, int index) { VTable vTable = getVTable(); String result = vTable.getRelation.invoke(this, status, index); - FbException.checkException(status); return result; } - public String getOwner(IStatus status, int index) throws FbException + public String getOwner(IStatus status, int index) { VTable vTable = getVTable(); String result = vTable.getOwner.invoke(this, status, index); - FbException.checkException(status); return result; } - public String getAlias(IStatus status, int index) throws FbException + public String getAlias(IStatus status, int index) { VTable vTable = getVTable(); String result = vTable.getAlias.invoke(this, status, index); - FbException.checkException(status); return result; } - public int getType(IStatus status, int index) throws FbException + public int getType(IStatus status, int index) { VTable vTable = getVTable(); int result = vTable.getType.invoke(this, status, index); - FbException.checkException(status); return result; } - public boolean isNullable(IStatus status, int index) throws FbException + public boolean isNullable(IStatus status, int index) { VTable vTable = getVTable(); boolean result = vTable.isNullable.invoke(this, status, index); - FbException.checkException(status); return result; } - public int getSubType(IStatus status, int index) throws FbException + public int getSubType(IStatus status, int index) { VTable vTable = getVTable(); int result = vTable.getSubType.invoke(this, status, index); - FbException.checkException(status); return result; } - public int getLength(IStatus status, int index) throws FbException + public int getLength(IStatus status, int index) { VTable vTable = getVTable(); int result = vTable.getLength.invoke(this, status, index); - FbException.checkException(status); return result; } - public int getScale(IStatus status, int index) throws FbException + public int getScale(IStatus status, int index) { VTable vTable = getVTable(); int result = vTable.getScale.invoke(this, status, index); - FbException.checkException(status); return result; } - public int getCharSet(IStatus status, int index) throws FbException + public int getCharSet(IStatus status, int index) { VTable vTable = getVTable(); int result = vTable.getCharSet.invoke(this, status, index); - FbException.checkException(status); return result; } - public int getOffset(IStatus status, int index) throws FbException + public int getOffset(IStatus status, int index) { VTable vTable = getVTable(); int result = vTable.getOffset.invoke(this, status, index); - FbException.checkException(status); return result; } - public int getNullOffset(IStatus status, int index) throws FbException + public int getNullOffset(IStatus status, int index) { VTable vTable = getVTable(); int result = vTable.getNullOffset.invoke(this, status, index); - FbException.checkException(status); return result; } - public IMetadataBuilder getBuilder(IStatus status) throws FbException + public IMetadataBuilder getBuilder(IStatus status) { VTable vTable = getVTable(); IMetadataBuilder result = vTable.getBuilder.invoke(this, status); - FbException.checkException(status); return result; } - public int getMessageLength(IStatus status) throws FbException + public int getMessageLength(IStatus status) { VTable vTable = getVTable(); int result = vTable.getMessageLength.invoke(this, status); - FbException.checkException(status); return result; } - public int getAlignment(IStatus status) throws FbException + public int getAlignment(IStatus status) { VTable vTable = getVTable(); int result = vTable.getAlignment.invoke(this, status); - FbException.checkException(status); return result; } - public int getAlignedLength(IStatus status) throws FbException + public int getAlignedLength(IStatus status) { VTable vTable = getVTable(); int result = vTable.getAlignedLength.invoke(this, status); - FbException.checkException(status); return result; } } @@ -4659,7 +4642,7 @@ public void invoke(IMetadataBuilder self, IStatus status, int index, int type) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -4674,7 +4657,7 @@ public void invoke(IMetadataBuilder self, IStatus status, int index, int subType } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -4689,7 +4672,7 @@ public void invoke(IMetadataBuilder self, IStatus status, int index, int length) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -4704,7 +4687,7 @@ public void invoke(IMetadataBuilder self, IStatus status, int index, int charSet } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -4719,7 +4702,7 @@ public void invoke(IMetadataBuilder self, IStatus status, int index, int scale) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -4734,7 +4717,7 @@ public void invoke(IMetadataBuilder self, IStatus status, int count) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -4749,7 +4732,7 @@ public void invoke(IMetadataBuilder self, IStatus status, String name, int index } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -4764,7 +4747,7 @@ public void invoke(IMetadataBuilder self, IStatus status, int index) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -4779,7 +4762,7 @@ public int invoke(IMetadataBuilder self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return 0; } } @@ -4795,7 +4778,7 @@ public IMessageMetadata invoke(IMetadataBuilder self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -4844,75 +4827,65 @@ protected VTable createVTable() return new VTable(cloopVTable); } - public void setType(IStatus status, int index, int type) throws FbException + public void setType(IStatus status, int index, int type) { VTable vTable = getVTable(); vTable.setType.invoke(this, status, index, type); - FbException.checkException(status); } - public void setSubType(IStatus status, int index, int subType) throws FbException + public void setSubType(IStatus status, int index, int subType) { VTable vTable = getVTable(); vTable.setSubType.invoke(this, status, index, subType); - FbException.checkException(status); } - public void setLength(IStatus status, int index, int length) throws FbException + public void setLength(IStatus status, int index, int length) { VTable vTable = getVTable(); vTable.setLength.invoke(this, status, index, length); - FbException.checkException(status); } - public void setCharSet(IStatus status, int index, int charSet) throws FbException + public void setCharSet(IStatus status, int index, int charSet) { VTable vTable = getVTable(); vTable.setCharSet.invoke(this, status, index, charSet); - FbException.checkException(status); } - public void setScale(IStatus status, int index, int scale) throws FbException + public void setScale(IStatus status, int index, int scale) { VTable vTable = getVTable(); vTable.setScale.invoke(this, status, index, scale); - FbException.checkException(status); } - public void truncate(IStatus status, int count) throws FbException + public void truncate(IStatus status, int count) { VTable vTable = getVTable(); vTable.truncate.invoke(this, status, count); - FbException.checkException(status); } - public void moveNameToIndex(IStatus status, String name, int index) throws FbException + public void moveNameToIndex(IStatus status, String name, int index) { VTable vTable = getVTable(); vTable.moveNameToIndex.invoke(this, status, name, index); - FbException.checkException(status); } - public void remove(IStatus status, int index) throws FbException + public void remove(IStatus status, int index) { VTable vTable = getVTable(); vTable.remove.invoke(this, status, index); - FbException.checkException(status); } - public int addField(IStatus status) throws FbException + public int addField(IStatus status) { VTable vTable = getVTable(); int result = vTable.addField.invoke(this, status); - FbException.checkException(status); return result; } - public IMessageMetadata getMetadata(IStatus status) throws FbException + public IMessageMetadata getMetadata(IStatus status) { VTable vTable = getVTable(); IMessageMetadata result = vTable.getMetadata.invoke(this, status); - FbException.checkException(status); return result; } } @@ -4995,7 +4968,7 @@ public int invoke(IResultSet self, IStatus status, com.sun.jna.Pointer message) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return 0; } } @@ -5011,7 +4984,7 @@ public int invoke(IResultSet self, IStatus status, com.sun.jna.Pointer message) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return 0; } } @@ -5027,7 +5000,7 @@ public int invoke(IResultSet self, IStatus status, com.sun.jna.Pointer message) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return 0; } } @@ -5043,7 +5016,7 @@ public int invoke(IResultSet self, IStatus status, com.sun.jna.Pointer message) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return 0; } } @@ -5059,7 +5032,7 @@ public int invoke(IResultSet self, IStatus status, int position, com.sun.jna.Poi } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return 0; } } @@ -5075,7 +5048,7 @@ public int invoke(IResultSet self, IStatus status, int offset, com.sun.jna.Point } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return 0; } } @@ -5091,7 +5064,7 @@ public boolean invoke(IResultSet self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return false; } } @@ -5107,7 +5080,7 @@ public boolean invoke(IResultSet self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return false; } } @@ -5123,7 +5096,7 @@ public IMessageMetadata invoke(IResultSet self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -5139,7 +5112,7 @@ public void invoke(IResultSet self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -5154,7 +5127,7 @@ public void invoke(IResultSet self, IStatus status, IMessageMetadata format) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -5203,90 +5176,79 @@ protected VTable createVTable() return new VTable(cloopVTable); } - public int fetchNext(IStatus status, com.sun.jna.Pointer message) throws FbException + public int fetchNext(IStatus status, com.sun.jna.Pointer message) { VTable vTable = getVTable(); int result = vTable.fetchNext.invoke(this, status, message); - FbException.checkException(status); return result; } - public int fetchPrior(IStatus status, com.sun.jna.Pointer message) throws FbException + public int fetchPrior(IStatus status, com.sun.jna.Pointer message) { VTable vTable = getVTable(); int result = vTable.fetchPrior.invoke(this, status, message); - FbException.checkException(status); return result; } - public int fetchFirst(IStatus status, com.sun.jna.Pointer message) throws FbException + public int fetchFirst(IStatus status, com.sun.jna.Pointer message) { VTable vTable = getVTable(); int result = vTable.fetchFirst.invoke(this, status, message); - FbException.checkException(status); return result; } - public int fetchLast(IStatus status, com.sun.jna.Pointer message) throws FbException + public int fetchLast(IStatus status, com.sun.jna.Pointer message) { VTable vTable = getVTable(); int result = vTable.fetchLast.invoke(this, status, message); - FbException.checkException(status); return result; } - public int fetchAbsolute(IStatus status, int position, com.sun.jna.Pointer message) throws FbException + public int fetchAbsolute(IStatus status, int position, com.sun.jna.Pointer message) { VTable vTable = getVTable(); int result = vTable.fetchAbsolute.invoke(this, status, position, message); - FbException.checkException(status); return result; } - public int fetchRelative(IStatus status, int offset, com.sun.jna.Pointer message) throws FbException + public int fetchRelative(IStatus status, int offset, com.sun.jna.Pointer message) { VTable vTable = getVTable(); int result = vTable.fetchRelative.invoke(this, status, offset, message); - FbException.checkException(status); return result; } - public boolean isEof(IStatus status) throws FbException + public boolean isEof(IStatus status) { VTable vTable = getVTable(); boolean result = vTable.isEof.invoke(this, status); - FbException.checkException(status); return result; } - public boolean isBof(IStatus status) throws FbException + public boolean isBof(IStatus status) { VTable vTable = getVTable(); boolean result = vTable.isBof.invoke(this, status); - FbException.checkException(status); return result; } - public IMessageMetadata getMetadata(IStatus status) throws FbException + public IMessageMetadata getMetadata(IStatus status) { VTable vTable = getVTable(); IMessageMetadata result = vTable.getMetadata.invoke(this, status); - FbException.checkException(status); return result; } - public void close(IStatus status) throws FbException + public void close(IStatus status) { VTable vTable = getVTable(); vTable.close.invoke(this, status); - FbException.checkException(status); } - public void setDelayedOutputFormat(IStatus status, IMessageMetadata format) throws FbException + public void setDelayedOutputFormat(IStatus status, IMessageMetadata format) { VTable vTable = getVTable(); vTable.setDelayedOutputFormat.invoke(this, status, format); - FbException.checkException(status); } } @@ -5383,7 +5345,7 @@ public void invoke(IStatement self, IStatus status, int itemsLength, byte[] item } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -5398,7 +5360,7 @@ public int invoke(IStatement self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return 0; } } @@ -5414,7 +5376,7 @@ public String invoke(IStatement self, IStatus status, boolean detailed) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -5430,7 +5392,7 @@ public long invoke(IStatement self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return 0; } } @@ -5446,7 +5408,7 @@ public IMessageMetadata invoke(IStatement self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -5462,7 +5424,7 @@ public IMessageMetadata invoke(IStatement self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -5478,7 +5440,7 @@ public ITransaction invoke(IStatement self, IStatus status, ITransaction transac } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -5494,7 +5456,7 @@ public IResultSet invoke(IStatement self, IStatus status, ITransaction transacti } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -5510,7 +5472,7 @@ public void invoke(IStatement self, IStatus status, String name) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -5525,7 +5487,7 @@ public void invoke(IStatement self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -5540,7 +5502,7 @@ public int invoke(IStatement self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return 0; } } @@ -5556,7 +5518,7 @@ public int invoke(IStatement self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return 0; } } @@ -5572,7 +5534,7 @@ public void invoke(IStatement self, IStatus status, int timeOut) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -5587,7 +5549,7 @@ public IBatch invoke(IStatement self, IStatus status, IMessageMetadata inMetadat } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -5640,111 +5602,97 @@ protected VTable createVTable() return new VTable(cloopVTable); } - public void getInfo(IStatus status, int itemsLength, byte[] items, int bufferLength, byte[] buffer) throws FbException + public void getInfo(IStatus status, int itemsLength, byte[] items, int bufferLength, byte[] buffer) { VTable vTable = getVTable(); vTable.getInfo.invoke(this, status, itemsLength, items, bufferLength, buffer); - FbException.checkException(status); } - public int getType(IStatus status) throws FbException + public int getType(IStatus status) { VTable vTable = getVTable(); int result = vTable.getType.invoke(this, status); - FbException.checkException(status); return result; } - public String getPlan(IStatus status, boolean detailed) throws FbException + public String getPlan(IStatus status, boolean detailed) { VTable vTable = getVTable(); String result = vTable.getPlan.invoke(this, status, detailed); - FbException.checkException(status); return result; } - public long getAffectedRecords(IStatus status) throws FbException + public long getAffectedRecords(IStatus status) { VTable vTable = getVTable(); long result = vTable.getAffectedRecords.invoke(this, status); - FbException.checkException(status); return result; } - public IMessageMetadata getInputMetadata(IStatus status) throws FbException + public IMessageMetadata getInputMetadata(IStatus status) { VTable vTable = getVTable(); IMessageMetadata result = vTable.getInputMetadata.invoke(this, status); - FbException.checkException(status); return result; } - public IMessageMetadata getOutputMetadata(IStatus status) throws FbException + public IMessageMetadata getOutputMetadata(IStatus status) { VTable vTable = getVTable(); IMessageMetadata result = vTable.getOutputMetadata.invoke(this, status); - FbException.checkException(status); return result; } - public ITransaction execute(IStatus status, ITransaction transaction, IMessageMetadata inMetadata, com.sun.jna.Pointer inBuffer, IMessageMetadata outMetadata, com.sun.jna.Pointer outBuffer) throws FbException + public ITransaction execute(IStatus status, ITransaction transaction, IMessageMetadata inMetadata, com.sun.jna.Pointer inBuffer, IMessageMetadata outMetadata, com.sun.jna.Pointer outBuffer) { VTable vTable = getVTable(); ITransaction result = vTable.execute.invoke(this, status, transaction, inMetadata, inBuffer, outMetadata, outBuffer); - FbException.checkException(status); return result; } - public IResultSet openCursor(IStatus status, ITransaction transaction, IMessageMetadata inMetadata, com.sun.jna.Pointer inBuffer, IMessageMetadata outMetadata, int flags) throws FbException + public IResultSet openCursor(IStatus status, ITransaction transaction, IMessageMetadata inMetadata, com.sun.jna.Pointer inBuffer, IMessageMetadata outMetadata, int flags) { VTable vTable = getVTable(); IResultSet result = vTable.openCursor.invoke(this, status, transaction, inMetadata, inBuffer, outMetadata, flags); - FbException.checkException(status); return result; } - public void setCursorName(IStatus status, String name) throws FbException + public void setCursorName(IStatus status, String name) { VTable vTable = getVTable(); vTable.setCursorName.invoke(this, status, name); - FbException.checkException(status); } - public void free(IStatus status) throws FbException + public void free(IStatus status) { VTable vTable = getVTable(); vTable.free.invoke(this, status); - FbException.checkException(status); } - public int getFlags(IStatus status) throws FbException + public int getFlags(IStatus status) { VTable vTable = getVTable(); int result = vTable.getFlags.invoke(this, status); - FbException.checkException(status); return result; } - public int getTimeout(IStatus status) throws FbException + public int getTimeout(IStatus status) { VTable vTable = getVTable(); int result = vTable.getTimeout.invoke(this, status); - FbException.checkException(status); return result; } - public void setTimeout(IStatus status, int timeOut) throws FbException + public void setTimeout(IStatus status, int timeOut) { VTable vTable = getVTable(); vTable.setTimeout.invoke(this, status, timeOut); - FbException.checkException(status); } - public IBatch createBatch(IStatus status, IMessageMetadata inMetadata, int parLength, byte[] par) throws FbException + public IBatch createBatch(IStatus status, IMessageMetadata inMetadata, int parLength, byte[] par) { VTable vTable = getVTable(); IBatch result = vTable.createBatch.invoke(this, status, inMetadata, parLength, par); - FbException.checkException(status); return result; } } @@ -5822,7 +5770,7 @@ public void invoke(IBatch self, IStatus status, int count, com.sun.jna.Pointer i } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -5837,7 +5785,7 @@ public void invoke(IBatch self, IStatus status, int length, com.sun.jna.Pointer } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -5852,7 +5800,7 @@ public void invoke(IBatch self, IStatus status, int length, com.sun.jna.Pointer } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -5867,7 +5815,7 @@ public void invoke(IBatch self, IStatus status, int length, com.sun.jna.Pointer } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -5882,7 +5830,7 @@ public void invoke(IBatch self, IStatus status, com.sun.jna.ptr.LongByReference } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -5897,7 +5845,7 @@ public IBatchCompletionState invoke(IBatch self, IStatus status, ITransaction tr } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -5913,7 +5861,7 @@ public void invoke(IBatch self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -5928,7 +5876,7 @@ public int invoke(IBatch self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return 0; } } @@ -5944,7 +5892,7 @@ public IMessageMetadata invoke(IBatch self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -5960,7 +5908,7 @@ public void invoke(IBatch self, IStatus status, int parLength, byte[] par) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -6008,77 +5956,67 @@ protected VTable createVTable() return new VTable(cloopVTable); } - public void add(IStatus status, int count, com.sun.jna.Pointer inBuffer) throws FbException + public void add(IStatus status, int count, com.sun.jna.Pointer inBuffer) { VTable vTable = getVTable(); vTable.add.invoke(this, status, count, inBuffer); - FbException.checkException(status); } - public void addBlob(IStatus status, int length, com.sun.jna.Pointer inBuffer, com.sun.jna.ptr.LongByReference blobId, int parLength, byte[] par) throws FbException + public void addBlob(IStatus status, int length, com.sun.jna.Pointer inBuffer, com.sun.jna.ptr.LongByReference blobId, int parLength, byte[] par) { VTable vTable = getVTable(); vTable.addBlob.invoke(this, status, length, inBuffer, blobId, parLength, par); - FbException.checkException(status); } - public void appendBlobData(IStatus status, int length, com.sun.jna.Pointer inBuffer) throws FbException + public void appendBlobData(IStatus status, int length, com.sun.jna.Pointer inBuffer) { VTable vTable = getVTable(); vTable.appendBlobData.invoke(this, status, length, inBuffer); - FbException.checkException(status); } - public void addBlobStream(IStatus status, int length, com.sun.jna.Pointer inBuffer) throws FbException + public void addBlobStream(IStatus status, int length, com.sun.jna.Pointer inBuffer) { VTable vTable = getVTable(); vTable.addBlobStream.invoke(this, status, length, inBuffer); - FbException.checkException(status); } - public void registerBlob(IStatus status, com.sun.jna.ptr.LongByReference existingBlob, com.sun.jna.ptr.LongByReference blobId) throws FbException + public void registerBlob(IStatus status, com.sun.jna.ptr.LongByReference existingBlob, com.sun.jna.ptr.LongByReference blobId) { VTable vTable = getVTable(); vTable.registerBlob.invoke(this, status, existingBlob, blobId); - FbException.checkException(status); } - public IBatchCompletionState execute(IStatus status, ITransaction transaction) throws FbException + public IBatchCompletionState execute(IStatus status, ITransaction transaction) { VTable vTable = getVTable(); IBatchCompletionState result = vTable.execute.invoke(this, status, transaction); - FbException.checkException(status); return result; } - public void cancel(IStatus status) throws FbException + public void cancel(IStatus status) { VTable vTable = getVTable(); vTable.cancel.invoke(this, status); - FbException.checkException(status); } - public int getBlobAlignment(IStatus status) throws FbException + public int getBlobAlignment(IStatus status) { VTable vTable = getVTable(); int result = vTable.getBlobAlignment.invoke(this, status); - FbException.checkException(status); return result; } - public IMessageMetadata getMetadata(IStatus status) throws FbException + public IMessageMetadata getMetadata(IStatus status) { VTable vTable = getVTable(); IMessageMetadata result = vTable.getMetadata.invoke(this, status); - FbException.checkException(status); return result; } - public void setDefaultBpb(IStatus status, int parLength, byte[] par) throws FbException + public void setDefaultBpb(IStatus status, int parLength, byte[] par) { VTable vTable = getVTable(); vTable.setDefaultBpb.invoke(this, status, parLength, par); - FbException.checkException(status); } } @@ -6125,7 +6063,7 @@ public int invoke(IBatchCompletionState self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return 0; } } @@ -6141,7 +6079,7 @@ public int invoke(IBatchCompletionState self, IStatus status, int pos) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return 0; } } @@ -6157,7 +6095,7 @@ public int invoke(IBatchCompletionState self, IStatus status, int pos) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return 0; } } @@ -6173,7 +6111,7 @@ public void invoke(IBatchCompletionState self, IStatus status, IStatus to, int p } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -6215,35 +6153,31 @@ protected VTable createVTable() return new VTable(cloopVTable); } - public int getSize(IStatus status) throws FbException + public int getSize(IStatus status) { VTable vTable = getVTable(); int result = vTable.getSize.invoke(this, status); - FbException.checkException(status); return result; } - public int getState(IStatus status, int pos) throws FbException + public int getState(IStatus status, int pos) { VTable vTable = getVTable(); int result = vTable.getState.invoke(this, status, pos); - FbException.checkException(status); return result; } - public int findError(IStatus status, int pos) throws FbException + public int findError(IStatus status, int pos) { VTable vTable = getVTable(); int result = vTable.findError.invoke(this, status, pos); - FbException.checkException(status); return result; } - public void getStatus(IStatus status, IStatus to, int pos) throws FbException + public void getStatus(IStatus status, IStatus to, int pos) { VTable vTable = getVTable(); vTable.getStatus.invoke(this, status, to, pos); - FbException.checkException(status); } } @@ -6305,7 +6239,7 @@ public void invoke(IRequest self, IStatus status, int level, int msgType, int le } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -6320,7 +6254,7 @@ public void invoke(IRequest self, IStatus status, int level, int msgType, int le } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -6335,7 +6269,7 @@ public void invoke(IRequest self, IStatus status, int level, int itemsLength, by } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -6350,7 +6284,7 @@ public void invoke(IRequest self, IStatus status, ITransaction tra, int level) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -6365,7 +6299,7 @@ public void invoke(IRequest self, IStatus status, ITransaction tra, int level, i } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -6380,7 +6314,7 @@ public void invoke(IRequest self, IStatus status, int level) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -6395,7 +6329,7 @@ public void invoke(IRequest self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -6440,53 +6374,46 @@ protected VTable createVTable() return new VTable(cloopVTable); } - public void receive(IStatus status, int level, int msgType, int length, com.sun.jna.Pointer message) throws FbException + public void receive(IStatus status, int level, int msgType, int length, com.sun.jna.Pointer message) { VTable vTable = getVTable(); vTable.receive.invoke(this, status, level, msgType, length, message); - FbException.checkException(status); } - public void send(IStatus status, int level, int msgType, int length, com.sun.jna.Pointer message) throws FbException + public void send(IStatus status, int level, int msgType, int length, com.sun.jna.Pointer message) { VTable vTable = getVTable(); vTable.send.invoke(this, status, level, msgType, length, message); - FbException.checkException(status); } - public void getInfo(IStatus status, int level, int itemsLength, byte[] items, int bufferLength, byte[] buffer) throws FbException + public void getInfo(IStatus status, int level, int itemsLength, byte[] items, int bufferLength, byte[] buffer) { VTable vTable = getVTable(); vTable.getInfo.invoke(this, status, level, itemsLength, items, bufferLength, buffer); - FbException.checkException(status); } - public void start(IStatus status, ITransaction tra, int level) throws FbException + public void start(IStatus status, ITransaction tra, int level) { VTable vTable = getVTable(); vTable.start.invoke(this, status, tra, level); - FbException.checkException(status); } - public void startAndSend(IStatus status, ITransaction tra, int level, int msgType, int length, com.sun.jna.Pointer message) throws FbException + public void startAndSend(IStatus status, ITransaction tra, int level, int msgType, int length, com.sun.jna.Pointer message) { VTable vTable = getVTable(); vTable.startAndSend.invoke(this, status, tra, level, msgType, length, message); - FbException.checkException(status); } - public void unwind(IStatus status, int level) throws FbException + public void unwind(IStatus status, int level) { VTable vTable = getVTable(); vTable.unwind.invoke(this, status, level); - FbException.checkException(status); } - public void free(IStatus status) throws FbException + public void free(IStatus status) { VTable vTable = getVTable(); vTable.free.invoke(this, status); - FbException.checkException(status); } } @@ -6518,7 +6445,7 @@ public void invoke(IEvents self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -6557,11 +6484,10 @@ protected VTable createVTable() return new VTable(cloopVTable); } - public void cancel(IStatus status) throws FbException + public void cancel(IStatus status) { VTable vTable = getVTable(); vTable.cancel.invoke(this, status); - FbException.checkException(status); } } @@ -6875,7 +6801,7 @@ public void invoke(IAttachment self, IStatus status, int itemsLength, byte[] ite } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -6890,7 +6816,7 @@ public ITransaction invoke(IAttachment self, IStatus status, int tpbLength, byte } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -6906,7 +6832,7 @@ public ITransaction invoke(IAttachment self, IStatus status, int length, byte[] } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -6922,7 +6848,7 @@ public IRequest invoke(IAttachment self, IStatus status, int blrLength, byte[] b } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -6938,7 +6864,7 @@ public void invoke(IAttachment self, IStatus status, ITransaction transaction, i } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -6953,7 +6879,7 @@ public IBlob invoke(IAttachment self, IStatus status, ITransaction transaction, } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -6969,7 +6895,7 @@ public IBlob invoke(IAttachment self, IStatus status, ITransaction transaction, } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -6985,7 +6911,7 @@ public int invoke(IAttachment self, IStatus status, ITransaction transaction, co } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return 0; } } @@ -7001,7 +6927,7 @@ public void invoke(IAttachment self, IStatus status, ITransaction transaction, c } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -7016,7 +6942,7 @@ public void invoke(IAttachment self, IStatus status, ITransaction transaction, i } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -7031,7 +6957,7 @@ public IStatement invoke(IAttachment self, IStatus status, ITransaction tra, int } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -7047,7 +6973,7 @@ public ITransaction invoke(IAttachment self, IStatus status, ITransaction transa } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -7063,7 +6989,7 @@ public IResultSet invoke(IAttachment self, IStatus status, ITransaction transact } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -7079,7 +7005,7 @@ public IEvents invoke(IAttachment self, IStatus status, IEventCallback callback, } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -7095,7 +7021,7 @@ public void invoke(IAttachment self, IStatus status, int option) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -7110,7 +7036,7 @@ public void invoke(IAttachment self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -7125,7 +7051,7 @@ public void invoke(IAttachment self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -7140,7 +7066,7 @@ public void invoke(IAttachment self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -7155,7 +7081,7 @@ public int invoke(IAttachment self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return 0; } } @@ -7171,7 +7097,7 @@ public void invoke(IAttachment self, IStatus status, int timeOut) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -7186,7 +7112,7 @@ public int invoke(IAttachment self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return 0; } } @@ -7202,7 +7128,7 @@ public void invoke(IAttachment self, IStatus status, int timeOut) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -7217,7 +7143,7 @@ public IBatch invoke(IAttachment self, IStatus status, ITransaction transaction, } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -7279,177 +7205,154 @@ protected VTable createVTable() return new VTable(cloopVTable); } - public void getInfo(IStatus status, int itemsLength, byte[] items, int bufferLength, byte[] buffer) throws FbException + public void getInfo(IStatus status, int itemsLength, byte[] items, int bufferLength, byte[] buffer) { VTable vTable = getVTable(); vTable.getInfo.invoke(this, status, itemsLength, items, bufferLength, buffer); - FbException.checkException(status); } - public ITransaction startTransaction(IStatus status, int tpbLength, byte[] tpb) throws FbException + public ITransaction startTransaction(IStatus status, int tpbLength, byte[] tpb) { VTable vTable = getVTable(); ITransaction result = vTable.startTransaction.invoke(this, status, tpbLength, tpb); - FbException.checkException(status); return result; } - public ITransaction reconnectTransaction(IStatus status, int length, byte[] id) throws FbException + public ITransaction reconnectTransaction(IStatus status, int length, byte[] id) { VTable vTable = getVTable(); ITransaction result = vTable.reconnectTransaction.invoke(this, status, length, id); - FbException.checkException(status); return result; } - public IRequest compileRequest(IStatus status, int blrLength, byte[] blr) throws FbException + public IRequest compileRequest(IStatus status, int blrLength, byte[] blr) { VTable vTable = getVTable(); IRequest result = vTable.compileRequest.invoke(this, status, blrLength, blr); - FbException.checkException(status); return result; } - public void transactRequest(IStatus status, ITransaction transaction, int blrLength, byte[] blr, int inMsgLength, byte[] inMsg, int outMsgLength, byte[] outMsg) throws FbException + public void transactRequest(IStatus status, ITransaction transaction, int blrLength, byte[] blr, int inMsgLength, byte[] inMsg, int outMsgLength, byte[] outMsg) { VTable vTable = getVTable(); vTable.transactRequest.invoke(this, status, transaction, blrLength, blr, inMsgLength, inMsg, outMsgLength, outMsg); - FbException.checkException(status); } - public IBlob createBlob(IStatus status, ITransaction transaction, com.sun.jna.ptr.LongByReference id, int bpbLength, byte[] bpb) throws FbException + public IBlob createBlob(IStatus status, ITransaction transaction, com.sun.jna.ptr.LongByReference id, int bpbLength, byte[] bpb) { VTable vTable = getVTable(); IBlob result = vTable.createBlob.invoke(this, status, transaction, id, bpbLength, bpb); - FbException.checkException(status); return result; } - public IBlob openBlob(IStatus status, ITransaction transaction, com.sun.jna.ptr.LongByReference id, int bpbLength, byte[] bpb) throws FbException + public IBlob openBlob(IStatus status, ITransaction transaction, com.sun.jna.ptr.LongByReference id, int bpbLength, byte[] bpb) { VTable vTable = getVTable(); IBlob result = vTable.openBlob.invoke(this, status, transaction, id, bpbLength, bpb); - FbException.checkException(status); return result; } - public int getSlice(IStatus status, ITransaction transaction, com.sun.jna.ptr.LongByReference id, int sdlLength, byte[] sdl, int paramLength, byte[] param, int sliceLength, byte[] slice) throws FbException + public int getSlice(IStatus status, ITransaction transaction, com.sun.jna.ptr.LongByReference id, int sdlLength, byte[] sdl, int paramLength, byte[] param, int sliceLength, byte[] slice) { VTable vTable = getVTable(); int result = vTable.getSlice.invoke(this, status, transaction, id, sdlLength, sdl, paramLength, param, sliceLength, slice); - FbException.checkException(status); return result; } - public void putSlice(IStatus status, ITransaction transaction, com.sun.jna.ptr.LongByReference id, int sdlLength, byte[] sdl, int paramLength, byte[] param, int sliceLength, byte[] slice) throws FbException + public void putSlice(IStatus status, ITransaction transaction, com.sun.jna.ptr.LongByReference id, int sdlLength, byte[] sdl, int paramLength, byte[] param, int sliceLength, byte[] slice) { VTable vTable = getVTable(); vTable.putSlice.invoke(this, status, transaction, id, sdlLength, sdl, paramLength, param, sliceLength, slice); - FbException.checkException(status); } - public void executeDyn(IStatus status, ITransaction transaction, int length, byte[] dyn) throws FbException + public void executeDyn(IStatus status, ITransaction transaction, int length, byte[] dyn) { VTable vTable = getVTable(); vTable.executeDyn.invoke(this, status, transaction, length, dyn); - FbException.checkException(status); } - public IStatement prepare(IStatus status, ITransaction tra, int stmtLength, String sqlStmt, int dialect, int flags) throws FbException + public IStatement prepare(IStatus status, ITransaction tra, int stmtLength, String sqlStmt, int dialect, int flags) { VTable vTable = getVTable(); IStatement result = vTable.prepare.invoke(this, status, tra, stmtLength, sqlStmt, dialect, flags); - FbException.checkException(status); return result; } - public ITransaction execute(IStatus status, ITransaction transaction, int stmtLength, String sqlStmt, int dialect, IMessageMetadata inMetadata, com.sun.jna.Pointer inBuffer, IMessageMetadata outMetadata, com.sun.jna.Pointer outBuffer) throws FbException + public ITransaction execute(IStatus status, ITransaction transaction, int stmtLength, String sqlStmt, int dialect, IMessageMetadata inMetadata, com.sun.jna.Pointer inBuffer, IMessageMetadata outMetadata, com.sun.jna.Pointer outBuffer) { VTable vTable = getVTable(); ITransaction result = vTable.execute.invoke(this, status, transaction, stmtLength, sqlStmt, dialect, inMetadata, inBuffer, outMetadata, outBuffer); - FbException.checkException(status); return result; } - public IResultSet openCursor(IStatus status, ITransaction transaction, int stmtLength, String sqlStmt, int dialect, IMessageMetadata inMetadata, com.sun.jna.Pointer inBuffer, IMessageMetadata outMetadata, String cursorName, int cursorFlags) throws FbException + public IResultSet openCursor(IStatus status, ITransaction transaction, int stmtLength, String sqlStmt, int dialect, IMessageMetadata inMetadata, com.sun.jna.Pointer inBuffer, IMessageMetadata outMetadata, String cursorName, int cursorFlags) { VTable vTable = getVTable(); IResultSet result = vTable.openCursor.invoke(this, status, transaction, stmtLength, sqlStmt, dialect, inMetadata, inBuffer, outMetadata, cursorName, cursorFlags); - FbException.checkException(status); return result; } - public IEvents queEvents(IStatus status, IEventCallback callback, int length, byte[] events) throws FbException + public IEvents queEvents(IStatus status, IEventCallback callback, int length, byte[] events) { VTable vTable = getVTable(); IEvents result = vTable.queEvents.invoke(this, status, callback, length, events); - FbException.checkException(status); return result; } - public void cancelOperation(IStatus status, int option) throws FbException + public void cancelOperation(IStatus status, int option) { VTable vTable = getVTable(); vTable.cancelOperation.invoke(this, status, option); - FbException.checkException(status); } - public void ping(IStatus status) throws FbException + public void ping(IStatus status) { VTable vTable = getVTable(); vTable.ping.invoke(this, status); - FbException.checkException(status); } - public void detach(IStatus status) throws FbException + public void detach(IStatus status) { VTable vTable = getVTable(); vTable.detach.invoke(this, status); - FbException.checkException(status); } - public void dropDatabase(IStatus status) throws FbException + public void dropDatabase(IStatus status) { VTable vTable = getVTable(); vTable.dropDatabase.invoke(this, status); - FbException.checkException(status); } - public int getIdleTimeout(IStatus status) throws FbException + public int getIdleTimeout(IStatus status) { VTable vTable = getVTable(); int result = vTable.getIdleTimeout.invoke(this, status); - FbException.checkException(status); return result; } - public void setIdleTimeout(IStatus status, int timeOut) throws FbException + public void setIdleTimeout(IStatus status, int timeOut) { VTable vTable = getVTable(); vTable.setIdleTimeout.invoke(this, status, timeOut); - FbException.checkException(status); } - public int getStatementTimeout(IStatus status) throws FbException + public int getStatementTimeout(IStatus status) { VTable vTable = getVTable(); int result = vTable.getStatementTimeout.invoke(this, status); - FbException.checkException(status); return result; } - public void setStatementTimeout(IStatus status, int timeOut) throws FbException + public void setStatementTimeout(IStatus status, int timeOut) { VTable vTable = getVTable(); vTable.setStatementTimeout.invoke(this, status, timeOut); - FbException.checkException(status); } - public IBatch createBatch(IStatus status, ITransaction transaction, int stmtLength, String sqlStmt, int dialect, IMessageMetadata inMetadata, int parLength, byte[] par) throws FbException + public IBatch createBatch(IStatus status, ITransaction transaction, int stmtLength, String sqlStmt, int dialect, IMessageMetadata inMetadata, int parLength, byte[] par) { VTable vTable = getVTable(); IBatch result = vTable.createBatch.invoke(this, status, transaction, stmtLength, sqlStmt, dialect, inMetadata, parLength, par); - FbException.checkException(status); return result; } } @@ -7492,7 +7395,7 @@ public void invoke(IService self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -7507,7 +7410,7 @@ public void invoke(IService self, IStatus status, int sendLength, byte[] sendIte } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -7522,7 +7425,7 @@ public void invoke(IService self, IStatus status, int spbLength, byte[] spb) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -7563,25 +7466,22 @@ protected VTable createVTable() return new VTable(cloopVTable); } - public void detach(IStatus status) throws FbException + public void detach(IStatus status) { VTable vTable = getVTable(); vTable.detach.invoke(this, status); - FbException.checkException(status); } - public void query(IStatus status, int sendLength, byte[] sendItems, int receiveLength, byte[] receiveItems, int bufferLength, byte[] buffer) throws FbException + public void query(IStatus status, int sendLength, byte[] sendItems, int receiveLength, byte[] receiveItems, int bufferLength, byte[] buffer) { VTable vTable = getVTable(); vTable.query.invoke(this, status, sendLength, sendItems, receiveLength, receiveItems, bufferLength, buffer); - FbException.checkException(status); } - public void start(IStatus status, int spbLength, byte[] spb) throws FbException + public void start(IStatus status, int spbLength, byte[] spb) { VTable vTable = getVTable(); vTable.start.invoke(this, status, spbLength, spb); - FbException.checkException(status); } } @@ -7633,7 +7533,7 @@ public IAttachment invoke(IProvider self, IStatus status, String fileName, int d } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -7649,7 +7549,7 @@ public IAttachment invoke(IProvider self, IStatus status, String fileName, int d } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -7665,7 +7565,7 @@ public IService invoke(IProvider self, IStatus status, String service, int spbLe } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -7681,7 +7581,7 @@ public void invoke(IProvider self, IStatus status, int timeout, int reason) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -7696,7 +7596,7 @@ public void invoke(IProvider self, IStatus status, ICryptKeyCallback cryptCallba } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -7739,42 +7639,37 @@ protected VTable createVTable() return new VTable(cloopVTable); } - public IAttachment attachDatabase(IStatus status, String fileName, int dpbLength, byte[] dpb) throws FbException + public IAttachment attachDatabase(IStatus status, String fileName, int dpbLength, byte[] dpb) { VTable vTable = getVTable(); IAttachment result = vTable.attachDatabase.invoke(this, status, fileName, dpbLength, dpb); - FbException.checkException(status); return result; } - public IAttachment createDatabase(IStatus status, String fileName, int dpbLength, byte[] dpb) throws FbException + public IAttachment createDatabase(IStatus status, String fileName, int dpbLength, byte[] dpb) { VTable vTable = getVTable(); IAttachment result = vTable.createDatabase.invoke(this, status, fileName, dpbLength, dpb); - FbException.checkException(status); return result; } - public IService attachServiceManager(IStatus status, String service, int spbLength, byte[] spb) throws FbException + public IService attachServiceManager(IStatus status, String service, int spbLength, byte[] spb) { VTable vTable = getVTable(); IService result = vTable.attachServiceManager.invoke(this, status, service, spbLength, spb); - FbException.checkException(status); return result; } - public void shutdown(IStatus status, int timeout, int reason) throws FbException + public void shutdown(IStatus status, int timeout, int reason) { VTable vTable = getVTable(); vTable.shutdown.invoke(this, status, timeout, reason); - FbException.checkException(status); } - public void setDbCryptCallback(IStatus status, ICryptKeyCallback cryptCallback) throws FbException + public void setDbCryptCallback(IStatus status, ICryptKeyCallback cryptCallback) { VTable vTable = getVTable(); vTable.setDbCryptCallback.invoke(this, status, cryptCallback); - FbException.checkException(status); } } @@ -7816,7 +7711,7 @@ public void invoke(IDtcStart self, IStatus status, IAttachment att) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -7831,7 +7726,7 @@ public void invoke(IDtcStart self, IStatus status, IAttachment att, int length, } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -7846,7 +7741,7 @@ public ITransaction invoke(IDtcStart self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -7888,25 +7783,22 @@ protected VTable createVTable() return new VTable(cloopVTable); } - public void addAttachment(IStatus status, IAttachment att) throws FbException + public void addAttachment(IStatus status, IAttachment att) { VTable vTable = getVTable(); vTable.addAttachment.invoke(this, status, att); - FbException.checkException(status); } - public void addWithTpb(IStatus status, IAttachment att, int length, byte[] tpb) throws FbException + public void addWithTpb(IStatus status, IAttachment att, int length, byte[] tpb) { VTable vTable = getVTable(); vTable.addWithTpb.invoke(this, status, att, length, tpb); - FbException.checkException(status); } - public ITransaction start(IStatus status) throws FbException + public ITransaction start(IStatus status) { VTable vTable = getVTable(); ITransaction result = vTable.start.invoke(this, status); - FbException.checkException(status); return result; } } @@ -7944,7 +7836,7 @@ public ITransaction invoke(IDtc self, IStatus status, ITransaction one, ITransac } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -7960,7 +7852,7 @@ public IDtcStart invoke(IDtc self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -8001,19 +7893,17 @@ protected VTable createVTable() return new VTable(cloopVTable); } - public ITransaction join(IStatus status, ITransaction one, ITransaction two) throws FbException + public ITransaction join(IStatus status, ITransaction one, ITransaction two) { VTable vTable = getVTable(); ITransaction result = vTable.join.invoke(this, status, one, two); - FbException.checkException(status); return result; } - public IDtcStart startBuilder(IStatus status) throws FbException + public IDtcStart startBuilder(IStatus status) { VTable vTable = getVTable(); IDtcStart result = vTable.startBuilder.invoke(this, status); - FbException.checkException(status); return result; } } @@ -8115,7 +8005,7 @@ public void invoke(IWriter self, IStatus status, String name) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -8130,7 +8020,7 @@ public void invoke(IWriter self, IStatus status, String value) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -8145,7 +8035,7 @@ public void invoke(IWriter self, IStatus status, String value) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -8193,25 +8083,22 @@ public void reset() vTable.reset.invoke(this); } - public void add(IStatus status, String name) throws FbException + public void add(IStatus status, String name) { VTable vTable = getVTable(); vTable.add.invoke(this, status, name); - FbException.checkException(status); } - public void setType(IStatus status, String value) throws FbException + public void setType(IStatus status, String value) { VTable vTable = getVTable(); vTable.setType.invoke(this, status, value); - FbException.checkException(status); } - public void setDb(IStatus status, String value) throws FbException + public void setDb(IStatus status, String value) { VTable vTable = getVTable(); vTable.setDb.invoke(this, status, value); - FbException.checkException(status); } } @@ -8274,7 +8161,7 @@ public void invoke(IServerBlock self, IStatus status, int length, com.sun.jna.Po } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -8289,7 +8176,7 @@ public ICryptKey invoke(IServerBlock self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -8346,18 +8233,16 @@ public com.sun.jna.Pointer getData(com.sun.jna.Pointer length) return result; } - public void putData(IStatus status, int length, com.sun.jna.Pointer data) throws FbException + public void putData(IStatus status, int length, com.sun.jna.Pointer data) { VTable vTable = getVTable(); vTable.putData.invoke(this, status, length, data); - FbException.checkException(status); } - public ICryptKey newKey(IStatus status) throws FbException + public ICryptKey newKey(IStatus status) { VTable vTable = getVTable(); ICryptKey result = vTable.newKey.invoke(this, status); - FbException.checkException(status); return result; } } @@ -8465,7 +8350,7 @@ public void invoke(IClientBlock self, IStatus status, int length, com.sun.jna.Po } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -8480,7 +8365,7 @@ public ICryptKey invoke(IClientBlock self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -8496,7 +8381,7 @@ public IAuthBlock invoke(IClientBlock self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -8578,26 +8463,23 @@ public com.sun.jna.Pointer getData(com.sun.jna.Pointer length) return result; } - public void putData(IStatus status, int length, com.sun.jna.Pointer data) throws FbException + public void putData(IStatus status, int length, com.sun.jna.Pointer data) { VTable vTable = getVTable(); vTable.putData.invoke(this, status, length, data); - FbException.checkException(status); } - public ICryptKey newKey(IStatus status) throws FbException + public ICryptKey newKey(IStatus status) { VTable vTable = getVTable(); ICryptKey result = vTable.newKey.invoke(this, status); - FbException.checkException(status); return result; } - public IAuthBlock getAuthBlock(IStatus status) throws FbException + public IAuthBlock getAuthBlock(IStatus status) { VTable vTable = getVTable(); IAuthBlock result = vTable.getAuthBlock.invoke(this, status); - FbException.checkException(status); return result; } } @@ -8635,7 +8517,7 @@ public int invoke(IServer self, IStatus status, IServerBlock sBlock, IWriter wri } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return 0; } } @@ -8651,7 +8533,7 @@ public void invoke(IServer self, IStatus status, ICryptKeyCallback cryptCallback } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -8691,19 +8573,17 @@ protected VTable createVTable() return new VTable(cloopVTable); } - public int authenticate(IStatus status, IServerBlock sBlock, IWriter writerInterface) throws FbException + public int authenticate(IStatus status, IServerBlock sBlock, IWriter writerInterface) { VTable vTable = getVTable(); int result = vTable.authenticate.invoke(this, status, sBlock, writerInterface); - FbException.checkException(status); return result; } - public void setDbCryptCallback(IStatus status, ICryptKeyCallback cryptCallback) throws FbException + public void setDbCryptCallback(IStatus status, ICryptKeyCallback cryptCallback) { VTable vTable = getVTable(); vTable.setDbCryptCallback.invoke(this, status, cryptCallback); - FbException.checkException(status); } } @@ -8735,7 +8615,7 @@ public int invoke(IClient self, IStatus status, IClientBlock cBlock) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return 0; } } @@ -8775,11 +8655,10 @@ protected VTable createVTable() return new VTable(cloopVTable); } - public int authenticate(IStatus status, IClientBlock cBlock) throws FbException + public int authenticate(IStatus status, IClientBlock cBlock) { VTable vTable = getVTable(); int result = vTable.authenticate.invoke(this, status, cBlock); - FbException.checkException(status); return result; } } @@ -8838,7 +8717,7 @@ public void invoke(IUserField self, IStatus status, int newValue) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -8893,11 +8772,10 @@ public int specified() return result; } - public void setEntered(IStatus status, int newValue) throws FbException + public void setEntered(IStatus status, int newValue) { VTable vTable = getVTable(); vTable.setEntered.invoke(this, status, newValue); - FbException.checkException(status); } } @@ -8942,7 +8820,7 @@ public void invoke(ICharUserField self, IStatus status, String newValue) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -8989,11 +8867,10 @@ public String get() return result; } - public void set(IStatus status, String newValue) throws FbException + public void set(IStatus status, String newValue) { VTable vTable = getVTable(); vTable.set.invoke(this, status, newValue); - FbException.checkException(status); } } @@ -9038,7 +8915,7 @@ public void invoke(IIntUserField self, IStatus status, int newValue) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -9085,11 +8962,10 @@ public int get() return result; } - public void set(IStatus status, int newValue) throws FbException + public void set(IStatus status, int newValue) { VTable vTable = getVTable(); vTable.set.invoke(this, status, newValue); - FbException.checkException(status); } } @@ -9251,7 +9127,7 @@ public void invoke(IUser self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -9370,11 +9246,10 @@ public IIntUserField admin() return result; } - public void clear(IStatus status) throws FbException + public void clear(IStatus status) { VTable vTable = getVTable(); vTable.clear.invoke(this, status); - FbException.checkException(status); } } @@ -9406,7 +9281,7 @@ public void invoke(IListUsers self, IStatus status, IUser user) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -9445,11 +9320,10 @@ protected VTable createVTable() return new VTable(cloopVTable); } - public void list(IStatus status, IUser user) throws FbException + public void list(IStatus status, IUser user) { VTable vTable = getVTable(); vTable.list.invoke(this, status, user); - FbException.checkException(status); } } @@ -9648,7 +9522,7 @@ public void invoke(IManagement self, IStatus status, ILogonInfo logonInfo) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -9663,7 +9537,7 @@ public int invoke(IManagement self, IStatus status, IUser user, IListUsers callb } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return 0; } } @@ -9679,7 +9553,7 @@ public void invoke(IManagement self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -9694,7 +9568,7 @@ public void invoke(IManagement self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -9736,33 +9610,29 @@ protected VTable createVTable() return new VTable(cloopVTable); } - public void start(IStatus status, ILogonInfo logonInfo) throws FbException + public void start(IStatus status, ILogonInfo logonInfo) { VTable vTable = getVTable(); vTable.start.invoke(this, status, logonInfo); - FbException.checkException(status); } - public int execute(IStatus status, IUser user, IListUsers callback) throws FbException + public int execute(IStatus status, IUser user, IListUsers callback) { VTable vTable = getVTable(); int result = vTable.execute.invoke(this, status, user, callback); - FbException.checkException(status); return result; } - public void commit(IStatus status) throws FbException + public void commit(IStatus status) { VTable vTable = getVTable(); vTable.commit.invoke(this, status); - FbException.checkException(status); } - public void rollback(IStatus status) throws FbException + public void rollback(IStatus status) { VTable vTable = getVTable(); vTable.rollback.invoke(this, status); - FbException.checkException(status); } } @@ -9864,7 +9734,7 @@ public boolean invoke(IAuthBlock self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return false; } } @@ -9880,7 +9750,7 @@ public boolean invoke(IAuthBlock self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return false; } } @@ -9961,19 +9831,17 @@ public String getOriginalPlugin() return result; } - public boolean next(IStatus status) throws FbException + public boolean next(IStatus status) { VTable vTable = getVTable(); boolean result = vTable.next.invoke(this, status); - FbException.checkException(status); return result; } - public boolean first(IStatus status) throws FbException + public boolean first(IStatus status) { VTable vTable = getVTable(); boolean result = vTable.first.invoke(this, status); - FbException.checkException(status); return result; } } @@ -10021,7 +9889,7 @@ public String invoke(IWireCryptPlugin self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -10037,7 +9905,7 @@ public void invoke(IWireCryptPlugin self, IStatus status, ICryptKey key) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -10052,7 +9920,7 @@ public void invoke(IWireCryptPlugin self, IStatus status, int length, com.sun.jn } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -10067,7 +9935,7 @@ public void invoke(IWireCryptPlugin self, IStatus status, int length, com.sun.jn } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -10109,33 +9977,29 @@ protected VTable createVTable() return new VTable(cloopVTable); } - public String getKnownTypes(IStatus status) throws FbException + public String getKnownTypes(IStatus status) { VTable vTable = getVTable(); String result = vTable.getKnownTypes.invoke(this, status); - FbException.checkException(status); return result; } - public void setKey(IStatus status, ICryptKey key) throws FbException + public void setKey(IStatus status, ICryptKey key) { VTable vTable = getVTable(); vTable.setKey.invoke(this, status, key); - FbException.checkException(status); } - public void encrypt(IStatus status, int length, com.sun.jna.Pointer from, com.sun.jna.Pointer to) throws FbException + public void encrypt(IStatus status, int length, com.sun.jna.Pointer from, com.sun.jna.Pointer to) { VTable vTable = getVTable(); vTable.encrypt.invoke(this, status, length, from, to); - FbException.checkException(status); } - public void decrypt(IStatus status, int length, com.sun.jna.Pointer from, com.sun.jna.Pointer to) throws FbException + public void decrypt(IStatus status, int length, com.sun.jna.Pointer from, com.sun.jna.Pointer to) { VTable vTable = getVTable(); vTable.decrypt.invoke(this, status, length, from, to); - FbException.checkException(status); } } @@ -10250,7 +10114,7 @@ public int invoke(IKeyHolderPlugin self, IStatus status, ICryptKeyCallback callb } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return 0; } } @@ -10266,7 +10130,7 @@ public ICryptKeyCallback invoke(IKeyHolderPlugin self, IStatus status, String ke } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -10282,7 +10146,7 @@ public boolean invoke(IKeyHolderPlugin self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return false; } } @@ -10298,7 +10162,7 @@ public ICryptKeyCallback invoke(IKeyHolderPlugin self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -10341,35 +10205,31 @@ protected VTable createVTable() return new VTable(cloopVTable); } - public int keyCallback(IStatus status, ICryptKeyCallback callback) throws FbException + public int keyCallback(IStatus status, ICryptKeyCallback callback) { VTable vTable = getVTable(); int result = vTable.keyCallback.invoke(this, status, callback); - FbException.checkException(status); return result; } - public ICryptKeyCallback keyHandle(IStatus status, String keyName) throws FbException + public ICryptKeyCallback keyHandle(IStatus status, String keyName) { VTable vTable = getVTable(); ICryptKeyCallback result = vTable.keyHandle.invoke(this, status, keyName); - FbException.checkException(status); return result; } - public boolean useOnlyOwnKeys(IStatus status) throws FbException + public boolean useOnlyOwnKeys(IStatus status) { VTable vTable = getVTable(); boolean result = vTable.useOnlyOwnKeys.invoke(this, status); - FbException.checkException(status); return result; } - public ICryptKeyCallback chainHandle(IStatus status) throws FbException + public ICryptKeyCallback chainHandle(IStatus status) { VTable vTable = getVTable(); ICryptKeyCallback result = vTable.chainHandle.invoke(this, status); - FbException.checkException(status); return result; } } @@ -10402,7 +10262,7 @@ public String invoke(IDbCryptInfo self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -10442,11 +10302,10 @@ protected VTable createVTable() return new VTable(cloopVTable); } - public String getDatabaseFullPath(IStatus status) throws FbException + public String getDatabaseFullPath(IStatus status) { VTable vTable = getVTable(); String result = vTable.getDatabaseFullPath.invoke(this, status); - FbException.checkException(status); return result; } } @@ -10494,7 +10353,7 @@ public void invoke(IDbCryptPlugin self, IStatus status, int length, IKeyHolderPl } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -10509,7 +10368,7 @@ public void invoke(IDbCryptPlugin self, IStatus status, int length, com.sun.jna. } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -10524,7 +10383,7 @@ public void invoke(IDbCryptPlugin self, IStatus status, int length, com.sun.jna. } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -10539,7 +10398,7 @@ public void invoke(IDbCryptPlugin self, IStatus status, IDbCryptInfo info) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -10581,32 +10440,28 @@ protected VTable createVTable() return new VTable(cloopVTable); } - public void setKey(IStatus status, int length, IKeyHolderPlugin[] sources, String keyName) throws FbException + public void setKey(IStatus status, int length, IKeyHolderPlugin[] sources, String keyName) { VTable vTable = getVTable(); vTable.setKey.invoke(this, status, length, sources, keyName); - FbException.checkException(status); } - public void encrypt(IStatus status, int length, com.sun.jna.Pointer from, com.sun.jna.Pointer to) throws FbException + public void encrypt(IStatus status, int length, com.sun.jna.Pointer from, com.sun.jna.Pointer to) { VTable vTable = getVTable(); vTable.encrypt.invoke(this, status, length, from, to); - FbException.checkException(status); } - public void decrypt(IStatus status, int length, com.sun.jna.Pointer from, com.sun.jna.Pointer to) throws FbException + public void decrypt(IStatus status, int length, com.sun.jna.Pointer from, com.sun.jna.Pointer to) { VTable vTable = getVTable(); vTable.decrypt.invoke(this, status, length, from, to); - FbException.checkException(status); } - public void setInfo(IStatus status, IDbCryptInfo info) throws FbException + public void setInfo(IStatus status, IDbCryptInfo info) { VTable vTable = getVTable(); vTable.setInfo.invoke(this, status, info); - FbException.checkException(status); } } @@ -10691,7 +10546,7 @@ public IExternalEngine invoke(IExternalContext self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -10707,7 +10562,7 @@ public IAttachment invoke(IExternalContext self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -10723,7 +10578,7 @@ public ITransaction invoke(IExternalContext self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -10827,27 +10682,24 @@ public IMaster getMaster() return result; } - public IExternalEngine getEngine(IStatus status) throws FbException + public IExternalEngine getEngine(IStatus status) { VTable vTable = getVTable(); IExternalEngine result = vTable.getEngine.invoke(this, status); - FbException.checkException(status); return result; } - public IAttachment getAttachment(IStatus status) throws FbException + public IAttachment getAttachment(IStatus status) { VTable vTable = getVTable(); IAttachment result = vTable.getAttachment.invoke(this, status); - FbException.checkException(status); return result; } - public ITransaction getTransaction(IStatus status) throws FbException + public ITransaction getTransaction(IStatus status) { VTable vTable = getVTable(); ITransaction result = vTable.getTransaction.invoke(this, status); - FbException.checkException(status); return result; } @@ -10922,7 +10774,7 @@ public boolean invoke(IExternalResultSet self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return false; } } @@ -10962,11 +10814,10 @@ protected VTable createVTable() return new VTable(cloopVTable); } - public boolean fetch(IStatus status) throws FbException + public boolean fetch(IStatus status) { VTable vTable = getVTable(); boolean result = vTable.fetch.invoke(this, status); - FbException.checkException(status); return result; } } @@ -11004,7 +10855,7 @@ public void invoke(IExternalFunction self, IStatus status, IExternalContext cont } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -11019,7 +10870,7 @@ public void invoke(IExternalFunction self, IStatus status, IExternalContext cont } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -11059,18 +10910,16 @@ protected VTable createVTable() return new VTable(cloopVTable); } - public void getCharSet(IStatus status, IExternalContext context, com.sun.jna.Pointer name, int nameSize) throws FbException + public void getCharSet(IStatus status, IExternalContext context, com.sun.jna.Pointer name, int nameSize) { VTable vTable = getVTable(); vTable.getCharSet.invoke(this, status, context, name, nameSize); - FbException.checkException(status); } - public void execute(IStatus status, IExternalContext context, com.sun.jna.Pointer inMsg, com.sun.jna.Pointer outMsg) throws FbException + public void execute(IStatus status, IExternalContext context, com.sun.jna.Pointer inMsg, com.sun.jna.Pointer outMsg) { VTable vTable = getVTable(); vTable.execute.invoke(this, status, context, inMsg, outMsg); - FbException.checkException(status); } } @@ -11107,7 +10956,7 @@ public void invoke(IExternalProcedure self, IStatus status, IExternalContext con } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -11122,7 +10971,7 @@ public IExternalResultSet invoke(IExternalProcedure self, IStatus status, IExter } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -11163,18 +11012,16 @@ protected VTable createVTable() return new VTable(cloopVTable); } - public void getCharSet(IStatus status, IExternalContext context, com.sun.jna.Pointer name, int nameSize) throws FbException + public void getCharSet(IStatus status, IExternalContext context, com.sun.jna.Pointer name, int nameSize) { VTable vTable = getVTable(); vTable.getCharSet.invoke(this, status, context, name, nameSize); - FbException.checkException(status); } - public IExternalResultSet open(IStatus status, IExternalContext context, com.sun.jna.Pointer inMsg, com.sun.jna.Pointer outMsg) throws FbException + public IExternalResultSet open(IStatus status, IExternalContext context, com.sun.jna.Pointer inMsg, com.sun.jna.Pointer outMsg) { VTable vTable = getVTable(); IExternalResultSet result = vTable.open.invoke(this, status, context, inMsg, outMsg); - FbException.checkException(status); return result; } } @@ -11212,7 +11059,7 @@ public void invoke(IExternalTrigger self, IStatus status, IExternalContext conte } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -11227,7 +11074,7 @@ public void invoke(IExternalTrigger self, IStatus status, IExternalContext conte } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -11267,18 +11114,16 @@ protected VTable createVTable() return new VTable(cloopVTable); } - public void getCharSet(IStatus status, IExternalContext context, com.sun.jna.Pointer name, int nameSize) throws FbException + public void getCharSet(IStatus status, IExternalContext context, com.sun.jna.Pointer name, int nameSize) { VTable vTable = getVTable(); vTable.getCharSet.invoke(this, status, context, name, nameSize); - FbException.checkException(status); } - public void execute(IStatus status, IExternalContext context, int action, com.sun.jna.Pointer oldMsg, com.sun.jna.Pointer newMsg, com.sun.jna.Pointer oldDbKey, com.sun.jna.Pointer newDbKey) throws FbException + public void execute(IStatus status, IExternalContext context, int action, com.sun.jna.Pointer oldMsg, com.sun.jna.Pointer newMsg, com.sun.jna.Pointer oldDbKey, com.sun.jna.Pointer newDbKey) { VTable vTable = getVTable(); vTable.execute.invoke(this, status, context, action, oldMsg, newMsg, oldDbKey, newDbKey); - FbException.checkException(status); } } @@ -11350,7 +11195,7 @@ public String invoke(IRoutineMetadata self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -11366,7 +11211,7 @@ public String invoke(IRoutineMetadata self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -11382,7 +11227,7 @@ public String invoke(IRoutineMetadata self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -11398,7 +11243,7 @@ public String invoke(IRoutineMetadata self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -11414,7 +11259,7 @@ public IMessageMetadata invoke(IRoutineMetadata self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -11430,7 +11275,7 @@ public IMessageMetadata invoke(IRoutineMetadata self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -11446,7 +11291,7 @@ public IMessageMetadata invoke(IRoutineMetadata self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -11462,7 +11307,7 @@ public String invoke(IRoutineMetadata self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -11478,7 +11323,7 @@ public int invoke(IRoutineMetadata self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return 0; } } @@ -11526,75 +11371,66 @@ protected VTable createVTable() return new VTable(cloopVTable); } - public String getPackage(IStatus status) throws FbException + public String getPackage(IStatus status) { VTable vTable = getVTable(); String result = vTable.getPackage.invoke(this, status); - FbException.checkException(status); return result; } - public String getName(IStatus status) throws FbException + public String getName(IStatus status) { VTable vTable = getVTable(); String result = vTable.getName.invoke(this, status); - FbException.checkException(status); return result; } - public String getEntryPoint(IStatus status) throws FbException + public String getEntryPoint(IStatus status) { VTable vTable = getVTable(); String result = vTable.getEntryPoint.invoke(this, status); - FbException.checkException(status); return result; } - public String getBody(IStatus status) throws FbException + public String getBody(IStatus status) { VTable vTable = getVTable(); String result = vTable.getBody.invoke(this, status); - FbException.checkException(status); return result; } - public IMessageMetadata getInputMetadata(IStatus status) throws FbException + public IMessageMetadata getInputMetadata(IStatus status) { VTable vTable = getVTable(); IMessageMetadata result = vTable.getInputMetadata.invoke(this, status); - FbException.checkException(status); return result; } - public IMessageMetadata getOutputMetadata(IStatus status) throws FbException + public IMessageMetadata getOutputMetadata(IStatus status) { VTable vTable = getVTable(); IMessageMetadata result = vTable.getOutputMetadata.invoke(this, status); - FbException.checkException(status); return result; } - public IMessageMetadata getTriggerMetadata(IStatus status) throws FbException + public IMessageMetadata getTriggerMetadata(IStatus status) { VTable vTable = getVTable(); IMessageMetadata result = vTable.getTriggerMetadata.invoke(this, status); - FbException.checkException(status); return result; } - public String getTriggerTable(IStatus status) throws FbException + public String getTriggerTable(IStatus status) { VTable vTable = getVTable(); String result = vTable.getTriggerTable.invoke(this, status); - FbException.checkException(status); return result; } - public int getTriggerType(IStatus status) throws FbException + public int getTriggerType(IStatus status) { VTable vTable = getVTable(); int result = vTable.getTriggerType.invoke(this, status); - FbException.checkException(status); return result; } } @@ -11652,7 +11488,7 @@ public void invoke(IExternalEngine self, IStatus status, IExternalContext contex } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -11667,7 +11503,7 @@ public void invoke(IExternalEngine self, IStatus status, IExternalContext contex } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -11682,7 +11518,7 @@ public void invoke(IExternalEngine self, IStatus status, IExternalContext contex } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -11697,7 +11533,7 @@ public IExternalFunction invoke(IExternalEngine self, IStatus status, IExternalC } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -11713,7 +11549,7 @@ public IExternalProcedure invoke(IExternalEngine self, IStatus status, IExternal } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -11729,7 +11565,7 @@ public IExternalTrigger invoke(IExternalEngine self, IStatus status, IExternalCo } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -11774,48 +11610,42 @@ protected VTable createVTable() return new VTable(cloopVTable); } - public void open(IStatus status, IExternalContext context, com.sun.jna.Pointer charSet, int charSetSize) throws FbException + public void open(IStatus status, IExternalContext context, com.sun.jna.Pointer charSet, int charSetSize) { VTable vTable = getVTable(); vTable.open.invoke(this, status, context, charSet, charSetSize); - FbException.checkException(status); } - public void openAttachment(IStatus status, IExternalContext context) throws FbException + public void openAttachment(IStatus status, IExternalContext context) { VTable vTable = getVTable(); vTable.openAttachment.invoke(this, status, context); - FbException.checkException(status); } - public void closeAttachment(IStatus status, IExternalContext context) throws FbException + public void closeAttachment(IStatus status, IExternalContext context) { VTable vTable = getVTable(); vTable.closeAttachment.invoke(this, status, context); - FbException.checkException(status); } - public IExternalFunction makeFunction(IStatus status, IExternalContext context, IRoutineMetadata metadata, IMetadataBuilder inBuilder, IMetadataBuilder outBuilder) throws FbException + public IExternalFunction makeFunction(IStatus status, IExternalContext context, IRoutineMetadata metadata, IMetadataBuilder inBuilder, IMetadataBuilder outBuilder) { VTable vTable = getVTable(); IExternalFunction result = vTable.makeFunction.invoke(this, status, context, metadata, inBuilder, outBuilder); - FbException.checkException(status); return result; } - public IExternalProcedure makeProcedure(IStatus status, IExternalContext context, IRoutineMetadata metadata, IMetadataBuilder inBuilder, IMetadataBuilder outBuilder) throws FbException + public IExternalProcedure makeProcedure(IStatus status, IExternalContext context, IRoutineMetadata metadata, IMetadataBuilder inBuilder, IMetadataBuilder outBuilder) { VTable vTable = getVTable(); IExternalProcedure result = vTable.makeProcedure.invoke(this, status, context, metadata, inBuilder, outBuilder); - FbException.checkException(status); return result; } - public IExternalTrigger makeTrigger(IStatus status, IExternalContext context, IRoutineMetadata metadata, IMetadataBuilder fieldsBuilder) throws FbException + public IExternalTrigger makeTrigger(IStatus status, IExternalContext context, IRoutineMetadata metadata, IMetadataBuilder fieldsBuilder) { VTable vTable = getVTable(); IExternalTrigger result = vTable.makeTrigger.invoke(this, status, context, metadata, fieldsBuilder); - FbException.checkException(status); return result; } } @@ -11920,7 +11750,7 @@ public void invoke(ITimerControl self, IStatus status, ITimer timer, long microS } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -11935,7 +11765,7 @@ public void invoke(ITimerControl self, IStatus status, ITimer timer) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -11975,18 +11805,16 @@ protected VTable createVTable() return new VTable(cloopVTable); } - public void start(IStatus status, ITimer timer, long microSeconds) throws FbException + public void start(IStatus status, ITimer timer, long microSeconds) { VTable vTable = getVTable(); vTable.start.invoke(this, status, timer, microSeconds); - FbException.checkException(status); } - public void stop(IStatus status, ITimer timer) throws FbException + public void stop(IStatus status, ITimer timer) { VTable vTable = getVTable(); vTable.stop.invoke(this, status, timer); - FbException.checkException(status); } } @@ -12018,7 +11846,7 @@ public void invoke(IVersionCallback self, IStatus status, String text) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -12057,11 +11885,10 @@ protected VTable createVTable() return new VTable(cloopVTable); } - public void callback(IStatus status, String text) throws FbException + public void callback(IStatus status, String text) { VTable vTable = getVTable(); vTable.callback.invoke(this, status, text); - FbException.checkException(status); } } @@ -12178,7 +12005,7 @@ public void invoke(IUtil self, IStatus status, IAttachment att, IVersionCallback } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -12193,7 +12020,7 @@ public void invoke(IUtil self, IStatus status, com.sun.jna.ptr.LongByReference b } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -12208,7 +12035,7 @@ public void invoke(IUtil self, IStatus status, com.sun.jna.ptr.LongByReference b } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -12223,7 +12050,7 @@ public void invoke(IUtil self, IStatus status, IAttachment att, String countersS } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -12238,7 +12065,7 @@ public IAttachment invoke(IUtil self, IStatus status, int stmtLength, String cre } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -12302,7 +12129,7 @@ public IXpbBuilder invoke(IUtil self, IStatus status, int kind, byte[] buf, int } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -12318,7 +12145,7 @@ public int invoke(IUtil self, IStatus status, IMessageMetadata metadata, IOffset } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return 0; } } @@ -12334,7 +12161,7 @@ public IEventBlock invoke(IUtil self, IStatus status, String[] events) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -12350,7 +12177,7 @@ public IDecFloat16 invoke(IUtil self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -12366,7 +12193,7 @@ public IDecFloat34 invoke(IUtil self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -12382,7 +12209,7 @@ public ITransaction invoke(IUtil self, IStatus status, com.sun.jna.ptr.LongByRef } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -12398,7 +12225,7 @@ public IStatement invoke(IUtil self, IStatus status, com.sun.jna.ptr.LongByRefer } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -12455,39 +12282,34 @@ protected VTable createVTable() return new VTable(cloopVTable); } - public void getFbVersion(IStatus status, IAttachment att, IVersionCallback callback) throws FbException + public void getFbVersion(IStatus status, IAttachment att, IVersionCallback callback) { VTable vTable = getVTable(); vTable.getFbVersion.invoke(this, status, att, callback); - FbException.checkException(status); } - public void loadBlob(IStatus status, com.sun.jna.ptr.LongByReference blobId, IAttachment att, ITransaction tra, String file, boolean txt) throws FbException + public void loadBlob(IStatus status, com.sun.jna.ptr.LongByReference blobId, IAttachment att, ITransaction tra, String file, boolean txt) { VTable vTable = getVTable(); vTable.loadBlob.invoke(this, status, blobId, att, tra, file, txt); - FbException.checkException(status); } - public void dumpBlob(IStatus status, com.sun.jna.ptr.LongByReference blobId, IAttachment att, ITransaction tra, String file, boolean txt) throws FbException + public void dumpBlob(IStatus status, com.sun.jna.ptr.LongByReference blobId, IAttachment att, ITransaction tra, String file, boolean txt) { VTable vTable = getVTable(); vTable.dumpBlob.invoke(this, status, blobId, att, tra, file, txt); - FbException.checkException(status); } - public void getPerfCounters(IStatus status, IAttachment att, String countersSet, long[] counters) throws FbException + public void getPerfCounters(IStatus status, IAttachment att, String countersSet, long[] counters) { VTable vTable = getVTable(); vTable.getPerfCounters.invoke(this, status, att, countersSet, counters); - FbException.checkException(status); } - public IAttachment executeCreateDatabase(IStatus status, int stmtLength, String creatDBstatement, int dialect, boolean[] stmtIsCreateDb) throws FbException + public IAttachment executeCreateDatabase(IStatus status, int stmtLength, String creatDBstatement, int dialect, boolean[] stmtIsCreateDb) { VTable vTable = getVTable(); IAttachment result = vTable.executeCreateDatabase.invoke(this, status, stmtLength, creatDBstatement, dialect, stmtIsCreateDb); - FbException.checkException(status); return result; } @@ -12531,59 +12353,52 @@ public int getClientVersion() return result; } - public IXpbBuilder getXpbBuilder(IStatus status, int kind, byte[] buf, int len) throws FbException + public IXpbBuilder getXpbBuilder(IStatus status, int kind, byte[] buf, int len) { VTable vTable = getVTable(); IXpbBuilder result = vTable.getXpbBuilder.invoke(this, status, kind, buf, len); - FbException.checkException(status); return result; } - public int setOffsets(IStatus status, IMessageMetadata metadata, IOffsetsCallback callback) throws FbException + public int setOffsets(IStatus status, IMessageMetadata metadata, IOffsetsCallback callback) { VTable vTable = getVTable(); int result = vTable.setOffsets.invoke(this, status, metadata, callback); - FbException.checkException(status); return result; } - public IEventBlock createEventBlock(IStatus status, String[] events) throws FbException + public IEventBlock createEventBlock(IStatus status, String[] events) { VTable vTable = getVTable(); IEventBlock result = vTable.createEventBlock.invoke(this, status, events); - FbException.checkException(status); return result; } - public IDecFloat16 getDecFloat16(IStatus status) throws FbException + public IDecFloat16 getDecFloat16(IStatus status) { VTable vTable = getVTable(); IDecFloat16 result = vTable.getDecFloat16.invoke(this, status); - FbException.checkException(status); return result; } - public IDecFloat34 getDecFloat34(IStatus status) throws FbException + public IDecFloat34 getDecFloat34(IStatus status) { VTable vTable = getVTable(); IDecFloat34 result = vTable.getDecFloat34.invoke(this, status); - FbException.checkException(status); return result; } - public ITransaction getTransactionByHandle(IStatus status, com.sun.jna.ptr.LongByReference hndlPtr) throws FbException + public ITransaction getTransactionByHandle(IStatus status, com.sun.jna.ptr.LongByReference hndlPtr) { VTable vTable = getVTable(); ITransaction result = vTable.getTransactionByHandle.invoke(this, status, hndlPtr); - FbException.checkException(status); return result; } - public IStatement getStatementByHandle(IStatus status, com.sun.jna.ptr.LongByReference hndlPtr) throws FbException + public IStatement getStatementByHandle(IStatus status, com.sun.jna.ptr.LongByReference hndlPtr) { VTable vTable = getVTable(); IStatement result = vTable.getStatementByHandle.invoke(this, status, hndlPtr); - FbException.checkException(status); return result; } } @@ -12616,7 +12431,7 @@ public void invoke(IOffsetsCallback self, IStatus status, int index, int offset, } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -12655,11 +12470,10 @@ protected VTable createVTable() return new VTable(cloopVTable); } - public void setOffset(IStatus status, int index, int offset, int nullOffset) throws FbException + public void setOffset(IStatus status, int index, int offset, int nullOffset) { VTable vTable = getVTable(); vTable.setOffset.invoke(this, status, index, offset, nullOffset); - FbException.checkException(status); } } @@ -12786,7 +12600,7 @@ public void invoke(IXpbBuilder self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -12801,7 +12615,7 @@ public void invoke(IXpbBuilder self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -12816,7 +12630,7 @@ public void invoke(IXpbBuilder self, IStatus status, byte tag, int value) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -12831,7 +12645,7 @@ public void invoke(IXpbBuilder self, IStatus status, byte tag, long value) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -12846,7 +12660,7 @@ public void invoke(IXpbBuilder self, IStatus status, byte tag, com.sun.jna.Point } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -12861,7 +12675,7 @@ public void invoke(IXpbBuilder self, IStatus status, byte tag, String str) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -12876,7 +12690,7 @@ public void invoke(IXpbBuilder self, IStatus status, byte tag) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -12891,7 +12705,7 @@ public boolean invoke(IXpbBuilder self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return false; } } @@ -12907,7 +12721,7 @@ public void invoke(IXpbBuilder self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -12922,7 +12736,7 @@ public void invoke(IXpbBuilder self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -12937,7 +12751,7 @@ public boolean invoke(IXpbBuilder self, IStatus status, byte tag) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return false; } } @@ -12953,7 +12767,7 @@ public boolean invoke(IXpbBuilder self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return false; } } @@ -12969,7 +12783,7 @@ public byte invoke(IXpbBuilder self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return (byte) 0; } } @@ -12985,7 +12799,7 @@ public int invoke(IXpbBuilder self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return 0; } } @@ -13001,7 +12815,7 @@ public int invoke(IXpbBuilder self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return 0; } } @@ -13017,7 +12831,7 @@ public long invoke(IXpbBuilder self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return 0; } } @@ -13033,7 +12847,7 @@ public String invoke(IXpbBuilder self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -13049,7 +12863,7 @@ public com.sun.jna.Pointer invoke(IXpbBuilder self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -13065,7 +12879,7 @@ public int invoke(IXpbBuilder self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return 0; } } @@ -13081,7 +12895,7 @@ public com.sun.jna.Pointer invoke(IXpbBuilder self, IStatus status) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -13140,154 +12954,134 @@ protected VTable createVTable() return new VTable(cloopVTable); } - public void clear(IStatus status) throws FbException + public void clear(IStatus status) { VTable vTable = getVTable(); vTable.clear.invoke(this, status); - FbException.checkException(status); } - public void removeCurrent(IStatus status) throws FbException + public void removeCurrent(IStatus status) { VTable vTable = getVTable(); vTable.removeCurrent.invoke(this, status); - FbException.checkException(status); } - public void insertInt(IStatus status, byte tag, int value) throws FbException + public void insertInt(IStatus status, byte tag, int value) { VTable vTable = getVTable(); vTable.insertInt.invoke(this, status, tag, value); - FbException.checkException(status); } - public void insertBigInt(IStatus status, byte tag, long value) throws FbException + public void insertBigInt(IStatus status, byte tag, long value) { VTable vTable = getVTable(); vTable.insertBigInt.invoke(this, status, tag, value); - FbException.checkException(status); } - public void insertBytes(IStatus status, byte tag, com.sun.jna.Pointer bytes, int length) throws FbException + public void insertBytes(IStatus status, byte tag, com.sun.jna.Pointer bytes, int length) { VTable vTable = getVTable(); vTable.insertBytes.invoke(this, status, tag, bytes, length); - FbException.checkException(status); } - public void insertString(IStatus status, byte tag, String str) throws FbException + public void insertString(IStatus status, byte tag, String str) { VTable vTable = getVTable(); vTable.insertString.invoke(this, status, tag, str); - FbException.checkException(status); } - public void insertTag(IStatus status, byte tag) throws FbException + public void insertTag(IStatus status, byte tag) { VTable vTable = getVTable(); vTable.insertTag.invoke(this, status, tag); - FbException.checkException(status); } - public boolean isEof(IStatus status) throws FbException + public boolean isEof(IStatus status) { VTable vTable = getVTable(); boolean result = vTable.isEof.invoke(this, status); - FbException.checkException(status); return result; } - public void moveNext(IStatus status) throws FbException + public void moveNext(IStatus status) { VTable vTable = getVTable(); vTable.moveNext.invoke(this, status); - FbException.checkException(status); } - public void rewind(IStatus status) throws FbException + public void rewind(IStatus status) { VTable vTable = getVTable(); vTable.rewind.invoke(this, status); - FbException.checkException(status); } - public boolean findFirst(IStatus status, byte tag) throws FbException + public boolean findFirst(IStatus status, byte tag) { VTable vTable = getVTable(); boolean result = vTable.findFirst.invoke(this, status, tag); - FbException.checkException(status); return result; } - public boolean findNext(IStatus status) throws FbException + public boolean findNext(IStatus status) { VTable vTable = getVTable(); boolean result = vTable.findNext.invoke(this, status); - FbException.checkException(status); return result; } - public byte getTag(IStatus status) throws FbException + public byte getTag(IStatus status) { VTable vTable = getVTable(); byte result = vTable.getTag.invoke(this, status); - FbException.checkException(status); return result; } - public int getLength(IStatus status) throws FbException + public int getLength(IStatus status) { VTable vTable = getVTable(); int result = vTable.getLength.invoke(this, status); - FbException.checkException(status); return result; } - public int getInt(IStatus status) throws FbException + public int getInt(IStatus status) { VTable vTable = getVTable(); int result = vTable.getInt.invoke(this, status); - FbException.checkException(status); return result; } - public long getBigInt(IStatus status) throws FbException + public long getBigInt(IStatus status) { VTable vTable = getVTable(); long result = vTable.getBigInt.invoke(this, status); - FbException.checkException(status); return result; } - public String getString(IStatus status) throws FbException + public String getString(IStatus status) { VTable vTable = getVTable(); String result = vTable.getString.invoke(this, status); - FbException.checkException(status); return result; } - public com.sun.jna.Pointer getBytes(IStatus status) throws FbException + public com.sun.jna.Pointer getBytes(IStatus status) { VTable vTable = getVTable(); com.sun.jna.Pointer result = vTable.getBytes.invoke(this, status); - FbException.checkException(status); return result; } - public int getBufferLength(IStatus status) throws FbException + public int getBufferLength(IStatus status) { VTable vTable = getVTable(); int result = vTable.getBufferLength.invoke(this, status); - FbException.checkException(status); return result; } - public com.sun.jna.Pointer getBuffer(IStatus status) throws FbException + public com.sun.jna.Pointer getBuffer(IStatus status) { VTable vTable = getVTable(); com.sun.jna.Pointer result = vTable.getBuffer.invoke(this, status); - FbException.checkException(status); return result; } } @@ -13844,7 +13638,7 @@ public String invoke(ITraceParams self, IStatus status, int idx) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -13900,11 +13694,10 @@ public com.sun.jna.Pointer getParam(int idx) return result; } - public String getTextUTF8(IStatus status, int idx) throws FbException + public String getTextUTF8(IStatus status, int idx) { VTable vTable = getVTable(); String result = vTable.getTextUTF8.invoke(this, status, idx); - FbException.checkException(status); return result; } } @@ -16120,7 +15913,7 @@ public ITracePlugin invoke(ITraceFactory self, IStatus status, ITraceInitInfo in } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -16168,11 +15961,10 @@ public long trace_needs() return result; } - public ITracePlugin trace_create(IStatus status, ITraceInitInfo init_info) throws FbException + public ITracePlugin trace_create(IStatus status, ITraceInitInfo init_info) { VTable vTable = getVTable(); ITracePlugin result = vTable.trace_create.invoke(this, status, init_info); - FbException.checkException(status); return result; } } @@ -16210,7 +16002,7 @@ public void invoke(IUdrFunctionFactory self, IStatus status, IExternalContext co } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -16225,7 +16017,7 @@ public IExternalFunction invoke(IUdrFunctionFactory self, IStatus status, IExter } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -16266,18 +16058,16 @@ protected VTable createVTable() return new VTable(cloopVTable); } - public void setup(IStatus status, IExternalContext context, IRoutineMetadata metadata, IMetadataBuilder inBuilder, IMetadataBuilder outBuilder) throws FbException + public void setup(IStatus status, IExternalContext context, IRoutineMetadata metadata, IMetadataBuilder inBuilder, IMetadataBuilder outBuilder) { VTable vTable = getVTable(); vTable.setup.invoke(this, status, context, metadata, inBuilder, outBuilder); - FbException.checkException(status); } - public IExternalFunction newItem(IStatus status, IExternalContext context, IRoutineMetadata metadata) throws FbException + public IExternalFunction newItem(IStatus status, IExternalContext context, IRoutineMetadata metadata) { VTable vTable = getVTable(); IExternalFunction result = vTable.newItem.invoke(this, status, context, metadata); - FbException.checkException(status); return result; } } @@ -16315,7 +16105,7 @@ public void invoke(IUdrProcedureFactory self, IStatus status, IExternalContext c } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -16330,7 +16120,7 @@ public IExternalProcedure invoke(IUdrProcedureFactory self, IStatus status, IExt } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -16371,18 +16161,16 @@ protected VTable createVTable() return new VTable(cloopVTable); } - public void setup(IStatus status, IExternalContext context, IRoutineMetadata metadata, IMetadataBuilder inBuilder, IMetadataBuilder outBuilder) throws FbException + public void setup(IStatus status, IExternalContext context, IRoutineMetadata metadata, IMetadataBuilder inBuilder, IMetadataBuilder outBuilder) { VTable vTable = getVTable(); vTable.setup.invoke(this, status, context, metadata, inBuilder, outBuilder); - FbException.checkException(status); } - public IExternalProcedure newItem(IStatus status, IExternalContext context, IRoutineMetadata metadata) throws FbException + public IExternalProcedure newItem(IStatus status, IExternalContext context, IRoutineMetadata metadata) { VTable vTable = getVTable(); IExternalProcedure result = vTable.newItem.invoke(this, status, context, metadata); - FbException.checkException(status); return result; } } @@ -16420,7 +16208,7 @@ public void invoke(IUdrTriggerFactory self, IStatus status, IExternalContext con } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -16435,7 +16223,7 @@ public IExternalTrigger invoke(IUdrTriggerFactory self, IStatus status, IExterna } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); return null; } } @@ -16476,18 +16264,16 @@ protected VTable createVTable() return new VTable(cloopVTable); } - public void setup(IStatus status, IExternalContext context, IRoutineMetadata metadata, IMetadataBuilder fieldsBuilder) throws FbException + public void setup(IStatus status, IExternalContext context, IRoutineMetadata metadata, IMetadataBuilder fieldsBuilder) { VTable vTable = getVTable(); vTable.setup.invoke(this, status, context, metadata, fieldsBuilder); - FbException.checkException(status); } - public IExternalTrigger newItem(IStatus status, IExternalContext context, IRoutineMetadata metadata) throws FbException + public IExternalTrigger newItem(IStatus status, IExternalContext context, IRoutineMetadata metadata) { VTable vTable = getVTable(); IExternalTrigger result = vTable.newItem.invoke(this, status, context, metadata); - FbException.checkException(status); return result; } } @@ -16543,7 +16329,7 @@ public void invoke(IUdrPlugin self, IStatus status, String name, IUdrFunctionFac } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -16558,7 +16344,7 @@ public void invoke(IUdrPlugin self, IStatus status, String name, IUdrProcedureFa } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -16573,7 +16359,7 @@ public void invoke(IUdrPlugin self, IStatus status, String name, IUdrTriggerFact } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -16622,25 +16408,22 @@ public IMaster getMaster() return result; } - public void registerFunction(IStatus status, String name, IUdrFunctionFactory factory) throws FbException + public void registerFunction(IStatus status, String name, IUdrFunctionFactory factory) { VTable vTable = getVTable(); vTable.registerFunction.invoke(this, status, name, factory); - FbException.checkException(status); } - public void registerProcedure(IStatus status, String name, IUdrProcedureFactory factory) throws FbException + public void registerProcedure(IStatus status, String name, IUdrProcedureFactory factory) { VTable vTable = getVTable(); vTable.registerProcedure.invoke(this, status, name, factory); - FbException.checkException(status); } - public void registerTrigger(IStatus status, String name, IUdrTriggerFactory factory) throws FbException + public void registerTrigger(IStatus status, String name, IUdrTriggerFactory factory) { VTable vTable = getVTable(); vTable.registerTrigger.invoke(this, status, name, factory); - FbException.checkException(status); } } @@ -16695,7 +16478,7 @@ public void invoke(IDecFloat16 self, IStatus status, FB_DEC16[] from, int buffer } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -16718,7 +16501,7 @@ public void invoke(IDecFloat16 self, IStatus status, String from, FB_DEC16[] to) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -16766,11 +16549,10 @@ public void toBcd(FB_DEC16[] from, com.sun.jna.Pointer sign, byte[] bcd, com.sun vTable.toBcd.invoke(this, from, sign, bcd, exp); } - public void toString(IStatus status, FB_DEC16[] from, int bufferLength, com.sun.jna.Pointer buffer) throws FbException + public void toString(IStatus status, FB_DEC16[] from, int bufferLength, com.sun.jna.Pointer buffer) { VTable vTable = getVTable(); vTable.toString.invoke(this, status, from, bufferLength, buffer); - FbException.checkException(status); } public void fromBcd(int sign, byte[] bcd, int exp, FB_DEC16[] to) @@ -16779,11 +16561,10 @@ public void fromBcd(int sign, byte[] bcd, int exp, FB_DEC16[] to) vTable.fromBcd.invoke(this, sign, bcd, exp, to); } - public void fromString(IStatus status, String from, FB_DEC16[] to) throws FbException + public void fromString(IStatus status, String from, FB_DEC16[] to) { VTable vTable = getVTable(); vTable.fromString.invoke(this, status, from, to); - FbException.checkException(status); } } @@ -16838,7 +16619,7 @@ public void invoke(IDecFloat34 self, IStatus status, FB_DEC34[] from, int buffer } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -16861,7 +16642,7 @@ public void invoke(IDecFloat34 self, IStatus status, String from, FB_DEC34[] to) } catch (Throwable t) { - FbException.catchException(status, t); + FbInterfaceException.catchException(status, t); } } }; @@ -16909,11 +16690,10 @@ public void toBcd(FB_DEC34[] from, com.sun.jna.Pointer sign, byte[] bcd, com.sun vTable.toBcd.invoke(this, from, sign, bcd, exp); } - public void toString(IStatus status, FB_DEC34[] from, int bufferLength, com.sun.jna.Pointer buffer) throws FbException + public void toString(IStatus status, FB_DEC34[] from, int bufferLength, com.sun.jna.Pointer buffer) { VTable vTable = getVTable(); vTable.toString.invoke(this, status, from, bufferLength, buffer); - FbException.checkException(status); } public void fromBcd(int sign, byte[] bcd, int exp, FB_DEC34[] to) @@ -16922,11 +16702,10 @@ public void fromBcd(int sign, byte[] bcd, int exp, FB_DEC34[] to) vTable.fromBcd.invoke(this, sign, bcd, exp, to); } - public void fromString(IStatus status, String from, FB_DEC34[] to) throws FbException + public void fromString(IStatus status, String from, FB_DEC34[] to) { VTable vTable = getVTable(); vTable.fromString.invoke(this, status, from, to); - FbException.checkException(status); } } @@ -19470,4 +19249,440 @@ public int getCryptoObjects(int type, IListCryptoObjects callback) return result; } } + + public static class ILdapPlugin extends IReferenceCounted implements ILdapPluginIntf + { + public static class VTable extends IReferenceCounted.VTable + { + public static interface Callback_connect extends com.sun.jna.Callback + { + public void invoke(ILdapPlugin self); + } + + public static interface Callback_is_connected extends com.sun.jna.Callback + { + public boolean invoke(ILdapPlugin self); + } + + public static interface Callback_bind extends com.sun.jna.Callback + { + public boolean invoke(ILdapPlugin self); + } + + public static interface Callback_bind_as extends com.sun.jna.Callback + { + public boolean invoke(ILdapPlugin self, String user, String password); + } + + public static interface Callback_find_user extends com.sun.jna.Callback + { + public boolean invoke(ILdapPlugin self, String name, com.sun.jna.Pointer password, com.sun.jna.Pointer mf_password, com.sun.jna.Pointer hash_alg); + } + + public static interface Callback_find_srp_user extends com.sun.jna.Callback + { + public boolean invoke(ILdapPlugin self, String name, com.sun.jna.Pointer verifier, com.sun.jna.Pointer salt); + } + + public static interface Callback_get_certificate extends com.sun.jna.Callback + { + public int invoke(ILdapPlugin self, String name, com.sun.jna.Pointer buffer, com.sun.jna.Pointer buffer_length, String attr_name); + } + + public static interface Callback_get_user_attr extends com.sun.jna.Callback + { + public boolean invoke(ILdapPlugin self, String name, String attr, com.sun.jna.Pointer value); + } + + public static interface Callback_get_policy extends com.sun.jna.Callback + { + public boolean invoke(ILdapPlugin self, String name, com.sun.jna.Pointer policy, ISC_TIMESTAMP[] passwd_time, com.sun.jna.Pointer failed_count, ISC_TIMESTAMP[] access_time); + } + + public static interface Callback_set_policy extends com.sun.jna.Callback + { + public boolean invoke(ILdapPlugin self, String name, String policy, ISC_TIMESTAMP[] passwd_time, com.sun.jna.Pointer failed_count, ISC_TIMESTAMP[] access_time); + } + + public static interface Callback_get_password_history extends com.sun.jna.Callback + { + public boolean invoke(ILdapPlugin self, String name, com.sun.jna.Pointer buffer, com.sun.jna.Pointer buffer_length); + } + + public static interface Callback_find_user_groups extends com.sun.jna.Callback + { + public void invoke(ILdapPlugin self, com.sun.jna.Pointer userId); + } + + public static interface Callback_change_legacy_password extends com.sun.jna.Callback + { + public int invoke(ILdapPlugin self, String name, String password, boolean[] active); + } + + public static interface Callback_change_mf_password extends com.sun.jna.Callback + { + public int invoke(ILdapPlugin self, String name, String password, com.sun.jna.Pointer hash, boolean[] active); + } + + public static interface Callback_change_srp_password extends com.sun.jna.Callback + { + public int invoke(ILdapPlugin self, String name, String password, com.sun.jna.Pointer verifier, com.sun.jna.Pointer salt, boolean[] active); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final ILdapPluginIntf obj) + { + super(obj); + + connect = new Callback_connect() { + @Override + public void invoke(ILdapPlugin self) + { + obj.connect(); + } + }; + + is_connected = new Callback_is_connected() { + @Override + public boolean invoke(ILdapPlugin self) + { + return obj.is_connected(); + } + }; + + bind = new Callback_bind() { + @Override + public boolean invoke(ILdapPlugin self) + { + return obj.bind(); + } + }; + + bind_as = new Callback_bind_as() { + @Override + public boolean invoke(ILdapPlugin self, String user, String password) + { + return obj.bind_as(user, password); + } + }; + + find_user = new Callback_find_user() { + @Override + public boolean invoke(ILdapPlugin self, String name, com.sun.jna.Pointer password, com.sun.jna.Pointer mf_password, com.sun.jna.Pointer hash_alg) + { + return obj.find_user(name, password, mf_password, hash_alg); + } + }; + + find_srp_user = new Callback_find_srp_user() { + @Override + public boolean invoke(ILdapPlugin self, String name, com.sun.jna.Pointer verifier, com.sun.jna.Pointer salt) + { + return obj.find_srp_user(name, verifier, salt); + } + }; + + get_certificate = new Callback_get_certificate() { + @Override + public int invoke(ILdapPlugin self, String name, com.sun.jna.Pointer buffer, com.sun.jna.Pointer buffer_length, String attr_name) + { + return obj.get_certificate(name, buffer, buffer_length, attr_name); + } + }; + + get_user_attr = new Callback_get_user_attr() { + @Override + public boolean invoke(ILdapPlugin self, String name, String attr, com.sun.jna.Pointer value) + { + return obj.get_user_attr(name, attr, value); + } + }; + + get_policy = new Callback_get_policy() { + @Override + public boolean invoke(ILdapPlugin self, String name, com.sun.jna.Pointer policy, ISC_TIMESTAMP[] passwd_time, com.sun.jna.Pointer failed_count, ISC_TIMESTAMP[] access_time) + { + return obj.get_policy(name, policy, passwd_time, failed_count, access_time); + } + }; + + set_policy = new Callback_set_policy() { + @Override + public boolean invoke(ILdapPlugin self, String name, String policy, ISC_TIMESTAMP[] passwd_time, com.sun.jna.Pointer failed_count, ISC_TIMESTAMP[] access_time) + { + return obj.set_policy(name, policy, passwd_time, failed_count, access_time); + } + }; + + get_password_history = new Callback_get_password_history() { + @Override + public boolean invoke(ILdapPlugin self, String name, com.sun.jna.Pointer buffer, com.sun.jna.Pointer buffer_length) + { + return obj.get_password_history(name, buffer, buffer_length); + } + }; + + find_user_groups = new Callback_find_user_groups() { + @Override + public void invoke(ILdapPlugin self, com.sun.jna.Pointer userId) + { + obj.find_user_groups(userId); + } + }; + + change_legacy_password = new Callback_change_legacy_password() { + @Override + public int invoke(ILdapPlugin self, String name, String password, boolean[] active) + { + return obj.change_legacy_password(name, password, active); + } + }; + + change_mf_password = new Callback_change_mf_password() { + @Override + public int invoke(ILdapPlugin self, String name, String password, com.sun.jna.Pointer hash, boolean[] active) + { + return obj.change_mf_password(name, password, hash, active); + } + }; + + change_srp_password = new Callback_change_srp_password() { + @Override + public int invoke(ILdapPlugin self, String name, String password, com.sun.jna.Pointer verifier, com.sun.jna.Pointer salt, boolean[] active) + { + return obj.change_srp_password(name, password, verifier, salt, active); + } + }; + } + + public VTable() + { + } + + public Callback_connect connect; + public Callback_is_connected is_connected; + public Callback_bind bind; + public Callback_bind_as bind_as; + public Callback_find_user find_user; + public Callback_find_srp_user find_srp_user; + public Callback_get_certificate get_certificate; + public Callback_get_user_attr get_user_attr; + public Callback_get_policy get_policy; + public Callback_set_policy set_policy; + public Callback_get_password_history get_password_history; + public Callback_find_user_groups find_user_groups; + public Callback_change_legacy_password change_legacy_password; + public Callback_change_mf_password change_mf_password; + public Callback_change_srp_password change_srp_password; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("connect", "is_connected", "bind", "bind_as", "find_user", "find_srp_user", "get_certificate", "get_user_attr", "get_policy", "set_policy", "get_password_history", "find_user_groups", "change_legacy_password", "change_mf_password", "change_srp_password")); + return fields; + } + } + + public ILdapPlugin() + { + } + + public ILdapPlugin(final ILdapPluginIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public void connect() + { + VTable vTable = getVTable(); + vTable.connect.invoke(this); + } + + public boolean is_connected() + { + VTable vTable = getVTable(); + boolean result = vTable.is_connected.invoke(this); + return result; + } + + public boolean bind() + { + VTable vTable = getVTable(); + boolean result = vTable.bind.invoke(this); + return result; + } + + public boolean bind_as(String user, String password) + { + VTable vTable = getVTable(); + boolean result = vTable.bind_as.invoke(this, user, password); + return result; + } + + public boolean find_user(String name, com.sun.jna.Pointer password, com.sun.jna.Pointer mf_password, com.sun.jna.Pointer hash_alg) + { + VTable vTable = getVTable(); + boolean result = vTable.find_user.invoke(this, name, password, mf_password, hash_alg); + return result; + } + + public boolean find_srp_user(String name, com.sun.jna.Pointer verifier, com.sun.jna.Pointer salt) + { + VTable vTable = getVTable(); + boolean result = vTable.find_srp_user.invoke(this, name, verifier, salt); + return result; + } + + public int get_certificate(String name, com.sun.jna.Pointer buffer, com.sun.jna.Pointer buffer_length, String attr_name) + { + VTable vTable = getVTable(); + int result = vTable.get_certificate.invoke(this, name, buffer, buffer_length, attr_name); + return result; + } + + public boolean get_user_attr(String name, String attr, com.sun.jna.Pointer value) + { + VTable vTable = getVTable(); + boolean result = vTable.get_user_attr.invoke(this, name, attr, value); + return result; + } + + public boolean get_policy(String name, com.sun.jna.Pointer policy, ISC_TIMESTAMP[] passwd_time, com.sun.jna.Pointer failed_count, ISC_TIMESTAMP[] access_time) + { + VTable vTable = getVTable(); + boolean result = vTable.get_policy.invoke(this, name, policy, passwd_time, failed_count, access_time); + return result; + } + + public boolean set_policy(String name, String policy, ISC_TIMESTAMP[] passwd_time, com.sun.jna.Pointer failed_count, ISC_TIMESTAMP[] access_time) + { + VTable vTable = getVTable(); + boolean result = vTable.set_policy.invoke(this, name, policy, passwd_time, failed_count, access_time); + return result; + } + + public boolean get_password_history(String name, com.sun.jna.Pointer buffer, com.sun.jna.Pointer buffer_length) + { + VTable vTable = getVTable(); + boolean result = vTable.get_password_history.invoke(this, name, buffer, buffer_length); + return result; + } + + public void find_user_groups(com.sun.jna.Pointer userId) + { + VTable vTable = getVTable(); + vTable.find_user_groups.invoke(this, userId); + } + + public int change_legacy_password(String name, String password, boolean[] active) + { + VTable vTable = getVTable(); + int result = vTable.change_legacy_password.invoke(this, name, password, active); + return result; + } + + public int change_mf_password(String name, String password, com.sun.jna.Pointer hash, boolean[] active) + { + VTable vTable = getVTable(); + int result = vTable.change_mf_password.invoke(this, name, password, hash, active); + return result; + } + + public int change_srp_password(String name, String password, com.sun.jna.Pointer verifier, com.sun.jna.Pointer salt, boolean[] active) + { + VTable vTable = getVTable(); + int result = vTable.change_srp_password.invoke(this, name, password, verifier, salt, active); + return result; + } + } + + public static class ILdapFactory extends IPluginBase implements ILdapFactoryIntf + { + public static class VTable extends IPluginBase.VTable + { + public static interface Callback_getLdapPlugin extends com.sun.jna.Callback + { + public ILdapPlugin invoke(ILdapFactory self, IStatus status); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final ILdapFactoryIntf obj) + { + super(obj); + + getLdapPlugin = new Callback_getLdapPlugin() { + @Override + public ILdapPlugin invoke(ILdapFactory self, IStatus status) + { + try + { + return obj.getLdapPlugin(status); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + return null; + } + } + }; + } + + public VTable() + { + } + + public Callback_getLdapPlugin getLdapPlugin; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("getLdapPlugin")); + return fields; + } + } + + public ILdapFactory() + { + } + + public ILdapFactory(final ILdapFactoryIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public ILdapPlugin getLdapPlugin(IStatus status) + { + VTable vTable = getVTable(); + ILdapPlugin result = vTable.getLdapPlugin.invoke(this, status); + return result; + } + } } diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbInterfaceException.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbInterfaceException.java new file mode 100644 index 0000000000..eca9abc958 --- /dev/null +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbInterfaceException.java @@ -0,0 +1,29 @@ +package org.firebirdsql.nativeoo.gds.ng; + +/** + * Class with for wrapping an exception thrown by the native interface. + * + * @since 4.0 + */ +public class FbInterfaceException { + public static void catchException(FbInterface.IStatus status, Throwable t) { + if (t == null) + return; + java.io.StringWriter sw = new java.io.StringWriter(); + java.io.PrintWriter pw = new java.io.PrintWriter(sw); + t.printStackTrace(pw); + String msg = sw.toString(); + try (CloseableMemory memory = new CloseableMemory(msg.length())) { + memory.setString(0, msg); + com.sun.jna.Pointer[] vector = new com.sun.jna.Pointer[]{ + new com.sun.jna.Pointer(org.firebirdsql.gds.ISCConstants.isc_arg_gds), + new com.sun.jna.Pointer(org.firebirdsql.gds.ISCConstants.isc_random), + new com.sun.jna.Pointer(org.firebirdsql.gds.ISCConstants.isc_arg_cstring), + new com.sun.jna.Pointer(msg.length()), + memory, + new com.sun.jna.Pointer(org.firebirdsql.gds.ISCConstants.isc_arg_end) + }; + status.setErrors2(vector.length, vector); + } + } +} diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbInterfaceImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbInterfaceImpl.java deleted file mode 100644 index 6f50bd4c27..0000000000 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbInterfaceImpl.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.firebirdsql.nativeoo.gds.ng; - -import org.firebirdsql.nativeoo.gds.ng.FbInterface.IMaster; - -public class FbInterfaceImpl { - public static IMaster getMasterInterface() { - return FbOOClientDatabaseFactory.getInstance().getClientLibrary().fb_get_master_interface(); - } -} diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IBatchCompletionStateImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IBatchCompletionStateImpl.java index 51174a13ea..285e17923f 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IBatchCompletionStateImpl.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IBatchCompletionStateImpl.java @@ -3,7 +3,10 @@ import org.firebirdsql.gds.ng.FbBatchCompletionState; import org.firebirdsql.nativeoo.gds.ng.FbInterface.*; +import java.sql.SQLException; + /** + * Implementation of {@Link FbBatchCompletionState} for native batch execution. * * @author Vasiliy Yashkov * @since 4.0 @@ -22,25 +25,30 @@ public IBatchCompletionStateImpl(IDatabaseImpl database, IBatchCompletionState s } @Override - public int getSize() throws FbException { - return state.getSize(status); + public int getSize() throws SQLException { + int result = state.getSize(getStatus()); + processStatus(); + return result; } @Override - public int getState(int index) throws FbException { - return state.getState(status, index); + public int getState(int index) throws SQLException { + int result = state.getState(getStatus(), index); + processStatus(); + return result; } @Override - public String getError(int index) throws FbException { + public String getError(int index) throws SQLException { if (state.findError(status, index) != FbBatchCompletionState.NO_MORE_ERRORS) { StringBuilder builder = new StringBuilder(); IStatus errorStatus = database.getMaster().getStatus(); - state.getStatus(status, errorStatus, index); + state.getStatus(getStatus(), errorStatus, index); + processStatus(); try (CloseableMemory memory = new CloseableMemory(1024)) { util.formatStatus(memory, (int) memory.size() - 1, errorStatus); - builder.append(memory.getString(0)); + builder.append(memory.getString(0, getDatabase().getEncoding().getCharsetName())); return builder.toString(); } } @@ -48,7 +56,7 @@ public String getError(int index) throws FbException { } @Override - public String getAllStates() throws FbException { + public String printAllStates() throws SQLException { StringBuilder builder = new StringBuilder(); @@ -57,18 +65,20 @@ public String getAllStates() throws FbException { util = database.getMaster().getUtilInterface(); - int updateCount = state.getSize(status); + int updateCount = state.getSize(getStatus()); + processStatus(); int unknownCount = 0; int successCount = 0; for (int p = 0; p < updateCount; ++p) { - int s = state.getState(status, p); + int s = state.getState(getStatus(), p); + processStatus(); switch (s) { case FbBatchCompletionState.EXECUTE_FAILED: if (!print1) { builder.append(String.format("Message Status\n", p)); print1 = true; } - builder.append(String.format("%5d Execute failed\n", p)); + builder.append(String.format("%5d Execute failed\n", p)); break; case FbBatchCompletionState.SUCCESS_NO_INFO: @@ -90,7 +100,8 @@ public String getAllStates() throws FbException { IStatus errorStatus = database.getMaster().getStatus(); for (int p = 0; (p = state.findError(status, p)) != FbBatchCompletionState.NO_MORE_ERRORS; ++p) { - state.getStatus(status, errorStatus, p); + state.getStatus(getStatus(), errorStatus, p); + processStatus(); try (CloseableMemory memory = new CloseableMemory(1024)) { @@ -99,7 +110,8 @@ public String getAllStates() throws FbException { builder.append(String.format("\nDetailed errors status:\n", p)); print2 = true; } - builder.append(String.format("Message %d: %s\n", p, memory.getString(0))); + builder.append(String.format("Message %d: %s\n", p, memory.getString(0, + database.getEncoding().getCharsetName()))); } } @@ -109,4 +121,35 @@ public String getAllStates() throws FbException { return builder.toString(); } + @Override + public int[] getAllStates() throws SQLException { + + util = database.getMaster().getUtilInterface(); + + int updateCount = state.getSize(getStatus()); + processStatus(); + + int[] states = new int[updateCount]; + + for (int p = 0; p < updateCount; ++p) { + states[p] = state.getState(getStatus(), p); + processStatus(); + } + + return states; + } + + private IStatus getStatus() { + status.init(); + return status; + } + + private IDatabaseImpl getDatabase() { + return database; + } + + private void processStatus() throws SQLException { + getDatabase().processStatus(status, null); + } + } diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IBatchImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IBatchImpl.java index 2df27f0c48..1bf4467756 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IBatchImpl.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IBatchImpl.java @@ -3,149 +3,243 @@ import com.sun.jna.ptr.LongByReference; import org.firebirdsql.gds.BatchParameterBuffer; import org.firebirdsql.gds.BlobParameterBuffer; +import org.firebirdsql.gds.impl.GDSHelper; import org.firebirdsql.gds.ng.*; +import org.firebirdsql.gds.ng.fields.RowValue; +import org.firebirdsql.jdbc.FBBlob; +import org.firebirdsql.logging.Logger; +import org.firebirdsql.logging.LoggerFactory; import org.firebirdsql.nativeoo.gds.ng.FbInterface.*; +import java.io.IOException; import java.sql.SQLException; /** + * Implementation of {@link FbBatch} for native OO API. * * @author Vasiliy Yashkov * @since 4.0 */ public class IBatchImpl extends AbstractFbBatch { - private IDatabaseImpl database = null; - private IAttachment attachment = null; - private FbTransaction transaction = null; - private String statement = null; - private IMessageMetadataImpl metadata = null; - private BatchParameterBuffer parameterBuffer; - private IBatch batch = null; - - public IBatchImpl(FbDatabase database, FbTransaction transaction, String statement, FbMessageMetadata metadata, BatchParameterBuffer parameters) throws SQLException { - super(database, transaction, statement, metadata, parameters); + private final IAttachment attachment; + private final BatchParameterBuffer parameterBuffer; + private final IStatus status; + private final String statementText; + private IMessageMetadataImpl metadata; + private IBatch batch; + private IStatementImpl statement; + private IMessageBuilderImpl messageBuilder; + public IBatchImpl(FbDatabase database, FbTransaction transaction, String statementText, FbMessageMetadata metadata, BatchParameterBuffer parameters) throws SQLException { + super(database, parameters); this.transaction = transaction; - this.database = (IDatabaseImpl)database; - this.attachment = this.database.getAttachment(); - this.statement = statement; + this.attachment = getDatabase().getAttachment(); this.metadata = (IMessageMetadataImpl) metadata; + this.statementText = statementText; this.parameterBuffer = parameters; + this.status = getDatabase().getStatus(); init(); } - public IBatchImpl(FbDatabase database, FbTransaction transaction, String statement, BatchParameterBuffer parameters) throws SQLException { - super(database, transaction, statement, parameters); - + public IBatchImpl(FbDatabase database, FbTransaction transaction, String statementText, BatchParameterBuffer parameters) throws SQLException { + super(database, parameters); this.transaction = transaction; - this.database = (IDatabaseImpl)database; - this.attachment = this.database.getAttachment(); - this.statement = statement; + this.attachment = getDatabase().getAttachment(); + this.statementText = statementText; this.parameterBuffer = parameters; + this.status = getDatabase().getStatus(); + metadata = null; init(); } + public IBatchImpl(IBatch batch, IStatementImpl statement, BatchParameterBuffer parameters) throws SQLException { + super(statement.getDatabase(), parameters); + this.transaction = statement.getTransaction(); + this.attachment = getDatabase().getAttachment(); + this.parameterBuffer = parameters; + this.status = getDatabase().getStatus(); + this.batch = batch; + this.statement = statement; + this.statementText = null; + this.messageBuilder = new IMessageBuilderImpl(this); + prepareBatch(); + } + + /** + * If batch is created from a database, + * it is necessary to initialize it to obtain metadata. + * + * @throws SQLException + */ private void init() throws SQLException { - if (metadata == null) { - IStatementImpl statementImpl = new IStatementImpl(database); - statementImpl.setTransaction(transaction); - statementImpl.prepare(statement); - metadata = (IMessageMetadataImpl) statementImpl.getInputMetadata(); - } + synchronized (getSynchronizationObject()) { + if (metadata == null) { + statement = new IStatementImpl(getDatabase()); + statement.setTransaction(transaction); + statement.prepare(statementText); + metadata = (IMessageMetadataImpl) statement.getInputMetadata(); + } - if (parameterBuffer == null) { - batch = attachment.createBatch(database.getStatus(), ((ITransactionImpl) transaction).getTransaction(), statement.length(), - statement, database.getDatabaseDialect(), - metadata.getMetadata(), 0, null); - } else { - batch = attachment.createBatch(database.getStatus(), ((ITransactionImpl) transaction).getTransaction(), statement.length(), - statement, database.getDatabaseDialect(), - metadata.getMetadata(), parameterBuffer.toBytesWithType().length, parameterBuffer.toBytesWithType()); + if (parameterBuffer == null) { + batch = attachment.createBatch(getStatus(), ((ITransactionImpl) transaction).getTransaction(), statementText.length(), + statementText, getDatabase().getDatabaseDialect(), + metadata.getMetadata(), 0, null); + } else { + batch = attachment.createBatch(getStatus(), ((ITransactionImpl) transaction).getTransaction(), statementText.length(), + statementText, getDatabase().getDatabaseDialect(), + metadata.getMetadata(), parameterBuffer.toBytesWithType().length, parameterBuffer.toBytesWithType()); + } + processStatus(); } + this.messageBuilder = new IMessageBuilderImpl(this); + prepareBatch(); } + /** + * Build batch message from field values. + * + * @throws SQLException + */ @Override - public FbTransaction getTransaction() { - return super.getTransaction(); - } - - @Override - public FbDatabase getDatabase() { - return super.getDatabase(); + public void addBatch() throws SQLException { + RowValue fieldValues = getFieldValues(); + for (int i = 0; i < fieldValues.getCount(); i++) { + messageBuilder.addData(i, fieldValues.getFieldData(i), getParameterDescriptor(i + 1)); + } + byte[] data = messageBuilder.getData(); + try (CloseableMemory memory = new CloseableMemory(data.length)) { + synchronized (getSynchronizationObject()) { + memory.write(0, data, 0, data.length); + batch.add(getStatus(), 1, memory); + processStatus(); + messageBuilder.clear(); + } + } + if (messageBuilder.getBlobStreamData().length != 0) { + addBlobStream(messageBuilder.getBlobStreamData()); + messageBuilder.clearBlobStream(); + } } @Override - public void add(int count, byte[] inBuffer) throws SQLException { - try (CloseableMemory memory = new CloseableMemory(inBuffer.length)) { - memory.write(0, inBuffer, 0, inBuffer.length); - batch.add(database.getStatus(), count, memory); - } + public void addBlob(int index, long blobId) throws SQLException { + FBBlob tmpBlob = new FBBlob(new GDSHelper(getDatabase()), blobId); + setBlob(index, tmpBlob); + tmpBlob.free(); } /* * Before use, сheck the buffer contains BLOB_ID_ENGINE that blob ID will be generated by engine */ @Override - public FbBlob addBlob(byte[] inBuffer, BlobParameterBuffer buffer) throws SQLException { - return addBlob(inBuffer, 0, buffer); + public FbBlob addBlob(int index, byte[] inBuffer, BlobParameterBuffer buffer) throws SQLException { + return addBlob(index, inBuffer, 0, buffer); } @Override - public FbBlob addBlob(byte[] inBuffer, long blobId, BlobParameterBuffer buffer) throws SQLException { + public FbBlob addBlob(int index, byte[] inBuffer, long blobId, BlobParameterBuffer buffer) throws SQLException { try (CloseableMemory memory = new CloseableMemory(inBuffer.length)) { - memory.write(0, inBuffer, 0, inBuffer.length); - LongByReference longByReference = new LongByReference(blobId); - if (buffer == null) - batch.addBlob(database.getStatus(), inBuffer.length, memory, longByReference, 0, null); + if (inBuffer != null) + memory.write(0, inBuffer, 0, inBuffer.length); else - batch.addBlob(database.getStatus(), inBuffer.length, memory, longByReference, buffer.toBytesWithType().length, buffer.toBytesWithType()); + memory.write(0, new byte[] {}, 0, 0); + LongByReference longByReference = new LongByReference(blobId); - return new IBlobImpl(database, (ITransactionImpl) transaction, buffer, longByReference.getValue()); + synchronized (getSynchronizationObject()) { + if (buffer == null) + batch.addBlob(getStatus(), inBuffer.length, memory, longByReference, 0, null); + else + batch.addBlob(getStatus(), inBuffer.length, memory, longByReference, buffer.toBytesWithType().length, buffer.toBytesWithType()); + processStatus(); + } + IBlobImpl blob = new IBlobImpl(getDatabase(), (ITransactionImpl) transaction, buffer, longByReference.getValue()); + FBBlob tmpBlob = new FBBlob(new GDSHelper(getDatabase()), blob.getBlobId()); + setBlob(index, tmpBlob); + return blob; } } + @Override + public void addSegmentedBlob(int index, long blobId, BlobParameterBuffer buffer) throws SQLException, IOException { + messageBuilder.addBlobHeader(blobId, buffer); + addBlob(index, blobId); + } + @Override public void appendBlobData(byte[] inBuffer) throws SQLException { try (CloseableMemory memory = new CloseableMemory(inBuffer.length)) { - memory.write(0, inBuffer, 0, inBuffer.length); - batch.appendBlobData(database.getStatus(), inBuffer.length, memory); + synchronized (getSynchronizationObject()) { + memory.write(0, inBuffer, 0, inBuffer.length); + batch.appendBlobData(getStatus(), inBuffer.length, memory); + processStatus(); + } + } + } + + @Override + public void appendBlobData(byte[] data, long blobId) throws IOException { + messageBuilder.addBlobData(data, blobId); + } + + @Override + public void addBlobSegment(byte[] data, boolean lastSegment) throws IOException, SQLException { + messageBuilder.addBlobSegment(data, lastSegment); + if (lastSegment) { + addBlobStream(messageBuilder.getBlobStreamData()); + messageBuilder.clearBlobStream(); } } @Override public void addBlobStream(byte[] inBuffer) throws SQLException { try (CloseableMemory memory = new CloseableMemory(inBuffer.length)) { - memory.write(0, inBuffer, 0, inBuffer.length); - batch.addBlobStream(database.getStatus(), inBuffer.length, memory); + synchronized (getSynchronizationObject()) { + memory.write(0, inBuffer, 0, inBuffer.length); + batch.addBlobStream(getStatus(), inBuffer.length, memory); + processStatus(); + } } } @Override - public void registerBlob(long existingBlob, long blobId) throws SQLException { + public void registerBlob(int index, long existingBlob, long blobId) throws SQLException { + addBlob(index, blobId); LongByReference longByReference = new LongByReference(blobId); LongByReference existLong = new LongByReference(existingBlob); - batch.registerBlob(database.getStatus(), existLong, longByReference); + synchronized (getSynchronizationObject()) { + batch.registerBlob(getStatus(), existLong, longByReference); + processStatus(); + } } @Override public FbBatchCompletionState execute() throws SQLException { - IBatchCompletionState execute = batch.execute(database.getStatus(), ((ITransactionImpl)transaction).getTransaction()); - - return new IBatchCompletionStateImpl(database, execute, database.getStatus()); + synchronized (getSynchronizationObject()) { + IBatchCompletionState execute = batch.execute(getStatus(), ((ITransactionImpl) transaction).getTransaction()); + processStatus(); + return new IBatchCompletionStateImpl(getDatabase(), execute, getDatabase().getStatus()); + } } @Override public void cancel() throws SQLException { - batch.cancel(database.getStatus()); + synchronized (getSynchronizationObject()) { + batch.cancel(getStatus()); + processStatus(); + } } @Override public int getBlobAlignment() throws SQLException { - return batch.getBlobAlignment(database.getStatus()); + synchronized (getSynchronizationObject()) { + int result = batch.getBlobAlignment(getStatus()); + processStatus(); + return result; + } } @Override @@ -155,6 +249,28 @@ public FbMessageMetadata getMetadata() throws SQLException { @Override public void setDefaultBpb(int parLength, byte[] par) throws SQLException { - batch.setDefaultBpb(database.getStatus(), parLength, par); + synchronized (getSynchronizationObject()) { + batch.setDefaultBpb(getStatus(), parLength, par); + processStatus(); + } + } + + @Override + public FbStatement getStatement() throws SQLException { + return this.statement; + } + + private IStatus getStatus() { + status.init(); + return status; + } + + @Override + public IDatabaseImpl getDatabase() { + return (IDatabaseImpl) super.getDatabase(); + } + + private void processStatus() throws SQLException { + getDatabase().processStatus(status, null); } } diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IBlobImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IBlobImpl.java index 58a32a5b08..98a20cf536 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IBlobImpl.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IBlobImpl.java @@ -25,9 +25,11 @@ public class IBlobImpl extends AbstractFbBlob implements FbBlob, DatabaseListene private final LongByReference blobId; private final boolean outputBlob; + private final IStatus status; private ByteBuffer byteBuffer; private IBlob blob; + public IBlobImpl(IDatabaseImpl database, ITransactionImpl transaction, BlobParameterBuffer blobParameterBuffer) { this(database, transaction, blobParameterBuffer, NO_BLOB_ID); } @@ -37,14 +39,15 @@ public IBlobImpl(IDatabaseImpl database, ITransactionImpl transaction, BlobParam super(database, transaction, blobParameterBuffer); this.blobId = new LongByReference(blobId); outputBlob = blobId == NO_BLOB_ID; + this.status = database.getStatus(); } @Override protected void closeImpl() throws SQLException { synchronized (getSynchronizationObject()) { try { - IDatabaseImpl database = (IDatabaseImpl)getDatabase(); - blob.close(database.getStatus()); + blob.close(getStatus()); + processStatus(); } finally { byteBuffer = null; } @@ -55,8 +58,8 @@ protected void closeImpl() throws SQLException { protected void cancelImpl() throws SQLException { synchronized (getSynchronizationObject()) { try { - IDatabaseImpl database = (IDatabaseImpl)getDatabase(); - blob.cancel(database.getStatus()); + blob.cancel(getStatus()); + processStatus(); } finally { byteBuffer = null; } @@ -95,12 +98,13 @@ public void open() throws SQLException { IDatabaseImpl database = (IDatabaseImpl)getDatabase(); IAttachment attachment = database.getAttachment(); if (isOutput()) { - blob = attachment.createBlob(database.getStatus(), ((ITransactionImpl)getTransaction()).getTransaction(), + blob = attachment.createBlob(getStatus(), ((ITransactionImpl)getTransaction()).getTransaction(), blobId, bpb.length, bpb); } else { - blob = attachment.openBlob(database.getStatus(), ((ITransactionImpl)getTransaction()).getTransaction(), + blob = attachment.openBlob(getStatus(), ((ITransactionImpl)getTransaction()).getTransaction(), blobId, bpb.length, bpb); } + processStatus(); setOpen(true); resetEof(); } @@ -133,10 +137,8 @@ public byte[] getSegment(int sizeRequested) throws SQLException { checkBlobOpen(); responseBuffer = getByteBuffer(sizeRequested); try (CloseableMemory memory = new CloseableMemory(sizeRequested)) { - - IDatabaseImpl database = (IDatabaseImpl) getDatabase(); - IStatus status = database.getStatus(); - int result = blob.getSegment(status, sizeRequested, memory, actualLength); + int result = blob.getSegment(getStatus(), sizeRequested, memory, actualLength); + processStatus(); // result 0 means: more to come, isc_segment means: buffer was too small, // rest will be returned on next call if (!(IStatus.RESULT_OK == result || result == IStatus.RESULT_SEGMENT)) { @@ -175,10 +177,8 @@ public void putSegment(byte[] segment) throws SQLException { try (CloseableMemory memory = new CloseableMemory(segment.length)) { memory.write(0, segment, 0, segment.length); - - IDatabaseImpl database = (IDatabaseImpl) getDatabase(); - IStatus status = database.getStatus(); - blob.putSegment(status, segment.length, memory); + blob.putSegment(getStatus(), segment.length, memory); + processStatus(); } } } catch (SQLException e) { @@ -193,12 +193,10 @@ public void seek(int offset, SeekMode seekMode) throws SQLException { synchronized (getSynchronizationObject()) { checkDatabaseAttached(); checkTransactionActive(); - - IDatabaseImpl database = (IDatabaseImpl)getDatabase(); - IStatus status = database.getStatus(); // result is the current position in the blob // We ignore the result - blob.seek(status, seekMode.getSeekModeId(), offset); + blob.seek(getStatus(), seekMode.getSeekModeId(), offset); + processStatus(); } } catch (SQLException e) { exceptionListenerDispatcher.errorOccurred(e); @@ -213,12 +211,9 @@ public byte[] getBlobInfo(byte[] requestItems, int bufferLength) throws SQLExcep synchronized (getSynchronizationObject()) { checkDatabaseAttached(); checkBlobOpen(); - - IDatabaseImpl database = (IDatabaseImpl)getDatabase(); - IStatus status = database.getStatus(); - blob.getInfo(status, requestItems.length, requestItems, bufferLength, responseArr); + blob.getInfo(getStatus(), requestItems.length, requestItems, bufferLength, responseArr); + processStatus(); } - return responseArr; } catch (SQLException e) { exceptionListenerDispatcher.errorOccurred(e); @@ -234,4 +229,18 @@ private ByteBuffer getByteBuffer(int requiredSize) { } return byteBuffer; } + + private IStatus getStatus() { + status.init(); + return status; + } + + @Override + public IDatabaseImpl getDatabase() { + return (IDatabaseImpl) super.getDatabase(); + } + + private void processStatus() throws SQLException { + getDatabase().processStatus(status, null); + } } diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IDatabaseImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IDatabaseImpl.java index 992cd610a3..33343aff07 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IDatabaseImpl.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IDatabaseImpl.java @@ -34,6 +34,8 @@ public class IDatabaseImpl extends AbstractFbDatabase private final IUtil util; private IAttachment attachment; private IEvents events; + private final IStatus status; + public IDatabaseImpl(NativeDatabaseConnection connection) { super(connection, connection.createDatatypeCoder()); @@ -42,6 +44,7 @@ public IDatabaseImpl(NativeDatabaseConnection connection) { provider = master.getDispatcher(); util = master.getUtilInterface(); attachment = null; + status = master.getStatus(); } /** @@ -69,6 +72,7 @@ protected void internalDetach() throws SQLException { synchronized (getSynchronizationObject()) { try { attachment.detach(getStatus()); + processStatus(); } catch (SQLException e) { throw e; } finally { @@ -114,9 +118,11 @@ public void cancelOperation(int kind) throws SQLException { // No synchronization, otherwise cancel will never work try { attachment.cancelOperation(getStatus(), kind); + processStatus(); } finally { if (kind == fb_cancel_abort) { attachment.detach(getStatus()); + processStatus(); setDetached(); } } @@ -133,7 +139,7 @@ public FbTransaction startTransaction(TransactionParameterBuffer tpb) throws SQL final byte[] tpbArray = tpb.toBytesWithType(); synchronized (getSynchronizationObject()) { ITransaction transaction = attachment.startTransaction(getStatus(), tpbArray.length, tpbArray); - + processStatus(); final ITransactionImpl transactionImpl = new ITransactionImpl(this, transaction, TransactionState.ACTIVE); transactionAdded(transactionImpl); @@ -154,7 +160,7 @@ public FbTransaction reconnectTransaction(long transactionId) throws SQLExceptio synchronized (getSynchronizationObject()) { ITransaction iTransaction = attachment.reconnectTransaction(getStatus(), transactionIdBuffer.length, transactionIdBuffer); - + processStatus(); final ITransactionImpl transaction = new ITransactionImpl(this, iTransaction, TransactionState.PREPARED); transactionAdded(transaction); @@ -211,9 +217,9 @@ public byte[] getDatabaseInfo(byte[] requestItems, int maxBufferLength) throws S synchronized (getSynchronizationObject()) { attachment.getInfo(getStatus(), requestItems.length, requestItems, (short) maxBufferLength, responseArray); } - + processStatus(); return responseArray; - } catch (FbException e) { + } catch (SQLException e) { exceptionListenerDispatcher.errorOccurred(new SQLException(e)); throw new SQLException(e); } @@ -392,6 +398,7 @@ protected void attachOrCreate(final DatabaseParameterBuffer dpb, final boolean c } else { attachment = provider.attachDatabase(getStatus(), dbName, (short) dpbArray.length, dpbArray); } + processStatus(); } catch (SQLException e) { safelyDetach(); throw e; @@ -410,10 +417,23 @@ public IMaster getMaster() { } public IStatus getStatus() { - return master.getStatus(); + status.init(); + return status; } public IAttachment getAttachment() { return attachment; } + + private void processStatus() throws SQLException { + processStatus(status, getDatabaseWarningCallback()); + } + + public void processStatus(IStatus status, WarningMessageCallback warningMessageCallback) + throws SQLException { + if (warningMessageCallback == null) { + warningMessageCallback = getDatabaseWarningCallback(); + } + connection.processStatus(status, warningMessageCallback); + } } diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IEventBlockImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IEventBlockImpl.java index df0c7bc140..67af5eddb9 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IEventBlockImpl.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IEventBlockImpl.java @@ -17,7 +17,7 @@ */ public class IEventBlockImpl extends AbstractEventHandle { - private static final Logger LOG = LoggerFactory.getLogger(IEventBlockImpl.class); + private static final Logger log = LoggerFactory.getLogger(IEventBlockImpl.class); private final CloseableMemory eventNameMemory; private int size = -1; diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IMessageMetadataImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IMessageMetadataImpl.java index 0077f135c2..7f4b20ab27 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IMessageMetadataImpl.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IMessageMetadataImpl.java @@ -4,98 +4,149 @@ import org.firebirdsql.gds.ng.FbMetadataBuilder; import org.firebirdsql.nativeoo.gds.ng.FbInterface.*; +import java.sql.SQLException; + /** + * Implementation of {@link FbMessageMetadata} for native OO API. * * @author Vasiliy Yashkov * @since 4.0 */ public class IMessageMetadataImpl implements FbMessageMetadata { - private IDatabaseImpl database; - private IMetadataBuilderImpl metadataBuilderImpl; - private IMetadataBuilder metadataBuilder; - private IMessageMetadata metadata; - - public IMessageMetadataImpl(FbMetadataBuilder metadataBuilder) throws FbException { + private final IDatabaseImpl database; + private final IMetadataBuilderImpl metadataBuilderImpl; + private final IMetadataBuilder metadataBuilder; + private final IMessageMetadata metadata; + private final IStatus status; + public IMessageMetadataImpl(FbMetadataBuilder metadataBuilder) throws SQLException { this.metadataBuilderImpl = (IMetadataBuilderImpl)metadataBuilder; this.database = (IDatabaseImpl)this.metadataBuilderImpl.getDatabase(); - this.metadataBuilder = this.metadataBuilderImpl.getMetadataBuilder(); - this.metadata = this.metadataBuilder.getMetadata(database.getStatus()); + this.status = this.database.getStatus(); + this.metadata = this.metadataBuilder.getMetadata(getStatus()); + processStatus(); } - public IMessageMetadataImpl(IDatabaseImpl database, IMessageMetadata metadata) throws FbException { + public IMessageMetadataImpl(IDatabaseImpl database, IMessageMetadata metadata) throws SQLException { this.database = database; this.metadata = metadata; + this.status = this.database.getStatus(); + metadataBuilderImpl = null; + metadataBuilder = null; } public IMessageMetadata getMetadata() { return metadata; } - public int getOffset(int index) throws FbException { - return metadata.getOffset(database.getStatus(), index); + public int getOffset(int index) throws SQLException { + int result = metadata.getOffset(getStatus(), index); + processStatus(); + return result; + } + + public int getNullOffset(int index) throws SQLException { + int result = metadata.getNullOffset(getStatus(), index); + processStatus(); + return result; + } + + public int getLength(int index) throws SQLException { + int result = metadata.getLength(getStatus(), index); + processStatus(); + return result; } - public int getNullOffset(int index) throws FbException { - return metadata.getNullOffset(database.getStatus(), index); + public String getAlias(int index) throws SQLException { + String result = metadata.getAlias(getStatus(), index); + processStatus(); + return result; } - public int getLength(int index) throws FbException { - return metadata.getLength(database.getStatus(), index); + public String getField(int index) throws SQLException { + String result = metadata.getField(getStatus(), index); + processStatus(); + return result; } - public String getAlias(int index) throws FbException { - return metadata.getAlias(database.getStatus(), index); + public String getOwner(int index) throws SQLException { + String result = metadata.getOwner(getStatus(), index); + processStatus(); + return result; } - public String getField(int index) throws FbException { - return metadata.getField(database.getStatus(), index); + public String getRelation(int index) throws SQLException { + String result = metadata.getRelation(getStatus(), index); + processStatus(); + return result; } - public String getOwner(int index) throws FbException { - return metadata.getOwner(database.getStatus(), index); + public int getAlignedLength() throws SQLException { + int result = metadata.getAlignedLength(getStatus()); + processStatus(); + return result; } - public String getRelation(int index) throws FbException { - return metadata.getRelation(database.getStatus(), index); + public int getAlignment() throws SQLException { + int result = metadata.getAlignment(getStatus()); + processStatus(); + return result; } - public int getAlignedLength() throws FbException { - return metadata.getAlignedLength(database.getStatus()); + public int getCount() throws SQLException { + int result = metadata.getCount(getStatus()); + processStatus(); + return result; } - public int getAlignment() throws FbException { - return metadata.getAlignment(database.getStatus()); + public int getCharSet(int index) throws SQLException { + int result = metadata.getCharSet(getStatus(), index); + processStatus(); + return result; } - public int getCount() throws FbException { - return metadata.getCount(database.getStatus()); + public int getMessageLength() throws SQLException { + int result = metadata.getMessageLength(getStatus()); + processStatus(); + return result; } - public int getCharSet(int index) throws FbException { - return metadata.getCharSet(database.getStatus(), index); + public int getScale(int index) throws SQLException { + int result = metadata.getScale(getStatus(), index); + processStatus(); + return result; } - public int getMessageLength() throws FbException { - return metadata.getMessageLength(database.getStatus()); + public int getSubType(int index) throws SQLException { + int result = metadata.getSubType(getStatus(), index); + processStatus(); + return result; } - public int getScale(int index) throws FbException { - return metadata.getScale(database.getStatus(), index); + public int getType(int index) throws SQLException { + int result = metadata.getType(getStatus(), index); + processStatus(); + return result; } - public int getSubType(int index) throws FbException { - return metadata.getSubType(database.getStatus(), index); + public IMetadataBuilder getBuilder() throws SQLException { + IMetadataBuilder result = metadata.getBuilder(getStatus()); + processStatus(); + return result; } - public int getType(int index) throws FbException { - return metadata.getType(database.getStatus(), index); + private IStatus getStatus() { + status.init(); + return status; } - public IMetadataBuilder getBuilder() throws FbException { - return metadata.getBuilder(database.getStatus()); + private IDatabaseImpl getDatabase() { + return database; } + private void processStatus() throws SQLException { + getDatabase().processStatus(status, null); + } } diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IMetadataBuilderImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IMetadataBuilderImpl.java index f428cc3fc4..2710642283 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IMetadataBuilderImpl.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IMetadataBuilderImpl.java @@ -5,6 +5,8 @@ import org.firebirdsql.gds.ng.FbMetadataBuilder; import org.firebirdsql.nativeoo.gds.ng.FbInterface.*; +import java.sql.SQLException; + import static org.firebirdsql.gds.ISCConstants.*; /** @@ -24,7 +26,7 @@ public class IMetadataBuilderImpl implements FbMetadataBuilder { private IMetadataBuilder metadataBuilder; private IMessageMetadata messageMetadata; - public IMetadataBuilderImpl(FbDatabase database, int fieldCount) throws FbException { + public IMetadataBuilderImpl(FbDatabase database, int fieldCount) throws SQLException { this.database = (IDatabaseImpl)database; this.master = this.database.getMaster(); this.status = this.database.getStatus(); @@ -33,7 +35,7 @@ public IMetadataBuilderImpl(FbDatabase database, int fieldCount) throws FbExcept } @Override - public FbMessageMetadata getMessageMetadata() throws FbException { + public FbMessageMetadata getMessageMetadata() throws SQLException { messageMetadata = metadataBuilder.getMetadata(status); IMessageMetadataImpl metadata = new IMessageMetadataImpl(this); @@ -49,39 +51,39 @@ public FbDatabase getDatabase() { return this.database; } - public int addField() throws FbException { + public int addField() throws SQLException { return this.metadataBuilder.addField(status); } @Override - public void addSmallint(int index) throws FbException { + public void addSmallint(int index) throws SQLException { metadataBuilder.setType(status, index, SQL_SHORT); metadataBuilder.setLength(status, index, Short.SIZE / Byte.SIZE); metadataBuilder.setScale(status, index, 0); } @Override - public void addInteger(int index) throws FbException { + public void addInteger(int index) throws SQLException { metadataBuilder.setType(status, index, SQL_LONG); metadataBuilder.setLength(status, index, Integer.SIZE / Byte.SIZE); metadataBuilder.setScale(status, index, 0); } @Override - public void addBigint(int index) throws FbException { + public void addBigint(int index) throws SQLException { metadataBuilder.setType(status, index, SQL_INT64); metadataBuilder.setLength(status, index, Long.SIZE / Byte.SIZE); metadataBuilder.setScale(status, index, 0); } @Override - public void addFloat(int index) throws FbException { + public void addFloat(int index) throws SQLException { metadataBuilder.setType(status, index, SQL_FLOAT); metadataBuilder.setLength(status, index, Float.SIZE / Byte.SIZE); } @Override - public void addNumeric(int index, int size, int scale) throws FbException { + public void addNumeric(int index, int size, int scale) throws SQLException { metadataBuilder.setType(status, index, SQL_SHORT); metadataBuilder.setLength(status, index, size); if (scale > 0) @@ -91,7 +93,7 @@ public void addNumeric(int index, int size, int scale) throws FbException { } @Override - public void addDecimal(int index, int size, int scale) throws FbException { + public void addDecimal(int index, int size, int scale) throws SQLException { metadataBuilder.setType(status, index, SQL_LONG); metadataBuilder.setLength(status, index, size); metadataBuilder.setScale(status, index, scale); @@ -99,88 +101,88 @@ public void addDecimal(int index, int size, int scale) throws FbException { } @Override - public void addDouble(int index) throws FbException { + public void addDouble(int index) throws SQLException { metadataBuilder.setType(status, index, SQL_DOUBLE); metadataBuilder.setLength(status, index, Double.SIZE / Byte.SIZE); } @Override - public void addDecfloat16(int index) throws FbException { + public void addDecfloat16(int index) throws SQLException { metadataBuilder.setType(status, index, SQL_DEC16); metadataBuilder.setLength(status, index, IDecFloat16.STRING_SIZE); } @Override - public void addDecfloat34(int index) throws FbException { + public void addDecfloat34(int index) throws SQLException { metadataBuilder.setType(status, index, SQL_DEC34); metadataBuilder.setLength(status, index, IDecFloat34.STRING_SIZE); } @Override - public void addBlob(int index) throws FbException { + public void addBlob(int index) throws SQLException { metadataBuilder.setType(status, index, SQL_BLOB); metadataBuilder.setLength(status, index, (Integer.SIZE / Byte.SIZE) * 2); } @Override - public void addBlob(int index, int subtype) throws FbException { + public void addBlob(int index, int subtype) throws SQLException { metadataBuilder.setType(status, index, SQL_BLOB); metadataBuilder.setLength(status, index, (Integer.SIZE / Byte.SIZE) * 2); metadataBuilder.setSubType(status, index, subtype); } @Override - public void addBoolean(int index) throws FbException { + public void addBoolean(int index) throws SQLException { metadataBuilder.setType(status, index, SQL_BOOLEAN); metadataBuilder.setLength(status, index, Short.SIZE / Byte.SIZE); } @Override - public void addDate(int index) throws FbException { + public void addDate(int index) throws SQLException { metadataBuilder.setType(status, index, SQL_DATE); metadataBuilder.setLength(status, index, Long.SIZE / Byte.SIZE); } @Override - public void addTime(int index) throws FbException { + public void addTime(int index) throws SQLException { metadataBuilder.setType(status, index, SQL_TYPE_TIME); metadataBuilder.setLength(status, index, Long.SIZE / Byte.SIZE); } @Override - public void addTimestamp(int index) throws FbException { + public void addTimestamp(int index) throws SQLException { metadataBuilder.setType(status, index, SQL_TIMESTAMP); metadataBuilder.setLength(status, index, Long.SIZE / Byte.SIZE); } @Override - public void addChar(int index, int length) throws FbException { + public void addChar(int index, int length) throws SQLException { metadataBuilder.setType(status, index, SQL_TEXT); metadataBuilder.setLength(status, index, length); } @Override - public void addVarchar(int index, int length) throws FbException { + public void addVarchar(int index, int length) throws SQLException { metadataBuilder.setType(status, index, SQL_VARYING); metadataBuilder.setLength(status, index, length); } @Override - public void addChar(int index, int length, int charSet) throws FbException { + public void addChar(int index, int length, int charSet) throws SQLException { metadataBuilder.setType(status, index, SQL_TEXT); metadataBuilder.setLength(status, index, length); metadataBuilder.setCharSet(status, index, charSet); } @Override - public void addVarchar(int index, int length, int charSet) throws FbException { + public void addVarchar(int index, int length, int charSet) throws SQLException { metadataBuilder.setType(status, index, SQL_VARYING); metadataBuilder.setLength(status, index, length); metadataBuilder.setCharSet(status, index, charSet); } @Override - public void addDecDecimal(int index, int size, int scale) throws FbException { + public void addDecDecimal(int index, int size, int scale) throws SQLException { metadataBuilder.setType(status, index, SQL_DEC_FIXED); metadataBuilder.setLength(status, index, size); metadataBuilder.setScale(status, index, scale); @@ -188,7 +190,7 @@ public void addDecDecimal(int index, int size, int scale) throws FbException { } @Override - public void addDecNumeric(int index, int size, int scale) throws FbException { + public void addDecNumeric(int index, int size, int scale) throws SQLException { metadataBuilder.setType(status, index, SQL_DEC_FIXED); metadataBuilder.setLength(status, index, size); metadataBuilder.setScale(status, index, scale); diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IParameterConverterImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IParameterConverterImpl.java index 9ddc3d7a4c..f7c69e14c9 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IParameterConverterImpl.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IParameterConverterImpl.java @@ -6,7 +6,6 @@ import org.firebirdsql.gds.ng.AbstractParameterConverter; import org.firebirdsql.gds.ng.IAttachProperties; import org.firebirdsql.gds.ng.WireCrypt; -import org.firebirdsql.nativeoo.gds.ng.NativeDatabaseConnection; import java.sql.SQLException; diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IServiceImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IServiceImpl.java index dc4e73d267..75f55e3e1a 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IServiceImpl.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IServiceImpl.java @@ -6,10 +6,7 @@ import org.firebirdsql.gds.ServiceRequestBuffer; import org.firebirdsql.gds.impl.ServiceParameterBufferImp; import org.firebirdsql.gds.impl.ServiceRequestBufferImp; -import org.firebirdsql.gds.ng.AbstractFbService; -import org.firebirdsql.gds.ng.FbAttachment; -import org.firebirdsql.gds.ng.FbExceptionBuilder; -import org.firebirdsql.gds.ng.ParameterConverter; +import org.firebirdsql.gds.ng.*; import org.firebirdsql.jna.fbclient.FbClientLibrary; import org.firebirdsql.nativeoo.gds.ng.FbInterface.*; @@ -71,11 +68,12 @@ public byte[] getServiceInfo(ServiceParameterBuffer serviceParameterBuffer, serviceRequestBuffer == null ? null : serviceRequestBuffer.toBytes(); final byte[] responseBuffer = new byte[maxBufferLength]; synchronized (getSynchronizationObject()) { - service.query(status, (serviceParameterBufferBytes != null ? serviceParameterBufferBytes.length + service.query(getStatus(), (serviceParameterBufferBytes != null ? serviceParameterBufferBytes.length : 0), serviceParameterBufferBytes, (serviceRequestBufferBytes != null ? serviceRequestBufferBytes.length : 0), serviceRequestBufferBytes, maxBufferLength, responseBuffer); + processStatus(); } return responseBuffer; } catch (SQLException e) { @@ -92,8 +90,9 @@ public void startServiceAction(ServiceRequestBuffer serviceRequestBuffer) throws ? null : serviceRequestBuffer.toBytes(); synchronized (getSynchronizationObject()) { - service.start(status, (serviceRequestBufferBytes != null ? serviceRequestBufferBytes.length : 0), + service.start(getStatus(), (serviceRequestBufferBytes != null ? serviceRequestBufferBytes.length : 0), serviceRequestBufferBytes); + processStatus(); } } catch (SQLException e) { exceptionListenerDispatcher.errorOccurred(e); @@ -113,7 +112,8 @@ public void attach() throws SQLException { synchronized (getSynchronizationObject()) { try { - service = provider.attachServiceManager(status, connection.getAttachUrl(), spbArray.length, spbArray); + service = provider.attachServiceManager(getStatus(), connection.getAttachUrl(), spbArray.length, spbArray); + processStatus(); } catch (SQLException ex) { safelyDetach(); throw ex; @@ -158,7 +158,8 @@ protected void internalDetach() throws SQLException { checkConnected(); synchronized (getSynchronizationObject()) { try { - service.detach(status); + service.detach(getStatus()); + processStatus(); } catch (SQLException ex) { throw ex; } catch (Exception ex) { @@ -174,6 +175,23 @@ protected void internalDetach() throws SQLException { } } + private IStatus getStatus() { + status.init(); + return status; + } + + private void processStatus() throws SQLException { + processStatus(status, getServiceWarningCallback()); + } + + public void processStatus(IStatus status, WarningMessageCallback warningMessageCallback) + throws SQLException { + if (warningMessageCallback == null) { + warningMessageCallback = getServiceWarningCallback(); + } + connection.processStatus(status, warningMessageCallback); + } + @Override protected void finalize() throws Throwable { try { diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IStatementImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IStatementImpl.java index 4122862083..ea40ea5d0c 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IStatementImpl.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IStatementImpl.java @@ -2,6 +2,7 @@ import com.sun.jna.Memory; import com.sun.jna.Pointer; +import org.firebirdsql.gds.BatchParameterBuffer; import org.firebirdsql.gds.ISCConstants; import org.firebirdsql.gds.JaybirdErrorCodes; import org.firebirdsql.gds.ng.*; @@ -29,8 +30,8 @@ public class IStatementImpl extends AbstractFbStatement { private static final Logger log = LoggerFactory.getLogger(IStatementImpl.class); - private IDatabaseImpl database; - private final FbClientLibrary clientLibrary; + private final IDatabaseImpl database; + private final IStatus status; private IStatement statement; private IResultSet cursor; private IMessageMetadata inMeta; @@ -40,16 +41,17 @@ public class IStatementImpl extends AbstractFbStatement { public IStatementImpl(IDatabaseImpl database) { super(database.getSynchronizationObject()); this.database = database; - clientLibrary = database.getClientLibrary(); + this.status = this.database.getStatus(); } @Override protected void free(int option) throws SQLException { synchronized (getSynchronizationObject()) { if (option == ISCConstants.DSQL_close) - cursor.close(database.getStatus()); - else - statement.free(database.getStatus()); + cursor.close(getStatus()); + else if (statement != null) + statement.free(getStatus()); + processStatus(); // Reset statement information reset(option == ISCConstants.DSQL_drop); } @@ -61,7 +63,7 @@ protected boolean isValidTransactionClass(Class transac } @Override - public FbDatabase getDatabase() { + public IDatabaseImpl getDatabase() { return database; } @@ -88,7 +90,6 @@ public void prepare(String statementText) throws SQLException { } resetAll(); - final IDatabaseImpl db = (IDatabaseImpl) getDatabase(); if (currentState == StatementState.NEW) { // allocated when prepare call switchState(StatementState.ALLOCATED); @@ -97,13 +98,14 @@ public void prepare(String statementText) throws SQLException { checkStatementValid(); } - IStatus status = db.getStatus(); ITransactionImpl transaction = (ITransactionImpl) getTransaction(); - statement = db.getAttachment().prepare(status, transaction.getTransaction(), statementText.length(), statementText, - db.getConnectionDialect(), IStatement.PREPARE_PREFETCH_METADATA); - - outMeta = statement.getOutputMetadata(status); - inMeta = statement.getInputMetadata(status); + statement = getDatabase().getAttachment().prepare(getStatus(), transaction.getTransaction(), statementText.length(), statementText, + getDatabase().getConnectionDialect(), IStatement.PREPARE_PREFETCH_METADATA); + processStatus(); + outMeta = statement.getOutputMetadata(getStatus()); + processStatus(); + inMeta = statement.getInputMetadata(getStatus()); + processStatus(); final byte[] statementInfoRequestItems = getStatementInfoRequestItems(); final int responseLength = getDefaultSqlInfoSize(); @@ -131,9 +133,6 @@ public void execute(RowValue parameters) throws SQLException { setMetaData(getParameterDescriptor(), parameters); - IDatabaseImpl db = (IDatabaseImpl) getDatabase(); - IStatus status = db.getStatus(); - final StatementType statementType = getType(); final boolean hasSingletonResult = hasSingletonResult(); ITransactionImpl transaction = (ITransactionImpl) getTransaction(); @@ -145,15 +144,15 @@ public void execute(RowValue parameters) throws SQLException { } Pointer outPtr = null; - if ((statement.getFlags(status) & IStatement.FLAG_HAS_CURSOR) == IStatement.FLAG_HAS_CURSOR) { - cursor = statement.openCursor(status, transaction.getTransaction(), inMeta, inPtr, outMeta, 0); + if ((statement.getFlags(getStatus()) & IStatement.FLAG_HAS_CURSOR) == IStatement.FLAG_HAS_CURSOR) { + cursor = statement.openCursor(getStatus(), transaction.getTransaction(), inMeta, inPtr, outMeta, 0); } else { ByteBuffer outMessage = ByteBuffer.allocate(getMaxSqlInfoSize()); outPtr = new Memory(outMessage.array().length); outPtr.write(0, outMessage.array(), 0, outMessage.array().length); - status = db.getStatus(); - statement.execute(status, transaction.getTransaction(), inMeta, inPtr, outMeta, outPtr); + statement.execute(getStatus(), transaction.getTransaction(), inMeta, inPtr, outMeta, outPtr); } + processStatus(); if (hasSingletonResult) { /* A type with a singleton result (ie an execute procedure with return fields), doesn't actually @@ -180,13 +179,13 @@ public void execute(RowValue parameters) throws SQLException { } } - protected void setMetaData(final RowDescriptor rowDescriptor, final RowValue parameters) throws FbException { + protected void setMetaData(final RowDescriptor rowDescriptor, final RowValue parameters) throws SQLException { IMaster master = database.getMaster(); - IStatus status = database.getStatus(); - IMetadataBuilder metadataBuilder = master.getMetadataBuilder(status, parameters.getCount()); - inMessage = ByteBuffer.allocate(inMeta.getMessageLength(status)); - int offset = 0; + IMetadataBuilder metadataBuilder = master.getMetadataBuilder(getStatus(), parameters.getCount()); + inMessage = ByteBuffer.allocate(inMeta.getMessageLength(getStatus())); + processStatus(); + int offset; byte[] nullShort = {0, 0}; int align = 0; @@ -198,6 +197,8 @@ protected void setMetaData(final RowDescriptor rowDescriptor, final RowValue par } else { final FieldDescriptor fieldDescriptor = rowDescriptor.getFieldDescriptor(idx); + // clear status + getStatus(); offset = inMeta.getOffset(status, idx) - align; int nullOffset = inMeta.getNullOffset(status, idx); inMessage.position(offset); @@ -226,13 +227,17 @@ protected void setMetaData(final RowDescriptor rowDescriptor, final RowValue par metadataBuilder.setSubType(status, idx, inMeta.getSubType(status, idx)); metadataBuilder.setCharSet(status, idx, inMeta.getCharSet(status, idx)); } + processStatus(); + // clear status + getStatus(); inMessage.put(fieldData); inMessage.position(nullOffset - align); inMessage.put(nullShort); } } - inMeta = metadataBuilder.getMetadata(status); + inMeta = metadataBuilder.getMetadata(getStatus()); + processStatus(); metadataBuilder.release(); } @@ -246,13 +251,12 @@ public void fetchRows(int fetchSize) throws SQLException { } if (isAllRowsFetched()) return; - final IDatabaseImpl db = (IDatabaseImpl) getDatabase(); - IStatus status = db.getStatus(); - - ByteBuffer message = ByteBuffer.allocate(outMeta.getMessageLength(status) + 1); + ByteBuffer message = ByteBuffer.allocate(outMeta.getMessageLength(getStatus()) + 1); + processStatus(); Pointer ptr = new Memory(message.array().length); // ptr.write(0, message.array(), 0, message.array().length); - int fetchStatus = cursor.fetchNext(status, ptr); + int fetchStatus = cursor.fetchNext(getStatus(), ptr); + processStatus(); if (fetchStatus == IStatus.RESULT_OK) { queueRowData(toRowValue(getFieldDescriptor(), outMeta, ptr)); } else if (fetchStatus == IStatus.RESULT_NO_DATA) { @@ -270,29 +274,25 @@ public void fetchRows(int fetchSize) throws SQLException { } } - protected RowValue toRowValue(RowDescriptor rowDescriptor, IMessageMetadata meta, Pointer ptr) throws FbException { + protected RowValue toRowValue(RowDescriptor rowDescriptor, IMessageMetadata meta, Pointer ptr) throws SQLException { final RowValueBuilder row = new RowValueBuilder(rowDescriptor); - - IStatus status = database.getStatus(); - - int columns = meta.getCount(status); - + int columns = meta.getCount(getStatus()); + processStatus(); for (int idx = 0; idx < columns; idx++) { - row.setFieldIndex(idx); - int nullOffset = meta.getNullOffset(status, idx); - + int nullOffset = meta.getNullOffset(getStatus(), idx); + processStatus(); if (ptr.getShort(nullOffset) == XSQLVAR.SQLIND_NULL) { row.set(null); } else { - int bufferLength = meta.getLength(status, idx); - int offset = meta.getOffset(status, idx); - + int bufferLength = meta.getLength(getStatus(), idx); + processStatus(); + int offset = meta.getOffset(getStatus(), idx); + processStatus(); if (rowDescriptor.getFieldDescriptor(idx).isVarying()) { bufferLength = ptr.getShort(offset) & 0xffff; offset += 2; } - byte[] data = new byte[bufferLength]; ptr.read(offset, data, 0, bufferLength); row.set(data); @@ -305,15 +305,12 @@ protected RowValue toRowValue(RowDescriptor rowDescriptor, IMessageMetadata meta public byte[] getSqlInfo(byte[] requestItems, int bufferLength) throws SQLException { try { final byte[] responseArr = new byte[bufferLength]; - final IDatabaseImpl db = (IDatabaseImpl) getDatabase(); - IStatus status = db.getStatus(); - synchronized (getSynchronizationObject()) { checkStatementValid(); - statement.getInfo(status, requestItems.length, requestItems, + statement.getInfo(getStatus(), requestItems.length, requestItems, bufferLength, responseArr); + processStatus(); } - return responseArr; } catch (SQLException e) { exceptionListenerDispatcher.errorOccurred(e); @@ -338,9 +335,8 @@ public void setCursorName(String cursorName) throws SQLException { try { synchronized (getSynchronizationObject()) { checkStatementValid(); - final IDatabaseImpl db = (IDatabaseImpl) getDatabase(); - IStatus status = db.getStatus(); - statement.setCursorName(status, cursorName + '\0'); + statement.setCursorName(getStatus(), cursorName + '\0'); + processStatus(); } } catch (SQLException e) { exceptionListenerDispatcher.errorOccurred(e); @@ -353,7 +349,23 @@ public RowDescriptor emptyRowDescriptor() { return database.emptyRowDescriptor(); } - public FbMessageMetadata getInputMetadata() throws FbException { + @Override + public FbBatch createBatch(BatchParameterBuffer parameters) throws SQLException { + IBatch batch = statement.createBatch(getStatus(), + inMeta, parameters.toBytesWithType().length, parameters.toBytesWithType()); + return new IBatchImpl(batch, this, parameters); + } + + public FbMessageMetadata getInputMetadata() throws SQLException { return new IMessageMetadataImpl(database, inMeta); } + + private IStatus getStatus() { + status.init(); + return status; + } + + private void processStatus() throws SQLException { + getDatabase().processStatus(status, getStatementWarningCallback()); + } } diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/ITransactionImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/ITransactionImpl.java index 14dd82f5a6..b4c66603d3 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/ITransactionImpl.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/ITransactionImpl.java @@ -21,11 +21,13 @@ public class ITransactionImpl extends AbstractFbTransaction { private final FbClientLibrary clientLibrary; private final ITransaction transaction; + private final IStatus status; public ITransactionImpl(IDatabaseImpl database, ITransaction iTransaction, TransactionState initialState) { super(initialState, database); transaction = iTransaction; clientLibrary = database.getClientLibrary(); + status = database.getStatus(); } @Override @@ -49,7 +51,8 @@ public void commit() throws SQLException { final IDatabaseImpl db = getDatabase(); db.checkConnected(); switchState(TransactionState.COMMITTING); - transaction.commit(db.getStatus()); + transaction.commit(getStatus()); + processStatus(); switchState(TransactionState.COMMITTED); } } catch (SQLException e) { @@ -71,7 +74,8 @@ public void rollback() throws SQLException { final IDatabaseImpl db = getDatabase(); db.checkConnected(); switchState(TransactionState.ROLLING_BACK); - transaction.rollback(db.getStatus()); + transaction.rollback(getStatus()); + processStatus(); switchState(TransactionState.ROLLED_BACK); } } catch (SQLException e) { @@ -96,12 +100,13 @@ public void prepare(byte[] recoveryInformation) throws SQLException { switchState(TransactionState.PREPARING); if (noRecoveryInfo) { // TODO check for recovery information - transaction.prepare(db.getStatus(), 0, + transaction.prepare(getStatus(), 0, null); } else { - transaction.prepare(db.getStatus(), (short) recoveryInformation.length, + transaction.prepare(getStatus(), (short) recoveryInformation.length, recoveryInformation); } + processStatus(); switchState(TransactionState.PREPARED); } } catch (SQLException e) { @@ -121,10 +126,10 @@ public byte[] getTransactionInfo(byte[] requestItems, int maxBufferLength) throw synchronized (getSynchronizationObject()) { final IDatabaseImpl db = getDatabase(); db.checkConnected(); - transaction.getInfo(db.getStatus(), (short) requestItems.length, requestItems, + transaction.getInfo(getStatus(), (short) requestItems.length, requestItems, (short) maxBufferLength, responseArray); + processStatus(); } - return responseArray; } catch (SQLException e) { exceptionListenerDispatcher.errorOccurred(e); @@ -132,4 +137,12 @@ public byte[] getTransactionInfo(byte[] requestItems, int maxBufferLength) throw } } + private IStatus getStatus() { + status.init(); + return status; + } + + private void processStatus() throws SQLException { + getDatabase().processStatus(status, null); + } } diff --git a/src/test/org/firebirdsql/gds/impl/jni/TestEmbeddedServicesAPI.java b/src/test/org/firebirdsql/gds/impl/jni/TestEmbeddedServicesAPI.java deleted file mode 100644 index a680833faf..0000000000 --- a/src/test/org/firebirdsql/gds/impl/jni/TestEmbeddedServicesAPI.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.firebirdsql.gds.impl.jni; - -import org.firebirdsql.gds.impl.GDSType; - -public class TestEmbeddedServicesAPI extends TestServicesAPI { - - public TestEmbeddedServicesAPI() { - gdsType = GDSType.getType(EmbeddedGDSFactoryPlugin.EMBEDDED_TYPE_NAME); - protocol = "jdbc:firebirdsql:embedded:"; - } -} diff --git a/src/test/org/firebirdsql/gds/impl/jni/TestFbOOEmbeddedServicesAPI.java b/src/test/org/firebirdsql/gds/impl/jni/TestFbOOEmbeddedServicesAPI.java deleted file mode 100644 index c1315c1c83..0000000000 --- a/src/test/org/firebirdsql/gds/impl/jni/TestFbOOEmbeddedServicesAPI.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.firebirdsql.gds.impl.jni; - -import org.firebirdsql.gds.impl.GDSType; -import org.firebirdsql.gds.impl.nativeoo.FbOOEmbeddedGDSFactoryPlugin; - -public class TestFbOOEmbeddedServicesAPI extends TestServicesAPI { - - public TestFbOOEmbeddedServicesAPI() { - gdsType = GDSType.getType(FbOOEmbeddedGDSFactoryPlugin.EMBEDDED_TYPE_NAME); - protocol = "jdbc:firebirdsql:fboo:embedded:"; - } -} diff --git a/src/test/org/firebirdsql/gds/impl/jni/TestFbOOLocalServicesAPI.java b/src/test/org/firebirdsql/gds/impl/jni/TestFbOOLocalServicesAPI.java deleted file mode 100644 index 9b775b95f1..0000000000 --- a/src/test/org/firebirdsql/gds/impl/jni/TestFbOOLocalServicesAPI.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.firebirdsql.gds.impl.jni; - -import org.firebirdsql.gds.impl.GDSType; -import org.firebirdsql.gds.impl.nativeoo.FbOOLocalGDSFactoryPlugin; - -public class TestFbOOLocalServicesAPI extends TestServicesAPI { - - public TestFbOOLocalServicesAPI() { - gdsType = GDSType.getType(FbOOLocalGDSFactoryPlugin.LOCAL_TYPE_NAME); - protocol = "jdbc:firebirdsql:fboo:local:"; - } -} diff --git a/src/test/org/firebirdsql/gds/impl/jni/TestFbOONativeServicesAPI.java b/src/test/org/firebirdsql/gds/impl/jni/TestFbOONativeServicesAPI.java deleted file mode 100644 index 959abb348b..0000000000 --- a/src/test/org/firebirdsql/gds/impl/jni/TestFbOONativeServicesAPI.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.firebirdsql.gds.impl.jni; - -import org.firebirdsql.gds.impl.GDSType; -import org.firebirdsql.gds.impl.nativeoo.FbOONativeGDSFactoryPlugin; - -public class TestFbOONativeServicesAPI extends TestServicesAPI { - - public TestFbOONativeServicesAPI() { - gdsType = GDSType.getType(FbOONativeGDSFactoryPlugin.NATIVE_TYPE_NAME); - protocol = "jdbc:firebirdsql:fboo:native:"; - port = 3050; - } -} diff --git a/src/test/org/firebirdsql/gds/impl/jni/TestLocalServicesAPI.java b/src/test/org/firebirdsql/gds/impl/jni/TestLocalServicesAPI.java deleted file mode 100644 index f4dbd5a365..0000000000 --- a/src/test/org/firebirdsql/gds/impl/jni/TestLocalServicesAPI.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.firebirdsql.gds.impl.jni; - -import org.firebirdsql.gds.impl.GDSType; - -public class TestLocalServicesAPI extends TestServicesAPI { - - public TestLocalServicesAPI() { - gdsType = GDSType.getType(LocalGDSFactoryPlugin.LOCAL_TYPE_NAME); - protocol = "jdbc:firebirdsql:local:"; - } -} diff --git a/src/test/org/firebirdsql/gds/impl/jni/TestNativeServicesAPI.java b/src/test/org/firebirdsql/gds/impl/jni/TestNativeServicesAPI.java deleted file mode 100644 index a94ecd2755..0000000000 --- a/src/test/org/firebirdsql/gds/impl/jni/TestNativeServicesAPI.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.firebirdsql.gds.impl.jni; - -import org.firebirdsql.gds.impl.GDSType; - -public class TestNativeServicesAPI extends TestServicesAPI { - - public TestNativeServicesAPI() { - gdsType = GDSType.getType(NativeGDSFactoryPlugin.NATIVE_TYPE_NAME); - protocol = "jdbc:firebirdsql:native:"; - port = 3050; - } -} diff --git a/src/test/org/firebirdsql/gds/impl/jni/TestServicesAPI.java b/src/test/org/firebirdsql/gds/impl/jni/TestServicesAPI.java index e66e7b6d2d..42ebc03c15 100644 --- a/src/test/org/firebirdsql/gds/impl/jni/TestServicesAPI.java +++ b/src/test/org/firebirdsql/gds/impl/jni/TestServicesAPI.java @@ -45,31 +45,33 @@ * Initial tests for Services API. Currently run only against embedded server. * TODO: Make run against other types */ -public abstract class TestServicesAPI { +public class TestServicesAPI { + + @ClassRule + public static final GdsTypeRule testType = GdsTypeRule.supports(EmbeddedGDSFactoryPlugin.EMBEDDED_TYPE_NAME); @Rule public final TemporaryFolder temporaryFolder = new TemporaryFolder(); private final Logger log = LoggerFactory.getLogger(getClass()); - protected String mAbsoluteDatabasePath; - protected String mAbsoluteBackupPath; - protected FBManager fbManager; - protected String protocol; - protected GDSType gdsType; - protected int port = 5066; - protected FbDatabaseFactory dbFactory; - protected File logFolder; + private String mAbsoluteDatabasePath; + private String mAbsoluteBackupPath; + private FBManager fbManager; + private GDSType gdsType; + private FbDatabaseFactory dbFactory; + private File logFolder; @Before public void setUp() throws Exception { Class.forName(FBDriver.class.getName()); + gdsType = GDSType.getType(EmbeddedGDSFactoryPlugin.EMBEDDED_TYPE_NAME); dbFactory = GDSFactory.getDatabaseFactoryForType(gdsType); fbManager = new FBManager(gdsType); fbManager.setServer("localhost"); - fbManager.setPort(port); + fbManager.setPort(5066); fbManager.start(); File dbFolder = temporaryFolder.newFolder("db"); @@ -117,8 +119,8 @@ public void testBackupAndRestore() throws Exception { connectToDatabase(); } - protected void connectToDatabase() throws SQLException { - Connection connection = DriverManager.getConnection(protocol + mAbsoluteDatabasePath + "?encoding=NONE", + private void connectToDatabase() throws SQLException { + Connection connection = DriverManager.getConnection("jdbc:firebirdsql:embedded:" + mAbsoluteDatabasePath + "?encoding=NONE", "SYSDBA", "masterkey"); connection.close(); } diff --git a/src/test/org/firebirdsql/gds/ng/wire/version10/TestV10Database.java b/src/test/org/firebirdsql/gds/ng/wire/version10/TestV10Database.java index 59d6e87614..ba8062eac5 100644 --- a/src/test/org/firebirdsql/gds/ng/wire/version10/TestV10Database.java +++ b/src/test/org/firebirdsql/gds/ng/wire/version10/TestV10Database.java @@ -434,8 +434,7 @@ private FbTransaction getTransaction(FbDatabase db) throws SQLException { private static void safelyClose(FbDatabase db) { if (db == null) return; try { - if (db.isAttached()) - db.close(); + db.close(); } catch (SQLException ex) { ex.printStackTrace(); } diff --git a/src/test/unit_test_defaults.properties b/src/test/unit_test_defaults.properties index da99135039..61754f17c6 100644 --- a/src/test/unit_test_defaults.properties +++ b/src/test/unit_test_defaults.properties @@ -1,5 +1,5 @@ test.db.dir = . test.db.host = localhost test.db.port = 3050 -test.gds_type = PURE_JAVA -# test.gds_type = LOCAL \ No newline at end of file +#test.gds_type = PURE_JAVA + test.gds_type = FBOONATIVE \ No newline at end of file From ceb90bb2816fc522cad002818a6ce62e63349019 Mon Sep 17 00:00:00 2001 From: Vasiliy Yashkov Date: Thu, 30 Jan 2020 12:47:35 +0300 Subject: [PATCH 03/12] Update native OO API implementation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Updated interfaces `FbInterface.java` in accordance with the current firebird 4 implementation. Removed old and unnecessary interface implementations. `fb_get_master_interface()` method moved from FbClientLibrary to separate old and new implementations. 2. Fixed setting `null` flag ​​in message data of `IStatement` if the field data was `null`. 3. Removed excess imports of `org.firebirdsql.nativeoo.gds.ng.FbInterface` from `org.firebirdsql.gds` layer. 4. The batch parameter buffer now contains constants instead of the `FbBatch` interface. 5. Reimplemented event handling with old `isc_*` calls. 6. JNA deprecated function `loadLibrary` replaced by `load`. 7. Other corrections and additions related to main code of the driver. --- .../org/firebirdsql/jna/fbclient/FB_I128.java | 35 + .../jna/fbclient/FbClientLibrary.java | 7 - .../jna/fbclient/ISC_TIMESTAMP_TZ.java | 18 + .../firebirdsql/jna/fbclient/ISC_TIME_TZ.java | 18 + .../firebirdsql/gds/BatchParameterBuffer.java | 12 +- .../gds/impl/BatchParameterBufferImpl.java | 5 +- .../firebirdsql/gds/ng/AbstractFbBatch.java | 79 + .../gds/ng/AbstractFbMessageBuilder.java | 5 +- .../gds/ng/AbstractFbStatement.java | 8 +- src/main/org/firebirdsql/gds/ng/FbBatch.java | 13 - .../firebirdsql/gds/ng/FbMessageMetadata.java | 4 +- .../nativeoo/gds/ng/IBatchImplTest.java | 259 +- .../nativeoo/gds/ng/IEventBlockImplTest.java | 5 +- .../gds/ng/IServiceConnectionImplTest.java | 3 - .../nativeoo/gds/ng/IServiceImplTest.java | 5 +- .../nativeoo/gds/ng/IStatementImplTest.java | 6 +- .../gds/ng/IStatementimplTimeoutTest.java | 28 + .../nativeoo/gds/ng/ITransactionImplTest.java | 4 - .../gds/ng/NativeDatabaseConnectionTest.java | 2 - .../nativeoo/gds/ng/FbInterface.java | 3991 ++++------------- .../gds/ng/FbOOClientDatabaseFactory.java | 2 +- .../gds/ng/FbOOEmbeddedDatabaseFactory.java | 2 +- .../nativeoo/gds/ng/IBlobImpl.java | 5 + .../nativeoo/gds/ng/IDatabaseImpl.java | 53 +- .../{IEventBlockImpl.java => IEventImpl.java} | 43 +- .../nativeoo/gds/ng/IMessageMetadataImpl.java | 9 +- .../nativeoo/gds/ng/IServiceImpl.java | 9 +- .../nativeoo/gds/ng/IStatementImpl.java | 103 +- .../firebirdsql/gds/ng/AbstractBatchTest.java | 7 +- 29 files changed, 1305 insertions(+), 3435 deletions(-) create mode 100644 src/jna-client/org/firebirdsql/jna/fbclient/FB_I128.java create mode 100644 src/jna-client/org/firebirdsql/jna/fbclient/ISC_TIMESTAMP_TZ.java create mode 100644 src/jna-client/org/firebirdsql/jna/fbclient/ISC_TIME_TZ.java create mode 100644 src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IStatementimplTimeoutTest.java rename src/nativeoo/org/firebirdsql/nativeoo/gds/ng/{IEventBlockImpl.java => IEventImpl.java} (77%) diff --git a/src/jna-client/org/firebirdsql/jna/fbclient/FB_I128.java b/src/jna-client/org/firebirdsql/jna/fbclient/FB_I128.java new file mode 100644 index 0000000000..b86b90798d --- /dev/null +++ b/src/jna-client/org/firebirdsql/jna/fbclient/FB_I128.java @@ -0,0 +1,35 @@ +package org.firebirdsql.jna.fbclient; + +import com.sun.jna.Pointer; +import com.sun.jna.Structure; + +import java.util.Arrays; +import java.util.List; + +/** + * @since 4.0 + */ +public class FB_I128 extends Structure { + public long[] fb_data = new long[2]; + public FB_I128() { + super(); + } + protected List getFieldOrder() { + return Arrays.asList("fb_data"); + } + public FB_I128(long fb_data[]) { + super(); + if ((fb_data.length != this.fb_data.length)) + throw new IllegalArgumentException("Wrong array size !"); + this.fb_data = fb_data; + } + public FB_I128(Pointer peer) { + super(peer); + } + public static class ByReference extends FB_I128 implements Structure.ByReference { + + }; + public static class ByValue extends FB_I128 implements Structure.ByValue { + + }; +} diff --git a/src/jna-client/org/firebirdsql/jna/fbclient/FbClientLibrary.java b/src/jna-client/org/firebirdsql/jna/fbclient/FbClientLibrary.java index 5f658b3456..d550deec97 100644 --- a/src/jna-client/org/firebirdsql/jna/fbclient/FbClientLibrary.java +++ b/src/jna-client/org/firebirdsql/jna/fbclient/FbClientLibrary.java @@ -26,7 +26,6 @@ import com.sun.jna.ptr.LongByReference; import com.sun.jna.ptr.PointerByReference; import com.sun.jna.ptr.ShortByReference; -import org.firebirdsql.nativeoo.gds.ng.FbInterface; import java.nio.ByteBuffer; import java.nio.IntBuffer; @@ -758,10 +757,4 @@ ISC_STATUS fb_shutdown_callback(ISC_STATUS[] statusVector, FbShutdownCallback FB * native declaration : C:\Program Files\Firebird\Firebird_2_5\include\ibase.h:1306 */ int isc_get_client_minor_version(); - - /** - * Original signature : extern "C" IMaster* ISC_EXPORT fb_get_master_interface();
- * native declaration : firebird/include/firebird/interface.h:364 - */ - FbInterface.IMaster fb_get_master_interface(); } diff --git a/src/jna-client/org/firebirdsql/jna/fbclient/ISC_TIMESTAMP_TZ.java b/src/jna-client/org/firebirdsql/jna/fbclient/ISC_TIMESTAMP_TZ.java new file mode 100644 index 0000000000..eee4aeed9d --- /dev/null +++ b/src/jna-client/org/firebirdsql/jna/fbclient/ISC_TIMESTAMP_TZ.java @@ -0,0 +1,18 @@ +package org.firebirdsql.jna.fbclient; + +import com.sun.jna.Structure; + +import java.util.Arrays; +import java.util.List; + +public class ISC_TIMESTAMP_TZ extends Structure implements Structure.ByValue { + + public ISC_TIMESTAMP timestamp; + public int time_zone; + + @Override + protected List getFieldOrder() + { + return Arrays.asList("timestamp", "time_zone"); + } +} diff --git a/src/jna-client/org/firebirdsql/jna/fbclient/ISC_TIME_TZ.java b/src/jna-client/org/firebirdsql/jna/fbclient/ISC_TIME_TZ.java new file mode 100644 index 0000000000..395652190c --- /dev/null +++ b/src/jna-client/org/firebirdsql/jna/fbclient/ISC_TIME_TZ.java @@ -0,0 +1,18 @@ +package org.firebirdsql.jna.fbclient; + +import com.sun.jna.Structure; + +import java.util.Arrays; +import java.util.List; + +public class ISC_TIME_TZ extends Structure implements Structure.ByValue { + + public ISC_TIME time; + public int time_zone; + + @Override + protected List getFieldOrder() + { + return Arrays.asList("time", "time_zone"); + } +} diff --git a/src/main/org/firebirdsql/gds/BatchParameterBuffer.java b/src/main/org/firebirdsql/gds/BatchParameterBuffer.java index 92b6f6f9b3..ba5e340fd7 100644 --- a/src/main/org/firebirdsql/gds/BatchParameterBuffer.java +++ b/src/main/org/firebirdsql/gds/BatchParameterBuffer.java @@ -6,5 +6,15 @@ * @since 4.0 */ public interface BatchParameterBuffer extends ParameterBuffer { - + int VERSION1 = 1; + int TAG_MULTIERROR = 1; + int TAG_RECORD_COUNTS = 2; + int TAG_BUFFER_BYTES_SIZE = 3; + int TAG_BLOB_POLICY = 4; + int TAG_DETAILED_ERRORS = 5; + int BLOB_NONE = 0; + int BLOB_ID_ENGINE = 1; + int BLOB_ID_USER = 2; + int BLOB_STREAM = 3; + int BLOB_SEGHDR_ALIGN = 2; } diff --git a/src/main/org/firebirdsql/gds/impl/BatchParameterBufferImpl.java b/src/main/org/firebirdsql/gds/impl/BatchParameterBufferImpl.java index 92326e5713..44be6b1906 100644 --- a/src/main/org/firebirdsql/gds/impl/BatchParameterBufferImpl.java +++ b/src/main/org/firebirdsql/gds/impl/BatchParameterBufferImpl.java @@ -3,7 +3,6 @@ import org.firebirdsql.gds.BatchParameterBuffer; import org.firebirdsql.gds.ParameterBuffer; import org.firebirdsql.gds.impl.argument.ArgumentType; -import org.firebirdsql.nativeoo.gds.ng.FbInterface; /** * @@ -18,7 +17,7 @@ public BatchParameterBufferImpl() { private enum BatchMetaData implements ParameterBufferMetaData { - BATCH_VERSION_1(FbInterface.IBatch.VERSION1); + BATCH_VERSION_1(VERSION1); private final int batchVersion; @@ -51,4 +50,4 @@ public final ArgumentType getIntegerArgumentType(int tag) { return ArgumentType.Wide; } } -} \ No newline at end of file +} diff --git a/src/main/org/firebirdsql/gds/ng/AbstractFbBatch.java b/src/main/org/firebirdsql/gds/ng/AbstractFbBatch.java index 81cde24b56..1296e6c946 100644 --- a/src/main/org/firebirdsql/gds/ng/AbstractFbBatch.java +++ b/src/main/org/firebirdsql/gds/ng/AbstractFbBatch.java @@ -207,6 +207,28 @@ public void setString(int parameterIndex, String x) throws SQLException { getField(parameterIndex).setString(x); } + /** + * Sets the designated parameter to the given String value. This is a + * workaround for the ambiguous "operation was cancelled" response from the + * server for when an oversized string is set for a limited-size field. This + * method sets the string parameter without checking size constraints. + * + * @param parameterIndex + * the first parameter is 1, the second is 2, ... + * @param x + * The String value to be set + * @throws SQLException + * if a database access occurs + */ + public void setStringForced(int parameterIndex, String x) throws SQLException { + FBField field = getField(parameterIndex); + if (field instanceof FBWorkaroundStringField) { + ((FBWorkaroundStringField) field).setStringForced(x); + } else { + field.setString(x); + } + } + public void setTime(int parameterIndex, Time x) throws SQLException { getField(parameterIndex).setTime(x); } @@ -267,6 +289,48 @@ public final void setAsciiStream(int parameterIndex, InputStream x) throws SQLEx setBinaryStream(parameterIndex, x); } + /** + * Method is no longer supported since Jaybird 3.0. + *

+ * For old behavior use {@link #setBinaryStream(int, InputStream, int)}. For JDBC suggested behavior, + * use {@link #setCharacterStream(int, Reader, int)}. + *

+ * + * @throws SQLFeatureNotSupportedException Always + * @deprecated + */ + @Deprecated + public void setUnicodeStream(int parameterIndex, InputStream x, int length) throws SQLException { + throw new SQLFeatureNotSupportedException(UNICODE_STREAM_NOT_SUPPORTED); + } + + /** + *

+ * Jaybird does not support array types. + *

+ */ + public void setURL(int parameterIndex, URL url) throws SQLException { + throw new FBDriverNotCapableException("Type URL not supported"); + } + + /** + *

+ * Implementation note: This method behaves exactly the same as {@link #setCharacterStream(int, Reader, long)}. + *

+ */ + public void setNCharacterStream(int parameterIndex, Reader value, long length) throws SQLException { + setCharacterStream(parameterIndex, value, length); + } + + /** + *

+ * Implementation note: This method behaves exactly the same as {@link #setCharacterStream(int, Reader)}. + *

+ */ + public void setNCharacterStream(int parameterIndex, Reader value) throws SQLException { + setCharacterStream(parameterIndex, value); + } + /** *

* Implementation note: This method behaves exactly the same as {@link #setString(int, String)}. @@ -301,6 +365,9 @@ public void setObject(int parameterIndex, Object x, int targetSqlType) throws SQ setObject(parameterIndex, x); } + public void setRef(int i, Ref x) throws SQLException { + throw new FBDriverNotCapableException("Type REF not supported"); + } protected void setBlob(int parameterIndex, Blob blob) throws SQLException { getField(parameterIndex).setBlob((FBBlob) blob); @@ -309,4 +376,16 @@ protected void setBlob(int parameterIndex, Blob blob) throws SQLException { protected void setClob(int parameterIndex, Clob clob) throws SQLException { getField(parameterIndex).setClob((FBClob) clob); } + + public void setCharacterStream(int parameterIndex, Reader reader, int length) throws SQLException { + getField(parameterIndex).setCharacterStream(reader, length); + } + + public void setCharacterStream(int parameterIndex, Reader reader, long length) throws SQLException { + getField(parameterIndex).setCharacterStream(reader, length); + } + + public void setCharacterStream(int parameterIndex, Reader reader) throws SQLException { + getField(parameterIndex).setCharacterStream(reader); + } } diff --git a/src/main/org/firebirdsql/gds/ng/AbstractFbMessageBuilder.java b/src/main/org/firebirdsql/gds/ng/AbstractFbMessageBuilder.java index f828271cdf..4d04fa1653 100644 --- a/src/main/org/firebirdsql/gds/ng/AbstractFbMessageBuilder.java +++ b/src/main/org/firebirdsql/gds/ng/AbstractFbMessageBuilder.java @@ -1,5 +1,6 @@ package org.firebirdsql.gds.ng; +import org.firebirdsql.gds.BatchParameterBuffer; import org.firebirdsql.gds.BlobParameterBuffer; import org.firebirdsql.gds.ng.fields.FieldDescriptor; @@ -152,7 +153,7 @@ public long addBlobHeader(long blobId, BlobParameterBuffer buffer) throws IOExce @Override public void addBlobSegment(byte[] data, boolean lastSegment) throws IOException { - int align = align(blobStream.size(), FbBatch.BLOB_SEGHDR_ALIGN); + int align = align(blobStream.size(), BatchParameterBuffer.BLOB_SEGHDR_ALIGN); if (align != 0 && blobStream.size() - align < 0) { byte[] shift = ByteBuffer.allocate(Math.abs(blobStream.size() - align)).array(); blobStream.write(shift); @@ -161,7 +162,7 @@ public void addBlobSegment(byte[] data, boolean lastSegment) throws IOException blobStream.seek(segmentedBlobOffset); byte[] dataLength = statement.getDatabase().getDatatypeCoder().encodeShort(data.length); - segmentedBlobSize += align(data.length + dataLength.length, FbBatch.BLOB_SEGHDR_ALIGN); + segmentedBlobSize += align(data.length + dataLength.length, BatchParameterBuffer.BLOB_SEGHDR_ALIGN); blobStream.write(statement.getDatabase().getDatatypeCoder().encodeShort(segmentedBlobSize)); blobStream.seek(oldPosition); diff --git a/src/main/org/firebirdsql/gds/ng/AbstractFbStatement.java b/src/main/org/firebirdsql/gds/ng/AbstractFbStatement.java index 4109446100..7b758c87d8 100644 --- a/src/main/org/firebirdsql/gds/ng/AbstractFbStatement.java +++ b/src/main/org/firebirdsql/gds/ng/AbstractFbStatement.java @@ -734,6 +734,10 @@ protected final OperationCloseHandle signalFetch() { return FbDatabaseOperation.signalFetch(getDatabase()); } + public FbBatch createBatch(BatchParameterBuffer parameters) throws SQLException { + throw new FBDriverNotCapableException(); + } + /** * Listener to reset the statement state when it has been cancelled due to statement timeout. */ @@ -758,8 +762,4 @@ public void errorOccurred(Object source, SQLException ex) { } } } - - public FbBatch createBatch(BatchParameterBuffer parameters) throws SQLException { - throw new FBDriverNotCapableException(); - } } diff --git a/src/main/org/firebirdsql/gds/ng/FbBatch.java b/src/main/org/firebirdsql/gds/ng/FbBatch.java index d7ed217f24..d2a82b7487 100644 --- a/src/main/org/firebirdsql/gds/ng/FbBatch.java +++ b/src/main/org/firebirdsql/gds/ng/FbBatch.java @@ -19,19 +19,6 @@ */ public interface FbBatch extends ExceptionListenable { - int VERSION1 = 1; - // continue batch executing in case of errors in some messages - int TAG_MULTIERROR = 1; - int TAG_RECORD_COUNTS = 2; - int TAG_BUFFER_BYTES_SIZE = 3; - int TAG_BLOB_POLICY = 4; - int TAG_DETAILED_ERRORS = 5; - int BLOB_NONE = 0; - int BLOB_ID_ENGINE = 1; - int BLOB_ID_USER = 2; - int BLOB_STREAM = 3; - int BLOB_SEGHDR_ALIGN = 2; - /** * @return Transaction currently associated with this batch. */ diff --git a/src/main/org/firebirdsql/gds/ng/FbMessageMetadata.java b/src/main/org/firebirdsql/gds/ng/FbMessageMetadata.java index 8d07d85382..f69944a5ac 100644 --- a/src/main/org/firebirdsql/gds/ng/FbMessageMetadata.java +++ b/src/main/org/firebirdsql/gds/ng/FbMessageMetadata.java @@ -1,7 +1,5 @@ package org.firebirdsql.gds.ng; -import org.firebirdsql.nativeoo.gds.ng.FbInterface.*; - import java.sql.SQLException; /** @@ -42,5 +40,5 @@ public interface FbMessageMetadata { int getType(int index) throws SQLException; - IMetadataBuilder getBuilder() throws SQLException; + FbMetadataBuilder getBuilder() throws SQLException; } diff --git a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IBatchImplTest.java b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IBatchImplTest.java index d08a319854..1181cd1a5b 100644 --- a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IBatchImplTest.java +++ b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IBatchImplTest.java @@ -8,7 +8,6 @@ import org.firebirdsql.gds.impl.*; import org.firebirdsql.gds.ng.*; import org.firebirdsql.gds.ng.fields.RowValue; -import org.firebirdsql.gds.ng.jna.AbstractNativeDatabaseFactory; import org.firebirdsql.gds.ng.wire.SimpleStatementListener; import org.firebirdsql.jdbc.FBBlob; import org.junit.Before; @@ -201,84 +200,84 @@ public void testSingleExecuteBatchWithoutBlobs() throws SQLException { RowValue fieldValues = statementListener.getRows().get(0); byte[] fieldData = fieldValues.getFieldData(0); assertEquals(testInteger, - statement.getFieldDescriptor().getFieldDescriptor(0).getDatatypeCoder().decodeInt(fieldData)); + statement.getRowDescriptor().getFieldDescriptor(0).getDatatypeCoder().decodeInt(fieldData)); fieldData = fieldValues.getFieldData(1); assertEquals(testVarchar, - statement.getFieldDescriptor().getFieldDescriptor(1).getDatatypeCoder().decodeString(fieldData)); + statement.getRowDescriptor().getFieldDescriptor(1).getDatatypeCoder().decodeString(fieldData)); fieldData = fieldValues.getFieldData(2); assertEquals(testVarchar, - statement.getFieldDescriptor().getFieldDescriptor(2).getDatatypeCoder().decodeString(fieldData)); + statement.getRowDescriptor().getFieldDescriptor(2).getDatatypeCoder().decodeString(fieldData)); fieldData = fieldValues.getFieldData(3); assertEquals(testVarchar, - statement.getFieldDescriptor().getFieldDescriptor(3).getDatatypeCoder().decodeString(fieldData)); + statement.getRowDescriptor().getFieldDescriptor(3).getDatatypeCoder().decodeString(fieldData)); fieldData = fieldValues.getFieldData(4); assertEquals(testBigInteger, - statement.getFieldDescriptor().getFieldDescriptor(4).getDatatypeCoder().decodeLong(fieldData)); + statement.getRowDescriptor().getFieldDescriptor(4).getDatatypeCoder().decodeLong(fieldData)); fieldData = fieldValues.getFieldData(5); assertEquals(testInteger, - statement.getFieldDescriptor().getFieldDescriptor(5).getDatatypeCoder().decodeInt(fieldData)); + statement.getRowDescriptor().getFieldDescriptor(5).getDatatypeCoder().decodeInt(fieldData)); fieldData = fieldValues.getFieldData(6); assertEquals(testShort, - statement.getFieldDescriptor().getFieldDescriptor(6).getDatatypeCoder().decodeShort(fieldData)); + statement.getRowDescriptor().getFieldDescriptor(6).getDatatypeCoder().decodeShort(fieldData)); fieldData = fieldValues.getFieldData(7); assertEquals(testFloat, - statement.getFieldDescriptor().getFieldDescriptor(7).getDatatypeCoder().decodeFloat(fieldData), + statement.getRowDescriptor().getFieldDescriptor(7).getDatatypeCoder().decodeFloat(fieldData), 0); fieldData = fieldValues.getFieldData(8); assertEquals(testDouble, - statement.getFieldDescriptor().getFieldDescriptor(8).getDatatypeCoder().decodeDouble(fieldData), + statement.getRowDescriptor().getFieldDescriptor(8).getDatatypeCoder().decodeDouble(fieldData), 0); fieldData = fieldValues.getFieldData(9); - short decodeShort = statement.getFieldDescriptor().getFieldDescriptor(9).getDatatypeCoder().decodeShort(fieldData); - BigDecimal decimal = BigDecimal.valueOf(decodeShort, -statement.getFieldDescriptor().getFieldDescriptor(9).getScale()); + short decodeShort = statement.getRowDescriptor().getFieldDescriptor(9).getDatatypeCoder().decodeShort(fieldData); + BigDecimal decimal = BigDecimal.valueOf(decodeShort, -statement.getRowDescriptor().getFieldDescriptor(9).getScale()); float floatValue = decimal.floatValue(); assertEquals(testSmallintNumeric, floatValue, 0.001); fieldData = fieldValues.getFieldData(10); - int decodeInt = statement.getFieldDescriptor().getFieldDescriptor(10).getDatatypeCoder().decodeInt(fieldData); - decimal = BigDecimal.valueOf(decodeInt, -statement.getFieldDescriptor().getFieldDescriptor(10).getScale()); + int decodeInt = statement.getRowDescriptor().getFieldDescriptor(10).getDatatypeCoder().decodeInt(fieldData); + decimal = BigDecimal.valueOf(decodeInt, -statement.getRowDescriptor().getFieldDescriptor(10).getScale()); double doubleValue = decimal.doubleValue(); assertEquals(testSmallintNumeric, doubleValue, 0.001); fieldData = fieldValues.getFieldData(11); - decodeInt = statement.getFieldDescriptor().getFieldDescriptor(11).getDatatypeCoder().decodeInt(fieldData); - decimal = BigDecimal.valueOf(decodeInt, -statement.getFieldDescriptor().getFieldDescriptor(11).getScale()); + decodeInt = statement.getRowDescriptor().getFieldDescriptor(11).getDatatypeCoder().decodeInt(fieldData); + decimal = BigDecimal.valueOf(decodeInt, -statement.getRowDescriptor().getFieldDescriptor(11).getScale()); doubleValue = decimal.doubleValue(); assertEquals(testIntNumeric, doubleValue, 0); fieldData = fieldValues.getFieldData(12); - decodeInt = statement.getFieldDescriptor().getFieldDescriptor(12).getDatatypeCoder().decodeInt(fieldData); - decimal = BigDecimal.valueOf(decodeInt, -statement.getFieldDescriptor().getFieldDescriptor(12).getScale()); + decodeInt = statement.getRowDescriptor().getFieldDescriptor(12).getDatatypeCoder().decodeInt(fieldData); + decimal = BigDecimal.valueOf(decodeInt, -statement.getRowDescriptor().getFieldDescriptor(12).getScale()); doubleValue = decimal.doubleValue(); assertEquals(testIntNumeric2, doubleValue, 0); fieldData = fieldValues.getFieldData(13); - long decodeLong = statement.getFieldDescriptor().getFieldDescriptor(13).getDatatypeCoder().decodeLong(fieldData); - decimal = BigDecimal.valueOf(decodeLong, -statement.getFieldDescriptor().getFieldDescriptor(13).getScale()); + long decodeLong = statement.getRowDescriptor().getFieldDescriptor(13).getDatatypeCoder().decodeLong(fieldData); + decimal = BigDecimal.valueOf(decodeLong, -statement.getRowDescriptor().getFieldDescriptor(13).getScale()); doubleValue = decimal.doubleValue(); assertEquals(testBigintNumeric, doubleValue, 0); fieldData = fieldValues.getFieldData(14); - decodeLong = statement.getFieldDescriptor().getFieldDescriptor(14).getDatatypeCoder().decodeLong(fieldData); - decimal = BigDecimal.valueOf(decodeLong, -statement.getFieldDescriptor().getFieldDescriptor(14).getScale()); + decodeLong = statement.getRowDescriptor().getFieldDescriptor(14).getDatatypeCoder().decodeLong(fieldData); + decimal = BigDecimal.valueOf(decodeLong, -statement.getRowDescriptor().getFieldDescriptor(14).getScale()); doubleValue = decimal.doubleValue(); assertEquals(testBigintNumeric2, doubleValue, 0); fieldData = fieldValues.getFieldData(15); assertEquals(testDate, - statement.getFieldDescriptor().getFieldDescriptor(15).getDatatypeCoder().decodeDate(fieldData)); + statement.getRowDescriptor().getFieldDescriptor(15).getDatatypeCoder().decodeDate(fieldData)); fieldData = fieldValues.getFieldData(16); assertEquals(testTime, - statement.getFieldDescriptor().getFieldDescriptor(16).getDatatypeCoder().decodeTime(fieldData)); + statement.getRowDescriptor().getFieldDescriptor(16).getDatatypeCoder().decodeTime(fieldData)); fieldData = fieldValues.getFieldData(17); assertEquals(testTimestamp, - statement.getFieldDescriptor().getFieldDescriptor(17).getDatatypeCoder().decodeTimestamp(fieldData)); + statement.getRowDescriptor().getFieldDescriptor(17).getDatatypeCoder().decodeTimestamp(fieldData)); } @@ -288,9 +287,9 @@ public void testSingleExecuteBatchWithBlobs() throws Exception { BatchParameterBuffer buffer = new BatchParameterBufferImpl(); buffer.addArgument(FbInterface.IBatch.TAG_RECORD_COUNTS, 1); // continue batch processing in case of errors in some messages - buffer.addArgument(FbBatch.TAG_MULTIERROR, 1); + buffer.addArgument(BatchParameterBuffer.TAG_MULTIERROR, 1); // enable blobs processing - IDs generated by firebird engine - buffer.addArgument(FbBatch.TAG_BLOB_POLICY, FbBatch.BLOB_ID_ENGINE); + buffer.addArgument(BatchParameterBuffer.TAG_BLOB_POLICY, BatchParameterBuffer.BLOB_ID_ENGINE); IBatchImpl batch = (IBatchImpl) db.createBatch(transaction, INSERT_QUERY_WITH_BLOBS, buffer); int testInteger = 42; @@ -362,92 +361,92 @@ public void testSingleExecuteBatchWithBlobs() throws Exception { RowValue fieldValues = statementListener.getRows().get(0); byte[] fieldData = fieldValues.getFieldData(0); assertEquals(testInteger, - statement.getFieldDescriptor().getFieldDescriptor(0).getDatatypeCoder().decodeInt(fieldData)); + statement.getRowDescriptor().getFieldDescriptor(0).getDatatypeCoder().decodeInt(fieldData)); fieldData = fieldValues.getFieldData(1); assertEquals(testVarchar, - statement.getFieldDescriptor().getFieldDescriptor(1).getDatatypeCoder().decodeString(fieldData)); + statement.getRowDescriptor().getFieldDescriptor(1).getDatatypeCoder().decodeString(fieldData)); fieldData = fieldValues.getFieldData(2); assertEquals(testVarchar, - statement.getFieldDescriptor().getFieldDescriptor(2).getDatatypeCoder().decodeString(fieldData)); + statement.getRowDescriptor().getFieldDescriptor(2).getDatatypeCoder().decodeString(fieldData)); fieldData = fieldValues.getFieldData(3); assertEquals(testVarchar, - statement.getFieldDescriptor().getFieldDescriptor(3).getDatatypeCoder().decodeString(fieldData)); + statement.getRowDescriptor().getFieldDescriptor(3).getDatatypeCoder().decodeString(fieldData)); fieldData = fieldValues.getFieldData(4); assertEquals(testBigInteger, - statement.getFieldDescriptor().getFieldDescriptor(4).getDatatypeCoder().decodeLong(fieldData)); + statement.getRowDescriptor().getFieldDescriptor(4).getDatatypeCoder().decodeLong(fieldData)); fieldData = fieldValues.getFieldData(5); assertEquals(testInteger, - statement.getFieldDescriptor().getFieldDescriptor(5).getDatatypeCoder().decodeInt(fieldData)); + statement.getRowDescriptor().getFieldDescriptor(5).getDatatypeCoder().decodeInt(fieldData)); fieldData = fieldValues.getFieldData(6); assertEquals(testShort, - statement.getFieldDescriptor().getFieldDescriptor(6).getDatatypeCoder().decodeShort(fieldData)); + statement.getRowDescriptor().getFieldDescriptor(6).getDatatypeCoder().decodeShort(fieldData)); fieldData = fieldValues.getFieldData(7); assertEquals(testFloat, - statement.getFieldDescriptor().getFieldDescriptor(7).getDatatypeCoder().decodeFloat(fieldData), + statement.getRowDescriptor().getFieldDescriptor(7).getDatatypeCoder().decodeFloat(fieldData), 0); fieldData = fieldValues.getFieldData(8); assertEquals(testDouble, - statement.getFieldDescriptor().getFieldDescriptor(8).getDatatypeCoder().decodeDouble(fieldData), + statement.getRowDescriptor().getFieldDescriptor(8).getDatatypeCoder().decodeDouble(fieldData), 0); fieldData = fieldValues.getFieldData(9); - short decodeShort = statement.getFieldDescriptor().getFieldDescriptor(9).getDatatypeCoder().decodeShort(fieldData); - BigDecimal decimal = BigDecimal.valueOf(decodeShort, -statement.getFieldDescriptor().getFieldDescriptor(9).getScale()); + short decodeShort = statement.getRowDescriptor().getFieldDescriptor(9).getDatatypeCoder().decodeShort(fieldData); + BigDecimal decimal = BigDecimal.valueOf(decodeShort, -statement.getRowDescriptor().getFieldDescriptor(9).getScale()); float floatValue = decimal.floatValue(); assertEquals(testSmallintNumeric, floatValue, 0.001); fieldData = fieldValues.getFieldData(10); - int decodeInt = statement.getFieldDescriptor().getFieldDescriptor(10).getDatatypeCoder().decodeInt(fieldData); - decimal = BigDecimal.valueOf(decodeInt, -statement.getFieldDescriptor().getFieldDescriptor(10).getScale()); + int decodeInt = statement.getRowDescriptor().getFieldDescriptor(10).getDatatypeCoder().decodeInt(fieldData); + decimal = BigDecimal.valueOf(decodeInt, -statement.getRowDescriptor().getFieldDescriptor(10).getScale()); double doubleValue = decimal.doubleValue(); assertEquals(testSmallintNumeric, doubleValue, 0.001); fieldData = fieldValues.getFieldData(11); - decodeInt = statement.getFieldDescriptor().getFieldDescriptor(11).getDatatypeCoder().decodeInt(fieldData); - decimal = BigDecimal.valueOf(decodeInt, -statement.getFieldDescriptor().getFieldDescriptor(11).getScale()); + decodeInt = statement.getRowDescriptor().getFieldDescriptor(11).getDatatypeCoder().decodeInt(fieldData); + decimal = BigDecimal.valueOf(decodeInt, -statement.getRowDescriptor().getFieldDescriptor(11).getScale()); doubleValue = decimal.doubleValue(); assertEquals(testIntNumeric, doubleValue, 0); fieldData = fieldValues.getFieldData(12); - decodeInt = statement.getFieldDescriptor().getFieldDescriptor(12).getDatatypeCoder().decodeInt(fieldData); - decimal = BigDecimal.valueOf(decodeInt, -statement.getFieldDescriptor().getFieldDescriptor(12).getScale()); + decodeInt = statement.getRowDescriptor().getFieldDescriptor(12).getDatatypeCoder().decodeInt(fieldData); + decimal = BigDecimal.valueOf(decodeInt, -statement.getRowDescriptor().getFieldDescriptor(12).getScale()); doubleValue = decimal.doubleValue(); assertEquals(testIntNumeric2, doubleValue, 0); fieldData = fieldValues.getFieldData(13); - long decodeLong = statement.getFieldDescriptor().getFieldDescriptor(13).getDatatypeCoder().decodeLong(fieldData); - decimal = BigDecimal.valueOf(decodeLong, -statement.getFieldDescriptor().getFieldDescriptor(13).getScale()); + long decodeLong = statement.getRowDescriptor().getFieldDescriptor(13).getDatatypeCoder().decodeLong(fieldData); + decimal = BigDecimal.valueOf(decodeLong, -statement.getRowDescriptor().getFieldDescriptor(13).getScale()); doubleValue = decimal.doubleValue(); assertEquals(testBigintNumeric, doubleValue, 0); fieldData = fieldValues.getFieldData(14); - decodeLong = statement.getFieldDescriptor().getFieldDescriptor(14).getDatatypeCoder().decodeLong(fieldData); - decimal = BigDecimal.valueOf(decodeLong, -statement.getFieldDescriptor().getFieldDescriptor(14).getScale()); + decodeLong = statement.getRowDescriptor().getFieldDescriptor(14).getDatatypeCoder().decodeLong(fieldData); + decimal = BigDecimal.valueOf(decodeLong, -statement.getRowDescriptor().getFieldDescriptor(14).getScale()); doubleValue = decimal.doubleValue(); assertEquals(testBigintNumeric2, doubleValue, 0); fieldData = fieldValues.getFieldData(15); assertEquals(testDate, - statement.getFieldDescriptor().getFieldDescriptor(15).getDatatypeCoder().decodeDate(fieldData)); + statement.getRowDescriptor().getFieldDescriptor(15).getDatatypeCoder().decodeDate(fieldData)); fieldData = fieldValues.getFieldData(16); assertEquals(testTime, - statement.getFieldDescriptor().getFieldDescriptor(16).getDatatypeCoder().decodeTime(fieldData)); + statement.getRowDescriptor().getFieldDescriptor(16).getDatatypeCoder().decodeTime(fieldData)); fieldData = fieldValues.getFieldData(17); assertEquals(testTimestamp, - statement.getFieldDescriptor().getFieldDescriptor(17).getDatatypeCoder().decodeTimestamp(fieldData)); + statement.getRowDescriptor().getFieldDescriptor(17).getDatatypeCoder().decodeTimestamp(fieldData)); fieldData = fieldValues.getFieldData(18); - blobID = statement.getFieldDescriptor().getFieldDescriptor(18).getDatatypeCoder().decodeLong(fieldData); + blobID = statement.getRowDescriptor().getFieldDescriptor(18).getDatatypeCoder().decodeLong(fieldData); checkBlob(blobID, INSERT_QUERY_WITH_BLOBS.getBytes()); fieldData = fieldValues.getFieldData(19); - blobID = statement.getFieldDescriptor().getFieldDescriptor(19).getDatatypeCoder().decodeLong(fieldData); + blobID = statement.getRowDescriptor().getFieldDescriptor(19).getDatatypeCoder().decodeLong(fieldData); checkBlob(blobID, INSERT_QUERY_WITH_BLOBS.getBytes()); fieldData = fieldValues.getFieldData(20); - blobID = statement.getFieldDescriptor().getFieldDescriptor(20).getDatatypeCoder().decodeLong(fieldData); + blobID = statement.getRowDescriptor().getFieldDescriptor(20).getDatatypeCoder().decodeLong(fieldData); checkBlob(blobID, new String(INSERT_QUERY_WITH_BLOBS + "\n" + INSERT_QUERY_ONLY_BLOBS).getBytes()); } @@ -455,7 +454,7 @@ public void testSingleExecuteBatchWithBlobs() throws Exception { public void testMultipleMessagesBatchWithoutBlobs() throws SQLException { allocateTransaction(); BatchParameterBuffer buffer = new BatchParameterBufferImpl(); - buffer.addArgument(FbBatch.TAG_RECORD_COUNTS, 1); + buffer.addArgument(BatchParameterBuffer.TAG_RECORD_COUNTS, 1); IBatchImpl batch = (IBatchImpl) db.createBatch(transaction, INSERT_QUERY_WITHOUT_BLOBS, buffer); int testInteger = 42; @@ -561,84 +560,84 @@ public void testMultipleMessagesBatchWithoutBlobs() throws SQLException { RowValue fieldValues = statementListener.getRows().get(2); byte[] fieldData = fieldValues.getFieldData(0); assertEquals(testInteger, - statement.getFieldDescriptor().getFieldDescriptor(0).getDatatypeCoder().decodeInt(fieldData)); + statement.getRowDescriptor().getFieldDescriptor(0).getDatatypeCoder().decodeInt(fieldData)); fieldData = fieldValues.getFieldData(1); assertEquals(testVarchar, - statement.getFieldDescriptor().getFieldDescriptor(1).getDatatypeCoder().decodeString(fieldData)); + statement.getRowDescriptor().getFieldDescriptor(1).getDatatypeCoder().decodeString(fieldData)); fieldData = fieldValues.getFieldData(2); assertEquals(testVarchar, - statement.getFieldDescriptor().getFieldDescriptor(2).getDatatypeCoder().decodeString(fieldData)); + statement.getRowDescriptor().getFieldDescriptor(2).getDatatypeCoder().decodeString(fieldData)); fieldData = fieldValues.getFieldData(3); assertEquals(testVarchar, - statement.getFieldDescriptor().getFieldDescriptor(3).getDatatypeCoder().decodeString(fieldData)); + statement.getRowDescriptor().getFieldDescriptor(3).getDatatypeCoder().decodeString(fieldData)); fieldData = fieldValues.getFieldData(4); assertEquals(testBigInteger, - statement.getFieldDescriptor().getFieldDescriptor(4).getDatatypeCoder().decodeLong(fieldData)); + statement.getRowDescriptor().getFieldDescriptor(4).getDatatypeCoder().decodeLong(fieldData)); fieldData = fieldValues.getFieldData(5); assertEquals(testInteger, - statement.getFieldDescriptor().getFieldDescriptor(5).getDatatypeCoder().decodeInt(fieldData)); + statement.getRowDescriptor().getFieldDescriptor(5).getDatatypeCoder().decodeInt(fieldData)); fieldData = fieldValues.getFieldData(6); assertEquals(testShort, - statement.getFieldDescriptor().getFieldDescriptor(6).getDatatypeCoder().decodeShort(fieldData)); + statement.getRowDescriptor().getFieldDescriptor(6).getDatatypeCoder().decodeShort(fieldData)); fieldData = fieldValues.getFieldData(7); assertEquals(testFloat, - statement.getFieldDescriptor().getFieldDescriptor(7).getDatatypeCoder().decodeFloat(fieldData), + statement.getRowDescriptor().getFieldDescriptor(7).getDatatypeCoder().decodeFloat(fieldData), 0); fieldData = fieldValues.getFieldData(8); assertEquals(testDouble, - statement.getFieldDescriptor().getFieldDescriptor(8).getDatatypeCoder().decodeDouble(fieldData), + statement.getRowDescriptor().getFieldDescriptor(8).getDatatypeCoder().decodeDouble(fieldData), 0); fieldData = fieldValues.getFieldData(9); - short decodeShort = statement.getFieldDescriptor().getFieldDescriptor(9).getDatatypeCoder().decodeShort(fieldData); - BigDecimal decimal = BigDecimal.valueOf(decodeShort, -statement.getFieldDescriptor().getFieldDescriptor(9).getScale()); + short decodeShort = statement.getRowDescriptor().getFieldDescriptor(9).getDatatypeCoder().decodeShort(fieldData); + BigDecimal decimal = BigDecimal.valueOf(decodeShort, -statement.getRowDescriptor().getFieldDescriptor(9).getScale()); float floatValue = decimal.floatValue(); assertEquals(testSmallintNumeric, floatValue, 0.001); fieldData = fieldValues.getFieldData(10); - int decodeInt = statement.getFieldDescriptor().getFieldDescriptor(10).getDatatypeCoder().decodeInt(fieldData); - decimal = BigDecimal.valueOf(decodeInt, -statement.getFieldDescriptor().getFieldDescriptor(10).getScale()); + int decodeInt = statement.getRowDescriptor().getFieldDescriptor(10).getDatatypeCoder().decodeInt(fieldData); + decimal = BigDecimal.valueOf(decodeInt, -statement.getRowDescriptor().getFieldDescriptor(10).getScale()); double doubleValue = decimal.doubleValue(); assertEquals(testSmallintNumeric, doubleValue, 0.001); fieldData = fieldValues.getFieldData(11); - decodeInt = statement.getFieldDescriptor().getFieldDescriptor(11).getDatatypeCoder().decodeInt(fieldData); - decimal = BigDecimal.valueOf(decodeInt, -statement.getFieldDescriptor().getFieldDescriptor(11).getScale()); + decodeInt = statement.getRowDescriptor().getFieldDescriptor(11).getDatatypeCoder().decodeInt(fieldData); + decimal = BigDecimal.valueOf(decodeInt, -statement.getRowDescriptor().getFieldDescriptor(11).getScale()); doubleValue = decimal.doubleValue(); assertEquals(testIntNumeric, doubleValue, 0); fieldData = fieldValues.getFieldData(12); - decodeInt = statement.getFieldDescriptor().getFieldDescriptor(12).getDatatypeCoder().decodeInt(fieldData); - decimal = BigDecimal.valueOf(decodeInt, -statement.getFieldDescriptor().getFieldDescriptor(12).getScale()); + decodeInt = statement.getRowDescriptor().getFieldDescriptor(12).getDatatypeCoder().decodeInt(fieldData); + decimal = BigDecimal.valueOf(decodeInt, -statement.getRowDescriptor().getFieldDescriptor(12).getScale()); doubleValue = decimal.doubleValue(); assertEquals(testIntNumeric2, doubleValue, 0); fieldData = fieldValues.getFieldData(13); - long decodeLong = statement.getFieldDescriptor().getFieldDescriptor(13).getDatatypeCoder().decodeLong(fieldData); - decimal = BigDecimal.valueOf(decodeLong, -statement.getFieldDescriptor().getFieldDescriptor(13).getScale()); + long decodeLong = statement.getRowDescriptor().getFieldDescriptor(13).getDatatypeCoder().decodeLong(fieldData); + decimal = BigDecimal.valueOf(decodeLong, -statement.getRowDescriptor().getFieldDescriptor(13).getScale()); doubleValue = decimal.doubleValue(); assertEquals(testBigintNumeric, doubleValue, 0); fieldData = fieldValues.getFieldData(14); - decodeLong = statement.getFieldDescriptor().getFieldDescriptor(14).getDatatypeCoder().decodeLong(fieldData); - decimal = BigDecimal.valueOf(decodeLong, -statement.getFieldDescriptor().getFieldDescriptor(14).getScale()); + decodeLong = statement.getRowDescriptor().getFieldDescriptor(14).getDatatypeCoder().decodeLong(fieldData); + decimal = BigDecimal.valueOf(decodeLong, -statement.getRowDescriptor().getFieldDescriptor(14).getScale()); doubleValue = decimal.doubleValue(); assertEquals(testBigintNumeric2, doubleValue, 0); fieldData = fieldValues.getFieldData(15); assertEquals(testDate, - statement.getFieldDescriptor().getFieldDescriptor(15).getDatatypeCoder().decodeDate(fieldData)); + statement.getRowDescriptor().getFieldDescriptor(15).getDatatypeCoder().decodeDate(fieldData)); fieldData = fieldValues.getFieldData(16); assertEquals(testTime, - statement.getFieldDescriptor().getFieldDescriptor(16).getDatatypeCoder().decodeTime(fieldData)); + statement.getRowDescriptor().getFieldDescriptor(16).getDatatypeCoder().decodeTime(fieldData)); fieldData = fieldValues.getFieldData(17); assertEquals(testTimestamp, - statement.getFieldDescriptor().getFieldDescriptor(17).getDatatypeCoder().decodeTimestamp(fieldData)); + statement.getRowDescriptor().getFieldDescriptor(17).getDatatypeCoder().decodeTimestamp(fieldData)); } @Test @@ -647,9 +646,9 @@ public void testMultipleMessagesBatchWithBlobs() throws Exception { BatchParameterBuffer buffer = new BatchParameterBufferImpl(); buffer.addArgument(FbInterface.IBatch.TAG_RECORD_COUNTS, 1); // continue batch processing in case of errors in some messages - buffer.addArgument(FbBatch.TAG_MULTIERROR, 1); + buffer.addArgument(BatchParameterBuffer.TAG_MULTIERROR, 1); // enable blobs processing - IDs generated by firebird engine - buffer.addArgument(FbBatch.TAG_BLOB_POLICY, FbBatch.BLOB_ID_ENGINE); + buffer.addArgument(BatchParameterBuffer.TAG_BLOB_POLICY, BatchParameterBuffer.BLOB_ID_ENGINE); IBatchImpl batch = (IBatchImpl) db.createBatch(transaction, INSERT_QUERY_WITH_BLOBS, buffer); int testInteger = 42; @@ -771,92 +770,92 @@ public void testMultipleMessagesBatchWithBlobs() throws Exception { RowValue fieldValues = statementListener.getRows().get(2); byte[] fieldData = fieldValues.getFieldData(0); assertEquals(testInteger, - statement.getFieldDescriptor().getFieldDescriptor(0).getDatatypeCoder().decodeInt(fieldData)); + statement.getRowDescriptor().getFieldDescriptor(0).getDatatypeCoder().decodeInt(fieldData)); fieldData = fieldValues.getFieldData(1); assertEquals(testVarchar, - statement.getFieldDescriptor().getFieldDescriptor(1).getDatatypeCoder().decodeString(fieldData)); + statement.getRowDescriptor().getFieldDescriptor(1).getDatatypeCoder().decodeString(fieldData)); fieldData = fieldValues.getFieldData(2); assertEquals(testVarchar, - statement.getFieldDescriptor().getFieldDescriptor(2).getDatatypeCoder().decodeString(fieldData)); + statement.getRowDescriptor().getFieldDescriptor(2).getDatatypeCoder().decodeString(fieldData)); fieldData = fieldValues.getFieldData(3); assertEquals(testVarchar, - statement.getFieldDescriptor().getFieldDescriptor(3).getDatatypeCoder().decodeString(fieldData)); + statement.getRowDescriptor().getFieldDescriptor(3).getDatatypeCoder().decodeString(fieldData)); fieldData = fieldValues.getFieldData(4); assertEquals(testBigInteger, - statement.getFieldDescriptor().getFieldDescriptor(4).getDatatypeCoder().decodeLong(fieldData)); + statement.getRowDescriptor().getFieldDescriptor(4).getDatatypeCoder().decodeLong(fieldData)); fieldData = fieldValues.getFieldData(5); assertEquals(testInteger, - statement.getFieldDescriptor().getFieldDescriptor(5).getDatatypeCoder().decodeInt(fieldData)); + statement.getRowDescriptor().getFieldDescriptor(5).getDatatypeCoder().decodeInt(fieldData)); fieldData = fieldValues.getFieldData(6); assertEquals(testShort, - statement.getFieldDescriptor().getFieldDescriptor(6).getDatatypeCoder().decodeShort(fieldData)); + statement.getRowDescriptor().getFieldDescriptor(6).getDatatypeCoder().decodeShort(fieldData)); fieldData = fieldValues.getFieldData(7); assertEquals(testFloat, - statement.getFieldDescriptor().getFieldDescriptor(7).getDatatypeCoder().decodeFloat(fieldData), + statement.getRowDescriptor().getFieldDescriptor(7).getDatatypeCoder().decodeFloat(fieldData), 0); fieldData = fieldValues.getFieldData(8); assertEquals(testDouble, - statement.getFieldDescriptor().getFieldDescriptor(8).getDatatypeCoder().decodeDouble(fieldData), + statement.getRowDescriptor().getFieldDescriptor(8).getDatatypeCoder().decodeDouble(fieldData), 0); fieldData = fieldValues.getFieldData(9); - short decodeShort = statement.getFieldDescriptor().getFieldDescriptor(9).getDatatypeCoder().decodeShort(fieldData); - BigDecimal decimal = BigDecimal.valueOf(decodeShort, -statement.getFieldDescriptor().getFieldDescriptor(9).getScale()); + short decodeShort = statement.getRowDescriptor().getFieldDescriptor(9).getDatatypeCoder().decodeShort(fieldData); + BigDecimal decimal = BigDecimal.valueOf(decodeShort, -statement.getRowDescriptor().getFieldDescriptor(9).getScale()); float floatValue = decimal.floatValue(); assertEquals(testSmallintNumeric, floatValue, 0.001); fieldData = fieldValues.getFieldData(10); - int decodeInt = statement.getFieldDescriptor().getFieldDescriptor(10).getDatatypeCoder().decodeInt(fieldData); - decimal = BigDecimal.valueOf(decodeInt, -statement.getFieldDescriptor().getFieldDescriptor(10).getScale()); + int decodeInt = statement.getRowDescriptor().getFieldDescriptor(10).getDatatypeCoder().decodeInt(fieldData); + decimal = BigDecimal.valueOf(decodeInt, -statement.getRowDescriptor().getFieldDescriptor(10).getScale()); double doubleValue = decimal.doubleValue(); assertEquals(testSmallintNumeric, doubleValue, 0.001); fieldData = fieldValues.getFieldData(11); - decodeInt = statement.getFieldDescriptor().getFieldDescriptor(11).getDatatypeCoder().decodeInt(fieldData); - decimal = BigDecimal.valueOf(decodeInt, -statement.getFieldDescriptor().getFieldDescriptor(11).getScale()); + decodeInt = statement.getRowDescriptor().getFieldDescriptor(11).getDatatypeCoder().decodeInt(fieldData); + decimal = BigDecimal.valueOf(decodeInt, -statement.getRowDescriptor().getFieldDescriptor(11).getScale()); doubleValue = decimal.doubleValue(); assertEquals(testIntNumeric, doubleValue, 0); fieldData = fieldValues.getFieldData(12); - decodeInt = statement.getFieldDescriptor().getFieldDescriptor(12).getDatatypeCoder().decodeInt(fieldData); - decimal = BigDecimal.valueOf(decodeInt, -statement.getFieldDescriptor().getFieldDescriptor(12).getScale()); + decodeInt = statement.getRowDescriptor().getFieldDescriptor(12).getDatatypeCoder().decodeInt(fieldData); + decimal = BigDecimal.valueOf(decodeInt, -statement.getRowDescriptor().getFieldDescriptor(12).getScale()); doubleValue = decimal.doubleValue(); assertEquals(testIntNumeric2, doubleValue, 0); fieldData = fieldValues.getFieldData(13); - long decodeLong = statement.getFieldDescriptor().getFieldDescriptor(13).getDatatypeCoder().decodeLong(fieldData); - decimal = BigDecimal.valueOf(decodeLong, -statement.getFieldDescriptor().getFieldDescriptor(13).getScale()); + long decodeLong = statement.getRowDescriptor().getFieldDescriptor(13).getDatatypeCoder().decodeLong(fieldData); + decimal = BigDecimal.valueOf(decodeLong, -statement.getRowDescriptor().getFieldDescriptor(13).getScale()); doubleValue = decimal.doubleValue(); assertEquals(testBigintNumeric, doubleValue, 0); fieldData = fieldValues.getFieldData(14); - decodeLong = statement.getFieldDescriptor().getFieldDescriptor(14).getDatatypeCoder().decodeLong(fieldData); - decimal = BigDecimal.valueOf(decodeLong, -statement.getFieldDescriptor().getFieldDescriptor(14).getScale()); + decodeLong = statement.getRowDescriptor().getFieldDescriptor(14).getDatatypeCoder().decodeLong(fieldData); + decimal = BigDecimal.valueOf(decodeLong, -statement.getRowDescriptor().getFieldDescriptor(14).getScale()); doubleValue = decimal.doubleValue(); assertEquals(testBigintNumeric2, doubleValue, 0); fieldData = fieldValues.getFieldData(15); assertEquals(testDate, - statement.getFieldDescriptor().getFieldDescriptor(15).getDatatypeCoder().decodeDate(fieldData)); + statement.getRowDescriptor().getFieldDescriptor(15).getDatatypeCoder().decodeDate(fieldData)); fieldData = fieldValues.getFieldData(16); assertEquals(testTime, - statement.getFieldDescriptor().getFieldDescriptor(16).getDatatypeCoder().decodeTime(fieldData)); + statement.getRowDescriptor().getFieldDescriptor(16).getDatatypeCoder().decodeTime(fieldData)); fieldData = fieldValues.getFieldData(17); assertEquals(testTimestamp, - statement.getFieldDescriptor().getFieldDescriptor(17).getDatatypeCoder().decodeTimestamp(fieldData)); + statement.getRowDescriptor().getFieldDescriptor(17).getDatatypeCoder().decodeTimestamp(fieldData)); fieldData = fieldValues.getFieldData(18); - blobID = statement.getFieldDescriptor().getFieldDescriptor(18).getDatatypeCoder().decodeLong(fieldData); + blobID = statement.getRowDescriptor().getFieldDescriptor(18).getDatatypeCoder().decodeLong(fieldData); checkBlob(blobID, testBytes); fieldData = fieldValues.getFieldData(19); - blobID = statement.getFieldDescriptor().getFieldDescriptor(19).getDatatypeCoder().decodeLong(fieldData); + blobID = statement.getRowDescriptor().getFieldDescriptor(19).getDatatypeCoder().decodeLong(fieldData); checkBlob(blobID, testBytes); fieldData = fieldValues.getFieldData(20); - blobID = statement.getFieldDescriptor().getFieldDescriptor(20).getDatatypeCoder().decodeLong(fieldData); + blobID = statement.getRowDescriptor().getFieldDescriptor(20).getDatatypeCoder().decodeLong(fieldData); checkBlob(blobID, testBytes); } @@ -865,7 +864,7 @@ public void testBatchWithBlobStream() throws Exception { allocateTransaction(); BatchParameterBuffer buffer = new BatchParameterBufferImpl(); // Blobs are placed in a stream - buffer.addArgument(FbBatch.TAG_BLOB_POLICY, FbBatch.BLOB_STREAM); + buffer.addArgument(BatchParameterBuffer.TAG_BLOB_POLICY, BatchParameterBuffer.BLOB_STREAM); IBatchImpl batch = (IBatchImpl) db.createBatch(transaction, INSERT_QUERY_ONLY_BLOBS, buffer); GDSHelper h = new GDSHelper(db); @@ -911,13 +910,13 @@ public void testBatchWithBlobStream() throws Exception { statement.fetchRows(1); RowValue fieldValues = statementListener.getRows().get(0); byte[] fieldData = fieldValues.getFieldData(0); - long blobID = statement.getFieldDescriptor().getFieldDescriptor(0).getDatatypeCoder().decodeLong(fieldData); + long blobID = statement.getRowDescriptor().getFieldDescriptor(0).getDatatypeCoder().decodeLong(fieldData); checkBlob(blobID, d1.getBytes()); fieldData = fieldValues.getFieldData(1); - blobID = statement.getFieldDescriptor().getFieldDescriptor(1).getDatatypeCoder().decodeLong(fieldData); + blobID = statement.getRowDescriptor().getFieldDescriptor(1).getDatatypeCoder().decodeLong(fieldData); checkBlob(blobID, d2.getBytes()); fieldData = fieldValues.getFieldData(2); - blobID = statement.getFieldDescriptor().getFieldDescriptor(2).getDatatypeCoder().decodeLong(fieldData); + blobID = statement.getRowDescriptor().getFieldDescriptor(2).getDatatypeCoder().decodeLong(fieldData); checkBlob(blobID, d3.getBytes()); } @@ -926,7 +925,7 @@ public void testBatchWithSegmentedBlobs() throws Exception { allocateTransaction(); BatchParameterBuffer buffer = new BatchParameterBufferImpl(); // Blobs are placed in a stream - buffer.addArgument(FbBatch.TAG_BLOB_POLICY, FbBatch.BLOB_STREAM); + buffer.addArgument(BatchParameterBuffer.TAG_BLOB_POLICY, BatchParameterBuffer.BLOB_STREAM); FbBatch batch = db.createBatch(transaction, INSERT_QUERY_ONLY_BLOBS, buffer); GDSHelper h = new GDSHelper(db); @@ -992,13 +991,13 @@ public void testBatchWithSegmentedBlobs() throws Exception { RowValue fieldValues = statementListener.getRows().get(0); byte[] fieldData = fieldValues.getFieldData(0); - long blobID = statement.getFieldDescriptor().getFieldDescriptor(0).getDatatypeCoder().decodeLong(fieldData); + long blobID = statement.getRowDescriptor().getFieldDescriptor(0).getDatatypeCoder().decodeLong(fieldData); checkBlob(blobID, allSegments.getBytes()); fieldData = fieldValues.getFieldData(1); - blobID = statement.getFieldDescriptor().getFieldDescriptor(1).getDatatypeCoder().decodeLong(fieldData); + blobID = statement.getRowDescriptor().getFieldDescriptor(1).getDatatypeCoder().decodeLong(fieldData); checkBlob(blobID, allSegments.getBytes()); fieldData = fieldValues.getFieldData(2); - blobID = statement.getFieldDescriptor().getFieldDescriptor(2).getDatatypeCoder().decodeLong(fieldData); + blobID = statement.getRowDescriptor().getFieldDescriptor(2).getDatatypeCoder().decodeLong(fieldData); checkBlob(blobID, allSegments.getBytes()); } @@ -1007,7 +1006,7 @@ public void testMultipleMessagesBatchWithSegmentedBlobs() throws Exception { allocateTransaction(); BatchParameterBuffer buffer = new BatchParameterBufferImpl(); // Blobs are placed in a stream - buffer.addArgument(FbBatch.TAG_BLOB_POLICY, FbBatch.BLOB_STREAM); + buffer.addArgument(BatchParameterBuffer.TAG_BLOB_POLICY, BatchParameterBuffer.BLOB_STREAM); FbBatch batch = db.createBatch(transaction, INSERT_QUERY_ONLY_BLOBS, buffer); GDSHelper h = new GDSHelper(db); @@ -1130,13 +1129,13 @@ public void testMultipleMessagesBatchWithSegmentedBlobs() throws Exception { RowValue fieldValues = statementListener.getRows().get(1); byte[] fieldData = fieldValues.getFieldData(0); - long blobID = statement.getFieldDescriptor().getFieldDescriptor(0).getDatatypeCoder().decodeLong(fieldData); + long blobID = statement.getRowDescriptor().getFieldDescriptor(0).getDatatypeCoder().decodeLong(fieldData); checkBlob(blobID, allSegments.getBytes()); fieldData = fieldValues.getFieldData(1); - blobID = statement.getFieldDescriptor().getFieldDescriptor(1).getDatatypeCoder().decodeLong(fieldData); + blobID = statement.getRowDescriptor().getFieldDescriptor(1).getDatatypeCoder().decodeLong(fieldData); checkBlob(blobID, allSegments.getBytes()); fieldData = fieldValues.getFieldData(2); - blobID = statement.getFieldDescriptor().getFieldDescriptor(2).getDatatypeCoder().decodeLong(fieldData); + blobID = statement.getRowDescriptor().getFieldDescriptor(2).getDatatypeCoder().decodeLong(fieldData); checkBlob(blobID, allSegments.getBytes()); } @@ -1145,7 +1144,7 @@ public void testBatchWithRegisteredBlobs() throws Exception { allocateTransaction(); BatchParameterBuffer buffer = new BatchParameterBufferImpl(); // Blobs are placed in a stream - buffer.addArgument(FbBatch.TAG_BLOB_POLICY, FbBatch.BLOB_STREAM); + buffer.addArgument(BatchParameterBuffer.TAG_BLOB_POLICY, BatchParameterBuffer.BLOB_STREAM); FbBatch batch = db.createBatch(transaction, INSERT_QUERY_ONLY_BLOBS, buffer); GDSHelper h = new GDSHelper(db); @@ -1196,13 +1195,13 @@ public void testBatchWithRegisteredBlobs() throws Exception { RowValue fieldValues = statementListener.getRows().get(0); byte[] fieldData = fieldValues.getFieldData(0); - long blobID = statement.getFieldDescriptor().getFieldDescriptor(0).getDatatypeCoder().decodeLong(fieldData); + long blobID = statement.getRowDescriptor().getFieldDescriptor(0).getDatatypeCoder().decodeLong(fieldData); checkBlob(blobID, INSERT_QUERY_WITH_BLOBS.getBytes()); fieldData = fieldValues.getFieldData(1); - blobID = statement.getFieldDescriptor().getFieldDescriptor(1).getDatatypeCoder().decodeLong(fieldData); + blobID = statement.getRowDescriptor().getFieldDescriptor(1).getDatatypeCoder().decodeLong(fieldData); checkBlob(blobID, INSERT_QUERY_WITHOUT_BLOBS.getBytes()); fieldData = fieldValues.getFieldData(2); - blobID = statement.getFieldDescriptor().getFieldDescriptor(2).getDatatypeCoder().decodeLong(fieldData); + blobID = statement.getRowDescriptor().getFieldDescriptor(2).getDatatypeCoder().decodeLong(fieldData); checkBlob(blobID, INSERT_QUERY_ONLY_BLOBS.getBytes()); } @@ -1258,8 +1257,8 @@ public void testBatchWithNulls() throws Exception { RowValue fieldValues = statementListener.getRows().get(0); byte[] fieldData = fieldValues.getFieldData(0); assertEquals(testInteger, - statement.getFieldDescriptor().getFieldDescriptor(0).getDatatypeCoder().decodeInt(fieldData)); - for (int i = 1; i < statement.getFieldDescriptor().getCount(); i++) { + statement.getRowDescriptor().getFieldDescriptor(0).getDatatypeCoder().decodeInt(fieldData)); + for (int i = 1; i < statement.getRowDescriptor().getCount(); i++) { fieldData = fieldValues.getFieldData(i); assertEquals(null, fieldData); } @@ -1270,8 +1269,8 @@ public void testBatchWithBlobNulls() throws Exception { allocateTransaction(); BatchParameterBuffer buffer = new BatchParameterBufferImpl(); buffer.addArgument(FbInterface.IBatch.TAG_RECORD_COUNTS, 1); - buffer.addArgument(FbBatch.TAG_MULTIERROR, 1); - buffer.addArgument(FbBatch.TAG_BLOB_POLICY, FbBatch.BLOB_ID_ENGINE); + buffer.addArgument(BatchParameterBuffer.TAG_MULTIERROR, 1); + buffer.addArgument(BatchParameterBuffer.TAG_BLOB_POLICY, BatchParameterBuffer.BLOB_ID_ENGINE); IBatchImpl batch = (IBatchImpl) db.createBatch(transaction, INSERT_QUERY_WITH_BLOBS, buffer); int testInteger = 42; @@ -1322,8 +1321,8 @@ public void testBatchWithBlobNulls() throws Exception { RowValue fieldValues = statementListener.getRows().get(0); byte[] fieldData = fieldValues.getFieldData(0); assertEquals(testInteger, - statement.getFieldDescriptor().getFieldDescriptor(0).getDatatypeCoder().decodeInt(fieldData)); - for (int i = 1; i < statement.getFieldDescriptor().getCount(); i++) { + statement.getRowDescriptor().getFieldDescriptor(0).getDatatypeCoder().decodeInt(fieldData)); + for (int i = 1; i < statement.getRowDescriptor().getCount(); i++) { fieldData = fieldValues.getFieldData(i); assertEquals(null, fieldData); } diff --git a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IEventBlockImplTest.java b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IEventBlockImplTest.java index e4b8c5833c..2f141b6449 100644 --- a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IEventBlockImplTest.java +++ b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IEventBlockImplTest.java @@ -7,12 +7,9 @@ import org.firebirdsql.gds.EventHandler; import org.firebirdsql.gds.ISCConstants; import org.firebirdsql.gds.TransactionParameterBuffer; -import org.firebirdsql.gds.impl.GDSFactory; -import org.firebirdsql.gds.impl.GDSType; import org.firebirdsql.gds.impl.TransactionParameterBufferImpl; import org.firebirdsql.gds.ng.*; import org.firebirdsql.gds.ng.fields.RowValue; -import org.firebirdsql.gds.ng.jna.AbstractNativeDatabaseFactory; import org.junit.*; import org.junit.rules.ExpectedException; @@ -81,7 +78,7 @@ public void testCreateEventHandle() throws Exception { db = (IDatabaseImpl) factory.connect(connectionInfo); db.attach(); - IEventBlockImpl eventBlock = (IEventBlockImpl)db.createEventHandle("TEST_EVENT", new EventHandler() { + IEventImpl eventBlock = (IEventImpl)db.createEventHandle("TEST_EVENT", new EventHandler() { @Override public void eventOccurred(EventHandle eventHandle) { } diff --git a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IServiceConnectionImplTest.java b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IServiceConnectionImplTest.java index 8b955014e7..5209576a79 100644 --- a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IServiceConnectionImplTest.java +++ b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IServiceConnectionImplTest.java @@ -2,11 +2,8 @@ import org.firebirdsql.common.FBTestProperties; import org.firebirdsql.common.rules.GdsTypeRule; -import org.firebirdsql.gds.impl.GDSFactory; -import org.firebirdsql.gds.impl.GDSType; import org.firebirdsql.gds.ng.FbService; import org.firebirdsql.gds.ng.FbServiceProperties; -import org.firebirdsql.gds.ng.jna.AbstractNativeDatabaseFactory; import org.firebirdsql.jna.fbclient.FbClientLibrary; import org.junit.Before; import org.junit.ClassRule; diff --git a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IServiceImplTest.java b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IServiceImplTest.java index 93056f4da9..b330565b8c 100644 --- a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IServiceImplTest.java +++ b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IServiceImplTest.java @@ -4,12 +4,9 @@ import org.firebirdsql.common.rules.GdsTypeRule; import org.firebirdsql.gds.ISCConstants; import org.firebirdsql.gds.ServiceRequestBuffer; -import org.firebirdsql.gds.impl.GDSFactory; import org.firebirdsql.gds.impl.GDSServerVersion; -import org.firebirdsql.gds.impl.GDSType; import org.firebirdsql.gds.impl.nativeoo.FbOOEmbeddedGDSFactoryPlugin; import org.firebirdsql.gds.ng.FbServiceProperties; -import org.firebirdsql.gds.ng.jna.AbstractNativeDatabaseFactory; import org.firebirdsql.management.FBManager; import org.firebirdsql.management.FBStatisticsManager; import org.junit.Before; @@ -34,6 +31,7 @@ import static org.junit.Assert.*; import static org.junit.Assert.assertThat; import static org.junit.Assume.assumeThat; +import static org.junit.Assume.assumeTrue; public class IServiceImplTest { @@ -103,6 +101,7 @@ public void basicStatusVectorProcessing_wrongLogin() throws Exception { @Test public void testBasicStatusVectorProcessing_wrongService() throws Exception { + assumeTrue("Incorrect service name ignored in Firebird 4+", getDefaultSupportInfo().isVersionBelow(4, 0)); // set invalid database final String invalidServiceName = "doesnotexist"; connectionInfo.setServiceName(invalidServiceName); diff --git a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IStatementImplTest.java b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IStatementImplTest.java index a3535908c5..018cecd705 100644 --- a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IStatementImplTest.java +++ b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IStatementImplTest.java @@ -20,15 +20,12 @@ import org.firebirdsql.common.FBTestProperties; import org.firebirdsql.common.rules.GdsTypeRule; -import org.firebirdsql.gds.impl.GDSFactory; -import org.firebirdsql.gds.impl.GDSType; +import org.firebirdsql.gds.JaybirdErrorCodes; import org.firebirdsql.gds.ng.AbstractStatementTest; import org.firebirdsql.gds.ng.DatatypeCoder; import org.firebirdsql.gds.ng.FbDatabase; import org.firebirdsql.gds.ng.fields.RowValue; -import org.firebirdsql.gds.ng.jna.AbstractNativeDatabaseFactory; import org.firebirdsql.gds.ng.wire.SimpleStatementListener; -import org.junit.Before; import org.junit.ClassRule; import org.junit.Rule; import org.junit.Test; @@ -37,6 +34,7 @@ import java.sql.SQLException; import java.sql.SQLNonTransientException; +import static org.firebirdsql.common.matchers.SQLExceptionMatchers.errorCodeEquals; import static org.junit.Assert.*; /** diff --git a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IStatementimplTimeoutTest.java b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IStatementimplTimeoutTest.java new file mode 100644 index 0000000000..cdb6d6b908 --- /dev/null +++ b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IStatementimplTimeoutTest.java @@ -0,0 +1,28 @@ +package org.firebirdsql.nativeoo.gds.ng; + +import org.firebirdsql.common.FBTestProperties; +import org.firebirdsql.common.rules.GdsTypeRule; +import org.firebirdsql.gds.ng.AbstractStatementTimeoutTest; +import org.firebirdsql.gds.ng.FbDatabase; +import org.junit.ClassRule; + +import java.sql.SQLException; + +public class IStatementimplTimeoutTest extends AbstractStatementTimeoutTest { + + @ClassRule + public static final GdsTypeRule testType = GdsTypeRule.supportsNativeOnly(); + + private final AbstractNativeOODatabaseFactory factory = + (AbstractNativeOODatabaseFactory) FBTestProperties.getFbDatabaseFactory(); + + @Override + protected Class getExpectedDatabaseType() { + return IDatabaseImpl.class; + } + + @Override + protected FbDatabase createDatabase() throws SQLException { + return factory.connect(connectionInfo); + } +} diff --git a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/ITransactionImplTest.java b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/ITransactionImplTest.java index 2cdea3a964..48f33ec740 100644 --- a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/ITransactionImplTest.java +++ b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/ITransactionImplTest.java @@ -2,12 +2,8 @@ import org.firebirdsql.common.FBTestProperties; import org.firebirdsql.common.rules.GdsTypeRule; -import org.firebirdsql.gds.impl.GDSFactory; -import org.firebirdsql.gds.impl.GDSType; import org.firebirdsql.gds.ng.AbstractTransactionTest; import org.firebirdsql.gds.ng.FbDatabase; -import org.firebirdsql.gds.ng.jna.AbstractNativeDatabaseFactory; -import org.junit.Before; import org.junit.ClassRule; import org.junit.Rule; import org.junit.rules.ExpectedException; diff --git a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/NativeDatabaseConnectionTest.java b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/NativeDatabaseConnectionTest.java index 799efcac41..c08fcb8e46 100644 --- a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/NativeDatabaseConnectionTest.java +++ b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/NativeDatabaseConnectionTest.java @@ -2,8 +2,6 @@ import org.firebirdsql.common.FBTestProperties; import org.firebirdsql.common.rules.GdsTypeRule; -import org.firebirdsql.gds.impl.GDSFactory; -import org.firebirdsql.gds.impl.GDSType; import org.firebirdsql.gds.ng.FbConnectionProperties; import org.firebirdsql.gds.ng.FbDatabase; import org.firebirdsql.jna.fbclient.FbClientLibrary; diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbInterface.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbInterface.java index 2b7faff3a9..4e803f1caa 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbInterface.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbInterface.java @@ -13,6 +13,12 @@ */ public interface FbInterface extends FbClientLibrary { + /** + * Original signature : extern "C" IMaster* ISC_EXPORT fb_get_master_interface();
+ * native declaration : firebird/include/firebird/interface.h:364 + */ + IMaster fb_get_master_interface(); + public static interface IVersionedIntf { } @@ -101,6 +107,7 @@ public static interface IFirebirdConfIntf extends IReferenceCountedIntf public long asInteger(int key); public String asString(int key); public boolean asBoolean(int key); + public int getVersion(IStatus status); } public static interface IPluginConfigIntf extends IReferenceCountedIntf @@ -134,9 +141,7 @@ public static interface IPluginManagerIntf extends IVersionedIntf public static int TYPE_WIRE_CRYPT = 8; public static int TYPE_DB_CRYPT = 9; public static int TYPE_KEY_HOLDER = 10; - public static int TYPE_CRYPTO_API = 11; - public static int TYPE_LDAP = 12; - public static int TYPE_COUNT = 13; + public static int TYPE_COUNT = 11; public void registerPluginFactory(int pluginType, String defaultName, IPluginFactory factory); public void registerModule(IPluginModule cleanup); @@ -332,6 +337,12 @@ public static interface IBatchCompletionStateIntf extends IDisposableIntf public void getStatus(IStatus status, IStatus to, int pos); } + public static interface IReplicatorIntf extends IReferenceCountedIntf + { + public void process(IStatus status, int length, byte[] data); + public void close(IStatus status); + } + public static interface IRequestIntf extends IReferenceCountedIntf { public void receive(IStatus status, int level, int msgType, int length, com.sun.jna.Pointer message); @@ -348,16 +359,6 @@ public static interface IEventsIntf extends IReferenceCountedIntf public void cancel(IStatus status); } - public static interface IEventBlockIntf extends IDisposableIntf - { - public int getLength(); - public com.sun.jna.Pointer getValues(); - public com.sun.jna.Pointer getBuffer(); - public int getCount(); - public com.sun.jna.Pointer getCounters(); - public void counts(); - } - public static interface IAttachmentIntf extends IReferenceCountedIntf { public void getInfo(IStatus status, int itemsLength, byte[] items, int bufferLength, byte[] buffer); @@ -383,6 +384,7 @@ public static interface IAttachmentIntf extends IReferenceCountedIntf public int getStatementTimeout(IStatus status); public void setStatementTimeout(IStatus status, int timeOut); public IBatch createBatch(IStatus status, ITransaction transaction, int stmtLength, String sqlStmt, int dialect, IMessageMetadata inMetadata, int parLength, byte[] par); + public IReplicator createReplicator(IStatus status); } public static interface IServiceIntf extends IReferenceCountedIntf @@ -443,8 +445,6 @@ public static interface IClientBlockIntf extends IReferenceCountedIntf { public String getLogin(); public String getPassword(); - public String getCertificate(); - public String getRepositoryPin(); public com.sun.jna.Pointer getData(com.sun.jna.Pointer length); public void putData(IStatus status, int length, com.sun.jna.Pointer data); public ICryptKey newKey(IStatus status); @@ -542,6 +542,8 @@ public static interface IWireCryptPluginIntf extends IPluginBaseIntf public void setKey(IStatus status, ICryptKey key); public void encrypt(IStatus status, int length, com.sun.jna.Pointer from, com.sun.jna.Pointer to); public void decrypt(IStatus status, int length, com.sun.jna.Pointer from, com.sun.jna.Pointer to); + public com.sun.jna.Pointer getSpecificData(IStatus status, String keyType, com.sun.jna.Pointer length); + public void setSpecificData(IStatus status, String keyType, int length, byte[] data); } public static interface ICryptKeyCallbackIntf extends IVersionedIntf @@ -617,7 +619,7 @@ public static interface IExternalTriggerIntf extends IDisposableIntf public static int ACTION_DDL = 9; public void getCharSet(IStatus status, IExternalContext context, com.sun.jna.Pointer name, int nameSize); - public void execute(IStatus status, IExternalContext context, int action, com.sun.jna.Pointer oldMsg, com.sun.jna.Pointer newMsg, com.sun.jna.Pointer oldDbKey, com.sun.jna.Pointer newDbKey); + public void execute(IStatus status, IExternalContext context, int action, com.sun.jna.Pointer oldMsg, com.sun.jna.Pointer newMsg); } public static interface IRoutineMetadataIntf extends IVersionedIntf @@ -674,11 +676,15 @@ public static interface IUtilIntf extends IVersionedIntf public int getClientVersion(); public IXpbBuilder getXpbBuilder(IStatus status, int kind, byte[] buf, int len); public int setOffsets(IStatus status, IMessageMetadata metadata, IOffsetsCallback callback); - public IEventBlock createEventBlock(IStatus status, String[] events); public IDecFloat16 getDecFloat16(IStatus status); public IDecFloat34 getDecFloat34(IStatus status); public ITransaction getTransactionByHandle(IStatus status, com.sun.jna.ptr.LongByReference hndlPtr); public IStatement getStatementByHandle(IStatus status, com.sun.jna.ptr.LongByReference hndlPtr); + public void decodeTimeTz(IStatus status, ISC_TIME_TZ[] timeTz, com.sun.jna.Pointer hours, com.sun.jna.Pointer minutes, com.sun.jna.Pointer seconds, com.sun.jna.Pointer fractions, int timeZoneBufferLength, com.sun.jna.Pointer timeZoneBuffer); + public void decodeTimeStampTz(IStatus status, ISC_TIMESTAMP_TZ[] timeStampTz, com.sun.jna.Pointer year, com.sun.jna.Pointer month, com.sun.jna.Pointer day, com.sun.jna.Pointer hours, com.sun.jna.Pointer minutes, com.sun.jna.Pointer seconds, com.sun.jna.Pointer fractions, int timeZoneBufferLength, com.sun.jna.Pointer timeZoneBuffer); + public void encodeTimeTz(IStatus status, ISC_TIME_TZ[] timeTz, int hours, int minutes, int seconds, int fractions, String timeZone); + public void encodeTimeStampTz(IStatus status, ISC_TIMESTAMP_TZ[] timeStampTz, int year, int month, int day, int hours, int minutes, int seconds, int fractions, String timeZone); + public IInt128 getInt128(IStatus status); } public static interface IOffsetsCallbackIntf extends IVersionedIntf @@ -729,7 +735,6 @@ public static interface ITraceConnectionIntf extends IVersionedIntf public String getCharSet(); public String getRemoteProtocol(); public String getRemoteAddress(); - public String getRemoteHwAddress(); public int getRemoteProcessID(); public String getRemoteProcessName(); } @@ -853,6 +858,7 @@ public static interface ITraceSweepInfoIntf extends IVersionedIntf public static interface ITraceLogWriterIntf extends IReferenceCountedIntf { public int write(com.sun.jna.Pointer buf, int size); + public int write_s(IStatus status, com.sun.jna.Pointer buf, int size); } public static interface ITraceInitInfoIntf extends IVersionedIntf @@ -860,11 +866,9 @@ public static interface ITraceInitInfoIntf extends IVersionedIntf public String getConfigText(); public int getTraceSessionID(); public String getTraceSessionName(); - public int getTraceSessionFlags(); public String getFirebirdRootDirectory(); public String getDatabaseName(); public ITraceDatabaseConnection getConnection(); - public ITraceServiceConnection getService(); public ITraceLogWriter getLogWriter(); } @@ -879,7 +883,7 @@ public static interface ITracePluginIntf extends IReferenceCountedIntf public static int SWEEP_STATE_PROGRESS = 4; public String trace_get_error(); - public boolean trace_attach(ITraceDatabaseConnection connection, boolean create_db, int dpb_length, byte[] dpb, int att_result); + public boolean trace_attach(ITraceDatabaseConnection connection, boolean create_db, int att_result); public boolean trace_detach(ITraceDatabaseConnection connection, boolean drop_db); public boolean trace_transaction_start(ITraceDatabaseConnection connection, ITraceTransaction transaction, int tpb_length, byte[] tpb, int tra_result); public boolean trace_transaction_end(ITraceDatabaseConnection connection, ITraceTransaction transaction, boolean commit, boolean retain_context, int tra_result); @@ -892,14 +896,13 @@ public static interface ITracePluginIntf extends IReferenceCountedIntf public boolean trace_blr_compile(ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceBLRStatement statement, long time_millis, int req_result); public boolean trace_blr_execute(ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceBLRStatement statement, int req_result); public boolean trace_dyn_execute(ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceDYNRequest request, long time_millis, int req_result); - public boolean trace_service_attach(ITraceServiceConnection service, int spb_length, byte[] spb, int att_result); + public boolean trace_service_attach(ITraceServiceConnection service, int att_result); public boolean trace_service_start(ITraceServiceConnection service, int switches_length, String switches, int start_result); public boolean trace_service_query(ITraceServiceConnection service, int send_item_length, byte[] send_items, int recv_item_length, byte[] recv_items, int query_result); public boolean trace_service_detach(ITraceServiceConnection service, int detach_result); public boolean trace_event_error(ITraceConnection connection, ITraceStatusVector status, String function); public boolean trace_event_sweep(ITraceDatabaseConnection connection, ITraceSweepInfo sweep, int sweep_state); public boolean trace_func_execute(ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceFunction function, boolean started, int func_result); - public boolean trace_privilege_change(ITraceDatabaseConnection connection, ITraceTransaction transaction, String executor, String grantor, boolean is_grant, String object_name, String field_name, String user_name, String privileges, int options, int change_result); } public static interface ITraceFactoryIntf extends IPluginBaseIntf @@ -924,8 +927,7 @@ public static interface ITraceFactoryIntf extends IPluginBaseIntf public static int TRACE_EVENT_ERROR = 17; public static int TRACE_EVENT_SWEEP = 18; public static int TRACE_EVENT_FUNC_EXECUTE = 19; - public static int TRACE_EVENT_PRIVILEGE_CHANGE = 20; - public static int TRACE_EVENT_MAX = 21; + public static int TRACE_EVENT_MAX = 20; public long trace_needs(); public ITracePlugin trace_create(IStatus status, ITraceInitInfo init_info); @@ -979,179 +981,48 @@ public static interface IDecFloat34Intf extends IVersionedIntf public void fromString(IStatus status, String from, FB_DEC34[] to); } - public static interface ICryptoKeyIntf extends IVersionedIntf - { - public com.sun.jna.Pointer getObjectInfo(); - public int loadFromFile(String fileName); - public int loadFromBuffer(com.sun.jna.Pointer buffer, int length); - public int loadFromCurrentRepository(); - public int saveToFile(String fileName); - public int saveToBuffer(com.sun.jna.Pointer buffer, int length, com.sun.jna.Pointer realLength); - public int saveToRepository(ICryptoRepository repository, String name); - public int setAgreeKeyFromRepository(ICryptoRepository repository); - public int setExchangeKey(ICryptoKey key); - public int generateKey(); - public int getIV(byte[] iv, int length, com.sun.jna.Pointer realLength); - public int setIV(byte[] iv, int length); - public int createFromBuffer(byte[] buffer, int length); - } - - public static interface ICryptoKeyPairIntf extends IVersionedIntf - { - public com.sun.jna.Pointer getObjectInfo(); - public int loadFromFile(String fileName); - public int loadFromBuffer(com.sun.jna.Pointer buffer, int length); - public int loadFromRepository(ICryptoRepository repository, String name); - public int loadFromCurrentRepository(); - public int saveToFile(String fileName); - public int saveToBuffer(com.sun.jna.Pointer buffer, int length, com.sun.jna.Pointer realLength); - public int saveToRepository(ICryptoRepository repository, String name); - public int setAgreeKeyFromRepository(ICryptoRepository repository); - public int setExchangeKey(ICryptoKey key); - public int generateKeyPair(); - public int getPublicKey(ICryptoKey key); - public int createPublicKey(ICryptoKey[] key); - public int deletePublicKey(ICryptoKey key); - } - - public static interface ICryptoRandomFactoryIntf extends IVersionedIntf - { - public com.sun.jna.Pointer getObjectInfo(); - public int generateRandom(byte[] buffer, int length, ICryptoProvider providerName); - } - - public static interface ICryptoHashFactoryIntf extends IVersionedIntf - { - public com.sun.jna.Pointer getObjectInfo(); - public int createHash(byte[] buffer, int bufferLength, byte[] hash, int hashLength, com.sun.jna.Pointer realHashLength, boolean asString); - public int setKeyForHash(ICryptoKey key); - } - - public static interface ICryptoSymmetricFactoryIntf extends IVersionedIntf - { - public com.sun.jna.Pointer getObjectInfo(); - public int encrypt(byte[] data, int dataLength, byte[] cryptData, int cryptDataLength, com.sun.jna.Pointer realCryptDataLength, ICryptoKey key); - public int decrypt(byte[] cryptData, int cryptDataLength, byte[] data, int dataLength, com.sun.jna.Pointer realDataLength, ICryptoKey key); - public int createKey(ICryptoRepository repository, ICryptoKey[] key); - public int deleteKey(ICryptoKey key); - } - - public static interface ICryptoSignatureFactoryIntf extends IVersionedIntf - { - public com.sun.jna.Pointer getObjectInfo(); - public int createKeyPair(ICryptoRepository repository, ICryptoKeyPair[] key); - public int deleteKeyPair(ICryptoKeyPair keyPair); - public int sign(byte[] data, int dataLength, ICryptoSignature signature, ICryptoKeyPair privateKey); - public int verifySign(byte[] data, int dataLength, ICryptoSignature signature, ICryptoKey publicKey); - public int createSignature(ICryptoSignature[] signature); - public int deleteSignature(ICryptoSignature signature); - } - - public static interface ICryptoSignatureIntf extends IVersionedIntf - { - public com.sun.jna.Pointer getObjectInfo(); - public int saveToFile(String fileName); - public int saveToBuffer(com.sun.jna.Pointer buffer, int length, com.sun.jna.Pointer realLength); - public int loadFromFile(String fileName); - public int loadFromBuffer(com.sun.jna.Pointer buffer, int length); - } - - public static interface ICryptoCertificateFactoryIntf extends IVersionedIntf - { - public com.sun.jna.Pointer getObjectInfo(); - public int createCertificate(ICryptoRepository repository, ICryptoCertificate[] certificate); - public int deleteCertificate(ICryptoCertificate certificate); - public int encrypt(byte[] data, int dataLength, byte[] cryptData, int cryptDataLength, com.sun.jna.Pointer realCryptDataLength, ICryptoCertificate certificate); - public int decrypt(byte[] cryptData, int cryptDataLength, byte[] data, int dataLength, com.sun.jna.Pointer realDataLength, ICryptoRepository repository); - } - - public static interface ICryptoCertificateIntf extends IVersionedIntf - { - public com.sun.jna.Pointer getObjectInfo(); - public int loadFromFile(String fileName); - public int loadFromBuffer(com.sun.jna.Pointer buffer, int length); - public int loadFromBinaryBuffer(com.sun.jna.Pointer buffer, int length); - public int loadFromRepository(ICryptoRepository repository, String name); - public int saveToFile(String fileName); - public int saveToBuffer(com.sun.jna.Pointer buffer, int length, com.sun.jna.Pointer realLength); - public int saveToBinaryBuffer(com.sun.jna.Pointer buffer, int length, com.sun.jna.Pointer realLength); - public int verifyCertificate(ICryptoCertificate certificate); - public int getId(byte[] id, com.sun.jna.Pointer length); - public int getIssuerName(byte[] issuerName, com.sun.jna.Pointer length); - public int getPublicKey(ICryptoKey key); - public int getPublicKeyMethod(com.sun.jna.Pointer method, com.sun.jna.Pointer length); - public int createPublicKeyFromCertificate(ICryptoRepository repository, ICryptoKey[] key); - public int deleteCertificatePublicKey(ICryptoKey key); - public int getSerialNumber(byte[] serialNumber, com.sun.jna.Pointer length); - public int getOwnerName(com.sun.jna.Pointer ownerName, com.sun.jna.Pointer length, String user_dn); - public int getKeyContainer(com.sun.jna.Pointer container, com.sun.jna.Pointer length); - } - - public static interface ICryptoRepositoryIntf extends IVersionedIntf + public static interface IInt128Intf extends IVersionedIntf { - public com.sun.jna.Pointer getObjectInfo(); - public int getRepositoryName(com.sun.jna.Pointer name, int length, com.sun.jna.Pointer realLength); - public int open(String path, int openMode, int repositoryLocation, int providerType); - public int close(); - public int createPublicKey(int method, ICryptoKey[] key); - public int getPublicKey(ICryptoKey key); - public int deletePublicKey(ICryptoKey key); - public boolean isOpened(); - } + public static int STRING_SIZE = 46; - public static interface ICryptoProviderIntf extends IVersionedIntf - { - public com.sun.jna.Pointer getObjectInfo(); - public int createRepository(ICryptoRepository[] repository, int type, String pin); - public int deleteRepository(ICryptoRepository repository); + public void toString(IStatus status, FB_I128[] from, int scale, int bufferLength, com.sun.jna.Pointer buffer); + public void fromString(IStatus status, int scale, String from, FB_I128[] to); } - public static interface IListCryptoObjectsIntf extends IVersionedIntf + public static interface IReplicatedRecordIntf extends IVersionedIntf { - public void list(CryptoObjectInfo[] objInfo); + public int getRawLength(); + public com.sun.jna.Pointer getRawData(); } - public static interface ICryptoFactoryIntf extends IPluginBaseIntf + public static interface IReplicatedBlobIntf extends IVersionedIntf { - public void setTrace(boolean need); - public ICryptoProvider getCryptoProvider(CryptoObjectInfo[] objInfo); - public ICryptoRandomFactory getCryptoRandomFactory(CryptoObjectInfo[] objInfo); - public ICryptoHashFactory getCryptoHashFactory(CryptoObjectInfo[] objInfo); - public ICryptoSymmetricFactory getCryptoSymmetricFactory(CryptoObjectInfo[] objInfo); - public ICryptoSignatureFactory getCryptoSignatureFactory(CryptoObjectInfo[] objInfo); - public ICryptoCertificateFactory getCryptoCertificateFactory(CryptoObjectInfo[] objInfo); - public int getCryptoObjects(int type, IListCryptoObjects callback); + public int getLength(); + public boolean isEof(); + public int getSegment(int length, byte[] buffer); } - public static interface ILdapPluginIntf extends IReferenceCountedIntf + public static interface IReplicatedTransactionIntf extends IDisposableIntf { - public static int SYNC_RESULT_SUCCESS = 0; - public static int SYNC_RESULT_NO_USER = 1; - public static int SYNC_RESULT_ERROR = 2; - public static int CERT_TEXT = 0; - public static int CERT_BINARY = 1; - public static int CERT_ERROR = 2; - - public void connect(); - public boolean is_connected(); - public boolean bind(); - public boolean bind_as(String user, String password); - public boolean find_user(String name, com.sun.jna.Pointer password, com.sun.jna.Pointer mf_password, com.sun.jna.Pointer hash_alg); - public boolean find_srp_user(String name, com.sun.jna.Pointer verifier, com.sun.jna.Pointer salt); - public int get_certificate(String name, com.sun.jna.Pointer buffer, com.sun.jna.Pointer buffer_length, String attr_name); - public boolean get_user_attr(String name, String attr, com.sun.jna.Pointer value); - public boolean get_policy(String name, com.sun.jna.Pointer policy, ISC_TIMESTAMP[] passwd_time, com.sun.jna.Pointer failed_count, ISC_TIMESTAMP[] access_time); - public boolean set_policy(String name, String policy, ISC_TIMESTAMP[] passwd_time, com.sun.jna.Pointer failed_count, ISC_TIMESTAMP[] access_time); - public boolean get_password_history(String name, com.sun.jna.Pointer buffer, com.sun.jna.Pointer buffer_length); - public void find_user_groups(com.sun.jna.Pointer userId); - public int change_legacy_password(String name, String password, boolean[] active); - public int change_mf_password(String name, String password, com.sun.jna.Pointer hash, boolean[] active); - public int change_srp_password(String name, String password, com.sun.jna.Pointer verifier, com.sun.jna.Pointer salt, boolean[] active); + public boolean prepare(); + public boolean commit(); + public boolean rollback(); + public boolean startSavepoint(); + public boolean releaseSavepoint(); + public boolean rollbackSavepoint(); + public boolean insertRecord(String name, IReplicatedRecord record); + public boolean updateRecord(String name, IReplicatedRecord orgRecord, IReplicatedRecord newRecord); + public boolean deleteRecord(String name, IReplicatedRecord record); + public boolean storeBlob(com.sun.jna.ptr.LongByReference blobId, IReplicatedBlob blob); + public boolean executeSql(String sql); } - public static interface ILdapFactoryIntf extends IPluginBaseIntf + public static interface IReplicatedSessionIntf extends IDisposableIntf { - public ILdapPlugin getLdapPlugin(IStatus status); + public IStatus getStatus(); + public IReplicatedTransaction startTransaction(long number); + public boolean cleanupTransaction(long number); + public boolean setSequence(String name, long value); } public static class IVersioned extends com.sun.jna.Structure implements IVersionedIntf @@ -2502,6 +2373,11 @@ public static interface Callback_asBoolean extends com.sun.jna.Callback public boolean invoke(IFirebirdConf self, int key); } + public static interface Callback_getVersion extends com.sun.jna.Callback + { + public int invoke(IFirebirdConf self, IStatus status); + } + public VTable(com.sun.jna.Pointer pointer) { super(pointer); @@ -2542,6 +2418,22 @@ public boolean invoke(IFirebirdConf self, int key) return obj.asBoolean(key); } }; + + getVersion = new Callback_getVersion() { + @Override + public int invoke(IFirebirdConf self, IStatus status) + { + try + { + return obj.getVersion(status); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + return 0; + } + } + }; } public VTable() @@ -2552,12 +2444,13 @@ public VTable() public Callback_asInteger asInteger; public Callback_asString asString; public Callback_asBoolean asBoolean; + public Callback_getVersion getVersion; @Override protected java.util.List getFieldOrder() { java.util.List fields = super.getFieldOrder(); - fields.addAll(java.util.Arrays.asList("getKey", "asInteger", "asString", "asBoolean")); + fields.addAll(java.util.Arrays.asList("getKey", "asInteger", "asString", "asBoolean", "getVersion")); return fields; } } @@ -2607,6 +2500,13 @@ public boolean asBoolean(int key) boolean result = vTable.asBoolean.invoke(this, key); return result; } + + public int getVersion(IStatus status) + { + VTable vTable = getVTable(); + int result = vTable.getVersion.invoke(this, status); + return result; + } } public static class IPluginConfig extends IReferenceCounted implements IPluginConfigIntf @@ -6181,6 +6081,107 @@ public void getStatus(IStatus status, IStatus to, int pos) } } + public static class IReplicator extends IReferenceCounted implements IReplicatorIntf + { + public static class VTable extends IReferenceCounted.VTable + { + public static interface Callback_process extends com.sun.jna.Callback + { + public void invoke(IReplicator self, IStatus status, int length, byte[] data); + } + + public static interface Callback_close extends com.sun.jna.Callback + { + public void invoke(IReplicator self, IStatus status); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IReplicatorIntf obj) + { + super(obj); + + process = new Callback_process() { + @Override + public void invoke(IReplicator self, IStatus status, int length, byte[] data) + { + try + { + obj.process(status, length, data); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + close = new Callback_close() { + @Override + public void invoke(IReplicator self, IStatus status) + { + try + { + obj.close(status); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; + } + + public VTable() + { + } + + public Callback_process process; + public Callback_close close; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("process", "close")); + return fields; + } + } + + public IReplicator() + { + } + + public IReplicator(final IReplicatorIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public void process(IStatus status, int length, byte[] data) + { + VTable vTable = getVTable(); + vTable.process.invoke(this, status, length, data); + } + + public void close(IStatus status) + { + VTable vTable = getVTable(); + vTable.close.invoke(this, status); + } + } + public static class IRequest extends IReferenceCounted implements IRequestIntf { public static class VTable extends IReferenceCounted.VTable @@ -6491,271 +6492,99 @@ public void cancel(IStatus status) } } - public static class IEventBlock extends IDisposable implements IEventBlockIntf + public static class IAttachment extends IReferenceCounted implements IAttachmentIntf { - public static class VTable extends IDisposable.VTable + public static class VTable extends IReferenceCounted.VTable { - public static interface Callback_getLength extends com.sun.jna.Callback + public static interface Callback_getInfo extends com.sun.jna.Callback { - public int invoke(IEventBlock self); + public void invoke(IAttachment self, IStatus status, int itemsLength, byte[] items, int bufferLength, byte[] buffer); } - public static interface Callback_getValues extends com.sun.jna.Callback + public static interface Callback_startTransaction extends com.sun.jna.Callback { - public com.sun.jna.Pointer invoke(IEventBlock self); + public ITransaction invoke(IAttachment self, IStatus status, int tpbLength, byte[] tpb); } - public static interface Callback_getBuffer extends com.sun.jna.Callback + public static interface Callback_reconnectTransaction extends com.sun.jna.Callback { - public com.sun.jna.Pointer invoke(IEventBlock self); + public ITransaction invoke(IAttachment self, IStatus status, int length, byte[] id); } - public static interface Callback_getCount extends com.sun.jna.Callback + public static interface Callback_compileRequest extends com.sun.jna.Callback { - public int invoke(IEventBlock self); + public IRequest invoke(IAttachment self, IStatus status, int blrLength, byte[] blr); } - public static interface Callback_getCounters extends com.sun.jna.Callback + public static interface Callback_transactRequest extends com.sun.jna.Callback { - public com.sun.jna.Pointer invoke(IEventBlock self); + public void invoke(IAttachment self, IStatus status, ITransaction transaction, int blrLength, byte[] blr, int inMsgLength, byte[] inMsg, int outMsgLength, byte[] outMsg); } - public static interface Callback_counts extends com.sun.jna.Callback + public static interface Callback_createBlob extends com.sun.jna.Callback { - public void invoke(IEventBlock self); + public IBlob invoke(IAttachment self, IStatus status, ITransaction transaction, com.sun.jna.ptr.LongByReference id, int bpbLength, byte[] bpb); } - public VTable(com.sun.jna.Pointer pointer) + public static interface Callback_openBlob extends com.sun.jna.Callback { - super(pointer); + public IBlob invoke(IAttachment self, IStatus status, ITransaction transaction, com.sun.jna.ptr.LongByReference id, int bpbLength, byte[] bpb); } - public VTable(final IEventBlockIntf obj) + public static interface Callback_getSlice extends com.sun.jna.Callback { - super(obj); - - getLength = new Callback_getLength() { - @Override - public int invoke(IEventBlock self) - { - return obj.getLength(); - } - }; + public int invoke(IAttachment self, IStatus status, ITransaction transaction, com.sun.jna.ptr.LongByReference id, int sdlLength, byte[] sdl, int paramLength, byte[] param, int sliceLength, byte[] slice); + } - getValues = new Callback_getValues() { - @Override - public com.sun.jna.Pointer invoke(IEventBlock self) - { - return obj.getValues(); - } - }; + public static interface Callback_putSlice extends com.sun.jna.Callback + { + public void invoke(IAttachment self, IStatus status, ITransaction transaction, com.sun.jna.ptr.LongByReference id, int sdlLength, byte[] sdl, int paramLength, byte[] param, int sliceLength, byte[] slice); + } - getBuffer = new Callback_getBuffer() { - @Override - public com.sun.jna.Pointer invoke(IEventBlock self) - { - return obj.getBuffer(); - } - }; + public static interface Callback_executeDyn extends com.sun.jna.Callback + { + public void invoke(IAttachment self, IStatus status, ITransaction transaction, int length, byte[] dyn); + } - getCount = new Callback_getCount() { - @Override - public int invoke(IEventBlock self) - { - return obj.getCount(); - } - }; + public static interface Callback_prepare extends com.sun.jna.Callback + { + public IStatement invoke(IAttachment self, IStatus status, ITransaction tra, int stmtLength, String sqlStmt, int dialect, int flags); + } - getCounters = new Callback_getCounters() { - @Override - public com.sun.jna.Pointer invoke(IEventBlock self) - { - return obj.getCounters(); - } - }; + public static interface Callback_execute extends com.sun.jna.Callback + { + public ITransaction invoke(IAttachment self, IStatus status, ITransaction transaction, int stmtLength, String sqlStmt, int dialect, IMessageMetadata inMetadata, com.sun.jna.Pointer inBuffer, IMessageMetadata outMetadata, com.sun.jna.Pointer outBuffer); + } - counts = new Callback_counts() { - @Override - public void invoke(IEventBlock self) - { - obj.counts(); - } - }; + public static interface Callback_openCursor extends com.sun.jna.Callback + { + public IResultSet invoke(IAttachment self, IStatus status, ITransaction transaction, int stmtLength, String sqlStmt, int dialect, IMessageMetadata inMetadata, com.sun.jna.Pointer inBuffer, IMessageMetadata outMetadata, String cursorName, int cursorFlags); } - public VTable() + public static interface Callback_queEvents extends com.sun.jna.Callback { + public IEvents invoke(IAttachment self, IStatus status, IEventCallback callback, int length, byte[] events); } - public Callback_getLength getLength; - public Callback_getValues getValues; - public Callback_getBuffer getBuffer; - public Callback_getCount getCount; - public Callback_getCounters getCounters; - public Callback_counts counts; + public static interface Callback_cancelOperation extends com.sun.jna.Callback + { + public void invoke(IAttachment self, IStatus status, int option); + } - @Override - protected java.util.List getFieldOrder() + public static interface Callback_ping extends com.sun.jna.Callback { - java.util.List fields = super.getFieldOrder(); - fields.addAll(java.util.Arrays.asList("getLength", "getValues", "getBuffer", "getCount", "getCounters", "counts")); - return fields; + public void invoke(IAttachment self, IStatus status); } - } - public IEventBlock() - { - } + public static interface Callback_detach extends com.sun.jna.Callback + { + public void invoke(IAttachment self, IStatus status); + } - public IEventBlock(final IEventBlockIntf obj) - { - vTable = new VTable(obj); - vTable.write(); - cloopVTable = vTable.getPointer(); - write(); - } - - @Override - protected VTable createVTable() - { - return new VTable(cloopVTable); - } - - public int getLength() - { - VTable vTable = getVTable(); - int result = vTable.getLength.invoke(this); - return result; - } - - public com.sun.jna.Pointer getValues() - { - VTable vTable = getVTable(); - com.sun.jna.Pointer result = vTable.getValues.invoke(this); - return result; - } - - public com.sun.jna.Pointer getBuffer() - { - VTable vTable = getVTable(); - com.sun.jna.Pointer result = vTable.getBuffer.invoke(this); - return result; - } - - public int getCount() - { - VTable vTable = getVTable(); - int result = vTable.getCount.invoke(this); - return result; - } - - public com.sun.jna.Pointer getCounters() - { - VTable vTable = getVTable(); - com.sun.jna.Pointer result = vTable.getCounters.invoke(this); - return result; - } - - public void counts() - { - VTable vTable = getVTable(); - vTable.counts.invoke(this); - } - } - - public static class IAttachment extends IReferenceCounted implements IAttachmentIntf - { - public static class VTable extends IReferenceCounted.VTable - { - public static interface Callback_getInfo extends com.sun.jna.Callback - { - public void invoke(IAttachment self, IStatus status, int itemsLength, byte[] items, int bufferLength, byte[] buffer); - } - - public static interface Callback_startTransaction extends com.sun.jna.Callback - { - public ITransaction invoke(IAttachment self, IStatus status, int tpbLength, byte[] tpb); - } - - public static interface Callback_reconnectTransaction extends com.sun.jna.Callback - { - public ITransaction invoke(IAttachment self, IStatus status, int length, byte[] id); - } - - public static interface Callback_compileRequest extends com.sun.jna.Callback - { - public IRequest invoke(IAttachment self, IStatus status, int blrLength, byte[] blr); - } - - public static interface Callback_transactRequest extends com.sun.jna.Callback - { - public void invoke(IAttachment self, IStatus status, ITransaction transaction, int blrLength, byte[] blr, int inMsgLength, byte[] inMsg, int outMsgLength, byte[] outMsg); - } - - public static interface Callback_createBlob extends com.sun.jna.Callback - { - public IBlob invoke(IAttachment self, IStatus status, ITransaction transaction, com.sun.jna.ptr.LongByReference id, int bpbLength, byte[] bpb); - } - - public static interface Callback_openBlob extends com.sun.jna.Callback - { - public IBlob invoke(IAttachment self, IStatus status, ITransaction transaction, com.sun.jna.ptr.LongByReference id, int bpbLength, byte[] bpb); - } - - public static interface Callback_getSlice extends com.sun.jna.Callback - { - public int invoke(IAttachment self, IStatus status, ITransaction transaction, com.sun.jna.ptr.LongByReference id, int sdlLength, byte[] sdl, int paramLength, byte[] param, int sliceLength, byte[] slice); - } - - public static interface Callback_putSlice extends com.sun.jna.Callback - { - public void invoke(IAttachment self, IStatus status, ITransaction transaction, com.sun.jna.ptr.LongByReference id, int sdlLength, byte[] sdl, int paramLength, byte[] param, int sliceLength, byte[] slice); - } - - public static interface Callback_executeDyn extends com.sun.jna.Callback - { - public void invoke(IAttachment self, IStatus status, ITransaction transaction, int length, byte[] dyn); - } - - public static interface Callback_prepare extends com.sun.jna.Callback - { - public IStatement invoke(IAttachment self, IStatus status, ITransaction tra, int stmtLength, String sqlStmt, int dialect, int flags); - } - - public static interface Callback_execute extends com.sun.jna.Callback - { - public ITransaction invoke(IAttachment self, IStatus status, ITransaction transaction, int stmtLength, String sqlStmt, int dialect, IMessageMetadata inMetadata, com.sun.jna.Pointer inBuffer, IMessageMetadata outMetadata, com.sun.jna.Pointer outBuffer); - } - - public static interface Callback_openCursor extends com.sun.jna.Callback - { - public IResultSet invoke(IAttachment self, IStatus status, ITransaction transaction, int stmtLength, String sqlStmt, int dialect, IMessageMetadata inMetadata, com.sun.jna.Pointer inBuffer, IMessageMetadata outMetadata, String cursorName, int cursorFlags); - } - - public static interface Callback_queEvents extends com.sun.jna.Callback - { - public IEvents invoke(IAttachment self, IStatus status, IEventCallback callback, int length, byte[] events); - } - - public static interface Callback_cancelOperation extends com.sun.jna.Callback - { - public void invoke(IAttachment self, IStatus status, int option); - } - - public static interface Callback_ping extends com.sun.jna.Callback - { - public void invoke(IAttachment self, IStatus status); - } - - public static interface Callback_detach extends com.sun.jna.Callback - { - public void invoke(IAttachment self, IStatus status); - } - - public static interface Callback_dropDatabase extends com.sun.jna.Callback - { - public void invoke(IAttachment self, IStatus status); - } + public static interface Callback_dropDatabase extends com.sun.jna.Callback + { + public void invoke(IAttachment self, IStatus status); + } public static interface Callback_getIdleTimeout extends com.sun.jna.Callback { @@ -6782,6 +6611,11 @@ public static interface Callback_createBatch extends com.sun.jna.Callback public IBatch invoke(IAttachment self, IStatus status, ITransaction transaction, int stmtLength, String sqlStmt, int dialect, IMessageMetadata inMetadata, int parLength, byte[] par); } + public static interface Callback_createReplicator extends com.sun.jna.Callback + { + public IReplicator invoke(IAttachment self, IStatus status); + } + public VTable(com.sun.jna.Pointer pointer) { super(pointer); @@ -7148,6 +6982,22 @@ public IBatch invoke(IAttachment self, IStatus status, ITransaction transaction, } } }; + + createReplicator = new Callback_createReplicator() { + @Override + public IReplicator invoke(IAttachment self, IStatus status) + { + try + { + return obj.createReplicator(status); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + return null; + } + } + }; } public VTable() @@ -7177,12 +7027,13 @@ public VTable() public Callback_getStatementTimeout getStatementTimeout; public Callback_setStatementTimeout setStatementTimeout; public Callback_createBatch createBatch; + public Callback_createReplicator createReplicator; @Override protected java.util.List getFieldOrder() { java.util.List fields = super.getFieldOrder(); - fields.addAll(java.util.Arrays.asList("getInfo", "startTransaction", "reconnectTransaction", "compileRequest", "transactRequest", "createBlob", "openBlob", "getSlice", "putSlice", "executeDyn", "prepare", "execute", "openCursor", "queEvents", "cancelOperation", "ping", "detach", "dropDatabase", "getIdleTimeout", "setIdleTimeout", "getStatementTimeout", "setStatementTimeout", "createBatch")); + fields.addAll(java.util.Arrays.asList("getInfo", "startTransaction", "reconnectTransaction", "compileRequest", "transactRequest", "createBlob", "openBlob", "getSlice", "putSlice", "executeDyn", "prepare", "execute", "openCursor", "queEvents", "cancelOperation", "ping", "detach", "dropDatabase", "getIdleTimeout", "setIdleTimeout", "getStatementTimeout", "setStatementTimeout", "createBatch", "createReplicator")); return fields; } } @@ -7355,6 +7206,13 @@ public IBatch createBatch(IStatus status, ITransaction transaction, int stmtLeng IBatch result = vTable.createBatch.invoke(this, status, transaction, stmtLength, sqlStmt, dialect, inMetadata, parLength, par); return result; } + + public IReplicator createReplicator(IStatus status) + { + VTable vTable = getVTable(); + IReplicator result = vTable.createReplicator.invoke(this, status); + return result; + } } public static class IService extends IReferenceCounted implements IServiceIntf @@ -8261,16 +8119,6 @@ public static interface Callback_getPassword extends com.sun.jna.Callback public String invoke(IClientBlock self); } - public static interface Callback_getCertificate extends com.sun.jna.Callback - { - public String invoke(IClientBlock self); - } - - public static interface Callback_getRepositoryPin extends com.sun.jna.Callback - { - public String invoke(IClientBlock self); - } - public static interface Callback_getData extends com.sun.jna.Callback { public com.sun.jna.Pointer invoke(IClientBlock self, com.sun.jna.Pointer length); @@ -8316,22 +8164,6 @@ public String invoke(IClientBlock self) } }; - getCertificate = new Callback_getCertificate() { - @Override - public String invoke(IClientBlock self) - { - return obj.getCertificate(); - } - }; - - getRepositoryPin = new Callback_getRepositoryPin() { - @Override - public String invoke(IClientBlock self) - { - return obj.getRepositoryPin(); - } - }; - getData = new Callback_getData() { @Override public com.sun.jna.Pointer invoke(IClientBlock self, com.sun.jna.Pointer length) @@ -8394,8 +8226,6 @@ public VTable() public Callback_getLogin getLogin; public Callback_getPassword getPassword; - public Callback_getCertificate getCertificate; - public Callback_getRepositoryPin getRepositoryPin; public Callback_getData getData; public Callback_putData putData; public Callback_newKey newKey; @@ -8405,7 +8235,7 @@ public VTable() protected java.util.List getFieldOrder() { java.util.List fields = super.getFieldOrder(); - fields.addAll(java.util.Arrays.asList("getLogin", "getPassword", "getCertificate", "getRepositoryPin", "getData", "putData", "newKey", "getAuthBlock")); + fields.addAll(java.util.Arrays.asList("getLogin", "getPassword", "getData", "putData", "newKey", "getAuthBlock")); return fields; } } @@ -8442,20 +8272,6 @@ public String getPassword() return result; } - public String getCertificate() - { - VTable vTable = getVTable(); - String result = vTable.getCertificate.invoke(this); - return result; - } - - public String getRepositoryPin() - { - VTable vTable = getVTable(); - String result = vTable.getRepositoryPin.invoke(this); - return result; - } - public com.sun.jna.Pointer getData(com.sun.jna.Pointer length) { VTable vTable = getVTable(); @@ -9870,6 +9686,16 @@ public static interface Callback_decrypt extends com.sun.jna.Callback public void invoke(IWireCryptPlugin self, IStatus status, int length, com.sun.jna.Pointer from, com.sun.jna.Pointer to); } + public static interface Callback_getSpecificData extends com.sun.jna.Callback + { + public com.sun.jna.Pointer invoke(IWireCryptPlugin self, IStatus status, String keyType, com.sun.jna.Pointer length); + } + + public static interface Callback_setSpecificData extends com.sun.jna.Callback + { + public void invoke(IWireCryptPlugin self, IStatus status, String keyType, int length, byte[] data); + } + public VTable(com.sun.jna.Pointer pointer) { super(pointer); @@ -9939,6 +9765,37 @@ public void invoke(IWireCryptPlugin self, IStatus status, int length, com.sun.jn } } }; + + getSpecificData = new Callback_getSpecificData() { + @Override + public com.sun.jna.Pointer invoke(IWireCryptPlugin self, IStatus status, String keyType, com.sun.jna.Pointer length) + { + try + { + return obj.getSpecificData(status, keyType, length); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + return null; + } + } + }; + + setSpecificData = new Callback_setSpecificData() { + @Override + public void invoke(IWireCryptPlugin self, IStatus status, String keyType, int length, byte[] data) + { + try + { + obj.setSpecificData(status, keyType, length, data); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; } public VTable() @@ -9949,12 +9806,14 @@ public VTable() public Callback_setKey setKey; public Callback_encrypt encrypt; public Callback_decrypt decrypt; + public Callback_getSpecificData getSpecificData; + public Callback_setSpecificData setSpecificData; @Override protected java.util.List getFieldOrder() { java.util.List fields = super.getFieldOrder(); - fields.addAll(java.util.Arrays.asList("getKnownTypes", "setKey", "encrypt", "decrypt")); + fields.addAll(java.util.Arrays.asList("getKnownTypes", "setKey", "encrypt", "decrypt", "getSpecificData", "setSpecificData")); return fields; } } @@ -10001,6 +9860,19 @@ public void decrypt(IStatus status, int length, com.sun.jna.Pointer from, com.su VTable vTable = getVTable(); vTable.decrypt.invoke(this, status, length, from, to); } + + public com.sun.jna.Pointer getSpecificData(IStatus status, String keyType, com.sun.jna.Pointer length) + { + VTable vTable = getVTable(); + com.sun.jna.Pointer result = vTable.getSpecificData.invoke(this, status, keyType, length); + return result; + } + + public void setSpecificData(IStatus status, String keyType, int length, byte[] data) + { + VTable vTable = getVTable(); + vTable.setSpecificData.invoke(this, status, keyType, length, data); + } } public static class ICryptKeyCallback extends IVersioned implements ICryptKeyCallbackIntf @@ -11037,7 +10909,7 @@ public static interface Callback_getCharSet extends com.sun.jna.Callback public static interface Callback_execute extends com.sun.jna.Callback { - public void invoke(IExternalTrigger self, IStatus status, IExternalContext context, int action, com.sun.jna.Pointer oldMsg, com.sun.jna.Pointer newMsg, com.sun.jna.Pointer oldDbKey, com.sun.jna.Pointer newDbKey); + public void invoke(IExternalTrigger self, IStatus status, IExternalContext context, int action, com.sun.jna.Pointer oldMsg, com.sun.jna.Pointer newMsg); } public VTable(com.sun.jna.Pointer pointer) @@ -11066,11 +10938,11 @@ public void invoke(IExternalTrigger self, IStatus status, IExternalContext conte execute = new Callback_execute() { @Override - public void invoke(IExternalTrigger self, IStatus status, IExternalContext context, int action, com.sun.jna.Pointer oldMsg, com.sun.jna.Pointer newMsg, com.sun.jna.Pointer oldDbKey, com.sun.jna.Pointer newDbKey) + public void invoke(IExternalTrigger self, IStatus status, IExternalContext context, int action, com.sun.jna.Pointer oldMsg, com.sun.jna.Pointer newMsg) { try { - obj.execute(status, context, action, oldMsg, newMsg, oldDbKey, newDbKey); + obj.execute(status, context, action, oldMsg, newMsg); } catch (Throwable t) { @@ -11120,10 +10992,10 @@ public void getCharSet(IStatus status, IExternalContext context, com.sun.jna.Poi vTable.getCharSet.invoke(this, status, context, name, nameSize); } - public void execute(IStatus status, IExternalContext context, int action, com.sun.jna.Pointer oldMsg, com.sun.jna.Pointer newMsg, com.sun.jna.Pointer oldDbKey, com.sun.jna.Pointer newDbKey) + public void execute(IStatus status, IExternalContext context, int action, com.sun.jna.Pointer oldMsg, com.sun.jna.Pointer newMsg) { VTable vTable = getVTable(); - vTable.execute.invoke(this, status, context, action, oldMsg, newMsg, oldDbKey, newDbKey); + vTable.execute.invoke(this, status, context, action, oldMsg, newMsg); } } @@ -11961,11 +11833,6 @@ public static interface Callback_setOffsets extends com.sun.jna.Callback public int invoke(IUtil self, IStatus status, IMessageMetadata metadata, IOffsetsCallback callback); } - public static interface Callback_createEventBlock extends com.sun.jna.Callback - { - public IEventBlock invoke(IUtil self, IStatus status, String[] events); - } - public static interface Callback_getDecFloat16 extends com.sun.jna.Callback { public IDecFloat16 invoke(IUtil self, IStatus status); @@ -11986,6 +11853,31 @@ public static interface Callback_getStatementByHandle extends com.sun.jna.Callba public IStatement invoke(IUtil self, IStatus status, com.sun.jna.ptr.LongByReference hndlPtr); } + public static interface Callback_decodeTimeTz extends com.sun.jna.Callback + { + public void invoke(IUtil self, IStatus status, ISC_TIME_TZ[] timeTz, com.sun.jna.Pointer hours, com.sun.jna.Pointer minutes, com.sun.jna.Pointer seconds, com.sun.jna.Pointer fractions, int timeZoneBufferLength, com.sun.jna.Pointer timeZoneBuffer); + } + + public static interface Callback_decodeTimeStampTz extends com.sun.jna.Callback + { + public void invoke(IUtil self, IStatus status, ISC_TIMESTAMP_TZ[] timeStampTz, com.sun.jna.Pointer year, com.sun.jna.Pointer month, com.sun.jna.Pointer day, com.sun.jna.Pointer hours, com.sun.jna.Pointer minutes, com.sun.jna.Pointer seconds, com.sun.jna.Pointer fractions, int timeZoneBufferLength, com.sun.jna.Pointer timeZoneBuffer); + } + + public static interface Callback_encodeTimeTz extends com.sun.jna.Callback + { + public void invoke(IUtil self, IStatus status, ISC_TIME_TZ[] timeTz, int hours, int minutes, int seconds, int fractions, String timeZone); + } + + public static interface Callback_encodeTimeStampTz extends com.sun.jna.Callback + { + public void invoke(IUtil self, IStatus status, ISC_TIMESTAMP_TZ[] timeStampTz, int year, int month, int day, int hours, int minutes, int seconds, int fractions, String timeZone); + } + + public static interface Callback_getInt128 extends com.sun.jna.Callback + { + public IInt128 invoke(IUtil self, IStatus status); + } + public VTable(com.sun.jna.Pointer pointer) { super(pointer); @@ -12151,22 +12043,6 @@ public int invoke(IUtil self, IStatus status, IMessageMetadata metadata, IOffset } }; - createEventBlock = new Callback_createEventBlock() { - @Override - public IEventBlock invoke(IUtil self, IStatus status, String[] events) - { - try - { - return obj.createEventBlock(status, events); - } - catch (Throwable t) - { - FbInterfaceException.catchException(status, t); - return null; - } - } - }; - getDecFloat16 = new Callback_getDecFloat16() { @Override public IDecFloat16 invoke(IUtil self, IStatus status) @@ -12230,6 +12106,82 @@ public IStatement invoke(IUtil self, IStatus status, com.sun.jna.ptr.LongByRefer } } }; + + decodeTimeTz = new Callback_decodeTimeTz() { + @Override + public void invoke(IUtil self, IStatus status, ISC_TIME_TZ[] timeTz, com.sun.jna.Pointer hours, com.sun.jna.Pointer minutes, com.sun.jna.Pointer seconds, com.sun.jna.Pointer fractions, int timeZoneBufferLength, com.sun.jna.Pointer timeZoneBuffer) + { + try + { + obj.decodeTimeTz(status, timeTz, hours, minutes, seconds, fractions, timeZoneBufferLength, timeZoneBuffer); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + decodeTimeStampTz = new Callback_decodeTimeStampTz() { + @Override + public void invoke(IUtil self, IStatus status, ISC_TIMESTAMP_TZ[] timeStampTz, com.sun.jna.Pointer year, com.sun.jna.Pointer month, com.sun.jna.Pointer day, com.sun.jna.Pointer hours, com.sun.jna.Pointer minutes, com.sun.jna.Pointer seconds, com.sun.jna.Pointer fractions, int timeZoneBufferLength, com.sun.jna.Pointer timeZoneBuffer) + { + try + { + obj.decodeTimeStampTz(status, timeStampTz, year, month, day, hours, minutes, seconds, fractions, timeZoneBufferLength, timeZoneBuffer); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + encodeTimeTz = new Callback_encodeTimeTz() { + @Override + public void invoke(IUtil self, IStatus status, ISC_TIME_TZ[] timeTz, int hours, int minutes, int seconds, int fractions, String timeZone) + { + try + { + obj.encodeTimeTz(status, timeTz, hours, minutes, seconds, fractions, timeZone); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + encodeTimeStampTz = new Callback_encodeTimeStampTz() { + @Override + public void invoke(IUtil self, IStatus status, ISC_TIMESTAMP_TZ[] timeStampTz, int year, int month, int day, int hours, int minutes, int seconds, int fractions, String timeZone) + { + try + { + obj.encodeTimeStampTz(status, timeStampTz, year, month, day, hours, minutes, seconds, fractions, timeZone); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + getInt128 = new Callback_getInt128() { + @Override + public IInt128 invoke(IUtil self, IStatus status) + { + try + { + return obj.getInt128(status); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + return null; + } + } + }; } public VTable() @@ -12249,17 +12201,21 @@ public VTable() public Callback_getClientVersion getClientVersion; public Callback_getXpbBuilder getXpbBuilder; public Callback_setOffsets setOffsets; - public Callback_createEventBlock createEventBlock; public Callback_getDecFloat16 getDecFloat16; public Callback_getDecFloat34 getDecFloat34; public Callback_getTransactionByHandle getTransactionByHandle; public Callback_getStatementByHandle getStatementByHandle; + public Callback_decodeTimeTz decodeTimeTz; + public Callback_decodeTimeStampTz decodeTimeStampTz; + public Callback_encodeTimeTz encodeTimeTz; + public Callback_encodeTimeStampTz encodeTimeStampTz; + public Callback_getInt128 getInt128; @Override protected java.util.List getFieldOrder() { java.util.List fields = super.getFieldOrder(); - fields.addAll(java.util.Arrays.asList("getFbVersion", "loadBlob", "dumpBlob", "getPerfCounters", "executeCreateDatabase", "decodeDate", "decodeTime", "encodeDate", "encodeTime", "formatStatus", "getClientVersion", "getXpbBuilder", "setOffsets", "createEventBlock", "getDecFloat16", "getDecFloat34", "getTransactionByHandle", "getStatementByHandle")); + fields.addAll(java.util.Arrays.asList("getFbVersion", "loadBlob", "dumpBlob", "getPerfCounters", "executeCreateDatabase", "decodeDate", "decodeTime", "encodeDate", "encodeTime", "formatStatus", "getClientVersion", "getXpbBuilder", "setOffsets", "getDecFloat16", "getDecFloat34", "getTransactionByHandle", "getStatementByHandle", "decodeTimeTz", "decodeTimeStampTz", "encodeTimeTz", "encodeTimeStampTz", "getInt128")); return fields; } } @@ -12367,13 +12323,6 @@ public int setOffsets(IStatus status, IMessageMetadata metadata, IOffsetsCallbac return result; } - public IEventBlock createEventBlock(IStatus status, String[] events) - { - VTable vTable = getVTable(); - IEventBlock result = vTable.createEventBlock.invoke(this, status, events); - return result; - } - public IDecFloat16 getDecFloat16(IStatus status) { VTable vTable = getVTable(); @@ -12401,6 +12350,37 @@ public IStatement getStatementByHandle(IStatus status, com.sun.jna.ptr.LongByRef IStatement result = vTable.getStatementByHandle.invoke(this, status, hndlPtr); return result; } + + public void decodeTimeTz(IStatus status, ISC_TIME_TZ[] timeTz, com.sun.jna.Pointer hours, com.sun.jna.Pointer minutes, com.sun.jna.Pointer seconds, com.sun.jna.Pointer fractions, int timeZoneBufferLength, com.sun.jna.Pointer timeZoneBuffer) + { + VTable vTable = getVTable(); + vTable.decodeTimeTz.invoke(this, status, timeTz, hours, minutes, seconds, fractions, timeZoneBufferLength, timeZoneBuffer); + } + + public void decodeTimeStampTz(IStatus status, ISC_TIMESTAMP_TZ[] timeStampTz, com.sun.jna.Pointer year, com.sun.jna.Pointer month, com.sun.jna.Pointer day, com.sun.jna.Pointer hours, com.sun.jna.Pointer minutes, com.sun.jna.Pointer seconds, com.sun.jna.Pointer fractions, int timeZoneBufferLength, com.sun.jna.Pointer timeZoneBuffer) + { + VTable vTable = getVTable(); + vTable.decodeTimeStampTz.invoke(this, status, timeStampTz, year, month, day, hours, minutes, seconds, fractions, timeZoneBufferLength, timeZoneBuffer); + } + + public void encodeTimeTz(IStatus status, ISC_TIME_TZ[] timeTz, int hours, int minutes, int seconds, int fractions, String timeZone) + { + VTable vTable = getVTable(); + vTable.encodeTimeTz.invoke(this, status, timeTz, hours, minutes, seconds, fractions, timeZone); + } + + public void encodeTimeStampTz(IStatus status, ISC_TIMESTAMP_TZ[] timeStampTz, int year, int month, int day, int hours, int minutes, int seconds, int fractions, String timeZone) + { + VTable vTable = getVTable(); + vTable.encodeTimeStampTz.invoke(this, status, timeStampTz, year, month, day, hours, minutes, seconds, fractions, timeZone); + } + + public IInt128 getInt128(IStatus status) + { + VTable vTable = getVTable(); + IInt128 result = vTable.getInt128.invoke(this, status); + return result; + } } public static class IOffsetsCallback extends IVersioned implements IOffsetsCallbackIntf @@ -13125,11 +13105,6 @@ public static interface Callback_getRemoteAddress extends com.sun.jna.Callback public String invoke(ITraceConnection self); } - public static interface Callback_getRemoteHwAddress extends com.sun.jna.Callback - { - public String invoke(ITraceConnection self); - } - public static interface Callback_getRemoteProcessID extends com.sun.jna.Callback { public int invoke(ITraceConnection self); @@ -13205,14 +13180,6 @@ public String invoke(ITraceConnection self) } }; - getRemoteHwAddress = new Callback_getRemoteHwAddress() { - @Override - public String invoke(ITraceConnection self) - { - return obj.getRemoteHwAddress(); - } - }; - getRemoteProcessID = new Callback_getRemoteProcessID() { @Override public int invoke(ITraceConnection self) @@ -13241,7 +13208,6 @@ public VTable() public Callback_getCharSet getCharSet; public Callback_getRemoteProtocol getRemoteProtocol; public Callback_getRemoteAddress getRemoteAddress; - public Callback_getRemoteHwAddress getRemoteHwAddress; public Callback_getRemoteProcessID getRemoteProcessID; public Callback_getRemoteProcessName getRemoteProcessName; @@ -13249,7 +13215,7 @@ public VTable() protected java.util.List getFieldOrder() { java.util.List fields = super.getFieldOrder(); - fields.addAll(java.util.Arrays.asList("getKind", "getProcessID", "getUserName", "getRoleName", "getCharSet", "getRemoteProtocol", "getRemoteAddress", "getRemoteHwAddress", "getRemoteProcessID", "getRemoteProcessName")); + fields.addAll(java.util.Arrays.asList("getKind", "getProcessID", "getUserName", "getRoleName", "getCharSet", "getRemoteProtocol", "getRemoteAddress", "getRemoteProcessID", "getRemoteProcessName")); return fields; } } @@ -13321,13 +13287,6 @@ public String getRemoteAddress() return result; } - public String getRemoteHwAddress() - { - VTable vTable = getVTable(); - String result = vTable.getRemoteHwAddress.invoke(this); - return result; - } - public int getRemoteProcessID() { VTable vTable = getVTable(); @@ -15068,6 +15027,11 @@ public static interface Callback_write extends com.sun.jna.Callback public int invoke(ITraceLogWriter self, com.sun.jna.Pointer buf, int size); } + public static interface Callback_write_s extends com.sun.jna.Callback + { + public int invoke(ITraceLogWriter self, IStatus status, com.sun.jna.Pointer buf, int size); + } + public VTable(com.sun.jna.Pointer pointer) { super(pointer); @@ -15084,6 +15048,22 @@ public int invoke(ITraceLogWriter self, com.sun.jna.Pointer buf, int size) return obj.write(buf, size); } }; + + write_s = new Callback_write_s() { + @Override + public int invoke(ITraceLogWriter self, IStatus status, com.sun.jna.Pointer buf, int size) + { + try + { + return obj.write_s(status, buf, size); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + return 0; + } + } + }; } public VTable() @@ -15091,12 +15071,13 @@ public VTable() } public Callback_write write; + public Callback_write_s write_s; @Override protected java.util.List getFieldOrder() { java.util.List fields = super.getFieldOrder(); - fields.addAll(java.util.Arrays.asList("write")); + fields.addAll(java.util.Arrays.asList("write", "write_s")); return fields; } } @@ -15125,6 +15106,13 @@ public int write(com.sun.jna.Pointer buf, int size) int result = vTable.write.invoke(this, buf, size); return result; } + + public int write_s(IStatus status, com.sun.jna.Pointer buf, int size) + { + VTable vTable = getVTable(); + int result = vTable.write_s.invoke(this, status, buf, size); + return result; + } } public static class ITraceInitInfo extends IVersioned implements ITraceInitInfoIntf @@ -15146,11 +15134,6 @@ public static interface Callback_getTraceSessionName extends com.sun.jna.Callbac public String invoke(ITraceInitInfo self); } - public static interface Callback_getTraceSessionFlags extends com.sun.jna.Callback - { - public int invoke(ITraceInitInfo self); - } - public static interface Callback_getFirebirdRootDirectory extends com.sun.jna.Callback { public String invoke(ITraceInitInfo self); @@ -15166,11 +15149,6 @@ public static interface Callback_getConnection extends com.sun.jna.Callback public ITraceDatabaseConnection invoke(ITraceInitInfo self); } - public static interface Callback_getService extends com.sun.jna.Callback - { - public ITraceServiceConnection invoke(ITraceInitInfo self); - } - public static interface Callback_getLogWriter extends com.sun.jna.Callback { public ITraceLogWriter invoke(ITraceInitInfo self); @@ -15209,14 +15187,6 @@ public String invoke(ITraceInitInfo self) } }; - getTraceSessionFlags = new Callback_getTraceSessionFlags() { - @Override - public int invoke(ITraceInitInfo self) - { - return obj.getTraceSessionFlags(); - } - }; - getFirebirdRootDirectory = new Callback_getFirebirdRootDirectory() { @Override public String invoke(ITraceInitInfo self) @@ -15241,14 +15211,6 @@ public ITraceDatabaseConnection invoke(ITraceInitInfo self) } }; - getService = new Callback_getService() { - @Override - public ITraceServiceConnection invoke(ITraceInitInfo self) - { - return obj.getService(); - } - }; - getLogWriter = new Callback_getLogWriter() { @Override public ITraceLogWriter invoke(ITraceInitInfo self) @@ -15265,18 +15227,16 @@ public VTable() public Callback_getConfigText getConfigText; public Callback_getTraceSessionID getTraceSessionID; public Callback_getTraceSessionName getTraceSessionName; - public Callback_getTraceSessionFlags getTraceSessionFlags; public Callback_getFirebirdRootDirectory getFirebirdRootDirectory; public Callback_getDatabaseName getDatabaseName; public Callback_getConnection getConnection; - public Callback_getService getService; public Callback_getLogWriter getLogWriter; @Override protected java.util.List getFieldOrder() { java.util.List fields = super.getFieldOrder(); - fields.addAll(java.util.Arrays.asList("getConfigText", "getTraceSessionID", "getTraceSessionName", "getTraceSessionFlags", "getFirebirdRootDirectory", "getDatabaseName", "getConnection", "getService", "getLogWriter")); + fields.addAll(java.util.Arrays.asList("getConfigText", "getTraceSessionID", "getTraceSessionName", "getFirebirdRootDirectory", "getDatabaseName", "getConnection", "getLogWriter")); return fields; } } @@ -15320,13 +15280,6 @@ public String getTraceSessionName() return result; } - public int getTraceSessionFlags() - { - VTable vTable = getVTable(); - int result = vTable.getTraceSessionFlags.invoke(this); - return result; - } - public String getFirebirdRootDirectory() { VTable vTable = getVTable(); @@ -15348,13 +15301,6 @@ public ITraceDatabaseConnection getConnection() return result; } - public ITraceServiceConnection getService() - { - VTable vTable = getVTable(); - ITraceServiceConnection result = vTable.getService.invoke(this); - return result; - } - public ITraceLogWriter getLogWriter() { VTable vTable = getVTable(); @@ -15374,7 +15320,7 @@ public static interface Callback_trace_get_error extends com.sun.jna.Callback public static interface Callback_trace_attach extends com.sun.jna.Callback { - public boolean invoke(ITracePlugin self, ITraceDatabaseConnection connection, boolean create_db, int dpb_length, byte[] dpb, int att_result); + public boolean invoke(ITracePlugin self, ITraceDatabaseConnection connection, boolean create_db, int att_result); } public static interface Callback_trace_detach extends com.sun.jna.Callback @@ -15439,7 +15385,7 @@ public static interface Callback_trace_dyn_execute extends com.sun.jna.Callback public static interface Callback_trace_service_attach extends com.sun.jna.Callback { - public boolean invoke(ITracePlugin self, ITraceServiceConnection service, int spb_length, byte[] spb, int att_result); + public boolean invoke(ITracePlugin self, ITraceServiceConnection service, int att_result); } public static interface Callback_trace_service_start extends com.sun.jna.Callback @@ -15472,11 +15418,6 @@ public static interface Callback_trace_func_execute extends com.sun.jna.Callback public boolean invoke(ITracePlugin self, ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceFunction function, boolean started, int func_result); } - public static interface Callback_trace_privilege_change extends com.sun.jna.Callback - { - public boolean invoke(ITracePlugin self, ITraceDatabaseConnection connection, ITraceTransaction transaction, String executor, String grantor, boolean is_grant, String object_name, String field_name, String user_name, String privileges, int options, int change_result); - } - public VTable(com.sun.jna.Pointer pointer) { super(pointer); @@ -15496,9 +15437,9 @@ public String invoke(ITracePlugin self) trace_attach = new Callback_trace_attach() { @Override - public boolean invoke(ITracePlugin self, ITraceDatabaseConnection connection, boolean create_db, int dpb_length, byte[] dpb, int att_result) + public boolean invoke(ITracePlugin self, ITraceDatabaseConnection connection, boolean create_db, int att_result) { - return obj.trace_attach(connection, create_db, dpb_length, dpb, att_result); + return obj.trace_attach(connection, create_db, att_result); } }; @@ -15600,9 +15541,9 @@ public boolean invoke(ITracePlugin self, ITraceDatabaseConnection connection, IT trace_service_attach = new Callback_trace_service_attach() { @Override - public boolean invoke(ITracePlugin self, ITraceServiceConnection service, int spb_length, byte[] spb, int att_result) + public boolean invoke(ITracePlugin self, ITraceServiceConnection service, int att_result) { - return obj.trace_service_attach(service, spb_length, spb, att_result); + return obj.trace_service_attach(service, att_result); } }; @@ -15653,14 +15594,6 @@ public boolean invoke(ITracePlugin self, ITraceDatabaseConnection connection, IT return obj.trace_func_execute(connection, transaction, function, started, func_result); } }; - - trace_privilege_change = new Callback_trace_privilege_change() { - @Override - public boolean invoke(ITracePlugin self, ITraceDatabaseConnection connection, ITraceTransaction transaction, String executor, String grantor, boolean is_grant, String object_name, String field_name, String user_name, String privileges, int options, int change_result) - { - return obj.trace_privilege_change(connection, transaction, executor, grantor, is_grant, object_name, field_name, user_name, privileges, options, change_result); - } - }; } public VTable() @@ -15688,13 +15621,12 @@ public VTable() public Callback_trace_event_error trace_event_error; public Callback_trace_event_sweep trace_event_sweep; public Callback_trace_func_execute trace_func_execute; - public Callback_trace_privilege_change trace_privilege_change; @Override protected java.util.List getFieldOrder() { java.util.List fields = super.getFieldOrder(); - fields.addAll(java.util.Arrays.asList("trace_get_error", "trace_attach", "trace_detach", "trace_transaction_start", "trace_transaction_end", "trace_proc_execute", "trace_trigger_execute", "trace_set_context", "trace_dsql_prepare", "trace_dsql_free", "trace_dsql_execute", "trace_blr_compile", "trace_blr_execute", "trace_dyn_execute", "trace_service_attach", "trace_service_start", "trace_service_query", "trace_service_detach", "trace_event_error", "trace_event_sweep", "trace_func_execute", "trace_privilege_change")); + fields.addAll(java.util.Arrays.asList("trace_get_error", "trace_attach", "trace_detach", "trace_transaction_start", "trace_transaction_end", "trace_proc_execute", "trace_trigger_execute", "trace_set_context", "trace_dsql_prepare", "trace_dsql_free", "trace_dsql_execute", "trace_blr_compile", "trace_blr_execute", "trace_dyn_execute", "trace_service_attach", "trace_service_start", "trace_service_query", "trace_service_detach", "trace_event_error", "trace_event_sweep", "trace_func_execute")); return fields; } } @@ -15724,10 +15656,10 @@ public String trace_get_error() return result; } - public boolean trace_attach(ITraceDatabaseConnection connection, boolean create_db, int dpb_length, byte[] dpb, int att_result) + public boolean trace_attach(ITraceDatabaseConnection connection, boolean create_db, int att_result) { VTable vTable = getVTable(); - boolean result = vTable.trace_attach.invoke(this, connection, create_db, dpb_length, dpb, att_result); + boolean result = vTable.trace_attach.invoke(this, connection, create_db, att_result); return result; } @@ -15815,10 +15747,10 @@ public boolean trace_dyn_execute(ITraceDatabaseConnection connection, ITraceTran return result; } - public boolean trace_service_attach(ITraceServiceConnection service, int spb_length, byte[] spb, int att_result) + public boolean trace_service_attach(ITraceServiceConnection service, int att_result) { VTable vTable = getVTable(); - boolean result = vTable.trace_service_attach.invoke(this, service, spb_length, spb, att_result); + boolean result = vTable.trace_service_attach.invoke(this, service, att_result); return result; } @@ -15863,13 +15795,6 @@ public boolean trace_func_execute(ITraceDatabaseConnection connection, ITraceTra boolean result = vTable.trace_func_execute.invoke(this, connection, transaction, function, started, func_result); return result; } - - public boolean trace_privilege_change(ITraceDatabaseConnection connection, ITraceTransaction transaction, String executor, String grantor, boolean is_grant, String object_name, String field_name, String user_name, String privileges, int options, int change_result) - { - VTable vTable = getVTable(); - boolean result = vTable.trace_privilege_change.invoke(this, connection, transaction, executor, grantor, is_grant, object_name, field_name, user_name, privileges, options, change_result); - return result; - } } public static class ITraceFactory extends IPluginBase implements ITraceFactoryIntf @@ -16709,73 +16634,119 @@ public void fromString(IStatus status, String from, FB_DEC34[] to) } } - public static class ICryptoKey extends IVersioned implements ICryptoKeyIntf + public static class IInt128 extends IVersioned implements IInt128Intf { public static class VTable extends IVersioned.VTable { - public static interface Callback_getObjectInfo extends com.sun.jna.Callback + public static interface Callback_toString extends com.sun.jna.Callback { - public com.sun.jna.Pointer invoke(ICryptoKey self); + public void invoke(IInt128 self, IStatus status, FB_I128[] from, int scale, int bufferLength, com.sun.jna.Pointer buffer); } - public static interface Callback_loadFromFile extends com.sun.jna.Callback + public static interface Callback_fromString extends com.sun.jna.Callback { - public int invoke(ICryptoKey self, String fileName); + public void invoke(IInt128 self, IStatus status, int scale, String from, FB_I128[] to); } - public static interface Callback_loadFromBuffer extends com.sun.jna.Callback + public VTable(com.sun.jna.Pointer pointer) { - public int invoke(ICryptoKey self, com.sun.jna.Pointer buffer, int length); + super(pointer); } - public static interface Callback_loadFromCurrentRepository extends com.sun.jna.Callback + public VTable(final IInt128Intf obj) { - public int invoke(ICryptoKey self); - } + super(obj); - public static interface Callback_saveToFile extends com.sun.jna.Callback - { - public int invoke(ICryptoKey self, String fileName); - } + toString = new Callback_toString() { + @Override + public void invoke(IInt128 self, IStatus status, FB_I128[] from, int scale, int bufferLength, com.sun.jna.Pointer buffer) + { + try + { + obj.toString(status, from, scale, bufferLength, buffer); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; - public static interface Callback_saveToBuffer extends com.sun.jna.Callback - { - public int invoke(ICryptoKey self, com.sun.jna.Pointer buffer, int length, com.sun.jna.Pointer realLength); + fromString = new Callback_fromString() { + @Override + public void invoke(IInt128 self, IStatus status, int scale, String from, FB_I128[] to) + { + try + { + obj.fromString(status, scale, from, to); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; } - public static interface Callback_saveToRepository extends com.sun.jna.Callback + public VTable() { - public int invoke(ICryptoKey self, ICryptoRepository repository, String name); } - public static interface Callback_setAgreeKeyFromRepository extends com.sun.jna.Callback - { - public int invoke(ICryptoKey self, ICryptoRepository repository); - } + public Callback_toString toString; + public Callback_fromString fromString; - public static interface Callback_setExchangeKey extends com.sun.jna.Callback + @Override + protected java.util.List getFieldOrder() { - public int invoke(ICryptoKey self, ICryptoKey key); + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("toString", "fromString")); + return fields; } + } - public static interface Callback_generateKey extends com.sun.jna.Callback - { - public int invoke(ICryptoKey self); - } + public IInt128() + { + } - public static interface Callback_getIV extends com.sun.jna.Callback - { - public int invoke(ICryptoKey self, byte[] iv, int length, com.sun.jna.Pointer realLength); - } + public IInt128(final IInt128Intf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public void toString(IStatus status, FB_I128[] from, int scale, int bufferLength, com.sun.jna.Pointer buffer) + { + VTable vTable = getVTable(); + vTable.toString.invoke(this, status, from, scale, bufferLength, buffer); + } + + public void fromString(IStatus status, int scale, String from, FB_I128[] to) + { + VTable vTable = getVTable(); + vTable.fromString.invoke(this, status, scale, from, to); + } + } - public static interface Callback_setIV extends com.sun.jna.Callback + public static class IReplicatedRecord extends IVersioned implements IReplicatedRecordIntf + { + public static class VTable extends IVersioned.VTable + { + public static interface Callback_getRawLength extends com.sun.jna.Callback { - public int invoke(ICryptoKey self, byte[] iv, int length); + public int invoke(IReplicatedRecord self); } - public static interface Callback_createFromBuffer extends com.sun.jna.Callback + public static interface Callback_getRawData extends com.sun.jna.Callback { - public int invoke(ICryptoKey self, byte[] buffer, int length); + public com.sun.jna.Pointer invoke(IReplicatedRecord self); } public VTable(com.sun.jna.Pointer pointer) @@ -16783,2239 +16754,48 @@ public VTable(com.sun.jna.Pointer pointer) super(pointer); } - public VTable(final ICryptoKeyIntf obj) + public VTable(final IReplicatedRecordIntf obj) { super(obj); - getObjectInfo = new Callback_getObjectInfo() { - @Override - public com.sun.jna.Pointer invoke(ICryptoKey self) - { - return obj.getObjectInfo(); - } - }; - - loadFromFile = new Callback_loadFromFile() { + getRawLength = new Callback_getRawLength() { @Override - public int invoke(ICryptoKey self, String fileName) + public int invoke(IReplicatedRecord self) { - return obj.loadFromFile(fileName); + return obj.getRawLength(); } }; - loadFromBuffer = new Callback_loadFromBuffer() { + getRawData = new Callback_getRawData() { @Override - public int invoke(ICryptoKey self, com.sun.jna.Pointer buffer, int length) + public com.sun.jna.Pointer invoke(IReplicatedRecord self) { - return obj.loadFromBuffer(buffer, length); + return obj.getRawData(); } }; + } - loadFromCurrentRepository = new Callback_loadFromCurrentRepository() { - @Override - public int invoke(ICryptoKey self) - { - return obj.loadFromCurrentRepository(); - } - }; + public VTable() + { + } - saveToFile = new Callback_saveToFile() { - @Override - public int invoke(ICryptoKey self, String fileName) - { - return obj.saveToFile(fileName); - } - }; - - saveToBuffer = new Callback_saveToBuffer() { - @Override - public int invoke(ICryptoKey self, com.sun.jna.Pointer buffer, int length, com.sun.jna.Pointer realLength) - { - return obj.saveToBuffer(buffer, length, realLength); - } - }; - - saveToRepository = new Callback_saveToRepository() { - @Override - public int invoke(ICryptoKey self, ICryptoRepository repository, String name) - { - return obj.saveToRepository(repository, name); - } - }; - - setAgreeKeyFromRepository = new Callback_setAgreeKeyFromRepository() { - @Override - public int invoke(ICryptoKey self, ICryptoRepository repository) - { - return obj.setAgreeKeyFromRepository(repository); - } - }; - - setExchangeKey = new Callback_setExchangeKey() { - @Override - public int invoke(ICryptoKey self, ICryptoKey key) - { - return obj.setExchangeKey(key); - } - }; - - generateKey = new Callback_generateKey() { - @Override - public int invoke(ICryptoKey self) - { - return obj.generateKey(); - } - }; - - getIV = new Callback_getIV() { - @Override - public int invoke(ICryptoKey self, byte[] iv, int length, com.sun.jna.Pointer realLength) - { - return obj.getIV(iv, length, realLength); - } - }; - - setIV = new Callback_setIV() { - @Override - public int invoke(ICryptoKey self, byte[] iv, int length) - { - return obj.setIV(iv, length); - } - }; - - createFromBuffer = new Callback_createFromBuffer() { - @Override - public int invoke(ICryptoKey self, byte[] buffer, int length) - { - return obj.createFromBuffer(buffer, length); - } - }; - } - - public VTable() - { - } - - public Callback_getObjectInfo getObjectInfo; - public Callback_loadFromFile loadFromFile; - public Callback_loadFromBuffer loadFromBuffer; - public Callback_loadFromCurrentRepository loadFromCurrentRepository; - public Callback_saveToFile saveToFile; - public Callback_saveToBuffer saveToBuffer; - public Callback_saveToRepository saveToRepository; - public Callback_setAgreeKeyFromRepository setAgreeKeyFromRepository; - public Callback_setExchangeKey setExchangeKey; - public Callback_generateKey generateKey; - public Callback_getIV getIV; - public Callback_setIV setIV; - public Callback_createFromBuffer createFromBuffer; - - @Override - protected java.util.List getFieldOrder() - { - java.util.List fields = super.getFieldOrder(); - fields.addAll(java.util.Arrays.asList("getObjectInfo", "loadFromFile", "loadFromBuffer", "loadFromCurrentRepository", "saveToFile", "saveToBuffer", "saveToRepository", "setAgreeKeyFromRepository", "setExchangeKey", "generateKey", "getIV", "setIV", "createFromBuffer")); - return fields; - } - } - - public ICryptoKey() - { - } - - public ICryptoKey(final ICryptoKeyIntf obj) - { - vTable = new VTable(obj); - vTable.write(); - cloopVTable = vTable.getPointer(); - write(); - } - - @Override - protected VTable createVTable() - { - return new VTable(cloopVTable); - } - - public com.sun.jna.Pointer getObjectInfo() - { - VTable vTable = getVTable(); - com.sun.jna.Pointer result = vTable.getObjectInfo.invoke(this); - return result; - } - - public int loadFromFile(String fileName) - { - VTable vTable = getVTable(); - int result = vTable.loadFromFile.invoke(this, fileName); - return result; - } - - public int loadFromBuffer(com.sun.jna.Pointer buffer, int length) - { - VTable vTable = getVTable(); - int result = vTable.loadFromBuffer.invoke(this, buffer, length); - return result; - } - - public int loadFromCurrentRepository() - { - VTable vTable = getVTable(); - int result = vTable.loadFromCurrentRepository.invoke(this); - return result; - } - - public int saveToFile(String fileName) - { - VTable vTable = getVTable(); - int result = vTable.saveToFile.invoke(this, fileName); - return result; - } - - public int saveToBuffer(com.sun.jna.Pointer buffer, int length, com.sun.jna.Pointer realLength) - { - VTable vTable = getVTable(); - int result = vTable.saveToBuffer.invoke(this, buffer, length, realLength); - return result; - } - - public int saveToRepository(ICryptoRepository repository, String name) - { - VTable vTable = getVTable(); - int result = vTable.saveToRepository.invoke(this, repository, name); - return result; - } - - public int setAgreeKeyFromRepository(ICryptoRepository repository) - { - VTable vTable = getVTable(); - int result = vTable.setAgreeKeyFromRepository.invoke(this, repository); - return result; - } - - public int setExchangeKey(ICryptoKey key) - { - VTable vTable = getVTable(); - int result = vTable.setExchangeKey.invoke(this, key); - return result; - } - - public int generateKey() - { - VTable vTable = getVTable(); - int result = vTable.generateKey.invoke(this); - return result; - } - - public int getIV(byte[] iv, int length, com.sun.jna.Pointer realLength) - { - VTable vTable = getVTable(); - int result = vTable.getIV.invoke(this, iv, length, realLength); - return result; - } - - public int setIV(byte[] iv, int length) - { - VTable vTable = getVTable(); - int result = vTable.setIV.invoke(this, iv, length); - return result; - } - - public int createFromBuffer(byte[] buffer, int length) - { - VTable vTable = getVTable(); - int result = vTable.createFromBuffer.invoke(this, buffer, length); - return result; - } - } - - public static class ICryptoKeyPair extends IVersioned implements ICryptoKeyPairIntf - { - public static class VTable extends IVersioned.VTable - { - public static interface Callback_getObjectInfo extends com.sun.jna.Callback - { - public com.sun.jna.Pointer invoke(ICryptoKeyPair self); - } - - public static interface Callback_loadFromFile extends com.sun.jna.Callback - { - public int invoke(ICryptoKeyPair self, String fileName); - } - - public static interface Callback_loadFromBuffer extends com.sun.jna.Callback - { - public int invoke(ICryptoKeyPair self, com.sun.jna.Pointer buffer, int length); - } - - public static interface Callback_loadFromRepository extends com.sun.jna.Callback - { - public int invoke(ICryptoKeyPair self, ICryptoRepository repository, String name); - } - - public static interface Callback_loadFromCurrentRepository extends com.sun.jna.Callback - { - public int invoke(ICryptoKeyPair self); - } - - public static interface Callback_saveToFile extends com.sun.jna.Callback - { - public int invoke(ICryptoKeyPair self, String fileName); - } - - public static interface Callback_saveToBuffer extends com.sun.jna.Callback - { - public int invoke(ICryptoKeyPair self, com.sun.jna.Pointer buffer, int length, com.sun.jna.Pointer realLength); - } - - public static interface Callback_saveToRepository extends com.sun.jna.Callback - { - public int invoke(ICryptoKeyPair self, ICryptoRepository repository, String name); - } - - public static interface Callback_setAgreeKeyFromRepository extends com.sun.jna.Callback - { - public int invoke(ICryptoKeyPair self, ICryptoRepository repository); - } - - public static interface Callback_setExchangeKey extends com.sun.jna.Callback - { - public int invoke(ICryptoKeyPair self, ICryptoKey key); - } - - public static interface Callback_generateKeyPair extends com.sun.jna.Callback - { - public int invoke(ICryptoKeyPair self); - } - - public static interface Callback_getPublicKey extends com.sun.jna.Callback - { - public int invoke(ICryptoKeyPair self, ICryptoKey key); - } - - public static interface Callback_createPublicKey extends com.sun.jna.Callback - { - public int invoke(ICryptoKeyPair self, ICryptoKey[] key); - } - - public static interface Callback_deletePublicKey extends com.sun.jna.Callback - { - public int invoke(ICryptoKeyPair self, ICryptoKey key); - } - - public VTable(com.sun.jna.Pointer pointer) - { - super(pointer); - } - - public VTable(final ICryptoKeyPairIntf obj) - { - super(obj); - - getObjectInfo = new Callback_getObjectInfo() { - @Override - public com.sun.jna.Pointer invoke(ICryptoKeyPair self) - { - return obj.getObjectInfo(); - } - }; - - loadFromFile = new Callback_loadFromFile() { - @Override - public int invoke(ICryptoKeyPair self, String fileName) - { - return obj.loadFromFile(fileName); - } - }; - - loadFromBuffer = new Callback_loadFromBuffer() { - @Override - public int invoke(ICryptoKeyPair self, com.sun.jna.Pointer buffer, int length) - { - return obj.loadFromBuffer(buffer, length); - } - }; - - loadFromRepository = new Callback_loadFromRepository() { - @Override - public int invoke(ICryptoKeyPair self, ICryptoRepository repository, String name) - { - return obj.loadFromRepository(repository, name); - } - }; - - loadFromCurrentRepository = new Callback_loadFromCurrentRepository() { - @Override - public int invoke(ICryptoKeyPair self) - { - return obj.loadFromCurrentRepository(); - } - }; - - saveToFile = new Callback_saveToFile() { - @Override - public int invoke(ICryptoKeyPair self, String fileName) - { - return obj.saveToFile(fileName); - } - }; - - saveToBuffer = new Callback_saveToBuffer() { - @Override - public int invoke(ICryptoKeyPair self, com.sun.jna.Pointer buffer, int length, com.sun.jna.Pointer realLength) - { - return obj.saveToBuffer(buffer, length, realLength); - } - }; - - saveToRepository = new Callback_saveToRepository() { - @Override - public int invoke(ICryptoKeyPair self, ICryptoRepository repository, String name) - { - return obj.saveToRepository(repository, name); - } - }; - - setAgreeKeyFromRepository = new Callback_setAgreeKeyFromRepository() { - @Override - public int invoke(ICryptoKeyPair self, ICryptoRepository repository) - { - return obj.setAgreeKeyFromRepository(repository); - } - }; - - setExchangeKey = new Callback_setExchangeKey() { - @Override - public int invoke(ICryptoKeyPair self, ICryptoKey key) - { - return obj.setExchangeKey(key); - } - }; - - generateKeyPair = new Callback_generateKeyPair() { - @Override - public int invoke(ICryptoKeyPair self) - { - return obj.generateKeyPair(); - } - }; - - getPublicKey = new Callback_getPublicKey() { - @Override - public int invoke(ICryptoKeyPair self, ICryptoKey key) - { - return obj.getPublicKey(key); - } - }; - - createPublicKey = new Callback_createPublicKey() { - @Override - public int invoke(ICryptoKeyPair self, ICryptoKey[] key) - { - return obj.createPublicKey(key); - } - }; - - deletePublicKey = new Callback_deletePublicKey() { - @Override - public int invoke(ICryptoKeyPair self, ICryptoKey key) - { - return obj.deletePublicKey(key); - } - }; - } - - public VTable() - { - } - - public Callback_getObjectInfo getObjectInfo; - public Callback_loadFromFile loadFromFile; - public Callback_loadFromBuffer loadFromBuffer; - public Callback_loadFromRepository loadFromRepository; - public Callback_loadFromCurrentRepository loadFromCurrentRepository; - public Callback_saveToFile saveToFile; - public Callback_saveToBuffer saveToBuffer; - public Callback_saveToRepository saveToRepository; - public Callback_setAgreeKeyFromRepository setAgreeKeyFromRepository; - public Callback_setExchangeKey setExchangeKey; - public Callback_generateKeyPair generateKeyPair; - public Callback_getPublicKey getPublicKey; - public Callback_createPublicKey createPublicKey; - public Callback_deletePublicKey deletePublicKey; - - @Override - protected java.util.List getFieldOrder() - { - java.util.List fields = super.getFieldOrder(); - fields.addAll(java.util.Arrays.asList("getObjectInfo", "loadFromFile", "loadFromBuffer", "loadFromRepository", "loadFromCurrentRepository", "saveToFile", "saveToBuffer", "saveToRepository", "setAgreeKeyFromRepository", "setExchangeKey", "generateKeyPair", "getPublicKey", "createPublicKey", "deletePublicKey")); - return fields; - } - } - - public ICryptoKeyPair() - { - } - - public ICryptoKeyPair(final ICryptoKeyPairIntf obj) - { - vTable = new VTable(obj); - vTable.write(); - cloopVTable = vTable.getPointer(); - write(); - } - - @Override - protected VTable createVTable() - { - return new VTable(cloopVTable); - } - - public com.sun.jna.Pointer getObjectInfo() - { - VTable vTable = getVTable(); - com.sun.jna.Pointer result = vTable.getObjectInfo.invoke(this); - return result; - } - - public int loadFromFile(String fileName) - { - VTable vTable = getVTable(); - int result = vTable.loadFromFile.invoke(this, fileName); - return result; - } - - public int loadFromBuffer(com.sun.jna.Pointer buffer, int length) - { - VTable vTable = getVTable(); - int result = vTable.loadFromBuffer.invoke(this, buffer, length); - return result; - } - - public int loadFromRepository(ICryptoRepository repository, String name) - { - VTable vTable = getVTable(); - int result = vTable.loadFromRepository.invoke(this, repository, name); - return result; - } - - public int loadFromCurrentRepository() - { - VTable vTable = getVTable(); - int result = vTable.loadFromCurrentRepository.invoke(this); - return result; - } - - public int saveToFile(String fileName) - { - VTable vTable = getVTable(); - int result = vTable.saveToFile.invoke(this, fileName); - return result; - } - - public int saveToBuffer(com.sun.jna.Pointer buffer, int length, com.sun.jna.Pointer realLength) - { - VTable vTable = getVTable(); - int result = vTable.saveToBuffer.invoke(this, buffer, length, realLength); - return result; - } - - public int saveToRepository(ICryptoRepository repository, String name) - { - VTable vTable = getVTable(); - int result = vTable.saveToRepository.invoke(this, repository, name); - return result; - } - - public int setAgreeKeyFromRepository(ICryptoRepository repository) - { - VTable vTable = getVTable(); - int result = vTable.setAgreeKeyFromRepository.invoke(this, repository); - return result; - } - - public int setExchangeKey(ICryptoKey key) - { - VTable vTable = getVTable(); - int result = vTable.setExchangeKey.invoke(this, key); - return result; - } - - public int generateKeyPair() - { - VTable vTable = getVTable(); - int result = vTable.generateKeyPair.invoke(this); - return result; - } - - public int getPublicKey(ICryptoKey key) - { - VTable vTable = getVTable(); - int result = vTable.getPublicKey.invoke(this, key); - return result; - } - - public int createPublicKey(ICryptoKey[] key) - { - VTable vTable = getVTable(); - int result = vTable.createPublicKey.invoke(this, key); - return result; - } - - public int deletePublicKey(ICryptoKey key) - { - VTable vTable = getVTable(); - int result = vTable.deletePublicKey.invoke(this, key); - return result; - } - } - - public static class ICryptoRandomFactory extends IVersioned implements ICryptoRandomFactoryIntf - { - public static class VTable extends IVersioned.VTable - { - public static interface Callback_getObjectInfo extends com.sun.jna.Callback - { - public com.sun.jna.Pointer invoke(ICryptoRandomFactory self); - } - - public static interface Callback_generateRandom extends com.sun.jna.Callback - { - public int invoke(ICryptoRandomFactory self, byte[] buffer, int length, ICryptoProvider providerName); - } - - public VTable(com.sun.jna.Pointer pointer) - { - super(pointer); - } - - public VTable(final ICryptoRandomFactoryIntf obj) - { - super(obj); - - getObjectInfo = new Callback_getObjectInfo() { - @Override - public com.sun.jna.Pointer invoke(ICryptoRandomFactory self) - { - return obj.getObjectInfo(); - } - }; - - generateRandom = new Callback_generateRandom() { - @Override - public int invoke(ICryptoRandomFactory self, byte[] buffer, int length, ICryptoProvider providerName) - { - return obj.generateRandom(buffer, length, providerName); - } - }; - } - - public VTable() - { - } - - public Callback_getObjectInfo getObjectInfo; - public Callback_generateRandom generateRandom; - - @Override - protected java.util.List getFieldOrder() - { - java.util.List fields = super.getFieldOrder(); - fields.addAll(java.util.Arrays.asList("getObjectInfo", "generateRandom")); - return fields; - } - } - - public ICryptoRandomFactory() - { - } - - public ICryptoRandomFactory(final ICryptoRandomFactoryIntf obj) - { - vTable = new VTable(obj); - vTable.write(); - cloopVTable = vTable.getPointer(); - write(); - } - - @Override - protected VTable createVTable() - { - return new VTable(cloopVTable); - } - - public com.sun.jna.Pointer getObjectInfo() - { - VTable vTable = getVTable(); - com.sun.jna.Pointer result = vTable.getObjectInfo.invoke(this); - return result; - } - - public int generateRandom(byte[] buffer, int length, ICryptoProvider providerName) - { - VTable vTable = getVTable(); - int result = vTable.generateRandom.invoke(this, buffer, length, providerName); - return result; - } - } - - public static class ICryptoHashFactory extends IVersioned implements ICryptoHashFactoryIntf - { - public static class VTable extends IVersioned.VTable - { - public static interface Callback_getObjectInfo extends com.sun.jna.Callback - { - public com.sun.jna.Pointer invoke(ICryptoHashFactory self); - } - - public static interface Callback_createHash extends com.sun.jna.Callback - { - public int invoke(ICryptoHashFactory self, byte[] buffer, int bufferLength, byte[] hash, int hashLength, com.sun.jna.Pointer realHashLength, boolean asString); - } - - public static interface Callback_setKeyForHash extends com.sun.jna.Callback - { - public int invoke(ICryptoHashFactory self, ICryptoKey key); - } - - public VTable(com.sun.jna.Pointer pointer) - { - super(pointer); - } - - public VTable(final ICryptoHashFactoryIntf obj) - { - super(obj); - - getObjectInfo = new Callback_getObjectInfo() { - @Override - public com.sun.jna.Pointer invoke(ICryptoHashFactory self) - { - return obj.getObjectInfo(); - } - }; - - createHash = new Callback_createHash() { - @Override - public int invoke(ICryptoHashFactory self, byte[] buffer, int bufferLength, byte[] hash, int hashLength, com.sun.jna.Pointer realHashLength, boolean asString) - { - return obj.createHash(buffer, bufferLength, hash, hashLength, realHashLength, asString); - } - }; - - setKeyForHash = new Callback_setKeyForHash() { - @Override - public int invoke(ICryptoHashFactory self, ICryptoKey key) - { - return obj.setKeyForHash(key); - } - }; - } - - public VTable() - { - } - - public Callback_getObjectInfo getObjectInfo; - public Callback_createHash createHash; - public Callback_setKeyForHash setKeyForHash; - - @Override - protected java.util.List getFieldOrder() - { - java.util.List fields = super.getFieldOrder(); - fields.addAll(java.util.Arrays.asList("getObjectInfo", "createHash", "setKeyForHash")); - return fields; - } - } - - public ICryptoHashFactory() - { - } - - public ICryptoHashFactory(final ICryptoHashFactoryIntf obj) - { - vTable = new VTable(obj); - vTable.write(); - cloopVTable = vTable.getPointer(); - write(); - } - - @Override - protected VTable createVTable() - { - return new VTable(cloopVTable); - } - - public com.sun.jna.Pointer getObjectInfo() - { - VTable vTable = getVTable(); - com.sun.jna.Pointer result = vTable.getObjectInfo.invoke(this); - return result; - } - - public int createHash(byte[] buffer, int bufferLength, byte[] hash, int hashLength, com.sun.jna.Pointer realHashLength, boolean asString) - { - VTable vTable = getVTable(); - int result = vTable.createHash.invoke(this, buffer, bufferLength, hash, hashLength, realHashLength, asString); - return result; - } - - public int setKeyForHash(ICryptoKey key) - { - VTable vTable = getVTable(); - int result = vTable.setKeyForHash.invoke(this, key); - return result; - } - } - - public static class ICryptoSymmetricFactory extends IVersioned implements ICryptoSymmetricFactoryIntf - { - public static class VTable extends IVersioned.VTable - { - public static interface Callback_getObjectInfo extends com.sun.jna.Callback - { - public com.sun.jna.Pointer invoke(ICryptoSymmetricFactory self); - } - - public static interface Callback_encrypt extends com.sun.jna.Callback - { - public int invoke(ICryptoSymmetricFactory self, byte[] data, int dataLength, byte[] cryptData, int cryptDataLength, com.sun.jna.Pointer realCryptDataLength, ICryptoKey key); - } - - public static interface Callback_decrypt extends com.sun.jna.Callback - { - public int invoke(ICryptoSymmetricFactory self, byte[] cryptData, int cryptDataLength, byte[] data, int dataLength, com.sun.jna.Pointer realDataLength, ICryptoKey key); - } - - public static interface Callback_createKey extends com.sun.jna.Callback - { - public int invoke(ICryptoSymmetricFactory self, ICryptoRepository repository, ICryptoKey[] key); - } - - public static interface Callback_deleteKey extends com.sun.jna.Callback - { - public int invoke(ICryptoSymmetricFactory self, ICryptoKey key); - } - - public VTable(com.sun.jna.Pointer pointer) - { - super(pointer); - } - - public VTable(final ICryptoSymmetricFactoryIntf obj) - { - super(obj); - - getObjectInfo = new Callback_getObjectInfo() { - @Override - public com.sun.jna.Pointer invoke(ICryptoSymmetricFactory self) - { - return obj.getObjectInfo(); - } - }; - - encrypt = new Callback_encrypt() { - @Override - public int invoke(ICryptoSymmetricFactory self, byte[] data, int dataLength, byte[] cryptData, int cryptDataLength, com.sun.jna.Pointer realCryptDataLength, ICryptoKey key) - { - return obj.encrypt(data, dataLength, cryptData, cryptDataLength, realCryptDataLength, key); - } - }; - - decrypt = new Callback_decrypt() { - @Override - public int invoke(ICryptoSymmetricFactory self, byte[] cryptData, int cryptDataLength, byte[] data, int dataLength, com.sun.jna.Pointer realDataLength, ICryptoKey key) - { - return obj.decrypt(cryptData, cryptDataLength, data, dataLength, realDataLength, key); - } - }; - - createKey = new Callback_createKey() { - @Override - public int invoke(ICryptoSymmetricFactory self, ICryptoRepository repository, ICryptoKey[] key) - { - return obj.createKey(repository, key); - } - }; - - deleteKey = new Callback_deleteKey() { - @Override - public int invoke(ICryptoSymmetricFactory self, ICryptoKey key) - { - return obj.deleteKey(key); - } - }; - } - - public VTable() - { - } - - public Callback_getObjectInfo getObjectInfo; - public Callback_encrypt encrypt; - public Callback_decrypt decrypt; - public Callback_createKey createKey; - public Callback_deleteKey deleteKey; - - @Override - protected java.util.List getFieldOrder() - { - java.util.List fields = super.getFieldOrder(); - fields.addAll(java.util.Arrays.asList("getObjectInfo", "encrypt", "decrypt", "createKey", "deleteKey")); - return fields; - } - } - - public ICryptoSymmetricFactory() - { - } - - public ICryptoSymmetricFactory(final ICryptoSymmetricFactoryIntf obj) - { - vTable = new VTable(obj); - vTable.write(); - cloopVTable = vTable.getPointer(); - write(); - } - - @Override - protected VTable createVTable() - { - return new VTable(cloopVTable); - } - - public com.sun.jna.Pointer getObjectInfo() - { - VTable vTable = getVTable(); - com.sun.jna.Pointer result = vTable.getObjectInfo.invoke(this); - return result; - } - - public int encrypt(byte[] data, int dataLength, byte[] cryptData, int cryptDataLength, com.sun.jna.Pointer realCryptDataLength, ICryptoKey key) - { - VTable vTable = getVTable(); - int result = vTable.encrypt.invoke(this, data, dataLength, cryptData, cryptDataLength, realCryptDataLength, key); - return result; - } - - public int decrypt(byte[] cryptData, int cryptDataLength, byte[] data, int dataLength, com.sun.jna.Pointer realDataLength, ICryptoKey key) - { - VTable vTable = getVTable(); - int result = vTable.decrypt.invoke(this, cryptData, cryptDataLength, data, dataLength, realDataLength, key); - return result; - } - - public int createKey(ICryptoRepository repository, ICryptoKey[] key) - { - VTable vTable = getVTable(); - int result = vTable.createKey.invoke(this, repository, key); - return result; - } - - public int deleteKey(ICryptoKey key) - { - VTable vTable = getVTable(); - int result = vTable.deleteKey.invoke(this, key); - return result; - } - } - - public static class ICryptoSignatureFactory extends IVersioned implements ICryptoSignatureFactoryIntf - { - public static class VTable extends IVersioned.VTable - { - public static interface Callback_getObjectInfo extends com.sun.jna.Callback - { - public com.sun.jna.Pointer invoke(ICryptoSignatureFactory self); - } - - public static interface Callback_createKeyPair extends com.sun.jna.Callback - { - public int invoke(ICryptoSignatureFactory self, ICryptoRepository repository, ICryptoKeyPair[] key); - } - - public static interface Callback_deleteKeyPair extends com.sun.jna.Callback - { - public int invoke(ICryptoSignatureFactory self, ICryptoKeyPair keyPair); - } - - public static interface Callback_sign extends com.sun.jna.Callback - { - public int invoke(ICryptoSignatureFactory self, byte[] data, int dataLength, ICryptoSignature signature, ICryptoKeyPair privateKey); - } - - public static interface Callback_verifySign extends com.sun.jna.Callback - { - public int invoke(ICryptoSignatureFactory self, byte[] data, int dataLength, ICryptoSignature signature, ICryptoKey publicKey); - } - - public static interface Callback_createSignature extends com.sun.jna.Callback - { - public int invoke(ICryptoSignatureFactory self, ICryptoSignature[] signature); - } - - public static interface Callback_deleteSignature extends com.sun.jna.Callback - { - public int invoke(ICryptoSignatureFactory self, ICryptoSignature signature); - } - - public VTable(com.sun.jna.Pointer pointer) - { - super(pointer); - } - - public VTable(final ICryptoSignatureFactoryIntf obj) - { - super(obj); - - getObjectInfo = new Callback_getObjectInfo() { - @Override - public com.sun.jna.Pointer invoke(ICryptoSignatureFactory self) - { - return obj.getObjectInfo(); - } - }; - - createKeyPair = new Callback_createKeyPair() { - @Override - public int invoke(ICryptoSignatureFactory self, ICryptoRepository repository, ICryptoKeyPair[] key) - { - return obj.createKeyPair(repository, key); - } - }; - - deleteKeyPair = new Callback_deleteKeyPair() { - @Override - public int invoke(ICryptoSignatureFactory self, ICryptoKeyPair keyPair) - { - return obj.deleteKeyPair(keyPair); - } - }; - - sign = new Callback_sign() { - @Override - public int invoke(ICryptoSignatureFactory self, byte[] data, int dataLength, ICryptoSignature signature, ICryptoKeyPair privateKey) - { - return obj.sign(data, dataLength, signature, privateKey); - } - }; - - verifySign = new Callback_verifySign() { - @Override - public int invoke(ICryptoSignatureFactory self, byte[] data, int dataLength, ICryptoSignature signature, ICryptoKey publicKey) - { - return obj.verifySign(data, dataLength, signature, publicKey); - } - }; - - createSignature = new Callback_createSignature() { - @Override - public int invoke(ICryptoSignatureFactory self, ICryptoSignature[] signature) - { - return obj.createSignature(signature); - } - }; - - deleteSignature = new Callback_deleteSignature() { - @Override - public int invoke(ICryptoSignatureFactory self, ICryptoSignature signature) - { - return obj.deleteSignature(signature); - } - }; - } - - public VTable() - { - } - - public Callback_getObjectInfo getObjectInfo; - public Callback_createKeyPair createKeyPair; - public Callback_deleteKeyPair deleteKeyPair; - public Callback_sign sign; - public Callback_verifySign verifySign; - public Callback_createSignature createSignature; - public Callback_deleteSignature deleteSignature; - - @Override - protected java.util.List getFieldOrder() - { - java.util.List fields = super.getFieldOrder(); - fields.addAll(java.util.Arrays.asList("getObjectInfo", "createKeyPair", "deleteKeyPair", "sign", "verifySign", "createSignature", "deleteSignature")); - return fields; - } - } - - public ICryptoSignatureFactory() - { - } - - public ICryptoSignatureFactory(final ICryptoSignatureFactoryIntf obj) - { - vTable = new VTable(obj); - vTable.write(); - cloopVTable = vTable.getPointer(); - write(); - } - - @Override - protected VTable createVTable() - { - return new VTable(cloopVTable); - } - - public com.sun.jna.Pointer getObjectInfo() - { - VTable vTable = getVTable(); - com.sun.jna.Pointer result = vTable.getObjectInfo.invoke(this); - return result; - } - - public int createKeyPair(ICryptoRepository repository, ICryptoKeyPair[] key) - { - VTable vTable = getVTable(); - int result = vTable.createKeyPair.invoke(this, repository, key); - return result; - } - - public int deleteKeyPair(ICryptoKeyPair keyPair) - { - VTable vTable = getVTable(); - int result = vTable.deleteKeyPair.invoke(this, keyPair); - return result; - } - - public int sign(byte[] data, int dataLength, ICryptoSignature signature, ICryptoKeyPair privateKey) - { - VTable vTable = getVTable(); - int result = vTable.sign.invoke(this, data, dataLength, signature, privateKey); - return result; - } - - public int verifySign(byte[] data, int dataLength, ICryptoSignature signature, ICryptoKey publicKey) - { - VTable vTable = getVTable(); - int result = vTable.verifySign.invoke(this, data, dataLength, signature, publicKey); - return result; - } - - public int createSignature(ICryptoSignature[] signature) - { - VTable vTable = getVTable(); - int result = vTable.createSignature.invoke(this, signature); - return result; - } - - public int deleteSignature(ICryptoSignature signature) - { - VTable vTable = getVTable(); - int result = vTable.deleteSignature.invoke(this, signature); - return result; - } - } - - public static class ICryptoSignature extends IVersioned implements ICryptoSignatureIntf - { - public static class VTable extends IVersioned.VTable - { - public static interface Callback_getObjectInfo extends com.sun.jna.Callback - { - public com.sun.jna.Pointer invoke(ICryptoSignature self); - } - - public static interface Callback_saveToFile extends com.sun.jna.Callback - { - public int invoke(ICryptoSignature self, String fileName); - } - - public static interface Callback_saveToBuffer extends com.sun.jna.Callback - { - public int invoke(ICryptoSignature self, com.sun.jna.Pointer buffer, int length, com.sun.jna.Pointer realLength); - } - - public static interface Callback_loadFromFile extends com.sun.jna.Callback - { - public int invoke(ICryptoSignature self, String fileName); - } - - public static interface Callback_loadFromBuffer extends com.sun.jna.Callback - { - public int invoke(ICryptoSignature self, com.sun.jna.Pointer buffer, int length); - } - - public VTable(com.sun.jna.Pointer pointer) - { - super(pointer); - } - - public VTable(final ICryptoSignatureIntf obj) - { - super(obj); - - getObjectInfo = new Callback_getObjectInfo() { - @Override - public com.sun.jna.Pointer invoke(ICryptoSignature self) - { - return obj.getObjectInfo(); - } - }; - - saveToFile = new Callback_saveToFile() { - @Override - public int invoke(ICryptoSignature self, String fileName) - { - return obj.saveToFile(fileName); - } - }; - - saveToBuffer = new Callback_saveToBuffer() { - @Override - public int invoke(ICryptoSignature self, com.sun.jna.Pointer buffer, int length, com.sun.jna.Pointer realLength) - { - return obj.saveToBuffer(buffer, length, realLength); - } - }; - - loadFromFile = new Callback_loadFromFile() { - @Override - public int invoke(ICryptoSignature self, String fileName) - { - return obj.loadFromFile(fileName); - } - }; - - loadFromBuffer = new Callback_loadFromBuffer() { - @Override - public int invoke(ICryptoSignature self, com.sun.jna.Pointer buffer, int length) - { - return obj.loadFromBuffer(buffer, length); - } - }; - } - - public VTable() - { - } - - public Callback_getObjectInfo getObjectInfo; - public Callback_saveToFile saveToFile; - public Callback_saveToBuffer saveToBuffer; - public Callback_loadFromFile loadFromFile; - public Callback_loadFromBuffer loadFromBuffer; - - @Override - protected java.util.List getFieldOrder() - { - java.util.List fields = super.getFieldOrder(); - fields.addAll(java.util.Arrays.asList("getObjectInfo", "saveToFile", "saveToBuffer", "loadFromFile", "loadFromBuffer")); - return fields; - } - } - - public ICryptoSignature() - { - } - - public ICryptoSignature(final ICryptoSignatureIntf obj) - { - vTable = new VTable(obj); - vTable.write(); - cloopVTable = vTable.getPointer(); - write(); - } - - @Override - protected VTable createVTable() - { - return new VTable(cloopVTable); - } - - public com.sun.jna.Pointer getObjectInfo() - { - VTable vTable = getVTable(); - com.sun.jna.Pointer result = vTable.getObjectInfo.invoke(this); - return result; - } - - public int saveToFile(String fileName) - { - VTable vTable = getVTable(); - int result = vTable.saveToFile.invoke(this, fileName); - return result; - } - - public int saveToBuffer(com.sun.jna.Pointer buffer, int length, com.sun.jna.Pointer realLength) - { - VTable vTable = getVTable(); - int result = vTable.saveToBuffer.invoke(this, buffer, length, realLength); - return result; - } - - public int loadFromFile(String fileName) - { - VTable vTable = getVTable(); - int result = vTable.loadFromFile.invoke(this, fileName); - return result; - } - - public int loadFromBuffer(com.sun.jna.Pointer buffer, int length) - { - VTable vTable = getVTable(); - int result = vTable.loadFromBuffer.invoke(this, buffer, length); - return result; - } - } - - public static class ICryptoCertificateFactory extends IVersioned implements ICryptoCertificateFactoryIntf - { - public static class VTable extends IVersioned.VTable - { - public static interface Callback_getObjectInfo extends com.sun.jna.Callback - { - public com.sun.jna.Pointer invoke(ICryptoCertificateFactory self); - } - - public static interface Callback_createCertificate extends com.sun.jna.Callback - { - public int invoke(ICryptoCertificateFactory self, ICryptoRepository repository, ICryptoCertificate[] certificate); - } - - public static interface Callback_deleteCertificate extends com.sun.jna.Callback - { - public int invoke(ICryptoCertificateFactory self, ICryptoCertificate certificate); - } - - public static interface Callback_encrypt extends com.sun.jna.Callback - { - public int invoke(ICryptoCertificateFactory self, byte[] data, int dataLength, byte[] cryptData, int cryptDataLength, com.sun.jna.Pointer realCryptDataLength, ICryptoCertificate certificate); - } - - public static interface Callback_decrypt extends com.sun.jna.Callback - { - public int invoke(ICryptoCertificateFactory self, byte[] cryptData, int cryptDataLength, byte[] data, int dataLength, com.sun.jna.Pointer realDataLength, ICryptoRepository repository); - } - - public VTable(com.sun.jna.Pointer pointer) - { - super(pointer); - } - - public VTable(final ICryptoCertificateFactoryIntf obj) - { - super(obj); - - getObjectInfo = new Callback_getObjectInfo() { - @Override - public com.sun.jna.Pointer invoke(ICryptoCertificateFactory self) - { - return obj.getObjectInfo(); - } - }; - - createCertificate = new Callback_createCertificate() { - @Override - public int invoke(ICryptoCertificateFactory self, ICryptoRepository repository, ICryptoCertificate[] certificate) - { - return obj.createCertificate(repository, certificate); - } - }; - - deleteCertificate = new Callback_deleteCertificate() { - @Override - public int invoke(ICryptoCertificateFactory self, ICryptoCertificate certificate) - { - return obj.deleteCertificate(certificate); - } - }; - - encrypt = new Callback_encrypt() { - @Override - public int invoke(ICryptoCertificateFactory self, byte[] data, int dataLength, byte[] cryptData, int cryptDataLength, com.sun.jna.Pointer realCryptDataLength, ICryptoCertificate certificate) - { - return obj.encrypt(data, dataLength, cryptData, cryptDataLength, realCryptDataLength, certificate); - } - }; - - decrypt = new Callback_decrypt() { - @Override - public int invoke(ICryptoCertificateFactory self, byte[] cryptData, int cryptDataLength, byte[] data, int dataLength, com.sun.jna.Pointer realDataLength, ICryptoRepository repository) - { - return obj.decrypt(cryptData, cryptDataLength, data, dataLength, realDataLength, repository); - } - }; - } - - public VTable() - { - } - - public Callback_getObjectInfo getObjectInfo; - public Callback_createCertificate createCertificate; - public Callback_deleteCertificate deleteCertificate; - public Callback_encrypt encrypt; - public Callback_decrypt decrypt; - - @Override - protected java.util.List getFieldOrder() - { - java.util.List fields = super.getFieldOrder(); - fields.addAll(java.util.Arrays.asList("getObjectInfo", "createCertificate", "deleteCertificate", "encrypt", "decrypt")); - return fields; - } - } - - public ICryptoCertificateFactory() - { - } - - public ICryptoCertificateFactory(final ICryptoCertificateFactoryIntf obj) - { - vTable = new VTable(obj); - vTable.write(); - cloopVTable = vTable.getPointer(); - write(); - } - - @Override - protected VTable createVTable() - { - return new VTable(cloopVTable); - } - - public com.sun.jna.Pointer getObjectInfo() - { - VTable vTable = getVTable(); - com.sun.jna.Pointer result = vTable.getObjectInfo.invoke(this); - return result; - } - - public int createCertificate(ICryptoRepository repository, ICryptoCertificate[] certificate) - { - VTable vTable = getVTable(); - int result = vTable.createCertificate.invoke(this, repository, certificate); - return result; - } - - public int deleteCertificate(ICryptoCertificate certificate) - { - VTable vTable = getVTable(); - int result = vTable.deleteCertificate.invoke(this, certificate); - return result; - } - - public int encrypt(byte[] data, int dataLength, byte[] cryptData, int cryptDataLength, com.sun.jna.Pointer realCryptDataLength, ICryptoCertificate certificate) - { - VTable vTable = getVTable(); - int result = vTable.encrypt.invoke(this, data, dataLength, cryptData, cryptDataLength, realCryptDataLength, certificate); - return result; - } - - public int decrypt(byte[] cryptData, int cryptDataLength, byte[] data, int dataLength, com.sun.jna.Pointer realDataLength, ICryptoRepository repository) - { - VTable vTable = getVTable(); - int result = vTable.decrypt.invoke(this, cryptData, cryptDataLength, data, dataLength, realDataLength, repository); - return result; - } - } - - public static class ICryptoCertificate extends IVersioned implements ICryptoCertificateIntf - { - public static class VTable extends IVersioned.VTable - { - public static interface Callback_getObjectInfo extends com.sun.jna.Callback - { - public com.sun.jna.Pointer invoke(ICryptoCertificate self); - } - - public static interface Callback_loadFromFile extends com.sun.jna.Callback - { - public int invoke(ICryptoCertificate self, String fileName); - } - - public static interface Callback_loadFromBuffer extends com.sun.jna.Callback - { - public int invoke(ICryptoCertificate self, com.sun.jna.Pointer buffer, int length); - } - - public static interface Callback_loadFromBinaryBuffer extends com.sun.jna.Callback - { - public int invoke(ICryptoCertificate self, com.sun.jna.Pointer buffer, int length); - } - - public static interface Callback_loadFromRepository extends com.sun.jna.Callback - { - public int invoke(ICryptoCertificate self, ICryptoRepository repository, String name); - } - - public static interface Callback_saveToFile extends com.sun.jna.Callback - { - public int invoke(ICryptoCertificate self, String fileName); - } - - public static interface Callback_saveToBuffer extends com.sun.jna.Callback - { - public int invoke(ICryptoCertificate self, com.sun.jna.Pointer buffer, int length, com.sun.jna.Pointer realLength); - } - - public static interface Callback_saveToBinaryBuffer extends com.sun.jna.Callback - { - public int invoke(ICryptoCertificate self, com.sun.jna.Pointer buffer, int length, com.sun.jna.Pointer realLength); - } - - public static interface Callback_verifyCertificate extends com.sun.jna.Callback - { - public int invoke(ICryptoCertificate self, ICryptoCertificate certificate); - } - - public static interface Callback_getId extends com.sun.jna.Callback - { - public int invoke(ICryptoCertificate self, byte[] id, com.sun.jna.Pointer length); - } - - public static interface Callback_getIssuerName extends com.sun.jna.Callback - { - public int invoke(ICryptoCertificate self, byte[] issuerName, com.sun.jna.Pointer length); - } - - public static interface Callback_getPublicKey extends com.sun.jna.Callback - { - public int invoke(ICryptoCertificate self, ICryptoKey key); - } - - public static interface Callback_getPublicKeyMethod extends com.sun.jna.Callback - { - public int invoke(ICryptoCertificate self, com.sun.jna.Pointer method, com.sun.jna.Pointer length); - } - - public static interface Callback_createPublicKeyFromCertificate extends com.sun.jna.Callback - { - public int invoke(ICryptoCertificate self, ICryptoRepository repository, ICryptoKey[] key); - } - - public static interface Callback_deleteCertificatePublicKey extends com.sun.jna.Callback - { - public int invoke(ICryptoCertificate self, ICryptoKey key); - } - - public static interface Callback_getSerialNumber extends com.sun.jna.Callback - { - public int invoke(ICryptoCertificate self, byte[] serialNumber, com.sun.jna.Pointer length); - } - - public static interface Callback_getOwnerName extends com.sun.jna.Callback - { - public int invoke(ICryptoCertificate self, com.sun.jna.Pointer ownerName, com.sun.jna.Pointer length, String user_dn); - } - - public static interface Callback_getKeyContainer extends com.sun.jna.Callback - { - public int invoke(ICryptoCertificate self, com.sun.jna.Pointer container, com.sun.jna.Pointer length); - } - - public VTable(com.sun.jna.Pointer pointer) - { - super(pointer); - } - - public VTable(final ICryptoCertificateIntf obj) - { - super(obj); - - getObjectInfo = new Callback_getObjectInfo() { - @Override - public com.sun.jna.Pointer invoke(ICryptoCertificate self) - { - return obj.getObjectInfo(); - } - }; - - loadFromFile = new Callback_loadFromFile() { - @Override - public int invoke(ICryptoCertificate self, String fileName) - { - return obj.loadFromFile(fileName); - } - }; - - loadFromBuffer = new Callback_loadFromBuffer() { - @Override - public int invoke(ICryptoCertificate self, com.sun.jna.Pointer buffer, int length) - { - return obj.loadFromBuffer(buffer, length); - } - }; - - loadFromBinaryBuffer = new Callback_loadFromBinaryBuffer() { - @Override - public int invoke(ICryptoCertificate self, com.sun.jna.Pointer buffer, int length) - { - return obj.loadFromBinaryBuffer(buffer, length); - } - }; - - loadFromRepository = new Callback_loadFromRepository() { - @Override - public int invoke(ICryptoCertificate self, ICryptoRepository repository, String name) - { - return obj.loadFromRepository(repository, name); - } - }; - - saveToFile = new Callback_saveToFile() { - @Override - public int invoke(ICryptoCertificate self, String fileName) - { - return obj.saveToFile(fileName); - } - }; - - saveToBuffer = new Callback_saveToBuffer() { - @Override - public int invoke(ICryptoCertificate self, com.sun.jna.Pointer buffer, int length, com.sun.jna.Pointer realLength) - { - return obj.saveToBuffer(buffer, length, realLength); - } - }; - - saveToBinaryBuffer = new Callback_saveToBinaryBuffer() { - @Override - public int invoke(ICryptoCertificate self, com.sun.jna.Pointer buffer, int length, com.sun.jna.Pointer realLength) - { - return obj.saveToBinaryBuffer(buffer, length, realLength); - } - }; - - verifyCertificate = new Callback_verifyCertificate() { - @Override - public int invoke(ICryptoCertificate self, ICryptoCertificate certificate) - { - return obj.verifyCertificate(certificate); - } - }; - - getId = new Callback_getId() { - @Override - public int invoke(ICryptoCertificate self, byte[] id, com.sun.jna.Pointer length) - { - return obj.getId(id, length); - } - }; - - getIssuerName = new Callback_getIssuerName() { - @Override - public int invoke(ICryptoCertificate self, byte[] issuerName, com.sun.jna.Pointer length) - { - return obj.getIssuerName(issuerName, length); - } - }; - - getPublicKey = new Callback_getPublicKey() { - @Override - public int invoke(ICryptoCertificate self, ICryptoKey key) - { - return obj.getPublicKey(key); - } - }; - - getPublicKeyMethod = new Callback_getPublicKeyMethod() { - @Override - public int invoke(ICryptoCertificate self, com.sun.jna.Pointer method, com.sun.jna.Pointer length) - { - return obj.getPublicKeyMethod(method, length); - } - }; - - createPublicKeyFromCertificate = new Callback_createPublicKeyFromCertificate() { - @Override - public int invoke(ICryptoCertificate self, ICryptoRepository repository, ICryptoKey[] key) - { - return obj.createPublicKeyFromCertificate(repository, key); - } - }; - - deleteCertificatePublicKey = new Callback_deleteCertificatePublicKey() { - @Override - public int invoke(ICryptoCertificate self, ICryptoKey key) - { - return obj.deleteCertificatePublicKey(key); - } - }; - - getSerialNumber = new Callback_getSerialNumber() { - @Override - public int invoke(ICryptoCertificate self, byte[] serialNumber, com.sun.jna.Pointer length) - { - return obj.getSerialNumber(serialNumber, length); - } - }; - - getOwnerName = new Callback_getOwnerName() { - @Override - public int invoke(ICryptoCertificate self, com.sun.jna.Pointer ownerName, com.sun.jna.Pointer length, String user_dn) - { - return obj.getOwnerName(ownerName, length, user_dn); - } - }; - - getKeyContainer = new Callback_getKeyContainer() { - @Override - public int invoke(ICryptoCertificate self, com.sun.jna.Pointer container, com.sun.jna.Pointer length) - { - return obj.getKeyContainer(container, length); - } - }; - } - - public VTable() - { - } - - public Callback_getObjectInfo getObjectInfo; - public Callback_loadFromFile loadFromFile; - public Callback_loadFromBuffer loadFromBuffer; - public Callback_loadFromBinaryBuffer loadFromBinaryBuffer; - public Callback_loadFromRepository loadFromRepository; - public Callback_saveToFile saveToFile; - public Callback_saveToBuffer saveToBuffer; - public Callback_saveToBinaryBuffer saveToBinaryBuffer; - public Callback_verifyCertificate verifyCertificate; - public Callback_getId getId; - public Callback_getIssuerName getIssuerName; - public Callback_getPublicKey getPublicKey; - public Callback_getPublicKeyMethod getPublicKeyMethod; - public Callback_createPublicKeyFromCertificate createPublicKeyFromCertificate; - public Callback_deleteCertificatePublicKey deleteCertificatePublicKey; - public Callback_getSerialNumber getSerialNumber; - public Callback_getOwnerName getOwnerName; - public Callback_getKeyContainer getKeyContainer; - - @Override - protected java.util.List getFieldOrder() - { - java.util.List fields = super.getFieldOrder(); - fields.addAll(java.util.Arrays.asList("getObjectInfo", "loadFromFile", "loadFromBuffer", "loadFromBinaryBuffer", "loadFromRepository", "saveToFile", "saveToBuffer", "saveToBinaryBuffer", "verifyCertificate", "getId", "getIssuerName", "getPublicKey", "getPublicKeyMethod", "createPublicKeyFromCertificate", "deleteCertificatePublicKey", "getSerialNumber", "getOwnerName", "getKeyContainer")); - return fields; - } - } - - public ICryptoCertificate() - { - } - - public ICryptoCertificate(final ICryptoCertificateIntf obj) - { - vTable = new VTable(obj); - vTable.write(); - cloopVTable = vTable.getPointer(); - write(); - } - - @Override - protected VTable createVTable() - { - return new VTable(cloopVTable); - } - - public com.sun.jna.Pointer getObjectInfo() - { - VTable vTable = getVTable(); - com.sun.jna.Pointer result = vTable.getObjectInfo.invoke(this); - return result; - } - - public int loadFromFile(String fileName) - { - VTable vTable = getVTable(); - int result = vTable.loadFromFile.invoke(this, fileName); - return result; - } - - public int loadFromBuffer(com.sun.jna.Pointer buffer, int length) - { - VTable vTable = getVTable(); - int result = vTable.loadFromBuffer.invoke(this, buffer, length); - return result; - } - - public int loadFromBinaryBuffer(com.sun.jna.Pointer buffer, int length) - { - VTable vTable = getVTable(); - int result = vTable.loadFromBinaryBuffer.invoke(this, buffer, length); - return result; - } - - public int loadFromRepository(ICryptoRepository repository, String name) - { - VTable vTable = getVTable(); - int result = vTable.loadFromRepository.invoke(this, repository, name); - return result; - } - - public int saveToFile(String fileName) - { - VTable vTable = getVTable(); - int result = vTable.saveToFile.invoke(this, fileName); - return result; - } - - public int saveToBuffer(com.sun.jna.Pointer buffer, int length, com.sun.jna.Pointer realLength) - { - VTable vTable = getVTable(); - int result = vTable.saveToBuffer.invoke(this, buffer, length, realLength); - return result; - } - - public int saveToBinaryBuffer(com.sun.jna.Pointer buffer, int length, com.sun.jna.Pointer realLength) - { - VTable vTable = getVTable(); - int result = vTable.saveToBinaryBuffer.invoke(this, buffer, length, realLength); - return result; - } - - public int verifyCertificate(ICryptoCertificate certificate) - { - VTable vTable = getVTable(); - int result = vTable.verifyCertificate.invoke(this, certificate); - return result; - } - - public int getId(byte[] id, com.sun.jna.Pointer length) - { - VTable vTable = getVTable(); - int result = vTable.getId.invoke(this, id, length); - return result; - } - - public int getIssuerName(byte[] issuerName, com.sun.jna.Pointer length) - { - VTable vTable = getVTable(); - int result = vTable.getIssuerName.invoke(this, issuerName, length); - return result; - } - - public int getPublicKey(ICryptoKey key) - { - VTable vTable = getVTable(); - int result = vTable.getPublicKey.invoke(this, key); - return result; - } - - public int getPublicKeyMethod(com.sun.jna.Pointer method, com.sun.jna.Pointer length) - { - VTable vTable = getVTable(); - int result = vTable.getPublicKeyMethod.invoke(this, method, length); - return result; - } - - public int createPublicKeyFromCertificate(ICryptoRepository repository, ICryptoKey[] key) - { - VTable vTable = getVTable(); - int result = vTable.createPublicKeyFromCertificate.invoke(this, repository, key); - return result; - } - - public int deleteCertificatePublicKey(ICryptoKey key) - { - VTable vTable = getVTable(); - int result = vTable.deleteCertificatePublicKey.invoke(this, key); - return result; - } - - public int getSerialNumber(byte[] serialNumber, com.sun.jna.Pointer length) - { - VTable vTable = getVTable(); - int result = vTable.getSerialNumber.invoke(this, serialNumber, length); - return result; - } - - public int getOwnerName(com.sun.jna.Pointer ownerName, com.sun.jna.Pointer length, String user_dn) - { - VTable vTable = getVTable(); - int result = vTable.getOwnerName.invoke(this, ownerName, length, user_dn); - return result; - } - - public int getKeyContainer(com.sun.jna.Pointer container, com.sun.jna.Pointer length) - { - VTable vTable = getVTable(); - int result = vTable.getKeyContainer.invoke(this, container, length); - return result; - } - } - - public static class ICryptoRepository extends IVersioned implements ICryptoRepositoryIntf - { - public static class VTable extends IVersioned.VTable - { - public static interface Callback_getObjectInfo extends com.sun.jna.Callback - { - public com.sun.jna.Pointer invoke(ICryptoRepository self); - } - - public static interface Callback_getRepositoryName extends com.sun.jna.Callback - { - public int invoke(ICryptoRepository self, com.sun.jna.Pointer name, int length, com.sun.jna.Pointer realLength); - } - - public static interface Callback_open extends com.sun.jna.Callback - { - public int invoke(ICryptoRepository self, String path, int openMode, int repositoryLocation, int providerType); - } - - public static interface Callback_close extends com.sun.jna.Callback - { - public int invoke(ICryptoRepository self); - } - - public static interface Callback_createPublicKey extends com.sun.jna.Callback - { - public int invoke(ICryptoRepository self, int method, ICryptoKey[] key); - } - - public static interface Callback_getPublicKey extends com.sun.jna.Callback - { - public int invoke(ICryptoRepository self, ICryptoKey key); - } - - public static interface Callback_deletePublicKey extends com.sun.jna.Callback - { - public int invoke(ICryptoRepository self, ICryptoKey key); - } - - public static interface Callback_isOpened extends com.sun.jna.Callback - { - public boolean invoke(ICryptoRepository self); - } - - public VTable(com.sun.jna.Pointer pointer) - { - super(pointer); - } - - public VTable(final ICryptoRepositoryIntf obj) - { - super(obj); - - getObjectInfo = new Callback_getObjectInfo() { - @Override - public com.sun.jna.Pointer invoke(ICryptoRepository self) - { - return obj.getObjectInfo(); - } - }; - - getRepositoryName = new Callback_getRepositoryName() { - @Override - public int invoke(ICryptoRepository self, com.sun.jna.Pointer name, int length, com.sun.jna.Pointer realLength) - { - return obj.getRepositoryName(name, length, realLength); - } - }; - - open = new Callback_open() { - @Override - public int invoke(ICryptoRepository self, String path, int openMode, int repositoryLocation, int providerType) - { - return obj.open(path, openMode, repositoryLocation, providerType); - } - }; - - close = new Callback_close() { - @Override - public int invoke(ICryptoRepository self) - { - return obj.close(); - } - }; - - createPublicKey = new Callback_createPublicKey() { - @Override - public int invoke(ICryptoRepository self, int method, ICryptoKey[] key) - { - return obj.createPublicKey(method, key); - } - }; - - getPublicKey = new Callback_getPublicKey() { - @Override - public int invoke(ICryptoRepository self, ICryptoKey key) - { - return obj.getPublicKey(key); - } - }; - - deletePublicKey = new Callback_deletePublicKey() { - @Override - public int invoke(ICryptoRepository self, ICryptoKey key) - { - return obj.deletePublicKey(key); - } - }; - - isOpened = new Callback_isOpened() { - @Override - public boolean invoke(ICryptoRepository self) - { - return obj.isOpened(); - } - }; - } - - public VTable() - { - } - - public Callback_getObjectInfo getObjectInfo; - public Callback_getRepositoryName getRepositoryName; - public Callback_open open; - public Callback_close close; - public Callback_createPublicKey createPublicKey; - public Callback_getPublicKey getPublicKey; - public Callback_deletePublicKey deletePublicKey; - public Callback_isOpened isOpened; - - @Override - protected java.util.List getFieldOrder() - { - java.util.List fields = super.getFieldOrder(); - fields.addAll(java.util.Arrays.asList("getObjectInfo", "getRepositoryName", "open", "close", "createPublicKey", "getPublicKey", "deletePublicKey", "isOpened")); - return fields; - } - } - - public ICryptoRepository() - { - } - - public ICryptoRepository(final ICryptoRepositoryIntf obj) - { - vTable = new VTable(obj); - vTable.write(); - cloopVTable = vTable.getPointer(); - write(); - } - - @Override - protected VTable createVTable() - { - return new VTable(cloopVTable); - } - - public com.sun.jna.Pointer getObjectInfo() - { - VTable vTable = getVTable(); - com.sun.jna.Pointer result = vTable.getObjectInfo.invoke(this); - return result; - } - - public int getRepositoryName(com.sun.jna.Pointer name, int length, com.sun.jna.Pointer realLength) - { - VTable vTable = getVTable(); - int result = vTable.getRepositoryName.invoke(this, name, length, realLength); - return result; - } - - public int open(String path, int openMode, int repositoryLocation, int providerType) - { - VTable vTable = getVTable(); - int result = vTable.open.invoke(this, path, openMode, repositoryLocation, providerType); - return result; - } - - public int close() - { - VTable vTable = getVTable(); - int result = vTable.close.invoke(this); - return result; - } - - public int createPublicKey(int method, ICryptoKey[] key) - { - VTable vTable = getVTable(); - int result = vTable.createPublicKey.invoke(this, method, key); - return result; - } - - public int getPublicKey(ICryptoKey key) - { - VTable vTable = getVTable(); - int result = vTable.getPublicKey.invoke(this, key); - return result; - } - - public int deletePublicKey(ICryptoKey key) - { - VTable vTable = getVTable(); - int result = vTable.deletePublicKey.invoke(this, key); - return result; - } - - public boolean isOpened() - { - VTable vTable = getVTable(); - boolean result = vTable.isOpened.invoke(this); - return result; - } - } - - public static class ICryptoProvider extends IVersioned implements ICryptoProviderIntf - { - public static class VTable extends IVersioned.VTable - { - public static interface Callback_getObjectInfo extends com.sun.jna.Callback - { - public com.sun.jna.Pointer invoke(ICryptoProvider self); - } - - public static interface Callback_createRepository extends com.sun.jna.Callback - { - public int invoke(ICryptoProvider self, ICryptoRepository[] repository, int type, String pin); - } - - public static interface Callback_deleteRepository extends com.sun.jna.Callback - { - public int invoke(ICryptoProvider self, ICryptoRepository repository); - } - - public VTable(com.sun.jna.Pointer pointer) - { - super(pointer); - } - - public VTable(final ICryptoProviderIntf obj) - { - super(obj); - - getObjectInfo = new Callback_getObjectInfo() { - @Override - public com.sun.jna.Pointer invoke(ICryptoProvider self) - { - return obj.getObjectInfo(); - } - }; - - createRepository = new Callback_createRepository() { - @Override - public int invoke(ICryptoProvider self, ICryptoRepository[] repository, int type, String pin) - { - return obj.createRepository(repository, type, pin); - } - }; - - deleteRepository = new Callback_deleteRepository() { - @Override - public int invoke(ICryptoProvider self, ICryptoRepository repository) - { - return obj.deleteRepository(repository); - } - }; - } - - public VTable() - { - } - - public Callback_getObjectInfo getObjectInfo; - public Callback_createRepository createRepository; - public Callback_deleteRepository deleteRepository; - - @Override - protected java.util.List getFieldOrder() - { - java.util.List fields = super.getFieldOrder(); - fields.addAll(java.util.Arrays.asList("getObjectInfo", "createRepository", "deleteRepository")); - return fields; - } - } - - public ICryptoProvider() - { - } - - public ICryptoProvider(final ICryptoProviderIntf obj) - { - vTable = new VTable(obj); - vTable.write(); - cloopVTable = vTable.getPointer(); - write(); - } - - @Override - protected VTable createVTable() - { - return new VTable(cloopVTable); - } - - public com.sun.jna.Pointer getObjectInfo() - { - VTable vTable = getVTable(); - com.sun.jna.Pointer result = vTable.getObjectInfo.invoke(this); - return result; - } - - public int createRepository(ICryptoRepository[] repository, int type, String pin) - { - VTable vTable = getVTable(); - int result = vTable.createRepository.invoke(this, repository, type, pin); - return result; - } - - public int deleteRepository(ICryptoRepository repository) - { - VTable vTable = getVTable(); - int result = vTable.deleteRepository.invoke(this, repository); - return result; - } - } - - public static class IListCryptoObjects extends IVersioned implements IListCryptoObjectsIntf - { - public static class VTable extends IVersioned.VTable - { - public static interface Callback_list extends com.sun.jna.Callback - { - public void invoke(IListCryptoObjects self, CryptoObjectInfo[] objInfo); - } - - public VTable(com.sun.jna.Pointer pointer) - { - super(pointer); - } - - public VTable(final IListCryptoObjectsIntf obj) - { - super(obj); - - list = new Callback_list() { - @Override - public void invoke(IListCryptoObjects self, CryptoObjectInfo[] objInfo) - { - obj.list(objInfo); - } - }; - } - - public VTable() - { - } - - public Callback_list list; + public Callback_getRawLength getRawLength; + public Callback_getRawData getRawData; @Override protected java.util.List getFieldOrder() { java.util.List fields = super.getFieldOrder(); - fields.addAll(java.util.Arrays.asList("list")); + fields.addAll(java.util.Arrays.asList("getRawLength", "getRawData")); return fields; } } - public IListCryptoObjects() + public IReplicatedRecord() { } - public IListCryptoObjects(final IListCryptoObjectsIntf obj) + public IReplicatedRecord(final IReplicatedRecordIntf obj) { vTable = new VTable(obj); vTable.write(); @@ -19029,55 +16809,38 @@ protected VTable createVTable() return new VTable(cloopVTable); } - public void list(CryptoObjectInfo[] objInfo) + public int getRawLength() + { + VTable vTable = getVTable(); + int result = vTable.getRawLength.invoke(this); + return result; + } + + public com.sun.jna.Pointer getRawData() { VTable vTable = getVTable(); - vTable.list.invoke(this, objInfo); + com.sun.jna.Pointer result = vTable.getRawData.invoke(this); + return result; } } - public static class ICryptoFactory extends IPluginBase implements ICryptoFactoryIntf + public static class IReplicatedBlob extends IVersioned implements IReplicatedBlobIntf { - public static class VTable extends IPluginBase.VTable + public static class VTable extends IVersioned.VTable { - public static interface Callback_setTrace extends com.sun.jna.Callback - { - public void invoke(ICryptoFactory self, boolean need); - } - - public static interface Callback_getCryptoProvider extends com.sun.jna.Callback - { - public ICryptoProvider invoke(ICryptoFactory self, CryptoObjectInfo[] objInfo); - } - - public static interface Callback_getCryptoRandomFactory extends com.sun.jna.Callback - { - public ICryptoRandomFactory invoke(ICryptoFactory self, CryptoObjectInfo[] objInfo); - } - - public static interface Callback_getCryptoHashFactory extends com.sun.jna.Callback - { - public ICryptoHashFactory invoke(ICryptoFactory self, CryptoObjectInfo[] objInfo); - } - - public static interface Callback_getCryptoSymmetricFactory extends com.sun.jna.Callback - { - public ICryptoSymmetricFactory invoke(ICryptoFactory self, CryptoObjectInfo[] objInfo); - } - - public static interface Callback_getCryptoSignatureFactory extends com.sun.jna.Callback + public static interface Callback_getLength extends com.sun.jna.Callback { - public ICryptoSignatureFactory invoke(ICryptoFactory self, CryptoObjectInfo[] objInfo); + public int invoke(IReplicatedBlob self); } - public static interface Callback_getCryptoCertificateFactory extends com.sun.jna.Callback + public static interface Callback_isEof extends com.sun.jna.Callback { - public ICryptoCertificateFactory invoke(ICryptoFactory self, CryptoObjectInfo[] objInfo); + public boolean invoke(IReplicatedBlob self); } - public static interface Callback_getCryptoObjects extends com.sun.jna.Callback + public static interface Callback_getSegment extends com.sun.jna.Callback { - public int invoke(ICryptoFactory self, int type, IListCryptoObjects callback); + public int invoke(IReplicatedBlob self, int length, byte[] buffer); } public VTable(com.sun.jna.Pointer pointer) @@ -19085,71 +16848,31 @@ public VTable(com.sun.jna.Pointer pointer) super(pointer); } - public VTable(final ICryptoFactoryIntf obj) + public VTable(final IReplicatedBlobIntf obj) { super(obj); - setTrace = new Callback_setTrace() { - @Override - public void invoke(ICryptoFactory self, boolean need) - { - obj.setTrace(need); - } - }; - - getCryptoProvider = new Callback_getCryptoProvider() { - @Override - public ICryptoProvider invoke(ICryptoFactory self, CryptoObjectInfo[] objInfo) - { - return obj.getCryptoProvider(objInfo); - } - }; - - getCryptoRandomFactory = new Callback_getCryptoRandomFactory() { - @Override - public ICryptoRandomFactory invoke(ICryptoFactory self, CryptoObjectInfo[] objInfo) - { - return obj.getCryptoRandomFactory(objInfo); - } - }; - - getCryptoHashFactory = new Callback_getCryptoHashFactory() { - @Override - public ICryptoHashFactory invoke(ICryptoFactory self, CryptoObjectInfo[] objInfo) - { - return obj.getCryptoHashFactory(objInfo); - } - }; - - getCryptoSymmetricFactory = new Callback_getCryptoSymmetricFactory() { - @Override - public ICryptoSymmetricFactory invoke(ICryptoFactory self, CryptoObjectInfo[] objInfo) - { - return obj.getCryptoSymmetricFactory(objInfo); - } - }; - - getCryptoSignatureFactory = new Callback_getCryptoSignatureFactory() { + getLength = new Callback_getLength() { @Override - public ICryptoSignatureFactory invoke(ICryptoFactory self, CryptoObjectInfo[] objInfo) + public int invoke(IReplicatedBlob self) { - return obj.getCryptoSignatureFactory(objInfo); + return obj.getLength(); } }; - getCryptoCertificateFactory = new Callback_getCryptoCertificateFactory() { + isEof = new Callback_isEof() { @Override - public ICryptoCertificateFactory invoke(ICryptoFactory self, CryptoObjectInfo[] objInfo) + public boolean invoke(IReplicatedBlob self) { - return obj.getCryptoCertificateFactory(objInfo); + return obj.isEof(); } }; - getCryptoObjects = new Callback_getCryptoObjects() { + getSegment = new Callback_getSegment() { @Override - public int invoke(ICryptoFactory self, int type, IListCryptoObjects callback) + public int invoke(IReplicatedBlob self, int length, byte[] buffer) { - return obj.getCryptoObjects(type, callback); + return obj.getSegment(length, buffer); } }; } @@ -19158,29 +16881,24 @@ public VTable() { } - public Callback_setTrace setTrace; - public Callback_getCryptoProvider getCryptoProvider; - public Callback_getCryptoRandomFactory getCryptoRandomFactory; - public Callback_getCryptoHashFactory getCryptoHashFactory; - public Callback_getCryptoSymmetricFactory getCryptoSymmetricFactory; - public Callback_getCryptoSignatureFactory getCryptoSignatureFactory; - public Callback_getCryptoCertificateFactory getCryptoCertificateFactory; - public Callback_getCryptoObjects getCryptoObjects; + public Callback_getLength getLength; + public Callback_isEof isEof; + public Callback_getSegment getSegment; @Override protected java.util.List getFieldOrder() { java.util.List fields = super.getFieldOrder(); - fields.addAll(java.util.Arrays.asList("setTrace", "getCryptoProvider", "getCryptoRandomFactory", "getCryptoHashFactory", "getCryptoSymmetricFactory", "getCryptoSignatureFactory", "getCryptoCertificateFactory", "getCryptoObjects")); + fields.addAll(java.util.Arrays.asList("getLength", "isEof", "getSegment")); return fields; } } - public ICryptoFactory() + public IReplicatedBlob() { } - public ICryptoFactory(final ICryptoFactoryIntf obj) + public IReplicatedBlob(final IReplicatedBlobIntf obj) { vTable = new VTable(obj); vTable.write(); @@ -19194,139 +16912,85 @@ protected VTable createVTable() return new VTable(cloopVTable); } - public void setTrace(boolean need) - { - VTable vTable = getVTable(); - vTable.setTrace.invoke(this, need); - } - - public ICryptoProvider getCryptoProvider(CryptoObjectInfo[] objInfo) - { - VTable vTable = getVTable(); - ICryptoProvider result = vTable.getCryptoProvider.invoke(this, objInfo); - return result; - } - - public ICryptoRandomFactory getCryptoRandomFactory(CryptoObjectInfo[] objInfo) - { - VTable vTable = getVTable(); - ICryptoRandomFactory result = vTable.getCryptoRandomFactory.invoke(this, objInfo); - return result; - } - - public ICryptoHashFactory getCryptoHashFactory(CryptoObjectInfo[] objInfo) - { - VTable vTable = getVTable(); - ICryptoHashFactory result = vTable.getCryptoHashFactory.invoke(this, objInfo); - return result; - } - - public ICryptoSymmetricFactory getCryptoSymmetricFactory(CryptoObjectInfo[] objInfo) - { - VTable vTable = getVTable(); - ICryptoSymmetricFactory result = vTable.getCryptoSymmetricFactory.invoke(this, objInfo); - return result; - } - - public ICryptoSignatureFactory getCryptoSignatureFactory(CryptoObjectInfo[] objInfo) + public int getLength() { VTable vTable = getVTable(); - ICryptoSignatureFactory result = vTable.getCryptoSignatureFactory.invoke(this, objInfo); + int result = vTable.getLength.invoke(this); return result; } - public ICryptoCertificateFactory getCryptoCertificateFactory(CryptoObjectInfo[] objInfo) + public boolean isEof() { VTable vTable = getVTable(); - ICryptoCertificateFactory result = vTable.getCryptoCertificateFactory.invoke(this, objInfo); + boolean result = vTable.isEof.invoke(this); return result; } - public int getCryptoObjects(int type, IListCryptoObjects callback) + public int getSegment(int length, byte[] buffer) { VTable vTable = getVTable(); - int result = vTable.getCryptoObjects.invoke(this, type, callback); + int result = vTable.getSegment.invoke(this, length, buffer); return result; } } - public static class ILdapPlugin extends IReferenceCounted implements ILdapPluginIntf + public static class IReplicatedTransaction extends IDisposable implements IReplicatedTransactionIntf { - public static class VTable extends IReferenceCounted.VTable + public static class VTable extends IDisposable.VTable { - public static interface Callback_connect extends com.sun.jna.Callback - { - public void invoke(ILdapPlugin self); - } - - public static interface Callback_is_connected extends com.sun.jna.Callback - { - public boolean invoke(ILdapPlugin self); - } - - public static interface Callback_bind extends com.sun.jna.Callback - { - public boolean invoke(ILdapPlugin self); - } - - public static interface Callback_bind_as extends com.sun.jna.Callback - { - public boolean invoke(ILdapPlugin self, String user, String password); - } - - public static interface Callback_find_user extends com.sun.jna.Callback + public static interface Callback_prepare extends com.sun.jna.Callback { - public boolean invoke(ILdapPlugin self, String name, com.sun.jna.Pointer password, com.sun.jna.Pointer mf_password, com.sun.jna.Pointer hash_alg); + public boolean invoke(IReplicatedTransaction self); } - public static interface Callback_find_srp_user extends com.sun.jna.Callback + public static interface Callback_commit extends com.sun.jna.Callback { - public boolean invoke(ILdapPlugin self, String name, com.sun.jna.Pointer verifier, com.sun.jna.Pointer salt); + public boolean invoke(IReplicatedTransaction self); } - public static interface Callback_get_certificate extends com.sun.jna.Callback + public static interface Callback_rollback extends com.sun.jna.Callback { - public int invoke(ILdapPlugin self, String name, com.sun.jna.Pointer buffer, com.sun.jna.Pointer buffer_length, String attr_name); + public boolean invoke(IReplicatedTransaction self); } - public static interface Callback_get_user_attr extends com.sun.jna.Callback + public static interface Callback_startSavepoint extends com.sun.jna.Callback { - public boolean invoke(ILdapPlugin self, String name, String attr, com.sun.jna.Pointer value); + public boolean invoke(IReplicatedTransaction self); } - public static interface Callback_get_policy extends com.sun.jna.Callback + public static interface Callback_releaseSavepoint extends com.sun.jna.Callback { - public boolean invoke(ILdapPlugin self, String name, com.sun.jna.Pointer policy, ISC_TIMESTAMP[] passwd_time, com.sun.jna.Pointer failed_count, ISC_TIMESTAMP[] access_time); + public boolean invoke(IReplicatedTransaction self); } - public static interface Callback_set_policy extends com.sun.jna.Callback + public static interface Callback_rollbackSavepoint extends com.sun.jna.Callback { - public boolean invoke(ILdapPlugin self, String name, String policy, ISC_TIMESTAMP[] passwd_time, com.sun.jna.Pointer failed_count, ISC_TIMESTAMP[] access_time); + public boolean invoke(IReplicatedTransaction self); } - public static interface Callback_get_password_history extends com.sun.jna.Callback + public static interface Callback_insertRecord extends com.sun.jna.Callback { - public boolean invoke(ILdapPlugin self, String name, com.sun.jna.Pointer buffer, com.sun.jna.Pointer buffer_length); + public boolean invoke(IReplicatedTransaction self, String name, IReplicatedRecord record); } - public static interface Callback_find_user_groups extends com.sun.jna.Callback + public static interface Callback_updateRecord extends com.sun.jna.Callback { - public void invoke(ILdapPlugin self, com.sun.jna.Pointer userId); + public boolean invoke(IReplicatedTransaction self, String name, IReplicatedRecord orgRecord, IReplicatedRecord newRecord); } - public static interface Callback_change_legacy_password extends com.sun.jna.Callback + public static interface Callback_deleteRecord extends com.sun.jna.Callback { - public int invoke(ILdapPlugin self, String name, String password, boolean[] active); + public boolean invoke(IReplicatedTransaction self, String name, IReplicatedRecord record); } - public static interface Callback_change_mf_password extends com.sun.jna.Callback + public static interface Callback_storeBlob extends com.sun.jna.Callback { - public int invoke(ILdapPlugin self, String name, String password, com.sun.jna.Pointer hash, boolean[] active); + public boolean invoke(IReplicatedTransaction self, com.sun.jna.ptr.LongByReference blobId, IReplicatedBlob blob); } - public static interface Callback_change_srp_password extends com.sun.jna.Callback + public static interface Callback_executeSql extends com.sun.jna.Callback { - public int invoke(ILdapPlugin self, String name, String password, com.sun.jna.Pointer verifier, com.sun.jna.Pointer salt, boolean[] active); + public boolean invoke(IReplicatedTransaction self, String sql); } public VTable(com.sun.jna.Pointer pointer) @@ -19334,127 +16998,95 @@ public VTable(com.sun.jna.Pointer pointer) super(pointer); } - public VTable(final ILdapPluginIntf obj) + public VTable(final IReplicatedTransactionIntf obj) { super(obj); - connect = new Callback_connect() { - @Override - public void invoke(ILdapPlugin self) - { - obj.connect(); - } - }; - - is_connected = new Callback_is_connected() { - @Override - public boolean invoke(ILdapPlugin self) - { - return obj.is_connected(); - } - }; - - bind = new Callback_bind() { - @Override - public boolean invoke(ILdapPlugin self) - { - return obj.bind(); - } - }; - - bind_as = new Callback_bind_as() { - @Override - public boolean invoke(ILdapPlugin self, String user, String password) - { - return obj.bind_as(user, password); - } - }; - - find_user = new Callback_find_user() { + prepare = new Callback_prepare() { @Override - public boolean invoke(ILdapPlugin self, String name, com.sun.jna.Pointer password, com.sun.jna.Pointer mf_password, com.sun.jna.Pointer hash_alg) + public boolean invoke(IReplicatedTransaction self) { - return obj.find_user(name, password, mf_password, hash_alg); + return obj.prepare(); } }; - find_srp_user = new Callback_find_srp_user() { + commit = new Callback_commit() { @Override - public boolean invoke(ILdapPlugin self, String name, com.sun.jna.Pointer verifier, com.sun.jna.Pointer salt) + public boolean invoke(IReplicatedTransaction self) { - return obj.find_srp_user(name, verifier, salt); + return obj.commit(); } }; - get_certificate = new Callback_get_certificate() { + rollback = new Callback_rollback() { @Override - public int invoke(ILdapPlugin self, String name, com.sun.jna.Pointer buffer, com.sun.jna.Pointer buffer_length, String attr_name) + public boolean invoke(IReplicatedTransaction self) { - return obj.get_certificate(name, buffer, buffer_length, attr_name); + return obj.rollback(); } }; - get_user_attr = new Callback_get_user_attr() { + startSavepoint = new Callback_startSavepoint() { @Override - public boolean invoke(ILdapPlugin self, String name, String attr, com.sun.jna.Pointer value) + public boolean invoke(IReplicatedTransaction self) { - return obj.get_user_attr(name, attr, value); + return obj.startSavepoint(); } }; - get_policy = new Callback_get_policy() { + releaseSavepoint = new Callback_releaseSavepoint() { @Override - public boolean invoke(ILdapPlugin self, String name, com.sun.jna.Pointer policy, ISC_TIMESTAMP[] passwd_time, com.sun.jna.Pointer failed_count, ISC_TIMESTAMP[] access_time) + public boolean invoke(IReplicatedTransaction self) { - return obj.get_policy(name, policy, passwd_time, failed_count, access_time); + return obj.releaseSavepoint(); } }; - set_policy = new Callback_set_policy() { + rollbackSavepoint = new Callback_rollbackSavepoint() { @Override - public boolean invoke(ILdapPlugin self, String name, String policy, ISC_TIMESTAMP[] passwd_time, com.sun.jna.Pointer failed_count, ISC_TIMESTAMP[] access_time) + public boolean invoke(IReplicatedTransaction self) { - return obj.set_policy(name, policy, passwd_time, failed_count, access_time); + return obj.rollbackSavepoint(); } }; - get_password_history = new Callback_get_password_history() { + insertRecord = new Callback_insertRecord() { @Override - public boolean invoke(ILdapPlugin self, String name, com.sun.jna.Pointer buffer, com.sun.jna.Pointer buffer_length) + public boolean invoke(IReplicatedTransaction self, String name, IReplicatedRecord record) { - return obj.get_password_history(name, buffer, buffer_length); + return obj.insertRecord(name, record); } }; - find_user_groups = new Callback_find_user_groups() { + updateRecord = new Callback_updateRecord() { @Override - public void invoke(ILdapPlugin self, com.sun.jna.Pointer userId) + public boolean invoke(IReplicatedTransaction self, String name, IReplicatedRecord orgRecord, IReplicatedRecord newRecord) { - obj.find_user_groups(userId); + return obj.updateRecord(name, orgRecord, newRecord); } }; - change_legacy_password = new Callback_change_legacy_password() { + deleteRecord = new Callback_deleteRecord() { @Override - public int invoke(ILdapPlugin self, String name, String password, boolean[] active) + public boolean invoke(IReplicatedTransaction self, String name, IReplicatedRecord record) { - return obj.change_legacy_password(name, password, active); + return obj.deleteRecord(name, record); } }; - change_mf_password = new Callback_change_mf_password() { + storeBlob = new Callback_storeBlob() { @Override - public int invoke(ILdapPlugin self, String name, String password, com.sun.jna.Pointer hash, boolean[] active) + public boolean invoke(IReplicatedTransaction self, com.sun.jna.ptr.LongByReference blobId, IReplicatedBlob blob) { - return obj.change_mf_password(name, password, hash, active); + return obj.storeBlob(blobId, blob); } }; - change_srp_password = new Callback_change_srp_password() { + executeSql = new Callback_executeSql() { @Override - public int invoke(ILdapPlugin self, String name, String password, com.sun.jna.Pointer verifier, com.sun.jna.Pointer salt, boolean[] active) + public boolean invoke(IReplicatedTransaction self, String sql) { - return obj.change_srp_password(name, password, verifier, salt, active); + return obj.executeSql(sql); } }; } @@ -19463,36 +17095,32 @@ public VTable() { } - public Callback_connect connect; - public Callback_is_connected is_connected; - public Callback_bind bind; - public Callback_bind_as bind_as; - public Callback_find_user find_user; - public Callback_find_srp_user find_srp_user; - public Callback_get_certificate get_certificate; - public Callback_get_user_attr get_user_attr; - public Callback_get_policy get_policy; - public Callback_set_policy set_policy; - public Callback_get_password_history get_password_history; - public Callback_find_user_groups find_user_groups; - public Callback_change_legacy_password change_legacy_password; - public Callback_change_mf_password change_mf_password; - public Callback_change_srp_password change_srp_password; + public Callback_prepare prepare; + public Callback_commit commit; + public Callback_rollback rollback; + public Callback_startSavepoint startSavepoint; + public Callback_releaseSavepoint releaseSavepoint; + public Callback_rollbackSavepoint rollbackSavepoint; + public Callback_insertRecord insertRecord; + public Callback_updateRecord updateRecord; + public Callback_deleteRecord deleteRecord; + public Callback_storeBlob storeBlob; + public Callback_executeSql executeSql; @Override protected java.util.List getFieldOrder() { java.util.List fields = super.getFieldOrder(); - fields.addAll(java.util.Arrays.asList("connect", "is_connected", "bind", "bind_as", "find_user", "find_srp_user", "get_certificate", "get_user_attr", "get_policy", "set_policy", "get_password_history", "find_user_groups", "change_legacy_password", "change_mf_password", "change_srp_password")); + fields.addAll(java.util.Arrays.asList("prepare", "commit", "rollback", "startSavepoint", "releaseSavepoint", "rollbackSavepoint", "insertRecord", "updateRecord", "deleteRecord", "storeBlob", "executeSql")); return fields; } } - public ILdapPlugin() + public IReplicatedTransaction() { } - public ILdapPlugin(final ILdapPluginIntf obj) + public IReplicatedTransaction(final IReplicatedTransactionIntf obj) { vTable = new VTable(obj); vTable.write(); @@ -19506,117 +17134,106 @@ protected VTable createVTable() return new VTable(cloopVTable); } - public void connect() - { - VTable vTable = getVTable(); - vTable.connect.invoke(this); - } - - public boolean is_connected() - { - VTable vTable = getVTable(); - boolean result = vTable.is_connected.invoke(this); - return result; - } - - public boolean bind() - { - VTable vTable = getVTable(); - boolean result = vTable.bind.invoke(this); - return result; - } - - public boolean bind_as(String user, String password) + public boolean prepare() { VTable vTable = getVTable(); - boolean result = vTable.bind_as.invoke(this, user, password); + boolean result = vTable.prepare.invoke(this); return result; } - public boolean find_user(String name, com.sun.jna.Pointer password, com.sun.jna.Pointer mf_password, com.sun.jna.Pointer hash_alg) + public boolean commit() { VTable vTable = getVTable(); - boolean result = vTable.find_user.invoke(this, name, password, mf_password, hash_alg); + boolean result = vTable.commit.invoke(this); return result; } - public boolean find_srp_user(String name, com.sun.jna.Pointer verifier, com.sun.jna.Pointer salt) + public boolean rollback() { VTable vTable = getVTable(); - boolean result = vTable.find_srp_user.invoke(this, name, verifier, salt); + boolean result = vTable.rollback.invoke(this); return result; } - public int get_certificate(String name, com.sun.jna.Pointer buffer, com.sun.jna.Pointer buffer_length, String attr_name) + public boolean startSavepoint() { VTable vTable = getVTable(); - int result = vTable.get_certificate.invoke(this, name, buffer, buffer_length, attr_name); + boolean result = vTable.startSavepoint.invoke(this); return result; } - public boolean get_user_attr(String name, String attr, com.sun.jna.Pointer value) + public boolean releaseSavepoint() { VTable vTable = getVTable(); - boolean result = vTable.get_user_attr.invoke(this, name, attr, value); + boolean result = vTable.releaseSavepoint.invoke(this); return result; } - public boolean get_policy(String name, com.sun.jna.Pointer policy, ISC_TIMESTAMP[] passwd_time, com.sun.jna.Pointer failed_count, ISC_TIMESTAMP[] access_time) + public boolean rollbackSavepoint() { VTable vTable = getVTable(); - boolean result = vTable.get_policy.invoke(this, name, policy, passwd_time, failed_count, access_time); + boolean result = vTable.rollbackSavepoint.invoke(this); return result; } - public boolean set_policy(String name, String policy, ISC_TIMESTAMP[] passwd_time, com.sun.jna.Pointer failed_count, ISC_TIMESTAMP[] access_time) + public boolean insertRecord(String name, IReplicatedRecord record) { VTable vTable = getVTable(); - boolean result = vTable.set_policy.invoke(this, name, policy, passwd_time, failed_count, access_time); + boolean result = vTable.insertRecord.invoke(this, name, record); return result; } - public boolean get_password_history(String name, com.sun.jna.Pointer buffer, com.sun.jna.Pointer buffer_length) + public boolean updateRecord(String name, IReplicatedRecord orgRecord, IReplicatedRecord newRecord) { VTable vTable = getVTable(); - boolean result = vTable.get_password_history.invoke(this, name, buffer, buffer_length); + boolean result = vTable.updateRecord.invoke(this, name, orgRecord, newRecord); return result; } - public void find_user_groups(com.sun.jna.Pointer userId) - { - VTable vTable = getVTable(); - vTable.find_user_groups.invoke(this, userId); - } - - public int change_legacy_password(String name, String password, boolean[] active) + public boolean deleteRecord(String name, IReplicatedRecord record) { VTable vTable = getVTable(); - int result = vTable.change_legacy_password.invoke(this, name, password, active); + boolean result = vTable.deleteRecord.invoke(this, name, record); return result; } - public int change_mf_password(String name, String password, com.sun.jna.Pointer hash, boolean[] active) + public boolean storeBlob(com.sun.jna.ptr.LongByReference blobId, IReplicatedBlob blob) { VTable vTable = getVTable(); - int result = vTable.change_mf_password.invoke(this, name, password, hash, active); + boolean result = vTable.storeBlob.invoke(this, blobId, blob); return result; } - public int change_srp_password(String name, String password, com.sun.jna.Pointer verifier, com.sun.jna.Pointer salt, boolean[] active) + public boolean executeSql(String sql) { VTable vTable = getVTable(); - int result = vTable.change_srp_password.invoke(this, name, password, verifier, salt, active); + boolean result = vTable.executeSql.invoke(this, sql); return result; } } - public static class ILdapFactory extends IPluginBase implements ILdapFactoryIntf + public static class IReplicatedSession extends IDisposable implements IReplicatedSessionIntf { - public static class VTable extends IPluginBase.VTable + public static class VTable extends IDisposable.VTable { - public static interface Callback_getLdapPlugin extends com.sun.jna.Callback + public static interface Callback_getStatus extends com.sun.jna.Callback + { + public IStatus invoke(IReplicatedSession self); + } + + public static interface Callback_startTransaction extends com.sun.jna.Callback + { + public IReplicatedTransaction invoke(IReplicatedSession self, long number); + } + + public static interface Callback_cleanupTransaction extends com.sun.jna.Callback { - public ILdapPlugin invoke(ILdapFactory self, IStatus status); + public boolean invoke(IReplicatedSession self, long number); + } + + public static interface Callback_setSequence extends com.sun.jna.Callback + { + public boolean invoke(IReplicatedSession self, String name, long value); } public VTable(com.sun.jna.Pointer pointer) @@ -19624,23 +17241,39 @@ public VTable(com.sun.jna.Pointer pointer) super(pointer); } - public VTable(final ILdapFactoryIntf obj) + public VTable(final IReplicatedSessionIntf obj) { super(obj); - getLdapPlugin = new Callback_getLdapPlugin() { + getStatus = new Callback_getStatus() { @Override - public ILdapPlugin invoke(ILdapFactory self, IStatus status) + public IStatus invoke(IReplicatedSession self) { - try - { - return obj.getLdapPlugin(status); - } - catch (Throwable t) - { - FbInterfaceException.catchException(status, t); - return null; - } + return obj.getStatus(); + } + }; + + startTransaction = new Callback_startTransaction() { + @Override + public IReplicatedTransaction invoke(IReplicatedSession self, long number) + { + return obj.startTransaction(number); + } + }; + + cleanupTransaction = new Callback_cleanupTransaction() { + @Override + public boolean invoke(IReplicatedSession self, long number) + { + return obj.cleanupTransaction(number); + } + }; + + setSequence = new Callback_setSequence() { + @Override + public boolean invoke(IReplicatedSession self, String name, long value) + { + return obj.setSequence(name, value); } }; } @@ -19649,22 +17282,25 @@ public VTable() { } - public Callback_getLdapPlugin getLdapPlugin; + public Callback_getStatus getStatus; + public Callback_startTransaction startTransaction; + public Callback_cleanupTransaction cleanupTransaction; + public Callback_setSequence setSequence; @Override protected java.util.List getFieldOrder() { java.util.List fields = super.getFieldOrder(); - fields.addAll(java.util.Arrays.asList("getLdapPlugin")); + fields.addAll(java.util.Arrays.asList("getStatus", "startTransaction", "cleanupTransaction", "setSequence")); return fields; } } - public ILdapFactory() + public IReplicatedSession() { } - public ILdapFactory(final ILdapFactoryIntf obj) + public IReplicatedSession(final IReplicatedSessionIntf obj) { vTable = new VTable(obj); vTable.write(); @@ -19678,10 +17314,31 @@ protected VTable createVTable() return new VTable(cloopVTable); } - public ILdapPlugin getLdapPlugin(IStatus status) + public IStatus getStatus() + { + VTable vTable = getVTable(); + IStatus result = vTable.getStatus.invoke(this); + return result; + } + + public IReplicatedTransaction startTransaction(long number) + { + VTable vTable = getVTable(); + IReplicatedTransaction result = vTable.startTransaction.invoke(this, number); + return result; + } + + public boolean cleanupTransaction(long number) + { + VTable vTable = getVTable(); + boolean result = vTable.cleanupTransaction.invoke(this, number); + return result; + } + + public boolean setSequence(String name, long value) { VTable vTable = getVTable(); - ILdapPlugin result = vTable.getLdapPlugin.invoke(this, status); + boolean result = vTable.setSequence.invoke(this, name, value); return result; } } diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbOOClientDatabaseFactory.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbOOClientDatabaseFactory.java index 1d9a48b4fa..19777120a8 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbOOClientDatabaseFactory.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbOOClientDatabaseFactory.java @@ -24,7 +24,7 @@ private static final class ClientHolder { private static final FbClientLibrary clientLibrary = syncWrapIfNecessary(initClientLibrary()); private static FbClientLibrary initClientLibrary() { - return Native.loadLibrary("fbclient", FbInterface.class); + return Native.load("fbclient", FbInterface.class); } private static FbClientLibrary syncWrapIfNecessary(FbClientLibrary clientLibrary) { diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbOOEmbeddedDatabaseFactory.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbOOEmbeddedDatabaseFactory.java index bb76ece7b4..58d30c4f14 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbOOEmbeddedDatabaseFactory.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbOOEmbeddedDatabaseFactory.java @@ -49,7 +49,7 @@ private static FbClientLibrary initClientLibrary() { final List throwables = new ArrayList<>(); for (String libraryName : LIBRARIES_TO_TRY) { try { - return Native.loadLibrary(libraryName, FbClientLibrary.class); + return Native.load(libraryName, FbInterface.class); } catch (UnsatisfiedLinkError e) { throwables.add(e); log.debug("Attempt to load " + libraryName + " failed", e); diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IBlobImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IBlobImpl.java index 98a20cf536..4650855b39 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IBlobImpl.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IBlobImpl.java @@ -66,6 +66,11 @@ protected void cancelImpl() throws SQLException { } } + @Override + protected void releaseResources() { + byteBuffer = null; + } + @Override public long getBlobId() { return blobId.getValue(); diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IDatabaseImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IDatabaseImpl.java index 33343aff07..8cb0a3c328 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IDatabaseImpl.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IDatabaseImpl.java @@ -4,8 +4,10 @@ import org.firebirdsql.gds.impl.DatabaseParameterBufferExtension; import org.firebirdsql.gds.ng.*; import org.firebirdsql.gds.ng.listeners.TransactionListener; +import org.firebirdsql.jdbc.FBDriverNotCapableException; import org.firebirdsql.jdbc.SQLStateConstants; import org.firebirdsql.jna.fbclient.FbClientLibrary; +import org.firebirdsql.jna.fbclient.ISC_STATUS; import org.firebirdsql.nativeoo.gds.ng.FbInterface.*; import java.io.ByteArrayOutputStream; @@ -40,7 +42,7 @@ public class IDatabaseImpl extends AbstractFbDatabase public IDatabaseImpl(NativeDatabaseConnection connection) { super(connection, connection.createDatatypeCoder()); clientLibrary = connection.getClientLibrary(); - master = clientLibrary.fb_get_master_interface(); + master = ((FbInterface)clientLibrary).fb_get_master_interface(); provider = master.getDispatcher(); util = master.getUtilInterface(); attachment = null; @@ -274,13 +276,19 @@ public int getHandle() { throw new UnsupportedOperationException( "Native OO API not support database handle" ); } - protected IEventBlockImpl validateEventHandle(EventHandle eventHandle) throws SQLException { - if (!(eventHandle instanceof IEventBlockImpl)) { + @Override + public void setNetworkTimeout(int milliseconds) throws SQLException { + throw new FBDriverNotCapableException( + "Setting network timeout not supported in native implementation"); + } + + protected IEventImpl validateEventHandle(EventHandle eventHandle) throws SQLException { + if (!(eventHandle instanceof IEventImpl)) { // TODO SQLState and/or Firebird specific error throw new SQLNonTransientException(String.format("Invalid event handle type: %s, expected: %s", - eventHandle.getClass(), IEventBlockImpl.class)); + eventHandle.getClass(), IEventImpl.class)); } - IEventBlockImpl event = (IEventBlockImpl) eventHandle; + IEventImpl event = (IEventImpl) eventHandle; if (event.getSize() == -1) { // TODO SQLState and/or Firebird specific error throw new SQLTransientException("Event handle hasn't been initialized"); @@ -290,12 +298,12 @@ protected IEventBlockImpl validateEventHandle(EventHandle eventHandle) throws SQ @Override public EventHandle createEventHandle(String eventName, EventHandler eventHandler) throws SQLException { - final IEventBlockImpl eventHandle = new IEventBlockImpl(eventName, eventHandler, getEncoding()); + final IEventImpl eventHandle = new IEventImpl(eventName, eventHandler, getEncoding()); synchronized (getSynchronizationObject()) { synchronized (eventHandle) { - IUtil util = master.getUtilInterface(); - IEventBlock eventBlock = util.createEventBlock(getStatus(), new String[]{eventName}); - eventHandle.setEventBlock(eventBlock); + int size = clientLibrary.isc_event_block(eventHandle.getEventBuffer(), eventHandle.getResultBuffer(), + (short) 1, eventHandle.getEventNameMemory()); + eventHandle.setSize(size); } } return eventHandle; @@ -304,14 +312,17 @@ public EventHandle createEventHandle(String eventName, EventHandler eventHandler @Override public void countEvents(EventHandle eventHandle) throws SQLException { try { - final IEventBlockImpl eventBlock = validateEventHandle(eventHandle); + final IEventImpl event = validateEventHandle(eventHandle); int count; synchronized (getSynchronizationObject()) { - synchronized (eventBlock) { - count = eventBlock.getEventBlock().getCount(); + synchronized (event) { + ISC_STATUS[] status = new ISC_STATUS[20]; + clientLibrary.isc_event_counts(status, (short) event.getSize(), + event.getEventBuffer().getValue(), event.getResultBuffer().getValue()); + count = status[0].intValue(); } } - eventBlock.setEventCount(count); + event.setEventCount(count); } catch (SQLException e) { exceptionListenerDispatcher.errorOccurred(e); throw e; @@ -322,13 +333,13 @@ public void countEvents(EventHandle eventHandle) throws SQLException { public void queueEvent(EventHandle eventHandle) throws SQLException { try { checkConnected(); - final IEventBlockImpl eventBlock = validateEventHandle(eventHandle); + final IEventImpl event = validateEventHandle(eventHandle); synchronized (getSynchronizationObject()) { - synchronized (eventBlock) { - int length = eventBlock.getEventBlock().getLength(); - byte[] array = eventBlock.getEventBlock().getValues().getByteArray(0, length); - events = attachment.queEvents(getStatus(), eventBlock.getCallback(), + synchronized (event) { + int length = event.getSize(); + byte[] array = event.getEventBuffer().getValue().getByteArray(0, length); + events = attachment.queEvents(getStatus(), event.getCallback(), length, array); } @@ -343,14 +354,14 @@ public void queueEvent(EventHandle eventHandle) throws SQLException { public void cancelEvent(EventHandle eventHandle) throws SQLException { try { checkConnected(); - final IEventBlockImpl eventBlock = validateEventHandle(eventHandle); + final IEventImpl event = validateEventHandle(eventHandle); synchronized (getSynchronizationObject()) { - synchronized (eventBlock) { + synchronized (event) { try { events.cancel(getStatus()); } finally { - eventBlock.releaseMemory(); + event.releaseMemory(); } } } diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IEventBlockImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IEventImpl.java similarity index 77% rename from src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IEventBlockImpl.java rename to src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IEventImpl.java index 67af5eddb9..01a86d2b9f 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IEventBlockImpl.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IEventImpl.java @@ -1,9 +1,10 @@ package org.firebirdsql.nativeoo.gds.ng; +import com.sun.jna.Memory; +import com.sun.jna.ptr.PointerByReference; import org.firebirdsql.encodings.Encoding; import org.firebirdsql.gds.EventHandler; import org.firebirdsql.gds.ng.AbstractEventHandle; -import org.firebirdsql.nativeoo.gds.ng.FbInterface.IEventBlock; import org.firebirdsql.nativeoo.gds.ng.FbInterface.IEventCallback; import org.firebirdsql.nativeoo.gds.ng.FbInterface.IEventCallbackIntf; import org.firebirdsql.logging.Logger; @@ -15,17 +16,18 @@ * @author Vasiliy Yashkov * @since 4.0 */ -public class IEventBlockImpl extends AbstractEventHandle { +public class IEventImpl extends AbstractEventHandle { - private static final Logger log = LoggerFactory.getLogger(IEventBlockImpl.class); + private static final Logger log = LoggerFactory.getLogger(IEventImpl.class); private final CloseableMemory eventNameMemory; private int size = -1; - private IEventBlock eventBlock; + private final PointerByReference eventBuffer = new PointerByReference(); + private final PointerByReference resultBuffer = new PointerByReference(); private IEventCallback callback = new IEventCallback(new IEventCallbackImpl()); private int referenceCount = 0; - IEventBlockImpl(String eventName, EventHandler eventHandler, Encoding encoding) { + IEventImpl(String eventName, EventHandler eventHandler, Encoding encoding) { super(eventName, eventHandler); // Requires null-termination final byte[] eventNameBytes = encoding.encodeToCharset(eventName + '\0'); @@ -57,7 +59,7 @@ void setSize(int size) { * @return Size of the event buffers */ int getSize() { - return eventBlock.getLength(); + return this.size; } /** @@ -67,14 +69,6 @@ IEventCallback getCallback() { return callback; } - public IEventBlock getEventBlock() { - return eventBlock; - } - - public void setEventBlock(IEventBlock eventBlock) { - this.eventBlock = eventBlock; - } - public synchronized void releaseMemory() { if (size == -1) return; try { @@ -93,6 +87,24 @@ protected void finalize() throws Throwable { } } + /** + * @return The event buffer with the last queued count + */ + PointerByReference getEventBuffer() { + return eventBuffer; + } + + /** + * @return The result buffer with the last received count + */ + PointerByReference getResultBuffer() { + return resultBuffer; + } + + public Memory getEventNameMemory() { + return this.eventNameMemory; + } + private class IEventCallbackImpl implements IEventCallbackIntf { @Override @@ -113,7 +125,7 @@ public int release() { public void eventCallbackFunction(int length, com.sun.jna.Pointer events) { synchronized (this) { if (events != null) { - eventBlock.getValues().write(0, events.getByteArray(0, length), 0, length); + resultBuffer.getValue().write(0, events.getByteArray(0, length), 0, length); this.release(); onEventOccurred(); @@ -130,5 +142,4 @@ protected void finalize() throws Throwable { } } } - } diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IMessageMetadataImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IMessageMetadataImpl.java index 7f4b20ab27..3353f6fecc 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IMessageMetadataImpl.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IMessageMetadataImpl.java @@ -15,7 +15,7 @@ public class IMessageMetadataImpl implements FbMessageMetadata { private final IDatabaseImpl database; - private final IMetadataBuilderImpl metadataBuilderImpl; + private IMetadataBuilderImpl metadataBuilderImpl; private final IMetadataBuilder metadataBuilder; private final IMessageMetadata metadata; private final IStatus status; @@ -131,10 +131,11 @@ public int getType(int index) throws SQLException { return result; } - public IMetadataBuilder getBuilder() throws SQLException { - IMetadataBuilder result = metadata.getBuilder(getStatus()); + public FbMetadataBuilder getBuilder() throws SQLException { + if (metadataBuilderImpl == null) + metadataBuilderImpl = new IMetadataBuilderImpl(this.database, metadata.getCount(getStatus())); processStatus(); - return result; + return metadataBuilderImpl; } private IStatus getStatus() { diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IServiceImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IServiceImpl.java index 75f55e3e1a..f35cadf94f 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IServiceImpl.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IServiceImpl.java @@ -7,6 +7,7 @@ import org.firebirdsql.gds.impl.ServiceParameterBufferImp; import org.firebirdsql.gds.impl.ServiceRequestBufferImp; import org.firebirdsql.gds.ng.*; +import org.firebirdsql.jdbc.FBDriverNotCapableException; import org.firebirdsql.jna.fbclient.FbClientLibrary; import org.firebirdsql.nativeoo.gds.ng.FbInterface.*; @@ -32,7 +33,7 @@ public class IServiceImpl extends AbstractFbService impl public IServiceImpl(IServiceConnectionImpl connection) { super(connection, connection.createDatatypeCoder()); clientLibrary = connection.getClientLibrary(); - master = clientLibrary.fb_get_master_interface(); + master = ((FbInterface) clientLibrary).fb_get_master_interface(); status = master.getStatus(); provider = master.getDispatcher(); } @@ -140,6 +141,12 @@ public int getHandle() { throw new UnsupportedOperationException( "Native OO API not support service handle" ); } + @Override + public void setNetworkTimeout(int milliseconds) throws SQLException { + throw new FBDriverNotCapableException( + "Setting network timeout not supported in native implementation"); + } + /** * Additional tasks to execute directly after attach operation. *

diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IStatementImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IStatementImpl.java index ea40ea5d0c..87b5728aec 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IStatementImpl.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IStatementImpl.java @@ -130,6 +130,7 @@ public void execute(RowValue parameters) throws SQLException { reset(false); switchState(StatementState.EXECUTING); + updateStatementTimeout(); setMetaData(getParameterDescriptor(), parameters); @@ -144,26 +145,32 @@ public void execute(RowValue parameters) throws SQLException { } Pointer outPtr = null; - if ((statement.getFlags(getStatus()) & IStatement.FLAG_HAS_CURSOR) == IStatement.FLAG_HAS_CURSOR) { - cursor = statement.openCursor(getStatus(), transaction.getTransaction(), inMeta, inPtr, outMeta, 0); - } else { - ByteBuffer outMessage = ByteBuffer.allocate(getMaxSqlInfoSize()); - outPtr = new Memory(outMessage.array().length); - outPtr.write(0, outMessage.array(), 0, outMessage.array().length); - statement.execute(getStatus(), transaction.getTransaction(), inMeta, inPtr, outMeta, outPtr); - } - processStatus(); - - if (hasSingletonResult) { - /* A type with a singleton result (ie an execute procedure with return fields), doesn't actually - * have a result set that will be fetched, instead we have a singleton result if we have fields - */ - statementListenerDispatcher.statementExecuted(this, false, true); - queueRowData(toRowValue(getFieldDescriptor(), outMeta, outPtr)); - setAllRowsFetched(true); - } else { - // A normal execute is never a singleton result (even if it only produces a single result) - statementListenerDispatcher.statementExecuted(this, hasFields(), false); + try (OperationCloseHandle operationCloseHandle = signalExecute()) { + if (operationCloseHandle.isCancelled()) { + // operation was synchronously cancelled from an OperationAware implementation + throw FbExceptionBuilder.forException(ISCConstants.isc_cancelled).toFlatSQLException(); + } + if ((statement.getFlags(getStatus()) & IStatement.FLAG_HAS_CURSOR) == IStatement.FLAG_HAS_CURSOR) { + cursor = statement.openCursor(getStatus(), transaction.getTransaction(), inMeta, inPtr, outMeta, 0); + } else { + ByteBuffer outMessage = ByteBuffer.allocate(getMaxSqlInfoSize()); + outPtr = new Memory(outMessage.array().length); + outPtr.write(0, outMessage.array(), 0, outMessage.array().length); + statement.execute(getStatus(), transaction.getTransaction(), inMeta, inPtr, outMeta, outPtr); + } + processStatus(); + + if (hasSingletonResult) { + /* A type with a singleton result (ie an execute procedure with return fields), doesn't actually + * have a result set that will be fetched, instead we have a singleton result if we have fields + */ + statementListenerDispatcher.statementExecuted(this, false, true); + queueRowData(toRowValue(getFieldDescriptor(), outMeta, outPtr)); + setAllRowsFetched(true); + } else { + // A normal execute is never a singleton result (even if it only produces a single result) + statementListenerDispatcher.statementExecuted(this, hasFields(), false); + } } if (getState() != StatementState.ERROR) { @@ -193,8 +200,19 @@ protected void setMetaData(final RowDescriptor rowDescriptor, final RowValue par byte[] fieldData = parameters.getFieldData(idx); if (fieldData == null) { - // Note this only works because we mark the type as nullable in allocateXSqlDa - + // Note this only works because we mark the type as nullable in inMessage + final FieldDescriptor fieldDescriptor = rowDescriptor.getFieldDescriptor(idx); + nullShort = new byte[]{-1, -1}; + // clear status + getStatus(); + offset = inMeta.getOffset(status, idx) - align; + int nullOffset = inMeta.getNullOffset(status, idx); + inMessage.position(offset); + processStatus(); + // clear status + getStatus(); + inMessage.position(nullOffset); + inMessage.put(nullShort); } else { final FieldDescriptor fieldDescriptor = rowDescriptor.getFieldDescriptor(idx); // clear status @@ -251,21 +269,27 @@ public void fetchRows(int fetchSize) throws SQLException { } if (isAllRowsFetched()) return; - ByteBuffer message = ByteBuffer.allocate(outMeta.getMessageLength(getStatus()) + 1); - processStatus(); - Pointer ptr = new Memory(message.array().length); -// ptr.write(0, message.array(), 0, message.array().length); - int fetchStatus = cursor.fetchNext(getStatus(), ptr); - processStatus(); - if (fetchStatus == IStatus.RESULT_OK) { - queueRowData(toRowValue(getFieldDescriptor(), outMeta, ptr)); - } else if (fetchStatus == IStatus.RESULT_NO_DATA) { - setAllRowsFetched(true); - // Note: we are not explicitly 'closing' the cursor here - } else { - final String errorMessage = "Unexpected fetch status (expected 0 or 100): " + fetchStatus; - log.error(errorMessage); - throw new SQLException(errorMessage); + try (OperationCloseHandle operationCloseHandle = signalFetch()) { + if (operationCloseHandle.isCancelled()) { + // operation was synchronously cancelled from an OperationAware implementation + throw FbExceptionBuilder.forException(ISCConstants.isc_cancelled).toFlatSQLException(); + } + + ByteBuffer message = ByteBuffer.allocate(outMeta.getMessageLength(getStatus()) + 1); + processStatus(); + Pointer ptr = new Memory(message.array().length); + int fetchStatus = cursor.fetchNext(getStatus(), ptr); + processStatus(); + if (fetchStatus == IStatus.RESULT_OK) { + queueRowData(toRowValue(getFieldDescriptor(), outMeta, ptr)); + } else if (fetchStatus == IStatus.RESULT_NO_DATA) { + setAllRowsFetched(true); + // Note: we are not explicitly 'closing' the cursor here + } else { + final String errorMessage = "Unexpected fetch status (expected 0 or 100): " + fetchStatus; + log.error(errorMessage); + throw new SQLException(errorMessage); + } } } } catch (SQLException e) { @@ -368,4 +392,9 @@ private IStatus getStatus() { private void processStatus() throws SQLException { getDatabase().processStatus(status, getStatementWarningCallback()); } + + private void updateStatementTimeout() throws SQLException { + int allowedTimeout = (int) getAllowedTimeout(); + statement.setTimeout(getStatus(), allowedTimeout); + } } diff --git a/src/test/org/firebirdsql/gds/ng/AbstractBatchTest.java b/src/test/org/firebirdsql/gds/ng/AbstractBatchTest.java index dd47da0659..13635a2212 100644 --- a/src/test/org/firebirdsql/gds/ng/AbstractBatchTest.java +++ b/src/test/org/firebirdsql/gds/ng/AbstractBatchTest.java @@ -9,7 +9,6 @@ import org.firebirdsql.gds.impl.BatchParameterBufferImpl; import org.firebirdsql.gds.impl.TransactionParameterBufferImpl; import org.firebirdsql.jdbc.FirebirdConnection; -import org.firebirdsql.nativeoo.gds.ng.FbInterface; import org.firebirdsql.management.FBManager; import org.firebirdsql.util.FirebirdSupportInfo; import org.junit.After; @@ -195,7 +194,7 @@ public static FirebirdConnection getConnectionViaDriverManager() throws SQLExcep public void testCreateBatchWithoutMetadata() throws SQLException { allocateTransaction(); BatchParameterBuffer buffer = new BatchParameterBufferImpl(); - buffer.addArgument(FbInterface.IBatch.TAG_RECORD_COUNTS, 1); + buffer.addArgument(BatchParameterBuffer.TAG_RECORD_COUNTS, 1); FbBatch batch = db.createBatch(transaction, INSERT_QUERY, buffer); } @@ -239,8 +238,8 @@ public void testCreateBatchWithMetadata() throws SQLException { } BatchParameterBuffer buffer = new BatchParameterBufferImpl(); - buffer.addArgument(FbInterface.IBatch.TAG_RECORD_COUNTS, 1); - FbBatch batch = db.createBatch(transaction, INSERT_QUERY, metadataBuilder.getMessageMetadata(), buffer); + buffer.addArgument(BatchParameterBuffer.TAG_RECORD_COUNTS, 1); + db.createBatch(transaction, INSERT_QUERY, metadataBuilder.getMessageMetadata(), buffer); } private FbTransaction getTransaction() throws SQLException { From c426c70961f53d4dcc639ceb384100fba4512790 Mon Sep 17 00:00:00 2001 From: Vasiliy Yashkov Date: Tue, 28 Jul 2020 11:03:26 +0300 Subject: [PATCH 04/12] Add versioning support of native interfaces and update existing class implementations Additional changes: 1. Fix preparation of metadata when executing statement. 2. Add GDS type rule for new native support. 3. Replace SQL_DEC_FIXED with SQL_INT128. 4. Update gradle build config. 5. Add small comments. --- build.gradle | 4 +- .../jna/fbclient/CryptoObjectInfo.java | 4 + .../org/firebirdsql/jna/fbclient/FB_I128.java | 5 + .../firebirdsql/jna/fbclient/ISC_DATE.java | 11 + .../firebirdsql/jna/fbclient/ISC_QUAD.java | 8 + .../firebirdsql/jna/fbclient/ISC_TIME.java | 8 + .../jna/fbclient/ISC_TIMESTAMP_TZ.java | 8 + .../jna/fbclient/ISC_TIMESTAMP_TZ_EX.java | 27 + .../firebirdsql/jna/fbclient/ISC_TIME_TZ.java | 8 + .../jna/fbclient/ISC_TIME_TZ_EX.java | 27 + .../nativeoo/gds/ng/IBatchImplTest.java | 3 +- .../nativeoo/gds/ng/IBlobImplTest.java | 7 +- .../nativeoo/gds/ng/IDatabaseImplTest.java | 23 +- .../nativeoo/gds/ng/IEventBlockImplTest.java | 19 +- .../gds/ng/IServiceConnectionImplTest.java | 15 +- .../nativeoo/gds/ng/IServiceImplTest.java | 16 +- .../nativeoo/gds/ng/IStatementImplTest.java | 62 +- .../gds/ng/IStatementimplTimeoutTest.java | 4 +- .../nativeoo/gds/ng/ITransactionImplTest.java | 9 +- .../gds/ng/NativeDatabaseConnectionTest.java | 13 +- .../nativeoo/gds/ng/FbInterface.java | 2690 ++++++++++++++++- .../nativeoo/gds/ng/FbInterfaceException.java | 21 + .../nativeoo/gds/ng/IMetadataBuilderImpl.java | 4 +- .../nativeoo/gds/ng/IStatementImpl.java | 113 +- .../firebirdsql/common/rules/GdsTypeRule.java | 11 +- 25 files changed, 2905 insertions(+), 215 deletions(-) create mode 100644 src/jna-client/org/firebirdsql/jna/fbclient/ISC_TIMESTAMP_TZ_EX.java create mode 100644 src/jna-client/org/firebirdsql/jna/fbclient/ISC_TIME_TZ_EX.java diff --git a/build.gradle b/build.gradle index cc2adec9c3..1f95292e18 100644 --- a/build.gradle +++ b/build.gradle @@ -84,7 +84,7 @@ dependencies { sourceSets { main { java { - srcDirs = ['src/main', 'src/extern', 'src/jdbc_42', 'src/jna-client', 'src/openoffice'] + srcDirs = ['src/main', 'src/extern', 'src/jdbc_42', 'src/jna-client', 'src/openoffice', 'src/nativeoo'] } resources { srcDirs = ['src/resources'] @@ -92,7 +92,7 @@ sourceSets { } test { java { - srcDirs = ['src/test', 'src/test_42', 'src/jna-test'] + srcDirs = ['src/test', 'src/test_42', 'src/jna-test', 'src/nativeoo-test'] } resources { srcDirs = ['src/test_resources'] diff --git a/src/jna-client/org/firebirdsql/jna/fbclient/CryptoObjectInfo.java b/src/jna-client/org/firebirdsql/jna/fbclient/CryptoObjectInfo.java index ae8638b91b..7f866b178b 100644 --- a/src/jna-client/org/firebirdsql/jna/fbclient/CryptoObjectInfo.java +++ b/src/jna-client/org/firebirdsql/jna/fbclient/CryptoObjectInfo.java @@ -1,6 +1,10 @@ package org.firebirdsql.jna.fbclient; /** + * JNA wrapper for CryptoObjectInfo. + *

+ * This file was modified manually, do not automatically regenerate! + *

* @author Vasiliy Yashkov * @since 4.0 */ diff --git a/src/jna-client/org/firebirdsql/jna/fbclient/FB_I128.java b/src/jna-client/org/firebirdsql/jna/fbclient/FB_I128.java index b86b90798d..1211dc54db 100644 --- a/src/jna-client/org/firebirdsql/jna/fbclient/FB_I128.java +++ b/src/jna-client/org/firebirdsql/jna/fbclient/FB_I128.java @@ -7,6 +7,11 @@ import java.util.List; /** + * JNA wrapper for FB_I128. + *

+ * This file was modified manually, do not automatically regenerate! + *

+ * @author Vasiliy Yashkov * @since 4.0 */ public class FB_I128 extends Structure { diff --git a/src/jna-client/org/firebirdsql/jna/fbclient/ISC_DATE.java b/src/jna-client/org/firebirdsql/jna/fbclient/ISC_DATE.java index b5dbc160ff..d5c72fa403 100644 --- a/src/jna-client/org/firebirdsql/jna/fbclient/ISC_DATE.java +++ b/src/jna-client/org/firebirdsql/jna/fbclient/ISC_DATE.java @@ -5,6 +5,17 @@ import java.util.Arrays; import java.util.List; + + + +/** + * JNA wrapper for ISC_DATE. + *

+ * This file was modified manually, do not automatically regenerate! + *

+ * @author Vasiliy Yashkov + * @since 4.0 + */ public class ISC_DATE extends Structure implements Structure.ByValue { public int value; diff --git a/src/jna-client/org/firebirdsql/jna/fbclient/ISC_QUAD.java b/src/jna-client/org/firebirdsql/jna/fbclient/ISC_QUAD.java index 41f28ebc48..db76652ad7 100644 --- a/src/jna-client/org/firebirdsql/jna/fbclient/ISC_QUAD.java +++ b/src/jna-client/org/firebirdsql/jna/fbclient/ISC_QUAD.java @@ -1,4 +1,12 @@ package org.firebirdsql.jna.fbclient; +/** + * JNA wrapper for ISC_QUAD. + *

+ * This file was modified manually, do not automatically regenerate! + *

+ * @author Vasiliy Yashkov + * @since 4.0 + */ public class ISC_QUAD extends GDS_QUAD_t { } diff --git a/src/jna-client/org/firebirdsql/jna/fbclient/ISC_TIME.java b/src/jna-client/org/firebirdsql/jna/fbclient/ISC_TIME.java index 61b2f3a2c9..79beb5ef31 100644 --- a/src/jna-client/org/firebirdsql/jna/fbclient/ISC_TIME.java +++ b/src/jna-client/org/firebirdsql/jna/fbclient/ISC_TIME.java @@ -5,6 +5,14 @@ import java.util.Arrays; import java.util.List; +/** + * JNA wrapper for ISC_TIME. + *

+ * This file was modified manually, do not automatically regenerate! + *

+ * @author Vasiliy Yashkov + * @since 4.0 + */ public class ISC_TIME extends Structure implements Structure.ByValue { public int value; diff --git a/src/jna-client/org/firebirdsql/jna/fbclient/ISC_TIMESTAMP_TZ.java b/src/jna-client/org/firebirdsql/jna/fbclient/ISC_TIMESTAMP_TZ.java index eee4aeed9d..48fc7b503f 100644 --- a/src/jna-client/org/firebirdsql/jna/fbclient/ISC_TIMESTAMP_TZ.java +++ b/src/jna-client/org/firebirdsql/jna/fbclient/ISC_TIMESTAMP_TZ.java @@ -5,6 +5,14 @@ import java.util.Arrays; import java.util.List; +/** + * JNA wrapper for ISC_TIMESTAMP_TZ. + *

+ * This file was modified manually, do not automatically regenerate! + *

+ * @author Vasiliy Yashkov + * @since 4.0 + */ public class ISC_TIMESTAMP_TZ extends Structure implements Structure.ByValue { public ISC_TIMESTAMP timestamp; diff --git a/src/jna-client/org/firebirdsql/jna/fbclient/ISC_TIMESTAMP_TZ_EX.java b/src/jna-client/org/firebirdsql/jna/fbclient/ISC_TIMESTAMP_TZ_EX.java new file mode 100644 index 0000000000..a1a61d0a92 --- /dev/null +++ b/src/jna-client/org/firebirdsql/jna/fbclient/ISC_TIMESTAMP_TZ_EX.java @@ -0,0 +1,27 @@ +package org.firebirdsql.jna.fbclient; + +import com.sun.jna.Structure; + +import java.util.Arrays; +import java.util.List; + +/** + * JNA wrapper for ISC_TIMESTAMP_TZ_EX. + *

+ * This file was modified manually, do not automatically regenerate! + *

+ * @author Vasiliy Yashkov + * @since 4.0 + */ +public class ISC_TIMESTAMP_TZ_EX extends Structure implements Structure.ByValue { + + public ISC_TIMESTAMP timestamp; + public int time_zone; + public int offset; + + @Override + protected List getFieldOrder() + { + return Arrays.asList("timestamp", "time_zone", "offset"); + } +} diff --git a/src/jna-client/org/firebirdsql/jna/fbclient/ISC_TIME_TZ.java b/src/jna-client/org/firebirdsql/jna/fbclient/ISC_TIME_TZ.java index 395652190c..7ad9bab0ba 100644 --- a/src/jna-client/org/firebirdsql/jna/fbclient/ISC_TIME_TZ.java +++ b/src/jna-client/org/firebirdsql/jna/fbclient/ISC_TIME_TZ.java @@ -5,6 +5,14 @@ import java.util.Arrays; import java.util.List; +/** + * JNA wrapper for ISC_TIME_TZ. + *

+ * This file was modified manually, do not automatically regenerate! + *

+ * @author Vasiliy Yashkov + * @since 4.0 + */ public class ISC_TIME_TZ extends Structure implements Structure.ByValue { public ISC_TIME time; diff --git a/src/jna-client/org/firebirdsql/jna/fbclient/ISC_TIME_TZ_EX.java b/src/jna-client/org/firebirdsql/jna/fbclient/ISC_TIME_TZ_EX.java new file mode 100644 index 0000000000..8a1e091371 --- /dev/null +++ b/src/jna-client/org/firebirdsql/jna/fbclient/ISC_TIME_TZ_EX.java @@ -0,0 +1,27 @@ +package org.firebirdsql.jna.fbclient; + +import com.sun.jna.Structure; + +import java.util.Arrays; +import java.util.List; + +/** + * JNA wrapper for ISC_TIME_TZ_EX. + *

+ * This file was modified manually, do not automatically regenerate! + *

+ * @author Vasiliy Yashkov + * @since 4.0 + */ +public class ISC_TIME_TZ_EX extends Structure implements Structure.ByValue { + + public ISC_TIME time; + public int time_zone; + public int offset; + + @Override + protected List getFieldOrder() + { + return Arrays.asList("time", "time_zone", "offset"); + } +} diff --git a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IBatchImplTest.java b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IBatchImplTest.java index 1181cd1a5b..6e015542cd 100644 --- a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IBatchImplTest.java +++ b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IBatchImplTest.java @@ -10,7 +10,6 @@ import org.firebirdsql.gds.ng.fields.RowValue; import org.firebirdsql.gds.ng.wire.SimpleStatementListener; import org.firebirdsql.jdbc.FBBlob; -import org.junit.Before; import org.junit.ClassRule; import org.junit.Rule; import org.junit.Test; @@ -39,7 +38,7 @@ public class IBatchImplTest extends AbstractBatchTest { @ClassRule - public static final GdsTypeRule testType = GdsTypeRule.supportsNativeOnly(); + public static final GdsTypeRule testType = GdsTypeRule.supportsFBOONativeOnly(); //@formatter:off protected String INSERT_QUERY_WITHOUT_BLOBS = "INSERT INTO test_p_metadata (" + diff --git a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IBlobImplTest.java b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IBlobImplTest.java index 0add28c991..2afb67df33 100755 --- a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IBlobImplTest.java +++ b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IBlobImplTest.java @@ -22,11 +22,10 @@ import org.firebirdsql.common.rules.GdsTypeRule; import org.firebirdsql.gds.BlobParameterBuffer; import org.firebirdsql.gds.ISCConstants; -import org.firebirdsql.gds.impl.GDSFactory; -import org.firebirdsql.gds.impl.GDSType; + import org.firebirdsql.gds.ng.*; import org.firebirdsql.gds.ng.fields.RowValue; -import org.firebirdsql.gds.ng.jna.AbstractNativeDatabaseFactory; + import org.firebirdsql.gds.ng.wire.SimpleStatementListener; import org.junit.*; import org.junit.rules.ExpectedException; @@ -55,7 +54,7 @@ public class IBlobImplTest extends BaseTestBlob { @ClassRule - public static final GdsTypeRule testType = GdsTypeRule.supportsNativeOnly(); + public static final GdsTypeRule testType = GdsTypeRule.supportsFBOONativeOnly(); @Rule public final ExpectedException expectedException = ExpectedException.none(); diff --git a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IDatabaseImplTest.java b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IDatabaseImplTest.java index 8462963c07..3c95a21e4a 100644 --- a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IDatabaseImplTest.java +++ b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IDatabaseImplTest.java @@ -4,19 +4,18 @@ import org.firebirdsql.common.rules.GdsTypeRule; import org.firebirdsql.gds.ISCConstants; import org.firebirdsql.gds.TransactionParameterBuffer; -import org.firebirdsql.gds.impl.GDSFactory; + import org.firebirdsql.gds.impl.GDSServerVersion; -import org.firebirdsql.gds.impl.GDSType; + import org.firebirdsql.gds.impl.TransactionParameterBufferImpl; import org.firebirdsql.gds.impl.nativeoo.FbOOEmbeddedGDSFactoryPlugin; import org.firebirdsql.gds.ng.FbConnectionProperties; import org.firebirdsql.gds.ng.FbDatabase; import org.firebirdsql.gds.ng.FbTransaction; import org.firebirdsql.gds.ng.TransactionState; -import org.firebirdsql.gds.ng.jna.AbstractNativeDatabaseFactory; + import org.firebirdsql.jdbc.SQLStateConstants; import org.firebirdsql.management.FBManager; -import org.junit.Before; import org.junit.ClassRule; import org.junit.Rule; import org.junit.Test; @@ -45,14 +44,14 @@ public class IDatabaseImplTest { // TODO Assert in tests need to be checked (and more need to be added) @ClassRule - public static final GdsTypeRule testType = GdsTypeRule.supportsNativeOnly(); + public static final GdsTypeRule testType = GdsTypeRule.supportsFBOONativeOnly(); + + private AbstractNativeOODatabaseFactory factory = + (AbstractNativeOODatabaseFactory) FBTestProperties.getFbDatabaseFactory(); @Rule public final ExpectedException expectedException = ExpectedException.none(); - private static final String gdsType = "FBOONATIVE"; - - private AbstractNativeOODatabaseFactory factory; private final FbConnectionProperties connectionInfo; { @@ -63,15 +62,7 @@ public class IDatabaseImplTest { connectionInfo.setPassword(DB_PASSWORD); connectionInfo.setDatabaseName(FBTestProperties.getDatabasePath()); connectionInfo.setEncoding("NONE"); - } - - @Before - public void setFactory() { - factory = (AbstractNativeOODatabaseFactory) FBTestProperties.getFbDatabaseFactory(); - } - public static FBManager createFBManager() { - return new FBManager(GDSType.getType(gdsType)); } @Test diff --git a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IEventBlockImplTest.java b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IEventBlockImplTest.java index 2f141b6449..c012b45b76 100644 --- a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IEventBlockImplTest.java +++ b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IEventBlockImplTest.java @@ -7,10 +7,15 @@ import org.firebirdsql.gds.EventHandler; import org.firebirdsql.gds.ISCConstants; import org.firebirdsql.gds.TransactionParameterBuffer; + import org.firebirdsql.gds.impl.TransactionParameterBufferImpl; import org.firebirdsql.gds.ng.*; import org.firebirdsql.gds.ng.fields.RowValue; -import org.junit.*; + +import org.junit.After; +import org.junit.ClassRule; +import org.junit.Rule; +import org.junit.Test; import org.junit.rules.ExpectedException; import java.sql.SQLException; @@ -23,12 +28,15 @@ public class IEventBlockImplTest extends FBJUnit4TestBase { @ClassRule - public static final GdsTypeRule testType = GdsTypeRule.supportsNativeOnly(); + public static final GdsTypeRule testType = GdsTypeRule.supportsFBOONativeOnly(); + + private AbstractNativeOODatabaseFactory factory = + (AbstractNativeOODatabaseFactory) FBTestProperties.getFbDatabaseFactory(); @Rule public final ExpectedException expectedException = ExpectedException.none(); - private AbstractNativeOODatabaseFactory factory; + //@formatter:off public static final String TABLE_DEF = "CREATE TABLE TEST (" + @@ -57,11 +65,6 @@ public class IEventBlockImplTest extends FBJUnit4TestBase { private IDatabaseImpl db; - @Before - public void setFactory() { - factory = (AbstractNativeOODatabaseFactory) FBTestProperties.getFbDatabaseFactory(); - } - @After public final void tearDown() throws Exception { if (db != null && db.isAttached()) { diff --git a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IServiceConnectionImplTest.java b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IServiceConnectionImplTest.java index 5209576a79..d0aa344595 100644 --- a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IServiceConnectionImplTest.java +++ b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IServiceConnectionImplTest.java @@ -4,8 +4,8 @@ import org.firebirdsql.common.rules.GdsTypeRule; import org.firebirdsql.gds.ng.FbService; import org.firebirdsql.gds.ng.FbServiceProperties; + import org.firebirdsql.jna.fbclient.FbClientLibrary; -import org.junit.Before; import org.junit.ClassRule; import org.junit.Rule; import org.junit.Test; @@ -17,15 +17,15 @@ import static org.junit.Assert.assertNull; public class IServiceConnectionImplTest { - @ClassRule - public static final GdsTypeRule testType = GdsTypeRule.supportsNativeOnly(); + public static final GdsTypeRule testType = GdsTypeRule.supportsFBOONativeOnly(); + + private AbstractNativeOODatabaseFactory factory = + (AbstractNativeOODatabaseFactory) FBTestProperties.getFbDatabaseFactory(); @Rule public final ExpectedException expectedException = ExpectedException.none(); - private AbstractNativeOODatabaseFactory factory; - private final FbServiceProperties connectionInfo; { connectionInfo = new FbServiceProperties(); @@ -35,11 +35,6 @@ public class IServiceConnectionImplTest { connectionInfo.setPassword(DB_PASSWORD); } - @Before - public void setFactory() { - factory = (AbstractNativeOODatabaseFactory) FBTestProperties.getFbDatabaseFactory(); - } - @Test public void construct_clientLibraryNull_IllegalArgument() throws Exception { expectedException.expect(NullPointerException.class); diff --git a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IServiceImplTest.java b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IServiceImplTest.java index b330565b8c..d0e2e1445a 100644 --- a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IServiceImplTest.java +++ b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IServiceImplTest.java @@ -4,12 +4,14 @@ import org.firebirdsql.common.rules.GdsTypeRule; import org.firebirdsql.gds.ISCConstants; import org.firebirdsql.gds.ServiceRequestBuffer; + import org.firebirdsql.gds.impl.GDSServerVersion; + import org.firebirdsql.gds.impl.nativeoo.FbOOEmbeddedGDSFactoryPlugin; import org.firebirdsql.gds.ng.FbServiceProperties; + import org.firebirdsql.management.FBManager; import org.firebirdsql.management.FBStatisticsManager; -import org.junit.Before; import org.junit.ClassRule; import org.junit.Rule; import org.junit.Test; @@ -36,12 +38,15 @@ public class IServiceImplTest { @ClassRule - public static final GdsTypeRule testType = GdsTypeRule.supportsNativeOnly(); + public static final GdsTypeRule testType = GdsTypeRule.supportsFBOONativeOnly(); + + private AbstractNativeOODatabaseFactory factory = + (AbstractNativeOODatabaseFactory) FBTestProperties.getFbDatabaseFactory(); @Rule public final ExpectedException expectedException = ExpectedException.none(); - private AbstractNativeOODatabaseFactory factory; + private final FbServiceProperties connectionInfo; { @@ -52,11 +57,6 @@ public class IServiceImplTest { connectionInfo.setPassword(DB_PASSWORD); } - @Before - public void setFactory() { - factory = (AbstractNativeOODatabaseFactory) FBTestProperties.getFbDatabaseFactory(); - } - @Test public void testBasicAttach() throws Exception { try (IServiceImpl service = (IServiceImpl)factory.serviceConnect(connectionInfo)) { diff --git a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IStatementImplTest.java b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IStatementImplTest.java index 018cecd705..a573e7aa23 100644 --- a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IStatementImplTest.java +++ b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IStatementImplTest.java @@ -21,15 +21,14 @@ import org.firebirdsql.common.FBTestProperties; import org.firebirdsql.common.rules.GdsTypeRule; import org.firebirdsql.gds.JaybirdErrorCodes; + import org.firebirdsql.gds.ng.AbstractStatementTest; import org.firebirdsql.gds.ng.DatatypeCoder; import org.firebirdsql.gds.ng.FbDatabase; import org.firebirdsql.gds.ng.fields.RowValue; import org.firebirdsql.gds.ng.wire.SimpleStatementListener; import org.junit.ClassRule; -import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; import java.sql.SQLException; import java.sql.SQLNonTransientException; @@ -46,12 +45,9 @@ public class IStatementImplTest extends AbstractStatementTest { @ClassRule - public static final GdsTypeRule testType = GdsTypeRule.supportsNativeOnly(); - - @Rule - public final ExpectedException expectedException = ExpectedException.none(); + public static final GdsTypeRule testType = GdsTypeRule.supportsFBOONativeOnly(); - private final AbstractNativeOODatabaseFactory factory = + private AbstractNativeOODatabaseFactory factory = (AbstractNativeOODatabaseFactory) FBTestProperties.getFbDatabaseFactory(); @Override @@ -273,4 +269,56 @@ public void test_GetExecutionPlan_StatementClosed() throws Exception { statement.getExecutionPlan(); } + + @Test + public void setTimeout_nonZeroThenZero() throws Exception { + allocateStatement(); + + statement.prepare( + "SELECT RDB$DESCRIPTION AS \"Description\", RDB$RELATION_ID, RDB$SECURITY_CLASS, RDB$CHARACTER_SET_NAME " + + "FROM RDB$DATABASE"); + + statement.setTimeout(1); + assertEquals(1, statement.getTimeout()); + + statement.setTimeout(0); + assertEquals(0, statement.getTimeout()); + } + + @Test + public void setTimeout_max_long_allowed() throws Exception { + allocateStatement(); + + statement.prepare( + "SELECT RDB$DESCRIPTION AS \"Description\", RDB$RELATION_ID, RDB$SECURITY_CLASS, RDB$CHARACTER_SET_NAME " + + "FROM RDB$DATABASE"); + + statement.setTimeout(Integer.MAX_VALUE); + assertEquals(Integer.MAX_VALUE, statement.getTimeout()); + } + + @Test + public void setTimeout_negativeValue_throwsException() throws Exception { + allocateStatement(); + + statement.prepare( + "SELECT RDB$DESCRIPTION AS \"Description\", RDB$RELATION_ID, RDB$SECURITY_CLASS, RDB$CHARACTER_SET_NAME " + + "FROM RDB$DATABASE"); + + expectedException.expect(SQLNonTransientException.class); + expectedException.expect(errorCodeEquals(JaybirdErrorCodes.jb_invalidTimeout)); + + statement.setTimeout(-1); + } + + @Test + public void getTimeout_defaultZero() throws Exception { + allocateStatement(); + + statement.prepare( + "SELECT RDB$DESCRIPTION AS \"Description\", RDB$RELATION_ID, RDB$SECURITY_CLASS, RDB$CHARACTER_SET_NAME " + + "FROM RDB$DATABASE"); + + assertEquals(0, statement.getTimeout()); + } } diff --git a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IStatementimplTimeoutTest.java b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IStatementimplTimeoutTest.java index cdb6d6b908..22a1d35eb9 100644 --- a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IStatementimplTimeoutTest.java +++ b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IStatementimplTimeoutTest.java @@ -11,9 +11,9 @@ public class IStatementimplTimeoutTest extends AbstractStatementTimeoutTest { @ClassRule - public static final GdsTypeRule testType = GdsTypeRule.supportsNativeOnly(); + public static final GdsTypeRule testType = GdsTypeRule.supportsFBOONativeOnly(); - private final AbstractNativeOODatabaseFactory factory = + private AbstractNativeOODatabaseFactory factory = (AbstractNativeOODatabaseFactory) FBTestProperties.getFbDatabaseFactory(); @Override diff --git a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/ITransactionImplTest.java b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/ITransactionImplTest.java index 48f33ec740..b3eb690107 100644 --- a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/ITransactionImplTest.java +++ b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/ITransactionImplTest.java @@ -5,8 +5,6 @@ import org.firebirdsql.gds.ng.AbstractTransactionTest; import org.firebirdsql.gds.ng.FbDatabase; import org.junit.ClassRule; -import org.junit.Rule; -import org.junit.rules.ExpectedException; import java.sql.SQLException; @@ -18,12 +16,9 @@ public class ITransactionImplTest extends AbstractTransactionTest { @ClassRule - public static final GdsTypeRule testType = GdsTypeRule.supportsNativeOnly(); + public static final GdsTypeRule testType = GdsTypeRule.supportsFBOONativeOnly(); - @Rule - public final ExpectedException expectedException = ExpectedException.none(); - - private final AbstractNativeOODatabaseFactory factory = + private AbstractNativeOODatabaseFactory factory = (AbstractNativeOODatabaseFactory) FBTestProperties.getFbDatabaseFactory(); @Override diff --git a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/NativeDatabaseConnectionTest.java b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/NativeDatabaseConnectionTest.java index c08fcb8e46..029d20e692 100644 --- a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/NativeDatabaseConnectionTest.java +++ b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/NativeDatabaseConnectionTest.java @@ -5,7 +5,6 @@ import org.firebirdsql.gds.ng.FbConnectionProperties; import org.firebirdsql.gds.ng.FbDatabase; import org.firebirdsql.jna.fbclient.FbClientLibrary; -import org.junit.Before; import org.junit.ClassRule; import org.junit.Rule; import org.junit.Test; @@ -18,13 +17,14 @@ public class NativeDatabaseConnectionTest { @ClassRule - public static final GdsTypeRule testType = GdsTypeRule.supportsNativeOnly(); + public static final GdsTypeRule testType = GdsTypeRule.supportsFBOONativeOnly(); + + private AbstractNativeOODatabaseFactory factory = + (AbstractNativeOODatabaseFactory) FBTestProperties.getFbDatabaseFactory(); @Rule public final ExpectedException expectedException = ExpectedException.none(); - private AbstractNativeOODatabaseFactory factory; - private final FbConnectionProperties connectionInfo; { connectionInfo = new FbConnectionProperties(); @@ -36,11 +36,6 @@ public class NativeDatabaseConnectionTest { connectionInfo.setEncoding("NONE"); } - @Before - public void setFactory() { - factory = (AbstractNativeOODatabaseFactory) FBTestProperties.getFbDatabaseFactory(); - } - @Test public void construct_clientLibraryNull_IllegalArgument() throws Exception { expectedException.expect(NullPointerException.class); diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbInterface.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbInterface.java index 4e803f1caa..b471e3922d 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbInterface.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbInterface.java @@ -21,23 +21,31 @@ public interface FbInterface extends FbClientLibrary public static interface IVersionedIntf { + public int VERSION = 1; + } public static interface IReferenceCountedIntf extends IVersionedIntf { + public int VERSION = 2; + public void addRef(); public int release(); } public static interface IDisposableIntf extends IVersionedIntf { + public int VERSION = 2; + public void dispose(); } public static interface IStatusIntf extends IDisposableIntf { - public static int STATE_WARNINGS = 1; - public static int STATE_ERRORS = 2; + public int VERSION = 3; + + public static int STATE_WARNINGS = 0x1; + public static int STATE_ERRORS = 0x2; public static int RESULT_ERROR = -1; public static int RESULT_OK = 0; public static int RESULT_NO_DATA = 1; @@ -56,6 +64,8 @@ public static interface IStatusIntf extends IDisposableIntf public static interface IMasterIntf extends IVersionedIntf { + public int VERSION = 2; + public IStatus getStatus(); public IProvider getDispatcher(); public IPluginManager getPluginManager(); @@ -72,12 +82,16 @@ public static interface IMasterIntf extends IVersionedIntf public static interface IPluginBaseIntf extends IReferenceCountedIntf { + public int VERSION = 3; + public void setOwner(IReferenceCounted r); public IReferenceCounted getOwner(); } public static interface IPluginSetIntf extends IReferenceCountedIntf { + public int VERSION = 3; + public String getName(); public String getModuleName(); public IPluginBase getPlugin(IStatus status); @@ -85,17 +99,29 @@ public static interface IPluginSetIntf extends IReferenceCountedIntf public void set(IStatus status, String s); } + public static interface IListElementCallbackIntf extends IReferenceCountedIntf + { + public int VERSION = 3; + + public void callback(String text); + } + public static interface IConfigEntryIntf extends IReferenceCountedIntf { + public int VERSION = 4; + public String getName(); public String getValue(); public long getIntValue(); public boolean getBoolValue(); public IConfig getSubConfig(IStatus status); + public void getList(IListElementCallback callback); } public static interface IConfigIntf extends IReferenceCountedIntf { + public int VERSION = 3; + public IConfigEntry find(IStatus status, String name); public IConfigEntry findValue(IStatus status, String name, String value); public IConfigEntry findPos(IStatus status, String name, int pos); @@ -103,15 +129,20 @@ public static interface IConfigIntf extends IReferenceCountedIntf public static interface IFirebirdConfIntf extends IReferenceCountedIntf { + public int VERSION = 4; + public int getKey(String name); public long asInteger(int key); public String asString(int key); public boolean asBoolean(int key); public int getVersion(IStatus status); + public void asList(int key, IListElementCallback callback); } public static interface IPluginConfigIntf extends IReferenceCountedIntf { + public int VERSION = 3; + public String getConfigFileName(); public IConfig getDefaultConfig(IStatus status); public IFirebirdConf getFirebirdConf(IStatus status); @@ -120,17 +151,23 @@ public static interface IPluginConfigIntf extends IReferenceCountedIntf public static interface IPluginFactoryIntf extends IVersionedIntf { + public int VERSION = 2; + public IPluginBase createPlugin(IStatus status, IPluginConfig factoryParameter); } public static interface IPluginModuleIntf extends IVersionedIntf { + public int VERSION = 3; + public void doClean(); public void threadDetach(); } public static interface IPluginManagerIntf extends IVersionedIntf { + public int VERSION = 2; + public static int TYPE_PROVIDER = 1; public static int TYPE_FIRST_NON_LIB = 2; public static int TYPE_AUTH_SERVER = 3; @@ -141,7 +178,9 @@ public static interface IPluginManagerIntf extends IVersionedIntf public static int TYPE_WIRE_CRYPT = 8; public static int TYPE_DB_CRYPT = 9; public static int TYPE_KEY_HOLDER = 10; - public static int TYPE_COUNT = 11; + public static int TYPE_CRYPTO_API = 11; + public static int TYPE_LDAP = 12; + public static int TYPE_COUNT = 13; public void registerPluginFactory(int pluginType, String defaultName, IPluginFactory factory); public void registerModule(IPluginModule cleanup); @@ -153,6 +192,8 @@ public static interface IPluginManagerIntf extends IVersionedIntf public static interface ICryptKeyIntf extends IVersionedIntf { + public int VERSION = 2; + public void setSymmetric(IStatus status, String type, int keyLength, com.sun.jna.Pointer key); public void setAsymmetric(IStatus status, String type, int encryptKeyLength, com.sun.jna.Pointer encryptKey, int decryptKeyLength, com.sun.jna.Pointer decryptKey); public com.sun.jna.Pointer getEncryptKey(com.sun.jna.Pointer length); @@ -161,6 +202,8 @@ public static interface ICryptKeyIntf extends IVersionedIntf public static interface IConfigManagerIntf extends IVersionedIntf { + public int VERSION = 3; + public static int DIR_BIN = 0; public static int DIR_SBIN = 1; public static int DIR_CONF = 2; @@ -178,7 +221,9 @@ public static interface IConfigManagerIntf extends IVersionedIntf public static int DIR_LOG = 14; public static int DIR_GUARD = 15; public static int DIR_PLUGINS = 16; - public static int DIR_COUNT = 17; + public static int DIR_TZDATA = 17; + public static int DIR_SCHEDULERDB = 18; + public static int DIR_COUNT = 19; public String getDirectory(int code); public IFirebirdConf getFirebirdConf(); @@ -186,15 +231,20 @@ public static interface IConfigManagerIntf extends IVersionedIntf public IConfig getPluginConfig(String configuredPlugin); public String getInstallDirectory(); public String getRootDirectory(); + public String getDefaultSecurityDb(); } public static interface IEventCallbackIntf extends IReferenceCountedIntf { + public int VERSION = 3; + public void eventCallbackFunction(int length, com.sun.jna.Pointer events); } public static interface IBlobIntf extends IReferenceCountedIntf { + public int VERSION = 3; + public void getInfo(IStatus status, int itemsLength, byte[] items, int bufferLength, byte[] buffer); public int getSegment(IStatus status, int bufferLength, com.sun.jna.Pointer buffer, com.sun.jna.Pointer segmentLength); public void putSegment(IStatus status, int length, com.sun.jna.Pointer buffer); @@ -205,6 +255,8 @@ public static interface IBlobIntf extends IReferenceCountedIntf public static interface ITransactionIntf extends IReferenceCountedIntf { + public int VERSION = 3; + public void getInfo(IStatus status, int itemsLength, byte[] items, int bufferLength, byte[] buffer); public void prepare(IStatus status, int msgLength, byte[] message); public void commit(IStatus status); @@ -219,6 +271,8 @@ public static interface ITransactionIntf extends IReferenceCountedIntf public static interface IMessageMetadataIntf extends IReferenceCountedIntf { + public int VERSION = 4; + public int getCount(IStatus status); public String getField(IStatus status, int index); public String getRelation(IStatus status, int index); @@ -240,6 +294,8 @@ public static interface IMessageMetadataIntf extends IReferenceCountedIntf public static interface IMetadataBuilderIntf extends IReferenceCountedIntf { + public int VERSION = 4; + public void setType(IStatus status, int index, int type); public void setSubType(IStatus status, int index, int subType); public void setLength(IStatus status, int index, int length); @@ -250,10 +306,16 @@ public static interface IMetadataBuilderIntf extends IReferenceCountedIntf public void remove(IStatus status, int index); public int addField(IStatus status); public IMessageMetadata getMetadata(IStatus status); + public void setField(IStatus status, int index, String field); + public void setRelation(IStatus status, int index, String relation); + public void setOwner(IStatus status, int index, String owner); + public void setAlias(IStatus status, int index, String alias); } public static interface IResultSetIntf extends IReferenceCountedIntf { + public int VERSION = 3; + public int fetchNext(IStatus status, com.sun.jna.Pointer message); public int fetchPrior(IStatus status, com.sun.jna.Pointer message); public int fetchFirst(IStatus status, com.sun.jna.Pointer message); @@ -269,19 +331,21 @@ public static interface IResultSetIntf extends IReferenceCountedIntf public static interface IStatementIntf extends IReferenceCountedIntf { - public static int PREPARE_PREFETCH_NONE = 0; - public static int PREPARE_PREFETCH_TYPE = 1; - public static int PREPARE_PREFETCH_INPUT_PARAMETERS = 2; - public static int PREPARE_PREFETCH_OUTPUT_PARAMETERS = 4; - public static int PREPARE_PREFETCH_LEGACY_PLAN = 8; - public static int PREPARE_PREFETCH_DETAILED_PLAN = 16; - public static int PREPARE_PREFETCH_AFFECTED_RECORDS = 32; - public static int PREPARE_PREFETCH_FLAGS = 64; + public int VERSION = 4; + + public static int PREPARE_PREFETCH_NONE = 0x0; + public static int PREPARE_PREFETCH_TYPE = 0x1; + public static int PREPARE_PREFETCH_INPUT_PARAMETERS = 0x2; + public static int PREPARE_PREFETCH_OUTPUT_PARAMETERS = 0x4; + public static int PREPARE_PREFETCH_LEGACY_PLAN = 0x8; + public static int PREPARE_PREFETCH_DETAILED_PLAN = 0x10; + public static int PREPARE_PREFETCH_AFFECTED_RECORDS = 0x20; + public static int PREPARE_PREFETCH_FLAGS = 0x40; public static int PREPARE_PREFETCH_METADATA = IStatementIntf.PREPARE_PREFETCH_TYPE | IStatementIntf.PREPARE_PREFETCH_FLAGS | IStatementIntf.PREPARE_PREFETCH_INPUT_PARAMETERS | IStatementIntf.PREPARE_PREFETCH_OUTPUT_PARAMETERS; public static int PREPARE_PREFETCH_ALL = IStatementIntf.PREPARE_PREFETCH_METADATA | IStatementIntf.PREPARE_PREFETCH_LEGACY_PLAN | IStatementIntf.PREPARE_PREFETCH_DETAILED_PLAN | IStatementIntf.PREPARE_PREFETCH_AFFECTED_RECORDS; - public static int FLAG_HAS_CURSOR = 1; - public static int FLAG_REPEAT_EXECUTE = 2; - public static int CURSOR_TYPE_SCROLLABLE = 1; + public static int FLAG_HAS_CURSOR = 0x1; + public static int FLAG_REPEAT_EXECUTE = 0x2; + public static int CURSOR_TYPE_SCROLLABLE = 0x1; public void getInfo(IStatus status, int itemsLength, byte[] items, int bufferLength, byte[] buffer); public int getType(IStatus status); @@ -301,6 +365,8 @@ public static interface IStatementIntf extends IReferenceCountedIntf public static interface IBatchIntf extends IReferenceCountedIntf { + public int VERSION = 3; + public static byte VERSION1 = 1; public static byte TAG_MULTIERROR = 1; public static byte TAG_RECORD_COUNTS = 2; @@ -327,9 +393,11 @@ public static interface IBatchIntf extends IReferenceCountedIntf public static interface IBatchCompletionStateIntf extends IDisposableIntf { + public int VERSION = 3; + public static int EXECUTE_FAILED = -1; public static int SUCCESS_NO_INFO = -2; - public static int NO_MORE_ERRORS = -1; + public static int NO_MORE_ERRORS = 0x7fffffff; public int getSize(IStatus status); public int getState(IStatus status, int pos); @@ -339,12 +407,16 @@ public static interface IBatchCompletionStateIntf extends IDisposableIntf public static interface IReplicatorIntf extends IReferenceCountedIntf { + public int VERSION = 3; + public void process(IStatus status, int length, byte[] data); public void close(IStatus status); } public static interface IRequestIntf extends IReferenceCountedIntf { + public int VERSION = 3; + public void receive(IStatus status, int level, int msgType, int length, com.sun.jna.Pointer message); public void send(IStatus status, int level, int msgType, int length, com.sun.jna.Pointer message); public void getInfo(IStatus status, int level, int itemsLength, byte[] items, int bufferLength, byte[] buffer); @@ -356,11 +428,15 @@ public static interface IRequestIntf extends IReferenceCountedIntf public static interface IEventsIntf extends IReferenceCountedIntf { + public int VERSION = 3; + public void cancel(IStatus status); } public static interface IAttachmentIntf extends IReferenceCountedIntf { + public int VERSION = 4; + public void getInfo(IStatus status, int itemsLength, byte[] items, int bufferLength, byte[] buffer); public ITransaction startTransaction(IStatus status, int tpbLength, byte[] tpb); public ITransaction reconnectTransaction(IStatus status, int length, byte[] id); @@ -389,6 +465,8 @@ public static interface IAttachmentIntf extends IReferenceCountedIntf public static interface IServiceIntf extends IReferenceCountedIntf { + public int VERSION = 3; + public void detach(IStatus status); public void query(IStatus status, int sendLength, byte[] sendItems, int receiveLength, byte[] receiveItems, int bufferLength, byte[] buffer); public void start(IStatus status, int spbLength, byte[] spb); @@ -396,6 +474,8 @@ public static interface IServiceIntf extends IReferenceCountedIntf public static interface IProviderIntf extends IPluginBaseIntf { + public int VERSION = 4; + public IAttachment attachDatabase(IStatus status, String fileName, int dpbLength, byte[] dpb); public IAttachment createDatabase(IStatus status, String fileName, int dpbLength, byte[] dpb); public IService attachServiceManager(IStatus status, String service, int spbLength, byte[] spb); @@ -405,6 +485,8 @@ public static interface IProviderIntf extends IPluginBaseIntf public static interface IDtcStartIntf extends IDisposableIntf { + public int VERSION = 3; + public void addAttachment(IStatus status, IAttachment att); public void addWithTpb(IStatus status, IAttachment att, int length, byte[] tpb); public ITransaction start(IStatus status); @@ -412,12 +494,16 @@ public static interface IDtcStartIntf extends IDisposableIntf public static interface IDtcIntf extends IVersionedIntf { + public int VERSION = 2; + public ITransaction join(IStatus status, ITransaction one, ITransaction two); public IDtcStart startBuilder(IStatus status); } public static interface IAuthIntf extends IPluginBaseIntf { + public int VERSION = 4; + public static int AUTH_FAILED = -1; public static int AUTH_SUCCESS = 0; public static int AUTH_MORE_DATA = 1; @@ -427,14 +513,19 @@ public static interface IAuthIntf extends IPluginBaseIntf public static interface IWriterIntf extends IVersionedIntf { + public int VERSION = 2; + public void reset(); public void add(IStatus status, String name); public void setType(IStatus status, String value); public void setDb(IStatus status, String value); + public void changeLogin(IStatus status, String login); } public static interface IServerBlockIntf extends IVersionedIntf { + public int VERSION = 2; + public String getLogin(); public com.sun.jna.Pointer getData(com.sun.jna.Pointer length); public void putData(IStatus status, int length, com.sun.jna.Pointer data); @@ -443,27 +534,38 @@ public static interface IServerBlockIntf extends IVersionedIntf public static interface IClientBlockIntf extends IReferenceCountedIntf { + public int VERSION = 5; + public String getLogin(); public String getPassword(); public com.sun.jna.Pointer getData(com.sun.jna.Pointer length); public void putData(IStatus status, int length, com.sun.jna.Pointer data); public ICryptKey newKey(IStatus status); public IAuthBlock getAuthBlock(IStatus status); + public String getEffectiveLogin(); + public String getCertificate(); + public String getRepositoryPin(); } public static interface IServerIntf extends IAuthIntf { + public int VERSION = 6; + public int authenticate(IStatus status, IServerBlock sBlock, IWriter writerInterface); public void setDbCryptCallback(IStatus status, ICryptKeyCallback cryptCallback); } public static interface IClientIntf extends IAuthIntf { + public int VERSION = 5; + public int authenticate(IStatus status, IClientBlock cBlock); } public static interface IUserFieldIntf extends IVersionedIntf { + public int VERSION = 2; + public int entered(); public int specified(); public void setEntered(IStatus status, int newValue); @@ -471,18 +573,24 @@ public static interface IUserFieldIntf extends IVersionedIntf public static interface ICharUserFieldIntf extends IUserFieldIntf { + public int VERSION = 3; + public String get(); public void set(IStatus status, String newValue); } public static interface IIntUserFieldIntf extends IUserFieldIntf { + public int VERSION = 3; + public int get(); public void set(IStatus status, int newValue); } public static interface IUserIntf extends IVersionedIntf { + public int VERSION = 2; + public static int OP_USER_ADD = 1; public static int OP_USER_MODIFY = 2; public static int OP_USER_DELETE = 3; @@ -505,11 +613,15 @@ public static interface IUserIntf extends IVersionedIntf public static interface IListUsersIntf extends IVersionedIntf { + public int VERSION = 2; + public void list(IStatus status, IUser user); } public static interface ILogonInfoIntf extends IVersionedIntf { + public int VERSION = 2; + public String name(); public String role(); public String networkProtocol(); @@ -519,6 +631,8 @@ public static interface ILogonInfoIntf extends IVersionedIntf public static interface IManagementIntf extends IPluginBaseIntf { + public int VERSION = 4; + public void start(IStatus status, ILogonInfo logonInfo); public int execute(IStatus status, IUser user, IListUsers callback); public void commit(IStatus status); @@ -527,6 +641,8 @@ public static interface IManagementIntf extends IPluginBaseIntf public static interface IAuthBlockIntf extends IVersionedIntf { + public int VERSION = 2; + public String getType(); public String getName(); public String getPlugin(); @@ -538,6 +654,8 @@ public static interface IAuthBlockIntf extends IVersionedIntf public static interface IWireCryptPluginIntf extends IPluginBaseIntf { + public int VERSION = 5; + public String getKnownTypes(IStatus status); public void setKey(IStatus status, ICryptKey key); public void encrypt(IStatus status, int length, com.sun.jna.Pointer from, com.sun.jna.Pointer to); @@ -548,11 +666,15 @@ public static interface IWireCryptPluginIntf extends IPluginBaseIntf public static interface ICryptKeyCallbackIntf extends IVersionedIntf { + public int VERSION = 2; + public int callback(int dataLength, com.sun.jna.Pointer data, int bufferLength, com.sun.jna.Pointer buffer); } public static interface IKeyHolderPluginIntf extends IPluginBaseIntf { + public int VERSION = 5; + public int keyCallback(IStatus status, ICryptKeyCallback callback); public ICryptKeyCallback keyHandle(IStatus status, String keyName); public boolean useOnlyOwnKeys(IStatus status); @@ -561,11 +683,15 @@ public static interface IKeyHolderPluginIntf extends IPluginBaseIntf public static interface IDbCryptInfoIntf extends IReferenceCountedIntf { + public int VERSION = 3; + public String getDatabaseFullPath(IStatus status); } public static interface IDbCryptPluginIntf extends IPluginBaseIntf { + public int VERSION = 5; + public void setKey(IStatus status, int length, IKeyHolderPlugin[] sources, String keyName); public void encrypt(IStatus status, int length, com.sun.jna.Pointer from, com.sun.jna.Pointer to); public void decrypt(IStatus status, int length, com.sun.jna.Pointer from, com.sun.jna.Pointer to); @@ -574,6 +700,8 @@ public static interface IDbCryptPluginIntf extends IPluginBaseIntf public static interface IExternalContextIntf extends IVersionedIntf { + public int VERSION = 2; + public IMaster getMaster(); public IExternalEngine getEngine(IStatus status); public IAttachment getAttachment(IStatus status); @@ -588,23 +716,31 @@ public static interface IExternalContextIntf extends IVersionedIntf public static interface IExternalResultSetIntf extends IDisposableIntf { + public int VERSION = 3; + public boolean fetch(IStatus status); } public static interface IExternalFunctionIntf extends IDisposableIntf { + public int VERSION = 3; + public void getCharSet(IStatus status, IExternalContext context, com.sun.jna.Pointer name, int nameSize); public void execute(IStatus status, IExternalContext context, com.sun.jna.Pointer inMsg, com.sun.jna.Pointer outMsg); } public static interface IExternalProcedureIntf extends IDisposableIntf { + public int VERSION = 3; + public void getCharSet(IStatus status, IExternalContext context, com.sun.jna.Pointer name, int nameSize); public IExternalResultSet open(IStatus status, IExternalContext context, com.sun.jna.Pointer inMsg, com.sun.jna.Pointer outMsg); } public static interface IExternalTriggerIntf extends IDisposableIntf { + public int VERSION = 4; + public static int TYPE_BEFORE = 1; public static int TYPE_AFTER = 2; public static int TYPE_DATABASE = 3; @@ -619,11 +755,14 @@ public static interface IExternalTriggerIntf extends IDisposableIntf public static int ACTION_DDL = 9; public void getCharSet(IStatus status, IExternalContext context, com.sun.jna.Pointer name, int nameSize); - public void execute(IStatus status, IExternalContext context, int action, com.sun.jna.Pointer oldMsg, com.sun.jna.Pointer newMsg); + public void execute(IStatus status, IExternalContext context, int action, com.sun.jna.Pointer oldMsg, com.sun.jna.Pointer newMsg, com.sun.jna.Pointer oldDbKey, com.sun.jna.Pointer newDbKey); + public boolean getDoNotEvaluateField(IStatus status, int index); } public static interface IRoutineMetadataIntf extends IVersionedIntf { + public int VERSION = 2; + public String getPackage(IStatus status); public String getName(IStatus status); public String getEntryPoint(IStatus status); @@ -637,6 +776,8 @@ public static interface IRoutineMetadataIntf extends IVersionedIntf public static interface IExternalEngineIntf extends IPluginBaseIntf { + public int VERSION = 4; + public void open(IStatus status, IExternalContext context, com.sun.jna.Pointer charSet, int charSetSize); public void openAttachment(IStatus status, IExternalContext context); public void closeAttachment(IStatus status, IExternalContext context); @@ -647,22 +788,30 @@ public static interface IExternalEngineIntf extends IPluginBaseIntf public static interface ITimerIntf extends IReferenceCountedIntf { + public int VERSION = 3; + public void handler(); } public static interface ITimerControlIntf extends IVersionedIntf { + public int VERSION = 2; + public void start(IStatus status, ITimer timer, long microSeconds); public void stop(IStatus status, ITimer timer); } public static interface IVersionCallbackIntf extends IVersionedIntf { + public int VERSION = 2; + public void callback(IStatus status, String text); } public static interface IUtilIntf extends IVersionedIntf { + public int VERSION = 4; + public void getFbVersion(IStatus status, IAttachment att, IVersionCallback callback); public void loadBlob(IStatus status, com.sun.jna.ptr.LongByReference blobId, IAttachment att, ITransaction tra, String file, boolean txt); public void dumpBlob(IStatus status, com.sun.jna.ptr.LongByReference blobId, IAttachment att, ITransaction tra, String file, boolean txt); @@ -678,28 +827,35 @@ public static interface IUtilIntf extends IVersionedIntf public int setOffsets(IStatus status, IMessageMetadata metadata, IOffsetsCallback callback); public IDecFloat16 getDecFloat16(IStatus status); public IDecFloat34 getDecFloat34(IStatus status); - public ITransaction getTransactionByHandle(IStatus status, com.sun.jna.ptr.LongByReference hndlPtr); - public IStatement getStatementByHandle(IStatus status, com.sun.jna.ptr.LongByReference hndlPtr); public void decodeTimeTz(IStatus status, ISC_TIME_TZ[] timeTz, com.sun.jna.Pointer hours, com.sun.jna.Pointer minutes, com.sun.jna.Pointer seconds, com.sun.jna.Pointer fractions, int timeZoneBufferLength, com.sun.jna.Pointer timeZoneBuffer); public void decodeTimeStampTz(IStatus status, ISC_TIMESTAMP_TZ[] timeStampTz, com.sun.jna.Pointer year, com.sun.jna.Pointer month, com.sun.jna.Pointer day, com.sun.jna.Pointer hours, com.sun.jna.Pointer minutes, com.sun.jna.Pointer seconds, com.sun.jna.Pointer fractions, int timeZoneBufferLength, com.sun.jna.Pointer timeZoneBuffer); public void encodeTimeTz(IStatus status, ISC_TIME_TZ[] timeTz, int hours, int minutes, int seconds, int fractions, String timeZone); public void encodeTimeStampTz(IStatus status, ISC_TIMESTAMP_TZ[] timeStampTz, int year, int month, int day, int hours, int minutes, int seconds, int fractions, String timeZone); public IInt128 getInt128(IStatus status); + public void decodeTimeTzEx(IStatus status, ISC_TIME_TZ_EX[] timeTz, com.sun.jna.Pointer hours, com.sun.jna.Pointer minutes, com.sun.jna.Pointer seconds, com.sun.jna.Pointer fractions, int timeZoneBufferLength, com.sun.jna.Pointer timeZoneBuffer); + public void decodeTimeStampTzEx(IStatus status, ISC_TIMESTAMP_TZ_EX[] timeStampTz, com.sun.jna.Pointer year, com.sun.jna.Pointer month, com.sun.jna.Pointer day, com.sun.jna.Pointer hours, com.sun.jna.Pointer minutes, com.sun.jna.Pointer seconds, com.sun.jna.Pointer fractions, int timeZoneBufferLength, com.sun.jna.Pointer timeZoneBuffer); } public static interface IOffsetsCallbackIntf extends IVersionedIntf { + public int VERSION = 2; + public void setOffset(IStatus status, int index, int offset, int nullOffset); } public static interface IXpbBuilderIntf extends IDisposableIntf { + public int VERSION = 3; + public static int DPB = 1; public static int SPB_ATTACH = 2; public static int SPB_START = 3; public static int TPB = 4; public static int BATCH = 5; public static int BPB = 6; + public static int SPB_SEND = 7; + public static int SPB_RECEIVE = 8; + public static int SPB_RESPONSE = 9; public void clear(IStatus status); public void removeCurrent(IStatus status); @@ -725,6 +881,8 @@ public static interface IXpbBuilderIntf extends IDisposableIntf public static interface ITraceConnectionIntf extends IVersionedIntf { + public int VERSION = 2; + public static int KIND_DATABASE = 1; public static int KIND_SERVICE = 2; @@ -735,18 +893,23 @@ public static interface ITraceConnectionIntf extends IVersionedIntf public String getCharSet(); public String getRemoteProtocol(); public String getRemoteAddress(); + public String getRemoteHwAddress(); public int getRemoteProcessID(); public String getRemoteProcessName(); } public static interface ITraceDatabaseConnectionIntf extends ITraceConnectionIntf { + public int VERSION = 3; + public long getConnectionID(); public String getDatabaseName(); } public static interface ITraceTransactionIntf extends IVersionedIntf { + public int VERSION = 3; + public static int ISOLATION_CONSISTENCY = 1; public static int ISOLATION_CONCURRENCY = 2; public static int ISOLATION_READ_COMMITTED_RECVER = 3; @@ -758,10 +921,14 @@ public static interface ITraceTransactionIntf extends IVersionedIntf public int getWait(); public int getIsolation(); public com.sun.jna.Pointer getPerf(); + public long getInitialID(); + public long getPreviousID(); } public static interface ITraceParamsIntf extends IVersionedIntf { + public int VERSION = 3; + public int getCount(); public com.sun.jna.Pointer getParam(int idx); public String getTextUTF8(IStatus status, int idx); @@ -769,12 +936,16 @@ public static interface ITraceParamsIntf extends IVersionedIntf public static interface ITraceStatementIntf extends IVersionedIntf { + public int VERSION = 2; + public long getStmtID(); public com.sun.jna.Pointer getPerf(); } public static interface ITraceSQLStatementIntf extends ITraceStatementIntf { + public int VERSION = 3; + public String getText(); public String getPlan(); public ITraceParams getInputs(); @@ -784,6 +955,8 @@ public static interface ITraceSQLStatementIntf extends ITraceStatementIntf public static interface ITraceBLRStatementIntf extends ITraceStatementIntf { + public int VERSION = 3; + public com.sun.jna.Pointer getData(); public int getDataLength(); public String getText(); @@ -791,6 +964,8 @@ public static interface ITraceBLRStatementIntf extends ITraceStatementIntf public static interface ITraceDYNRequestIntf extends IVersionedIntf { + public int VERSION = 2; + public com.sun.jna.Pointer getData(); public int getDataLength(); public String getText(); @@ -798,6 +973,8 @@ public static interface ITraceDYNRequestIntf extends IVersionedIntf public static interface ITraceContextVariableIntf extends IVersionedIntf { + public int VERSION = 2; + public String getNameSpace(); public String getVarName(); public String getVarValue(); @@ -805,6 +982,8 @@ public static interface ITraceContextVariableIntf extends IVersionedIntf public static interface ITraceProcedureIntf extends IVersionedIntf { + public int VERSION = 2; + public String getProcName(); public ITraceParams getInputs(); public com.sun.jna.Pointer getPerf(); @@ -812,6 +991,8 @@ public static interface ITraceProcedureIntf extends IVersionedIntf public static interface ITraceFunctionIntf extends IVersionedIntf { + public int VERSION = 2; + public String getFuncName(); public ITraceParams getInputs(); public ITraceParams getResult(); @@ -820,6 +1001,8 @@ public static interface ITraceFunctionIntf extends IVersionedIntf public static interface ITraceTriggerIntf extends IVersionedIntf { + public int VERSION = 2; + public static int TYPE_ALL = 0; public static int TYPE_BEFORE = 1; public static int TYPE_AFTER = 2; @@ -833,6 +1016,8 @@ public static interface ITraceTriggerIntf extends IVersionedIntf public static interface ITraceServiceConnectionIntf extends ITraceConnectionIntf { + public int VERSION = 3; + public com.sun.jna.Pointer getServiceID(); public String getServiceMgr(); public String getServiceName(); @@ -840,6 +1025,8 @@ public static interface ITraceServiceConnectionIntf extends ITraceConnectionIntf public static interface ITraceStatusVectorIntf extends IVersionedIntf { + public int VERSION = 2; + public boolean hasError(); public boolean hasWarning(); public IStatus getStatus(); @@ -848,6 +1035,8 @@ public static interface ITraceStatusVectorIntf extends IVersionedIntf public static interface ITraceSweepInfoIntf extends IVersionedIntf { + public int VERSION = 2; + public long getOIT(); public long getOST(); public long getOAT(); @@ -857,23 +1046,31 @@ public static interface ITraceSweepInfoIntf extends IVersionedIntf public static interface ITraceLogWriterIntf extends IReferenceCountedIntf { + public int VERSION = 4; + public int write(com.sun.jna.Pointer buf, int size); public int write_s(IStatus status, com.sun.jna.Pointer buf, int size); } public static interface ITraceInitInfoIntf extends IVersionedIntf { + public int VERSION = 2; + public String getConfigText(); public int getTraceSessionID(); public String getTraceSessionName(); + public int getTraceSessionFlags(); public String getFirebirdRootDirectory(); public String getDatabaseName(); public ITraceDatabaseConnection getConnection(); + public ITraceServiceConnection getService(); public ITraceLogWriter getLogWriter(); } public static interface ITracePluginIntf extends IReferenceCountedIntf { + public int VERSION = 3; + public static int RESULT_SUCCESS = 0; public static int RESULT_FAILED = 1; public static int RESULT_UNAUTHORIZED = 2; @@ -883,7 +1080,7 @@ public static interface ITracePluginIntf extends IReferenceCountedIntf public static int SWEEP_STATE_PROGRESS = 4; public String trace_get_error(); - public boolean trace_attach(ITraceDatabaseConnection connection, boolean create_db, int att_result); + public boolean trace_attach(ITraceDatabaseConnection connection, boolean create_db, int dpb_length, byte[] dpb, int att_result); public boolean trace_detach(ITraceDatabaseConnection connection, boolean drop_db); public boolean trace_transaction_start(ITraceDatabaseConnection connection, ITraceTransaction transaction, int tpb_length, byte[] tpb, int tra_result); public boolean trace_transaction_end(ITraceDatabaseConnection connection, ITraceTransaction transaction, boolean commit, boolean retain_context, int tra_result); @@ -896,17 +1093,20 @@ public static interface ITracePluginIntf extends IReferenceCountedIntf public boolean trace_blr_compile(ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceBLRStatement statement, long time_millis, int req_result); public boolean trace_blr_execute(ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceBLRStatement statement, int req_result); public boolean trace_dyn_execute(ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceDYNRequest request, long time_millis, int req_result); - public boolean trace_service_attach(ITraceServiceConnection service, int att_result); + public boolean trace_service_attach(ITraceServiceConnection service, int spb_length, byte[] spb, int att_result); public boolean trace_service_start(ITraceServiceConnection service, int switches_length, String switches, int start_result); public boolean trace_service_query(ITraceServiceConnection service, int send_item_length, byte[] send_items, int recv_item_length, byte[] recv_items, int query_result); public boolean trace_service_detach(ITraceServiceConnection service, int detach_result); public boolean trace_event_error(ITraceConnection connection, ITraceStatusVector status, String function); public boolean trace_event_sweep(ITraceDatabaseConnection connection, ITraceSweepInfo sweep, int sweep_state); public boolean trace_func_execute(ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceFunction function, boolean started, int func_result); + public boolean trace_privilege_change(ITraceDatabaseConnection connection, ITraceTransaction transaction, String executor, String grantor, boolean is_grant, String object_name, String field_name, String user_name, String privileges, int options, int change_result); } public static interface ITraceFactoryIntf extends IPluginBaseIntf { + public int VERSION = 4; + public static int TRACE_EVENT_ATTACH = 0; public static int TRACE_EVENT_DETACH = 1; public static int TRACE_EVENT_TRANSACTION_START = 2; @@ -927,7 +1127,8 @@ public static interface ITraceFactoryIntf extends IPluginBaseIntf public static int TRACE_EVENT_ERROR = 17; public static int TRACE_EVENT_SWEEP = 18; public static int TRACE_EVENT_FUNC_EXECUTE = 19; - public static int TRACE_EVENT_MAX = 20; + public static int TRACE_EVENT_PRIVILEGE_CHANGE = 20; + public static int TRACE_EVENT_MAX = 21; public long trace_needs(); public ITracePlugin trace_create(IStatus status, ITraceInitInfo init_info); @@ -935,24 +1136,32 @@ public static interface ITraceFactoryIntf extends IPluginBaseIntf public static interface IUdrFunctionFactoryIntf extends IDisposableIntf { + public int VERSION = 3; + public void setup(IStatus status, IExternalContext context, IRoutineMetadata metadata, IMetadataBuilder inBuilder, IMetadataBuilder outBuilder); public IExternalFunction newItem(IStatus status, IExternalContext context, IRoutineMetadata metadata); } public static interface IUdrProcedureFactoryIntf extends IDisposableIntf { + public int VERSION = 3; + public void setup(IStatus status, IExternalContext context, IRoutineMetadata metadata, IMetadataBuilder inBuilder, IMetadataBuilder outBuilder); public IExternalProcedure newItem(IStatus status, IExternalContext context, IRoutineMetadata metadata); } public static interface IUdrTriggerFactoryIntf extends IDisposableIntf { + public int VERSION = 3; + public void setup(IStatus status, IExternalContext context, IRoutineMetadata metadata, IMetadataBuilder fieldsBuilder); public IExternalTrigger newItem(IStatus status, IExternalContext context, IRoutineMetadata metadata); } public static interface IUdrPluginIntf extends IVersionedIntf { + public int VERSION = 2; + public IMaster getMaster(); public void registerFunction(IStatus status, String name, IUdrFunctionFactory factory); public void registerProcedure(IStatus status, String name, IUdrProcedureFactory factory); @@ -961,6 +1170,8 @@ public static interface IUdrPluginIntf extends IVersionedIntf public static interface IDecFloat16Intf extends IVersionedIntf { + public int VERSION = 2; + public static int BCD_SIZE = 16; public static int STRING_SIZE = 24; @@ -972,6 +1183,8 @@ public static interface IDecFloat16Intf extends IVersionedIntf public static interface IDecFloat34Intf extends IVersionedIntf { + public int VERSION = 2; + public static int BCD_SIZE = 34; public static int STRING_SIZE = 43; @@ -983,6 +1196,8 @@ public static interface IDecFloat34Intf extends IVersionedIntf public static interface IInt128Intf extends IVersionedIntf { + public int VERSION = 2; + public static int STRING_SIZE = 46; public void toString(IStatus status, FB_I128[] from, int scale, int bufferLength, com.sun.jna.Pointer buffer); @@ -991,12 +1206,16 @@ public static interface IInt128Intf extends IVersionedIntf public static interface IReplicatedRecordIntf extends IVersionedIntf { + public int VERSION = 2; + public int getRawLength(); public com.sun.jna.Pointer getRawData(); } public static interface IReplicatedBlobIntf extends IVersionedIntf { + public int VERSION = 2; + public int getLength(); public boolean isEof(); public int getSegment(int length, byte[] buffer); @@ -1004,6 +1223,8 @@ public static interface IReplicatedBlobIntf extends IVersionedIntf public static interface IReplicatedTransactionIntf extends IDisposableIntf { + public int VERSION = 3; + public boolean prepare(); public boolean commit(); public boolean rollback(); @@ -1015,10 +1236,13 @@ public static interface IReplicatedTransactionIntf extends IDisposableIntf public boolean deleteRecord(String name, IReplicatedRecord record); public boolean storeBlob(com.sun.jna.ptr.LongByReference blobId, IReplicatedBlob blob); public boolean executeSql(String sql); + public boolean executeSqlIntl(int charset, String sql); } public static interface IReplicatedSessionIntf extends IDisposableIntf { + public int VERSION = 3; + public IStatus getStatus(); public IReplicatedTransaction startTransaction(long number); public boolean cleanupTransaction(long number); @@ -1030,7 +1254,7 @@ public static class IVersioned extends com.sun.jna.Structure implements IVersion public static class VTable extends com.sun.jna.Structure implements com.sun.jna.Structure.ByReference { public com.sun.jna.Pointer cloopDummy; - public com.sun.jna.Pointer version; + public int version; public VTable(com.sun.jna.Pointer pointer) { @@ -1052,6 +1276,15 @@ protected java.util.List getFieldOrder() fields.addAll(java.util.Arrays.asList("cloopDummy", "version")); return fields; } + + @Override + public void read() { + try { + super.read(); + } catch (java.lang.IllegalStateException e) { + // nothing to do, just skip it + } + } } public com.sun.jna.Pointer cloopDummy; @@ -1179,12 +1412,18 @@ protected VTable createVTable() public void addRef() { VTable vTable = getVTable(); + if (vTable.addRef == null) { + return; + } vTable.addRef.invoke(this); } public int release() { VTable vTable = getVTable(); + if (vTable.release == null) { + return 0; + } int result = vTable.release.invoke(this); return result; } @@ -1253,6 +1492,9 @@ protected VTable createVTable() public void dispose() { VTable vTable = getVTable(); + if (vTable.dispose == null) { + return; + } vTable.dispose.invoke(this); } } @@ -1432,12 +1674,18 @@ protected VTable createVTable() public void init() { VTable vTable = getVTable(); + if (vTable.init == null) { + return; + } vTable.init.invoke(this); } public int getState() { VTable vTable = getVTable(); + if (vTable.getState == null) { + return 0; + } int result = vTable.getState.invoke(this); return result; } @@ -1445,30 +1693,45 @@ public int getState() public void setErrors2(int length, com.sun.jna.Pointer[] value) { VTable vTable = getVTable(); + if (vTable.setErrors2 == null) { + return; + } vTable.setErrors2.invoke(this, length, value); } public void setWarnings2(int length, com.sun.jna.Pointer[] value) { VTable vTable = getVTable(); + if (vTable.setWarnings2 == null) { + return; + } vTable.setWarnings2.invoke(this, length, value); } public void setErrors(com.sun.jna.Pointer[] value) { VTable vTable = getVTable(); + if (vTable.setErrors == null) { + return; + } vTable.setErrors.invoke(this, value); } public void setWarnings(com.sun.jna.Pointer[] value) { VTable vTable = getVTable(); + if (vTable.setWarnings == null) { + return; + } vTable.setWarnings.invoke(this, value); } public com.sun.jna.Pointer getErrors() { VTable vTable = getVTable(); + if (vTable.getErrors == null) { + return null; + } com.sun.jna.Pointer result = vTable.getErrors.invoke(this); return result; } @@ -1476,6 +1739,9 @@ public com.sun.jna.Pointer getErrors() public com.sun.jna.Pointer getWarnings() { VTable vTable = getVTable(); + if (vTable.getWarnings == null) { + return null; + } com.sun.jna.Pointer result = vTable.getWarnings.invoke(this); return result; } @@ -1483,6 +1749,9 @@ public com.sun.jna.Pointer getWarnings() public IStatus clone() { VTable vTable = getVTable(); + if (vTable.clone == null) { + return null; + } IStatus result = vTable.clone.invoke(this); return result; } @@ -1713,6 +1982,9 @@ protected VTable createVTable() public IStatus getStatus() { VTable vTable = getVTable(); + if (vTable.getStatus == null) { + return null; + } IStatus result = vTable.getStatus.invoke(this); return result; } @@ -1720,6 +1992,9 @@ public IStatus getStatus() public IProvider getDispatcher() { VTable vTable = getVTable(); + if (vTable.getDispatcher == null) { + return null; + } IProvider result = vTable.getDispatcher.invoke(this); return result; } @@ -1727,6 +2002,9 @@ public IProvider getDispatcher() public IPluginManager getPluginManager() { VTable vTable = getVTable(); + if (vTable.getPluginManager == null) { + return null; + } IPluginManager result = vTable.getPluginManager.invoke(this); return result; } @@ -1734,6 +2012,9 @@ public IPluginManager getPluginManager() public ITimerControl getTimerControl() { VTable vTable = getVTable(); + if (vTable.getTimerControl == null) { + return null; + } ITimerControl result = vTable.getTimerControl.invoke(this); return result; } @@ -1741,6 +2022,9 @@ public ITimerControl getTimerControl() public IDtc getDtc() { VTable vTable = getVTable(); + if (vTable.getDtc == null) { + return null; + } IDtc result = vTable.getDtc.invoke(this); return result; } @@ -1748,6 +2032,9 @@ public IDtc getDtc() public IAttachment registerAttachment(IProvider provider, IAttachment attachment) { VTable vTable = getVTable(); + if (vTable.registerAttachment == null) { + return null; + } IAttachment result = vTable.registerAttachment.invoke(this, provider, attachment); return result; } @@ -1755,6 +2042,9 @@ public IAttachment registerAttachment(IProvider provider, IAttachment attachment public ITransaction registerTransaction(IAttachment attachment, ITransaction transaction) { VTable vTable = getVTable(); + if (vTable.registerTransaction == null) { + return null; + } ITransaction result = vTable.registerTransaction.invoke(this, attachment, transaction); return result; } @@ -1762,6 +2052,10 @@ public ITransaction registerTransaction(IAttachment attachment, ITransaction tra public IMetadataBuilder getMetadataBuilder(IStatus status, int fieldCount) { VTable vTable = getVTable(); + if (vTable.getMetadataBuilder == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IMasterIntf.VERSION); + return null; + } IMetadataBuilder result = vTable.getMetadataBuilder.invoke(this, status, fieldCount); return result; } @@ -1769,6 +2063,9 @@ public IMetadataBuilder getMetadataBuilder(IStatus status, int fieldCount) public int serverMode(int mode) { VTable vTable = getVTable(); + if (vTable.serverMode == null) { + return 0; + } int result = vTable.serverMode.invoke(this, mode); return result; } @@ -1776,6 +2073,9 @@ public int serverMode(int mode) public IUtil getUtilInterface() { VTable vTable = getVTable(); + if (vTable.getUtilInterface == null) { + return null; + } IUtil result = vTable.getUtilInterface.invoke(this); return result; } @@ -1783,6 +2083,9 @@ public IUtil getUtilInterface() public IConfigManager getConfigManager() { VTable vTable = getVTable(); + if (vTable.getConfigManager == null) { + return null; + } IConfigManager result = vTable.getConfigManager.invoke(this); return result; } @@ -1790,6 +2093,9 @@ public IConfigManager getConfigManager() public boolean getProcessExiting() { VTable vTable = getVTable(); + if (vTable.getProcessExiting == null) { + return false; + } boolean result = vTable.getProcessExiting.invoke(this); return result; } @@ -1872,12 +2178,18 @@ protected VTable createVTable() public void setOwner(IReferenceCounted r) { VTable vTable = getVTable(); + if (vTable.setOwner == null) { + return; + } vTable.setOwner.invoke(this, r); } public IReferenceCounted getOwner() { VTable vTable = getVTable(); + if (vTable.getOwner == null) { + return null; + } IReferenceCounted result = vTable.getOwner.invoke(this); return result; } @@ -2024,6 +2336,9 @@ protected VTable createVTable() public String getName() { VTable vTable = getVTable(); + if (vTable.getName == null) { + return null; + } String result = vTable.getName.invoke(this); return result; } @@ -2031,6 +2346,9 @@ public String getName() public String getModuleName() { VTable vTable = getVTable(); + if (vTable.getModuleName == null) { + return null; + } String result = vTable.getModuleName.invoke(this); return result; } @@ -2038,6 +2356,10 @@ public String getModuleName() public IPluginBase getPlugin(IStatus status) { VTable vTable = getVTable(); + if (vTable.getPlugin == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IPluginSetIntf.VERSION); + return null; + } IPluginBase result = vTable.getPlugin.invoke(this, status); return result; } @@ -2045,16 +2367,94 @@ public IPluginBase getPlugin(IStatus status) public void next(IStatus status) { VTable vTable = getVTable(); + if (vTable.next == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IPluginSetIntf.VERSION); + return; + } vTable.next.invoke(this, status); } public void set(IStatus status, String s) { VTable vTable = getVTable(); + if (vTable.set == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IPluginSetIntf.VERSION); + return; + } vTable.set.invoke(this, status, s); } } + public static class IListElementCallback extends IReferenceCounted implements IListElementCallbackIntf + { + public static class VTable extends IReferenceCounted.VTable + { + public static interface Callback_callback extends com.sun.jna.Callback + { + public void invoke(IListElementCallback self, String text); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IListElementCallbackIntf obj) + { + super(obj); + + callback = new Callback_callback() { + @Override + public void invoke(IListElementCallback self, String text) + { + obj.callback(text); + } + }; + } + + public VTable() + { + } + + public Callback_callback callback; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("callback")); + return fields; + } + } + + public IListElementCallback() + { + } + + public IListElementCallback(final IListElementCallbackIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public void callback(String text) + { + VTable vTable = getVTable(); + if (vTable.callback == null) { + return; + } + vTable.callback.invoke(this, text); + } + } + public static class IConfigEntry extends IReferenceCounted implements IConfigEntryIntf { public static class VTable extends IReferenceCounted.VTable @@ -2084,6 +2484,11 @@ public static interface Callback_getSubConfig extends com.sun.jna.Callback public IConfig invoke(IConfigEntry self, IStatus status); } + public static interface Callback_getList extends com.sun.jna.Callback + { + public void invoke(IConfigEntry self, IListElementCallback callback); + } + public VTable(com.sun.jna.Pointer pointer) { super(pointer); @@ -2140,6 +2545,14 @@ public IConfig invoke(IConfigEntry self, IStatus status) } } }; + + getList = new Callback_getList() { + @Override + public void invoke(IConfigEntry self, IListElementCallback callback) + { + obj.getList(callback); + } + }; } public VTable() @@ -2151,12 +2564,13 @@ public VTable() public Callback_getIntValue getIntValue; public Callback_getBoolValue getBoolValue; public Callback_getSubConfig getSubConfig; + public Callback_getList getList; @Override protected java.util.List getFieldOrder() { java.util.List fields = super.getFieldOrder(); - fields.addAll(java.util.Arrays.asList("getName", "getValue", "getIntValue", "getBoolValue", "getSubConfig")); + fields.addAll(java.util.Arrays.asList("getName", "getValue", "getIntValue", "getBoolValue", "getSubConfig", "getList")); return fields; } } @@ -2182,6 +2596,9 @@ protected VTable createVTable() public String getName() { VTable vTable = getVTable(); + if (vTable.getName == null) { + return null; + } String result = vTable.getName.invoke(this); return result; } @@ -2189,6 +2606,9 @@ public String getName() public String getValue() { VTable vTable = getVTable(); + if (vTable.getValue == null) { + return null; + } String result = vTable.getValue.invoke(this); return result; } @@ -2196,6 +2616,9 @@ public String getValue() public long getIntValue() { VTable vTable = getVTable(); + if (vTable.getIntValue == null) { + return 0; + } long result = vTable.getIntValue.invoke(this); return result; } @@ -2203,6 +2626,9 @@ public long getIntValue() public boolean getBoolValue() { VTable vTable = getVTable(); + if (vTable.getBoolValue == null) { + return false; + } boolean result = vTable.getBoolValue.invoke(this); return result; } @@ -2210,9 +2636,22 @@ public boolean getBoolValue() public IConfig getSubConfig(IStatus status) { VTable vTable = getVTable(); + if (vTable.getSubConfig == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IConfigEntryIntf.VERSION); + return null; + } IConfig result = vTable.getSubConfig.invoke(this, status); return result; } + + public void getList(IListElementCallback callback) + { + VTable vTable = getVTable(); + if (vTable.getList == null) { + return; + } + vTable.getList.invoke(this, callback); + } } public static class IConfig extends IReferenceCounted implements IConfigIntf @@ -2330,6 +2769,10 @@ protected VTable createVTable() public IConfigEntry find(IStatus status, String name) { VTable vTable = getVTable(); + if (vTable.find == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IConfigIntf.VERSION); + return null; + } IConfigEntry result = vTable.find.invoke(this, status, name); return result; } @@ -2337,6 +2780,10 @@ public IConfigEntry find(IStatus status, String name) public IConfigEntry findValue(IStatus status, String name, String value) { VTable vTable = getVTable(); + if (vTable.findValue == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IConfigIntf.VERSION); + return null; + } IConfigEntry result = vTable.findValue.invoke(this, status, name, value); return result; } @@ -2344,6 +2791,10 @@ public IConfigEntry findValue(IStatus status, String name, String value) public IConfigEntry findPos(IStatus status, String name, int pos) { VTable vTable = getVTable(); + if (vTable.findPos == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IConfigIntf.VERSION); + return null; + } IConfigEntry result = vTable.findPos.invoke(this, status, name, pos); return result; } @@ -2378,6 +2829,11 @@ public static interface Callback_getVersion extends com.sun.jna.Callback public int invoke(IFirebirdConf self, IStatus status); } + public static interface Callback_asList extends com.sun.jna.Callback + { + public void invoke(IFirebirdConf self, int key, IListElementCallback callback); + } + public VTable(com.sun.jna.Pointer pointer) { super(pointer); @@ -2434,6 +2890,14 @@ public int invoke(IFirebirdConf self, IStatus status) } } }; + + asList = new Callback_asList() { + @Override + public void invoke(IFirebirdConf self, int key, IListElementCallback callback) + { + obj.asList(key, callback); + } + }; } public VTable() @@ -2445,12 +2909,13 @@ public VTable() public Callback_asString asString; public Callback_asBoolean asBoolean; public Callback_getVersion getVersion; + public Callback_asList asList; @Override protected java.util.List getFieldOrder() { java.util.List fields = super.getFieldOrder(); - fields.addAll(java.util.Arrays.asList("getKey", "asInteger", "asString", "asBoolean", "getVersion")); + fields.addAll(java.util.Arrays.asList("getKey", "asInteger", "asString", "asBoolean", "getVersion", "asList")); return fields; } } @@ -2476,6 +2941,9 @@ protected VTable createVTable() public int getKey(String name) { VTable vTable = getVTable(); + if (vTable.getKey == null) { + return 0; + } int result = vTable.getKey.invoke(this, name); return result; } @@ -2483,6 +2951,9 @@ public int getKey(String name) public long asInteger(int key) { VTable vTable = getVTable(); + if (vTable.asInteger == null) { + return 0; + } long result = vTable.asInteger.invoke(this, key); return result; } @@ -2490,6 +2961,9 @@ public long asInteger(int key) public String asString(int key) { VTable vTable = getVTable(); + if (vTable.asString == null) { + return null; + } String result = vTable.asString.invoke(this, key); return result; } @@ -2497,6 +2971,9 @@ public String asString(int key) public boolean asBoolean(int key) { VTable vTable = getVTable(); + if (vTable.asBoolean == null) { + return false; + } boolean result = vTable.asBoolean.invoke(this, key); return result; } @@ -2504,9 +2981,22 @@ public boolean asBoolean(int key) public int getVersion(IStatus status) { VTable vTable = getVTable(); + if (vTable.getVersion == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IFirebirdConfIntf.VERSION); + return 0; + } int result = vTable.getVersion.invoke(this, status); return result; } + + public void asList(int key, IListElementCallback callback) + { + VTable vTable = getVTable(); + if (vTable.asList == null) { + return; + } + vTable.asList.invoke(this, key, callback); + } } public static class IPluginConfig extends IReferenceCounted implements IPluginConfigIntf @@ -2637,6 +3127,9 @@ protected VTable createVTable() public String getConfigFileName() { VTable vTable = getVTable(); + if (vTable.getConfigFileName == null) { + return null; + } String result = vTable.getConfigFileName.invoke(this); return result; } @@ -2644,6 +3137,10 @@ public String getConfigFileName() public IConfig getDefaultConfig(IStatus status) { VTable vTable = getVTable(); + if (vTable.getDefaultConfig == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IPluginConfigIntf.VERSION); + return null; + } IConfig result = vTable.getDefaultConfig.invoke(this, status); return result; } @@ -2651,6 +3148,10 @@ public IConfig getDefaultConfig(IStatus status) public IFirebirdConf getFirebirdConf(IStatus status) { VTable vTable = getVTable(); + if (vTable.getFirebirdConf == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IPluginConfigIntf.VERSION); + return null; + } IFirebirdConf result = vTable.getFirebirdConf.invoke(this, status); return result; } @@ -2658,6 +3159,10 @@ public IFirebirdConf getFirebirdConf(IStatus status) public void setReleaseDelay(IStatus status, long microSeconds) { VTable vTable = getVTable(); + if (vTable.setReleaseDelay == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IPluginConfigIntf.VERSION); + return; + } vTable.setReleaseDelay.invoke(this, status, microSeconds); } } @@ -2733,6 +3238,10 @@ protected VTable createVTable() public IPluginBase createPlugin(IStatus status, IPluginConfig factoryParameter) { VTable vTable = getVTable(); + if (vTable.createPlugin == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IPluginFactoryIntf.VERSION); + return null; + } IPluginBase result = vTable.createPlugin.invoke(this, status, factoryParameter); return result; } @@ -2815,12 +3324,18 @@ protected VTable createVTable() public void doClean() { VTable vTable = getVTable(); + if (vTable.doClean == null) { + return; + } vTable.doClean.invoke(this); } public void threadDetach() { VTable vTable = getVTable(); + if (vTable.threadDetach == null) { + return; + } vTable.threadDetach.invoke(this); } } @@ -2974,24 +3489,37 @@ protected VTable createVTable() public void registerPluginFactory(int pluginType, String defaultName, IPluginFactory factory) { VTable vTable = getVTable(); + if (vTable.registerPluginFactory == null) { + return; + } vTable.registerPluginFactory.invoke(this, pluginType, defaultName, factory); } public void registerModule(IPluginModule cleanup) { VTable vTable = getVTable(); + if (vTable.registerModule == null) { + return; + } vTable.registerModule.invoke(this, cleanup); } public void unregisterModule(IPluginModule cleanup) { VTable vTable = getVTable(); + if (vTable.unregisterModule == null) { + return; + } vTable.unregisterModule.invoke(this, cleanup); } public IPluginSet getPlugins(IStatus status, int pluginType, String namesList, IFirebirdConf firebirdConf) { VTable vTable = getVTable(); + if (vTable.getPlugins == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IPluginManagerIntf.VERSION); + return null; + } IPluginSet result = vTable.getPlugins.invoke(this, status, pluginType, namesList, firebirdConf); return result; } @@ -2999,6 +3527,10 @@ public IPluginSet getPlugins(IStatus status, int pluginType, String namesList, I public IConfig getConfig(IStatus status, String filename) { VTable vTable = getVTable(); + if (vTable.getConfig == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IPluginManagerIntf.VERSION); + return null; + } IConfig result = vTable.getConfig.invoke(this, status, filename); return result; } @@ -3006,6 +3538,9 @@ public IConfig getConfig(IStatus status, String filename) public void releasePlugin(IPluginBase plugin) { VTable vTable = getVTable(); + if (vTable.releasePlugin == null) { + return; + } vTable.releasePlugin.invoke(this, plugin); } } @@ -3129,18 +3664,29 @@ protected VTable createVTable() public void setSymmetric(IStatus status, String type, int keyLength, com.sun.jna.Pointer key) { VTable vTable = getVTable(); + if (vTable.setSymmetric == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, ICryptKeyIntf.VERSION); + return; + } vTable.setSymmetric.invoke(this, status, type, keyLength, key); } public void setAsymmetric(IStatus status, String type, int encryptKeyLength, com.sun.jna.Pointer encryptKey, int decryptKeyLength, com.sun.jna.Pointer decryptKey) { VTable vTable = getVTable(); + if (vTable.setAsymmetric == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, ICryptKeyIntf.VERSION); + return; + } vTable.setAsymmetric.invoke(this, status, type, encryptKeyLength, encryptKey, decryptKeyLength, decryptKey); } public com.sun.jna.Pointer getEncryptKey(com.sun.jna.Pointer length) { VTable vTable = getVTable(); + if (vTable.getEncryptKey == null) { + return null; + } com.sun.jna.Pointer result = vTable.getEncryptKey.invoke(this, length); return result; } @@ -3148,6 +3694,9 @@ public com.sun.jna.Pointer getEncryptKey(com.sun.jna.Pointer length) public com.sun.jna.Pointer getDecryptKey(com.sun.jna.Pointer length) { VTable vTable = getVTable(); + if (vTable.getDecryptKey == null) { + return null; + } com.sun.jna.Pointer result = vTable.getDecryptKey.invoke(this, length); return result; } @@ -3187,6 +3736,11 @@ public static interface Callback_getRootDirectory extends com.sun.jna.Callback public String invoke(IConfigManager self); } + public static interface Callback_getDefaultSecurityDb extends com.sun.jna.Callback + { + public String invoke(IConfigManager self); + } + public VTable(com.sun.jna.Pointer pointer) { super(pointer); @@ -3243,6 +3797,14 @@ public String invoke(IConfigManager self) return obj.getRootDirectory(); } }; + + getDefaultSecurityDb = new Callback_getDefaultSecurityDb() { + @Override + public String invoke(IConfigManager self) + { + return obj.getDefaultSecurityDb(); + } + }; } public VTable() @@ -3255,12 +3817,13 @@ public VTable() public Callback_getPluginConfig getPluginConfig; public Callback_getInstallDirectory getInstallDirectory; public Callback_getRootDirectory getRootDirectory; + public Callback_getDefaultSecurityDb getDefaultSecurityDb; @Override protected java.util.List getFieldOrder() { java.util.List fields = super.getFieldOrder(); - fields.addAll(java.util.Arrays.asList("getDirectory", "getFirebirdConf", "getDatabaseConf", "getPluginConfig", "getInstallDirectory", "getRootDirectory")); + fields.addAll(java.util.Arrays.asList("getDirectory", "getFirebirdConf", "getDatabaseConf", "getPluginConfig", "getInstallDirectory", "getRootDirectory", "getDefaultSecurityDb")); return fields; } } @@ -3286,6 +3849,9 @@ protected VTable createVTable() public String getDirectory(int code) { VTable vTable = getVTable(); + if (vTable.getDirectory == null) { + return null; + } String result = vTable.getDirectory.invoke(this, code); return result; } @@ -3293,6 +3859,9 @@ public String getDirectory(int code) public IFirebirdConf getFirebirdConf() { VTable vTable = getVTable(); + if (vTable.getFirebirdConf == null) { + return null; + } IFirebirdConf result = vTable.getFirebirdConf.invoke(this); return result; } @@ -3300,6 +3869,9 @@ public IFirebirdConf getFirebirdConf() public IFirebirdConf getDatabaseConf(String dbName) { VTable vTable = getVTable(); + if (vTable.getDatabaseConf == null) { + return null; + } IFirebirdConf result = vTable.getDatabaseConf.invoke(this, dbName); return result; } @@ -3307,6 +3879,9 @@ public IFirebirdConf getDatabaseConf(String dbName) public IConfig getPluginConfig(String configuredPlugin) { VTable vTable = getVTable(); + if (vTable.getPluginConfig == null) { + return null; + } IConfig result = vTable.getPluginConfig.invoke(this, configuredPlugin); return result; } @@ -3314,6 +3889,9 @@ public IConfig getPluginConfig(String configuredPlugin) public String getInstallDirectory() { VTable vTable = getVTable(); + if (vTable.getInstallDirectory == null) { + return null; + } String result = vTable.getInstallDirectory.invoke(this); return result; } @@ -3321,9 +3899,22 @@ public String getInstallDirectory() public String getRootDirectory() { VTable vTable = getVTable(); + if (vTable.getRootDirectory == null) { + return null; + } String result = vTable.getRootDirectory.invoke(this); return result; } + + public String getDefaultSecurityDb() + { + VTable vTable = getVTable(); + if (vTable.getDefaultSecurityDb == null) { + return null; + } + String result = vTable.getDefaultSecurityDb.invoke(this); + return result; + } } public static class IEventCallback extends IReferenceCounted implements IEventCallbackIntf @@ -3389,6 +3980,9 @@ protected VTable createVTable() public void eventCallbackFunction(int length, com.sun.jna.Pointer events) { VTable vTable = getVTable(); + if (vTable.eventCallbackFunction == null) { + return; + } vTable.eventCallbackFunction.invoke(this, length, events); } } @@ -3570,12 +4164,20 @@ protected VTable createVTable() public void getInfo(IStatus status, int itemsLength, byte[] items, int bufferLength, byte[] buffer) { VTable vTable = getVTable(); + if (vTable.getInfo == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IBlobIntf.VERSION); + return; + } vTable.getInfo.invoke(this, status, itemsLength, items, bufferLength, buffer); } public int getSegment(IStatus status, int bufferLength, com.sun.jna.Pointer buffer, com.sun.jna.Pointer segmentLength) { VTable vTable = getVTable(); + if (vTable.getSegment == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IBlobIntf.VERSION); + return 0; + } int result = vTable.getSegment.invoke(this, status, bufferLength, buffer, segmentLength); return result; } @@ -3583,24 +4185,40 @@ public int getSegment(IStatus status, int bufferLength, com.sun.jna.Pointer buff public void putSegment(IStatus status, int length, com.sun.jna.Pointer buffer) { VTable vTable = getVTable(); + if (vTable.putSegment == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IBlobIntf.VERSION); + return; + } vTable.putSegment.invoke(this, status, length, buffer); } public void cancel(IStatus status) { VTable vTable = getVTable(); + if (vTable.cancel == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IBlobIntf.VERSION); + return; + } vTable.cancel.invoke(this, status); } public void close(IStatus status) { VTable vTable = getVTable(); + if (vTable.close == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IBlobIntf.VERSION); + return; + } vTable.close.invoke(this, status); } public int seek(IStatus status, int mode, int offset) { VTable vTable = getVTable(); + if (vTable.seek == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IBlobIntf.VERSION); + return 0; + } int result = vTable.seek.invoke(this, status, mode, offset); return result; } @@ -3868,48 +4486,80 @@ protected VTable createVTable() public void getInfo(IStatus status, int itemsLength, byte[] items, int bufferLength, byte[] buffer) { VTable vTable = getVTable(); + if (vTable.getInfo == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, ITransactionIntf.VERSION); + return; + } vTable.getInfo.invoke(this, status, itemsLength, items, bufferLength, buffer); } public void prepare(IStatus status, int msgLength, byte[] message) { VTable vTable = getVTable(); + if (vTable.prepare == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, ITransactionIntf.VERSION); + return; + } vTable.prepare.invoke(this, status, msgLength, message); } public void commit(IStatus status) { VTable vTable = getVTable(); + if (vTable.commit == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, ITransactionIntf.VERSION); + return; + } vTable.commit.invoke(this, status); } public void commitRetaining(IStatus status) { VTable vTable = getVTable(); + if (vTable.commitRetaining == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, ITransactionIntf.VERSION); + return; + } vTable.commitRetaining.invoke(this, status); } public void rollback(IStatus status) { VTable vTable = getVTable(); + if (vTable.rollback == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, ITransactionIntf.VERSION); + return; + } vTable.rollback.invoke(this, status); } public void rollbackRetaining(IStatus status) { VTable vTable = getVTable(); + if (vTable.rollbackRetaining == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, ITransactionIntf.VERSION); + return; + } vTable.rollbackRetaining.invoke(this, status); } public void disconnect(IStatus status) { VTable vTable = getVTable(); + if (vTable.disconnect == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, ITransactionIntf.VERSION); + return; + } vTable.disconnect.invoke(this, status); } public ITransaction join(IStatus status, ITransaction transaction) { VTable vTable = getVTable(); + if (vTable.join == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, ITransactionIntf.VERSION); + return null; + } ITransaction result = vTable.join.invoke(this, status, transaction); return result; } @@ -3917,6 +4567,10 @@ public ITransaction join(IStatus status, ITransaction transaction) public ITransaction validate(IStatus status, IAttachment attachment) { VTable vTable = getVTable(); + if (vTable.validate == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, ITransactionIntf.VERSION); + return null; + } ITransaction result = vTable.validate.invoke(this, status, attachment); return result; } @@ -3924,6 +4578,10 @@ public ITransaction validate(IStatus status, IAttachment attachment) public ITransaction enterDtc(IStatus status) { VTable vTable = getVTable(); + if (vTable.enterDtc == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, ITransactionIntf.VERSION); + return null; + } ITransaction result = vTable.enterDtc.invoke(this, status); return result; } @@ -4352,6 +5010,10 @@ protected VTable createVTable() public int getCount(IStatus status) { VTable vTable = getVTable(); + if (vTable.getCount == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IMessageMetadataIntf.VERSION); + return 0; + } int result = vTable.getCount.invoke(this, status); return result; } @@ -4359,6 +5021,10 @@ public int getCount(IStatus status) public String getField(IStatus status, int index) { VTable vTable = getVTable(); + if (vTable.getField == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IMessageMetadataIntf.VERSION); + return null; + } String result = vTable.getField.invoke(this, status, index); return result; } @@ -4366,6 +5032,10 @@ public String getField(IStatus status, int index) public String getRelation(IStatus status, int index) { VTable vTable = getVTable(); + if (vTable.getRelation == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IMessageMetadataIntf.VERSION); + return null; + } String result = vTable.getRelation.invoke(this, status, index); return result; } @@ -4373,6 +5043,10 @@ public String getRelation(IStatus status, int index) public String getOwner(IStatus status, int index) { VTable vTable = getVTable(); + if (vTable.getOwner == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IMessageMetadataIntf.VERSION); + return null; + } String result = vTable.getOwner.invoke(this, status, index); return result; } @@ -4380,6 +5054,10 @@ public String getOwner(IStatus status, int index) public String getAlias(IStatus status, int index) { VTable vTable = getVTable(); + if (vTable.getAlias == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IMessageMetadataIntf.VERSION); + return null; + } String result = vTable.getAlias.invoke(this, status, index); return result; } @@ -4387,6 +5065,10 @@ public String getAlias(IStatus status, int index) public int getType(IStatus status, int index) { VTable vTable = getVTable(); + if (vTable.getType == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IMessageMetadataIntf.VERSION); + return 0; + } int result = vTable.getType.invoke(this, status, index); return result; } @@ -4394,6 +5076,10 @@ public int getType(IStatus status, int index) public boolean isNullable(IStatus status, int index) { VTable vTable = getVTable(); + if (vTable.isNullable == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IMessageMetadataIntf.VERSION); + return false; + } boolean result = vTable.isNullable.invoke(this, status, index); return result; } @@ -4401,6 +5087,10 @@ public boolean isNullable(IStatus status, int index) public int getSubType(IStatus status, int index) { VTable vTable = getVTable(); + if (vTable.getSubType == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IMessageMetadataIntf.VERSION); + return 0; + } int result = vTable.getSubType.invoke(this, status, index); return result; } @@ -4408,6 +5098,10 @@ public int getSubType(IStatus status, int index) public int getLength(IStatus status, int index) { VTable vTable = getVTable(); + if (vTable.getLength == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IMessageMetadataIntf.VERSION); + return 0; + } int result = vTable.getLength.invoke(this, status, index); return result; } @@ -4415,6 +5109,10 @@ public int getLength(IStatus status, int index) public int getScale(IStatus status, int index) { VTable vTable = getVTable(); + if (vTable.getScale == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IMessageMetadataIntf.VERSION); + return 0; + } int result = vTable.getScale.invoke(this, status, index); return result; } @@ -4422,6 +5120,10 @@ public int getScale(IStatus status, int index) public int getCharSet(IStatus status, int index) { VTable vTable = getVTable(); + if (vTable.getCharSet == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IMessageMetadataIntf.VERSION); + return 0; + } int result = vTable.getCharSet.invoke(this, status, index); return result; } @@ -4429,6 +5131,10 @@ public int getCharSet(IStatus status, int index) public int getOffset(IStatus status, int index) { VTable vTable = getVTable(); + if (vTable.getOffset == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IMessageMetadataIntf.VERSION); + return 0; + } int result = vTable.getOffset.invoke(this, status, index); return result; } @@ -4436,6 +5142,10 @@ public int getOffset(IStatus status, int index) public int getNullOffset(IStatus status, int index) { VTable vTable = getVTable(); + if (vTable.getNullOffset == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IMessageMetadataIntf.VERSION); + return 0; + } int result = vTable.getNullOffset.invoke(this, status, index); return result; } @@ -4443,6 +5153,10 @@ public int getNullOffset(IStatus status, int index) public IMetadataBuilder getBuilder(IStatus status) { VTable vTable = getVTable(); + if (vTable.getBuilder == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IMessageMetadataIntf.VERSION); + return null; + } IMetadataBuilder result = vTable.getBuilder.invoke(this, status); return result; } @@ -4450,6 +5164,10 @@ public IMetadataBuilder getBuilder(IStatus status) public int getMessageLength(IStatus status) { VTable vTable = getVTable(); + if (vTable.getMessageLength == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IMessageMetadataIntf.VERSION); + return 0; + } int result = vTable.getMessageLength.invoke(this, status); return result; } @@ -4457,6 +5175,10 @@ public int getMessageLength(IStatus status) public int getAlignment(IStatus status) { VTable vTable = getVTable(); + if (vTable.getAlignment == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IMessageMetadataIntf.VERSION); + return 0; + } int result = vTable.getAlignment.invoke(this, status); return result; } @@ -4464,6 +5186,10 @@ public int getAlignment(IStatus status) public int getAlignedLength(IStatus status) { VTable vTable = getVTable(); + if (vTable.getAlignedLength == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IMessageMetadataIntf.VERSION); + return 0; + } int result = vTable.getAlignedLength.invoke(this, status); return result; } @@ -4523,6 +5249,26 @@ public static interface Callback_getMetadata extends com.sun.jna.Callback public IMessageMetadata invoke(IMetadataBuilder self, IStatus status); } + public static interface Callback_setField extends com.sun.jna.Callback + { + public void invoke(IMetadataBuilder self, IStatus status, int index, String field); + } + + public static interface Callback_setRelation extends com.sun.jna.Callback + { + public void invoke(IMetadataBuilder self, IStatus status, int index, String relation); + } + + public static interface Callback_setOwner extends com.sun.jna.Callback + { + public void invoke(IMetadataBuilder self, IStatus status, int index, String owner); + } + + public static interface Callback_setAlias extends com.sun.jna.Callback + { + public void invoke(IMetadataBuilder self, IStatus status, int index, String alias); + } + public VTable(com.sun.jna.Pointer pointer) { super(pointer); @@ -4683,6 +5429,66 @@ public IMessageMetadata invoke(IMetadataBuilder self, IStatus status) } } }; + + setField = new Callback_setField() { + @Override + public void invoke(IMetadataBuilder self, IStatus status, int index, String field) + { + try + { + obj.setField(status, index, field); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + setRelation = new Callback_setRelation() { + @Override + public void invoke(IMetadataBuilder self, IStatus status, int index, String relation) + { + try + { + obj.setRelation(status, index, relation); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + setOwner = new Callback_setOwner() { + @Override + public void invoke(IMetadataBuilder self, IStatus status, int index, String owner) + { + try + { + obj.setOwner(status, index, owner); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + setAlias = new Callback_setAlias() { + @Override + public void invoke(IMetadataBuilder self, IStatus status, int index, String alias) + { + try + { + obj.setAlias(status, index, alias); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; } public VTable() @@ -4699,12 +5505,16 @@ public VTable() public Callback_remove remove; public Callback_addField addField; public Callback_getMetadata getMetadata; + public Callback_setField setField; + public Callback_setRelation setRelation; + public Callback_setOwner setOwner; + public Callback_setAlias setAlias; @Override protected java.util.List getFieldOrder() { java.util.List fields = super.getFieldOrder(); - fields.addAll(java.util.Arrays.asList("setType", "setSubType", "setLength", "setCharSet", "setScale", "truncate", "moveNameToIndex", "remove", "addField", "getMetadata")); + fields.addAll(java.util.Arrays.asList("setType", "setSubType", "setLength", "setCharSet", "setScale", "truncate", "moveNameToIndex", "remove", "addField", "getMetadata", "setField", "setRelation", "setOwner", "setAlias")); return fields; } } @@ -4730,54 +5540,90 @@ protected VTable createVTable() public void setType(IStatus status, int index, int type) { VTable vTable = getVTable(); + if (vTable.setType == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IMetadataBuilderIntf.VERSION); + return; + } vTable.setType.invoke(this, status, index, type); } public void setSubType(IStatus status, int index, int subType) { VTable vTable = getVTable(); + if (vTable.setSubType == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IMetadataBuilderIntf.VERSION); + return; + } vTable.setSubType.invoke(this, status, index, subType); } public void setLength(IStatus status, int index, int length) { VTable vTable = getVTable(); + if (vTable.setLength == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IMetadataBuilderIntf.VERSION); + return; + } vTable.setLength.invoke(this, status, index, length); } public void setCharSet(IStatus status, int index, int charSet) { VTable vTable = getVTable(); + if (vTable.setCharSet == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IMetadataBuilderIntf.VERSION); + return; + } vTable.setCharSet.invoke(this, status, index, charSet); } public void setScale(IStatus status, int index, int scale) { VTable vTable = getVTable(); + if (vTable.setScale == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IMetadataBuilderIntf.VERSION); + return; + } vTable.setScale.invoke(this, status, index, scale); } public void truncate(IStatus status, int count) { VTable vTable = getVTable(); + if (vTable.truncate == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IMetadataBuilderIntf.VERSION); + return; + } vTable.truncate.invoke(this, status, count); } public void moveNameToIndex(IStatus status, String name, int index) { VTable vTable = getVTable(); + if (vTable.moveNameToIndex == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IMetadataBuilderIntf.VERSION); + return; + } vTable.moveNameToIndex.invoke(this, status, name, index); } public void remove(IStatus status, int index) { VTable vTable = getVTable(); + if (vTable.remove == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IMetadataBuilderIntf.VERSION); + return; + } vTable.remove.invoke(this, status, index); } public int addField(IStatus status) { VTable vTable = getVTable(); + if (vTable.addField == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IMetadataBuilderIntf.VERSION); + return 0; + } int result = vTable.addField.invoke(this, status); return result; } @@ -4785,9 +5631,53 @@ public int addField(IStatus status) public IMessageMetadata getMetadata(IStatus status) { VTable vTable = getVTable(); + if (vTable.getMetadata == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IMetadataBuilderIntf.VERSION); + return null; + } IMessageMetadata result = vTable.getMetadata.invoke(this, status); return result; } + + public void setField(IStatus status, int index, String field) + { + VTable vTable = getVTable(); + if (vTable.setField == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IMetadataBuilderIntf.VERSION); + return; + } + vTable.setField.invoke(this, status, index, field); + } + + public void setRelation(IStatus status, int index, String relation) + { + VTable vTable = getVTable(); + if (vTable.setRelation == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IMetadataBuilderIntf.VERSION); + return; + } + vTable.setRelation.invoke(this, status, index, relation); + } + + public void setOwner(IStatus status, int index, String owner) + { + VTable vTable = getVTable(); + if (vTable.setOwner == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IMetadataBuilderIntf.VERSION); + return; + } + vTable.setOwner.invoke(this, status, index, owner); + } + + public void setAlias(IStatus status, int index, String alias) + { + VTable vTable = getVTable(); + if (vTable.setAlias == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IMetadataBuilderIntf.VERSION); + return; + } + vTable.setAlias.invoke(this, status, index, alias); + } } public static class IResultSet extends IReferenceCounted implements IResultSetIntf @@ -5079,6 +5969,10 @@ protected VTable createVTable() public int fetchNext(IStatus status, com.sun.jna.Pointer message) { VTable vTable = getVTable(); + if (vTable.fetchNext == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IResultSetIntf.VERSION); + return 0; + } int result = vTable.fetchNext.invoke(this, status, message); return result; } @@ -5086,6 +5980,10 @@ public int fetchNext(IStatus status, com.sun.jna.Pointer message) public int fetchPrior(IStatus status, com.sun.jna.Pointer message) { VTable vTable = getVTable(); + if (vTable.fetchPrior == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IResultSetIntf.VERSION); + return 0; + } int result = vTable.fetchPrior.invoke(this, status, message); return result; } @@ -5093,6 +5991,10 @@ public int fetchPrior(IStatus status, com.sun.jna.Pointer message) public int fetchFirst(IStatus status, com.sun.jna.Pointer message) { VTable vTable = getVTable(); + if (vTable.fetchFirst == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IResultSetIntf.VERSION); + return 0; + } int result = vTable.fetchFirst.invoke(this, status, message); return result; } @@ -5100,6 +6002,10 @@ public int fetchFirst(IStatus status, com.sun.jna.Pointer message) public int fetchLast(IStatus status, com.sun.jna.Pointer message) { VTable vTable = getVTable(); + if (vTable.fetchLast == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IResultSetIntf.VERSION); + return 0; + } int result = vTable.fetchLast.invoke(this, status, message); return result; } @@ -5107,6 +6013,10 @@ public int fetchLast(IStatus status, com.sun.jna.Pointer message) public int fetchAbsolute(IStatus status, int position, com.sun.jna.Pointer message) { VTable vTable = getVTable(); + if (vTable.fetchAbsolute == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IResultSetIntf.VERSION); + return 0; + } int result = vTable.fetchAbsolute.invoke(this, status, position, message); return result; } @@ -5114,6 +6024,10 @@ public int fetchAbsolute(IStatus status, int position, com.sun.jna.Pointer messa public int fetchRelative(IStatus status, int offset, com.sun.jna.Pointer message) { VTable vTable = getVTable(); + if (vTable.fetchRelative == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IResultSetIntf.VERSION); + return 0; + } int result = vTable.fetchRelative.invoke(this, status, offset, message); return result; } @@ -5121,6 +6035,10 @@ public int fetchRelative(IStatus status, int offset, com.sun.jna.Pointer message public boolean isEof(IStatus status) { VTable vTable = getVTable(); + if (vTable.isEof == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IResultSetIntf.VERSION); + return false; + } boolean result = vTable.isEof.invoke(this, status); return result; } @@ -5128,6 +6046,10 @@ public boolean isEof(IStatus status) public boolean isBof(IStatus status) { VTable vTable = getVTable(); + if (vTable.isBof == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IResultSetIntf.VERSION); + return false; + } boolean result = vTable.isBof.invoke(this, status); return result; } @@ -5135,6 +6057,10 @@ public boolean isBof(IStatus status) public IMessageMetadata getMetadata(IStatus status) { VTable vTable = getVTable(); + if (vTable.getMetadata == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IResultSetIntf.VERSION); + return null; + } IMessageMetadata result = vTable.getMetadata.invoke(this, status); return result; } @@ -5142,12 +6068,20 @@ public IMessageMetadata getMetadata(IStatus status) public void close(IStatus status) { VTable vTable = getVTable(); + if (vTable.close == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IResultSetIntf.VERSION); + return; + } vTable.close.invoke(this, status); } public void setDelayedOutputFormat(IStatus status, IMessageMetadata format) { VTable vTable = getVTable(); + if (vTable.setDelayedOutputFormat == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IResultSetIntf.VERSION); + return; + } vTable.setDelayedOutputFormat.invoke(this, status, format); } } @@ -5505,12 +6439,20 @@ protected VTable createVTable() public void getInfo(IStatus status, int itemsLength, byte[] items, int bufferLength, byte[] buffer) { VTable vTable = getVTable(); + if (vTable.getInfo == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IStatementIntf.VERSION); + return; + } vTable.getInfo.invoke(this, status, itemsLength, items, bufferLength, buffer); } public int getType(IStatus status) { VTable vTable = getVTable(); + if (vTable.getType == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IStatementIntf.VERSION); + return 0; + } int result = vTable.getType.invoke(this, status); return result; } @@ -5518,6 +6460,10 @@ public int getType(IStatus status) public String getPlan(IStatus status, boolean detailed) { VTable vTable = getVTable(); + if (vTable.getPlan == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IStatementIntf.VERSION); + return null; + } String result = vTable.getPlan.invoke(this, status, detailed); return result; } @@ -5525,6 +6471,10 @@ public String getPlan(IStatus status, boolean detailed) public long getAffectedRecords(IStatus status) { VTable vTable = getVTable(); + if (vTable.getAffectedRecords == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IStatementIntf.VERSION); + return 0; + } long result = vTable.getAffectedRecords.invoke(this, status); return result; } @@ -5532,6 +6482,10 @@ public long getAffectedRecords(IStatus status) public IMessageMetadata getInputMetadata(IStatus status) { VTable vTable = getVTable(); + if (vTable.getInputMetadata == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IStatementIntf.VERSION); + return null; + } IMessageMetadata result = vTable.getInputMetadata.invoke(this, status); return result; } @@ -5539,6 +6493,10 @@ public IMessageMetadata getInputMetadata(IStatus status) public IMessageMetadata getOutputMetadata(IStatus status) { VTable vTable = getVTable(); + if (vTable.getOutputMetadata == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IStatementIntf.VERSION); + return null; + } IMessageMetadata result = vTable.getOutputMetadata.invoke(this, status); return result; } @@ -5546,6 +6504,10 @@ public IMessageMetadata getOutputMetadata(IStatus status) public ITransaction execute(IStatus status, ITransaction transaction, IMessageMetadata inMetadata, com.sun.jna.Pointer inBuffer, IMessageMetadata outMetadata, com.sun.jna.Pointer outBuffer) { VTable vTable = getVTable(); + if (vTable.execute == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IStatementIntf.VERSION); + return null; + } ITransaction result = vTable.execute.invoke(this, status, transaction, inMetadata, inBuffer, outMetadata, outBuffer); return result; } @@ -5553,6 +6515,10 @@ public ITransaction execute(IStatus status, ITransaction transaction, IMessageMe public IResultSet openCursor(IStatus status, ITransaction transaction, IMessageMetadata inMetadata, com.sun.jna.Pointer inBuffer, IMessageMetadata outMetadata, int flags) { VTable vTable = getVTable(); + if (vTable.openCursor == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IStatementIntf.VERSION); + return null; + } IResultSet result = vTable.openCursor.invoke(this, status, transaction, inMetadata, inBuffer, outMetadata, flags); return result; } @@ -5560,18 +6526,30 @@ public IResultSet openCursor(IStatus status, ITransaction transaction, IMessageM public void setCursorName(IStatus status, String name) { VTable vTable = getVTable(); + if (vTable.setCursorName == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IStatementIntf.VERSION); + return; + } vTable.setCursorName.invoke(this, status, name); } public void free(IStatus status) { VTable vTable = getVTable(); + if (vTable.free == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IStatementIntf.VERSION); + return; + } vTable.free.invoke(this, status); } public int getFlags(IStatus status) { VTable vTable = getVTable(); + if (vTable.getFlags == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IStatementIntf.VERSION); + return 0; + } int result = vTable.getFlags.invoke(this, status); return result; } @@ -5579,6 +6557,10 @@ public int getFlags(IStatus status) public int getTimeout(IStatus status) { VTable vTable = getVTable(); + if (vTable.getTimeout == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IStatementIntf.VERSION); + return 0; + } int result = vTable.getTimeout.invoke(this, status); return result; } @@ -5586,12 +6568,20 @@ public int getTimeout(IStatus status) public void setTimeout(IStatus status, int timeOut) { VTable vTable = getVTable(); + if (vTable.setTimeout == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IStatementIntf.VERSION); + return; + } vTable.setTimeout.invoke(this, status, timeOut); } public IBatch createBatch(IStatus status, IMessageMetadata inMetadata, int parLength, byte[] par) { VTable vTable = getVTable(); + if (vTable.createBatch == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IStatementIntf.VERSION); + return null; + } IBatch result = vTable.createBatch.invoke(this, status, inMetadata, parLength, par); return result; } @@ -5859,36 +6849,60 @@ protected VTable createVTable() public void add(IStatus status, int count, com.sun.jna.Pointer inBuffer) { VTable vTable = getVTable(); + if (vTable.add == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IBatchIntf.VERSION); + return; + } vTable.add.invoke(this, status, count, inBuffer); } public void addBlob(IStatus status, int length, com.sun.jna.Pointer inBuffer, com.sun.jna.ptr.LongByReference blobId, int parLength, byte[] par) { VTable vTable = getVTable(); + if (vTable.addBlob == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IBatchIntf.VERSION); + return; + } vTable.addBlob.invoke(this, status, length, inBuffer, blobId, parLength, par); } public void appendBlobData(IStatus status, int length, com.sun.jna.Pointer inBuffer) { VTable vTable = getVTable(); + if (vTable.appendBlobData == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IBatchIntf.VERSION); + return; + } vTable.appendBlobData.invoke(this, status, length, inBuffer); } public void addBlobStream(IStatus status, int length, com.sun.jna.Pointer inBuffer) { VTable vTable = getVTable(); + if (vTable.addBlobStream == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IBatchIntf.VERSION); + return; + } vTable.addBlobStream.invoke(this, status, length, inBuffer); } public void registerBlob(IStatus status, com.sun.jna.ptr.LongByReference existingBlob, com.sun.jna.ptr.LongByReference blobId) { VTable vTable = getVTable(); + if (vTable.registerBlob == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IBatchIntf.VERSION); + return; + } vTable.registerBlob.invoke(this, status, existingBlob, blobId); } public IBatchCompletionState execute(IStatus status, ITransaction transaction) { VTable vTable = getVTable(); + if (vTable.execute == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IBatchIntf.VERSION); + return null; + } IBatchCompletionState result = vTable.execute.invoke(this, status, transaction); return result; } @@ -5896,12 +6910,20 @@ public IBatchCompletionState execute(IStatus status, ITransaction transaction) public void cancel(IStatus status) { VTable vTable = getVTable(); + if (vTable.cancel == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IBatchIntf.VERSION); + return; + } vTable.cancel.invoke(this, status); } public int getBlobAlignment(IStatus status) { VTable vTable = getVTable(); + if (vTable.getBlobAlignment == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IBatchIntf.VERSION); + return 0; + } int result = vTable.getBlobAlignment.invoke(this, status); return result; } @@ -5909,6 +6931,10 @@ public int getBlobAlignment(IStatus status) public IMessageMetadata getMetadata(IStatus status) { VTable vTable = getVTable(); + if (vTable.getMetadata == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IBatchIntf.VERSION); + return null; + } IMessageMetadata result = vTable.getMetadata.invoke(this, status); return result; } @@ -5916,6 +6942,10 @@ public IMessageMetadata getMetadata(IStatus status) public void setDefaultBpb(IStatus status, int parLength, byte[] par) { VTable vTable = getVTable(); + if (vTable.setDefaultBpb == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IBatchIntf.VERSION); + return; + } vTable.setDefaultBpb.invoke(this, status, parLength, par); } } @@ -6056,6 +7086,10 @@ protected VTable createVTable() public int getSize(IStatus status) { VTable vTable = getVTable(); + if (vTable.getSize == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IBatchCompletionStateIntf.VERSION); + return 0; + } int result = vTable.getSize.invoke(this, status); return result; } @@ -6063,6 +7097,10 @@ public int getSize(IStatus status) public int getState(IStatus status, int pos) { VTable vTable = getVTable(); + if (vTable.getState == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IBatchCompletionStateIntf.VERSION); + return 0; + } int result = vTable.getState.invoke(this, status, pos); return result; } @@ -6070,6 +7108,10 @@ public int getState(IStatus status, int pos) public int findError(IStatus status, int pos) { VTable vTable = getVTable(); + if (vTable.findError == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IBatchCompletionStateIntf.VERSION); + return 0; + } int result = vTable.findError.invoke(this, status, pos); return result; } @@ -6077,6 +7119,10 @@ public int findError(IStatus status, int pos) public void getStatus(IStatus status, IStatus to, int pos) { VTable vTable = getVTable(); + if (vTable.getStatus == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IBatchCompletionStateIntf.VERSION); + return; + } vTable.getStatus.invoke(this, status, to, pos); } } @@ -6172,12 +7218,20 @@ protected VTable createVTable() public void process(IStatus status, int length, byte[] data) { VTable vTable = getVTable(); + if (vTable.process == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IReplicatorIntf.VERSION); + return; + } vTable.process.invoke(this, status, length, data); } public void close(IStatus status) { VTable vTable = getVTable(); + if (vTable.close == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IReplicatorIntf.VERSION); + return; + } vTable.close.invoke(this, status); } } @@ -6378,42 +7432,70 @@ protected VTable createVTable() public void receive(IStatus status, int level, int msgType, int length, com.sun.jna.Pointer message) { VTable vTable = getVTable(); + if (vTable.receive == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IRequestIntf.VERSION); + return; + } vTable.receive.invoke(this, status, level, msgType, length, message); } public void send(IStatus status, int level, int msgType, int length, com.sun.jna.Pointer message) { VTable vTable = getVTable(); + if (vTable.send == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IRequestIntf.VERSION); + return; + } vTable.send.invoke(this, status, level, msgType, length, message); } public void getInfo(IStatus status, int level, int itemsLength, byte[] items, int bufferLength, byte[] buffer) { VTable vTable = getVTable(); + if (vTable.getInfo == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IRequestIntf.VERSION); + return; + } vTable.getInfo.invoke(this, status, level, itemsLength, items, bufferLength, buffer); } public void start(IStatus status, ITransaction tra, int level) { VTable vTable = getVTable(); + if (vTable.start == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IRequestIntf.VERSION); + return; + } vTable.start.invoke(this, status, tra, level); } public void startAndSend(IStatus status, ITransaction tra, int level, int msgType, int length, com.sun.jna.Pointer message) { VTable vTable = getVTable(); + if (vTable.startAndSend == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IRequestIntf.VERSION); + return; + } vTable.startAndSend.invoke(this, status, tra, level, msgType, length, message); } public void unwind(IStatus status, int level) { VTable vTable = getVTable(); + if (vTable.unwind == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IRequestIntf.VERSION); + return; + } vTable.unwind.invoke(this, status, level); } public void free(IStatus status) { VTable vTable = getVTable(); + if (vTable.free == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IRequestIntf.VERSION); + return; + } vTable.free.invoke(this, status); } } @@ -6488,6 +7570,10 @@ protected VTable createVTable() public void cancel(IStatus status) { VTable vTable = getVTable(); + if (vTable.cancel == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IEventsIntf.VERSION); + return; + } vTable.cancel.invoke(this, status); } } @@ -7059,12 +8145,20 @@ protected VTable createVTable() public void getInfo(IStatus status, int itemsLength, byte[] items, int bufferLength, byte[] buffer) { VTable vTable = getVTable(); + if (vTable.getInfo == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IAttachmentIntf.VERSION); + return; + } vTable.getInfo.invoke(this, status, itemsLength, items, bufferLength, buffer); } public ITransaction startTransaction(IStatus status, int tpbLength, byte[] tpb) { VTable vTable = getVTable(); + if (vTable.startTransaction == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IAttachmentIntf.VERSION); + return null; + } ITransaction result = vTable.startTransaction.invoke(this, status, tpbLength, tpb); return result; } @@ -7072,6 +8166,10 @@ public ITransaction startTransaction(IStatus status, int tpbLength, byte[] tpb) public ITransaction reconnectTransaction(IStatus status, int length, byte[] id) { VTable vTable = getVTable(); + if (vTable.reconnectTransaction == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IAttachmentIntf.VERSION); + return null; + } ITransaction result = vTable.reconnectTransaction.invoke(this, status, length, id); return result; } @@ -7079,6 +8177,10 @@ public ITransaction reconnectTransaction(IStatus status, int length, byte[] id) public IRequest compileRequest(IStatus status, int blrLength, byte[] blr) { VTable vTable = getVTable(); + if (vTable.compileRequest == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IAttachmentIntf.VERSION); + return null; + } IRequest result = vTable.compileRequest.invoke(this, status, blrLength, blr); return result; } @@ -7086,12 +8188,20 @@ public IRequest compileRequest(IStatus status, int blrLength, byte[] blr) public void transactRequest(IStatus status, ITransaction transaction, int blrLength, byte[] blr, int inMsgLength, byte[] inMsg, int outMsgLength, byte[] outMsg) { VTable vTable = getVTable(); + if (vTable.transactRequest == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IAttachmentIntf.VERSION); + return; + } vTable.transactRequest.invoke(this, status, transaction, blrLength, blr, inMsgLength, inMsg, outMsgLength, outMsg); } public IBlob createBlob(IStatus status, ITransaction transaction, com.sun.jna.ptr.LongByReference id, int bpbLength, byte[] bpb) { VTable vTable = getVTable(); + if (vTable.createBlob == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IAttachmentIntf.VERSION); + return null; + } IBlob result = vTable.createBlob.invoke(this, status, transaction, id, bpbLength, bpb); return result; } @@ -7099,6 +8209,10 @@ public IBlob createBlob(IStatus status, ITransaction transaction, com.sun.jna.pt public IBlob openBlob(IStatus status, ITransaction transaction, com.sun.jna.ptr.LongByReference id, int bpbLength, byte[] bpb) { VTable vTable = getVTable(); + if (vTable.openBlob == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IAttachmentIntf.VERSION); + return null; + } IBlob result = vTable.openBlob.invoke(this, status, transaction, id, bpbLength, bpb); return result; } @@ -7106,6 +8220,10 @@ public IBlob openBlob(IStatus status, ITransaction transaction, com.sun.jna.ptr. public int getSlice(IStatus status, ITransaction transaction, com.sun.jna.ptr.LongByReference id, int sdlLength, byte[] sdl, int paramLength, byte[] param, int sliceLength, byte[] slice) { VTable vTable = getVTable(); + if (vTable.getSlice == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IAttachmentIntf.VERSION); + return 0; + } int result = vTable.getSlice.invoke(this, status, transaction, id, sdlLength, sdl, paramLength, param, sliceLength, slice); return result; } @@ -7113,18 +8231,30 @@ public int getSlice(IStatus status, ITransaction transaction, com.sun.jna.ptr.Lo public void putSlice(IStatus status, ITransaction transaction, com.sun.jna.ptr.LongByReference id, int sdlLength, byte[] sdl, int paramLength, byte[] param, int sliceLength, byte[] slice) { VTable vTable = getVTable(); + if (vTable.putSlice == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IAttachmentIntf.VERSION); + return; + } vTable.putSlice.invoke(this, status, transaction, id, sdlLength, sdl, paramLength, param, sliceLength, slice); } public void executeDyn(IStatus status, ITransaction transaction, int length, byte[] dyn) { VTable vTable = getVTable(); + if (vTable.executeDyn == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IAttachmentIntf.VERSION); + return; + } vTable.executeDyn.invoke(this, status, transaction, length, dyn); } public IStatement prepare(IStatus status, ITransaction tra, int stmtLength, String sqlStmt, int dialect, int flags) { VTable vTable = getVTable(); + if (vTable.prepare == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IAttachmentIntf.VERSION); + return null; + } IStatement result = vTable.prepare.invoke(this, status, tra, stmtLength, sqlStmt, dialect, flags); return result; } @@ -7132,6 +8262,10 @@ public IStatement prepare(IStatus status, ITransaction tra, int stmtLength, Stri public ITransaction execute(IStatus status, ITransaction transaction, int stmtLength, String sqlStmt, int dialect, IMessageMetadata inMetadata, com.sun.jna.Pointer inBuffer, IMessageMetadata outMetadata, com.sun.jna.Pointer outBuffer) { VTable vTable = getVTable(); + if (vTable.execute == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IAttachmentIntf.VERSION); + return null; + } ITransaction result = vTable.execute.invoke(this, status, transaction, stmtLength, sqlStmt, dialect, inMetadata, inBuffer, outMetadata, outBuffer); return result; } @@ -7139,6 +8273,10 @@ public ITransaction execute(IStatus status, ITransaction transaction, int stmtLe public IResultSet openCursor(IStatus status, ITransaction transaction, int stmtLength, String sqlStmt, int dialect, IMessageMetadata inMetadata, com.sun.jna.Pointer inBuffer, IMessageMetadata outMetadata, String cursorName, int cursorFlags) { VTable vTable = getVTable(); + if (vTable.openCursor == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IAttachmentIntf.VERSION); + return null; + } IResultSet result = vTable.openCursor.invoke(this, status, transaction, stmtLength, sqlStmt, dialect, inMetadata, inBuffer, outMetadata, cursorName, cursorFlags); return result; } @@ -7146,6 +8284,10 @@ public IResultSet openCursor(IStatus status, ITransaction transaction, int stmtL public IEvents queEvents(IStatus status, IEventCallback callback, int length, byte[] events) { VTable vTable = getVTable(); + if (vTable.queEvents == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IAttachmentIntf.VERSION); + return null; + } IEvents result = vTable.queEvents.invoke(this, status, callback, length, events); return result; } @@ -7153,30 +8295,50 @@ public IEvents queEvents(IStatus status, IEventCallback callback, int length, by public void cancelOperation(IStatus status, int option) { VTable vTable = getVTable(); + if (vTable.cancelOperation == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IAttachmentIntf.VERSION); + return; + } vTable.cancelOperation.invoke(this, status, option); } public void ping(IStatus status) { VTable vTable = getVTable(); + if (vTable.ping == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IAttachmentIntf.VERSION); + return; + } vTable.ping.invoke(this, status); } public void detach(IStatus status) { VTable vTable = getVTable(); + if (vTable.detach == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IAttachmentIntf.VERSION); + return; + } vTable.detach.invoke(this, status); } public void dropDatabase(IStatus status) { VTable vTable = getVTable(); + if (vTable.dropDatabase == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IAttachmentIntf.VERSION); + return; + } vTable.dropDatabase.invoke(this, status); } public int getIdleTimeout(IStatus status) { VTable vTable = getVTable(); + if (vTable.getIdleTimeout == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IAttachmentIntf.VERSION); + return 0; + } int result = vTable.getIdleTimeout.invoke(this, status); return result; } @@ -7184,12 +8346,20 @@ public int getIdleTimeout(IStatus status) public void setIdleTimeout(IStatus status, int timeOut) { VTable vTable = getVTable(); + if (vTable.setIdleTimeout == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IAttachmentIntf.VERSION); + return; + } vTable.setIdleTimeout.invoke(this, status, timeOut); } public int getStatementTimeout(IStatus status) { VTable vTable = getVTable(); + if (vTable.getStatementTimeout == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IAttachmentIntf.VERSION); + return 0; + } int result = vTable.getStatementTimeout.invoke(this, status); return result; } @@ -7197,12 +8367,20 @@ public int getStatementTimeout(IStatus status) public void setStatementTimeout(IStatus status, int timeOut) { VTable vTable = getVTable(); + if (vTable.setStatementTimeout == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IAttachmentIntf.VERSION); + return; + } vTable.setStatementTimeout.invoke(this, status, timeOut); } public IBatch createBatch(IStatus status, ITransaction transaction, int stmtLength, String sqlStmt, int dialect, IMessageMetadata inMetadata, int parLength, byte[] par) { VTable vTable = getVTable(); + if (vTable.createBatch == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IAttachmentIntf.VERSION); + return null; + } IBatch result = vTable.createBatch.invoke(this, status, transaction, stmtLength, sqlStmt, dialect, inMetadata, parLength, par); return result; } @@ -7210,6 +8388,10 @@ public IBatch createBatch(IStatus status, ITransaction transaction, int stmtLeng public IReplicator createReplicator(IStatus status) { VTable vTable = getVTable(); + if (vTable.createReplicator == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IAttachmentIntf.VERSION); + return null; + } IReplicator result = vTable.createReplicator.invoke(this, status); return result; } @@ -7327,18 +8509,30 @@ protected VTable createVTable() public void detach(IStatus status) { VTable vTable = getVTable(); + if (vTable.detach == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IServiceIntf.VERSION); + return; + } vTable.detach.invoke(this, status); } public void query(IStatus status, int sendLength, byte[] sendItems, int receiveLength, byte[] receiveItems, int bufferLength, byte[] buffer) { VTable vTable = getVTable(); + if (vTable.query == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IServiceIntf.VERSION); + return; + } vTable.query.invoke(this, status, sendLength, sendItems, receiveLength, receiveItems, bufferLength, buffer); } public void start(IStatus status, int spbLength, byte[] spb) { VTable vTable = getVTable(); + if (vTable.start == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IServiceIntf.VERSION); + return; + } vTable.start.invoke(this, status, spbLength, spb); } } @@ -7500,6 +8694,10 @@ protected VTable createVTable() public IAttachment attachDatabase(IStatus status, String fileName, int dpbLength, byte[] dpb) { VTable vTable = getVTable(); + if (vTable.attachDatabase == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IProviderIntf.VERSION); + return null; + } IAttachment result = vTable.attachDatabase.invoke(this, status, fileName, dpbLength, dpb); return result; } @@ -7507,6 +8705,10 @@ public IAttachment attachDatabase(IStatus status, String fileName, int dpbLength public IAttachment createDatabase(IStatus status, String fileName, int dpbLength, byte[] dpb) { VTable vTable = getVTable(); + if (vTable.createDatabase == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IProviderIntf.VERSION); + return null; + } IAttachment result = vTable.createDatabase.invoke(this, status, fileName, dpbLength, dpb); return result; } @@ -7514,6 +8716,10 @@ public IAttachment createDatabase(IStatus status, String fileName, int dpbLength public IService attachServiceManager(IStatus status, String service, int spbLength, byte[] spb) { VTable vTable = getVTable(); + if (vTable.attachServiceManager == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IProviderIntf.VERSION); + return null; + } IService result = vTable.attachServiceManager.invoke(this, status, service, spbLength, spb); return result; } @@ -7521,12 +8727,20 @@ public IService attachServiceManager(IStatus status, String service, int spbLeng public void shutdown(IStatus status, int timeout, int reason) { VTable vTable = getVTable(); + if (vTable.shutdown == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IProviderIntf.VERSION); + return; + } vTable.shutdown.invoke(this, status, timeout, reason); } public void setDbCryptCallback(IStatus status, ICryptKeyCallback cryptCallback) { VTable vTable = getVTable(); + if (vTable.setDbCryptCallback == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IProviderIntf.VERSION); + return; + } vTable.setDbCryptCallback.invoke(this, status, cryptCallback); } } @@ -7644,18 +8858,30 @@ protected VTable createVTable() public void addAttachment(IStatus status, IAttachment att) { VTable vTable = getVTable(); + if (vTable.addAttachment == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IDtcStartIntf.VERSION); + return; + } vTable.addAttachment.invoke(this, status, att); } public void addWithTpb(IStatus status, IAttachment att, int length, byte[] tpb) { VTable vTable = getVTable(); + if (vTable.addWithTpb == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IDtcStartIntf.VERSION); + return; + } vTable.addWithTpb.invoke(this, status, att, length, tpb); } public ITransaction start(IStatus status) { VTable vTable = getVTable(); + if (vTable.start == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IDtcStartIntf.VERSION); + return null; + } ITransaction result = vTable.start.invoke(this, status); return result; } @@ -7754,6 +8980,10 @@ protected VTable createVTable() public ITransaction join(IStatus status, ITransaction one, ITransaction two) { VTable vTable = getVTable(); + if (vTable.join == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IDtcIntf.VERSION); + return null; + } ITransaction result = vTable.join.invoke(this, status, one, two); return result; } @@ -7761,6 +8991,10 @@ public ITransaction join(IStatus status, ITransaction one, ITransaction two) public IDtcStart startBuilder(IStatus status) { VTable vTable = getVTable(); + if (vTable.startBuilder == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IDtcIntf.VERSION); + return null; + } IDtcStart result = vTable.startBuilder.invoke(this, status); return result; } @@ -7836,6 +9070,11 @@ public static interface Callback_setDb extends com.sun.jna.Callback public void invoke(IWriter self, IStatus status, String value); } + public static interface Callback_changeLogin extends com.sun.jna.Callback + { + public void invoke(IWriter self, IStatus status, String login); + } + public VTable(com.sun.jna.Pointer pointer) { super(pointer); @@ -7897,6 +9136,21 @@ public void invoke(IWriter self, IStatus status, String value) } } }; + + changeLogin = new Callback_changeLogin() { + @Override + public void invoke(IWriter self, IStatus status, String login) + { + try + { + obj.changeLogin(status, login); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; } public VTable() @@ -7907,12 +9161,13 @@ public VTable() public Callback_add add; public Callback_setType setType; public Callback_setDb setDb; + public Callback_changeLogin changeLogin; @Override protected java.util.List getFieldOrder() { java.util.List fields = super.getFieldOrder(); - fields.addAll(java.util.Arrays.asList("reset", "add", "setType", "setDb")); + fields.addAll(java.util.Arrays.asList("reset", "add", "setType", "setDb", "changeLogin")); return fields; } } @@ -7938,26 +9193,51 @@ protected VTable createVTable() public void reset() { VTable vTable = getVTable(); + if (vTable.reset == null) { + return; + } vTable.reset.invoke(this); } public void add(IStatus status, String name) { VTable vTable = getVTable(); + if (vTable.add == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IWriterIntf.VERSION); + return; + } vTable.add.invoke(this, status, name); } public void setType(IStatus status, String value) { VTable vTable = getVTable(); + if (vTable.setType == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IWriterIntf.VERSION); + return; + } vTable.setType.invoke(this, status, value); } public void setDb(IStatus status, String value) { VTable vTable = getVTable(); + if (vTable.setDb == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IWriterIntf.VERSION); + return; + } vTable.setDb.invoke(this, status, value); } + + public void changeLogin(IStatus status, String login) + { + VTable vTable = getVTable(); + if (vTable.changeLogin == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IWriterIntf.VERSION); + return; + } + vTable.changeLogin.invoke(this, status, login); + } } public static class IServerBlock extends IVersioned implements IServerBlockIntf @@ -8080,6 +9360,9 @@ protected VTable createVTable() public String getLogin() { VTable vTable = getVTable(); + if (vTable.getLogin == null) { + return null; + } String result = vTable.getLogin.invoke(this); return result; } @@ -8087,6 +9370,9 @@ public String getLogin() public com.sun.jna.Pointer getData(com.sun.jna.Pointer length) { VTable vTable = getVTable(); + if (vTable.getData == null) { + return null; + } com.sun.jna.Pointer result = vTable.getData.invoke(this, length); return result; } @@ -8094,12 +9380,20 @@ public com.sun.jna.Pointer getData(com.sun.jna.Pointer length) public void putData(IStatus status, int length, com.sun.jna.Pointer data) { VTable vTable = getVTable(); + if (vTable.putData == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IServerBlockIntf.VERSION); + return; + } vTable.putData.invoke(this, status, length, data); } public ICryptKey newKey(IStatus status) { VTable vTable = getVTable(); + if (vTable.newKey == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IServerBlockIntf.VERSION); + return null; + } ICryptKey result = vTable.newKey.invoke(this, status); return result; } @@ -8139,6 +9433,21 @@ public static interface Callback_getAuthBlock extends com.sun.jna.Callback public IAuthBlock invoke(IClientBlock self, IStatus status); } + public static interface Callback_getEffectiveLogin extends com.sun.jna.Callback + { + public String invoke(IClientBlock self); + } + + public static interface Callback_getCertificate extends com.sun.jna.Callback + { + public String invoke(IClientBlock self); + } + + public static interface Callback_getRepositoryPin extends com.sun.jna.Callback + { + public String invoke(IClientBlock self); + } + public VTable(com.sun.jna.Pointer pointer) { super(pointer); @@ -8218,6 +9527,30 @@ public IAuthBlock invoke(IClientBlock self, IStatus status) } } }; + + getEffectiveLogin = new Callback_getEffectiveLogin() { + @Override + public String invoke(IClientBlock self) + { + return obj.getEffectiveLogin(); + } + }; + + getCertificate = new Callback_getCertificate() { + @Override + public String invoke(IClientBlock self) + { + return obj.getCertificate(); + } + }; + + getRepositoryPin = new Callback_getRepositoryPin() { + @Override + public String invoke(IClientBlock self) + { + return obj.getRepositoryPin(); + } + }; } public VTable() @@ -8230,12 +9563,15 @@ public VTable() public Callback_putData putData; public Callback_newKey newKey; public Callback_getAuthBlock getAuthBlock; + public Callback_getEffectiveLogin getEffectiveLogin; + public Callback_getCertificate getCertificate; + public Callback_getRepositoryPin getRepositoryPin; @Override protected java.util.List getFieldOrder() { java.util.List fields = super.getFieldOrder(); - fields.addAll(java.util.Arrays.asList("getLogin", "getPassword", "getData", "putData", "newKey", "getAuthBlock")); + fields.addAll(java.util.Arrays.asList("getLogin", "getPassword", "getData", "putData", "newKey", "getAuthBlock", "getEffectiveLogin", "getCertificate", "getRepositoryPin")); return fields; } } @@ -8261,6 +9597,9 @@ protected VTable createVTable() public String getLogin() { VTable vTable = getVTable(); + if (vTable.getLogin == null) { + return null; + } String result = vTable.getLogin.invoke(this); return result; } @@ -8268,6 +9607,9 @@ public String getLogin() public String getPassword() { VTable vTable = getVTable(); + if (vTable.getPassword == null) { + return null; + } String result = vTable.getPassword.invoke(this); return result; } @@ -8275,6 +9617,9 @@ public String getPassword() public com.sun.jna.Pointer getData(com.sun.jna.Pointer length) { VTable vTable = getVTable(); + if (vTable.getData == null) { + return null; + } com.sun.jna.Pointer result = vTable.getData.invoke(this, length); return result; } @@ -8282,12 +9627,20 @@ public com.sun.jna.Pointer getData(com.sun.jna.Pointer length) public void putData(IStatus status, int length, com.sun.jna.Pointer data) { VTable vTable = getVTable(); + if (vTable.putData == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IClientBlockIntf.VERSION); + return; + } vTable.putData.invoke(this, status, length, data); } public ICryptKey newKey(IStatus status) { VTable vTable = getVTable(); + if (vTable.newKey == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IClientBlockIntf.VERSION); + return null; + } ICryptKey result = vTable.newKey.invoke(this, status); return result; } @@ -8295,9 +9648,43 @@ public ICryptKey newKey(IStatus status) public IAuthBlock getAuthBlock(IStatus status) { VTable vTable = getVTable(); + if (vTable.getAuthBlock == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IClientBlockIntf.VERSION); + return null; + } IAuthBlock result = vTable.getAuthBlock.invoke(this, status); return result; } + + public String getEffectiveLogin() + { + VTable vTable = getVTable(); + if (vTable.getEffectiveLogin == null) { + return null; + } + String result = vTable.getEffectiveLogin.invoke(this); + return result; + } + + public String getCertificate() + { + VTable vTable = getVTable(); + if (vTable.getCertificate == null) { + return null; + } + String result = vTable.getCertificate.invoke(this); + return result; + } + + public String getRepositoryPin() + { + VTable vTable = getVTable(); + if (vTable.getRepositoryPin == null) { + return null; + } + String result = vTable.getRepositoryPin.invoke(this); + return result; + } } public static class IServer extends IAuth implements IServerIntf @@ -8392,6 +9779,10 @@ protected VTable createVTable() public int authenticate(IStatus status, IServerBlock sBlock, IWriter writerInterface) { VTable vTable = getVTable(); + if (vTable.authenticate == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IServerIntf.VERSION); + return 0; + } int result = vTable.authenticate.invoke(this, status, sBlock, writerInterface); return result; } @@ -8399,6 +9790,10 @@ public int authenticate(IStatus status, IServerBlock sBlock, IWriter writerInter public void setDbCryptCallback(IStatus status, ICryptKeyCallback cryptCallback) { VTable vTable = getVTable(); + if (vTable.setDbCryptCallback == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IServerIntf.VERSION); + return; + } vTable.setDbCryptCallback.invoke(this, status, cryptCallback); } } @@ -8474,6 +9869,10 @@ protected VTable createVTable() public int authenticate(IStatus status, IClientBlock cBlock) { VTable vTable = getVTable(); + if (vTable.authenticate == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IClientIntf.VERSION); + return 0; + } int result = vTable.authenticate.invoke(this, status, cBlock); return result; } @@ -8577,6 +9976,9 @@ protected VTable createVTable() public int entered() { VTable vTable = getVTable(); + if (vTable.entered == null) { + return 0; + } int result = vTable.entered.invoke(this); return result; } @@ -8584,6 +9986,9 @@ public int entered() public int specified() { VTable vTable = getVTable(); + if (vTable.specified == null) { + return 0; + } int result = vTable.specified.invoke(this); return result; } @@ -8591,6 +9996,10 @@ public int specified() public void setEntered(IStatus status, int newValue) { VTable vTable = getVTable(); + if (vTable.setEntered == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IUserFieldIntf.VERSION); + return; + } vTable.setEntered.invoke(this, status, newValue); } } @@ -8679,6 +10088,9 @@ protected VTable createVTable() public String get() { VTable vTable = getVTable(); + if (vTable.get == null) { + return null; + } String result = vTable.get.invoke(this); return result; } @@ -8686,6 +10098,10 @@ public String get() public void set(IStatus status, String newValue) { VTable vTable = getVTable(); + if (vTable.set == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, ICharUserFieldIntf.VERSION); + return; + } vTable.set.invoke(this, status, newValue); } } @@ -8774,6 +10190,9 @@ protected VTable createVTable() public int get() { VTable vTable = getVTable(); + if (vTable.get == null) { + return 0; + } int result = vTable.get.invoke(this); return result; } @@ -8781,6 +10200,10 @@ public int get() public void set(IStatus status, int newValue) { VTable vTable = getVTable(); + if (vTable.set == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IIntUserFieldIntf.VERSION); + return; + } vTable.set.invoke(this, status, newValue); } } @@ -8995,6 +10418,9 @@ protected VTable createVTable() public int operation() { VTable vTable = getVTable(); + if (vTable.operation == null) { + return 0; + } int result = vTable.operation.invoke(this); return result; } @@ -9002,6 +10428,9 @@ public int operation() public ICharUserField userName() { VTable vTable = getVTable(); + if (vTable.userName == null) { + return null; + } ICharUserField result = vTable.userName.invoke(this); return result; } @@ -9009,6 +10438,9 @@ public ICharUserField userName() public ICharUserField password() { VTable vTable = getVTable(); + if (vTable.password == null) { + return null; + } ICharUserField result = vTable.password.invoke(this); return result; } @@ -9016,6 +10448,9 @@ public ICharUserField password() public ICharUserField firstName() { VTable vTable = getVTable(); + if (vTable.firstName == null) { + return null; + } ICharUserField result = vTable.firstName.invoke(this); return result; } @@ -9023,6 +10458,9 @@ public ICharUserField firstName() public ICharUserField lastName() { VTable vTable = getVTable(); + if (vTable.lastName == null) { + return null; + } ICharUserField result = vTable.lastName.invoke(this); return result; } @@ -9030,6 +10468,9 @@ public ICharUserField lastName() public ICharUserField middleName() { VTable vTable = getVTable(); + if (vTable.middleName == null) { + return null; + } ICharUserField result = vTable.middleName.invoke(this); return result; } @@ -9037,6 +10478,9 @@ public ICharUserField middleName() public ICharUserField comment() { VTable vTable = getVTable(); + if (vTable.comment == null) { + return null; + } ICharUserField result = vTable.comment.invoke(this); return result; } @@ -9044,6 +10488,9 @@ public ICharUserField comment() public ICharUserField attributes() { VTable vTable = getVTable(); + if (vTable.attributes == null) { + return null; + } ICharUserField result = vTable.attributes.invoke(this); return result; } @@ -9051,6 +10498,9 @@ public ICharUserField attributes() public IIntUserField active() { VTable vTable = getVTable(); + if (vTable.active == null) { + return null; + } IIntUserField result = vTable.active.invoke(this); return result; } @@ -9058,6 +10508,9 @@ public IIntUserField active() public IIntUserField admin() { VTable vTable = getVTable(); + if (vTable.admin == null) { + return null; + } IIntUserField result = vTable.admin.invoke(this); return result; } @@ -9065,6 +10518,10 @@ public IIntUserField admin() public void clear(IStatus status) { VTable vTable = getVTable(); + if (vTable.clear == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IUserIntf.VERSION); + return; + } vTable.clear.invoke(this, status); } } @@ -9139,6 +10596,10 @@ protected VTable createVTable() public void list(IStatus status, IUser user) { VTable vTable = getVTable(); + if (vTable.list == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IListUsersIntf.VERSION); + return; + } vTable.list.invoke(this, status, user); } } @@ -9262,6 +10723,9 @@ protected VTable createVTable() public String name() { VTable vTable = getVTable(); + if (vTable.name == null) { + return null; + } String result = vTable.name.invoke(this); return result; } @@ -9269,6 +10733,9 @@ public String name() public String role() { VTable vTable = getVTable(); + if (vTable.role == null) { + return null; + } String result = vTable.role.invoke(this); return result; } @@ -9276,6 +10743,9 @@ public String role() public String networkProtocol() { VTable vTable = getVTable(); + if (vTable.networkProtocol == null) { + return null; + } String result = vTable.networkProtocol.invoke(this); return result; } @@ -9283,6 +10753,9 @@ public String networkProtocol() public String remoteAddress() { VTable vTable = getVTable(); + if (vTable.remoteAddress == null) { + return null; + } String result = vTable.remoteAddress.invoke(this); return result; } @@ -9290,6 +10763,9 @@ public String remoteAddress() public com.sun.jna.Pointer authBlock(com.sun.jna.Pointer length) { VTable vTable = getVTable(); + if (vTable.authBlock == null) { + return null; + } com.sun.jna.Pointer result = vTable.authBlock.invoke(this, length); return result; } @@ -9429,12 +10905,20 @@ protected VTable createVTable() public void start(IStatus status, ILogonInfo logonInfo) { VTable vTable = getVTable(); + if (vTable.start == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IManagementIntf.VERSION); + return; + } vTable.start.invoke(this, status, logonInfo); } public int execute(IStatus status, IUser user, IListUsers callback) { VTable vTable = getVTable(); + if (vTable.execute == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IManagementIntf.VERSION); + return 0; + } int result = vTable.execute.invoke(this, status, user, callback); return result; } @@ -9442,12 +10926,20 @@ public int execute(IStatus status, IUser user, IListUsers callback) public void commit(IStatus status) { VTable vTable = getVTable(); + if (vTable.commit == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IManagementIntf.VERSION); + return; + } vTable.commit.invoke(this, status); } public void rollback(IStatus status) { VTable vTable = getVTable(); + if (vTable.rollback == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IManagementIntf.VERSION); + return; + } vTable.rollback.invoke(this, status); } } @@ -9615,6 +11107,9 @@ protected VTable createVTable() public String getType() { VTable vTable = getVTable(); + if (vTable.getType == null) { + return null; + } String result = vTable.getType.invoke(this); return result; } @@ -9622,6 +11117,9 @@ public String getType() public String getName() { VTable vTable = getVTable(); + if (vTable.getName == null) { + return null; + } String result = vTable.getName.invoke(this); return result; } @@ -9629,6 +11127,9 @@ public String getName() public String getPlugin() { VTable vTable = getVTable(); + if (vTable.getPlugin == null) { + return null; + } String result = vTable.getPlugin.invoke(this); return result; } @@ -9636,6 +11137,9 @@ public String getPlugin() public String getSecurityDb() { VTable vTable = getVTable(); + if (vTable.getSecurityDb == null) { + return null; + } String result = vTable.getSecurityDb.invoke(this); return result; } @@ -9643,6 +11147,9 @@ public String getSecurityDb() public String getOriginalPlugin() { VTable vTable = getVTable(); + if (vTable.getOriginalPlugin == null) { + return null; + } String result = vTable.getOriginalPlugin.invoke(this); return result; } @@ -9650,6 +11157,10 @@ public String getOriginalPlugin() public boolean next(IStatus status) { VTable vTable = getVTable(); + if (vTable.next == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IAuthBlockIntf.VERSION); + return false; + } boolean result = vTable.next.invoke(this, status); return result; } @@ -9657,6 +11168,10 @@ public boolean next(IStatus status) public boolean first(IStatus status) { VTable vTable = getVTable(); + if (vTable.first == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IAuthBlockIntf.VERSION); + return false; + } boolean result = vTable.first.invoke(this, status); return result; } @@ -9839,6 +11354,10 @@ protected VTable createVTable() public String getKnownTypes(IStatus status) { VTable vTable = getVTable(); + if (vTable.getKnownTypes == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IWireCryptPluginIntf.VERSION); + return null; + } String result = vTable.getKnownTypes.invoke(this, status); return result; } @@ -9846,24 +11365,40 @@ public String getKnownTypes(IStatus status) public void setKey(IStatus status, ICryptKey key) { VTable vTable = getVTable(); + if (vTable.setKey == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IWireCryptPluginIntf.VERSION); + return; + } vTable.setKey.invoke(this, status, key); } public void encrypt(IStatus status, int length, com.sun.jna.Pointer from, com.sun.jna.Pointer to) { VTable vTable = getVTable(); + if (vTable.encrypt == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IWireCryptPluginIntf.VERSION); + return; + } vTable.encrypt.invoke(this, status, length, from, to); } public void decrypt(IStatus status, int length, com.sun.jna.Pointer from, com.sun.jna.Pointer to) { VTable vTable = getVTable(); + if (vTable.decrypt == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IWireCryptPluginIntf.VERSION); + return; + } vTable.decrypt.invoke(this, status, length, from, to); } public com.sun.jna.Pointer getSpecificData(IStatus status, String keyType, com.sun.jna.Pointer length) { VTable vTable = getVTable(); + if (vTable.getSpecificData == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IWireCryptPluginIntf.VERSION); + return null; + } com.sun.jna.Pointer result = vTable.getSpecificData.invoke(this, status, keyType, length); return result; } @@ -9871,6 +11406,10 @@ public com.sun.jna.Pointer getSpecificData(IStatus status, String keyType, com.s public void setSpecificData(IStatus status, String keyType, int length, byte[] data) { VTable vTable = getVTable(); + if (vTable.setSpecificData == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IWireCryptPluginIntf.VERSION); + return; + } vTable.setSpecificData.invoke(this, status, keyType, length, data); } } @@ -9938,6 +11477,9 @@ protected VTable createVTable() public int callback(int dataLength, com.sun.jna.Pointer data, int bufferLength, com.sun.jna.Pointer buffer) { VTable vTable = getVTable(); + if (vTable.callback == null) { + return 0; + } int result = vTable.callback.invoke(this, dataLength, data, bufferLength, buffer); return result; } @@ -10080,6 +11622,10 @@ protected VTable createVTable() public int keyCallback(IStatus status, ICryptKeyCallback callback) { VTable vTable = getVTable(); + if (vTable.keyCallback == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IKeyHolderPluginIntf.VERSION); + return 0; + } int result = vTable.keyCallback.invoke(this, status, callback); return result; } @@ -10087,6 +11633,10 @@ public int keyCallback(IStatus status, ICryptKeyCallback callback) public ICryptKeyCallback keyHandle(IStatus status, String keyName) { VTable vTable = getVTable(); + if (vTable.keyHandle == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IKeyHolderPluginIntf.VERSION); + return null; + } ICryptKeyCallback result = vTable.keyHandle.invoke(this, status, keyName); return result; } @@ -10094,6 +11644,10 @@ public ICryptKeyCallback keyHandle(IStatus status, String keyName) public boolean useOnlyOwnKeys(IStatus status) { VTable vTable = getVTable(); + if (vTable.useOnlyOwnKeys == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IKeyHolderPluginIntf.VERSION); + return false; + } boolean result = vTable.useOnlyOwnKeys.invoke(this, status); return result; } @@ -10101,6 +11655,10 @@ public boolean useOnlyOwnKeys(IStatus status) public ICryptKeyCallback chainHandle(IStatus status) { VTable vTable = getVTable(); + if (vTable.chainHandle == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IKeyHolderPluginIntf.VERSION); + return null; + } ICryptKeyCallback result = vTable.chainHandle.invoke(this, status); return result; } @@ -10177,6 +11735,10 @@ protected VTable createVTable() public String getDatabaseFullPath(IStatus status) { VTable vTable = getVTable(); + if (vTable.getDatabaseFullPath == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IDbCryptInfoIntf.VERSION); + return null; + } String result = vTable.getDatabaseFullPath.invoke(this, status); return result; } @@ -10315,24 +11877,40 @@ protected VTable createVTable() public void setKey(IStatus status, int length, IKeyHolderPlugin[] sources, String keyName) { VTable vTable = getVTable(); + if (vTable.setKey == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IDbCryptPluginIntf.VERSION); + return; + } vTable.setKey.invoke(this, status, length, sources, keyName); } public void encrypt(IStatus status, int length, com.sun.jna.Pointer from, com.sun.jna.Pointer to) { VTable vTable = getVTable(); + if (vTable.encrypt == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IDbCryptPluginIntf.VERSION); + return; + } vTable.encrypt.invoke(this, status, length, from, to); } public void decrypt(IStatus status, int length, com.sun.jna.Pointer from, com.sun.jna.Pointer to) { VTable vTable = getVTable(); + if (vTable.decrypt == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IDbCryptPluginIntf.VERSION); + return; + } vTable.decrypt.invoke(this, status, length, from, to); } public void setInfo(IStatus status, IDbCryptInfo info) { VTable vTable = getVTable(); + if (vTable.setInfo == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IDbCryptPluginIntf.VERSION); + return; + } vTable.setInfo.invoke(this, status, info); } } @@ -10550,6 +12128,9 @@ protected VTable createVTable() public IMaster getMaster() { VTable vTable = getVTable(); + if (vTable.getMaster == null) { + return null; + } IMaster result = vTable.getMaster.invoke(this); return result; } @@ -10557,6 +12138,10 @@ public IMaster getMaster() public IExternalEngine getEngine(IStatus status) { VTable vTable = getVTable(); + if (vTable.getEngine == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IExternalContextIntf.VERSION); + return null; + } IExternalEngine result = vTable.getEngine.invoke(this, status); return result; } @@ -10564,6 +12149,10 @@ public IExternalEngine getEngine(IStatus status) public IAttachment getAttachment(IStatus status) { VTable vTable = getVTable(); + if (vTable.getAttachment == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IExternalContextIntf.VERSION); + return null; + } IAttachment result = vTable.getAttachment.invoke(this, status); return result; } @@ -10571,6 +12160,10 @@ public IAttachment getAttachment(IStatus status) public ITransaction getTransaction(IStatus status) { VTable vTable = getVTable(); + if (vTable.getTransaction == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IExternalContextIntf.VERSION); + return null; + } ITransaction result = vTable.getTransaction.invoke(this, status); return result; } @@ -10578,6 +12171,9 @@ public ITransaction getTransaction(IStatus status) public String getUserName() { VTable vTable = getVTable(); + if (vTable.getUserName == null) { + return null; + } String result = vTable.getUserName.invoke(this); return result; } @@ -10585,6 +12181,9 @@ public String getUserName() public String getDatabaseName() { VTable vTable = getVTable(); + if (vTable.getDatabaseName == null) { + return null; + } String result = vTable.getDatabaseName.invoke(this); return result; } @@ -10592,6 +12191,9 @@ public String getDatabaseName() public String getClientCharSet() { VTable vTable = getVTable(); + if (vTable.getClientCharSet == null) { + return null; + } String result = vTable.getClientCharSet.invoke(this); return result; } @@ -10599,6 +12201,9 @@ public String getClientCharSet() public int obtainInfoCode() { VTable vTable = getVTable(); + if (vTable.obtainInfoCode == null) { + return 0; + } int result = vTable.obtainInfoCode.invoke(this); return result; } @@ -10606,6 +12211,9 @@ public int obtainInfoCode() public com.sun.jna.Pointer getInfo(int code) { VTable vTable = getVTable(); + if (vTable.getInfo == null) { + return null; + } com.sun.jna.Pointer result = vTable.getInfo.invoke(this, code); return result; } @@ -10613,6 +12221,9 @@ public com.sun.jna.Pointer getInfo(int code) public com.sun.jna.Pointer setInfo(int code, com.sun.jna.Pointer value) { VTable vTable = getVTable(); + if (vTable.setInfo == null) { + return null; + } com.sun.jna.Pointer result = vTable.setInfo.invoke(this, code, value); return result; } @@ -10689,6 +12300,10 @@ protected VTable createVTable() public boolean fetch(IStatus status) { VTable vTable = getVTable(); + if (vTable.fetch == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IExternalResultSetIntf.VERSION); + return false; + } boolean result = vTable.fetch.invoke(this, status); return result; } @@ -10785,12 +12400,20 @@ protected VTable createVTable() public void getCharSet(IStatus status, IExternalContext context, com.sun.jna.Pointer name, int nameSize) { VTable vTable = getVTable(); + if (vTable.getCharSet == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IExternalFunctionIntf.VERSION); + return; + } vTable.getCharSet.invoke(this, status, context, name, nameSize); } public void execute(IStatus status, IExternalContext context, com.sun.jna.Pointer inMsg, com.sun.jna.Pointer outMsg) { VTable vTable = getVTable(); + if (vTable.execute == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IExternalFunctionIntf.VERSION); + return; + } vTable.execute.invoke(this, status, context, inMsg, outMsg); } } @@ -10887,12 +12510,20 @@ protected VTable createVTable() public void getCharSet(IStatus status, IExternalContext context, com.sun.jna.Pointer name, int nameSize) { VTable vTable = getVTable(); + if (vTable.getCharSet == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IExternalProcedureIntf.VERSION); + return; + } vTable.getCharSet.invoke(this, status, context, name, nameSize); } public IExternalResultSet open(IStatus status, IExternalContext context, com.sun.jna.Pointer inMsg, com.sun.jna.Pointer outMsg) { VTable vTable = getVTable(); + if (vTable.open == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IExternalProcedureIntf.VERSION); + return null; + } IExternalResultSet result = vTable.open.invoke(this, status, context, inMsg, outMsg); return result; } @@ -10909,7 +12540,12 @@ public static interface Callback_getCharSet extends com.sun.jna.Callback public static interface Callback_execute extends com.sun.jna.Callback { - public void invoke(IExternalTrigger self, IStatus status, IExternalContext context, int action, com.sun.jna.Pointer oldMsg, com.sun.jna.Pointer newMsg); + public void invoke(IExternalTrigger self, IStatus status, IExternalContext context, int action, com.sun.jna.Pointer oldMsg, com.sun.jna.Pointer newMsg, com.sun.jna.Pointer oldDbKey, com.sun.jna.Pointer newDbKey); + } + + public static interface Callback_getDoNotEvaluateField extends com.sun.jna.Callback + { + public boolean invoke(IExternalTrigger self, IStatus status, int index); } public VTable(com.sun.jna.Pointer pointer) @@ -10938,15 +12574,31 @@ public void invoke(IExternalTrigger self, IStatus status, IExternalContext conte execute = new Callback_execute() { @Override - public void invoke(IExternalTrigger self, IStatus status, IExternalContext context, int action, com.sun.jna.Pointer oldMsg, com.sun.jna.Pointer newMsg) + public void invoke(IExternalTrigger self, IStatus status, IExternalContext context, int action, com.sun.jna.Pointer oldMsg, com.sun.jna.Pointer newMsg, com.sun.jna.Pointer oldDbKey, com.sun.jna.Pointer newDbKey) + { + try + { + obj.execute(status, context, action, oldMsg, newMsg, oldDbKey, newDbKey); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + getDoNotEvaluateField = new Callback_getDoNotEvaluateField() { + @Override + public boolean invoke(IExternalTrigger self, IStatus status, int index) { try { - obj.execute(status, context, action, oldMsg, newMsg); + return obj.getDoNotEvaluateField(status, index); } catch (Throwable t) { FbInterfaceException.catchException(status, t); + return false; } } }; @@ -10958,12 +12610,13 @@ public VTable() public Callback_getCharSet getCharSet; public Callback_execute execute; + public Callback_getDoNotEvaluateField getDoNotEvaluateField; @Override protected java.util.List getFieldOrder() { java.util.List fields = super.getFieldOrder(); - fields.addAll(java.util.Arrays.asList("getCharSet", "execute")); + fields.addAll(java.util.Arrays.asList("getCharSet", "execute", "getDoNotEvaluateField")); return fields; } } @@ -10989,13 +12642,32 @@ protected VTable createVTable() public void getCharSet(IStatus status, IExternalContext context, com.sun.jna.Pointer name, int nameSize) { VTable vTable = getVTable(); + if (vTable.getCharSet == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IExternalTriggerIntf.VERSION); + return; + } vTable.getCharSet.invoke(this, status, context, name, nameSize); } - public void execute(IStatus status, IExternalContext context, int action, com.sun.jna.Pointer oldMsg, com.sun.jna.Pointer newMsg) + public void execute(IStatus status, IExternalContext context, int action, com.sun.jna.Pointer oldMsg, com.sun.jna.Pointer newMsg, com.sun.jna.Pointer oldDbKey, com.sun.jna.Pointer newDbKey) + { + VTable vTable = getVTable(); + if (vTable.execute == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IExternalTriggerIntf.VERSION); + return; + } + vTable.execute.invoke(this, status, context, action, oldMsg, newMsg, oldDbKey, newDbKey); + } + + public boolean getDoNotEvaluateField(IStatus status, int index) { VTable vTable = getVTable(); - vTable.execute.invoke(this, status, context, action, oldMsg, newMsg); + if (vTable.getDoNotEvaluateField == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IExternalTriggerIntf.VERSION); + return false; + } + boolean result = vTable.getDoNotEvaluateField.invoke(this, status, index); + return result; } } @@ -11246,6 +12918,10 @@ protected VTable createVTable() public String getPackage(IStatus status) { VTable vTable = getVTable(); + if (vTable.getPackage == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IRoutineMetadataIntf.VERSION); + return null; + } String result = vTable.getPackage.invoke(this, status); return result; } @@ -11253,6 +12929,10 @@ public String getPackage(IStatus status) public String getName(IStatus status) { VTable vTable = getVTable(); + if (vTable.getName == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IRoutineMetadataIntf.VERSION); + return null; + } String result = vTable.getName.invoke(this, status); return result; } @@ -11260,6 +12940,10 @@ public String getName(IStatus status) public String getEntryPoint(IStatus status) { VTable vTable = getVTable(); + if (vTable.getEntryPoint == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IRoutineMetadataIntf.VERSION); + return null; + } String result = vTable.getEntryPoint.invoke(this, status); return result; } @@ -11267,6 +12951,10 @@ public String getEntryPoint(IStatus status) public String getBody(IStatus status) { VTable vTable = getVTable(); + if (vTable.getBody == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IRoutineMetadataIntf.VERSION); + return null; + } String result = vTable.getBody.invoke(this, status); return result; } @@ -11274,6 +12962,10 @@ public String getBody(IStatus status) public IMessageMetadata getInputMetadata(IStatus status) { VTable vTable = getVTable(); + if (vTable.getInputMetadata == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IRoutineMetadataIntf.VERSION); + return null; + } IMessageMetadata result = vTable.getInputMetadata.invoke(this, status); return result; } @@ -11281,6 +12973,10 @@ public IMessageMetadata getInputMetadata(IStatus status) public IMessageMetadata getOutputMetadata(IStatus status) { VTable vTable = getVTable(); + if (vTable.getOutputMetadata == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IRoutineMetadataIntf.VERSION); + return null; + } IMessageMetadata result = vTable.getOutputMetadata.invoke(this, status); return result; } @@ -11288,6 +12984,10 @@ public IMessageMetadata getOutputMetadata(IStatus status) public IMessageMetadata getTriggerMetadata(IStatus status) { VTable vTable = getVTable(); + if (vTable.getTriggerMetadata == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IRoutineMetadataIntf.VERSION); + return null; + } IMessageMetadata result = vTable.getTriggerMetadata.invoke(this, status); return result; } @@ -11295,6 +12995,10 @@ public IMessageMetadata getTriggerMetadata(IStatus status) public String getTriggerTable(IStatus status) { VTable vTable = getVTable(); + if (vTable.getTriggerTable == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IRoutineMetadataIntf.VERSION); + return null; + } String result = vTable.getTriggerTable.invoke(this, status); return result; } @@ -11302,6 +13006,10 @@ public String getTriggerTable(IStatus status) public int getTriggerType(IStatus status) { VTable vTable = getVTable(); + if (vTable.getTriggerType == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IRoutineMetadataIntf.VERSION); + return 0; + } int result = vTable.getTriggerType.invoke(this, status); return result; } @@ -11485,24 +13193,40 @@ protected VTable createVTable() public void open(IStatus status, IExternalContext context, com.sun.jna.Pointer charSet, int charSetSize) { VTable vTable = getVTable(); + if (vTable.open == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IExternalEngineIntf.VERSION); + return; + } vTable.open.invoke(this, status, context, charSet, charSetSize); } public void openAttachment(IStatus status, IExternalContext context) { VTable vTable = getVTable(); + if (vTable.openAttachment == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IExternalEngineIntf.VERSION); + return; + } vTable.openAttachment.invoke(this, status, context); } public void closeAttachment(IStatus status, IExternalContext context) { VTable vTable = getVTable(); + if (vTable.closeAttachment == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IExternalEngineIntf.VERSION); + return; + } vTable.closeAttachment.invoke(this, status, context); } public IExternalFunction makeFunction(IStatus status, IExternalContext context, IRoutineMetadata metadata, IMetadataBuilder inBuilder, IMetadataBuilder outBuilder) { VTable vTable = getVTable(); + if (vTable.makeFunction == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IExternalEngineIntf.VERSION); + return null; + } IExternalFunction result = vTable.makeFunction.invoke(this, status, context, metadata, inBuilder, outBuilder); return result; } @@ -11510,6 +13234,10 @@ public IExternalFunction makeFunction(IStatus status, IExternalContext context, public IExternalProcedure makeProcedure(IStatus status, IExternalContext context, IRoutineMetadata metadata, IMetadataBuilder inBuilder, IMetadataBuilder outBuilder) { VTable vTable = getVTable(); + if (vTable.makeProcedure == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IExternalEngineIntf.VERSION); + return null; + } IExternalProcedure result = vTable.makeProcedure.invoke(this, status, context, metadata, inBuilder, outBuilder); return result; } @@ -11517,6 +13245,10 @@ public IExternalProcedure makeProcedure(IStatus status, IExternalContext context public IExternalTrigger makeTrigger(IStatus status, IExternalContext context, IRoutineMetadata metadata, IMetadataBuilder fieldsBuilder) { VTable vTable = getVTable(); + if (vTable.makeTrigger == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IExternalEngineIntf.VERSION); + return null; + } IExternalTrigger result = vTable.makeTrigger.invoke(this, status, context, metadata, fieldsBuilder); return result; } @@ -11585,6 +13317,9 @@ protected VTable createVTable() public void handler() { VTable vTable = getVTable(); + if (vTable.handler == null) { + return; + } vTable.handler.invoke(this); } } @@ -11680,12 +13415,20 @@ protected VTable createVTable() public void start(IStatus status, ITimer timer, long microSeconds) { VTable vTable = getVTable(); + if (vTable.start == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, ITimerControlIntf.VERSION); + return; + } vTable.start.invoke(this, status, timer, microSeconds); } public void stop(IStatus status, ITimer timer) { VTable vTable = getVTable(); + if (vTable.stop == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, ITimerControlIntf.VERSION); + return; + } vTable.stop.invoke(this, status, timer); } } @@ -11760,6 +13503,10 @@ protected VTable createVTable() public void callback(IStatus status, String text) { VTable vTable = getVTable(); + if (vTable.callback == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IVersionCallbackIntf.VERSION); + return; + } vTable.callback.invoke(this, status, text); } } @@ -11843,16 +13590,6 @@ public static interface Callback_getDecFloat34 extends com.sun.jna.Callback public IDecFloat34 invoke(IUtil self, IStatus status); } - public static interface Callback_getTransactionByHandle extends com.sun.jna.Callback - { - public ITransaction invoke(IUtil self, IStatus status, com.sun.jna.ptr.LongByReference hndlPtr); - } - - public static interface Callback_getStatementByHandle extends com.sun.jna.Callback - { - public IStatement invoke(IUtil self, IStatus status, com.sun.jna.ptr.LongByReference hndlPtr); - } - public static interface Callback_decodeTimeTz extends com.sun.jna.Callback { public void invoke(IUtil self, IStatus status, ISC_TIME_TZ[] timeTz, com.sun.jna.Pointer hours, com.sun.jna.Pointer minutes, com.sun.jna.Pointer seconds, com.sun.jna.Pointer fractions, int timeZoneBufferLength, com.sun.jna.Pointer timeZoneBuffer); @@ -11878,6 +13615,16 @@ public static interface Callback_getInt128 extends com.sun.jna.Callback public IInt128 invoke(IUtil self, IStatus status); } + public static interface Callback_decodeTimeTzEx extends com.sun.jna.Callback + { + public void invoke(IUtil self, IStatus status, ISC_TIME_TZ_EX[] timeTz, com.sun.jna.Pointer hours, com.sun.jna.Pointer minutes, com.sun.jna.Pointer seconds, com.sun.jna.Pointer fractions, int timeZoneBufferLength, com.sun.jna.Pointer timeZoneBuffer); + } + + public static interface Callback_decodeTimeStampTzEx extends com.sun.jna.Callback + { + public void invoke(IUtil self, IStatus status, ISC_TIMESTAMP_TZ_EX[] timeStampTz, com.sun.jna.Pointer year, com.sun.jna.Pointer month, com.sun.jna.Pointer day, com.sun.jna.Pointer hours, com.sun.jna.Pointer minutes, com.sun.jna.Pointer seconds, com.sun.jna.Pointer fractions, int timeZoneBufferLength, com.sun.jna.Pointer timeZoneBuffer); + } + public VTable(com.sun.jna.Pointer pointer) { super(pointer); @@ -12075,45 +13822,43 @@ public IDecFloat34 invoke(IUtil self, IStatus status) } }; - getTransactionByHandle = new Callback_getTransactionByHandle() { + decodeTimeTz = new Callback_decodeTimeTz() { @Override - public ITransaction invoke(IUtil self, IStatus status, com.sun.jna.ptr.LongByReference hndlPtr) + public void invoke(IUtil self, IStatus status, ISC_TIME_TZ[] timeTz, com.sun.jna.Pointer hours, com.sun.jna.Pointer minutes, com.sun.jna.Pointer seconds, com.sun.jna.Pointer fractions, int timeZoneBufferLength, com.sun.jna.Pointer timeZoneBuffer) { try { - return obj.getTransactionByHandle(status, hndlPtr); + obj.decodeTimeTz(status, timeTz, hours, minutes, seconds, fractions, timeZoneBufferLength, timeZoneBuffer); } catch (Throwable t) { FbInterfaceException.catchException(status, t); - return null; } } }; - getStatementByHandle = new Callback_getStatementByHandle() { + decodeTimeStampTz = new Callback_decodeTimeStampTz() { @Override - public IStatement invoke(IUtil self, IStatus status, com.sun.jna.ptr.LongByReference hndlPtr) + public void invoke(IUtil self, IStatus status, ISC_TIMESTAMP_TZ[] timeStampTz, com.sun.jna.Pointer year, com.sun.jna.Pointer month, com.sun.jna.Pointer day, com.sun.jna.Pointer hours, com.sun.jna.Pointer minutes, com.sun.jna.Pointer seconds, com.sun.jna.Pointer fractions, int timeZoneBufferLength, com.sun.jna.Pointer timeZoneBuffer) { try { - return obj.getStatementByHandle(status, hndlPtr); + obj.decodeTimeStampTz(status, timeStampTz, year, month, day, hours, minutes, seconds, fractions, timeZoneBufferLength, timeZoneBuffer); } catch (Throwable t) { FbInterfaceException.catchException(status, t); - return null; } } }; - decodeTimeTz = new Callback_decodeTimeTz() { + encodeTimeTz = new Callback_encodeTimeTz() { @Override - public void invoke(IUtil self, IStatus status, ISC_TIME_TZ[] timeTz, com.sun.jna.Pointer hours, com.sun.jna.Pointer minutes, com.sun.jna.Pointer seconds, com.sun.jna.Pointer fractions, int timeZoneBufferLength, com.sun.jna.Pointer timeZoneBuffer) + public void invoke(IUtil self, IStatus status, ISC_TIME_TZ[] timeTz, int hours, int minutes, int seconds, int fractions, String timeZone) { try { - obj.decodeTimeTz(status, timeTz, hours, minutes, seconds, fractions, timeZoneBufferLength, timeZoneBuffer); + obj.encodeTimeTz(status, timeTz, hours, minutes, seconds, fractions, timeZone); } catch (Throwable t) { @@ -12122,13 +13867,13 @@ public void invoke(IUtil self, IStatus status, ISC_TIME_TZ[] timeTz, com.sun.jna } }; - decodeTimeStampTz = new Callback_decodeTimeStampTz() { + encodeTimeStampTz = new Callback_encodeTimeStampTz() { @Override - public void invoke(IUtil self, IStatus status, ISC_TIMESTAMP_TZ[] timeStampTz, com.sun.jna.Pointer year, com.sun.jna.Pointer month, com.sun.jna.Pointer day, com.sun.jna.Pointer hours, com.sun.jna.Pointer minutes, com.sun.jna.Pointer seconds, com.sun.jna.Pointer fractions, int timeZoneBufferLength, com.sun.jna.Pointer timeZoneBuffer) + public void invoke(IUtil self, IStatus status, ISC_TIMESTAMP_TZ[] timeStampTz, int year, int month, int day, int hours, int minutes, int seconds, int fractions, String timeZone) { try { - obj.decodeTimeStampTz(status, timeStampTz, year, month, day, hours, minutes, seconds, fractions, timeZoneBufferLength, timeZoneBuffer); + obj.encodeTimeStampTz(status, timeStampTz, year, month, day, hours, minutes, seconds, fractions, timeZone); } catch (Throwable t) { @@ -12137,28 +13882,29 @@ public void invoke(IUtil self, IStatus status, ISC_TIMESTAMP_TZ[] timeStampTz, c } }; - encodeTimeTz = new Callback_encodeTimeTz() { + getInt128 = new Callback_getInt128() { @Override - public void invoke(IUtil self, IStatus status, ISC_TIME_TZ[] timeTz, int hours, int minutes, int seconds, int fractions, String timeZone) + public IInt128 invoke(IUtil self, IStatus status) { try { - obj.encodeTimeTz(status, timeTz, hours, minutes, seconds, fractions, timeZone); + return obj.getInt128(status); } catch (Throwable t) { FbInterfaceException.catchException(status, t); + return null; } } }; - encodeTimeStampTz = new Callback_encodeTimeStampTz() { + decodeTimeTzEx = new Callback_decodeTimeTzEx() { @Override - public void invoke(IUtil self, IStatus status, ISC_TIMESTAMP_TZ[] timeStampTz, int year, int month, int day, int hours, int minutes, int seconds, int fractions, String timeZone) + public void invoke(IUtil self, IStatus status, ISC_TIME_TZ_EX[] timeTz, com.sun.jna.Pointer hours, com.sun.jna.Pointer minutes, com.sun.jna.Pointer seconds, com.sun.jna.Pointer fractions, int timeZoneBufferLength, com.sun.jna.Pointer timeZoneBuffer) { try { - obj.encodeTimeStampTz(status, timeStampTz, year, month, day, hours, minutes, seconds, fractions, timeZone); + obj.decodeTimeTzEx(status, timeTz, hours, minutes, seconds, fractions, timeZoneBufferLength, timeZoneBuffer); } catch (Throwable t) { @@ -12167,18 +13913,17 @@ public void invoke(IUtil self, IStatus status, ISC_TIMESTAMP_TZ[] timeStampTz, i } }; - getInt128 = new Callback_getInt128() { + decodeTimeStampTzEx = new Callback_decodeTimeStampTzEx() { @Override - public IInt128 invoke(IUtil self, IStatus status) + public void invoke(IUtil self, IStatus status, ISC_TIMESTAMP_TZ_EX[] timeStampTz, com.sun.jna.Pointer year, com.sun.jna.Pointer month, com.sun.jna.Pointer day, com.sun.jna.Pointer hours, com.sun.jna.Pointer minutes, com.sun.jna.Pointer seconds, com.sun.jna.Pointer fractions, int timeZoneBufferLength, com.sun.jna.Pointer timeZoneBuffer) { try { - return obj.getInt128(status); + obj.decodeTimeStampTzEx(status, timeStampTz, year, month, day, hours, minutes, seconds, fractions, timeZoneBufferLength, timeZoneBuffer); } catch (Throwable t) { FbInterfaceException.catchException(status, t); - return null; } } }; @@ -12203,19 +13948,19 @@ public VTable() public Callback_setOffsets setOffsets; public Callback_getDecFloat16 getDecFloat16; public Callback_getDecFloat34 getDecFloat34; - public Callback_getTransactionByHandle getTransactionByHandle; - public Callback_getStatementByHandle getStatementByHandle; public Callback_decodeTimeTz decodeTimeTz; public Callback_decodeTimeStampTz decodeTimeStampTz; public Callback_encodeTimeTz encodeTimeTz; public Callback_encodeTimeStampTz encodeTimeStampTz; public Callback_getInt128 getInt128; + public Callback_decodeTimeTzEx decodeTimeTzEx; + public Callback_decodeTimeStampTzEx decodeTimeStampTzEx; @Override protected java.util.List getFieldOrder() { java.util.List fields = super.getFieldOrder(); - fields.addAll(java.util.Arrays.asList("getFbVersion", "loadBlob", "dumpBlob", "getPerfCounters", "executeCreateDatabase", "decodeDate", "decodeTime", "encodeDate", "encodeTime", "formatStatus", "getClientVersion", "getXpbBuilder", "setOffsets", "getDecFloat16", "getDecFloat34", "getTransactionByHandle", "getStatementByHandle", "decodeTimeTz", "decodeTimeStampTz", "encodeTimeTz", "encodeTimeStampTz", "getInt128")); + fields.addAll(java.util.Arrays.asList("getFbVersion", "loadBlob", "dumpBlob", "getPerfCounters", "executeCreateDatabase", "decodeDate", "decodeTime", "encodeDate", "encodeTime", "formatStatus", "getClientVersion", "getXpbBuilder", "setOffsets", "getDecFloat16", "getDecFloat34", "decodeTimeTz", "decodeTimeStampTz", "encodeTimeTz", "encodeTimeStampTz", "getInt128", "decodeTimeTzEx", "decodeTimeStampTzEx")); return fields; } } @@ -12241,30 +13986,50 @@ protected VTable createVTable() public void getFbVersion(IStatus status, IAttachment att, IVersionCallback callback) { VTable vTable = getVTable(); + if (vTable.getFbVersion == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IUtilIntf.VERSION); + return; + } vTable.getFbVersion.invoke(this, status, att, callback); } public void loadBlob(IStatus status, com.sun.jna.ptr.LongByReference blobId, IAttachment att, ITransaction tra, String file, boolean txt) { VTable vTable = getVTable(); + if (vTable.loadBlob == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IUtilIntf.VERSION); + return; + } vTable.loadBlob.invoke(this, status, blobId, att, tra, file, txt); } public void dumpBlob(IStatus status, com.sun.jna.ptr.LongByReference blobId, IAttachment att, ITransaction tra, String file, boolean txt) { VTable vTable = getVTable(); + if (vTable.dumpBlob == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IUtilIntf.VERSION); + return; + } vTable.dumpBlob.invoke(this, status, blobId, att, tra, file, txt); } public void getPerfCounters(IStatus status, IAttachment att, String countersSet, long[] counters) { VTable vTable = getVTable(); + if (vTable.getPerfCounters == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IUtilIntf.VERSION); + return; + } vTable.getPerfCounters.invoke(this, status, att, countersSet, counters); } public IAttachment executeCreateDatabase(IStatus status, int stmtLength, String creatDBstatement, int dialect, boolean[] stmtIsCreateDb) { VTable vTable = getVTable(); + if (vTable.executeCreateDatabase == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IUtilIntf.VERSION); + return null; + } IAttachment result = vTable.executeCreateDatabase.invoke(this, status, stmtLength, creatDBstatement, dialect, stmtIsCreateDb); return result; } @@ -12272,18 +14037,27 @@ public IAttachment executeCreateDatabase(IStatus status, int stmtLength, String public void decodeDate(ISC_DATE date, com.sun.jna.Pointer year, com.sun.jna.Pointer month, com.sun.jna.Pointer day) { VTable vTable = getVTable(); + if (vTable.decodeDate == null) { + return; + } vTable.decodeDate.invoke(this, date, year, month, day); } public void decodeTime(ISC_TIME time, com.sun.jna.Pointer hours, com.sun.jna.Pointer minutes, com.sun.jna.Pointer seconds, com.sun.jna.Pointer fractions) { VTable vTable = getVTable(); + if (vTable.decodeTime == null) { + return; + } vTable.decodeTime.invoke(this, time, hours, minutes, seconds, fractions); } public ISC_DATE encodeDate(int year, int month, int day) { VTable vTable = getVTable(); + if (vTable.encodeDate == null) { + return null; + } ISC_DATE result = vTable.encodeDate.invoke(this, year, month, day); return result; } @@ -12291,6 +14065,9 @@ public ISC_DATE encodeDate(int year, int month, int day) public ISC_TIME encodeTime(int hours, int minutes, int seconds, int fractions) { VTable vTable = getVTable(); + if (vTable.encodeTime == null) { + return null; + } ISC_TIME result = vTable.encodeTime.invoke(this, hours, minutes, seconds, fractions); return result; } @@ -12298,6 +14075,9 @@ public ISC_TIME encodeTime(int hours, int minutes, int seconds, int fractions) public int formatStatus(com.sun.jna.Pointer buffer, int bufferSize, IStatus status) { VTable vTable = getVTable(); + if (vTable.formatStatus == null) { + return 0; + } int result = vTable.formatStatus.invoke(this, buffer, bufferSize, status); return result; } @@ -12305,6 +14085,9 @@ public int formatStatus(com.sun.jna.Pointer buffer, int bufferSize, IStatus stat public int getClientVersion() { VTable vTable = getVTable(); + if (vTable.getClientVersion == null) { + return 0; + } int result = vTable.getClientVersion.invoke(this); return result; } @@ -12312,6 +14095,10 @@ public int getClientVersion() public IXpbBuilder getXpbBuilder(IStatus status, int kind, byte[] buf, int len) { VTable vTable = getVTable(); + if (vTable.getXpbBuilder == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IUtilIntf.VERSION); + return null; + } IXpbBuilder result = vTable.getXpbBuilder.invoke(this, status, kind, buf, len); return result; } @@ -12319,6 +14106,10 @@ public IXpbBuilder getXpbBuilder(IStatus status, int kind, byte[] buf, int len) public int setOffsets(IStatus status, IMessageMetadata metadata, IOffsetsCallback callback) { VTable vTable = getVTable(); + if (vTable.setOffsets == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IUtilIntf.VERSION); + return 0; + } int result = vTable.setOffsets.invoke(this, status, metadata, callback); return result; } @@ -12326,6 +14117,10 @@ public int setOffsets(IStatus status, IMessageMetadata metadata, IOffsetsCallbac public IDecFloat16 getDecFloat16(IStatus status) { VTable vTable = getVTable(); + if (vTable.getDecFloat16 == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IUtilIntf.VERSION); + return null; + } IDecFloat16 result = vTable.getDecFloat16.invoke(this, status); return result; } @@ -12333,54 +14128,84 @@ public IDecFloat16 getDecFloat16(IStatus status) public IDecFloat34 getDecFloat34(IStatus status) { VTable vTable = getVTable(); + if (vTable.getDecFloat34 == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IUtilIntf.VERSION); + return null; + } IDecFloat34 result = vTable.getDecFloat34.invoke(this, status); return result; } - public ITransaction getTransactionByHandle(IStatus status, com.sun.jna.ptr.LongByReference hndlPtr) - { - VTable vTable = getVTable(); - ITransaction result = vTable.getTransactionByHandle.invoke(this, status, hndlPtr); - return result; - } - - public IStatement getStatementByHandle(IStatus status, com.sun.jna.ptr.LongByReference hndlPtr) - { - VTable vTable = getVTable(); - IStatement result = vTable.getStatementByHandle.invoke(this, status, hndlPtr); - return result; - } - public void decodeTimeTz(IStatus status, ISC_TIME_TZ[] timeTz, com.sun.jna.Pointer hours, com.sun.jna.Pointer minutes, com.sun.jna.Pointer seconds, com.sun.jna.Pointer fractions, int timeZoneBufferLength, com.sun.jna.Pointer timeZoneBuffer) { VTable vTable = getVTable(); + if (vTable.decodeTimeTz == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IUtilIntf.VERSION); + return; + } vTable.decodeTimeTz.invoke(this, status, timeTz, hours, minutes, seconds, fractions, timeZoneBufferLength, timeZoneBuffer); } public void decodeTimeStampTz(IStatus status, ISC_TIMESTAMP_TZ[] timeStampTz, com.sun.jna.Pointer year, com.sun.jna.Pointer month, com.sun.jna.Pointer day, com.sun.jna.Pointer hours, com.sun.jna.Pointer minutes, com.sun.jna.Pointer seconds, com.sun.jna.Pointer fractions, int timeZoneBufferLength, com.sun.jna.Pointer timeZoneBuffer) { VTable vTable = getVTable(); + if (vTable.decodeTimeStampTz == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IUtilIntf.VERSION); + return; + } vTable.decodeTimeStampTz.invoke(this, status, timeStampTz, year, month, day, hours, minutes, seconds, fractions, timeZoneBufferLength, timeZoneBuffer); } public void encodeTimeTz(IStatus status, ISC_TIME_TZ[] timeTz, int hours, int minutes, int seconds, int fractions, String timeZone) { VTable vTable = getVTable(); + if (vTable.encodeTimeTz == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IUtilIntf.VERSION); + return; + } vTable.encodeTimeTz.invoke(this, status, timeTz, hours, minutes, seconds, fractions, timeZone); } public void encodeTimeStampTz(IStatus status, ISC_TIMESTAMP_TZ[] timeStampTz, int year, int month, int day, int hours, int minutes, int seconds, int fractions, String timeZone) { VTable vTable = getVTable(); + if (vTable.encodeTimeStampTz == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IUtilIntf.VERSION); + return; + } vTable.encodeTimeStampTz.invoke(this, status, timeStampTz, year, month, day, hours, minutes, seconds, fractions, timeZone); } public IInt128 getInt128(IStatus status) { VTable vTable = getVTable(); + if (vTable.getInt128 == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IUtilIntf.VERSION); + return null; + } IInt128 result = vTable.getInt128.invoke(this, status); return result; } + + public void decodeTimeTzEx(IStatus status, ISC_TIME_TZ_EX[] timeTz, com.sun.jna.Pointer hours, com.sun.jna.Pointer minutes, com.sun.jna.Pointer seconds, com.sun.jna.Pointer fractions, int timeZoneBufferLength, com.sun.jna.Pointer timeZoneBuffer) + { + VTable vTable = getVTable(); + if (vTable.decodeTimeTzEx == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IUtilIntf.VERSION); + return; + } + vTable.decodeTimeTzEx.invoke(this, status, timeTz, hours, minutes, seconds, fractions, timeZoneBufferLength, timeZoneBuffer); + } + + public void decodeTimeStampTzEx(IStatus status, ISC_TIMESTAMP_TZ_EX[] timeStampTz, com.sun.jna.Pointer year, com.sun.jna.Pointer month, com.sun.jna.Pointer day, com.sun.jna.Pointer hours, com.sun.jna.Pointer minutes, com.sun.jna.Pointer seconds, com.sun.jna.Pointer fractions, int timeZoneBufferLength, com.sun.jna.Pointer timeZoneBuffer) + { + VTable vTable = getVTable(); + if (vTable.decodeTimeStampTzEx == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IUtilIntf.VERSION); + return; + } + vTable.decodeTimeStampTzEx.invoke(this, status, timeStampTz, year, month, day, hours, minutes, seconds, fractions, timeZoneBufferLength, timeZoneBuffer); + } } public static class IOffsetsCallback extends IVersioned implements IOffsetsCallbackIntf @@ -12453,6 +14278,10 @@ protected VTable createVTable() public void setOffset(IStatus status, int index, int offset, int nullOffset) { VTable vTable = getVTable(); + if (vTable.setOffset == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IOffsetsCallbackIntf.VERSION); + return; + } vTable.setOffset.invoke(this, status, index, offset, nullOffset); } } @@ -12937,48 +14766,80 @@ protected VTable createVTable() public void clear(IStatus status) { VTable vTable = getVTable(); + if (vTable.clear == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IXpbBuilderIntf.VERSION); + return; + } vTable.clear.invoke(this, status); } public void removeCurrent(IStatus status) { VTable vTable = getVTable(); + if (vTable.removeCurrent == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IXpbBuilderIntf.VERSION); + return; + } vTable.removeCurrent.invoke(this, status); } public void insertInt(IStatus status, byte tag, int value) { VTable vTable = getVTable(); + if (vTable.insertInt == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IXpbBuilderIntf.VERSION); + return; + } vTable.insertInt.invoke(this, status, tag, value); } public void insertBigInt(IStatus status, byte tag, long value) { VTable vTable = getVTable(); + if (vTable.insertBigInt == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IXpbBuilderIntf.VERSION); + return; + } vTable.insertBigInt.invoke(this, status, tag, value); } public void insertBytes(IStatus status, byte tag, com.sun.jna.Pointer bytes, int length) { VTable vTable = getVTable(); + if (vTable.insertBytes == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IXpbBuilderIntf.VERSION); + return; + } vTable.insertBytes.invoke(this, status, tag, bytes, length); } public void insertString(IStatus status, byte tag, String str) { VTable vTable = getVTable(); + if (vTable.insertString == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IXpbBuilderIntf.VERSION); + return; + } vTable.insertString.invoke(this, status, tag, str); } public void insertTag(IStatus status, byte tag) { VTable vTable = getVTable(); + if (vTable.insertTag == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IXpbBuilderIntf.VERSION); + return; + } vTable.insertTag.invoke(this, status, tag); } public boolean isEof(IStatus status) { VTable vTable = getVTable(); + if (vTable.isEof == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IXpbBuilderIntf.VERSION); + return false; + } boolean result = vTable.isEof.invoke(this, status); return result; } @@ -12986,18 +14847,30 @@ public boolean isEof(IStatus status) public void moveNext(IStatus status) { VTable vTable = getVTable(); + if (vTable.moveNext == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IXpbBuilderIntf.VERSION); + return; + } vTable.moveNext.invoke(this, status); } public void rewind(IStatus status) { VTable vTable = getVTable(); + if (vTable.rewind == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IXpbBuilderIntf.VERSION); + return; + } vTable.rewind.invoke(this, status); } public boolean findFirst(IStatus status, byte tag) { VTable vTable = getVTable(); + if (vTable.findFirst == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IXpbBuilderIntf.VERSION); + return false; + } boolean result = vTable.findFirst.invoke(this, status, tag); return result; } @@ -13005,6 +14878,10 @@ public boolean findFirst(IStatus status, byte tag) public boolean findNext(IStatus status) { VTable vTable = getVTable(); + if (vTable.findNext == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IXpbBuilderIntf.VERSION); + return false; + } boolean result = vTable.findNext.invoke(this, status); return result; } @@ -13012,6 +14889,10 @@ public boolean findNext(IStatus status) public byte getTag(IStatus status) { VTable vTable = getVTable(); + if (vTable.getTag == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IXpbBuilderIntf.VERSION); + return (byte) 0; + } byte result = vTable.getTag.invoke(this, status); return result; } @@ -13019,6 +14900,10 @@ public byte getTag(IStatus status) public int getLength(IStatus status) { VTable vTable = getVTable(); + if (vTable.getLength == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IXpbBuilderIntf.VERSION); + return 0; + } int result = vTable.getLength.invoke(this, status); return result; } @@ -13026,6 +14911,10 @@ public int getLength(IStatus status) public int getInt(IStatus status) { VTable vTable = getVTable(); + if (vTable.getInt == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IXpbBuilderIntf.VERSION); + return 0; + } int result = vTable.getInt.invoke(this, status); return result; } @@ -13033,6 +14922,10 @@ public int getInt(IStatus status) public long getBigInt(IStatus status) { VTable vTable = getVTable(); + if (vTable.getBigInt == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IXpbBuilderIntf.VERSION); + return 0; + } long result = vTable.getBigInt.invoke(this, status); return result; } @@ -13040,6 +14933,10 @@ public long getBigInt(IStatus status) public String getString(IStatus status) { VTable vTable = getVTable(); + if (vTable.getString == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IXpbBuilderIntf.VERSION); + return null; + } String result = vTable.getString.invoke(this, status); return result; } @@ -13047,6 +14944,10 @@ public String getString(IStatus status) public com.sun.jna.Pointer getBytes(IStatus status) { VTable vTable = getVTable(); + if (vTable.getBytes == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IXpbBuilderIntf.VERSION); + return null; + } com.sun.jna.Pointer result = vTable.getBytes.invoke(this, status); return result; } @@ -13054,6 +14955,10 @@ public com.sun.jna.Pointer getBytes(IStatus status) public int getBufferLength(IStatus status) { VTable vTable = getVTable(); + if (vTable.getBufferLength == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IXpbBuilderIntf.VERSION); + return 0; + } int result = vTable.getBufferLength.invoke(this, status); return result; } @@ -13061,6 +14966,10 @@ public int getBufferLength(IStatus status) public com.sun.jna.Pointer getBuffer(IStatus status) { VTable vTable = getVTable(); + if (vTable.getBuffer == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IXpbBuilderIntf.VERSION); + return null; + } com.sun.jna.Pointer result = vTable.getBuffer.invoke(this, status); return result; } @@ -13105,6 +15014,11 @@ public static interface Callback_getRemoteAddress extends com.sun.jna.Callback public String invoke(ITraceConnection self); } + public static interface Callback_getRemoteHwAddress extends com.sun.jna.Callback + { + public String invoke(ITraceConnection self); + } + public static interface Callback_getRemoteProcessID extends com.sun.jna.Callback { public int invoke(ITraceConnection self); @@ -13180,6 +15094,14 @@ public String invoke(ITraceConnection self) } }; + getRemoteHwAddress = new Callback_getRemoteHwAddress() { + @Override + public String invoke(ITraceConnection self) + { + return obj.getRemoteHwAddress(); + } + }; + getRemoteProcessID = new Callback_getRemoteProcessID() { @Override public int invoke(ITraceConnection self) @@ -13208,6 +15130,7 @@ public VTable() public Callback_getCharSet getCharSet; public Callback_getRemoteProtocol getRemoteProtocol; public Callback_getRemoteAddress getRemoteAddress; + public Callback_getRemoteHwAddress getRemoteHwAddress; public Callback_getRemoteProcessID getRemoteProcessID; public Callback_getRemoteProcessName getRemoteProcessName; @@ -13215,7 +15138,7 @@ public VTable() protected java.util.List getFieldOrder() { java.util.List fields = super.getFieldOrder(); - fields.addAll(java.util.Arrays.asList("getKind", "getProcessID", "getUserName", "getRoleName", "getCharSet", "getRemoteProtocol", "getRemoteAddress", "getRemoteProcessID", "getRemoteProcessName")); + fields.addAll(java.util.Arrays.asList("getKind", "getProcessID", "getUserName", "getRoleName", "getCharSet", "getRemoteProtocol", "getRemoteAddress", "getRemoteHwAddress", "getRemoteProcessID", "getRemoteProcessName")); return fields; } } @@ -13241,6 +15164,9 @@ protected VTable createVTable() public int getKind() { VTable vTable = getVTable(); + if (vTable.getKind == null) { + return 0; + } int result = vTable.getKind.invoke(this); return result; } @@ -13248,6 +15174,9 @@ public int getKind() public int getProcessID() { VTable vTable = getVTable(); + if (vTable.getProcessID == null) { + return 0; + } int result = vTable.getProcessID.invoke(this); return result; } @@ -13255,6 +15184,9 @@ public int getProcessID() public String getUserName() { VTable vTable = getVTable(); + if (vTable.getUserName == null) { + return null; + } String result = vTable.getUserName.invoke(this); return result; } @@ -13262,6 +15194,9 @@ public String getUserName() public String getRoleName() { VTable vTable = getVTable(); + if (vTable.getRoleName == null) { + return null; + } String result = vTable.getRoleName.invoke(this); return result; } @@ -13269,6 +15204,9 @@ public String getRoleName() public String getCharSet() { VTable vTable = getVTable(); + if (vTable.getCharSet == null) { + return null; + } String result = vTable.getCharSet.invoke(this); return result; } @@ -13276,6 +15214,9 @@ public String getCharSet() public String getRemoteProtocol() { VTable vTable = getVTable(); + if (vTable.getRemoteProtocol == null) { + return null; + } String result = vTable.getRemoteProtocol.invoke(this); return result; } @@ -13283,13 +15224,29 @@ public String getRemoteProtocol() public String getRemoteAddress() { VTable vTable = getVTable(); + if (vTable.getRemoteAddress == null) { + return null; + } String result = vTable.getRemoteAddress.invoke(this); return result; } + public String getRemoteHwAddress() + { + VTable vTable = getVTable(); + if (vTable.getRemoteHwAddress == null) { + return null; + } + String result = vTable.getRemoteHwAddress.invoke(this); + return result; + } + public int getRemoteProcessID() { VTable vTable = getVTable(); + if (vTable.getRemoteProcessID == null) { + return 0; + } int result = vTable.getRemoteProcessID.invoke(this); return result; } @@ -13297,6 +15254,9 @@ public int getRemoteProcessID() public String getRemoteProcessName() { VTable vTable = getVTable(); + if (vTable.getRemoteProcessName == null) { + return null; + } String result = vTable.getRemoteProcessName.invoke(this); return result; } @@ -13379,6 +15339,9 @@ protected VTable createVTable() public long getConnectionID() { VTable vTable = getVTable(); + if (vTable.getConnectionID == null) { + return 0; + } long result = vTable.getConnectionID.invoke(this); return result; } @@ -13386,6 +15349,9 @@ public long getConnectionID() public String getDatabaseName() { VTable vTable = getVTable(); + if (vTable.getDatabaseName == null) { + return null; + } String result = vTable.getDatabaseName.invoke(this); return result; } @@ -13420,6 +15386,16 @@ public static interface Callback_getPerf extends com.sun.jna.Callback public com.sun.jna.Pointer invoke(ITraceTransaction self); } + public static interface Callback_getInitialID extends com.sun.jna.Callback + { + public long invoke(ITraceTransaction self); + } + + public static interface Callback_getPreviousID extends com.sun.jna.Callback + { + public long invoke(ITraceTransaction self); + } + public VTable(com.sun.jna.Pointer pointer) { super(pointer); @@ -13468,6 +15444,22 @@ public com.sun.jna.Pointer invoke(ITraceTransaction self) return obj.getPerf(); } }; + + getInitialID = new Callback_getInitialID() { + @Override + public long invoke(ITraceTransaction self) + { + return obj.getInitialID(); + } + }; + + getPreviousID = new Callback_getPreviousID() { + @Override + public long invoke(ITraceTransaction self) + { + return obj.getPreviousID(); + } + }; } public VTable() @@ -13479,12 +15471,14 @@ public VTable() public Callback_getWait getWait; public Callback_getIsolation getIsolation; public Callback_getPerf getPerf; + public Callback_getInitialID getInitialID; + public Callback_getPreviousID getPreviousID; @Override protected java.util.List getFieldOrder() { java.util.List fields = super.getFieldOrder(); - fields.addAll(java.util.Arrays.asList("getTransactionID", "getReadOnly", "getWait", "getIsolation", "getPerf")); + fields.addAll(java.util.Arrays.asList("getTransactionID", "getReadOnly", "getWait", "getIsolation", "getPerf", "getInitialID", "getPreviousID")); return fields; } } @@ -13510,6 +15504,9 @@ protected VTable createVTable() public long getTransactionID() { VTable vTable = getVTable(); + if (vTable.getTransactionID == null) { + return 0; + } long result = vTable.getTransactionID.invoke(this); return result; } @@ -13517,6 +15514,9 @@ public long getTransactionID() public boolean getReadOnly() { VTable vTable = getVTable(); + if (vTable.getReadOnly == null) { + return false; + } boolean result = vTable.getReadOnly.invoke(this); return result; } @@ -13524,6 +15524,9 @@ public boolean getReadOnly() public int getWait() { VTable vTable = getVTable(); + if (vTable.getWait == null) { + return 0; + } int result = vTable.getWait.invoke(this); return result; } @@ -13531,6 +15534,9 @@ public int getWait() public int getIsolation() { VTable vTable = getVTable(); + if (vTable.getIsolation == null) { + return 0; + } int result = vTable.getIsolation.invoke(this); return result; } @@ -13538,9 +15544,32 @@ public int getIsolation() public com.sun.jna.Pointer getPerf() { VTable vTable = getVTable(); + if (vTable.getPerf == null) { + return null; + } com.sun.jna.Pointer result = vTable.getPerf.invoke(this); return result; } + + public long getInitialID() + { + VTable vTable = getVTable(); + if (vTable.getInitialID == null) { + return 0; + } + long result = vTable.getInitialID.invoke(this); + return result; + } + + public long getPreviousID() + { + VTable vTable = getVTable(); + if (vTable.getPreviousID == null) { + return 0; + } + long result = vTable.getPreviousID.invoke(this); + return result; + } } public static class ITraceParams extends IVersioned implements ITraceParamsIntf @@ -13642,6 +15671,9 @@ protected VTable createVTable() public int getCount() { VTable vTable = getVTable(); + if (vTable.getCount == null) { + return 0; + } int result = vTable.getCount.invoke(this); return result; } @@ -13649,6 +15681,9 @@ public int getCount() public com.sun.jna.Pointer getParam(int idx) { VTable vTable = getVTable(); + if (vTable.getParam == null) { + return null; + } com.sun.jna.Pointer result = vTable.getParam.invoke(this, idx); return result; } @@ -13656,6 +15691,10 @@ public com.sun.jna.Pointer getParam(int idx) public String getTextUTF8(IStatus status, int idx) { VTable vTable = getVTable(); + if (vTable.getTextUTF8 == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, ITraceParamsIntf.VERSION); + return null; + } String result = vTable.getTextUTF8.invoke(this, status, idx); return result; } @@ -13738,6 +15777,9 @@ protected VTable createVTable() public long getStmtID() { VTable vTable = getVTable(); + if (vTable.getStmtID == null) { + return 0; + } long result = vTable.getStmtID.invoke(this); return result; } @@ -13745,6 +15787,9 @@ public long getStmtID() public com.sun.jna.Pointer getPerf() { VTable vTable = getVTable(); + if (vTable.getPerf == null) { + return null; + } com.sun.jna.Pointer result = vTable.getPerf.invoke(this); return result; } @@ -13869,6 +15914,9 @@ protected VTable createVTable() public String getText() { VTable vTable = getVTable(); + if (vTable.getText == null) { + return null; + } String result = vTable.getText.invoke(this); return result; } @@ -13876,6 +15924,9 @@ public String getText() public String getPlan() { VTable vTable = getVTable(); + if (vTable.getPlan == null) { + return null; + } String result = vTable.getPlan.invoke(this); return result; } @@ -13883,6 +15934,9 @@ public String getPlan() public ITraceParams getInputs() { VTable vTable = getVTable(); + if (vTable.getInputs == null) { + return null; + } ITraceParams result = vTable.getInputs.invoke(this); return result; } @@ -13890,6 +15944,9 @@ public ITraceParams getInputs() public String getTextUTF8() { VTable vTable = getVTable(); + if (vTable.getTextUTF8 == null) { + return null; + } String result = vTable.getTextUTF8.invoke(this); return result; } @@ -13897,6 +15954,9 @@ public String getTextUTF8() public String getExplainedPlan() { VTable vTable = getVTable(); + if (vTable.getExplainedPlan == null) { + return null; + } String result = vTable.getExplainedPlan.invoke(this); return result; } @@ -13993,6 +16053,9 @@ protected VTable createVTable() public com.sun.jna.Pointer getData() { VTable vTable = getVTable(); + if (vTable.getData == null) { + return null; + } com.sun.jna.Pointer result = vTable.getData.invoke(this); return result; } @@ -14000,6 +16063,9 @@ public com.sun.jna.Pointer getData() public int getDataLength() { VTable vTable = getVTable(); + if (vTable.getDataLength == null) { + return 0; + } int result = vTable.getDataLength.invoke(this); return result; } @@ -14007,6 +16073,9 @@ public int getDataLength() public String getText() { VTable vTable = getVTable(); + if (vTable.getText == null) { + return null; + } String result = vTable.getText.invoke(this); return result; } @@ -14103,6 +16172,9 @@ protected VTable createVTable() public com.sun.jna.Pointer getData() { VTable vTable = getVTable(); + if (vTable.getData == null) { + return null; + } com.sun.jna.Pointer result = vTable.getData.invoke(this); return result; } @@ -14110,6 +16182,9 @@ public com.sun.jna.Pointer getData() public int getDataLength() { VTable vTable = getVTable(); + if (vTable.getDataLength == null) { + return 0; + } int result = vTable.getDataLength.invoke(this); return result; } @@ -14117,6 +16192,9 @@ public int getDataLength() public String getText() { VTable vTable = getVTable(); + if (vTable.getText == null) { + return null; + } String result = vTable.getText.invoke(this); return result; } @@ -14213,6 +16291,9 @@ protected VTable createVTable() public String getNameSpace() { VTable vTable = getVTable(); + if (vTable.getNameSpace == null) { + return null; + } String result = vTable.getNameSpace.invoke(this); return result; } @@ -14220,6 +16301,9 @@ public String getNameSpace() public String getVarName() { VTable vTable = getVTable(); + if (vTable.getVarName == null) { + return null; + } String result = vTable.getVarName.invoke(this); return result; } @@ -14227,6 +16311,9 @@ public String getVarName() public String getVarValue() { VTable vTable = getVTable(); + if (vTable.getVarValue == null) { + return null; + } String result = vTable.getVarValue.invoke(this); return result; } @@ -14323,6 +16410,9 @@ protected VTable createVTable() public String getProcName() { VTable vTable = getVTable(); + if (vTable.getProcName == null) { + return null; + } String result = vTable.getProcName.invoke(this); return result; } @@ -14330,6 +16420,9 @@ public String getProcName() public ITraceParams getInputs() { VTable vTable = getVTable(); + if (vTable.getInputs == null) { + return null; + } ITraceParams result = vTable.getInputs.invoke(this); return result; } @@ -14337,6 +16430,9 @@ public ITraceParams getInputs() public com.sun.jna.Pointer getPerf() { VTable vTable = getVTable(); + if (vTable.getPerf == null) { + return null; + } com.sun.jna.Pointer result = vTable.getPerf.invoke(this); return result; } @@ -14447,6 +16543,9 @@ protected VTable createVTable() public String getFuncName() { VTable vTable = getVTable(); + if (vTable.getFuncName == null) { + return null; + } String result = vTable.getFuncName.invoke(this); return result; } @@ -14454,6 +16553,9 @@ public String getFuncName() public ITraceParams getInputs() { VTable vTable = getVTable(); + if (vTable.getInputs == null) { + return null; + } ITraceParams result = vTable.getInputs.invoke(this); return result; } @@ -14461,6 +16563,9 @@ public ITraceParams getInputs() public ITraceParams getResult() { VTable vTable = getVTable(); + if (vTable.getResult == null) { + return null; + } ITraceParams result = vTable.getResult.invoke(this); return result; } @@ -14468,6 +16573,9 @@ public ITraceParams getResult() public com.sun.jna.Pointer getPerf() { VTable vTable = getVTable(); + if (vTable.getPerf == null) { + return null; + } com.sun.jna.Pointer result = vTable.getPerf.invoke(this); return result; } @@ -14592,6 +16700,9 @@ protected VTable createVTable() public String getTriggerName() { VTable vTable = getVTable(); + if (vTable.getTriggerName == null) { + return null; + } String result = vTable.getTriggerName.invoke(this); return result; } @@ -14599,6 +16710,9 @@ public String getTriggerName() public String getRelationName() { VTable vTable = getVTable(); + if (vTable.getRelationName == null) { + return null; + } String result = vTable.getRelationName.invoke(this); return result; } @@ -14606,6 +16720,9 @@ public String getRelationName() public int getAction() { VTable vTable = getVTable(); + if (vTable.getAction == null) { + return 0; + } int result = vTable.getAction.invoke(this); return result; } @@ -14613,6 +16730,9 @@ public int getAction() public int getWhich() { VTable vTable = getVTable(); + if (vTable.getWhich == null) { + return 0; + } int result = vTable.getWhich.invoke(this); return result; } @@ -14620,6 +16740,9 @@ public int getWhich() public com.sun.jna.Pointer getPerf() { VTable vTable = getVTable(); + if (vTable.getPerf == null) { + return null; + } com.sun.jna.Pointer result = vTable.getPerf.invoke(this); return result; } @@ -14716,6 +16839,9 @@ protected VTable createVTable() public com.sun.jna.Pointer getServiceID() { VTable vTable = getVTable(); + if (vTable.getServiceID == null) { + return null; + } com.sun.jna.Pointer result = vTable.getServiceID.invoke(this); return result; } @@ -14723,6 +16849,9 @@ public com.sun.jna.Pointer getServiceID() public String getServiceMgr() { VTable vTable = getVTable(); + if (vTable.getServiceMgr == null) { + return null; + } String result = vTable.getServiceMgr.invoke(this); return result; } @@ -14730,6 +16859,9 @@ public String getServiceMgr() public String getServiceName() { VTable vTable = getVTable(); + if (vTable.getServiceName == null) { + return null; + } String result = vTable.getServiceName.invoke(this); return result; } @@ -14840,6 +16972,9 @@ protected VTable createVTable() public boolean hasError() { VTable vTable = getVTable(); + if (vTable.hasError == null) { + return false; + } boolean result = vTable.hasError.invoke(this); return result; } @@ -14847,6 +16982,9 @@ public boolean hasError() public boolean hasWarning() { VTable vTable = getVTable(); + if (vTable.hasWarning == null) { + return false; + } boolean result = vTable.hasWarning.invoke(this); return result; } @@ -14854,6 +16992,9 @@ public boolean hasWarning() public IStatus getStatus() { VTable vTable = getVTable(); + if (vTable.getStatus == null) { + return null; + } IStatus result = vTable.getStatus.invoke(this); return result; } @@ -14861,6 +17002,9 @@ public IStatus getStatus() public String getText() { VTable vTable = getVTable(); + if (vTable.getText == null) { + return null; + } String result = vTable.getText.invoke(this); return result; } @@ -14985,6 +17129,9 @@ protected VTable createVTable() public long getOIT() { VTable vTable = getVTable(); + if (vTable.getOIT == null) { + return 0; + } long result = vTable.getOIT.invoke(this); return result; } @@ -14992,6 +17139,9 @@ public long getOIT() public long getOST() { VTable vTable = getVTable(); + if (vTable.getOST == null) { + return 0; + } long result = vTable.getOST.invoke(this); return result; } @@ -14999,6 +17149,9 @@ public long getOST() public long getOAT() { VTable vTable = getVTable(); + if (vTable.getOAT == null) { + return 0; + } long result = vTable.getOAT.invoke(this); return result; } @@ -15006,6 +17159,9 @@ public long getOAT() public long getNext() { VTable vTable = getVTable(); + if (vTable.getNext == null) { + return 0; + } long result = vTable.getNext.invoke(this); return result; } @@ -15013,6 +17169,9 @@ public long getNext() public com.sun.jna.Pointer getPerf() { VTable vTable = getVTable(); + if (vTable.getPerf == null) { + return null; + } com.sun.jna.Pointer result = vTable.getPerf.invoke(this); return result; } @@ -15103,6 +17262,9 @@ protected VTable createVTable() public int write(com.sun.jna.Pointer buf, int size) { VTable vTable = getVTable(); + if (vTable.write == null) { + return 0; + } int result = vTable.write.invoke(this, buf, size); return result; } @@ -15110,6 +17272,10 @@ public int write(com.sun.jna.Pointer buf, int size) public int write_s(IStatus status, com.sun.jna.Pointer buf, int size) { VTable vTable = getVTable(); + if (vTable.write_s == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, ITraceLogWriterIntf.VERSION); + return 0; + } int result = vTable.write_s.invoke(this, status, buf, size); return result; } @@ -15134,6 +17300,11 @@ public static interface Callback_getTraceSessionName extends com.sun.jna.Callbac public String invoke(ITraceInitInfo self); } + public static interface Callback_getTraceSessionFlags extends com.sun.jna.Callback + { + public int invoke(ITraceInitInfo self); + } + public static interface Callback_getFirebirdRootDirectory extends com.sun.jna.Callback { public String invoke(ITraceInitInfo self); @@ -15149,6 +17320,11 @@ public static interface Callback_getConnection extends com.sun.jna.Callback public ITraceDatabaseConnection invoke(ITraceInitInfo self); } + public static interface Callback_getService extends com.sun.jna.Callback + { + public ITraceServiceConnection invoke(ITraceInitInfo self); + } + public static interface Callback_getLogWriter extends com.sun.jna.Callback { public ITraceLogWriter invoke(ITraceInitInfo self); @@ -15187,6 +17363,14 @@ public String invoke(ITraceInitInfo self) } }; + getTraceSessionFlags = new Callback_getTraceSessionFlags() { + @Override + public int invoke(ITraceInitInfo self) + { + return obj.getTraceSessionFlags(); + } + }; + getFirebirdRootDirectory = new Callback_getFirebirdRootDirectory() { @Override public String invoke(ITraceInitInfo self) @@ -15211,6 +17395,14 @@ public ITraceDatabaseConnection invoke(ITraceInitInfo self) } }; + getService = new Callback_getService() { + @Override + public ITraceServiceConnection invoke(ITraceInitInfo self) + { + return obj.getService(); + } + }; + getLogWriter = new Callback_getLogWriter() { @Override public ITraceLogWriter invoke(ITraceInitInfo self) @@ -15227,16 +17419,18 @@ public VTable() public Callback_getConfigText getConfigText; public Callback_getTraceSessionID getTraceSessionID; public Callback_getTraceSessionName getTraceSessionName; + public Callback_getTraceSessionFlags getTraceSessionFlags; public Callback_getFirebirdRootDirectory getFirebirdRootDirectory; public Callback_getDatabaseName getDatabaseName; public Callback_getConnection getConnection; + public Callback_getService getService; public Callback_getLogWriter getLogWriter; @Override protected java.util.List getFieldOrder() { java.util.List fields = super.getFieldOrder(); - fields.addAll(java.util.Arrays.asList("getConfigText", "getTraceSessionID", "getTraceSessionName", "getFirebirdRootDirectory", "getDatabaseName", "getConnection", "getLogWriter")); + fields.addAll(java.util.Arrays.asList("getConfigText", "getTraceSessionID", "getTraceSessionName", "getTraceSessionFlags", "getFirebirdRootDirectory", "getDatabaseName", "getConnection", "getService", "getLogWriter")); return fields; } } @@ -15262,6 +17456,9 @@ protected VTable createVTable() public String getConfigText() { VTable vTable = getVTable(); + if (vTable.getConfigText == null) { + return null; + } String result = vTable.getConfigText.invoke(this); return result; } @@ -15269,6 +17466,9 @@ public String getConfigText() public int getTraceSessionID() { VTable vTable = getVTable(); + if (vTable.getTraceSessionID == null) { + return 0; + } int result = vTable.getTraceSessionID.invoke(this); return result; } @@ -15276,13 +17476,29 @@ public int getTraceSessionID() public String getTraceSessionName() { VTable vTable = getVTable(); + if (vTable.getTraceSessionName == null) { + return null; + } String result = vTable.getTraceSessionName.invoke(this); return result; } + public int getTraceSessionFlags() + { + VTable vTable = getVTable(); + if (vTable.getTraceSessionFlags == null) { + return 0; + } + int result = vTable.getTraceSessionFlags.invoke(this); + return result; + } + public String getFirebirdRootDirectory() { VTable vTable = getVTable(); + if (vTable.getFirebirdRootDirectory == null) { + return null; + } String result = vTable.getFirebirdRootDirectory.invoke(this); return result; } @@ -15290,6 +17506,9 @@ public String getFirebirdRootDirectory() public String getDatabaseName() { VTable vTable = getVTable(); + if (vTable.getDatabaseName == null) { + return null; + } String result = vTable.getDatabaseName.invoke(this); return result; } @@ -15297,13 +17516,29 @@ public String getDatabaseName() public ITraceDatabaseConnection getConnection() { VTable vTable = getVTable(); + if (vTable.getConnection == null) { + return null; + } ITraceDatabaseConnection result = vTable.getConnection.invoke(this); return result; } + public ITraceServiceConnection getService() + { + VTable vTable = getVTable(); + if (vTable.getService == null) { + return null; + } + ITraceServiceConnection result = vTable.getService.invoke(this); + return result; + } + public ITraceLogWriter getLogWriter() { VTable vTable = getVTable(); + if (vTable.getLogWriter == null) { + return null; + } ITraceLogWriter result = vTable.getLogWriter.invoke(this); return result; } @@ -15320,7 +17555,7 @@ public static interface Callback_trace_get_error extends com.sun.jna.Callback public static interface Callback_trace_attach extends com.sun.jna.Callback { - public boolean invoke(ITracePlugin self, ITraceDatabaseConnection connection, boolean create_db, int att_result); + public boolean invoke(ITracePlugin self, ITraceDatabaseConnection connection, boolean create_db, int dpb_length, byte[] dpb, int att_result); } public static interface Callback_trace_detach extends com.sun.jna.Callback @@ -15385,7 +17620,7 @@ public static interface Callback_trace_dyn_execute extends com.sun.jna.Callback public static interface Callback_trace_service_attach extends com.sun.jna.Callback { - public boolean invoke(ITracePlugin self, ITraceServiceConnection service, int att_result); + public boolean invoke(ITracePlugin self, ITraceServiceConnection service, int spb_length, byte[] spb, int att_result); } public static interface Callback_trace_service_start extends com.sun.jna.Callback @@ -15418,6 +17653,11 @@ public static interface Callback_trace_func_execute extends com.sun.jna.Callback public boolean invoke(ITracePlugin self, ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceFunction function, boolean started, int func_result); } + public static interface Callback_trace_privilege_change extends com.sun.jna.Callback + { + public boolean invoke(ITracePlugin self, ITraceDatabaseConnection connection, ITraceTransaction transaction, String executor, String grantor, boolean is_grant, String object_name, String field_name, String user_name, String privileges, int options, int change_result); + } + public VTable(com.sun.jna.Pointer pointer) { super(pointer); @@ -15437,9 +17677,9 @@ public String invoke(ITracePlugin self) trace_attach = new Callback_trace_attach() { @Override - public boolean invoke(ITracePlugin self, ITraceDatabaseConnection connection, boolean create_db, int att_result) + public boolean invoke(ITracePlugin self, ITraceDatabaseConnection connection, boolean create_db, int dpb_length, byte[] dpb, int att_result) { - return obj.trace_attach(connection, create_db, att_result); + return obj.trace_attach(connection, create_db, dpb_length, dpb, att_result); } }; @@ -15541,9 +17781,9 @@ public boolean invoke(ITracePlugin self, ITraceDatabaseConnection connection, IT trace_service_attach = new Callback_trace_service_attach() { @Override - public boolean invoke(ITracePlugin self, ITraceServiceConnection service, int att_result) + public boolean invoke(ITracePlugin self, ITraceServiceConnection service, int spb_length, byte[] spb, int att_result) { - return obj.trace_service_attach(service, att_result); + return obj.trace_service_attach(service, spb_length, spb, att_result); } }; @@ -15594,6 +17834,14 @@ public boolean invoke(ITracePlugin self, ITraceDatabaseConnection connection, IT return obj.trace_func_execute(connection, transaction, function, started, func_result); } }; + + trace_privilege_change = new Callback_trace_privilege_change() { + @Override + public boolean invoke(ITracePlugin self, ITraceDatabaseConnection connection, ITraceTransaction transaction, String executor, String grantor, boolean is_grant, String object_name, String field_name, String user_name, String privileges, int options, int change_result) + { + return obj.trace_privilege_change(connection, transaction, executor, grantor, is_grant, object_name, field_name, user_name, privileges, options, change_result); + } + }; } public VTable() @@ -15621,12 +17869,13 @@ public VTable() public Callback_trace_event_error trace_event_error; public Callback_trace_event_sweep trace_event_sweep; public Callback_trace_func_execute trace_func_execute; + public Callback_trace_privilege_change trace_privilege_change; @Override protected java.util.List getFieldOrder() { java.util.List fields = super.getFieldOrder(); - fields.addAll(java.util.Arrays.asList("trace_get_error", "trace_attach", "trace_detach", "trace_transaction_start", "trace_transaction_end", "trace_proc_execute", "trace_trigger_execute", "trace_set_context", "trace_dsql_prepare", "trace_dsql_free", "trace_dsql_execute", "trace_blr_compile", "trace_blr_execute", "trace_dyn_execute", "trace_service_attach", "trace_service_start", "trace_service_query", "trace_service_detach", "trace_event_error", "trace_event_sweep", "trace_func_execute")); + fields.addAll(java.util.Arrays.asList("trace_get_error", "trace_attach", "trace_detach", "trace_transaction_start", "trace_transaction_end", "trace_proc_execute", "trace_trigger_execute", "trace_set_context", "trace_dsql_prepare", "trace_dsql_free", "trace_dsql_execute", "trace_blr_compile", "trace_blr_execute", "trace_dyn_execute", "trace_service_attach", "trace_service_start", "trace_service_query", "trace_service_detach", "trace_event_error", "trace_event_sweep", "trace_func_execute", "trace_privilege_change")); return fields; } } @@ -15652,20 +17901,29 @@ protected VTable createVTable() public String trace_get_error() { VTable vTable = getVTable(); + if (vTable.trace_get_error == null) { + return null; + } String result = vTable.trace_get_error.invoke(this); return result; } - public boolean trace_attach(ITraceDatabaseConnection connection, boolean create_db, int att_result) + public boolean trace_attach(ITraceDatabaseConnection connection, boolean create_db, int dpb_length, byte[] dpb, int att_result) { VTable vTable = getVTable(); - boolean result = vTable.trace_attach.invoke(this, connection, create_db, att_result); + if (vTable.trace_attach == null) { + return false; + } + boolean result = vTable.trace_attach.invoke(this, connection, create_db, dpb_length, dpb, att_result); return result; } public boolean trace_detach(ITraceDatabaseConnection connection, boolean drop_db) { VTable vTable = getVTable(); + if (vTable.trace_detach == null) { + return false; + } boolean result = vTable.trace_detach.invoke(this, connection, drop_db); return result; } @@ -15673,6 +17931,9 @@ public boolean trace_detach(ITraceDatabaseConnection connection, boolean drop_db public boolean trace_transaction_start(ITraceDatabaseConnection connection, ITraceTransaction transaction, int tpb_length, byte[] tpb, int tra_result) { VTable vTable = getVTable(); + if (vTable.trace_transaction_start == null) { + return false; + } boolean result = vTable.trace_transaction_start.invoke(this, connection, transaction, tpb_length, tpb, tra_result); return result; } @@ -15680,6 +17941,9 @@ public boolean trace_transaction_start(ITraceDatabaseConnection connection, ITra public boolean trace_transaction_end(ITraceDatabaseConnection connection, ITraceTransaction transaction, boolean commit, boolean retain_context, int tra_result) { VTable vTable = getVTable(); + if (vTable.trace_transaction_end == null) { + return false; + } boolean result = vTable.trace_transaction_end.invoke(this, connection, transaction, commit, retain_context, tra_result); return result; } @@ -15687,6 +17951,9 @@ public boolean trace_transaction_end(ITraceDatabaseConnection connection, ITrace public boolean trace_proc_execute(ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceProcedure procedure, boolean started, int proc_result) { VTable vTable = getVTable(); + if (vTable.trace_proc_execute == null) { + return false; + } boolean result = vTable.trace_proc_execute.invoke(this, connection, transaction, procedure, started, proc_result); return result; } @@ -15694,6 +17961,9 @@ public boolean trace_proc_execute(ITraceDatabaseConnection connection, ITraceTra public boolean trace_trigger_execute(ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceTrigger trigger, boolean started, int trig_result) { VTable vTable = getVTable(); + if (vTable.trace_trigger_execute == null) { + return false; + } boolean result = vTable.trace_trigger_execute.invoke(this, connection, transaction, trigger, started, trig_result); return result; } @@ -15701,6 +17971,9 @@ public boolean trace_trigger_execute(ITraceDatabaseConnection connection, ITrace public boolean trace_set_context(ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceContextVariable variable) { VTable vTable = getVTable(); + if (vTable.trace_set_context == null) { + return false; + } boolean result = vTable.trace_set_context.invoke(this, connection, transaction, variable); return result; } @@ -15708,6 +17981,9 @@ public boolean trace_set_context(ITraceDatabaseConnection connection, ITraceTran public boolean trace_dsql_prepare(ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceSQLStatement statement, long time_millis, int req_result) { VTable vTable = getVTable(); + if (vTable.trace_dsql_prepare == null) { + return false; + } boolean result = vTable.trace_dsql_prepare.invoke(this, connection, transaction, statement, time_millis, req_result); return result; } @@ -15715,6 +17991,9 @@ public boolean trace_dsql_prepare(ITraceDatabaseConnection connection, ITraceTra public boolean trace_dsql_free(ITraceDatabaseConnection connection, ITraceSQLStatement statement, int option) { VTable vTable = getVTable(); + if (vTable.trace_dsql_free == null) { + return false; + } boolean result = vTable.trace_dsql_free.invoke(this, connection, statement, option); return result; } @@ -15722,6 +18001,9 @@ public boolean trace_dsql_free(ITraceDatabaseConnection connection, ITraceSQLSta public boolean trace_dsql_execute(ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceSQLStatement statement, boolean started, int req_result) { VTable vTable = getVTable(); + if (vTable.trace_dsql_execute == null) { + return false; + } boolean result = vTable.trace_dsql_execute.invoke(this, connection, transaction, statement, started, req_result); return result; } @@ -15729,6 +18011,9 @@ public boolean trace_dsql_execute(ITraceDatabaseConnection connection, ITraceTra public boolean trace_blr_compile(ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceBLRStatement statement, long time_millis, int req_result) { VTable vTable = getVTable(); + if (vTable.trace_blr_compile == null) { + return false; + } boolean result = vTable.trace_blr_compile.invoke(this, connection, transaction, statement, time_millis, req_result); return result; } @@ -15736,6 +18021,9 @@ public boolean trace_blr_compile(ITraceDatabaseConnection connection, ITraceTran public boolean trace_blr_execute(ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceBLRStatement statement, int req_result) { VTable vTable = getVTable(); + if (vTable.trace_blr_execute == null) { + return false; + } boolean result = vTable.trace_blr_execute.invoke(this, connection, transaction, statement, req_result); return result; } @@ -15743,20 +18031,29 @@ public boolean trace_blr_execute(ITraceDatabaseConnection connection, ITraceTran public boolean trace_dyn_execute(ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceDYNRequest request, long time_millis, int req_result) { VTable vTable = getVTable(); + if (vTable.trace_dyn_execute == null) { + return false; + } boolean result = vTable.trace_dyn_execute.invoke(this, connection, transaction, request, time_millis, req_result); return result; } - public boolean trace_service_attach(ITraceServiceConnection service, int att_result) + public boolean trace_service_attach(ITraceServiceConnection service, int spb_length, byte[] spb, int att_result) { VTable vTable = getVTable(); - boolean result = vTable.trace_service_attach.invoke(this, service, att_result); + if (vTable.trace_service_attach == null) { + return false; + } + boolean result = vTable.trace_service_attach.invoke(this, service, spb_length, spb, att_result); return result; } public boolean trace_service_start(ITraceServiceConnection service, int switches_length, String switches, int start_result) { VTable vTable = getVTable(); + if (vTable.trace_service_start == null) { + return false; + } boolean result = vTable.trace_service_start.invoke(this, service, switches_length, switches, start_result); return result; } @@ -15764,6 +18061,9 @@ public boolean trace_service_start(ITraceServiceConnection service, int switches public boolean trace_service_query(ITraceServiceConnection service, int send_item_length, byte[] send_items, int recv_item_length, byte[] recv_items, int query_result) { VTable vTable = getVTable(); + if (vTable.trace_service_query == null) { + return false; + } boolean result = vTable.trace_service_query.invoke(this, service, send_item_length, send_items, recv_item_length, recv_items, query_result); return result; } @@ -15771,6 +18071,9 @@ public boolean trace_service_query(ITraceServiceConnection service, int send_ite public boolean trace_service_detach(ITraceServiceConnection service, int detach_result) { VTable vTable = getVTable(); + if (vTable.trace_service_detach == null) { + return false; + } boolean result = vTable.trace_service_detach.invoke(this, service, detach_result); return result; } @@ -15778,6 +18081,9 @@ public boolean trace_service_detach(ITraceServiceConnection service, int detach_ public boolean trace_event_error(ITraceConnection connection, ITraceStatusVector status, String function) { VTable vTable = getVTable(); + if (vTable.trace_event_error == null) { + return false; + } boolean result = vTable.trace_event_error.invoke(this, connection, status, function); return result; } @@ -15785,6 +18091,9 @@ public boolean trace_event_error(ITraceConnection connection, ITraceStatusVector public boolean trace_event_sweep(ITraceDatabaseConnection connection, ITraceSweepInfo sweep, int sweep_state) { VTable vTable = getVTable(); + if (vTable.trace_event_sweep == null) { + return false; + } boolean result = vTable.trace_event_sweep.invoke(this, connection, sweep, sweep_state); return result; } @@ -15792,9 +18101,22 @@ public boolean trace_event_sweep(ITraceDatabaseConnection connection, ITraceSwee public boolean trace_func_execute(ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceFunction function, boolean started, int func_result) { VTable vTable = getVTable(); + if (vTable.trace_func_execute == null) { + return false; + } boolean result = vTable.trace_func_execute.invoke(this, connection, transaction, function, started, func_result); return result; } + + public boolean trace_privilege_change(ITraceDatabaseConnection connection, ITraceTransaction transaction, String executor, String grantor, boolean is_grant, String object_name, String field_name, String user_name, String privileges, int options, int change_result) + { + VTable vTable = getVTable(); + if (vTable.trace_privilege_change == null) { + return false; + } + boolean result = vTable.trace_privilege_change.invoke(this, connection, transaction, executor, grantor, is_grant, object_name, field_name, user_name, privileges, options, change_result); + return result; + } } public static class ITraceFactory extends IPluginBase implements ITraceFactoryIntf @@ -15882,6 +18204,9 @@ protected VTable createVTable() public long trace_needs() { VTable vTable = getVTable(); + if (vTable.trace_needs == null) { + return 0; + } long result = vTable.trace_needs.invoke(this); return result; } @@ -15889,6 +18214,10 @@ public long trace_needs() public ITracePlugin trace_create(IStatus status, ITraceInitInfo init_info) { VTable vTable = getVTable(); + if (vTable.trace_create == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, ITraceFactoryIntf.VERSION); + return null; + } ITracePlugin result = vTable.trace_create.invoke(this, status, init_info); return result; } @@ -15986,12 +18315,20 @@ protected VTable createVTable() public void setup(IStatus status, IExternalContext context, IRoutineMetadata metadata, IMetadataBuilder inBuilder, IMetadataBuilder outBuilder) { VTable vTable = getVTable(); + if (vTable.setup == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IUdrFunctionFactoryIntf.VERSION); + return; + } vTable.setup.invoke(this, status, context, metadata, inBuilder, outBuilder); } public IExternalFunction newItem(IStatus status, IExternalContext context, IRoutineMetadata metadata) { VTable vTable = getVTable(); + if (vTable.newItem == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IUdrFunctionFactoryIntf.VERSION); + return null; + } IExternalFunction result = vTable.newItem.invoke(this, status, context, metadata); return result; } @@ -16089,12 +18426,20 @@ protected VTable createVTable() public void setup(IStatus status, IExternalContext context, IRoutineMetadata metadata, IMetadataBuilder inBuilder, IMetadataBuilder outBuilder) { VTable vTable = getVTable(); + if (vTable.setup == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IUdrProcedureFactoryIntf.VERSION); + return; + } vTable.setup.invoke(this, status, context, metadata, inBuilder, outBuilder); } public IExternalProcedure newItem(IStatus status, IExternalContext context, IRoutineMetadata metadata) { VTable vTable = getVTable(); + if (vTable.newItem == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IUdrProcedureFactoryIntf.VERSION); + return null; + } IExternalProcedure result = vTable.newItem.invoke(this, status, context, metadata); return result; } @@ -16192,12 +18537,20 @@ protected VTable createVTable() public void setup(IStatus status, IExternalContext context, IRoutineMetadata metadata, IMetadataBuilder fieldsBuilder) { VTable vTable = getVTable(); + if (vTable.setup == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IUdrTriggerFactoryIntf.VERSION); + return; + } vTable.setup.invoke(this, status, context, metadata, fieldsBuilder); } public IExternalTrigger newItem(IStatus status, IExternalContext context, IRoutineMetadata metadata) { VTable vTable = getVTable(); + if (vTable.newItem == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IUdrTriggerFactoryIntf.VERSION); + return null; + } IExternalTrigger result = vTable.newItem.invoke(this, status, context, metadata); return result; } @@ -16329,6 +18682,9 @@ protected VTable createVTable() public IMaster getMaster() { VTable vTable = getVTable(); + if (vTable.getMaster == null) { + return null; + } IMaster result = vTable.getMaster.invoke(this); return result; } @@ -16336,18 +18692,30 @@ public IMaster getMaster() public void registerFunction(IStatus status, String name, IUdrFunctionFactory factory) { VTable vTable = getVTable(); + if (vTable.registerFunction == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IUdrPluginIntf.VERSION); + return; + } vTable.registerFunction.invoke(this, status, name, factory); } public void registerProcedure(IStatus status, String name, IUdrProcedureFactory factory) { VTable vTable = getVTable(); + if (vTable.registerProcedure == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IUdrPluginIntf.VERSION); + return; + } vTable.registerProcedure.invoke(this, status, name, factory); } public void registerTrigger(IStatus status, String name, IUdrTriggerFactory factory) { VTable vTable = getVTable(); + if (vTable.registerTrigger == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IUdrPluginIntf.VERSION); + return; + } vTable.registerTrigger.invoke(this, status, name, factory); } } @@ -16471,24 +18839,38 @@ protected VTable createVTable() public void toBcd(FB_DEC16[] from, com.sun.jna.Pointer sign, byte[] bcd, com.sun.jna.Pointer exp) { VTable vTable = getVTable(); + if (vTable.toBcd == null) { + return; + } vTable.toBcd.invoke(this, from, sign, bcd, exp); } public void toString(IStatus status, FB_DEC16[] from, int bufferLength, com.sun.jna.Pointer buffer) { VTable vTable = getVTable(); + if (vTable.toString == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IDecFloat16Intf.VERSION); + return; + } vTable.toString.invoke(this, status, from, bufferLength, buffer); } public void fromBcd(int sign, byte[] bcd, int exp, FB_DEC16[] to) { VTable vTable = getVTable(); + if (vTable.fromBcd == null) { + return; + } vTable.fromBcd.invoke(this, sign, bcd, exp, to); } public void fromString(IStatus status, String from, FB_DEC16[] to) { VTable vTable = getVTable(); + if (vTable.fromString == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IDecFloat16Intf.VERSION); + return; + } vTable.fromString.invoke(this, status, from, to); } } @@ -16612,24 +18994,38 @@ protected VTable createVTable() public void toBcd(FB_DEC34[] from, com.sun.jna.Pointer sign, byte[] bcd, com.sun.jna.Pointer exp) { VTable vTable = getVTable(); + if (vTable.toBcd == null) { + return; + } vTable.toBcd.invoke(this, from, sign, bcd, exp); } public void toString(IStatus status, FB_DEC34[] from, int bufferLength, com.sun.jna.Pointer buffer) { VTable vTable = getVTable(); + if (vTable.toString == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IDecFloat34Intf.VERSION); + return; + } vTable.toString.invoke(this, status, from, bufferLength, buffer); } public void fromBcd(int sign, byte[] bcd, int exp, FB_DEC34[] to) { VTable vTable = getVTable(); + if (vTable.fromBcd == null) { + return; + } vTable.fromBcd.invoke(this, sign, bcd, exp, to); } public void fromString(IStatus status, String from, FB_DEC34[] to) { VTable vTable = getVTable(); + if (vTable.fromString == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IDecFloat34Intf.VERSION); + return; + } vTable.fromString.invoke(this, status, from, to); } } @@ -16725,12 +19121,20 @@ protected VTable createVTable() public void toString(IStatus status, FB_I128[] from, int scale, int bufferLength, com.sun.jna.Pointer buffer) { VTable vTable = getVTable(); + if (vTable.toString == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IInt128Intf.VERSION); + return; + } vTable.toString.invoke(this, status, from, scale, bufferLength, buffer); } public void fromString(IStatus status, int scale, String from, FB_I128[] to) { VTable vTable = getVTable(); + if (vTable.fromString == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IInt128Intf.VERSION); + return; + } vTable.fromString.invoke(this, status, scale, from, to); } } @@ -16812,6 +19216,9 @@ protected VTable createVTable() public int getRawLength() { VTable vTable = getVTable(); + if (vTable.getRawLength == null) { + return 0; + } int result = vTable.getRawLength.invoke(this); return result; } @@ -16819,6 +19226,9 @@ public int getRawLength() public com.sun.jna.Pointer getRawData() { VTable vTable = getVTable(); + if (vTable.getRawData == null) { + return null; + } com.sun.jna.Pointer result = vTable.getRawData.invoke(this); return result; } @@ -16915,6 +19325,9 @@ protected VTable createVTable() public int getLength() { VTable vTable = getVTable(); + if (vTable.getLength == null) { + return 0; + } int result = vTable.getLength.invoke(this); return result; } @@ -16922,6 +19335,9 @@ public int getLength() public boolean isEof() { VTable vTable = getVTable(); + if (vTable.isEof == null) { + return false; + } boolean result = vTable.isEof.invoke(this); return result; } @@ -16929,6 +19345,9 @@ public boolean isEof() public int getSegment(int length, byte[] buffer) { VTable vTable = getVTable(); + if (vTable.getSegment == null) { + return 0; + } int result = vTable.getSegment.invoke(this, length, buffer); return result; } @@ -16993,6 +19412,11 @@ public static interface Callback_executeSql extends com.sun.jna.Callback public boolean invoke(IReplicatedTransaction self, String sql); } + public static interface Callback_executeSqlIntl extends com.sun.jna.Callback + { + public boolean invoke(IReplicatedTransaction self, int charset, String sql); + } + public VTable(com.sun.jna.Pointer pointer) { super(pointer); @@ -17089,6 +19513,14 @@ public boolean invoke(IReplicatedTransaction self, String sql) return obj.executeSql(sql); } }; + + executeSqlIntl = new Callback_executeSqlIntl() { + @Override + public boolean invoke(IReplicatedTransaction self, int charset, String sql) + { + return obj.executeSqlIntl(charset, sql); + } + }; } public VTable() @@ -17106,12 +19538,13 @@ public VTable() public Callback_deleteRecord deleteRecord; public Callback_storeBlob storeBlob; public Callback_executeSql executeSql; + public Callback_executeSqlIntl executeSqlIntl; @Override protected java.util.List getFieldOrder() { java.util.List fields = super.getFieldOrder(); - fields.addAll(java.util.Arrays.asList("prepare", "commit", "rollback", "startSavepoint", "releaseSavepoint", "rollbackSavepoint", "insertRecord", "updateRecord", "deleteRecord", "storeBlob", "executeSql")); + fields.addAll(java.util.Arrays.asList("prepare", "commit", "rollback", "startSavepoint", "releaseSavepoint", "rollbackSavepoint", "insertRecord", "updateRecord", "deleteRecord", "storeBlob", "executeSql", "executeSqlIntl")); return fields; } } @@ -17137,6 +19570,9 @@ protected VTable createVTable() public boolean prepare() { VTable vTable = getVTable(); + if (vTable.prepare == null) { + return false; + } boolean result = vTable.prepare.invoke(this); return result; } @@ -17144,6 +19580,9 @@ public boolean prepare() public boolean commit() { VTable vTable = getVTable(); + if (vTable.commit == null) { + return false; + } boolean result = vTable.commit.invoke(this); return result; } @@ -17151,6 +19590,9 @@ public boolean commit() public boolean rollback() { VTable vTable = getVTable(); + if (vTable.rollback == null) { + return false; + } boolean result = vTable.rollback.invoke(this); return result; } @@ -17158,6 +19600,9 @@ public boolean rollback() public boolean startSavepoint() { VTable vTable = getVTable(); + if (vTable.startSavepoint == null) { + return false; + } boolean result = vTable.startSavepoint.invoke(this); return result; } @@ -17165,6 +19610,9 @@ public boolean startSavepoint() public boolean releaseSavepoint() { VTable vTable = getVTable(); + if (vTable.releaseSavepoint == null) { + return false; + } boolean result = vTable.releaseSavepoint.invoke(this); return result; } @@ -17172,6 +19620,9 @@ public boolean releaseSavepoint() public boolean rollbackSavepoint() { VTable vTable = getVTable(); + if (vTable.rollbackSavepoint == null) { + return false; + } boolean result = vTable.rollbackSavepoint.invoke(this); return result; } @@ -17179,6 +19630,9 @@ public boolean rollbackSavepoint() public boolean insertRecord(String name, IReplicatedRecord record) { VTable vTable = getVTable(); + if (vTable.insertRecord == null) { + return false; + } boolean result = vTable.insertRecord.invoke(this, name, record); return result; } @@ -17186,6 +19640,9 @@ public boolean insertRecord(String name, IReplicatedRecord record) public boolean updateRecord(String name, IReplicatedRecord orgRecord, IReplicatedRecord newRecord) { VTable vTable = getVTable(); + if (vTable.updateRecord == null) { + return false; + } boolean result = vTable.updateRecord.invoke(this, name, orgRecord, newRecord); return result; } @@ -17193,6 +19650,9 @@ public boolean updateRecord(String name, IReplicatedRecord orgRecord, IReplicate public boolean deleteRecord(String name, IReplicatedRecord record) { VTable vTable = getVTable(); + if (vTable.deleteRecord == null) { + return false; + } boolean result = vTable.deleteRecord.invoke(this, name, record); return result; } @@ -17200,6 +19660,9 @@ public boolean deleteRecord(String name, IReplicatedRecord record) public boolean storeBlob(com.sun.jna.ptr.LongByReference blobId, IReplicatedBlob blob) { VTable vTable = getVTable(); + if (vTable.storeBlob == null) { + return false; + } boolean result = vTable.storeBlob.invoke(this, blobId, blob); return result; } @@ -17207,9 +19670,22 @@ public boolean storeBlob(com.sun.jna.ptr.LongByReference blobId, IReplicatedBlob public boolean executeSql(String sql) { VTable vTable = getVTable(); + if (vTable.executeSql == null) { + return false; + } boolean result = vTable.executeSql.invoke(this, sql); return result; } + + public boolean executeSqlIntl(int charset, String sql) + { + VTable vTable = getVTable(); + if (vTable.executeSqlIntl == null) { + return false; + } + boolean result = vTable.executeSqlIntl.invoke(this, charset, sql); + return result; + } } public static class IReplicatedSession extends IDisposable implements IReplicatedSessionIntf @@ -17317,6 +19793,9 @@ protected VTable createVTable() public IStatus getStatus() { VTable vTable = getVTable(); + if (vTable.getStatus == null) { + return null; + } IStatus result = vTable.getStatus.invoke(this); return result; } @@ -17324,6 +19803,9 @@ public IStatus getStatus() public IReplicatedTransaction startTransaction(long number) { VTable vTable = getVTable(); + if (vTable.startTransaction == null) { + return null; + } IReplicatedTransaction result = vTable.startTransaction.invoke(this, number); return result; } @@ -17331,6 +19813,9 @@ public IReplicatedTransaction startTransaction(long number) public boolean cleanupTransaction(long number) { VTable vTable = getVTable(); + if (vTable.cleanupTransaction == null) { + return false; + } boolean result = vTable.cleanupTransaction.invoke(this, number); return result; } @@ -17338,6 +19823,9 @@ public boolean cleanupTransaction(long number) public boolean setSequence(String name, long value) { VTable vTable = getVTable(); + if (vTable.setSequence == null) { + return false; + } boolean result = vTable.setSequence.invoke(this, name, value); return result; } diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbInterfaceException.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbInterfaceException.java index eca9abc958..5d3b5e83b3 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbInterfaceException.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbInterfaceException.java @@ -26,4 +26,25 @@ public static void catchException(FbInterface.IStatus status, Throwable t) { status.setErrors2(vector.length, vector); } } + + public static void setVersionError(FbInterface.IStatus status, String interfaceName, + int currentVersion, int expectedVersion) { + + try (CloseableMemory memory = new CloseableMemory(interfaceName.length() + 1)) { + memory.setString(0, interfaceName); + com.sun.jna.Pointer[] vector = new com.sun.jna.Pointer[]{ + new com.sun.jna.Pointer(org.firebirdsql.gds.ISCConstants.isc_arg_gds), + new com.sun.jna.Pointer(org.firebirdsql.gds.ISCConstants.isc_interface_version_too_old), + new com.sun.jna.Pointer(org.firebirdsql.gds.ISCConstants.isc_arg_number), + new com.sun.jna.Pointer(expectedVersion), + new com.sun.jna.Pointer(org.firebirdsql.gds.ISCConstants.isc_arg_number), + new com.sun.jna.Pointer(currentVersion), + new com.sun.jna.Pointer(org.firebirdsql.gds.ISCConstants.isc_arg_cstring), + new com.sun.jna.Pointer(memory.size()), + memory, + new com.sun.jna.Pointer(org.firebirdsql.gds.ISCConstants.isc_arg_end) + }; + status.setErrors2(vector.length, vector); + } + } } diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IMetadataBuilderImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IMetadataBuilderImpl.java index 2710642283..ea107bfb6b 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IMetadataBuilderImpl.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IMetadataBuilderImpl.java @@ -183,7 +183,7 @@ public void addVarchar(int index, int length, int charSet) throws SQLException { @Override public void addDecDecimal(int index, int size, int scale) throws SQLException { - metadataBuilder.setType(status, index, SQL_DEC_FIXED); + metadataBuilder.setType(status, index, SQL_INT128); metadataBuilder.setLength(status, index, size); metadataBuilder.setScale(status, index, scale); metadataBuilder.setSubType(status, index, SUBTYPE_DECIMAL); @@ -191,7 +191,7 @@ public void addDecDecimal(int index, int size, int scale) throws SQLException { @Override public void addDecNumeric(int index, int size, int scale) throws SQLException { - metadataBuilder.setType(status, index, SQL_DEC_FIXED); + metadataBuilder.setType(status, index, SQL_INT128); metadataBuilder.setLength(status, index, size); metadataBuilder.setScale(status, index, scale); metadataBuilder.setSubType(status, index, SUBTYPE_NUMERIC); diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IStatementImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IStatementImpl.java index 87b5728aec..d7118765c9 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IStatementImpl.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IStatementImpl.java @@ -130,7 +130,8 @@ public void execute(RowValue parameters) throws SQLException { reset(false); switchState(StatementState.EXECUTING); - updateStatementTimeout(); + if (this.statement.vTable.version >= IStatementIntf.VERSION) + updateStatementTimeout(); setMetaData(getParameterDescriptor(), parameters); @@ -139,9 +140,11 @@ public void execute(RowValue parameters) throws SQLException { ITransactionImpl transaction = (ITransactionImpl) getTransaction(); Pointer inPtr = null; - if (inMessage.array().length > 0) { - inPtr = new Memory(inMessage.array().length); - inPtr.write(0, inMessage.array(), 0, inMessage.array().length); + // Actually the message size may be smaller than previously declared, + // so we take pointer position as message size + if (inMessage.position() > 0) { + inPtr = new Memory(inMessage.position()); + inPtr.write(0, inMessage.array(), 0, inMessage.position()); } Pointer outPtr = null; @@ -165,7 +168,7 @@ public void execute(RowValue parameters) throws SQLException { * have a result set that will be fetched, instead we have a singleton result if we have fields */ statementListenerDispatcher.statementExecuted(this, false, true); - queueRowData(toRowValue(getFieldDescriptor(), outMeta, outPtr)); + queueRowData(toRowValue(getRowDescriptor(), outMeta, outPtr)); setAllRowsFetched(true); } else { // A normal execute is never a singleton result (even if it only produces a single result) @@ -190,70 +193,107 @@ protected void setMetaData(final RowDescriptor rowDescriptor, final RowValue par IMaster master = database.getMaster(); IMetadataBuilder metadataBuilder = master.getMetadataBuilder(getStatus(), parameters.getCount()); - inMessage = ByteBuffer.allocate(inMeta.getMessageLength(getStatus())); + // We will be sure that we have enough memory for message + inMessage = ByteBuffer.allocate(Short.MAX_VALUE); processStatus(); - int offset; - byte[] nullShort = {0, 0}; - int align = 0; + int offset = 0; + byte[] nullShort = new byte[]{-1, -1}; + byte[] notNullShort = new byte[]{0, 0}; + int shift; for (int idx = 0; idx < parameters.getCount(); idx++) { byte[] fieldData = parameters.getFieldData(idx); + final FieldDescriptor fieldDescriptor = rowDescriptor.getFieldDescriptor(idx); if (fieldData == null) { // Note this only works because we mark the type as nullable in inMessage - final FieldDescriptor fieldDescriptor = rowDescriptor.getFieldDescriptor(idx); - nullShort = new byte[]{-1, -1}; + // clear status getStatus(); - offset = inMeta.getOffset(status, idx) - align; + int nullOffset = inMeta.getNullOffset(status, idx); - inMessage.position(offset); + processStatus(); // clear status getStatus(); + int length = inMeta.getLength(status, idx); + offset += length; inMessage.position(nullOffset); inMessage.put(nullShort); + offset += nullShort.length; + inMessage.position(offset); + // Although we pass a null value, length and type must still be specified + if (length == 0) { + length = fieldDescriptor.getLength() != 0 ? fieldDescriptor.getLength() : Integer.MIN_VALUE; + } + metadataBuilder.setLength(status, idx, length); + metadataBuilder.setType(status, idx, inMeta.getType(status, idx) | 1); + metadataBuilder.setCharSet(status, idx, inMeta.getCharSet(status, idx)); } else { - final FieldDescriptor fieldDescriptor = rowDescriptor.getFieldDescriptor(idx); + // clear status getStatus(); - offset = inMeta.getOffset(status, idx) - align; - int nullOffset = inMeta.getNullOffset(status, idx); + // Values must be aligned, otherwise, data will be lost + int alignment = inMeta.getAlignment(status); + shift = (fieldData.length ^ alignment) & 1; inMessage.position(offset); if (fieldDescriptor.isVarying()) { - metadataBuilder.setLength(status, idx, Math.min(fieldDescriptor.getLength(), fieldData.length)); - metadataBuilder.setType(status, idx, ISCConstants.SQL_VARYING); - metadataBuilder.setScale(status, idx, inMeta.getScale(status, idx)); - metadataBuilder.setSubType(status, idx, inMeta.getSubType(status, idx)); + int length = Math.min(fieldDescriptor.getLength(), fieldData.length); + if (length == 0) + length = fieldDescriptor.getLength() != 0 ? fieldDescriptor.getLength() : Integer.MIN_VALUE; + metadataBuilder.setLength(status, idx, length); + metadataBuilder.setType(status, idx, ISCConstants.SQL_VARYING + 1); metadataBuilder.setCharSet(status, idx, inMeta.getCharSet(status, idx)); byte[] encodeShort = fieldDescriptor.getDatatypeCoder().encodeShort(fieldData.length); inMessage.put(encodeShort); offset += encodeShort.length; inMessage.position(offset); - align += inMeta.getLength(status, idx) - fieldData.length; + } else if (fieldDescriptor.isFbType(ISCConstants.SQL_TEXT)) { metadataBuilder.setLength(status, idx, Math.min(fieldDescriptor.getLength(), fieldData.length)); - metadataBuilder.setType(status, idx, ISCConstants.SQL_TEXT); - metadataBuilder.setScale(status, idx, inMeta.getScale(status, idx)); - metadataBuilder.setSubType(status, idx, inMeta.getSubType(status, idx)); + metadataBuilder.setType(status, idx, ISCConstants.SQL_TEXT + 1); metadataBuilder.setCharSet(status, idx, inMeta.getCharSet(status, idx)); - align += inMeta.getLength(status, idx) - fieldData.length; - } else { + } else if (fieldDescriptor.isFbType(ISCConstants.SQL_BLOB)) { + if (offset != 0) + offset += offset % alignment; + inMessage.position(offset); metadataBuilder.setLength(status, idx, inMeta.getLength(status, idx)); - metadataBuilder.setType(status, idx, fieldDescriptor.getType()); - metadataBuilder.setSubType(status, idx, fieldDescriptor.getSubType()); - metadataBuilder.setSubType(status, idx, inMeta.getSubType(status, idx)); + metadataBuilder.setType(status, idx, ISCConstants.SQL_BLOB + 1); + metadataBuilder.setCharSet(status, idx, inMeta.getCharSet(status, idx)); + + + } else if (fieldDescriptor.isFbType(ISCConstants.SQL_TYPE_TIME)) { + if (offset != 0) + offset += offset % alignment; + inMessage.position(offset); + metadataBuilder.setLength(status, idx, inMeta.getLength(status, idx)); + metadataBuilder.setType(status, idx, ISCConstants.SQL_TYPE_TIME + 1); + metadataBuilder.setCharSet(status, idx, inMeta.getCharSet(status, idx)); + } else if (fieldDescriptor.isFbType(ISCConstants.SQL_TIMESTAMP)) { + if (offset != 0) + offset += offset % alignment; + inMessage.position(offset); + metadataBuilder.setLength(status, idx, inMeta.getLength(status, idx)); + metadataBuilder.setType(status, idx, ISCConstants.SQL_TIMESTAMP + 1); metadataBuilder.setCharSet(status, idx, inMeta.getCharSet(status, idx)); + } else { + if (offset % alignment != 0) + offset += offset % alignment; + inMessage.position(offset); + int length = inMeta.getLength(status, idx); + metadataBuilder.setLength(status, idx, length != 0 ? length : Integer.MIN_VALUE); + metadataBuilder.setType(status, idx, fieldDescriptor.getType()); + metadataBuilder.setCharSet(status, idx, 0); } - processStatus(); - // clear status - getStatus(); inMessage.put(fieldData); - inMessage.position(nullOffset - align); - inMessage.put(nullShort); + offset += fieldData.length; + if (offset + shift < inMessage.limit()) + offset += shift; + inMessage.position(offset); + inMessage.put(notNullShort); } + offset += notNullShort.length; } - inMeta = metadataBuilder.getMetadata(getStatus()); processStatus(); metadataBuilder.release(); @@ -281,7 +321,7 @@ public void fetchRows(int fetchSize) throws SQLException { int fetchStatus = cursor.fetchNext(getStatus(), ptr); processStatus(); if (fetchStatus == IStatus.RESULT_OK) { - queueRowData(toRowValue(getFieldDescriptor(), outMeta, ptr)); + queueRowData(toRowValue(getRowDescriptor(), outMeta, ptr)); } else if (fetchStatus == IStatus.RESULT_NO_DATA) { setAllRowsFetched(true); // Note: we are not explicitly 'closing' the cursor here @@ -396,5 +436,6 @@ private void processStatus() throws SQLException { private void updateStatementTimeout() throws SQLException { int allowedTimeout = (int) getAllowedTimeout(); statement.setTimeout(getStatus(), allowedTimeout); + processStatus(); } } diff --git a/src/test/org/firebirdsql/common/rules/GdsTypeRule.java b/src/test/org/firebirdsql/common/rules/GdsTypeRule.java index 708c3a8ed8..f55b806ddb 100644 --- a/src/test/org/firebirdsql/common/rules/GdsTypeRule.java +++ b/src/test/org/firebirdsql/common/rules/GdsTypeRule.java @@ -105,7 +105,16 @@ public static GdsTypeRule excludes(String... excludedTypes) { */ public static GdsTypeRule supportsNativeOnly() { return supports(NativeGDSFactoryPlugin.NATIVE_TYPE_NAME, EmbeddedGDSFactoryPlugin.EMBEDDED_TYPE_NAME, - LocalGDSFactoryPlugin.LOCAL_TYPE_NAME, FbOONativeGDSFactoryPlugin.NATIVE_TYPE_NAME, + LocalGDSFactoryPlugin.LOCAL_TYPE_NAME); + } + + /** + * Creates an instance that supports only all (known) OO API native test types. + * + * @return Instance + */ + public static GdsTypeRule supportsFBOONativeOnly() { + return supports(FbOONativeGDSFactoryPlugin.NATIVE_TYPE_NAME, FbOOEmbeddedGDSFactoryPlugin.EMBEDDED_TYPE_NAME, FbOOLocalGDSFactoryPlugin.LOCAL_TYPE_NAME); } From 7b1f4ac9e9c7a3a2bc86dfef3e71bcc46db2bb31 Mon Sep 17 00:00:00 2001 From: Vasiliy Yashkov Date: Fri, 15 Apr 2022 13:58:45 +0300 Subject: [PATCH 05/12] Update native OO API implementations --- build.gradle | 3 +- .../gds/impl/BatchParameterBufferImpl.java | 5 + .../nativeoo/FbOOLocalGDSFactoryPlugin.java | 44 - .../gds/ng/FbBatchCompletionState.java | 2 +- .../firebirdsql/gds/ng/FbMessageMetadata.java | 2 + .../nativeoo/gds/ng/IBatchImplTest.java | 28 +- .../nativeoo/gds/ng/IDatabaseImplTest.java | 16 +- .../nativeoo/gds/ng/IEventBlockImplTest.java | 10 +- .../nativeoo/gds/ng/IServiceImplTest.java | 11 +- .../gds/ng/AbstractNativeConnection.java | 72 +- .../ng/AbstractNativeOODatabaseFactory.java | 12 +- .../nativeoo/gds/ng/CloseableMemory.java | 2 +- .../nativeoo/gds/ng/FbInterface.java | 1772 +++++++++++++---- .../nativeoo/gds/ng/FbInterfaceException.java | 4 +- .../gds/ng/FbOOClientDatabaseFactory.java | 6 + .../gds/ng/FbOOEmbeddedDatabaseFactory.java | 8 +- .../gds/ng/FbOOLocalDatabaseFactory.java | 26 - .../gds/ng/IBatchCompletionStateImpl.java | 8 +- .../nativeoo/gds/ng/IBatchImpl.java | 19 +- .../nativeoo/gds/ng/IBlobImpl.java | 7 +- .../nativeoo/gds/ng/IDatabaseImpl.java | 49 +- .../nativeoo/gds/ng/IEventImpl.java | 22 +- .../nativeoo/gds/ng/IMessageBuilderImpl.java | 6 +- .../nativeoo/gds/ng/IMessageMetadataImpl.java | 14 +- .../nativeoo/gds/ng/IMetadataBuilderImpl.java | 74 +- .../gds/ng/IParameterConverterImpl.java | 2 +- .../gds/ng/IServiceConnectionImpl.java | 11 + .../nativeoo/gds/ng/IServiceImpl.java | 15 +- .../nativeoo/gds/ng/IStatementImpl.java | 47 +- .../nativeoo/gds/ng/ITransactionImpl.java | 3 +- .../gds/ng/NativeDatabaseConnection.java | 17 + .../org.firebirdsql.gds.impl.GDSFactoryPlugin | 1 - .../firebirdsql/jaybird/version.properties | 8 +- .../firebirdsql/common/FBTestProperties.java | 6 +- .../common/matchers/GdsTypeMatchers.java | 8 +- .../firebirdsql/common/rules/GdsTypeRule.java | 4 +- .../gds/impl/jni/TestEmbeddedServicesAPI.java | 11 + .../impl/jni/TestFbOOEmbeddedServicesAPI.java | 12 + .../impl/jni/TestFbOONativeServicesAPI.java | 13 + .../gds/impl/jni/TestNativeServicesAPI.java | 12 + .../gds/impl/jni/TestServicesAPI.java | 28 +- .../firebirdsql/gds/ng/AbstractBatchTest.java | 10 +- .../firebirdsql/jdbc/JDBCUrlPrefixTest.java | 2 + 43 files changed, 1768 insertions(+), 664 deletions(-) delete mode 100644 src/main/org/firebirdsql/gds/impl/nativeoo/FbOOLocalGDSFactoryPlugin.java delete mode 100644 src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbOOLocalDatabaseFactory.java create mode 100644 src/test/org/firebirdsql/gds/impl/jni/TestEmbeddedServicesAPI.java create mode 100644 src/test/org/firebirdsql/gds/impl/jni/TestFbOOEmbeddedServicesAPI.java create mode 100644 src/test/org/firebirdsql/gds/impl/jni/TestFbOONativeServicesAPI.java create mode 100644 src/test/org/firebirdsql/gds/impl/jni/TestNativeServicesAPI.java diff --git a/build.gradle b/build.gradle index 780934e663..d0c9163681 100644 --- a/build.gradle +++ b/build.gradle @@ -225,7 +225,8 @@ test { ) if (project.hasProperty('test.jna.library.path')) { systemProperty 'jna.library.path', project.'test.jna.library.path' - } else if (project.'test.gds_type' == 'NATIVE' || project.'test.gds_type' == 'EMBEDDED') { + } else if (project.'test.gds_type' == 'NATIVE' || project.'test.gds_type' == 'EMBEDDED' + || project.'test.gds_type' == 'FBOONATIVE' || project.'test.gds_type' == 'FBOOEMBEDDED') { println "Running test type ${project.'test.gds_type'} without explicit native library path. " + "Specify property 'test.jna.library.path' to point to a Firebird client location (NATIVE) or " + "Firebird install (EMBEDDED)." diff --git a/src/main/org/firebirdsql/gds/impl/BatchParameterBufferImpl.java b/src/main/org/firebirdsql/gds/impl/BatchParameterBufferImpl.java index 44be6b1906..4a229198ca 100644 --- a/src/main/org/firebirdsql/gds/impl/BatchParameterBufferImpl.java +++ b/src/main/org/firebirdsql/gds/impl/BatchParameterBufferImpl.java @@ -49,5 +49,10 @@ public final ArgumentType getByteArrayArgumentType(int tag) { public final ArgumentType getIntegerArgumentType(int tag) { return ArgumentType.Wide; } + + @Override + public ArgumentType getSingleArgumentType(int tag) { + return ArgumentType.SingleTpb; + } } } diff --git a/src/main/org/firebirdsql/gds/impl/nativeoo/FbOOLocalGDSFactoryPlugin.java b/src/main/org/firebirdsql/gds/impl/nativeoo/FbOOLocalGDSFactoryPlugin.java deleted file mode 100644 index 4bdb801936..0000000000 --- a/src/main/org/firebirdsql/gds/impl/nativeoo/FbOOLocalGDSFactoryPlugin.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.firebirdsql.gds.impl.nativeoo; - -import org.firebirdsql.gds.GDSException; -import org.firebirdsql.gds.impl.BaseGDSFactoryPlugin; -import org.firebirdsql.nativeoo.gds.ng.FbOOLocalDatabaseFactory; - -public class FbOOLocalGDSFactoryPlugin extends BaseGDSFactoryPlugin { - - public static final String LOCAL_TYPE_NAME = "FBOOLOCAL"; - - private static final String[] TYPE_ALIASES = new String[0]; - private static final String[] JDBC_PROTOCOLS = new String[] { - "jdbc:firebirdsql:fboo:local:", "jdbc:firebird:fboo:local:" - }; - - public String getPluginName() { - return "JNA-based GDS implementation using IPC communication."; - } - - public String getTypeName() { - return LOCAL_TYPE_NAME; - } - - public String[] getTypeAliases() { - return TYPE_ALIASES; - } - - public String[] getSupportedProtocols() { - return JDBC_PROTOCOLS; - } - - public String getDatabasePath(String server, Integer port, String path) throws GDSException { - if (path == null) { - throw new GDSException("Database name/path is required."); - } - - return path; - } - - @Override - public FbOOLocalDatabaseFactory getDatabaseFactory() { - return FbOOLocalDatabaseFactory.getInstance(); - } -} \ No newline at end of file diff --git a/src/main/org/firebirdsql/gds/ng/FbBatchCompletionState.java b/src/main/org/firebirdsql/gds/ng/FbBatchCompletionState.java index c43a3bb528..b23b958498 100644 --- a/src/main/org/firebirdsql/gds/ng/FbBatchCompletionState.java +++ b/src/main/org/firebirdsql/gds/ng/FbBatchCompletionState.java @@ -15,7 +15,7 @@ public interface FbBatchCompletionState { int EXECUTE_FAILED = -1; int SUCCESS_NO_INFO = -2; - int NO_MORE_ERRORS = -1; + int NO_MORE_ERRORS = 0xFFFFFFFF; /** * @return Count of executed statements. diff --git a/src/main/org/firebirdsql/gds/ng/FbMessageMetadata.java b/src/main/org/firebirdsql/gds/ng/FbMessageMetadata.java index f69944a5ac..8646aff39c 100644 --- a/src/main/org/firebirdsql/gds/ng/FbMessageMetadata.java +++ b/src/main/org/firebirdsql/gds/ng/FbMessageMetadata.java @@ -40,5 +40,7 @@ public interface FbMessageMetadata { int getType(int index) throws SQLException; + boolean isNullable(int index) throws SQLException; + FbMetadataBuilder getBuilder() throws SQLException; } diff --git a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IBatchImplTest.java b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IBatchImplTest.java index 6e015542cd..7de58a247d 100644 --- a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IBatchImplTest.java +++ b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IBatchImplTest.java @@ -23,8 +23,8 @@ import java.util.Calendar; import static org.hamcrest.CoreMatchers.*; +import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; /** @@ -117,7 +117,7 @@ public class IBatchImplTest extends AbstractBatchTest { @Rule public final ExpectedException expectedException = ExpectedException.none(); - private final AbstractNativeOODatabaseFactory factory = + private AbstractNativeOODatabaseFactory factory = (AbstractNativeOODatabaseFactory) FBTestProperties.getFbDatabaseFactory(); @Override @@ -270,13 +270,13 @@ public void testSingleExecuteBatchWithoutBlobs() throws SQLException { 0); fieldData = fieldValues.getFieldData(15); assertEquals(testDate, - statement.getRowDescriptor().getFieldDescriptor(15).getDatatypeCoder().decodeDate(fieldData)); + statement.getRowDescriptor().getFieldDescriptor(15).getDatatypeCoder().decodeDateCalendar(fieldData, Calendar.getInstance())); fieldData = fieldValues.getFieldData(16); assertEquals(testTime, - statement.getRowDescriptor().getFieldDescriptor(16).getDatatypeCoder().decodeTime(fieldData)); + statement.getRowDescriptor().getFieldDescriptor(16).getDatatypeCoder().decodeTimeCalendar(fieldData, Calendar.getInstance())); fieldData = fieldValues.getFieldData(17); assertEquals(testTimestamp, - statement.getRowDescriptor().getFieldDescriptor(17).getDatatypeCoder().decodeTimestamp(fieldData)); + statement.getRowDescriptor().getFieldDescriptor(17).getDatatypeCoder().decodeTimestampCalendar(fieldData, Calendar.getInstance())); } @@ -431,13 +431,13 @@ public void testSingleExecuteBatchWithBlobs() throws Exception { 0); fieldData = fieldValues.getFieldData(15); assertEquals(testDate, - statement.getRowDescriptor().getFieldDescriptor(15).getDatatypeCoder().decodeDate(fieldData)); + statement.getRowDescriptor().getFieldDescriptor(15).getDatatypeCoder().decodeDateCalendar(fieldData, Calendar.getInstance())); fieldData = fieldValues.getFieldData(16); assertEquals(testTime, - statement.getRowDescriptor().getFieldDescriptor(16).getDatatypeCoder().decodeTime(fieldData)); + statement.getRowDescriptor().getFieldDescriptor(16).getDatatypeCoder().decodeTimeCalendar(fieldData, Calendar.getInstance())); fieldData = fieldValues.getFieldData(17); assertEquals(testTimestamp, - statement.getRowDescriptor().getFieldDescriptor(17).getDatatypeCoder().decodeTimestamp(fieldData)); + statement.getRowDescriptor().getFieldDescriptor(17).getDatatypeCoder().decodeTimestampCalendar(fieldData, Calendar.getInstance())); fieldData = fieldValues.getFieldData(18); blobID = statement.getRowDescriptor().getFieldDescriptor(18).getDatatypeCoder().decodeLong(fieldData); checkBlob(blobID, INSERT_QUERY_WITH_BLOBS.getBytes()); @@ -630,13 +630,13 @@ public void testMultipleMessagesBatchWithoutBlobs() throws SQLException { 0); fieldData = fieldValues.getFieldData(15); assertEquals(testDate, - statement.getRowDescriptor().getFieldDescriptor(15).getDatatypeCoder().decodeDate(fieldData)); + statement.getRowDescriptor().getFieldDescriptor(15).getDatatypeCoder().decodeDateCalendar(fieldData, Calendar.getInstance())); fieldData = fieldValues.getFieldData(16); assertEquals(testTime, - statement.getRowDescriptor().getFieldDescriptor(16).getDatatypeCoder().decodeTime(fieldData)); + statement.getRowDescriptor().getFieldDescriptor(16).getDatatypeCoder().decodeTimeCalendar(fieldData, Calendar.getInstance())); fieldData = fieldValues.getFieldData(17); assertEquals(testTimestamp, - statement.getRowDescriptor().getFieldDescriptor(17).getDatatypeCoder().decodeTimestamp(fieldData)); + statement.getRowDescriptor().getFieldDescriptor(17).getDatatypeCoder().decodeTimestampCalendar(fieldData, Calendar.getInstance())); } @Test @@ -840,13 +840,13 @@ public void testMultipleMessagesBatchWithBlobs() throws Exception { 0); fieldData = fieldValues.getFieldData(15); assertEquals(testDate, - statement.getRowDescriptor().getFieldDescriptor(15).getDatatypeCoder().decodeDate(fieldData)); + statement.getRowDescriptor().getFieldDescriptor(15).getDatatypeCoder().decodeDateCalendar(fieldData, Calendar.getInstance())); fieldData = fieldValues.getFieldData(16); assertEquals(testTime, - statement.getRowDescriptor().getFieldDescriptor(16).getDatatypeCoder().decodeTime(fieldData)); + statement.getRowDescriptor().getFieldDescriptor(16).getDatatypeCoder().decodeTimeCalendar(fieldData, Calendar.getInstance())); fieldData = fieldValues.getFieldData(17); assertEquals(testTimestamp, - statement.getRowDescriptor().getFieldDescriptor(17).getDatatypeCoder().decodeTimestamp(fieldData)); + statement.getRowDescriptor().getFieldDescriptor(17).getDatatypeCoder().decodeTimestampCalendar(fieldData, Calendar.getInstance())); fieldData = fieldValues.getFieldData(18); blobID = statement.getRowDescriptor().getFieldDescriptor(18).getDatatypeCoder().decodeLong(fieldData); checkBlob(blobID, testBytes); diff --git a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IDatabaseImplTest.java b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IDatabaseImplTest.java index 3c95a21e4a..13425ec4b5 100644 --- a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IDatabaseImplTest.java +++ b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IDatabaseImplTest.java @@ -14,6 +14,7 @@ import org.firebirdsql.gds.ng.FbTransaction; import org.firebirdsql.gds.ng.TransactionState; +import org.firebirdsql.jaybird.fb.constants.TpbItems; import org.firebirdsql.jdbc.SQLStateConstants; import org.firebirdsql.management.FBManager; import org.junit.ClassRule; @@ -148,8 +149,7 @@ public void testBasicStatusProcessing_wrongDatabase() throws Exception { */ @Test public void testBasicCreateAndDrop() throws Exception { - connectionInfo.getExtraDatabaseParameters() - .addArgument(ISCConstants.isc_dpb_sql_dialect, 3); + connectionInfo.setSqlDialect(3); IDatabaseImpl db = (IDatabaseImpl) factory.connect(connectionInfo); File dbFile = new File(connectionInfo.getDatabaseName()); try { @@ -287,17 +287,19 @@ public void testExecuteImmediate_createDatabase() throws Exception { private FbTransaction getTransaction(FbDatabase db) throws SQLException { TransactionParameterBuffer tpb = new TransactionParameterBufferImpl(); - tpb.addArgument(ISCConstants.isc_tpb_read_committed); - tpb.addArgument(ISCConstants.isc_tpb_rec_version); - tpb.addArgument(ISCConstants.isc_tpb_write); - tpb.addArgument(ISCConstants.isc_tpb_wait); + tpb.addArgument(TpbItems.isc_tpb_read_committed); + tpb.addArgument(TpbItems.isc_tpb_rec_version); + tpb.addArgument(TpbItems.isc_tpb_write); + tpb.addArgument(TpbItems.isc_tpb_wait); return db.startTransaction(tpb); } private static void safelyClose(FbDatabase db) { if (db == null) return; try { - db.close(); + if (db.isAttached()) { + db.close(); + } } catch (SQLException ex) { ex.printStackTrace(); // ignore diff --git a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IEventBlockImplTest.java b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IEventBlockImplTest.java index c012b45b76..728d764668 100644 --- a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IEventBlockImplTest.java +++ b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IEventBlockImplTest.java @@ -5,13 +5,13 @@ import org.firebirdsql.common.rules.GdsTypeRule; import org.firebirdsql.gds.EventHandle; import org.firebirdsql.gds.EventHandler; -import org.firebirdsql.gds.ISCConstants; import org.firebirdsql.gds.TransactionParameterBuffer; import org.firebirdsql.gds.impl.TransactionParameterBufferImpl; import org.firebirdsql.gds.ng.*; import org.firebirdsql.gds.ng.fields.RowValue; +import org.firebirdsql.jaybird.fb.constants.TpbItems; import org.junit.After; import org.junit.ClassRule; import org.junit.Rule; @@ -158,10 +158,10 @@ public void testQueueEvent_andNotification() throws Exception { private FbTransaction getTransaction(FbDatabase db) throws SQLException { TransactionParameterBuffer tpb = new TransactionParameterBufferImpl(); - tpb.addArgument(ISCConstants.isc_tpb_read_committed); - tpb.addArgument(ISCConstants.isc_tpb_rec_version); - tpb.addArgument(ISCConstants.isc_tpb_write); - tpb.addArgument(ISCConstants.isc_tpb_wait); + tpb.addArgument(TpbItems.isc_tpb_read_committed); + tpb.addArgument(TpbItems.isc_tpb_rec_version); + tpb.addArgument(TpbItems.isc_tpb_write); + tpb.addArgument(TpbItems.isc_tpb_wait); return db.startTransaction(tpb); } } diff --git a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IServiceImplTest.java b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IServiceImplTest.java index d0e2e1445a..750e811e60 100644 --- a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IServiceImplTest.java +++ b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IServiceImplTest.java @@ -10,6 +10,7 @@ import org.firebirdsql.gds.impl.nativeoo.FbOOEmbeddedGDSFactoryPlugin; import org.firebirdsql.gds.ng.FbServiceProperties; +import org.firebirdsql.jaybird.fb.constants.SpbItems; import org.firebirdsql.management.FBManager; import org.firebirdsql.management.FBStatisticsManager; import org.junit.ClassRule; @@ -30,8 +31,10 @@ import static org.hamcrest.CoreMatchers.*; import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.CoreMatchers.endsWith; -import static org.junit.Assert.*; -import static org.junit.Assert.assertThat; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; import static org.junit.Assume.assumeThat; import static org.junit.Assume.assumeTrue; @@ -131,8 +134,8 @@ public void testStartServiceAction() throws Exception { ServiceRequestBuffer actionSrb = service.createServiceRequestBuffer(); actionSrb.addArgument(isc_action_svc_db_stats); - actionSrb.addArgument(isc_spb_dbname, getDatabasePath()); - actionSrb.addArgument(isc_spb_options, isc_spb_sts_hdr_pages); + actionSrb.addArgument(SpbItems.isc_spb_dbname, getDatabasePath()); + actionSrb.addArgument(SpbItems.isc_spb_options, isc_spb_sts_hdr_pages); service.startServiceAction(actionSrb); diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/AbstractNativeConnection.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/AbstractNativeConnection.java index 9ccf75f633..d548789bc4 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/AbstractNativeConnection.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/AbstractNativeConnection.java @@ -1,10 +1,14 @@ package org.firebirdsql.nativeoo.gds.ng; import com.sun.jna.Pointer; -import org.firebirdsql.encodings.DefaultEncodingDefinition; import org.firebirdsql.encodings.IEncodingFactory; -import org.firebirdsql.gds.ISCConstants; -import org.firebirdsql.gds.ng.*; +import org.firebirdsql.gds.impl.DbAttachInfo; +import org.firebirdsql.gds.ng.AbstractConnection; +import org.firebirdsql.gds.ng.DatatypeCoder; +import org.firebirdsql.gds.ng.FbAttachment; +import org.firebirdsql.gds.ng.FbExceptionBuilder; +import org.firebirdsql.gds.ng.IAttachProperties; +import org.firebirdsql.gds.ng.WarningMessageCallback; import org.firebirdsql.gds.ng.jna.BigEndianDatatypeCoder; import org.firebirdsql.gds.ng.jna.LittleEndianDatatypeCoder; import org.firebirdsql.jna.fbclient.FbClientLibrary; @@ -16,8 +20,14 @@ import java.sql.SQLException; import static java.util.Objects.requireNonNull; -import static org.firebirdsql.gds.ISCConstants.*; +import static org.firebirdsql.gds.ISCConstants.isc_arg_cstring; import static org.firebirdsql.gds.ISCConstants.isc_arg_end; +import static org.firebirdsql.gds.ISCConstants.isc_arg_gds; +import static org.firebirdsql.gds.ISCConstants.isc_arg_interpreted; +import static org.firebirdsql.gds.ISCConstants.isc_arg_number; +import static org.firebirdsql.gds.ISCConstants.isc_arg_sql_state; +import static org.firebirdsql.gds.ISCConstants.isc_arg_string; +import static org.firebirdsql.gds.ISCConstants.isc_arg_warning; /** * Class handling the initial setup of the native connection. @@ -25,7 +35,7 @@ * * @param Type of attach properties * @param Type of connection handle - * @since 4.0 + * @since 5.0 */ public abstract class AbstractNativeConnection, C extends FbAttachment> extends AbstractConnection { @@ -33,6 +43,7 @@ public abstract class AbstractNativeConnection, C private static final boolean bigEndian = ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN; private final FbClientLibrary clientLibrary; + private final String attachUrl; /** * Creates a AbstractNativeConnection (without establishing a connection to the server). @@ -45,8 +56,23 @@ protected AbstractNativeConnection(FbClientLibrary clientLibrary, T attachProper throws SQLException { super(attachProperties, encodingFactory); this.clientLibrary = requireNonNull(clientLibrary, "parameter clientLibrary cannot be null"); + this.attachUrl = createAttachUrl(toDbAttachInfo(attachProperties), attachProperties); } + private DbAttachInfo toDbAttachInfo(T attachProperties) throws SQLException { + DbAttachInfo initialDbAttachInfo = DbAttachInfo.of(attachProperties); + + if (!initialDbAttachInfo.hasServerName() && initialDbAttachInfo.hasAttachObjectName() + && initialDbAttachInfo.getAttachObjectName().startsWith("//")) { + // This is a connection string using the default URL format which is not directly supported by fbclient + return DbAttachInfo.parseConnectString(initialDbAttachInfo.getAttachObjectName()); + } + + return initialDbAttachInfo; + } + + protected abstract String createAttachUrl(DbAttachInfo dbAttachInfo, T attachProperties) throws SQLException; + /** * @return The client library instance associated with the connection. */ @@ -138,24 +164,34 @@ public final DatatypeCoder createDatatypeCoder() { } /** - * Builds the attach URL for the library. + * Gets the attach URL for the library. * * @return Attach URL */ public String getAttachUrl() { - StringBuilder sb = new StringBuilder(); - if (getServerName() != null) { - boolean ipv6 = getServerName().indexOf(':') != -1; - if (ipv6) { - sb.append('[').append(getServerName()).append(']'); - } else { - sb.append(getServerName()); - } - sb.append('/') - .append(getPortNumber()) - .append(':'); + return attachUrl; + } + + /** + * Builds the attach URL for the library. + * + * @return Attach URL + */ + protected static String toAttachUrl(DbAttachInfo dbAttachInfo) { + if (!dbAttachInfo.hasServerName()) { + return dbAttachInfo.getAttachObjectName(); + } + String serverName = dbAttachInfo.getServerName(); + String attachObjectName = dbAttachInfo.getAttachObjectName(); + StringBuilder sb = new StringBuilder(serverName.length() + attachObjectName.length() + 4); + boolean ipv6 = serverName.indexOf(':') != -1; + if (ipv6) { + sb.append('[').append(serverName).append(']'); + } else { + sb.append(serverName); } - sb.append(getAttachObjectName()); + sb.append('/').append(dbAttachInfo.getPortNumber()) + .append(':').append(attachObjectName); return sb.toString(); } } diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/AbstractNativeOODatabaseFactory.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/AbstractNativeOODatabaseFactory.java index c2d94008a4..8c98b6b952 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/AbstractNativeOODatabaseFactory.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/AbstractNativeOODatabaseFactory.java @@ -1,10 +1,20 @@ package org.firebirdsql.nativeoo.gds.ng; -import org.firebirdsql.gds.ng.*; +import org.firebirdsql.gds.ng.FbDatabase; +import org.firebirdsql.gds.ng.FbDatabaseFactory; +import org.firebirdsql.gds.ng.FbService; +import org.firebirdsql.gds.ng.IAttachProperties; +import org.firebirdsql.gds.ng.IConnectionProperties; +import org.firebirdsql.gds.ng.IServiceProperties; import org.firebirdsql.jna.fbclient.FbClientLibrary; import java.sql.SQLException; +/** + * Implementation of {@link org.firebirdsql.gds.ng.FbDatabaseFactory} for the Native OO protocol implementation. + * + * @since 5.0 + */ public abstract class AbstractNativeOODatabaseFactory implements FbDatabaseFactory { @Override public FbDatabase connect(IConnectionProperties connectionProperties) throws SQLException { diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/CloseableMemory.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/CloseableMemory.java index 9bf51027d9..792905f5d0 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/CloseableMemory.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/CloseableMemory.java @@ -5,7 +5,7 @@ /** * Memory class for send and receive native messages using OO API. * - * @since 4.0 + * @since 5.0 */ public class CloseableMemory extends Memory implements AutoCloseable { diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbInterface.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbInterface.java index b471e3922d..87fbe3e40a 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbInterface.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbInterface.java @@ -3,13 +3,22 @@ package org.firebirdsql.nativeoo.gds.ng; -import org.firebirdsql.jna.fbclient.*; +import org.firebirdsql.jna.fbclient.FbClientLibrary; +import org.firebirdsql.jna.fbclient.FB_DEC16; +import org.firebirdsql.jna.fbclient.FB_DEC34; +import org.firebirdsql.jna.fbclient.FB_I128; +import org.firebirdsql.jna.fbclient.ISC_DATE; +import org.firebirdsql.jna.fbclient.ISC_TIME; +import org.firebirdsql.jna.fbclient.ISC_TIME_TZ; +import org.firebirdsql.jna.fbclient.ISC_TIME_TZ_EX; +import org.firebirdsql.jna.fbclient.ISC_TIMESTAMP_TZ; +import org.firebirdsql.jna.fbclient.ISC_TIMESTAMP_TZ_EX; /** * JNA Wrapper for library implementing interface.h. * - * @since 4.0 + * @since 5.0 */ public interface FbInterface extends FbClientLibrary { @@ -178,9 +187,7 @@ public static interface IPluginManagerIntf extends IVersionedIntf public static int TYPE_WIRE_CRYPT = 8; public static int TYPE_DB_CRYPT = 9; public static int TYPE_KEY_HOLDER = 10; - public static int TYPE_CRYPTO_API = 11; - public static int TYPE_LDAP = 12; - public static int TYPE_COUNT = 13; + public static int TYPE_REPLICATOR = 11; public void registerPluginFactory(int pluginType, String defaultName, IPluginFactory factory); public void registerModule(IPluginModule cleanup); @@ -243,30 +250,35 @@ public static interface IEventCallbackIntf extends IReferenceCountedIntf public static interface IBlobIntf extends IReferenceCountedIntf { - public int VERSION = 3; + public int VERSION = 4; public void getInfo(IStatus status, int itemsLength, byte[] items, int bufferLength, byte[] buffer); public int getSegment(IStatus status, int bufferLength, com.sun.jna.Pointer buffer, com.sun.jna.Pointer segmentLength); public void putSegment(IStatus status, int length, com.sun.jna.Pointer buffer); + public void deprecatedCancel(IStatus status); + public void deprecatedClose(IStatus status); + public int seek(IStatus status, int mode, int offset); public void cancel(IStatus status); public void close(IStatus status); - public int seek(IStatus status, int mode, int offset); } public static interface ITransactionIntf extends IReferenceCountedIntf { - public int VERSION = 3; + public int VERSION = 4; public void getInfo(IStatus status, int itemsLength, byte[] items, int bufferLength, byte[] buffer); public void prepare(IStatus status, int msgLength, byte[] message); - public void commit(IStatus status); + public void deprecatedCommit(IStatus status); public void commitRetaining(IStatus status); - public void rollback(IStatus status); + public void deprecatedRollback(IStatus status); public void rollbackRetaining(IStatus status); - public void disconnect(IStatus status); + public void deprecatedDisconnect(IStatus status); public ITransaction join(IStatus status, ITransaction transaction); public ITransaction validate(IStatus status, IAttachment attachment); public ITransaction enterDtc(IStatus status); + public void commit(IStatus status); + public void rollback(IStatus status); + public void disconnect(IStatus status); } public static interface IMessageMetadataIntf extends IReferenceCountedIntf @@ -314,7 +326,7 @@ public static interface IMetadataBuilderIntf extends IReferenceCountedIntf public static interface IResultSetIntf extends IReferenceCountedIntf { - public int VERSION = 3; + public int VERSION = 4; public int fetchNext(IStatus status, com.sun.jna.Pointer message); public int fetchPrior(IStatus status, com.sun.jna.Pointer message); @@ -325,13 +337,14 @@ public static interface IResultSetIntf extends IReferenceCountedIntf public boolean isEof(IStatus status); public boolean isBof(IStatus status); public IMessageMetadata getMetadata(IStatus status); - public void close(IStatus status); + public void deprecatedClose(IStatus status); public void setDelayedOutputFormat(IStatus status, IMessageMetadata format); + public void close(IStatus status); } public static interface IStatementIntf extends IReferenceCountedIntf { - public int VERSION = 4; + public int VERSION = 5; public static int PREPARE_PREFETCH_NONE = 0x0; public static int PREPARE_PREFETCH_TYPE = 0x1; @@ -356,16 +369,17 @@ public static interface IStatementIntf extends IReferenceCountedIntf public ITransaction execute(IStatus status, ITransaction transaction, IMessageMetadata inMetadata, com.sun.jna.Pointer inBuffer, IMessageMetadata outMetadata, com.sun.jna.Pointer outBuffer); public IResultSet openCursor(IStatus status, ITransaction transaction, IMessageMetadata inMetadata, com.sun.jna.Pointer inBuffer, IMessageMetadata outMetadata, int flags); public void setCursorName(IStatus status, String name); - public void free(IStatus status); + public void deprecatedFree(IStatus status); public int getFlags(IStatus status); public int getTimeout(IStatus status); public void setTimeout(IStatus status, int timeOut); public IBatch createBatch(IStatus status, IMessageMetadata inMetadata, int parLength, byte[] par); + public void free(IStatus status); } public static interface IBatchIntf extends IReferenceCountedIntf { - public int VERSION = 3; + public int VERSION = 4; public static byte VERSION1 = 1; public static byte TAG_MULTIERROR = 1; @@ -373,6 +387,11 @@ public static interface IBatchIntf extends IReferenceCountedIntf public static byte TAG_BUFFER_BYTES_SIZE = 3; public static byte TAG_BLOB_POLICY = 4; public static byte TAG_DETAILED_ERRORS = 5; + public static byte INF_BUFFER_BYTES_SIZE = 10; + public static byte INF_DATA_BYTES_SIZE = 11; + public static byte INF_BLOBS_BYTES_SIZE = 12; + public static byte INF_BLOB_ALIGNMENT = 13; + public static byte INF_BLOB_HEADER = 14; public static byte BLOB_NONE = 0; public static byte BLOB_ID_ENGINE = 1; public static byte BLOB_ID_USER = 2; @@ -389,6 +408,9 @@ public static interface IBatchIntf extends IReferenceCountedIntf public int getBlobAlignment(IStatus status); public IMessageMetadata getMetadata(IStatus status); public void setDefaultBpb(IStatus status, int parLength, byte[] par); + public void deprecatedClose(IStatus status); + public void close(IStatus status); + public void getInfo(IStatus status, int itemsLength, byte[] items, int bufferLength, byte[] buffer); } public static interface IBatchCompletionStateIntf extends IDisposableIntf @@ -397,7 +419,7 @@ public static interface IBatchCompletionStateIntf extends IDisposableIntf public static int EXECUTE_FAILED = -1; public static int SUCCESS_NO_INFO = -2; - public static int NO_MORE_ERRORS = 0x7fffffff; + public static int NO_MORE_ERRORS = 0xffffffff; public int getSize(IStatus status); public int getState(IStatus status, int pos); @@ -407,15 +429,16 @@ public static interface IBatchCompletionStateIntf extends IDisposableIntf public static interface IReplicatorIntf extends IReferenceCountedIntf { - public int VERSION = 3; + public int VERSION = 4; public void process(IStatus status, int length, byte[] data); + public void deprecatedClose(IStatus status); public void close(IStatus status); } public static interface IRequestIntf extends IReferenceCountedIntf { - public int VERSION = 3; + public int VERSION = 4; public void receive(IStatus status, int level, int msgType, int length, com.sun.jna.Pointer message); public void send(IStatus status, int level, int msgType, int length, com.sun.jna.Pointer message); @@ -423,19 +446,21 @@ public static interface IRequestIntf extends IReferenceCountedIntf public void start(IStatus status, ITransaction tra, int level); public void startAndSend(IStatus status, ITransaction tra, int level, int msgType, int length, com.sun.jna.Pointer message); public void unwind(IStatus status, int level); + public void deprecatedFree(IStatus status); public void free(IStatus status); } public static interface IEventsIntf extends IReferenceCountedIntf { - public int VERSION = 3; + public int VERSION = 4; + public void deprecatedCancel(IStatus status); public void cancel(IStatus status); } public static interface IAttachmentIntf extends IReferenceCountedIntf { - public int VERSION = 4; + public int VERSION = 5; public void getInfo(IStatus status, int itemsLength, byte[] items, int bufferLength, byte[] buffer); public ITransaction startTransaction(IStatus status, int tpbLength, byte[] tpb); @@ -453,23 +478,26 @@ public static interface IAttachmentIntf extends IReferenceCountedIntf public IEvents queEvents(IStatus status, IEventCallback callback, int length, byte[] events); public void cancelOperation(IStatus status, int option); public void ping(IStatus status); - public void detach(IStatus status); - public void dropDatabase(IStatus status); + public void deprecatedDetach(IStatus status); + public void deprecatedDropDatabase(IStatus status); public int getIdleTimeout(IStatus status); public void setIdleTimeout(IStatus status, int timeOut); public int getStatementTimeout(IStatus status); public void setStatementTimeout(IStatus status, int timeOut); public IBatch createBatch(IStatus status, ITransaction transaction, int stmtLength, String sqlStmt, int dialect, IMessageMetadata inMetadata, int parLength, byte[] par); public IReplicator createReplicator(IStatus status); + public void detach(IStatus status); + public void dropDatabase(IStatus status); } public static interface IServiceIntf extends IReferenceCountedIntf { - public int VERSION = 3; + public int VERSION = 4; - public void detach(IStatus status); + public void deprecatedDetach(IStatus status); public void query(IStatus status, int sendLength, byte[] sendItems, int receiveLength, byte[] receiveItems, int bufferLength, byte[] buffer); public void start(IStatus status, int spbLength, byte[] spb); + public void detach(IStatus status); } public static interface IProviderIntf extends IPluginBaseIntf @@ -534,7 +562,7 @@ public static interface IServerBlockIntf extends IVersionedIntf public static interface IClientBlockIntf extends IReferenceCountedIntf { - public int VERSION = 5; + public int VERSION = 6; public String getLogin(); public String getPassword(); @@ -542,9 +570,6 @@ public static interface IClientBlockIntf extends IReferenceCountedIntf public void putData(IStatus status, int length, com.sun.jna.Pointer data); public ICryptKey newKey(IStatus status); public IAuthBlock getAuthBlock(IStatus status); - public String getEffectiveLogin(); - public String getCertificate(); - public String getRepositoryPin(); } public static interface IServerIntf extends IAuthIntf @@ -620,13 +645,15 @@ public static interface IListUsersIntf extends IVersionedIntf public static interface ILogonInfoIntf extends IVersionedIntf { - public int VERSION = 2; + public int VERSION = 3; public String name(); public String role(); public String networkProtocol(); public String remoteAddress(); public com.sun.jna.Pointer authBlock(com.sun.jna.Pointer length); + public IAttachment attachment(IStatus status); + public ITransaction transaction(IStatus status); } public static interface IManagementIntf extends IPluginBaseIntf @@ -856,6 +883,8 @@ public static interface IXpbBuilderIntf extends IDisposableIntf public static int SPB_SEND = 7; public static int SPB_RECEIVE = 8; public static int SPB_RESPONSE = 9; + public static int INFO_SEND = 10; + public static int INFO_RESPONSE = 11; public void clear(IStatus status); public void removeCurrent(IStatus status); @@ -1204,49 +1233,54 @@ public static interface IInt128Intf extends IVersionedIntf public void fromString(IStatus status, int scale, String from, FB_I128[] to); } - public static interface IReplicatedRecordIntf extends IVersionedIntf + public static interface IReplicatedFieldIntf extends IVersionedIntf { public int VERSION = 2; - public int getRawLength(); - public com.sun.jna.Pointer getRawData(); + public String getName(); + public int getType(); + public int getSubType(); + public int getScale(); + public int getLength(); + public int getCharSet(); + public com.sun.jna.Pointer getData(); } - public static interface IReplicatedBlobIntf extends IVersionedIntf + public static interface IReplicatedRecordIntf extends IVersionedIntf { public int VERSION = 2; - public int getLength(); - public boolean isEof(); - public int getSegment(int length, byte[] buffer); + public int getCount(); + public IReplicatedField getField(int index); + public int getRawLength(); + public com.sun.jna.Pointer getRawData(); } public static interface IReplicatedTransactionIntf extends IDisposableIntf { public int VERSION = 3; - public boolean prepare(); - public boolean commit(); - public boolean rollback(); - public boolean startSavepoint(); - public boolean releaseSavepoint(); - public boolean rollbackSavepoint(); - public boolean insertRecord(String name, IReplicatedRecord record); - public boolean updateRecord(String name, IReplicatedRecord orgRecord, IReplicatedRecord newRecord); - public boolean deleteRecord(String name, IReplicatedRecord record); - public boolean storeBlob(com.sun.jna.ptr.LongByReference blobId, IReplicatedBlob blob); - public boolean executeSql(String sql); - public boolean executeSqlIntl(int charset, String sql); + public void prepare(IStatus status); + public void commit(IStatus status); + public void rollback(IStatus status); + public void startSavepoint(IStatus status); + public void releaseSavepoint(IStatus status); + public void rollbackSavepoint(IStatus status); + public void insertRecord(IStatus status, String name, IReplicatedRecord record); + public void updateRecord(IStatus status, String name, IReplicatedRecord orgRecord, IReplicatedRecord newRecord); + public void deleteRecord(IStatus status, String name, IReplicatedRecord record); + public void executeSql(IStatus status, String sql); + public void executeSqlIntl(IStatus status, int charset, String sql); } - public static interface IReplicatedSessionIntf extends IDisposableIntf + public static interface IReplicatedSessionIntf extends IPluginBaseIntf { - public int VERSION = 3; + public int VERSION = 4; - public IStatus getStatus(); - public IReplicatedTransaction startTransaction(long number); - public boolean cleanupTransaction(long number); - public boolean setSequence(String name, long value); + public boolean init(IStatus status, IAttachment attachment); + public IReplicatedTransaction startTransaction(IStatus status, ITransaction transaction, long number); + public void cleanupTransaction(IStatus status, long number); + public void setSequence(IStatus status, String name, long value); } public static class IVersioned extends com.sun.jna.Structure implements IVersionedIntf @@ -1276,15 +1310,6 @@ protected java.util.List getFieldOrder() fields.addAll(java.util.Arrays.asList("cloopDummy", "version")); return fields; } - - @Override - public void read() { - try { - super.read(); - } catch (java.lang.IllegalStateException e) { - // nothing to do, just skip it - } - } } public com.sun.jna.Pointer cloopDummy; @@ -1358,6 +1383,8 @@ public VTable(final IReferenceCountedIntf obj) { super(obj); + version = IReferenceCountedIntf.VERSION; + addRef = new Callback_addRef() { @Override public void invoke(IReferenceCounted self) @@ -1447,6 +1474,8 @@ public VTable(final IDisposableIntf obj) { super(obj); + version = IDisposableIntf.VERSION; + dispose = new Callback_dispose() { @Override public void invoke(IDisposable self) @@ -1557,6 +1586,8 @@ public VTable(final IStatusIntf obj) { super(obj); + version = IStatusIntf.VERSION; + init = new Callback_init() { @Override public void invoke(IStatus self) @@ -1830,6 +1861,8 @@ public VTable(final IMasterIntf obj) { super(obj); + version = IMasterIntf.VERSION; + getStatus = new Callback_getStatus() { @Override public IStatus invoke(IMaster self) @@ -2124,6 +2157,8 @@ public VTable(final IPluginBaseIntf obj) { super(obj); + version = IPluginBaseIntf.VERSION; + setOwner = new Callback_setOwner() { @Override public void invoke(IPluginBase self, IReferenceCounted r) @@ -2233,6 +2268,8 @@ public VTable(final IPluginSetIntf obj) { super(obj); + version = IPluginSetIntf.VERSION; + getName = new Callback_getName() { @Override public String invoke(IPluginSet self) @@ -2403,6 +2440,8 @@ public VTable(final IListElementCallbackIntf obj) { super(obj); + version = IListElementCallbackIntf.VERSION; + callback = new Callback_callback() { @Override public void invoke(IListElementCallback self, String text) @@ -2498,6 +2537,8 @@ public VTable(final IConfigEntryIntf obj) { super(obj); + version = IConfigEntryIntf.VERSION; + getName = new Callback_getName() { @Override public String invoke(IConfigEntry self) @@ -2682,6 +2723,8 @@ public VTable(final IConfigIntf obj) { super(obj); + version = IConfigIntf.VERSION; + find = new Callback_find() { @Override public IConfigEntry invoke(IConfig self, IStatus status, String name) @@ -2843,6 +2886,8 @@ public VTable(final IFirebirdConfIntf obj) { super(obj); + version = IFirebirdConfIntf.VERSION; + getKey = new Callback_getKey() { @Override public int invoke(IFirebirdConf self, String name) @@ -3032,6 +3077,8 @@ public VTable(final IPluginConfigIntf obj) { super(obj); + version = IPluginConfigIntf.VERSION; + getConfigFileName = new Callback_getConfigFileName() { @Override public String invoke(IPluginConfig self) @@ -3185,6 +3232,8 @@ public VTable(final IPluginFactoryIntf obj) { super(obj); + version = IPluginFactoryIntf.VERSION; + createPlugin = new Callback_createPlugin() { @Override public IPluginBase invoke(IPluginFactory self, IStatus status, IPluginConfig factoryParameter) @@ -3270,6 +3319,8 @@ public VTable(final IPluginModuleIntf obj) { super(obj); + version = IPluginModuleIntf.VERSION; + doClean = new Callback_doClean() { @Override public void invoke(IPluginModule self) @@ -3383,6 +3434,8 @@ public VTable(final IPluginManagerIntf obj) { super(obj); + version = IPluginManagerIntf.VERSION; + registerPluginFactory = new Callback_registerPluginFactory() { @Override public void invoke(IPluginManager self, int pluginType, String defaultName, IPluginFactory factory) @@ -3578,6 +3631,8 @@ public VTable(final ICryptKeyIntf obj) { super(obj); + version = ICryptKeyIntf.VERSION; + setSymmetric = new Callback_setSymmetric() { @Override public void invoke(ICryptKey self, IStatus status, String type, int keyLength, com.sun.jna.Pointer key) @@ -3750,6 +3805,8 @@ public VTable(final IConfigManagerIntf obj) { super(obj); + version = IConfigManagerIntf.VERSION; + getDirectory = new Callback_getDirectory() { @Override public String invoke(IConfigManager self, int code) @@ -3935,6 +3992,8 @@ public VTable(final IEventCallbackIntf obj) { super(obj); + version = IEventCallbackIntf.VERSION; + eventCallbackFunction = new Callback_eventCallbackFunction() { @Override public void invoke(IEventCallback self, int length, com.sun.jna.Pointer events) @@ -4006,12 +4065,12 @@ public static interface Callback_putSegment extends com.sun.jna.Callback public void invoke(IBlob self, IStatus status, int length, com.sun.jna.Pointer buffer); } - public static interface Callback_cancel extends com.sun.jna.Callback + public static interface Callback_deprecatedCancel extends com.sun.jna.Callback { public void invoke(IBlob self, IStatus status); } - public static interface Callback_close extends com.sun.jna.Callback + public static interface Callback_deprecatedClose extends com.sun.jna.Callback { public void invoke(IBlob self, IStatus status); } @@ -4021,6 +4080,16 @@ public static interface Callback_seek extends com.sun.jna.Callback public int invoke(IBlob self, IStatus status, int mode, int offset); } + public static interface Callback_cancel extends com.sun.jna.Callback + { + public void invoke(IBlob self, IStatus status); + } + + public static interface Callback_close extends com.sun.jna.Callback + { + public void invoke(IBlob self, IStatus status); + } + public VTable(com.sun.jna.Pointer pointer) { super(pointer); @@ -4030,6 +4099,8 @@ public VTable(final IBlobIntf obj) { super(obj); + version = IBlobIntf.VERSION; + getInfo = new Callback_getInfo() { @Override public void invoke(IBlob self, IStatus status, int itemsLength, byte[] items, int bufferLength, byte[] buffer) @@ -4076,13 +4147,13 @@ public void invoke(IBlob self, IStatus status, int length, com.sun.jna.Pointer b } }; - cancel = new Callback_cancel() { + deprecatedCancel = new Callback_deprecatedCancel() { @Override public void invoke(IBlob self, IStatus status) { try { - obj.cancel(status); + obj.deprecatedCancel(status); } catch (Throwable t) { @@ -4091,13 +4162,13 @@ public void invoke(IBlob self, IStatus status) } }; - close = new Callback_close() { + deprecatedClose = new Callback_deprecatedClose() { @Override public void invoke(IBlob self, IStatus status) { try { - obj.close(status); + obj.deprecatedClose(status); } catch (Throwable t) { @@ -4121,6 +4192,36 @@ public int invoke(IBlob self, IStatus status, int mode, int offset) } } }; + + cancel = new Callback_cancel() { + @Override + public void invoke(IBlob self, IStatus status) + { + try + { + obj.cancel(status); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + close = new Callback_close() { + @Override + public void invoke(IBlob self, IStatus status) + { + try + { + obj.close(status); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; } public VTable() @@ -4130,15 +4231,17 @@ public VTable() public Callback_getInfo getInfo; public Callback_getSegment getSegment; public Callback_putSegment putSegment; + public Callback_deprecatedCancel deprecatedCancel; + public Callback_deprecatedClose deprecatedClose; + public Callback_seek seek; public Callback_cancel cancel; public Callback_close close; - public Callback_seek seek; @Override protected java.util.List getFieldOrder() { java.util.List fields = super.getFieldOrder(); - fields.addAll(java.util.Arrays.asList("getInfo", "getSegment", "putSegment", "cancel", "close", "seek")); + fields.addAll(java.util.Arrays.asList("getInfo", "getSegment", "putSegment", "deprecatedCancel", "deprecatedClose", "seek", "cancel", "close")); return fields; } } @@ -4192,24 +4295,24 @@ public void putSegment(IStatus status, int length, com.sun.jna.Pointer buffer) vTable.putSegment.invoke(this, status, length, buffer); } - public void cancel(IStatus status) + public void deprecatedCancel(IStatus status) { VTable vTable = getVTable(); - if (vTable.cancel == null) { + if (vTable.deprecatedCancel == null) { FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IBlobIntf.VERSION); return; } - vTable.cancel.invoke(this, status); + vTable.deprecatedCancel.invoke(this, status); } - public void close(IStatus status) + public void deprecatedClose(IStatus status) { VTable vTable = getVTable(); - if (vTable.close == null) { + if (vTable.deprecatedClose == null) { FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IBlobIntf.VERSION); return; } - vTable.close.invoke(this, status); + vTable.deprecatedClose.invoke(this, status); } public int seek(IStatus status, int mode, int offset) @@ -4222,6 +4325,26 @@ public int seek(IStatus status, int mode, int offset) int result = vTable.seek.invoke(this, status, mode, offset); return result; } + + public void cancel(IStatus status) + { + VTable vTable = getVTable(); + if (vTable.cancel == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IBlobIntf.VERSION); + return; + } + vTable.cancel.invoke(this, status); + } + + public void close(IStatus status) + { + VTable vTable = getVTable(); + if (vTable.close == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IBlobIntf.VERSION); + return; + } + vTable.close.invoke(this, status); + } } public static class ITransaction extends IReferenceCounted implements ITransactionIntf @@ -4238,7 +4361,7 @@ public static interface Callback_prepare extends com.sun.jna.Callback public void invoke(ITransaction self, IStatus status, int msgLength, byte[] message); } - public static interface Callback_commit extends com.sun.jna.Callback + public static interface Callback_deprecatedCommit extends com.sun.jna.Callback { public void invoke(ITransaction self, IStatus status); } @@ -4248,7 +4371,7 @@ public static interface Callback_commitRetaining extends com.sun.jna.Callback public void invoke(ITransaction self, IStatus status); } - public static interface Callback_rollback extends com.sun.jna.Callback + public static interface Callback_deprecatedRollback extends com.sun.jna.Callback { public void invoke(ITransaction self, IStatus status); } @@ -4258,7 +4381,7 @@ public static interface Callback_rollbackRetaining extends com.sun.jna.Callback public void invoke(ITransaction self, IStatus status); } - public static interface Callback_disconnect extends com.sun.jna.Callback + public static interface Callback_deprecatedDisconnect extends com.sun.jna.Callback { public void invoke(ITransaction self, IStatus status); } @@ -4278,6 +4401,21 @@ public static interface Callback_enterDtc extends com.sun.jna.Callback public ITransaction invoke(ITransaction self, IStatus status); } + public static interface Callback_commit extends com.sun.jna.Callback + { + public void invoke(ITransaction self, IStatus status); + } + + public static interface Callback_rollback extends com.sun.jna.Callback + { + public void invoke(ITransaction self, IStatus status); + } + + public static interface Callback_disconnect extends com.sun.jna.Callback + { + public void invoke(ITransaction self, IStatus status); + } + public VTable(com.sun.jna.Pointer pointer) { super(pointer); @@ -4287,6 +4425,8 @@ public VTable(final ITransactionIntf obj) { super(obj); + version = ITransactionIntf.VERSION; + getInfo = new Callback_getInfo() { @Override public void invoke(ITransaction self, IStatus status, int itemsLength, byte[] items, int bufferLength, byte[] buffer) @@ -4317,13 +4457,13 @@ public void invoke(ITransaction self, IStatus status, int msgLength, byte[] mess } }; - commit = new Callback_commit() { + deprecatedCommit = new Callback_deprecatedCommit() { @Override public void invoke(ITransaction self, IStatus status) { try { - obj.commit(status); + obj.deprecatedCommit(status); } catch (Throwable t) { @@ -4347,13 +4487,13 @@ public void invoke(ITransaction self, IStatus status) } }; - rollback = new Callback_rollback() { + deprecatedRollback = new Callback_deprecatedRollback() { @Override public void invoke(ITransaction self, IStatus status) { try { - obj.rollback(status); + obj.deprecatedRollback(status); } catch (Throwable t) { @@ -4377,13 +4517,13 @@ public void invoke(ITransaction self, IStatus status) } }; - disconnect = new Callback_disconnect() { + deprecatedDisconnect = new Callback_deprecatedDisconnect() { @Override public void invoke(ITransaction self, IStatus status) { try { - obj.disconnect(status); + obj.deprecatedDisconnect(status); } catch (Throwable t) { @@ -4439,6 +4579,51 @@ public ITransaction invoke(ITransaction self, IStatus status) } } }; + + commit = new Callback_commit() { + @Override + public void invoke(ITransaction self, IStatus status) + { + try + { + obj.commit(status); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + rollback = new Callback_rollback() { + @Override + public void invoke(ITransaction self, IStatus status) + { + try + { + obj.rollback(status); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + disconnect = new Callback_disconnect() { + @Override + public void invoke(ITransaction self, IStatus status) + { + try + { + obj.disconnect(status); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; } public VTable() @@ -4447,20 +4632,23 @@ public VTable() public Callback_getInfo getInfo; public Callback_prepare prepare; - public Callback_commit commit; + public Callback_deprecatedCommit deprecatedCommit; public Callback_commitRetaining commitRetaining; - public Callback_rollback rollback; + public Callback_deprecatedRollback deprecatedRollback; public Callback_rollbackRetaining rollbackRetaining; - public Callback_disconnect disconnect; + public Callback_deprecatedDisconnect deprecatedDisconnect; public Callback_join join; public Callback_validate validate; public Callback_enterDtc enterDtc; + public Callback_commit commit; + public Callback_rollback rollback; + public Callback_disconnect disconnect; @Override protected java.util.List getFieldOrder() { java.util.List fields = super.getFieldOrder(); - fields.addAll(java.util.Arrays.asList("getInfo", "prepare", "commit", "commitRetaining", "rollback", "rollbackRetaining", "disconnect", "join", "validate", "enterDtc")); + fields.addAll(java.util.Arrays.asList("getInfo", "prepare", "deprecatedCommit", "commitRetaining", "deprecatedRollback", "rollbackRetaining", "deprecatedDisconnect", "join", "validate", "enterDtc", "commit", "rollback", "disconnect")); return fields; } } @@ -4503,14 +4691,14 @@ public void prepare(IStatus status, int msgLength, byte[] message) vTable.prepare.invoke(this, status, msgLength, message); } - public void commit(IStatus status) + public void deprecatedCommit(IStatus status) { VTable vTable = getVTable(); - if (vTable.commit == null) { + if (vTable.deprecatedCommit == null) { FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, ITransactionIntf.VERSION); return; } - vTable.commit.invoke(this, status); + vTable.deprecatedCommit.invoke(this, status); } public void commitRetaining(IStatus status) @@ -4523,14 +4711,14 @@ public void commitRetaining(IStatus status) vTable.commitRetaining.invoke(this, status); } - public void rollback(IStatus status) + public void deprecatedRollback(IStatus status) { VTable vTable = getVTable(); - if (vTable.rollback == null) { + if (vTable.deprecatedRollback == null) { FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, ITransactionIntf.VERSION); return; } - vTable.rollback.invoke(this, status); + vTable.deprecatedRollback.invoke(this, status); } public void rollbackRetaining(IStatus status) @@ -4543,14 +4731,14 @@ public void rollbackRetaining(IStatus status) vTable.rollbackRetaining.invoke(this, status); } - public void disconnect(IStatus status) + public void deprecatedDisconnect(IStatus status) { VTable vTable = getVTable(); - if (vTable.disconnect == null) { + if (vTable.deprecatedDisconnect == null) { FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, ITransactionIntf.VERSION); return; } - vTable.disconnect.invoke(this, status); + vTable.deprecatedDisconnect.invoke(this, status); } public ITransaction join(IStatus status, ITransaction transaction) @@ -4585,18 +4773,48 @@ public ITransaction enterDtc(IStatus status) ITransaction result = vTable.enterDtc.invoke(this, status); return result; } - } - public static class IMessageMetadata extends IReferenceCounted implements IMessageMetadataIntf - { - public static class VTable extends IReferenceCounted.VTable + public void commit(IStatus status) { - public static interface Callback_getCount extends com.sun.jna.Callback - { - public int invoke(IMessageMetadata self, IStatus status); + VTable vTable = getVTable(); + if (vTable.commit == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, ITransactionIntf.VERSION); + return; } + vTable.commit.invoke(this, status); + } - public static interface Callback_getField extends com.sun.jna.Callback + public void rollback(IStatus status) + { + VTable vTable = getVTable(); + if (vTable.rollback == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, ITransactionIntf.VERSION); + return; + } + vTable.rollback.invoke(this, status); + } + + public void disconnect(IStatus status) + { + VTable vTable = getVTable(); + if (vTable.disconnect == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, ITransactionIntf.VERSION); + return; + } + vTable.disconnect.invoke(this, status); + } + } + + public static class IMessageMetadata extends IReferenceCounted implements IMessageMetadataIntf + { + public static class VTable extends IReferenceCounted.VTable + { + public static interface Callback_getCount extends com.sun.jna.Callback + { + public int invoke(IMessageMetadata self, IStatus status); + } + + public static interface Callback_getField extends com.sun.jna.Callback { public String invoke(IMessageMetadata self, IStatus status, int index); } @@ -4685,6 +4903,8 @@ public VTable(final IMessageMetadataIntf obj) { super(obj); + version = IMessageMetadataIntf.VERSION; + getCount = new Callback_getCount() { @Override public int invoke(IMessageMetadata self, IStatus status) @@ -5278,6 +5498,8 @@ public VTable(final IMetadataBuilderIntf obj) { super(obj); + version = IMetadataBuilderIntf.VERSION; + setType = new Callback_setType() { @Override public void invoke(IMetadataBuilder self, IStatus status, int index, int type) @@ -5729,7 +5951,7 @@ public static interface Callback_getMetadata extends com.sun.jna.Callback public IMessageMetadata invoke(IResultSet self, IStatus status); } - public static interface Callback_close extends com.sun.jna.Callback + public static interface Callback_deprecatedClose extends com.sun.jna.Callback { public void invoke(IResultSet self, IStatus status); } @@ -5739,6 +5961,11 @@ public static interface Callback_setDelayedOutputFormat extends com.sun.jna.Call public void invoke(IResultSet self, IStatus status, IMessageMetadata format); } + public static interface Callback_close extends com.sun.jna.Callback + { + public void invoke(IResultSet self, IStatus status); + } + public VTable(com.sun.jna.Pointer pointer) { super(pointer); @@ -5748,6 +5975,8 @@ public VTable(final IResultSetIntf obj) { super(obj); + version = IResultSetIntf.VERSION; + fetchNext = new Callback_fetchNext() { @Override public int invoke(IResultSet self, IStatus status, com.sun.jna.Pointer message) @@ -5892,13 +6121,13 @@ public IMessageMetadata invoke(IResultSet self, IStatus status) } }; - close = new Callback_close() { + deprecatedClose = new Callback_deprecatedClose() { @Override public void invoke(IResultSet self, IStatus status) { try { - obj.close(status); + obj.deprecatedClose(status); } catch (Throwable t) { @@ -5921,6 +6150,21 @@ public void invoke(IResultSet self, IStatus status, IMessageMetadata format) } } }; + + close = new Callback_close() { + @Override + public void invoke(IResultSet self, IStatus status) + { + try + { + obj.close(status); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; } public VTable() @@ -5936,14 +6180,15 @@ public VTable() public Callback_isEof isEof; public Callback_isBof isBof; public Callback_getMetadata getMetadata; - public Callback_close close; + public Callback_deprecatedClose deprecatedClose; public Callback_setDelayedOutputFormat setDelayedOutputFormat; + public Callback_close close; @Override protected java.util.List getFieldOrder() { java.util.List fields = super.getFieldOrder(); - fields.addAll(java.util.Arrays.asList("fetchNext", "fetchPrior", "fetchFirst", "fetchLast", "fetchAbsolute", "fetchRelative", "isEof", "isBof", "getMetadata", "close", "setDelayedOutputFormat")); + fields.addAll(java.util.Arrays.asList("fetchNext", "fetchPrior", "fetchFirst", "fetchLast", "fetchAbsolute", "fetchRelative", "isEof", "isBof", "getMetadata", "deprecatedClose", "setDelayedOutputFormat", "close")); return fields; } } @@ -6065,14 +6310,14 @@ public IMessageMetadata getMetadata(IStatus status) return result; } - public void close(IStatus status) + public void deprecatedClose(IStatus status) { VTable vTable = getVTable(); - if (vTable.close == null) { + if (vTable.deprecatedClose == null) { FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IResultSetIntf.VERSION); return; } - vTable.close.invoke(this, status); + vTable.deprecatedClose.invoke(this, status); } public void setDelayedOutputFormat(IStatus status, IMessageMetadata format) @@ -6084,6 +6329,16 @@ public void setDelayedOutputFormat(IStatus status, IMessageMetadata format) } vTable.setDelayedOutputFormat.invoke(this, status, format); } + + public void close(IStatus status) + { + VTable vTable = getVTable(); + if (vTable.close == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IResultSetIntf.VERSION); + return; + } + vTable.close.invoke(this, status); + } } public static class IStatement extends IReferenceCounted implements IStatementIntf @@ -6135,7 +6390,7 @@ public static interface Callback_setCursorName extends com.sun.jna.Callback public void invoke(IStatement self, IStatus status, String name); } - public static interface Callback_free extends com.sun.jna.Callback + public static interface Callback_deprecatedFree extends com.sun.jna.Callback { public void invoke(IStatement self, IStatus status); } @@ -6160,6 +6415,11 @@ public static interface Callback_createBatch extends com.sun.jna.Callback public IBatch invoke(IStatement self, IStatus status, IMessageMetadata inMetadata, int parLength, byte[] par); } + public static interface Callback_free extends com.sun.jna.Callback + { + public void invoke(IStatement self, IStatus status); + } + public VTable(com.sun.jna.Pointer pointer) { super(pointer); @@ -6169,6 +6429,8 @@ public VTable(final IStatementIntf obj) { super(obj); + version = IStatementIntf.VERSION; + getInfo = new Callback_getInfo() { @Override public void invoke(IStatement self, IStatus status, int itemsLength, byte[] items, int bufferLength, byte[] buffer) @@ -6311,13 +6573,13 @@ public void invoke(IStatement self, IStatus status, String name) } }; - free = new Callback_free() { + deprecatedFree = new Callback_deprecatedFree() { @Override public void invoke(IStatement self, IStatus status) { try { - obj.free(status); + obj.deprecatedFree(status); } catch (Throwable t) { @@ -6388,6 +6650,21 @@ public IBatch invoke(IStatement self, IStatus status, IMessageMetadata inMetadat } } }; + + free = new Callback_free() { + @Override + public void invoke(IStatement self, IStatus status) + { + try + { + obj.free(status); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; } public VTable() @@ -6403,17 +6680,18 @@ public VTable() public Callback_execute execute; public Callback_openCursor openCursor; public Callback_setCursorName setCursorName; - public Callback_free free; + public Callback_deprecatedFree deprecatedFree; public Callback_getFlags getFlags; public Callback_getTimeout getTimeout; public Callback_setTimeout setTimeout; public Callback_createBatch createBatch; + public Callback_free free; @Override protected java.util.List getFieldOrder() { java.util.List fields = super.getFieldOrder(); - fields.addAll(java.util.Arrays.asList("getInfo", "getType", "getPlan", "getAffectedRecords", "getInputMetadata", "getOutputMetadata", "execute", "openCursor", "setCursorName", "free", "getFlags", "getTimeout", "setTimeout", "createBatch")); + fields.addAll(java.util.Arrays.asList("getInfo", "getType", "getPlan", "getAffectedRecords", "getInputMetadata", "getOutputMetadata", "execute", "openCursor", "setCursorName", "deprecatedFree", "getFlags", "getTimeout", "setTimeout", "createBatch", "free")); return fields; } } @@ -6533,14 +6811,14 @@ public void setCursorName(IStatus status, String name) vTable.setCursorName.invoke(this, status, name); } - public void free(IStatus status) + public void deprecatedFree(IStatus status) { VTable vTable = getVTable(); - if (vTable.free == null) { + if (vTable.deprecatedFree == null) { FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IStatementIntf.VERSION); return; } - vTable.free.invoke(this, status); + vTable.deprecatedFree.invoke(this, status); } public int getFlags(IStatus status) @@ -6585,6 +6863,16 @@ public IBatch createBatch(IStatus status, IMessageMetadata inMetadata, int parLe IBatch result = vTable.createBatch.invoke(this, status, inMetadata, parLength, par); return result; } + + public void free(IStatus status) + { + VTable vTable = getVTable(); + if (vTable.free == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IStatementIntf.VERSION); + return; + } + vTable.free.invoke(this, status); + } } public static class IBatch extends IReferenceCounted implements IBatchIntf @@ -6641,6 +6929,21 @@ public static interface Callback_setDefaultBpb extends com.sun.jna.Callback public void invoke(IBatch self, IStatus status, int parLength, byte[] par); } + public static interface Callback_deprecatedClose extends com.sun.jna.Callback + { + public void invoke(IBatch self, IStatus status); + } + + public static interface Callback_close extends com.sun.jna.Callback + { + public void invoke(IBatch self, IStatus status); + } + + public static interface Callback_getInfo extends com.sun.jna.Callback + { + public void invoke(IBatch self, IStatus status, int itemsLength, byte[] items, int bufferLength, byte[] buffer); + } + public VTable(com.sun.jna.Pointer pointer) { super(pointer); @@ -6650,6 +6953,8 @@ public VTable(final IBatchIntf obj) { super(obj); + version = IBatchIntf.VERSION; + add = new Callback_add() { @Override public void invoke(IBatch self, IStatus status, int count, com.sun.jna.Pointer inBuffer) @@ -6802,6 +7107,51 @@ public void invoke(IBatch self, IStatus status, int parLength, byte[] par) } } }; + + deprecatedClose = new Callback_deprecatedClose() { + @Override + public void invoke(IBatch self, IStatus status) + { + try + { + obj.deprecatedClose(status); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + close = new Callback_close() { + @Override + public void invoke(IBatch self, IStatus status) + { + try + { + obj.close(status); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + getInfo = new Callback_getInfo() { + @Override + public void invoke(IBatch self, IStatus status, int itemsLength, byte[] items, int bufferLength, byte[] buffer) + { + try + { + obj.getInfo(status, itemsLength, items, bufferLength, buffer); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; } public VTable() @@ -6818,12 +7168,15 @@ public VTable() public Callback_getBlobAlignment getBlobAlignment; public Callback_getMetadata getMetadata; public Callback_setDefaultBpb setDefaultBpb; + public Callback_deprecatedClose deprecatedClose; + public Callback_close close; + public Callback_getInfo getInfo; @Override protected java.util.List getFieldOrder() { java.util.List fields = super.getFieldOrder(); - fields.addAll(java.util.Arrays.asList("add", "addBlob", "appendBlobData", "addBlobStream", "registerBlob", "execute", "cancel", "getBlobAlignment", "getMetadata", "setDefaultBpb")); + fields.addAll(java.util.Arrays.asList("add", "addBlob", "appendBlobData", "addBlobStream", "registerBlob", "execute", "cancel", "getBlobAlignment", "getMetadata", "setDefaultBpb", "deprecatedClose", "close", "getInfo")); return fields; } } @@ -6948,6 +7301,36 @@ public void setDefaultBpb(IStatus status, int parLength, byte[] par) } vTable.setDefaultBpb.invoke(this, status, parLength, par); } + + public void deprecatedClose(IStatus status) + { + VTable vTable = getVTable(); + if (vTable.deprecatedClose == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IBatchIntf.VERSION); + return; + } + vTable.deprecatedClose.invoke(this, status); + } + + public void close(IStatus status) + { + VTable vTable = getVTable(); + if (vTable.close == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IBatchIntf.VERSION); + return; + } + vTable.close.invoke(this, status); + } + + public void getInfo(IStatus status, int itemsLength, byte[] items, int bufferLength, byte[] buffer) + { + VTable vTable = getVTable(); + if (vTable.getInfo == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IBatchIntf.VERSION); + return; + } + vTable.getInfo.invoke(this, status, itemsLength, items, bufferLength, buffer); + } } public static class IBatchCompletionState extends IDisposable implements IBatchCompletionStateIntf @@ -6983,6 +7366,8 @@ public VTable(final IBatchCompletionStateIntf obj) { super(obj); + version = IBatchCompletionStateIntf.VERSION; + getSize = new Callback_getSize() { @Override public int invoke(IBatchCompletionState self, IStatus status) @@ -7136,6 +7521,11 @@ public static interface Callback_process extends com.sun.jna.Callback public void invoke(IReplicator self, IStatus status, int length, byte[] data); } + public static interface Callback_deprecatedClose extends com.sun.jna.Callback + { + public void invoke(IReplicator self, IStatus status); + } + public static interface Callback_close extends com.sun.jna.Callback { public void invoke(IReplicator self, IStatus status); @@ -7150,6 +7540,8 @@ public VTable(final IReplicatorIntf obj) { super(obj); + version = IReplicatorIntf.VERSION; + process = new Callback_process() { @Override public void invoke(IReplicator self, IStatus status, int length, byte[] data) @@ -7165,6 +7557,21 @@ public void invoke(IReplicator self, IStatus status, int length, byte[] data) } }; + deprecatedClose = new Callback_deprecatedClose() { + @Override + public void invoke(IReplicator self, IStatus status) + { + try + { + obj.deprecatedClose(status); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; + close = new Callback_close() { @Override public void invoke(IReplicator self, IStatus status) @@ -7186,13 +7593,14 @@ public VTable() } public Callback_process process; + public Callback_deprecatedClose deprecatedClose; public Callback_close close; @Override protected java.util.List getFieldOrder() { java.util.List fields = super.getFieldOrder(); - fields.addAll(java.util.Arrays.asList("process", "close")); + fields.addAll(java.util.Arrays.asList("process", "deprecatedClose", "close")); return fields; } } @@ -7225,6 +7633,16 @@ public void process(IStatus status, int length, byte[] data) vTable.process.invoke(this, status, length, data); } + public void deprecatedClose(IStatus status) + { + VTable vTable = getVTable(); + if (vTable.deprecatedClose == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IReplicatorIntf.VERSION); + return; + } + vTable.deprecatedClose.invoke(this, status); + } + public void close(IStatus status) { VTable vTable = getVTable(); @@ -7270,6 +7688,11 @@ public static interface Callback_unwind extends com.sun.jna.Callback public void invoke(IRequest self, IStatus status, int level); } + public static interface Callback_deprecatedFree extends com.sun.jna.Callback + { + public void invoke(IRequest self, IStatus status); + } + public static interface Callback_free extends com.sun.jna.Callback { public void invoke(IRequest self, IStatus status); @@ -7284,6 +7707,8 @@ public VTable(final IRequestIntf obj) { super(obj); + version = IRequestIntf.VERSION; + receive = new Callback_receive() { @Override public void invoke(IRequest self, IStatus status, int level, int msgType, int length, com.sun.jna.Pointer message) @@ -7374,6 +7799,21 @@ public void invoke(IRequest self, IStatus status, int level) } }; + deprecatedFree = new Callback_deprecatedFree() { + @Override + public void invoke(IRequest self, IStatus status) + { + try + { + obj.deprecatedFree(status); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; + free = new Callback_free() { @Override public void invoke(IRequest self, IStatus status) @@ -7400,13 +7840,14 @@ public VTable() public Callback_start start; public Callback_startAndSend startAndSend; public Callback_unwind unwind; + public Callback_deprecatedFree deprecatedFree; public Callback_free free; @Override protected java.util.List getFieldOrder() { java.util.List fields = super.getFieldOrder(); - fields.addAll(java.util.Arrays.asList("receive", "send", "getInfo", "start", "startAndSend", "unwind", "free")); + fields.addAll(java.util.Arrays.asList("receive", "send", "getInfo", "start", "startAndSend", "unwind", "deprecatedFree", "free")); return fields; } } @@ -7489,6 +7930,16 @@ public void unwind(IStatus status, int level) vTable.unwind.invoke(this, status, level); } + public void deprecatedFree(IStatus status) + { + VTable vTable = getVTable(); + if (vTable.deprecatedFree == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IRequestIntf.VERSION); + return; + } + vTable.deprecatedFree.invoke(this, status); + } + public void free(IStatus status) { VTable vTable = getVTable(); @@ -7504,6 +7955,11 @@ public static class IEvents extends IReferenceCounted implements IEventsIntf { public static class VTable extends IReferenceCounted.VTable { + public static interface Callback_deprecatedCancel extends com.sun.jna.Callback + { + public void invoke(IEvents self, IStatus status); + } + public static interface Callback_cancel extends com.sun.jna.Callback { public void invoke(IEvents self, IStatus status); @@ -7518,13 +7974,15 @@ public VTable(final IEventsIntf obj) { super(obj); - cancel = new Callback_cancel() { + version = IEventsIntf.VERSION; + + deprecatedCancel = new Callback_deprecatedCancel() { @Override public void invoke(IEvents self, IStatus status) { try { - obj.cancel(status); + obj.deprecatedCancel(status); } catch (Throwable t) { @@ -7532,19 +7990,35 @@ public void invoke(IEvents self, IStatus status) } } }; - } - public VTable() + cancel = new Callback_cancel() { + @Override + public void invoke(IEvents self, IStatus status) + { + try + { + obj.cancel(status); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; + } + + public VTable() { } + public Callback_deprecatedCancel deprecatedCancel; public Callback_cancel cancel; @Override protected java.util.List getFieldOrder() { java.util.List fields = super.getFieldOrder(); - fields.addAll(java.util.Arrays.asList("cancel")); + fields.addAll(java.util.Arrays.asList("deprecatedCancel", "cancel")); return fields; } } @@ -7567,6 +8041,16 @@ protected VTable createVTable() return new VTable(cloopVTable); } + public void deprecatedCancel(IStatus status) + { + VTable vTable = getVTable(); + if (vTable.deprecatedCancel == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IEventsIntf.VERSION); + return; + } + vTable.deprecatedCancel.invoke(this, status); + } + public void cancel(IStatus status) { VTable vTable = getVTable(); @@ -7662,12 +8146,12 @@ public static interface Callback_ping extends com.sun.jna.Callback public void invoke(IAttachment self, IStatus status); } - public static interface Callback_detach extends com.sun.jna.Callback + public static interface Callback_deprecatedDetach extends com.sun.jna.Callback { public void invoke(IAttachment self, IStatus status); } - public static interface Callback_dropDatabase extends com.sun.jna.Callback + public static interface Callback_deprecatedDropDatabase extends com.sun.jna.Callback { public void invoke(IAttachment self, IStatus status); } @@ -7702,6 +8186,16 @@ public static interface Callback_createReplicator extends com.sun.jna.Callback public IReplicator invoke(IAttachment self, IStatus status); } + public static interface Callback_detach extends com.sun.jna.Callback + { + public void invoke(IAttachment self, IStatus status); + } + + public static interface Callback_dropDatabase extends com.sun.jna.Callback + { + public void invoke(IAttachment self, IStatus status); + } + public VTable(com.sun.jna.Pointer pointer) { super(pointer); @@ -7711,6 +8205,8 @@ public VTable(final IAttachmentIntf obj) { super(obj); + version = IAttachmentIntf.VERSION; + getInfo = new Callback_getInfo() { @Override public void invoke(IAttachment self, IStatus status, int itemsLength, byte[] items, int bufferLength, byte[] buffer) @@ -7961,13 +8457,13 @@ public void invoke(IAttachment self, IStatus status) } }; - detach = new Callback_detach() { + deprecatedDetach = new Callback_deprecatedDetach() { @Override public void invoke(IAttachment self, IStatus status) { try { - obj.detach(status); + obj.deprecatedDetach(status); } catch (Throwable t) { @@ -7976,13 +8472,13 @@ public void invoke(IAttachment self, IStatus status) } }; - dropDatabase = new Callback_dropDatabase() { + deprecatedDropDatabase = new Callback_deprecatedDropDatabase() { @Override public void invoke(IAttachment self, IStatus status) { try { - obj.dropDatabase(status); + obj.deprecatedDropDatabase(status); } catch (Throwable t) { @@ -8084,6 +8580,36 @@ public IReplicator invoke(IAttachment self, IStatus status) } } }; + + detach = new Callback_detach() { + @Override + public void invoke(IAttachment self, IStatus status) + { + try + { + obj.detach(status); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + dropDatabase = new Callback_dropDatabase() { + @Override + public void invoke(IAttachment self, IStatus status) + { + try + { + obj.dropDatabase(status); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; } public VTable() @@ -8106,20 +8632,22 @@ public VTable() public Callback_queEvents queEvents; public Callback_cancelOperation cancelOperation; public Callback_ping ping; - public Callback_detach detach; - public Callback_dropDatabase dropDatabase; + public Callback_deprecatedDetach deprecatedDetach; + public Callback_deprecatedDropDatabase deprecatedDropDatabase; public Callback_getIdleTimeout getIdleTimeout; public Callback_setIdleTimeout setIdleTimeout; public Callback_getStatementTimeout getStatementTimeout; public Callback_setStatementTimeout setStatementTimeout; public Callback_createBatch createBatch; public Callback_createReplicator createReplicator; + public Callback_detach detach; + public Callback_dropDatabase dropDatabase; @Override protected java.util.List getFieldOrder() { java.util.List fields = super.getFieldOrder(); - fields.addAll(java.util.Arrays.asList("getInfo", "startTransaction", "reconnectTransaction", "compileRequest", "transactRequest", "createBlob", "openBlob", "getSlice", "putSlice", "executeDyn", "prepare", "execute", "openCursor", "queEvents", "cancelOperation", "ping", "detach", "dropDatabase", "getIdleTimeout", "setIdleTimeout", "getStatementTimeout", "setStatementTimeout", "createBatch", "createReplicator")); + fields.addAll(java.util.Arrays.asList("getInfo", "startTransaction", "reconnectTransaction", "compileRequest", "transactRequest", "createBlob", "openBlob", "getSlice", "putSlice", "executeDyn", "prepare", "execute", "openCursor", "queEvents", "cancelOperation", "ping", "deprecatedDetach", "deprecatedDropDatabase", "getIdleTimeout", "setIdleTimeout", "getStatementTimeout", "setStatementTimeout", "createBatch", "createReplicator", "detach", "dropDatabase")); return fields; } } @@ -8312,24 +8840,24 @@ public void ping(IStatus status) vTable.ping.invoke(this, status); } - public void detach(IStatus status) + public void deprecatedDetach(IStatus status) { VTable vTable = getVTable(); - if (vTable.detach == null) { + if (vTable.deprecatedDetach == null) { FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IAttachmentIntf.VERSION); return; } - vTable.detach.invoke(this, status); + vTable.deprecatedDetach.invoke(this, status); } - public void dropDatabase(IStatus status) + public void deprecatedDropDatabase(IStatus status) { VTable vTable = getVTable(); - if (vTable.dropDatabase == null) { + if (vTable.deprecatedDropDatabase == null) { FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IAttachmentIntf.VERSION); return; } - vTable.dropDatabase.invoke(this, status); + vTable.deprecatedDropDatabase.invoke(this, status); } public int getIdleTimeout(IStatus status) @@ -8395,13 +8923,33 @@ public IReplicator createReplicator(IStatus status) IReplicator result = vTable.createReplicator.invoke(this, status); return result; } + + public void detach(IStatus status) + { + VTable vTable = getVTable(); + if (vTable.detach == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IAttachmentIntf.VERSION); + return; + } + vTable.detach.invoke(this, status); + } + + public void dropDatabase(IStatus status) + { + VTable vTable = getVTable(); + if (vTable.dropDatabase == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IAttachmentIntf.VERSION); + return; + } + vTable.dropDatabase.invoke(this, status); + } } public static class IService extends IReferenceCounted implements IServiceIntf { public static class VTable extends IReferenceCounted.VTable { - public static interface Callback_detach extends com.sun.jna.Callback + public static interface Callback_deprecatedDetach extends com.sun.jna.Callback { public void invoke(IService self, IStatus status); } @@ -8416,6 +8964,11 @@ public static interface Callback_start extends com.sun.jna.Callback public void invoke(IService self, IStatus status, int spbLength, byte[] spb); } + public static interface Callback_detach extends com.sun.jna.Callback + { + public void invoke(IService self, IStatus status); + } + public VTable(com.sun.jna.Pointer pointer) { super(pointer); @@ -8425,13 +8978,15 @@ public VTable(final IServiceIntf obj) { super(obj); - detach = new Callback_detach() { + version = IServiceIntf.VERSION; + + deprecatedDetach = new Callback_deprecatedDetach() { @Override public void invoke(IService self, IStatus status) { try { - obj.detach(status); + obj.deprecatedDetach(status); } catch (Throwable t) { @@ -8469,21 +9024,37 @@ public void invoke(IService self, IStatus status, int spbLength, byte[] spb) } } }; + + detach = new Callback_detach() { + @Override + public void invoke(IService self, IStatus status) + { + try + { + obj.detach(status); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; } public VTable() { } - public Callback_detach detach; + public Callback_deprecatedDetach deprecatedDetach; public Callback_query query; public Callback_start start; + public Callback_detach detach; @Override protected java.util.List getFieldOrder() { java.util.List fields = super.getFieldOrder(); - fields.addAll(java.util.Arrays.asList("detach", "query", "start")); + fields.addAll(java.util.Arrays.asList("deprecatedDetach", "query", "start", "detach")); return fields; } } @@ -8506,14 +9077,14 @@ protected VTable createVTable() return new VTable(cloopVTable); } - public void detach(IStatus status) + public void deprecatedDetach(IStatus status) { VTable vTable = getVTable(); - if (vTable.detach == null) { + if (vTable.deprecatedDetach == null) { FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IServiceIntf.VERSION); return; } - vTable.detach.invoke(this, status); + vTable.deprecatedDetach.invoke(this, status); } public void query(IStatus status, int sendLength, byte[] sendItems, int receiveLength, byte[] receiveItems, int bufferLength, byte[] buffer) @@ -8535,6 +9106,16 @@ public void start(IStatus status, int spbLength, byte[] spb) } vTable.start.invoke(this, status, spbLength, spb); } + + public void detach(IStatus status) + { + VTable vTable = getVTable(); + if (vTable.detach == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IServiceIntf.VERSION); + return; + } + vTable.detach.invoke(this, status); + } } public static class IProvider extends IPluginBase implements IProviderIntf @@ -8575,6 +9156,8 @@ public VTable(final IProviderIntf obj) { super(obj); + version = IProviderIntf.VERSION; + attachDatabase = new Callback_attachDatabase() { @Override public IAttachment invoke(IProvider self, IStatus status, String fileName, int dpbLength, byte[] dpb) @@ -8773,6 +9356,8 @@ public VTable(final IDtcStartIntf obj) { super(obj); + version = IDtcStartIntf.VERSION; + addAttachment = new Callback_addAttachment() { @Override public void invoke(IDtcStart self, IStatus status, IAttachment att) @@ -8910,6 +9495,8 @@ public VTable(final IDtcIntf obj) { super(obj); + version = IDtcIntf.VERSION; + join = new Callback_join() { @Override public ITransaction invoke(IDtc self, IStatus status, ITransaction one, ITransaction two) @@ -9013,6 +9600,8 @@ public VTable(final IAuthIntf obj) { super(obj); + version = IAuthIntf.VERSION; + } public VTable() @@ -9084,6 +9673,8 @@ public VTable(final IWriterIntf obj) { super(obj); + version = IWriterIntf.VERSION; + reset = new Callback_reset() { @Override public void invoke(IWriter self) @@ -9273,6 +9864,8 @@ public VTable(final IServerBlockIntf obj) { super(obj); + version = IServerBlockIntf.VERSION; + getLogin = new Callback_getLogin() { @Override public String invoke(IServerBlock self) @@ -9433,21 +10026,6 @@ public static interface Callback_getAuthBlock extends com.sun.jna.Callback public IAuthBlock invoke(IClientBlock self, IStatus status); } - public static interface Callback_getEffectiveLogin extends com.sun.jna.Callback - { - public String invoke(IClientBlock self); - } - - public static interface Callback_getCertificate extends com.sun.jna.Callback - { - public String invoke(IClientBlock self); - } - - public static interface Callback_getRepositoryPin extends com.sun.jna.Callback - { - public String invoke(IClientBlock self); - } - public VTable(com.sun.jna.Pointer pointer) { super(pointer); @@ -9457,6 +10035,8 @@ public VTable(final IClientBlockIntf obj) { super(obj); + version = IClientBlockIntf.VERSION; + getLogin = new Callback_getLogin() { @Override public String invoke(IClientBlock self) @@ -9527,30 +10107,6 @@ public IAuthBlock invoke(IClientBlock self, IStatus status) } } }; - - getEffectiveLogin = new Callback_getEffectiveLogin() { - @Override - public String invoke(IClientBlock self) - { - return obj.getEffectiveLogin(); - } - }; - - getCertificate = new Callback_getCertificate() { - @Override - public String invoke(IClientBlock self) - { - return obj.getCertificate(); - } - }; - - getRepositoryPin = new Callback_getRepositoryPin() { - @Override - public String invoke(IClientBlock self) - { - return obj.getRepositoryPin(); - } - }; } public VTable() @@ -9563,15 +10119,12 @@ public VTable() public Callback_putData putData; public Callback_newKey newKey; public Callback_getAuthBlock getAuthBlock; - public Callback_getEffectiveLogin getEffectiveLogin; - public Callback_getCertificate getCertificate; - public Callback_getRepositoryPin getRepositoryPin; @Override protected java.util.List getFieldOrder() { java.util.List fields = super.getFieldOrder(); - fields.addAll(java.util.Arrays.asList("getLogin", "getPassword", "getData", "putData", "newKey", "getAuthBlock", "getEffectiveLogin", "getCertificate", "getRepositoryPin")); + fields.addAll(java.util.Arrays.asList("getLogin", "getPassword", "getData", "putData", "newKey", "getAuthBlock")); return fields; } } @@ -9655,36 +10208,6 @@ public IAuthBlock getAuthBlock(IStatus status) IAuthBlock result = vTable.getAuthBlock.invoke(this, status); return result; } - - public String getEffectiveLogin() - { - VTable vTable = getVTable(); - if (vTable.getEffectiveLogin == null) { - return null; - } - String result = vTable.getEffectiveLogin.invoke(this); - return result; - } - - public String getCertificate() - { - VTable vTable = getVTable(); - if (vTable.getCertificate == null) { - return null; - } - String result = vTable.getCertificate.invoke(this); - return result; - } - - public String getRepositoryPin() - { - VTable vTable = getVTable(); - if (vTable.getRepositoryPin == null) { - return null; - } - String result = vTable.getRepositoryPin.invoke(this); - return result; - } } public static class IServer extends IAuth implements IServerIntf @@ -9710,6 +10233,8 @@ public VTable(final IServerIntf obj) { super(obj); + version = IServerIntf.VERSION; + authenticate = new Callback_authenticate() { @Override public int invoke(IServer self, IStatus status, IServerBlock sBlock, IWriter writerInterface) @@ -9816,6 +10341,8 @@ public VTable(final IClientIntf obj) { super(obj); + version = IClientIntf.VERSION; + authenticate = new Callback_authenticate() { @Override public int invoke(IClient self, IStatus status, IClientBlock cBlock) @@ -9906,6 +10433,8 @@ public VTable(final IUserFieldIntf obj) { super(obj); + version = IUserFieldIntf.VERSION; + entered = new Callback_entered() { @Override public int invoke(IUserField self) @@ -10027,6 +10556,8 @@ public VTable(final ICharUserFieldIntf obj) { super(obj); + version = ICharUserFieldIntf.VERSION; + get = new Callback_get() { @Override public String invoke(ICharUserField self) @@ -10129,6 +10660,8 @@ public VTable(final IIntUserFieldIntf obj) { super(obj); + version = IIntUserFieldIntf.VERSION; + get = new Callback_get() { @Override public int invoke(IIntUserField self) @@ -10276,6 +10809,8 @@ public VTable(final IUserIntf obj) { super(obj); + version = IUserIntf.VERSION; + operation = new Callback_operation() { @Override public int invoke(IUser self) @@ -10544,6 +11079,8 @@ public VTable(final IListUsersIntf obj) { super(obj); + version = IListUsersIntf.VERSION; + list = new Callback_list() { @Override public void invoke(IListUsers self, IStatus status, IUser user) @@ -10633,6 +11170,16 @@ public static interface Callback_authBlock extends com.sun.jna.Callback public com.sun.jna.Pointer invoke(ILogonInfo self, com.sun.jna.Pointer length); } + public static interface Callback_attachment extends com.sun.jna.Callback + { + public IAttachment invoke(ILogonInfo self, IStatus status); + } + + public static interface Callback_transaction extends com.sun.jna.Callback + { + public ITransaction invoke(ILogonInfo self, IStatus status); + } + public VTable(com.sun.jna.Pointer pointer) { super(pointer); @@ -10642,6 +11189,8 @@ public VTable(final ILogonInfoIntf obj) { super(obj); + version = ILogonInfoIntf.VERSION; + name = new Callback_name() { @Override public String invoke(ILogonInfo self) @@ -10681,6 +11230,38 @@ public com.sun.jna.Pointer invoke(ILogonInfo self, com.sun.jna.Pointer length) return obj.authBlock(length); } }; + + attachment = new Callback_attachment() { + @Override + public IAttachment invoke(ILogonInfo self, IStatus status) + { + try + { + return obj.attachment(status); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + return null; + } + } + }; + + transaction = new Callback_transaction() { + @Override + public ITransaction invoke(ILogonInfo self, IStatus status) + { + try + { + return obj.transaction(status); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + return null; + } + } + }; } public VTable() @@ -10692,12 +11273,14 @@ public VTable() public Callback_networkProtocol networkProtocol; public Callback_remoteAddress remoteAddress; public Callback_authBlock authBlock; + public Callback_attachment attachment; + public Callback_transaction transaction; @Override protected java.util.List getFieldOrder() { java.util.List fields = super.getFieldOrder(); - fields.addAll(java.util.Arrays.asList("name", "role", "networkProtocol", "remoteAddress", "authBlock")); + fields.addAll(java.util.Arrays.asList("name", "role", "networkProtocol", "remoteAddress", "authBlock", "attachment", "transaction")); return fields; } } @@ -10769,6 +11352,28 @@ public com.sun.jna.Pointer authBlock(com.sun.jna.Pointer length) com.sun.jna.Pointer result = vTable.authBlock.invoke(this, length); return result; } + + public IAttachment attachment(IStatus status) + { + VTable vTable = getVTable(); + if (vTable.attachment == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, ILogonInfoIntf.VERSION); + return null; + } + IAttachment result = vTable.attachment.invoke(this, status); + return result; + } + + public ITransaction transaction(IStatus status) + { + VTable vTable = getVTable(); + if (vTable.transaction == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, ILogonInfoIntf.VERSION); + return null; + } + ITransaction result = vTable.transaction.invoke(this, status); + return result; + } } public static class IManagement extends IPluginBase implements IManagementIntf @@ -10804,6 +11409,8 @@ public VTable(final IManagementIntf obj) { super(obj); + version = IManagementIntf.VERSION; + start = new Callback_start() { @Override public void invoke(IManagement self, IStatus status, ILogonInfo logonInfo) @@ -10992,6 +11599,8 @@ public VTable(final IAuthBlockIntf obj) { super(obj); + version = IAuthBlockIntf.VERSION; + getType = new Callback_getType() { @Override public String invoke(IAuthBlock self) @@ -11220,6 +11829,8 @@ public VTable(final IWireCryptPluginIntf obj) { super(obj); + version = IWireCryptPluginIntf.VERSION; + getKnownTypes = new Callback_getKnownTypes() { @Override public String invoke(IWireCryptPlugin self, IStatus status) @@ -11432,6 +12043,8 @@ public VTable(final ICryptKeyCallbackIntf obj) { super(obj); + version = ICryptKeyCallbackIntf.VERSION; + callback = new Callback_callback() { @Override public int invoke(ICryptKeyCallback self, int dataLength, com.sun.jna.Pointer data, int bufferLength, com.sun.jna.Pointer buffer) @@ -11518,6 +12131,8 @@ public VTable(final IKeyHolderPluginIntf obj) { super(obj); + version = IKeyHolderPluginIntf.VERSION; + keyCallback = new Callback_keyCallback() { @Override public int invoke(IKeyHolderPlugin self, IStatus status, ICryptKeyCallback callback) @@ -11682,6 +12297,8 @@ public VTable(final IDbCryptInfoIntf obj) { super(obj); + version = IDbCryptInfoIntf.VERSION; + getDatabaseFullPath = new Callback_getDatabaseFullPath() { @Override public String invoke(IDbCryptInfo self, IStatus status) @@ -11777,6 +12394,8 @@ public VTable(final IDbCryptPluginIntf obj) { super(obj); + version = IDbCryptPluginIntf.VERSION; + setKey = new Callback_setKey() { @Override public void invoke(IDbCryptPlugin self, IStatus status, int length, IKeyHolderPlugin[] sources, String keyName) @@ -11978,6 +12597,8 @@ public VTable(final IExternalContextIntf obj) { super(obj); + version = IExternalContextIntf.VERSION; + getMaster = new Callback_getMaster() { @Override public IMaster invoke(IExternalContext self) @@ -12247,6 +12868,8 @@ public VTable(final IExternalResultSetIntf obj) { super(obj); + version = IExternalResultSetIntf.VERSION; + fetch = new Callback_fetch() { @Override public boolean invoke(IExternalResultSet self, IStatus status) @@ -12332,6 +12955,8 @@ public VTable(final IExternalFunctionIntf obj) { super(obj); + version = IExternalFunctionIntf.VERSION; + getCharSet = new Callback_getCharSet() { @Override public void invoke(IExternalFunction self, IStatus status, IExternalContext context, com.sun.jna.Pointer name, int nameSize) @@ -12441,6 +13066,8 @@ public VTable(final IExternalProcedureIntf obj) { super(obj); + version = IExternalProcedureIntf.VERSION; + getCharSet = new Callback_getCharSet() { @Override public void invoke(IExternalProcedure self, IStatus status, IExternalContext context, com.sun.jna.Pointer name, int nameSize) @@ -12557,6 +13184,8 @@ public VTable(final IExternalTriggerIntf obj) { super(obj); + version = IExternalTriggerIntf.VERSION; + getCharSet = new Callback_getCharSet() { @Override public void invoke(IExternalTrigger self, IStatus status, IExternalContext context, com.sun.jna.Pointer name, int nameSize) @@ -12729,6 +13358,8 @@ public VTable(final IRoutineMetadataIntf obj) { super(obj); + version = IRoutineMetadataIntf.VERSION; + getPackage = new Callback_getPackage() { @Override public String invoke(IRoutineMetadata self, IStatus status) @@ -13058,6 +13689,8 @@ public VTable(final IExternalEngineIntf obj) { super(obj); + version = IExternalEngineIntf.VERSION; + open = new Callback_open() { @Override public void invoke(IExternalEngine self, IStatus status, IExternalContext context, com.sun.jna.Pointer charSet, int charSetSize) @@ -13272,6 +13905,8 @@ public VTable(final ITimerIntf obj) { super(obj); + version = ITimerIntf.VERSION; + handler = new Callback_handler() { @Override public void invoke(ITimer self) @@ -13347,6 +13982,8 @@ public VTable(final ITimerControlIntf obj) { super(obj); + version = ITimerControlIntf.VERSION; + start = new Callback_start() { @Override public void invoke(ITimerControl self, IStatus status, ITimer timer, long microSeconds) @@ -13451,6 +14088,8 @@ public VTable(final IVersionCallbackIntf obj) { super(obj); + version = IVersionCallbackIntf.VERSION; + callback = new Callback_callback() { @Override public void invoke(IVersionCallback self, IStatus status, String text) @@ -13634,6 +14273,8 @@ public VTable(final IUtilIntf obj) { super(obj); + version = IUtilIntf.VERSION; + getFbVersion = new Callback_getFbVersion() { @Override public void invoke(IUtil self, IStatus status, IAttachment att, IVersionCallback callback) @@ -14226,6 +14867,8 @@ public VTable(final IOffsetsCallbackIntf obj) { super(obj); + version = IOffsetsCallbackIntf.VERSION; + setOffset = new Callback_setOffset() { @Override public void invoke(IOffsetsCallback self, IStatus status, int index, int offset, int nullOffset) @@ -14399,6 +15042,8 @@ public VTable(final IXpbBuilderIntf obj) { super(obj); + version = IXpbBuilderIntf.VERSION; + clear = new Callback_clear() { @Override public void invoke(IXpbBuilder self, IStatus status) @@ -15038,6 +15683,8 @@ public VTable(final ITraceConnectionIntf obj) { super(obj); + version = ITraceConnectionIntf.VERSION; + getKind = new Callback_getKind() { @Override public int invoke(ITraceConnection self) @@ -15285,6 +15932,8 @@ public VTable(final ITraceDatabaseConnectionIntf obj) { super(obj); + version = ITraceDatabaseConnectionIntf.VERSION; + getConnectionID = new Callback_getConnectionID() { @Override public long invoke(ITraceDatabaseConnection self) @@ -15405,6 +16054,8 @@ public VTable(final ITraceTransactionIntf obj) { super(obj); + version = ITraceTransactionIntf.VERSION; + getTransactionID = new Callback_getTransactionID() { @Override public long invoke(ITraceTransaction self) @@ -15600,6 +16251,8 @@ public VTable(final ITraceParamsIntf obj) { super(obj); + version = ITraceParamsIntf.VERSION; + getCount = new Callback_getCount() { @Override public int invoke(ITraceParams self) @@ -15723,6 +16376,8 @@ public VTable(final ITraceStatementIntf obj) { super(obj); + version = ITraceStatementIntf.VERSION; + getStmtID = new Callback_getStmtID() { @Override public long invoke(ITraceStatement self) @@ -15833,6 +16488,8 @@ public VTable(final ITraceSQLStatementIntf obj) { super(obj); + version = ITraceSQLStatementIntf.VERSION; + getText = new Callback_getText() { @Override public String invoke(ITraceSQLStatement self) @@ -15990,6 +16647,8 @@ public VTable(final ITraceBLRStatementIntf obj) { super(obj); + version = ITraceBLRStatementIntf.VERSION; + getData = new Callback_getData() { @Override public com.sun.jna.Pointer invoke(ITraceBLRStatement self) @@ -16109,6 +16768,8 @@ public VTable(final ITraceDYNRequestIntf obj) { super(obj); + version = ITraceDYNRequestIntf.VERSION; + getData = new Callback_getData() { @Override public com.sun.jna.Pointer invoke(ITraceDYNRequest self) @@ -16228,6 +16889,8 @@ public VTable(final ITraceContextVariableIntf obj) { super(obj); + version = ITraceContextVariableIntf.VERSION; + getNameSpace = new Callback_getNameSpace() { @Override public String invoke(ITraceContextVariable self) @@ -16347,6 +17010,8 @@ public VTable(final ITraceProcedureIntf obj) { super(obj); + version = ITraceProcedureIntf.VERSION; + getProcName = new Callback_getProcName() { @Override public String invoke(ITraceProcedure self) @@ -16471,6 +17136,8 @@ public VTable(final ITraceFunctionIntf obj) { super(obj); + version = ITraceFunctionIntf.VERSION; + getFuncName = new Callback_getFuncName() { @Override public String invoke(ITraceFunction self) @@ -16619,6 +17286,8 @@ public VTable(final ITraceTriggerIntf obj) { super(obj); + version = ITraceTriggerIntf.VERSION; + getTriggerName = new Callback_getTriggerName() { @Override public String invoke(ITraceTrigger self) @@ -16776,6 +17445,8 @@ public VTable(final ITraceServiceConnectionIntf obj) { super(obj); + version = ITraceServiceConnectionIntf.VERSION; + getServiceID = new Callback_getServiceID() { @Override public com.sun.jna.Pointer invoke(ITraceServiceConnection self) @@ -16900,6 +17571,8 @@ public VTable(final ITraceStatusVectorIntf obj) { super(obj); + version = ITraceStatusVectorIntf.VERSION; + hasError = new Callback_hasError() { @Override public boolean invoke(ITraceStatusVector self) @@ -17048,6 +17721,8 @@ public VTable(final ITraceSweepInfoIntf obj) { super(obj); + version = ITraceSweepInfoIntf.VERSION; + getOIT = new Callback_getOIT() { @Override public long invoke(ITraceSweepInfo self) @@ -17200,6 +17875,8 @@ public VTable(final ITraceLogWriterIntf obj) { super(obj); + version = ITraceLogWriterIntf.VERSION; + write = new Callback_write() { @Override public int invoke(ITraceLogWriter self, com.sun.jna.Pointer buf, int size) @@ -17339,6 +18016,8 @@ public VTable(final ITraceInitInfoIntf obj) { super(obj); + version = ITraceInitInfoIntf.VERSION; + getConfigText = new Callback_getConfigText() { @Override public String invoke(ITraceInitInfo self) @@ -17667,6 +18346,8 @@ public VTable(final ITracePluginIntf obj) { super(obj); + version = ITracePluginIntf.VERSION; + trace_get_error = new Callback_trace_get_error() { @Override public String invoke(ITracePlugin self) @@ -18142,6 +18823,8 @@ public VTable(final ITraceFactoryIntf obj) { super(obj); + version = ITraceFactoryIntf.VERSION; + trace_needs = new Callback_trace_needs() { @Override public long invoke(ITraceFactory self) @@ -18246,6 +18929,8 @@ public VTable(final IUdrFunctionFactoryIntf obj) { super(obj); + version = IUdrFunctionFactoryIntf.VERSION; + setup = new Callback_setup() { @Override public void invoke(IUdrFunctionFactory self, IStatus status, IExternalContext context, IRoutineMetadata metadata, IMetadataBuilder inBuilder, IMetadataBuilder outBuilder) @@ -18357,6 +19042,8 @@ public VTable(final IUdrProcedureFactoryIntf obj) { super(obj); + version = IUdrProcedureFactoryIntf.VERSION; + setup = new Callback_setup() { @Override public void invoke(IUdrProcedureFactory self, IStatus status, IExternalContext context, IRoutineMetadata metadata, IMetadataBuilder inBuilder, IMetadataBuilder outBuilder) @@ -18468,6 +19155,8 @@ public VTable(final IUdrTriggerFactoryIntf obj) { super(obj); + version = IUdrTriggerFactoryIntf.VERSION; + setup = new Callback_setup() { @Override public void invoke(IUdrTriggerFactory self, IStatus status, IExternalContext context, IRoutineMetadata metadata, IMetadataBuilder fieldsBuilder) @@ -18589,6 +19278,8 @@ public VTable(final IUdrPluginIntf obj) { super(obj); + version = IUdrPluginIntf.VERSION; + getMaster = new Callback_getMaster() { @Override public IMaster invoke(IUdrPlugin self) @@ -18753,6 +19444,8 @@ public VTable(final IDecFloat16Intf obj) { super(obj); + version = IDecFloat16Intf.VERSION; + toBcd = new Callback_toBcd() { @Override public void invoke(IDecFloat16 self, FB_DEC16[] from, com.sun.jna.Pointer sign, byte[] bcd, com.sun.jna.Pointer exp) @@ -18908,6 +19601,8 @@ public VTable(final IDecFloat34Intf obj) { super(obj); + version = IDecFloat34Intf.VERSION; + toBcd = new Callback_toBcd() { @Override public void invoke(IDecFloat34 self, FB_DEC34[] from, com.sun.jna.Pointer sign, byte[] bcd, com.sun.jna.Pointer exp) @@ -19053,6 +19748,8 @@ public VTable(final IInt128Intf obj) { super(obj); + version = IInt128Intf.VERSION; + toString = new Callback_toString() { @Override public void invoke(IInt128 self, IStatus status, FB_I128[] from, int scale, int bufferLength, com.sun.jna.Pointer buffer) @@ -19139,18 +19836,43 @@ public void fromString(IStatus status, int scale, String from, FB_I128[] to) } } - public static class IReplicatedRecord extends IVersioned implements IReplicatedRecordIntf + public static class IReplicatedField extends IVersioned implements IReplicatedFieldIntf { public static class VTable extends IVersioned.VTable { - public static interface Callback_getRawLength extends com.sun.jna.Callback + public static interface Callback_getName extends com.sun.jna.Callback { - public int invoke(IReplicatedRecord self); + public String invoke(IReplicatedField self); } - public static interface Callback_getRawData extends com.sun.jna.Callback + public static interface Callback_getType extends com.sun.jna.Callback { - public com.sun.jna.Pointer invoke(IReplicatedRecord self); + public int invoke(IReplicatedField self); + } + + public static interface Callback_getSubType extends com.sun.jna.Callback + { + public int invoke(IReplicatedField self); + } + + public static interface Callback_getScale extends com.sun.jna.Callback + { + public int invoke(IReplicatedField self); + } + + public static interface Callback_getLength extends com.sun.jna.Callback + { + public int invoke(IReplicatedField self); + } + + public static interface Callback_getCharSet extends com.sun.jna.Callback + { + public int invoke(IReplicatedField self); + } + + public static interface Callback_getData extends com.sun.jna.Callback + { + public com.sun.jna.Pointer invoke(IReplicatedField self); } public VTable(com.sun.jna.Pointer pointer) @@ -19158,23 +19880,65 @@ public VTable(com.sun.jna.Pointer pointer) super(pointer); } - public VTable(final IReplicatedRecordIntf obj) + public VTable(final IReplicatedFieldIntf obj) { super(obj); - getRawLength = new Callback_getRawLength() { + version = IReplicatedFieldIntf.VERSION; + + getName = new Callback_getName() { @Override - public int invoke(IReplicatedRecord self) + public String invoke(IReplicatedField self) { - return obj.getRawLength(); + return obj.getName(); } }; - getRawData = new Callback_getRawData() { + getType = new Callback_getType() { @Override - public com.sun.jna.Pointer invoke(IReplicatedRecord self) + public int invoke(IReplicatedField self) { - return obj.getRawData(); + return obj.getType(); + } + }; + + getSubType = new Callback_getSubType() { + @Override + public int invoke(IReplicatedField self) + { + return obj.getSubType(); + } + }; + + getScale = new Callback_getScale() { + @Override + public int invoke(IReplicatedField self) + { + return obj.getScale(); + } + }; + + getLength = new Callback_getLength() { + @Override + public int invoke(IReplicatedField self) + { + return obj.getLength(); + } + }; + + getCharSet = new Callback_getCharSet() { + @Override + public int invoke(IReplicatedField self) + { + return obj.getCharSet(); + } + }; + + getData = new Callback_getData() { + @Override + public com.sun.jna.Pointer invoke(IReplicatedField self) + { + return obj.getData(); } }; } @@ -19183,23 +19947,28 @@ public VTable() { } - public Callback_getRawLength getRawLength; - public Callback_getRawData getRawData; + public Callback_getName getName; + public Callback_getType getType; + public Callback_getSubType getSubType; + public Callback_getScale getScale; + public Callback_getLength getLength; + public Callback_getCharSet getCharSet; + public Callback_getData getData; @Override protected java.util.List getFieldOrder() { java.util.List fields = super.getFieldOrder(); - fields.addAll(java.util.Arrays.asList("getRawLength", "getRawData")); + fields.addAll(java.util.Arrays.asList("getName", "getType", "getSubType", "getScale", "getLength", "getCharSet", "getData")); return fields; } } - public IReplicatedRecord() + public IReplicatedField() { } - public IReplicatedRecord(final IReplicatedRecordIntf obj) + public IReplicatedField(final IReplicatedFieldIntf obj) { vTable = new VTable(obj); vTable.write(); @@ -19213,44 +19982,99 @@ protected VTable createVTable() return new VTable(cloopVTable); } - public int getRawLength() + public String getName() { VTable vTable = getVTable(); - if (vTable.getRawLength == null) { + if (vTable.getName == null) { + return null; + } + String result = vTable.getName.invoke(this); + return result; + } + + public int getType() + { + VTable vTable = getVTable(); + if (vTable.getType == null) { return 0; } - int result = vTable.getRawLength.invoke(this); + int result = vTable.getType.invoke(this); return result; } - public com.sun.jna.Pointer getRawData() + public int getSubType() { VTable vTable = getVTable(); - if (vTable.getRawData == null) { + if (vTable.getSubType == null) { + return 0; + } + int result = vTable.getSubType.invoke(this); + return result; + } + + public int getScale() + { + VTable vTable = getVTable(); + if (vTable.getScale == null) { + return 0; + } + int result = vTable.getScale.invoke(this); + return result; + } + + public int getLength() + { + VTable vTable = getVTable(); + if (vTable.getLength == null) { + return 0; + } + int result = vTable.getLength.invoke(this); + return result; + } + + public int getCharSet() + { + VTable vTable = getVTable(); + if (vTable.getCharSet == null) { + return 0; + } + int result = vTable.getCharSet.invoke(this); + return result; + } + + public com.sun.jna.Pointer getData() + { + VTable vTable = getVTable(); + if (vTable.getData == null) { return null; } - com.sun.jna.Pointer result = vTable.getRawData.invoke(this); + com.sun.jna.Pointer result = vTable.getData.invoke(this); return result; } } - public static class IReplicatedBlob extends IVersioned implements IReplicatedBlobIntf + public static class IReplicatedRecord extends IVersioned implements IReplicatedRecordIntf { public static class VTable extends IVersioned.VTable { - public static interface Callback_getLength extends com.sun.jna.Callback + public static interface Callback_getCount extends com.sun.jna.Callback { - public int invoke(IReplicatedBlob self); + public int invoke(IReplicatedRecord self); } - public static interface Callback_isEof extends com.sun.jna.Callback + public static interface Callback_getField extends com.sun.jna.Callback { - public boolean invoke(IReplicatedBlob self); + public IReplicatedField invoke(IReplicatedRecord self, int index); } - public static interface Callback_getSegment extends com.sun.jna.Callback + public static interface Callback_getRawLength extends com.sun.jna.Callback + { + public int invoke(IReplicatedRecord self); + } + + public static interface Callback_getRawData extends com.sun.jna.Callback { - public int invoke(IReplicatedBlob self, int length, byte[] buffer); + public com.sun.jna.Pointer invoke(IReplicatedRecord self); } public VTable(com.sun.jna.Pointer pointer) @@ -19258,31 +20082,41 @@ public VTable(com.sun.jna.Pointer pointer) super(pointer); } - public VTable(final IReplicatedBlobIntf obj) + public VTable(final IReplicatedRecordIntf obj) { super(obj); - getLength = new Callback_getLength() { + version = IReplicatedRecordIntf.VERSION; + + getCount = new Callback_getCount() { @Override - public int invoke(IReplicatedBlob self) + public int invoke(IReplicatedRecord self) { - return obj.getLength(); + return obj.getCount(); } }; - isEof = new Callback_isEof() { + getField = new Callback_getField() { @Override - public boolean invoke(IReplicatedBlob self) + public IReplicatedField invoke(IReplicatedRecord self, int index) { - return obj.isEof(); + return obj.getField(index); } }; - getSegment = new Callback_getSegment() { + getRawLength = new Callback_getRawLength() { @Override - public int invoke(IReplicatedBlob self, int length, byte[] buffer) + public int invoke(IReplicatedRecord self) { - return obj.getSegment(length, buffer); + return obj.getRawLength(); + } + }; + + getRawData = new Callback_getRawData() { + @Override + public com.sun.jna.Pointer invoke(IReplicatedRecord self) + { + return obj.getRawData(); } }; } @@ -19291,24 +20125,25 @@ public VTable() { } - public Callback_getLength getLength; - public Callback_isEof isEof; - public Callback_getSegment getSegment; + public Callback_getCount getCount; + public Callback_getField getField; + public Callback_getRawLength getRawLength; + public Callback_getRawData getRawData; @Override protected java.util.List getFieldOrder() { java.util.List fields = super.getFieldOrder(); - fields.addAll(java.util.Arrays.asList("getLength", "isEof", "getSegment")); + fields.addAll(java.util.Arrays.asList("getCount", "getField", "getRawLength", "getRawData")); return fields; } } - public IReplicatedBlob() + public IReplicatedRecord() { } - public IReplicatedBlob(final IReplicatedBlobIntf obj) + public IReplicatedRecord(final IReplicatedRecordIntf obj) { vTable = new VTable(obj); vTable.write(); @@ -19322,33 +20157,43 @@ protected VTable createVTable() return new VTable(cloopVTable); } - public int getLength() + public int getCount() { VTable vTable = getVTable(); - if (vTable.getLength == null) { + if (vTable.getCount == null) { return 0; } - int result = vTable.getLength.invoke(this); + int result = vTable.getCount.invoke(this); return result; } - public boolean isEof() + public IReplicatedField getField(int index) { VTable vTable = getVTable(); - if (vTable.isEof == null) { - return false; + if (vTable.getField == null) { + return null; } - boolean result = vTable.isEof.invoke(this); + IReplicatedField result = vTable.getField.invoke(this, index); return result; } - public int getSegment(int length, byte[] buffer) + public int getRawLength() { VTable vTable = getVTable(); - if (vTable.getSegment == null) { + if (vTable.getRawLength == null) { return 0; } - int result = vTable.getSegment.invoke(this, length, buffer); + int result = vTable.getRawLength.invoke(this); + return result; + } + + public com.sun.jna.Pointer getRawData() + { + VTable vTable = getVTable(); + if (vTable.getRawData == null) { + return null; + } + com.sun.jna.Pointer result = vTable.getRawData.invoke(this); return result; } } @@ -19359,62 +20204,57 @@ public static class VTable extends IDisposable.VTable { public static interface Callback_prepare extends com.sun.jna.Callback { - public boolean invoke(IReplicatedTransaction self); + public void invoke(IReplicatedTransaction self, IStatus status); } public static interface Callback_commit extends com.sun.jna.Callback { - public boolean invoke(IReplicatedTransaction self); + public void invoke(IReplicatedTransaction self, IStatus status); } public static interface Callback_rollback extends com.sun.jna.Callback { - public boolean invoke(IReplicatedTransaction self); + public void invoke(IReplicatedTransaction self, IStatus status); } public static interface Callback_startSavepoint extends com.sun.jna.Callback { - public boolean invoke(IReplicatedTransaction self); + public void invoke(IReplicatedTransaction self, IStatus status); } public static interface Callback_releaseSavepoint extends com.sun.jna.Callback { - public boolean invoke(IReplicatedTransaction self); + public void invoke(IReplicatedTransaction self, IStatus status); } public static interface Callback_rollbackSavepoint extends com.sun.jna.Callback { - public boolean invoke(IReplicatedTransaction self); + public void invoke(IReplicatedTransaction self, IStatus status); } public static interface Callback_insertRecord extends com.sun.jna.Callback { - public boolean invoke(IReplicatedTransaction self, String name, IReplicatedRecord record); + public void invoke(IReplicatedTransaction self, IStatus status, String name, IReplicatedRecord record); } public static interface Callback_updateRecord extends com.sun.jna.Callback { - public boolean invoke(IReplicatedTransaction self, String name, IReplicatedRecord orgRecord, IReplicatedRecord newRecord); + public void invoke(IReplicatedTransaction self, IStatus status, String name, IReplicatedRecord orgRecord, IReplicatedRecord newRecord); } public static interface Callback_deleteRecord extends com.sun.jna.Callback { - public boolean invoke(IReplicatedTransaction self, String name, IReplicatedRecord record); - } - - public static interface Callback_storeBlob extends com.sun.jna.Callback - { - public boolean invoke(IReplicatedTransaction self, com.sun.jna.ptr.LongByReference blobId, IReplicatedBlob blob); + public void invoke(IReplicatedTransaction self, IStatus status, String name, IReplicatedRecord record); } public static interface Callback_executeSql extends com.sun.jna.Callback { - public boolean invoke(IReplicatedTransaction self, String sql); + public void invoke(IReplicatedTransaction self, IStatus status, String sql); } public static interface Callback_executeSqlIntl extends com.sun.jna.Callback { - public boolean invoke(IReplicatedTransaction self, int charset, String sql); + public void invoke(IReplicatedTransaction self, IStatus status, int charset, String sql); } public VTable(com.sun.jna.Pointer pointer) @@ -19426,99 +20266,170 @@ public VTable(final IReplicatedTransactionIntf obj) { super(obj); + version = IReplicatedTransactionIntf.VERSION; + prepare = new Callback_prepare() { @Override - public boolean invoke(IReplicatedTransaction self) + public void invoke(IReplicatedTransaction self, IStatus status) { - return obj.prepare(); + try + { + obj.prepare(status); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } } }; commit = new Callback_commit() { @Override - public boolean invoke(IReplicatedTransaction self) + public void invoke(IReplicatedTransaction self, IStatus status) { - return obj.commit(); + try + { + obj.commit(status); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } } }; rollback = new Callback_rollback() { @Override - public boolean invoke(IReplicatedTransaction self) + public void invoke(IReplicatedTransaction self, IStatus status) { - return obj.rollback(); + try + { + obj.rollback(status); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } } }; startSavepoint = new Callback_startSavepoint() { @Override - public boolean invoke(IReplicatedTransaction self) + public void invoke(IReplicatedTransaction self, IStatus status) { - return obj.startSavepoint(); + try + { + obj.startSavepoint(status); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } } }; releaseSavepoint = new Callback_releaseSavepoint() { @Override - public boolean invoke(IReplicatedTransaction self) + public void invoke(IReplicatedTransaction self, IStatus status) { - return obj.releaseSavepoint(); + try + { + obj.releaseSavepoint(status); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } } }; rollbackSavepoint = new Callback_rollbackSavepoint() { @Override - public boolean invoke(IReplicatedTransaction self) + public void invoke(IReplicatedTransaction self, IStatus status) { - return obj.rollbackSavepoint(); + try + { + obj.rollbackSavepoint(status); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } } }; insertRecord = new Callback_insertRecord() { @Override - public boolean invoke(IReplicatedTransaction self, String name, IReplicatedRecord record) + public void invoke(IReplicatedTransaction self, IStatus status, String name, IReplicatedRecord record) { - return obj.insertRecord(name, record); + try + { + obj.insertRecord(status, name, record); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } } }; updateRecord = new Callback_updateRecord() { @Override - public boolean invoke(IReplicatedTransaction self, String name, IReplicatedRecord orgRecord, IReplicatedRecord newRecord) + public void invoke(IReplicatedTransaction self, IStatus status, String name, IReplicatedRecord orgRecord, IReplicatedRecord newRecord) { - return obj.updateRecord(name, orgRecord, newRecord); + try + { + obj.updateRecord(status, name, orgRecord, newRecord); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } } }; deleteRecord = new Callback_deleteRecord() { @Override - public boolean invoke(IReplicatedTransaction self, String name, IReplicatedRecord record) + public void invoke(IReplicatedTransaction self, IStatus status, String name, IReplicatedRecord record) { - return obj.deleteRecord(name, record); - } - }; - - storeBlob = new Callback_storeBlob() { - @Override - public boolean invoke(IReplicatedTransaction self, com.sun.jna.ptr.LongByReference blobId, IReplicatedBlob blob) - { - return obj.storeBlob(blobId, blob); + try + { + obj.deleteRecord(status, name, record); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } } }; executeSql = new Callback_executeSql() { @Override - public boolean invoke(IReplicatedTransaction self, String sql) + public void invoke(IReplicatedTransaction self, IStatus status, String sql) { - return obj.executeSql(sql); + try + { + obj.executeSql(status, sql); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } } }; executeSqlIntl = new Callback_executeSqlIntl() { @Override - public boolean invoke(IReplicatedTransaction self, int charset, String sql) + public void invoke(IReplicatedTransaction self, IStatus status, int charset, String sql) { - return obj.executeSqlIntl(charset, sql); + try + { + obj.executeSqlIntl(status, charset, sql); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } } }; } @@ -19536,7 +20447,6 @@ public VTable() public Callback_insertRecord insertRecord; public Callback_updateRecord updateRecord; public Callback_deleteRecord deleteRecord; - public Callback_storeBlob storeBlob; public Callback_executeSql executeSql; public Callback_executeSqlIntl executeSqlIntl; @@ -19544,7 +20454,7 @@ public VTable() protected java.util.List getFieldOrder() { java.util.List fields = super.getFieldOrder(); - fields.addAll(java.util.Arrays.asList("prepare", "commit", "rollback", "startSavepoint", "releaseSavepoint", "rollbackSavepoint", "insertRecord", "updateRecord", "deleteRecord", "storeBlob", "executeSql", "executeSqlIntl")); + fields.addAll(java.util.Arrays.asList("prepare", "commit", "rollback", "startSavepoint", "releaseSavepoint", "rollbackSavepoint", "insertRecord", "updateRecord", "deleteRecord", "executeSql", "executeSqlIntl")); return fields; } } @@ -19567,149 +20477,139 @@ protected VTable createVTable() return new VTable(cloopVTable); } - public boolean prepare() + public void prepare(IStatus status) { VTable vTable = getVTable(); if (vTable.prepare == null) { - return false; + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IReplicatedTransactionIntf.VERSION); + return; } - boolean result = vTable.prepare.invoke(this); - return result; + vTable.prepare.invoke(this, status); } - public boolean commit() + public void commit(IStatus status) { VTable vTable = getVTable(); if (vTable.commit == null) { - return false; + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IReplicatedTransactionIntf.VERSION); + return; } - boolean result = vTable.commit.invoke(this); - return result; + vTable.commit.invoke(this, status); } - public boolean rollback() + public void rollback(IStatus status) { VTable vTable = getVTable(); if (vTable.rollback == null) { - return false; + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IReplicatedTransactionIntf.VERSION); + return; } - boolean result = vTable.rollback.invoke(this); - return result; + vTable.rollback.invoke(this, status); } - public boolean startSavepoint() + public void startSavepoint(IStatus status) { VTable vTable = getVTable(); if (vTable.startSavepoint == null) { - return false; + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IReplicatedTransactionIntf.VERSION); + return; } - boolean result = vTable.startSavepoint.invoke(this); - return result; + vTable.startSavepoint.invoke(this, status); } - public boolean releaseSavepoint() + public void releaseSavepoint(IStatus status) { VTable vTable = getVTable(); if (vTable.releaseSavepoint == null) { - return false; + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IReplicatedTransactionIntf.VERSION); + return; } - boolean result = vTable.releaseSavepoint.invoke(this); - return result; + vTable.releaseSavepoint.invoke(this, status); } - public boolean rollbackSavepoint() + public void rollbackSavepoint(IStatus status) { VTable vTable = getVTable(); if (vTable.rollbackSavepoint == null) { - return false; + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IReplicatedTransactionIntf.VERSION); + return; } - boolean result = vTable.rollbackSavepoint.invoke(this); - return result; + vTable.rollbackSavepoint.invoke(this, status); } - public boolean insertRecord(String name, IReplicatedRecord record) + public void insertRecord(IStatus status, String name, IReplicatedRecord record) { VTable vTable = getVTable(); if (vTable.insertRecord == null) { - return false; + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IReplicatedTransactionIntf.VERSION); + return; } - boolean result = vTable.insertRecord.invoke(this, name, record); - return result; + vTable.insertRecord.invoke(this, status, name, record); } - public boolean updateRecord(String name, IReplicatedRecord orgRecord, IReplicatedRecord newRecord) + public void updateRecord(IStatus status, String name, IReplicatedRecord orgRecord, IReplicatedRecord newRecord) { VTable vTable = getVTable(); if (vTable.updateRecord == null) { - return false; + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IReplicatedTransactionIntf.VERSION); + return; } - boolean result = vTable.updateRecord.invoke(this, name, orgRecord, newRecord); - return result; + vTable.updateRecord.invoke(this, status, name, orgRecord, newRecord); } - public boolean deleteRecord(String name, IReplicatedRecord record) + public void deleteRecord(IStatus status, String name, IReplicatedRecord record) { VTable vTable = getVTable(); if (vTable.deleteRecord == null) { - return false; - } - boolean result = vTable.deleteRecord.invoke(this, name, record); - return result; - } - - public boolean storeBlob(com.sun.jna.ptr.LongByReference blobId, IReplicatedBlob blob) - { - VTable vTable = getVTable(); - if (vTable.storeBlob == null) { - return false; + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IReplicatedTransactionIntf.VERSION); + return; } - boolean result = vTable.storeBlob.invoke(this, blobId, blob); - return result; + vTable.deleteRecord.invoke(this, status, name, record); } - public boolean executeSql(String sql) + public void executeSql(IStatus status, String sql) { VTable vTable = getVTable(); if (vTable.executeSql == null) { - return false; + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IReplicatedTransactionIntf.VERSION); + return; } - boolean result = vTable.executeSql.invoke(this, sql); - return result; + vTable.executeSql.invoke(this, status, sql); } - public boolean executeSqlIntl(int charset, String sql) + public void executeSqlIntl(IStatus status, int charset, String sql) { VTable vTable = getVTable(); if (vTable.executeSqlIntl == null) { - return false; + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IReplicatedTransactionIntf.VERSION); + return; } - boolean result = vTable.executeSqlIntl.invoke(this, charset, sql); - return result; + vTable.executeSqlIntl.invoke(this, status, charset, sql); } } - public static class IReplicatedSession extends IDisposable implements IReplicatedSessionIntf + public static class IReplicatedSession extends IPluginBase implements IReplicatedSessionIntf { - public static class VTable extends IDisposable.VTable + public static class VTable extends IPluginBase.VTable { - public static interface Callback_getStatus extends com.sun.jna.Callback + public static interface Callback_init extends com.sun.jna.Callback { - public IStatus invoke(IReplicatedSession self); + public boolean invoke(IReplicatedSession self, IStatus status, IAttachment attachment); } public static interface Callback_startTransaction extends com.sun.jna.Callback { - public IReplicatedTransaction invoke(IReplicatedSession self, long number); + public IReplicatedTransaction invoke(IReplicatedSession self, IStatus status, ITransaction transaction, long number); } public static interface Callback_cleanupTransaction extends com.sun.jna.Callback { - public boolean invoke(IReplicatedSession self, long number); + public void invoke(IReplicatedSession self, IStatus status, long number); } public static interface Callback_setSequence extends com.sun.jna.Callback { - public boolean invoke(IReplicatedSession self, String name, long value); + public void invoke(IReplicatedSession self, IStatus status, String name, long value); } public VTable(com.sun.jna.Pointer pointer) @@ -19721,35 +20621,67 @@ public VTable(final IReplicatedSessionIntf obj) { super(obj); - getStatus = new Callback_getStatus() { + version = IReplicatedSessionIntf.VERSION; + + init = new Callback_init() { @Override - public IStatus invoke(IReplicatedSession self) + public boolean invoke(IReplicatedSession self, IStatus status, IAttachment attachment) { - return obj.getStatus(); + try + { + return obj.init(status, attachment); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + return false; + } } }; startTransaction = new Callback_startTransaction() { @Override - public IReplicatedTransaction invoke(IReplicatedSession self, long number) + public IReplicatedTransaction invoke(IReplicatedSession self, IStatus status, ITransaction transaction, long number) { - return obj.startTransaction(number); + try + { + return obj.startTransaction(status, transaction, number); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + return null; + } } }; cleanupTransaction = new Callback_cleanupTransaction() { @Override - public boolean invoke(IReplicatedSession self, long number) + public void invoke(IReplicatedSession self, IStatus status, long number) { - return obj.cleanupTransaction(number); + try + { + obj.cleanupTransaction(status, number); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } } }; setSequence = new Callback_setSequence() { @Override - public boolean invoke(IReplicatedSession self, String name, long value) + public void invoke(IReplicatedSession self, IStatus status, String name, long value) { - return obj.setSequence(name, value); + try + { + obj.setSequence(status, name, value); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } } }; } @@ -19758,7 +20690,7 @@ public VTable() { } - public Callback_getStatus getStatus; + public Callback_init init; public Callback_startTransaction startTransaction; public Callback_cleanupTransaction cleanupTransaction; public Callback_setSequence setSequence; @@ -19767,7 +20699,7 @@ public VTable() protected java.util.List getFieldOrder() { java.util.List fields = super.getFieldOrder(); - fields.addAll(java.util.Arrays.asList("getStatus", "startTransaction", "cleanupTransaction", "setSequence")); + fields.addAll(java.util.Arrays.asList("init", "startTransaction", "cleanupTransaction", "setSequence")); return fields; } } @@ -19790,44 +20722,46 @@ protected VTable createVTable() return new VTable(cloopVTable); } - public IStatus getStatus() + public boolean init(IStatus status, IAttachment attachment) { VTable vTable = getVTable(); - if (vTable.getStatus == null) { - return null; + if (vTable.init == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IReplicatedSessionIntf.VERSION); + return false; } - IStatus result = vTable.getStatus.invoke(this); + boolean result = vTable.init.invoke(this, status, attachment); return result; } - public IReplicatedTransaction startTransaction(long number) + public IReplicatedTransaction startTransaction(IStatus status, ITransaction transaction, long number) { VTable vTable = getVTable(); if (vTable.startTransaction == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IReplicatedSessionIntf.VERSION); return null; } - IReplicatedTransaction result = vTable.startTransaction.invoke(this, number); + IReplicatedTransaction result = vTable.startTransaction.invoke(this, status, transaction, number); return result; } - public boolean cleanupTransaction(long number) + public void cleanupTransaction(IStatus status, long number) { VTable vTable = getVTable(); if (vTable.cleanupTransaction == null) { - return false; + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IReplicatedSessionIntf.VERSION); + return; } - boolean result = vTable.cleanupTransaction.invoke(this, number); - return result; + vTable.cleanupTransaction.invoke(this, status, number); } - public boolean setSequence(String name, long value) + public void setSequence(IStatus status, String name, long value) { VTable vTable = getVTable(); if (vTable.setSequence == null) { - return false; + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IReplicatedSessionIntf.VERSION); + return; } - boolean result = vTable.setSequence.invoke(this, name, value); - return result; + vTable.setSequence.invoke(this, status, name, value); } } } diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbInterfaceException.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbInterfaceException.java index 5d3b5e83b3..c455a00e09 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbInterfaceException.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbInterfaceException.java @@ -3,7 +3,7 @@ /** * Class with for wrapping an exception thrown by the native interface. * - * @since 4.0 + * @since 5.0 */ public class FbInterfaceException { public static void catchException(FbInterface.IStatus status, Throwable t) { @@ -13,7 +13,7 @@ public static void catchException(FbInterface.IStatus status, Throwable t) { java.io.PrintWriter pw = new java.io.PrintWriter(sw); t.printStackTrace(pw); String msg = sw.toString(); - try (CloseableMemory memory = new CloseableMemory(msg.length())) { + try (CloseableMemory memory = new CloseableMemory(msg.length() + 1)) { memory.setString(0, msg); com.sun.jna.Pointer[] vector = new com.sun.jna.Pointer[]{ new com.sun.jna.Pointer(org.firebirdsql.gds.ISCConstants.isc_arg_gds), diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbOOClientDatabaseFactory.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbOOClientDatabaseFactory.java index 19777120a8..eb41658690 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbOOClientDatabaseFactory.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbOOClientDatabaseFactory.java @@ -4,6 +4,12 @@ import org.firebirdsql.gds.JaybirdSystemProperties; import org.firebirdsql.jna.fbclient.FbClientLibrary; +/** + * Implementation of {@link org.firebirdsql.nativeoo.gds.ng.AbstractNativeOODatabaseFactory} to connect with native + * client library via OO API. + * + * @since 5.0 + */ public class FbOOClientDatabaseFactory extends AbstractNativeOODatabaseFactory { private static final FbOOClientDatabaseFactory INSTANCE = new FbOOClientDatabaseFactory(); diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbOOEmbeddedDatabaseFactory.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbOOEmbeddedDatabaseFactory.java index 58d30c4f14..f57ab956c6 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbOOEmbeddedDatabaseFactory.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbOOEmbeddedDatabaseFactory.java @@ -2,7 +2,7 @@ import com.sun.jna.Native; import org.firebirdsql.gds.JaybirdSystemProperties; -import org.firebirdsql.gds.ng.*; +import org.firebirdsql.gds.ng.IAttachProperties; import org.firebirdsql.jna.fbclient.FbClientLibrary; import org.firebirdsql.logging.Logger; import org.firebirdsql.logging.LoggerFactory; @@ -12,6 +12,12 @@ import java.util.Collections; import java.util.List; +/** + * Implementation of {@link org.firebirdsql.nativeoo.gds.ng.AbstractNativeOODatabaseFactory} to connect with embedded + * client library via OO API. + * + * @since 5.0 + */ public class FbOOEmbeddedDatabaseFactory extends AbstractNativeOODatabaseFactory { private static final Logger log = LoggerFactory.getLogger(FbOOEmbeddedDatabaseFactory.class); diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbOOLocalDatabaseFactory.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbOOLocalDatabaseFactory.java deleted file mode 100644 index e3dd0b73ee..0000000000 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbOOLocalDatabaseFactory.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.firebirdsql.nativeoo.gds.ng; - -import org.firebirdsql.gds.ng.*; -import org.firebirdsql.jna.fbclient.FbClientLibrary; - -public class FbOOLocalDatabaseFactory extends AbstractNativeOODatabaseFactory { - - private static final FbOOLocalDatabaseFactory INSTANCE = new FbOOLocalDatabaseFactory(); - - @Override - protected FbClientLibrary getClientLibrary() { - return FbOOClientDatabaseFactory.getInstance().getClientLibrary(); - } - - @Override - protected > T filterProperties(T attachProperties) { - T attachPropertiesCopy = attachProperties.asNewMutable(); - // Clear server name - attachPropertiesCopy.setServerName(null); - return attachPropertiesCopy; - } - - public static FbOOLocalDatabaseFactory getInstance() { - return INSTANCE; - } -} diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IBatchCompletionStateImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IBatchCompletionStateImpl.java index 285e17923f..fec8175758 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IBatchCompletionStateImpl.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IBatchCompletionStateImpl.java @@ -1,15 +1,17 @@ package org.firebirdsql.nativeoo.gds.ng; import org.firebirdsql.gds.ng.FbBatchCompletionState; -import org.firebirdsql.nativeoo.gds.ng.FbInterface.*; +import org.firebirdsql.nativeoo.gds.ng.FbInterface.IBatchCompletionState; +import org.firebirdsql.nativeoo.gds.ng.FbInterface.IStatus; +import org.firebirdsql.nativeoo.gds.ng.FbInterface.IUtil; import java.sql.SQLException; /** - * Implementation of {@Link FbBatchCompletionState} for native batch execution. + * Implementation of {@link org.firebirdsql.gds.ng.FbBatchCompletionState} for native batch execution. * * @author Vasiliy Yashkov - * @since 4.0 + * @since 5.0 */ public class IBatchCompletionStateImpl implements FbBatchCompletionState { diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IBatchImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IBatchImpl.java index 1bf4467756..a8ce8afbd7 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IBatchImpl.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IBatchImpl.java @@ -4,21 +4,28 @@ import org.firebirdsql.gds.BatchParameterBuffer; import org.firebirdsql.gds.BlobParameterBuffer; import org.firebirdsql.gds.impl.GDSHelper; -import org.firebirdsql.gds.ng.*; +import org.firebirdsql.gds.ng.AbstractFbBatch; +import org.firebirdsql.gds.ng.FbBatchCompletionState; +import org.firebirdsql.gds.ng.FbBlob; +import org.firebirdsql.gds.ng.FbDatabase; +import org.firebirdsql.gds.ng.FbMessageMetadata; +import org.firebirdsql.gds.ng.FbStatement; +import org.firebirdsql.gds.ng.FbTransaction; import org.firebirdsql.gds.ng.fields.RowValue; import org.firebirdsql.jdbc.FBBlob; -import org.firebirdsql.logging.Logger; -import org.firebirdsql.logging.LoggerFactory; -import org.firebirdsql.nativeoo.gds.ng.FbInterface.*; +import org.firebirdsql.nativeoo.gds.ng.FbInterface.IAttachment; +import org.firebirdsql.nativeoo.gds.ng.FbInterface.IBatch; +import org.firebirdsql.nativeoo.gds.ng.FbInterface.IBatchCompletionState; +import org.firebirdsql.nativeoo.gds.ng.FbInterface.IStatus; import java.io.IOException; import java.sql.SQLException; /** - * Implementation of {@link FbBatch} for native OO API. + * Implementation of {@link org.firebirdsql.gds.ng.FbBatch} for native OO API. * * @author Vasiliy Yashkov - * @since 4.0 + * @since 5.0 */ public class IBatchImpl extends AbstractFbBatch { diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IBlobImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IBlobImpl.java index 4650855b39..832562c1a6 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IBlobImpl.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IBlobImpl.java @@ -7,7 +7,9 @@ import org.firebirdsql.gds.ng.FbBlob; import org.firebirdsql.gds.ng.FbExceptionBuilder; import org.firebirdsql.gds.ng.listeners.DatabaseListener; -import org.firebirdsql.nativeoo.gds.ng.FbInterface.*; +import org.firebirdsql.nativeoo.gds.ng.FbInterface.IAttachment; +import org.firebirdsql.nativeoo.gds.ng.FbInterface.IBlob; +import org.firebirdsql.nativeoo.gds.ng.FbInterface.IStatus; import java.nio.ByteBuffer; import java.sql.SQLException; @@ -17,9 +19,10 @@ import static org.firebirdsql.gds.JaybirdErrorCodes.jb_blobPutSegmentTooLong; /** + * Implementation of {@link org.firebirdsql.gds.ng.FbBlob} for native OO API. * * @author Vasiliy Yashkov - * @since 4.0 + * @since 5.0 */ public class IBlobImpl extends AbstractFbBlob implements FbBlob, DatabaseListener { diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IDatabaseImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IDatabaseImpl.java index 8cb0a3c328..75684dd208 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IDatabaseImpl.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IDatabaseImpl.java @@ -1,14 +1,37 @@ package org.firebirdsql.nativeoo.gds.ng; -import org.firebirdsql.gds.*; -import org.firebirdsql.gds.impl.DatabaseParameterBufferExtension; -import org.firebirdsql.gds.ng.*; +import org.firebirdsql.gds.BatchParameterBuffer; +import org.firebirdsql.gds.BlobParameterBuffer; +import org.firebirdsql.gds.DatabaseParameterBuffer; +import org.firebirdsql.gds.EventHandle; +import org.firebirdsql.gds.EventHandler; +import org.firebirdsql.gds.JaybirdErrorCodes; +import org.firebirdsql.gds.TransactionParameterBuffer; +import org.firebirdsql.gds.VaxEncoding; +import org.firebirdsql.gds.ng.AbstractFbDatabase; +import org.firebirdsql.gds.ng.FbBatch; +import org.firebirdsql.gds.ng.FbBlob; +import org.firebirdsql.gds.ng.FbAttachment; +import org.firebirdsql.gds.ng.FbExceptionBuilder; +import org.firebirdsql.gds.ng.FbMessageMetadata; +import org.firebirdsql.gds.ng.FbMetadataBuilder; +import org.firebirdsql.gds.ng.FbStatement; +import org.firebirdsql.gds.ng.FbTransaction; +import org.firebirdsql.gds.ng.ParameterConverter; +import org.firebirdsql.gds.ng.TransactionState; +import org.firebirdsql.gds.ng.WarningMessageCallback; import org.firebirdsql.gds.ng.listeners.TransactionListener; import org.firebirdsql.jdbc.FBDriverNotCapableException; import org.firebirdsql.jdbc.SQLStateConstants; import org.firebirdsql.jna.fbclient.FbClientLibrary; import org.firebirdsql.jna.fbclient.ISC_STATUS; -import org.firebirdsql.nativeoo.gds.ng.FbInterface.*; +import org.firebirdsql.nativeoo.gds.ng.FbInterface.IAttachment; +import org.firebirdsql.nativeoo.gds.ng.FbInterface.IEvents; +import org.firebirdsql.nativeoo.gds.ng.FbInterface.IMaster; +import org.firebirdsql.nativeoo.gds.ng.FbInterface.IProvider; +import org.firebirdsql.nativeoo.gds.ng.FbInterface.IStatus; +import org.firebirdsql.nativeoo.gds.ng.FbInterface.ITransaction; +import org.firebirdsql.nativeoo.gds.ng.FbInterface.IUtil; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -23,20 +46,20 @@ * Implementation of {@link org.firebirdsql.gds.ng.FbDatabase} for native OO API. * * @author Vasiliy Yashkov - * @since 4.0 + * @since 5.0 */ public class IDatabaseImpl extends AbstractFbDatabase implements FbAttachment, TransactionListener { private static final ParameterConverter PARAMETER_CONVERTER = new IParameterConverterImpl(); - private final FbClientLibrary clientLibrary; - private final IMaster master; + private FbClientLibrary clientLibrary; + private IMaster master; private final IProvider provider; private final IUtil util; - private IAttachment attachment; + protected IAttachment attachment; private IEvents events; - private final IStatus status; + protected IStatus status; public IDatabaseImpl(NativeDatabaseConnection connection) { @@ -59,9 +82,7 @@ protected final FbClientLibrary getClientLibrary() { @Override public void attach() throws SQLException { try { - final DatabaseParameterBuffer dpb = ((DatabaseParameterBufferExtension) PARAMETER_CONVERTER - .toDatabaseParameterBuffer(connection)) - .removeExtensionParams(); + final DatabaseParameterBuffer dpb = PARAMETER_CONVERTER.toDatabaseParameterBuffer(connection); attachOrCreate(dpb, false); } catch (SQLException e) { exceptionListenerDispatcher.errorOccurred(e); @@ -86,9 +107,7 @@ protected void internalDetach() throws SQLException { @Override public void createDatabase() throws SQLException { try { - final DatabaseParameterBuffer dpb = ((DatabaseParameterBufferExtension) PARAMETER_CONVERTER - .toDatabaseParameterBuffer(connection)) - .removeExtensionParams(); + final DatabaseParameterBuffer dpb = PARAMETER_CONVERTER.toDatabaseParameterBuffer(connection); attachOrCreate(dpb, true); } catch (SQLException e) { exceptionListenerDispatcher.errorOccurred(e); diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IEventImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IEventImpl.java index 01a86d2b9f..f0c7db6333 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IEventImpl.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IEventImpl.java @@ -14,7 +14,7 @@ * Event handle for the native OO API. * * @author Vasiliy Yashkov - * @since 4.0 + * @since 5.0 */ public class IEventImpl extends AbstractEventHandle { @@ -25,7 +25,7 @@ public class IEventImpl extends AbstractEventHandle { private final PointerByReference eventBuffer = new PointerByReference(); private final PointerByReference resultBuffer = new PointerByReference(); private IEventCallback callback = new IEventCallback(new IEventCallbackImpl()); - private int referenceCount = 0; + private volatile int referenceCount = 0; IEventImpl(String eventName, EventHandler eventHandler, Encoding encoding) { super(eventName, eventHandler); @@ -109,27 +109,21 @@ private class IEventCallbackImpl implements IEventCallbackIntf { @Override public void addRef() { - synchronized (this) { - ++referenceCount; - } + ++referenceCount; } @Override public int release() { - synchronized (this) { - return --referenceCount; - } + return --referenceCount; } @Override public void eventCallbackFunction(int length, com.sun.jna.Pointer events) { - synchronized (this) { - if (events != null) { - resultBuffer.getValue().write(0, events.getByteArray(0, length), 0, length); - this.release(); + if (events != null) { + resultBuffer.getValue().write(0, events.getByteArray(0, length), 0, length); + this.release(); - onEventOccurred(); - } + onEventOccurred(); } } diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IMessageBuilderImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IMessageBuilderImpl.java index a6c710abee..a9382dcb64 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IMessageBuilderImpl.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IMessageBuilderImpl.java @@ -6,11 +6,11 @@ import java.sql.SQLException; /** - * Implementation of {@link AbstractFbMessageBuilder} - * to build messages for a native connection using OO API. + * Implementation of {@link org.firebirdsql.gds.ng.AbstractFbMessageBuilder} to build messages for a native connection + * using OO API. * * @author Vasiliy Yashkov - * @since 4.0 + * @since 5.0 */ public class IMessageBuilderImpl extends AbstractFbMessageBuilder { diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IMessageMetadataImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IMessageMetadataImpl.java index 3353f6fecc..3b34265e47 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IMessageMetadataImpl.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IMessageMetadataImpl.java @@ -2,15 +2,17 @@ import org.firebirdsql.gds.ng.FbMessageMetadata; import org.firebirdsql.gds.ng.FbMetadataBuilder; -import org.firebirdsql.nativeoo.gds.ng.FbInterface.*; +import org.firebirdsql.nativeoo.gds.ng.FbInterface.IMessageMetadata; +import org.firebirdsql.nativeoo.gds.ng.FbInterface.IMetadataBuilder; +import org.firebirdsql.nativeoo.gds.ng.FbInterface.IStatus; import java.sql.SQLException; /** - * Implementation of {@link FbMessageMetadata} for native OO API. + * Implementation of {@link org.firebirdsql.gds.ng.FbMessageMetadata} for native OO API. * * @author Vasiliy Yashkov - * @since 4.0 + * @since 5.0 */ public class IMessageMetadataImpl implements FbMessageMetadata { @@ -131,6 +133,12 @@ public int getType(int index) throws SQLException { return result; } + public boolean isNullable(int index) throws SQLException { + boolean result = metadata.isNullable(getStatus(), index); + processStatus(); + return result; + } + public FbMetadataBuilder getBuilder() throws SQLException { if (metadataBuilderImpl == null) metadataBuilderImpl = new IMetadataBuilderImpl(this.database, metadata.getCount(getStatus())); diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IMetadataBuilderImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IMetadataBuilderImpl.java index ea107bfb6b..26979b96bd 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IMetadataBuilderImpl.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IMetadataBuilderImpl.java @@ -3,13 +3,31 @@ import org.firebirdsql.gds.ng.FbDatabase; import org.firebirdsql.gds.ng.FbMessageMetadata; import org.firebirdsql.gds.ng.FbMetadataBuilder; -import org.firebirdsql.nativeoo.gds.ng.FbInterface.*; +import org.firebirdsql.nativeoo.gds.ng.FbInterface.IMaster; +import org.firebirdsql.nativeoo.gds.ng.FbInterface.IMessageMetadata; +import org.firebirdsql.nativeoo.gds.ng.FbInterface.IMetadataBuilder; +import org.firebirdsql.nativeoo.gds.ng.FbInterface.IStatus; import java.sql.SQLException; -import static org.firebirdsql.gds.ISCConstants.*; +import static org.firebirdsql.gds.ISCConstants.SQL_BLOB; +import static org.firebirdsql.gds.ISCConstants.SQL_BOOLEAN; +import static org.firebirdsql.gds.ISCConstants.SQL_DATE; +import static org.firebirdsql.gds.ISCConstants.SQL_DEC16; +import static org.firebirdsql.gds.ISCConstants.SQL_DEC34; +import static org.firebirdsql.gds.ISCConstants.SQL_DOUBLE; +import static org.firebirdsql.gds.ISCConstants.SQL_FLOAT; +import static org.firebirdsql.gds.ISCConstants.SQL_INT64; +import static org.firebirdsql.gds.ISCConstants.SQL_INT128; +import static org.firebirdsql.gds.ISCConstants.SQL_LONG; +import static org.firebirdsql.gds.ISCConstants.SQL_SHORT; +import static org.firebirdsql.gds.ISCConstants.SQL_TEXT; +import static org.firebirdsql.gds.ISCConstants.SQL_TIMESTAMP; +import static org.firebirdsql.gds.ISCConstants.SQL_TYPE_TIME; +import static org.firebirdsql.gds.ISCConstants.SQL_VARYING; /** + * Implementation of {@link org.firebirdsql.gds.ng.FbMetadataBuilder} for native OO API. * * @author Vasiliy Yashkov * @since 4.0 @@ -84,8 +102,21 @@ public void addFloat(int index) throws SQLException { @Override public void addNumeric(int index, int size, int scale) throws SQLException { - metadataBuilder.setType(status, index, SQL_SHORT); - metadataBuilder.setLength(status, index, size); + int length = 0; + if (size < 5) { + metadataBuilder.setType(status, index, SQL_SHORT); + length = 2; + } else if (size < 10) { + metadataBuilder.setType(status, index, SQL_LONG); + length = 4; + } else if (size < 19) { + metadataBuilder.setType(status, index, SQL_INT64); + length = 8; + } else { + metadataBuilder.setType(status, index, SQL_INT128); + length = 16; + } + metadataBuilder.setLength(status, index, length); if (scale > 0) scale = -scale; metadataBuilder.setScale(status, index, scale); @@ -94,8 +125,21 @@ public void addNumeric(int index, int size, int scale) throws SQLException { @Override public void addDecimal(int index, int size, int scale) throws SQLException { - metadataBuilder.setType(status, index, SQL_LONG); - metadataBuilder.setLength(status, index, size); + int length = 0; + if (size < 5) { + metadataBuilder.setType(status, index, SQL_SHORT); + length = 2; + } else if (size < 10) { + metadataBuilder.setType(status, index, SQL_LONG); + length = 4; + } else if (size < 19) { + metadataBuilder.setType(status, index, SQL_INT64); + length = 8; + } else { + metadataBuilder.setType(status, index, SQL_INT128); + length = 16; + } + metadataBuilder.setLength(status, index, length); metadataBuilder.setScale(status, index, scale); metadataBuilder.setSubType(status, index, SUBTYPE_DECIMAL); } @@ -109,13 +153,13 @@ public void addDouble(int index) throws SQLException { @Override public void addDecfloat16(int index) throws SQLException { metadataBuilder.setType(status, index, SQL_DEC16); - metadataBuilder.setLength(status, index, IDecFloat16.STRING_SIZE); + metadataBuilder.setLength(status, index, Byte.SIZE); } @Override public void addDecfloat34(int index) throws SQLException { metadataBuilder.setType(status, index, SQL_DEC34); - metadataBuilder.setLength(status, index, IDecFloat34.STRING_SIZE); + metadataBuilder.setLength(status, index, Byte.SIZE * 2); } @Override @@ -134,7 +178,7 @@ public void addBlob(int index, int subtype) throws SQLException { @Override public void addBoolean(int index) throws SQLException { metadataBuilder.setType(status, index, SQL_BOOLEAN); - metadataBuilder.setLength(status, index, Short.SIZE / Byte.SIZE); + metadataBuilder.setLength(status, index, 1); } @Override @@ -146,7 +190,7 @@ public void addDate(int index) throws SQLException { @Override public void addTime(int index) throws SQLException { metadataBuilder.setType(status, index, SQL_TYPE_TIME); - metadataBuilder.setLength(status, index, Long.SIZE / Byte.SIZE); + metadataBuilder.setLength(status, index, Integer.SIZE / Byte.SIZE); } @Override @@ -183,17 +227,11 @@ public void addVarchar(int index, int length, int charSet) throws SQLException { @Override public void addDecDecimal(int index, int size, int scale) throws SQLException { - metadataBuilder.setType(status, index, SQL_INT128); - metadataBuilder.setLength(status, index, size); - metadataBuilder.setScale(status, index, scale); - metadataBuilder.setSubType(status, index, SUBTYPE_DECIMAL); + addDecimal(index, size, scale); } @Override public void addDecNumeric(int index, int size, int scale) throws SQLException { - metadataBuilder.setType(status, index, SQL_INT128); - metadataBuilder.setLength(status, index, size); - metadataBuilder.setScale(status, index, scale); - metadataBuilder.setSubType(status, index, SUBTYPE_NUMERIC); + addNumeric(index, size, scale); } } diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IParameterConverterImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IParameterConverterImpl.java index f7c69e14c9..f15a9e4170 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IParameterConverterImpl.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IParameterConverterImpl.java @@ -23,7 +23,7 @@ protected void populateAuthenticationProperties(final AbstractConnection connect pb.addArgument(tagMapping.getPasswordTag(), props.getPassword()); } - if (props.getWireCrypt() != WireCrypt.DEFAULT) { + if (props.getWireCryptAsEnum() != WireCrypt.DEFAULT) { // Need to do this differently when having to add multiple configs String configString = "WireCrypt = " + props.getWireCrypt(); pb.addArgument(tagMapping.getConfigTag(), configString); diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IServiceConnectionImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IServiceConnectionImpl.java index 06c9306c4c..f0694cef92 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IServiceConnectionImpl.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IServiceConnectionImpl.java @@ -2,7 +2,9 @@ import org.firebirdsql.encodings.EncodingFactory; import org.firebirdsql.encodings.IEncodingFactory; +import org.firebirdsql.gds.impl.DbAttachInfo; import org.firebirdsql.gds.ng.IServiceProperties; +import org.firebirdsql.jaybird.props.PropertyConstants; import org.firebirdsql.jna.fbclient.FbClientLibrary; import java.sql.SQLException; @@ -42,6 +44,15 @@ public IServiceConnectionImpl(FbClientLibrary clientLibrary, IServiceProperties super(clientLibrary, connectionProperties, encodingFactory); } + @Override + protected String createAttachUrl(DbAttachInfo dbAttachInfo, IServiceProperties attachProperties) { + if (!dbAttachInfo.hasAttachObjectName()) { + // fallback to service_mgr + dbAttachInfo = dbAttachInfo.withAttachObjectName(PropertyConstants.DEFAULT_SERVICE_NAME); + } + return toAttachUrl(dbAttachInfo); + } + /** * Contrary to the description in the super class, this will simply return an unconnected instance. * diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IServiceImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IServiceImpl.java index f35cadf94f..0702e47b13 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IServiceImpl.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IServiceImpl.java @@ -6,10 +6,17 @@ import org.firebirdsql.gds.ServiceRequestBuffer; import org.firebirdsql.gds.impl.ServiceParameterBufferImp; import org.firebirdsql.gds.impl.ServiceRequestBufferImp; -import org.firebirdsql.gds.ng.*; +import org.firebirdsql.gds.ng.AbstractFbService; +import org.firebirdsql.gds.ng.FbAttachment; +import org.firebirdsql.gds.ng.FbExceptionBuilder; +import org.firebirdsql.gds.ng.ParameterConverter; +import org.firebirdsql.gds.ng.WarningMessageCallback; import org.firebirdsql.jdbc.FBDriverNotCapableException; import org.firebirdsql.jna.fbclient.FbClientLibrary; -import org.firebirdsql.nativeoo.gds.ng.FbInterface.*; +import org.firebirdsql.nativeoo.gds.ng.FbInterface.IMaster; +import org.firebirdsql.nativeoo.gds.ng.FbInterface.IProvider; +import org.firebirdsql.nativeoo.gds.ng.FbInterface.IService; +import org.firebirdsql.nativeoo.gds.ng.FbInterface.IStatus; import java.sql.SQLException; @@ -123,7 +130,7 @@ public void attach() throws SQLException { // TODO Replace with specific error (eg native client error) throw new FbExceptionBuilder() .exception(ISCConstants.isc_network_error) - .messageParameter(connection.getServerName()) + .messageParameter(connection.getAttachUrl()) .cause(ex) .toSQLException(); } @@ -173,7 +180,7 @@ protected void internalDetach() throws SQLException { // TODO Replace with specific error (eg native client error) throw new FbExceptionBuilder() .exception(ISCConstants.isc_network_error) - .messageParameter(connection.getServerName()) + .messageParameter(connection.getAttachUrl()) .cause(ex) .toSQLException(); } finally { diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IStatementImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IStatementImpl.java index d7118765c9..b4c7a9406d 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IStatementImpl.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IStatementImpl.java @@ -5,14 +5,30 @@ import org.firebirdsql.gds.BatchParameterBuffer; import org.firebirdsql.gds.ISCConstants; import org.firebirdsql.gds.JaybirdErrorCodes; -import org.firebirdsql.gds.ng.*; -import org.firebirdsql.gds.ng.fields.*; +import org.firebirdsql.gds.ng.AbstractFbStatement; +import org.firebirdsql.gds.ng.FbBatch; +import org.firebirdsql.gds.ng.FbExceptionBuilder; +import org.firebirdsql.gds.ng.FbMessageMetadata; +import org.firebirdsql.gds.ng.FbTransaction; +import org.firebirdsql.gds.ng.OperationCloseHandle; +import org.firebirdsql.gds.ng.StatementState; +import org.firebirdsql.gds.ng.StatementType; +import org.firebirdsql.gds.ng.fields.FieldDescriptor; +import org.firebirdsql.gds.ng.fields.RowDescriptor; +import org.firebirdsql.gds.ng.fields.RowValue; +import org.firebirdsql.gds.ng.fields.RowValueBuilder; import org.firebirdsql.gds.ng.jna.JnaDatabase; -import org.firebirdsql.jna.fbclient.FbClientLibrary; -import org.firebirdsql.nativeoo.gds.ng.FbInterface.*; import org.firebirdsql.jna.fbclient.XSQLVAR; import org.firebirdsql.logging.Logger; import org.firebirdsql.logging.LoggerFactory; +import org.firebirdsql.nativeoo.gds.ng.FbInterface.IBatch; +import org.firebirdsql.nativeoo.gds.ng.FbInterface.IMaster; +import org.firebirdsql.nativeoo.gds.ng.FbInterface.IMessageMetadata; +import org.firebirdsql.nativeoo.gds.ng.FbInterface.IMetadataBuilder; +import org.firebirdsql.nativeoo.gds.ng.FbInterface.IResultSet; +import org.firebirdsql.nativeoo.gds.ng.FbInterface.IStatement; +import org.firebirdsql.nativeoo.gds.ng.FbInterface.IStatementIntf; +import org.firebirdsql.nativeoo.gds.ng.FbInterface.IStatus; import java.nio.ByteBuffer; import java.sql.SQLException; @@ -217,17 +233,15 @@ protected void setMetaData(final RowDescriptor rowDescriptor, final RowValue par // clear status getStatus(); int length = inMeta.getLength(status, idx); + processStatus(); offset += length; inMessage.position(nullOffset); inMessage.put(nullShort); offset += nullShort.length; inMessage.position(offset); // Although we pass a null value, length and type must still be specified - if (length == 0) { - length = fieldDescriptor.getLength() != 0 ? fieldDescriptor.getLength() : Integer.MIN_VALUE; - } - metadataBuilder.setLength(status, idx, length); metadataBuilder.setType(status, idx, inMeta.getType(status, idx) | 1); + metadataBuilder.setLength(status, idx, inMeta.getLength(status, idx)); metadataBuilder.setCharSet(status, idx, inMeta.getCharSet(status, idx)); } else { @@ -239,10 +253,8 @@ protected void setMetaData(final RowDescriptor rowDescriptor, final RowValue par inMessage.position(offset); if (fieldDescriptor.isVarying()) { int length = Math.min(fieldDescriptor.getLength(), fieldData.length); - if (length == 0) - length = fieldDescriptor.getLength() != 0 ? fieldDescriptor.getLength() : Integer.MIN_VALUE; - metadataBuilder.setLength(status, idx, length); metadataBuilder.setType(status, idx, ISCConstants.SQL_VARYING + 1); + metadataBuilder.setLength(status, idx, length); metadataBuilder.setCharSet(status, idx, inMeta.getCharSet(status, idx)); byte[] encodeShort = fieldDescriptor.getDatatypeCoder().encodeShort(fieldData.length); inMessage.put(encodeShort); @@ -250,39 +262,36 @@ protected void setMetaData(final RowDescriptor rowDescriptor, final RowValue par inMessage.position(offset); } else if (fieldDescriptor.isFbType(ISCConstants.SQL_TEXT)) { - metadataBuilder.setLength(status, idx, Math.min(fieldDescriptor.getLength(), fieldData.length)); metadataBuilder.setType(status, idx, ISCConstants.SQL_TEXT + 1); + metadataBuilder.setLength(status, idx, Math.min(fieldDescriptor.getLength(), fieldData.length)); metadataBuilder.setCharSet(status, idx, inMeta.getCharSet(status, idx)); } else if (fieldDescriptor.isFbType(ISCConstants.SQL_BLOB)) { if (offset != 0) offset += offset % alignment; inMessage.position(offset); - metadataBuilder.setLength(status, idx, inMeta.getLength(status, idx)); metadataBuilder.setType(status, idx, ISCConstants.SQL_BLOB + 1); + metadataBuilder.setLength(status, idx, inMeta.getLength(status, idx)); metadataBuilder.setCharSet(status, idx, inMeta.getCharSet(status, idx)); - - } else if (fieldDescriptor.isFbType(ISCConstants.SQL_TYPE_TIME)) { if (offset != 0) offset += offset % alignment; inMessage.position(offset); - metadataBuilder.setLength(status, idx, inMeta.getLength(status, idx)); metadataBuilder.setType(status, idx, ISCConstants.SQL_TYPE_TIME + 1); + metadataBuilder.setLength(status, idx, inMeta.getLength(status, idx)); metadataBuilder.setCharSet(status, idx, inMeta.getCharSet(status, idx)); } else if (fieldDescriptor.isFbType(ISCConstants.SQL_TIMESTAMP)) { if (offset != 0) offset += offset % alignment; inMessage.position(offset); - metadataBuilder.setLength(status, idx, inMeta.getLength(status, idx)); metadataBuilder.setType(status, idx, ISCConstants.SQL_TIMESTAMP + 1); + metadataBuilder.setLength(status, idx, inMeta.getLength(status, idx)); metadataBuilder.setCharSet(status, idx, inMeta.getCharSet(status, idx)); } else { if (offset % alignment != 0) offset += offset % alignment; inMessage.position(offset); - int length = inMeta.getLength(status, idx); - metadataBuilder.setLength(status, idx, length != 0 ? length : Integer.MIN_VALUE); metadataBuilder.setType(status, idx, fieldDescriptor.getType()); + metadataBuilder.setLength(status, idx, inMeta.getLength(status, idx)); metadataBuilder.setCharSet(status, idx, 0); } inMessage.put(fieldData); diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/ITransactionImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/ITransactionImpl.java index b4c66603d3..f50777b920 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/ITransactionImpl.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/ITransactionImpl.java @@ -3,7 +3,8 @@ import org.firebirdsql.gds.ng.AbstractFbTransaction; import org.firebirdsql.gds.ng.TransactionState; import org.firebirdsql.jna.fbclient.FbClientLibrary; -import org.firebirdsql.nativeoo.gds.ng.FbInterface.*; +import org.firebirdsql.nativeoo.gds.ng.FbInterface.IStatus; +import org.firebirdsql.nativeoo.gds.ng.FbInterface.ITransaction; import org.firebirdsql.logging.Logger; import org.firebirdsql.logging.LoggerFactory; diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/NativeDatabaseConnection.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/NativeDatabaseConnection.java index b92f9e65a4..44e74cf82c 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/NativeDatabaseConnection.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/NativeDatabaseConnection.java @@ -2,6 +2,9 @@ import org.firebirdsql.encodings.EncodingFactory; import org.firebirdsql.encodings.IEncodingFactory; +import org.firebirdsql.gds.JaybirdErrorCodes; +import org.firebirdsql.gds.impl.DbAttachInfo; +import org.firebirdsql.gds.ng.FbExceptionBuilder; import org.firebirdsql.gds.ng.IConnectionProperties; import org.firebirdsql.jna.fbclient.FbClientLibrary; @@ -38,6 +41,20 @@ protected NativeDatabaseConnection(FbClientLibrary clientLibrary, IConnectionPro super(clientLibrary, attachProperties, encodingFactory); } + @Override + protected String createAttachUrl(DbAttachInfo dbAttachInfo, IConnectionProperties connectionProperties) + throws SQLException { + if (!dbAttachInfo.hasAttachObjectName()) { + throw new FbExceptionBuilder() + .nonTransientConnectionException(JaybirdErrorCodes.jb_invalidConnectionString) + // Using original attach object name as that may well be non-null even if it is null in dbAttachInfo + .messageParameter(connectionProperties.getAttachObjectName()) + .messageParameter("null or empty database name in connection string") + .toFlatSQLException(); + } + return toAttachUrl(dbAttachInfo); + } + @Override public IDatabaseImpl identify() throws SQLException { return new IDatabaseImpl(this); diff --git a/src/resources/META-INF/services/org.firebirdsql.gds.impl.GDSFactoryPlugin b/src/resources/META-INF/services/org.firebirdsql.gds.impl.GDSFactoryPlugin index 14eebafd58..bdbee1d098 100644 --- a/src/resources/META-INF/services/org.firebirdsql.gds.impl.GDSFactoryPlugin +++ b/src/resources/META-INF/services/org.firebirdsql.gds.impl.GDSFactoryPlugin @@ -2,6 +2,5 @@ org.firebirdsql.gds.impl.wire.WireGDSFactoryPlugin org.firebirdsql.gds.impl.jni.NativeGDSFactoryPlugin org.firebirdsql.gds.impl.jni.EmbeddedGDSFactoryPlugin org.firebirdsql.gds.impl.nativeoo.FbOONativeGDSFactoryPlugin -org.firebirdsql.gds.impl.nativeoo.FbOOLocalGDSFactoryPlugin org.firebirdsql.gds.impl.nativeoo.FbOOEmbeddedGDSFactoryPlugin org.firebirdsql.gds.impl.oo.OOGDSFactoryPlugin diff --git a/src/resources/org/firebirdsql/jaybird/version.properties b/src/resources/org/firebirdsql/jaybird/version.properties index 815204b53e..5519600c70 100644 --- a/src/resources/org/firebirdsql/jaybird/version.properties +++ b/src/resources/org/firebirdsql/jaybird/version.properties @@ -1,4 +1,4 @@ -jaybird.version.simple=@VERSION@ -jaybird.version.display=@NAME@ @MAVEN_NAME@-@VERSION_FULL@ -jaybird.version.major=@VERSION_MAJOR@ -jaybird.version.minor=@VERSION_MINOR@ +jaybird.version.simple=${project.version} +jaybird.version.display=${project.maven.name}-${project.version.maven} +jaybird.version.major=${project.artifact.selectedVersion.majorVersion} +jaybird.version.minor=${project.artifact.selectedVersion.minorVersion} diff --git a/src/test/org/firebirdsql/common/FBTestProperties.java b/src/test/org/firebirdsql/common/FBTestProperties.java index 0fdb1fc5f1..50abf0710d 100644 --- a/src/test/org/firebirdsql/common/FBTestProperties.java +++ b/src/test/org/firebirdsql/common/FBTestProperties.java @@ -159,7 +159,8 @@ public static FirebirdSupportInfo getDefaultSupportInfo() { final FBServiceManager fbServiceManager = new FBServiceManager(gdsType); if (gdsType == GDSType.getType("PURE_JAVA") || gdsType == GDSType.getType("NATIVE") - || gdsType == GDSType.getType("OOREMOTE") ) { + || gdsType == GDSType.getType("OOREMOTE") + || gdsType == GDSType.getType("FBOONATIVE")) { fbServiceManager.setServerName(DB_SERVER_URL); fbServiceManager.setPortNumber(DB_SERVER_PORT); } @@ -239,7 +240,8 @@ public static void defaultDatabaseSetUp(FBManager fbManager) throws Exception { final GDSType gdsType = getGdsType(); if (gdsType == GDSType.getType("PURE_JAVA") || gdsType == GDSType.getType("NATIVE") - || gdsType == GDSType.getType("OOREMOTE")) { + || gdsType == GDSType.getType("OOREMOTE") + || gdsType == GDSType.getType("FBOONATIVE")) { fbManager.setServer(DB_SERVER_URL); fbManager.setPort(DB_SERVER_PORT); } diff --git a/src/test/org/firebirdsql/common/matchers/GdsTypeMatchers.java b/src/test/org/firebirdsql/common/matchers/GdsTypeMatchers.java index ad77a33354..97e941cd69 100644 --- a/src/test/org/firebirdsql/common/matchers/GdsTypeMatchers.java +++ b/src/test/org/firebirdsql/common/matchers/GdsTypeMatchers.java @@ -20,6 +20,8 @@ import org.firebirdsql.gds.impl.jni.EmbeddedGDSFactoryPlugin; import org.firebirdsql.gds.impl.jni.NativeGDSFactoryPlugin; +import org.firebirdsql.gds.impl.nativeoo.FbOOEmbeddedGDSFactoryPlugin; +import org.firebirdsql.gds.impl.nativeoo.FbOONativeGDSFactoryPlugin; import org.firebirdsql.gds.impl.oo.OOGDSFactoryPlugin; import org.firebirdsql.gds.impl.wire.WireGDSFactoryPlugin; import org.hamcrest.Matcher; @@ -43,8 +45,8 @@ public class GdsTypeMatchers { Arrays.asList(WireGDSFactoryPlugin.PURE_JAVA_TYPE_NAME, OOGDSFactoryPlugin.TYPE_NAME)); private static final List EMBEDDED_TYPES = Collections.unmodifiableList( Arrays.asList(EmbeddedGDSFactoryPlugin.EMBEDDED_TYPE_NAME, FbOOEmbeddedGDSFactoryPlugin.EMBEDDED_TYPE_NAME)); - private static final List OTHER_NATIVE_TYPES = - Collections.singletonList(NativeGDSFactoryPlugin.NATIVE_TYPE_NAME, FbOONativeGDSFactoryPlugin.NATIVE_TYPE_NAME); + private static final List OTHER_NATIVE_TYPES = Collections.unmodifiableList( + Arrays.asList(NativeGDSFactoryPlugin.NATIVE_TYPE_NAME, FbOONativeGDSFactoryPlugin.NATIVE_TYPE_NAME)); /** * @return Matcher for pure java types @@ -57,7 +59,7 @@ public static Matcher isPureJavaType() { * @return Matcher for embedded types */ public static Matcher isEmbeddedType() { - return isIn(EMBEDDED_TYPES); + return is(in(EMBEDDED_TYPES)); } /** diff --git a/src/test/org/firebirdsql/common/rules/GdsTypeRule.java b/src/test/org/firebirdsql/common/rules/GdsTypeRule.java index dd483f80ab..22acfe5e77 100644 --- a/src/test/org/firebirdsql/common/rules/GdsTypeRule.java +++ b/src/test/org/firebirdsql/common/rules/GdsTypeRule.java @@ -23,6 +23,8 @@ import org.firebirdsql.common.FBTestProperties; import org.firebirdsql.gds.impl.jni.EmbeddedGDSFactoryPlugin; import org.firebirdsql.gds.impl.jni.NativeGDSFactoryPlugin; +import org.firebirdsql.gds.impl.nativeoo.FbOOEmbeddedGDSFactoryPlugin; +import org.firebirdsql.gds.impl.nativeoo.FbOONativeGDSFactoryPlugin; import org.hamcrest.Matcher; import org.junit.rules.TestRule; import org.junit.runner.Description; @@ -112,7 +114,7 @@ public static GdsTypeRule supportsNativeOnly() { */ public static GdsTypeRule supportsFBOONativeOnly() { return supports(FbOONativeGDSFactoryPlugin.NATIVE_TYPE_NAME, - FbOOEmbeddedGDSFactoryPlugin.EMBEDDED_TYPE_NAME, FbOOLocalGDSFactoryPlugin.LOCAL_TYPE_NAME); + FbOOEmbeddedGDSFactoryPlugin.EMBEDDED_TYPE_NAME); } /** diff --git a/src/test/org/firebirdsql/gds/impl/jni/TestEmbeddedServicesAPI.java b/src/test/org/firebirdsql/gds/impl/jni/TestEmbeddedServicesAPI.java new file mode 100644 index 0000000000..a680833faf --- /dev/null +++ b/src/test/org/firebirdsql/gds/impl/jni/TestEmbeddedServicesAPI.java @@ -0,0 +1,11 @@ +package org.firebirdsql.gds.impl.jni; + +import org.firebirdsql.gds.impl.GDSType; + +public class TestEmbeddedServicesAPI extends TestServicesAPI { + + public TestEmbeddedServicesAPI() { + gdsType = GDSType.getType(EmbeddedGDSFactoryPlugin.EMBEDDED_TYPE_NAME); + protocol = "jdbc:firebirdsql:embedded:"; + } +} diff --git a/src/test/org/firebirdsql/gds/impl/jni/TestFbOOEmbeddedServicesAPI.java b/src/test/org/firebirdsql/gds/impl/jni/TestFbOOEmbeddedServicesAPI.java new file mode 100644 index 0000000000..c1315c1c83 --- /dev/null +++ b/src/test/org/firebirdsql/gds/impl/jni/TestFbOOEmbeddedServicesAPI.java @@ -0,0 +1,12 @@ +package org.firebirdsql.gds.impl.jni; + +import org.firebirdsql.gds.impl.GDSType; +import org.firebirdsql.gds.impl.nativeoo.FbOOEmbeddedGDSFactoryPlugin; + +public class TestFbOOEmbeddedServicesAPI extends TestServicesAPI { + + public TestFbOOEmbeddedServicesAPI() { + gdsType = GDSType.getType(FbOOEmbeddedGDSFactoryPlugin.EMBEDDED_TYPE_NAME); + protocol = "jdbc:firebirdsql:fboo:embedded:"; + } +} diff --git a/src/test/org/firebirdsql/gds/impl/jni/TestFbOONativeServicesAPI.java b/src/test/org/firebirdsql/gds/impl/jni/TestFbOONativeServicesAPI.java new file mode 100644 index 0000000000..959abb348b --- /dev/null +++ b/src/test/org/firebirdsql/gds/impl/jni/TestFbOONativeServicesAPI.java @@ -0,0 +1,13 @@ +package org.firebirdsql.gds.impl.jni; + +import org.firebirdsql.gds.impl.GDSType; +import org.firebirdsql.gds.impl.nativeoo.FbOONativeGDSFactoryPlugin; + +public class TestFbOONativeServicesAPI extends TestServicesAPI { + + public TestFbOONativeServicesAPI() { + gdsType = GDSType.getType(FbOONativeGDSFactoryPlugin.NATIVE_TYPE_NAME); + protocol = "jdbc:firebirdsql:fboo:native:"; + port = 3050; + } +} diff --git a/src/test/org/firebirdsql/gds/impl/jni/TestNativeServicesAPI.java b/src/test/org/firebirdsql/gds/impl/jni/TestNativeServicesAPI.java new file mode 100644 index 0000000000..a94ecd2755 --- /dev/null +++ b/src/test/org/firebirdsql/gds/impl/jni/TestNativeServicesAPI.java @@ -0,0 +1,12 @@ +package org.firebirdsql.gds.impl.jni; + +import org.firebirdsql.gds.impl.GDSType; + +public class TestNativeServicesAPI extends TestServicesAPI { + + public TestNativeServicesAPI() { + gdsType = GDSType.getType(NativeGDSFactoryPlugin.NATIVE_TYPE_NAME); + protocol = "jdbc:firebirdsql:native:"; + port = 3050; + } +} diff --git a/src/test/org/firebirdsql/gds/impl/jni/TestServicesAPI.java b/src/test/org/firebirdsql/gds/impl/jni/TestServicesAPI.java index 1393dbd702..d05ff3868f 100644 --- a/src/test/org/firebirdsql/gds/impl/jni/TestServicesAPI.java +++ b/src/test/org/firebirdsql/gds/impl/jni/TestServicesAPI.java @@ -44,36 +44,34 @@ import static org.junit.Assert.assertTrue; /** - * Initial tests for Services API. Currently run only against embedded server. + * Initial tests for Services API. * TODO: Make run against other types */ -public class TestServicesAPI { - - @ClassRule - public static final GdsTypeRule testType = GdsTypeRule.supports(EmbeddedGDSFactoryPlugin.EMBEDDED_TYPE_NAME); +public abstract class TestServicesAPI { @Rule public final TemporaryFolder temporaryFolder = new TemporaryFolder(); private final Logger log = LoggerFactory.getLogger(getClass()); - private String mAbsoluteDatabasePath; - private String mAbsoluteBackupPath; - private FBManager fbManager; - private GDSType gdsType; - private FbDatabaseFactory dbFactory; - private File logFolder; + protected String mAbsoluteDatabasePath; + protected String mAbsoluteBackupPath; + protected FBManager fbManager; + protected String protocol; + protected GDSType gdsType; + protected int port = 5066; + protected FbDatabaseFactory dbFactory; + protected File logFolder; @Before public void setUp() throws Exception { Class.forName(FBDriver.class.getName()); - gdsType = GDSType.getType(EmbeddedGDSFactoryPlugin.EMBEDDED_TYPE_NAME); dbFactory = GDSFactory.getDatabaseFactoryForType(gdsType); fbManager = new FBManager(gdsType); fbManager.setServer("localhost"); - fbManager.setPort(5066); + fbManager.setPort(port); fbManager.start(); File dbFolder = temporaryFolder.newFolder("db"); @@ -121,8 +119,8 @@ public void testBackupAndRestore() throws Exception { connectToDatabase(); } - private void connectToDatabase() throws SQLException { - Connection connection = DriverManager.getConnection("jdbc:firebirdsql:embedded:" + mAbsoluteDatabasePath + "?encoding=NONE", + protected void connectToDatabase() throws SQLException { + Connection connection = DriverManager.getConnection(protocol + mAbsoluteDatabasePath + "?encoding=NONE", "SYSDBA", "masterkey"); connection.close(); } diff --git a/src/test/org/firebirdsql/gds/ng/AbstractBatchTest.java b/src/test/org/firebirdsql/gds/ng/AbstractBatchTest.java index 13635a2212..53cf0978bb 100644 --- a/src/test/org/firebirdsql/gds/ng/AbstractBatchTest.java +++ b/src/test/org/firebirdsql/gds/ng/AbstractBatchTest.java @@ -4,10 +4,10 @@ import org.firebirdsql.common.FBTestProperties; import org.firebirdsql.common.rules.UsesDatabase; import org.firebirdsql.gds.BatchParameterBuffer; -import org.firebirdsql.gds.ISCConstants; import org.firebirdsql.gds.TransactionParameterBuffer; import org.firebirdsql.gds.impl.BatchParameterBufferImpl; import org.firebirdsql.gds.impl.TransactionParameterBufferImpl; +import org.firebirdsql.jaybird.fb.constants.TpbItems; import org.firebirdsql.jdbc.FirebirdConnection; import org.firebirdsql.management.FBManager; import org.firebirdsql.util.FirebirdSupportInfo; @@ -244,10 +244,10 @@ public void testCreateBatchWithMetadata() throws SQLException { private FbTransaction getTransaction() throws SQLException { TransactionParameterBuffer tpb = new TransactionParameterBufferImpl(); - tpb.addArgument(ISCConstants.isc_tpb_read_committed); - tpb.addArgument(ISCConstants.isc_tpb_rec_version); - tpb.addArgument(ISCConstants.isc_tpb_write); - tpb.addArgument(ISCConstants.isc_tpb_wait); + tpb.addArgument(TpbItems.isc_tpb_read_committed); + tpb.addArgument(TpbItems.isc_tpb_rec_version); + tpb.addArgument(TpbItems.isc_tpb_write); + tpb.addArgument(TpbItems.isc_tpb_wait); return db.startTransaction(tpb); } diff --git a/src/test/org/firebirdsql/jdbc/JDBCUrlPrefixTest.java b/src/test/org/firebirdsql/jdbc/JDBCUrlPrefixTest.java index 06d027dc89..3800e86732 100644 --- a/src/test/org/firebirdsql/jdbc/JDBCUrlPrefixTest.java +++ b/src/test/org/firebirdsql/jdbc/JDBCUrlPrefixTest.java @@ -22,6 +22,8 @@ import org.firebirdsql.common.rules.UsesDatabase; import org.firebirdsql.gds.impl.jni.EmbeddedGDSFactoryPlugin; import org.firebirdsql.gds.impl.jni.NativeGDSFactoryPlugin; +import org.firebirdsql.gds.impl.nativeoo.FbOOEmbeddedGDSFactoryPlugin; +import org.firebirdsql.gds.impl.nativeoo.FbOONativeGDSFactoryPlugin; import org.firebirdsql.gds.impl.oo.OOGDSFactoryPlugin; import org.firebirdsql.gds.impl.wire.WireGDSFactoryPlugin; import org.firebirdsql.jaybird.xca.FBManagedConnectionFactory; From d79b0a54e4205cd511d6ec874f4720bb19c4d2b5 Mon Sep 17 00:00:00 2001 From: Vasiliy Yashkov Date: Mon, 25 Jul 2022 15:35:02 +0300 Subject: [PATCH 06/12] Update native OO API implementations 1. Update interfaces for `fbclient` library. 2. Fix memory allocation for error message. 3. Fix parsing of warnings from status vector. 4. Fix `free` call when closing statement. 5. Update and fix tests. --- .../org/firebirdsql/gds/impl/GDSFactory.java | 1 - .../FbOOEmbeddedGDSFactoryPlugin.java | 6 +- .../nativeoo/FbOONativeGDSFactoryPlugin.java | 6 +- .../nativeoo/gds/ng/IBatchImplTest.java | 65 +- .../nativeoo/gds/ng/IBlobImplTest.java | 149 ++-- .../nativeoo/gds/ng/IDatabaseImplTest.java | 237 +++--- .../nativeoo/gds/ng/IEventBlockImplTest.java | 123 ++- .../gds/ng/IServiceConnectionImplTest.java | 68 +- .../nativeoo/gds/ng/IServiceImplTest.java | 117 ++- .../nativeoo/gds/ng/IStatementImplTest.java | 219 ++--- ...st.java => IStatementImplTimeoutTest.java} | 19 +- .../nativeoo/gds/ng/ITransactionImplTest.java | 18 +- .../gds/ng/NativeDatabaseConnectionTest.java | 70 +- .../gds/ng/AbstractNativeConnection.java | 53 +- .../ng/AbstractNativeOODatabaseFactory.java | 4 +- .../nativeoo/gds/ng/FbInterface.java | 783 ++++++++++-------- .../nativeoo/gds/ng/FbInterfaceException.java | 5 +- .../nativeoo/gds/ng/IBatchImpl.java | 12 +- .../nativeoo/gds/ng/IDatabaseImpl.java | 21 +- .../nativeoo/gds/ng/IMetadataBuilderImpl.java | 2 +- .../gds/ng/IParameterConverterImpl.java | 6 + .../gds/ng/IServiceConnectionImpl.java | 2 +- .../nativeoo/gds/ng/IServiceImpl.java | 2 +- .../nativeoo/gds/ng/IStatementImpl.java | 95 ++- .../nativeoo/gds/ng/ITransactionImpl.java | 2 +- .../gds/ng/NativeDatabaseConnection.java | 2 +- .../firebirdsql/common/FBTestProperties.java | 4 +- .../common/extension/GdsTypeExtension.java | 15 +- .../ds/FBConnectionPoolTestBase.java | 3 +- .../firebirdsql/ds/FBXADataSourceTest.java | 3 +- .../firebirdsql/event/FBEventManagerTest.java | 3 +- .../gds/impl/jni/EmbeddedServicesAPITest.java | 18 + .../impl/jni/FbOOEmbeddedServicesAPITest.java | 19 + .../impl/jni/FbOONativeServicesAPITest.java | 20 + .../gds/impl/jni/NativeServicesAPITest.java | 19 + .../gds/impl/jni/ServicesAPITest.java | 15 +- .../SpecialFbOOEmbeddedServerUrlsTest.java | 125 +++ .../gds/impl/jni/TestEmbeddedServicesAPI.java | 11 - .../impl/jni/TestFbOOEmbeddedServicesAPI.java | 12 - .../impl/jni/TestFbOONativeServicesAPI.java | 13 - .../gds/impl/jni/TestNativeServicesAPI.java | 12 - .../TestSpecialFbOOEmbeddedServerUrls.java | 119 --- .../firebirdsql/gds/ng/AbstractBatchTest.java | 225 +++-- .../jdbc/DatabaseEncryptionTest.java | 15 +- .../jdbc/Dialect1SpecificsTest.java | 3 +- .../management/FBBackupManagerTest.java | 3 +- .../management/FBMaintenanceManagerTest.java | 3 +- .../management/FBStatisticsManagerTest.java | 3 +- .../FBStreamingBackupManagerTest.java | 3 +- 49 files changed, 1401 insertions(+), 1352 deletions(-) rename src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/{IStatementimplTimeoutTest.java => IStatementImplTimeoutTest.java} (51%) create mode 100644 src/test/org/firebirdsql/gds/impl/jni/EmbeddedServicesAPITest.java create mode 100644 src/test/org/firebirdsql/gds/impl/jni/FbOOEmbeddedServicesAPITest.java create mode 100644 src/test/org/firebirdsql/gds/impl/jni/FbOONativeServicesAPITest.java create mode 100644 src/test/org/firebirdsql/gds/impl/jni/NativeServicesAPITest.java create mode 100644 src/test/org/firebirdsql/gds/impl/jni/SpecialFbOOEmbeddedServerUrlsTest.java delete mode 100644 src/test/org/firebirdsql/gds/impl/jni/TestEmbeddedServicesAPI.java delete mode 100644 src/test/org/firebirdsql/gds/impl/jni/TestFbOOEmbeddedServicesAPI.java delete mode 100644 src/test/org/firebirdsql/gds/impl/jni/TestFbOONativeServicesAPI.java delete mode 100644 src/test/org/firebirdsql/gds/impl/jni/TestNativeServicesAPI.java delete mode 100644 src/test/org/firebirdsql/gds/impl/jni/TestSpecialFbOOEmbeddedServerUrls.java diff --git a/src/main/org/firebirdsql/gds/impl/GDSFactory.java b/src/main/org/firebirdsql/gds/impl/GDSFactory.java index 1a34e19873..cbb90eeb15 100644 --- a/src/main/org/firebirdsql/gds/impl/GDSFactory.java +++ b/src/main/org/firebirdsql/gds/impl/GDSFactory.java @@ -153,7 +153,6 @@ private static void loadPluginsFallback(final ClassLoader classLoader) { "org.firebirdsql.gds.impl.jni.NativeGDSFactoryPlugin", "org.firebirdsql.gds.impl.jni.EmbeddedGDSFactoryPlugin", "org.firebirdsql.gds.impl.jni.FbOONativeGDSFactoryPlugin", - "org.firebirdsql.gds.impl.jni.FbOOLocalGDSFactoryPlugin", "org.firebirdsql.gds.impl.jni.FbOOEmbeddedGDSFactoryPlugin", "org.firebirdsql.gds.impl.oo.OOGDSFactoryPlugin" }; diff --git a/src/main/org/firebirdsql/gds/impl/nativeoo/FbOOEmbeddedGDSFactoryPlugin.java b/src/main/org/firebirdsql/gds/impl/nativeoo/FbOOEmbeddedGDSFactoryPlugin.java index 8eec0bdee5..6eb9834f9f 100644 --- a/src/main/org/firebirdsql/gds/impl/nativeoo/FbOOEmbeddedGDSFactoryPlugin.java +++ b/src/main/org/firebirdsql/gds/impl/nativeoo/FbOOEmbeddedGDSFactoryPlugin.java @@ -4,6 +4,8 @@ import org.firebirdsql.gds.impl.BaseGDSFactoryPlugin; import org.firebirdsql.nativeoo.gds.ng.FbOOEmbeddedDatabaseFactory; +import java.util.Arrays; + public class FbOOEmbeddedGDSFactoryPlugin extends BaseGDSFactoryPlugin { public static final String EMBEDDED_TYPE_NAME = "FBOOEMBEDDED"; @@ -11,7 +13,7 @@ public class FbOOEmbeddedGDSFactoryPlugin extends BaseGDSFactoryPlugin { private static final String[] TYPE_ALIASES = new String[0]; private static final String[] JDBC_PROTOCOLS = new String[] { - "jdbc:firebirdsql:fboo:embedded:", "jdbc:firebird:fboo:embedded:" + "jdbc:firebirdsql:fboo:embedded:", "jdbc:firebird:fboo:embedded:" }; public String getPluginName() { @@ -27,7 +29,7 @@ public String[] getTypeAliases() { } public String[] getSupportedProtocols() { - return JDBC_PROTOCOLS; + return Arrays.copyOf(JDBC_PROTOCOLS, JDBC_PROTOCOLS.length); } public String getDatabasePath(String server, Integer port, String path) throws GDSException { diff --git a/src/main/org/firebirdsql/gds/impl/nativeoo/FbOONativeGDSFactoryPlugin.java b/src/main/org/firebirdsql/gds/impl/nativeoo/FbOONativeGDSFactoryPlugin.java index 4870806580..39081ad9b5 100644 --- a/src/main/org/firebirdsql/gds/impl/nativeoo/FbOONativeGDSFactoryPlugin.java +++ b/src/main/org/firebirdsql/gds/impl/nativeoo/FbOONativeGDSFactoryPlugin.java @@ -4,13 +4,15 @@ import org.firebirdsql.gds.impl.BaseGDSFactoryPlugin; import org.firebirdsql.nativeoo.gds.ng.FbOOClientDatabaseFactory; +import java.util.Arrays; + public class FbOONativeGDSFactoryPlugin extends BaseGDSFactoryPlugin { public static final String NATIVE_TYPE_NAME = "FBOONATIVE"; private static final String[] TYPE_ALIASES = new String[] { "TYPE2" }; private static final String[] JDBC_PROTOCOLS = new String[] { - "jdbc:firebirdsql:fboo:native:", "jdbc:firebird:fboo:native:" + "jdbc:firebirdsql:fboo:native:", "jdbc:firebird:fboo:native:" }; public String getPluginName() { @@ -26,7 +28,7 @@ public String[] getTypeAliases() { } public String[] getSupportedProtocols() { - return JDBC_PROTOCOLS; + return Arrays.copyOf(JDBC_PROTOCOLS, JDBC_PROTOCOLS.length); } public String getDatabasePath(String server, Integer port, String path) throws GDSException { diff --git a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IBatchImplTest.java b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IBatchImplTest.java index 7de58a247d..933e3e2668 100644 --- a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IBatchImplTest.java +++ b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IBatchImplTest.java @@ -1,7 +1,7 @@ package org.firebirdsql.nativeoo.gds.ng; import org.firebirdsql.common.FBTestProperties; -import org.firebirdsql.common.rules.GdsTypeRule; +import org.firebirdsql.common.extension.GdsTypeExtension; import org.firebirdsql.gds.BatchParameterBuffer; import org.firebirdsql.gds.BlobParameterBuffer; import org.firebirdsql.gds.ISCConstants; @@ -10,10 +10,9 @@ import org.firebirdsql.gds.ng.fields.RowValue; import org.firebirdsql.gds.ng.wire.SimpleStatementListener; import org.firebirdsql.jdbc.FBBlob; -import org.junit.ClassRule; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; +import org.junit.jupiter.api.Order; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.RegisterExtension; import java.io.ByteArrayOutputStream; import java.math.BigDecimal; @@ -22,10 +21,12 @@ import java.text.SimpleDateFormat; import java.util.Calendar; -import static org.hamcrest.CoreMatchers.*; +import static org.hamcrest.CoreMatchers.allOf; +import static org.hamcrest.CoreMatchers.containsString; +import static org.hamcrest.CoreMatchers.endsWith; +import static org.hamcrest.CoreMatchers.startsWith; import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.*; /** * Test for batch in the OO API implementation. @@ -33,12 +34,16 @@ * {@link org.firebirdsql.nativeoo.gds.ng.IBatchImpl}. * * @author Vasiliy Yashkov - * @since 4.0 + * @since 5.0 */ -public class IBatchImplTest extends AbstractBatchTest { +class IBatchImplTest extends AbstractBatchTest { - @ClassRule - public static final GdsTypeRule testType = GdsTypeRule.supportsFBOONativeOnly(); + @RegisterExtension + @Order(1) + public static final GdsTypeExtension testType = GdsTypeExtension.supportsFBOONativeOnly(); + + private final AbstractNativeOODatabaseFactory factory = + (AbstractNativeOODatabaseFactory) FBTestProperties.getFbDatabaseFactory(); //@formatter:off protected String INSERT_QUERY_WITHOUT_BLOBS = "INSERT INTO test_p_metadata (" + @@ -94,32 +99,26 @@ public class IBatchImplTest extends AbstractBatchTest { protected String SELECT_QUERY_WITHOUT_BLOBS = "SELECT " + - "id, simple_field, two_byte_field, three_byte_field, long_field, int_field, short_field," + - "float_field, double_field, smallint_numeric, integer_decimal_1, integer_numeric," + - "integer_decimal_2, bigint_numeric, bigint_decimal, date_field, time_field," + - "timestamp_field " + + "id, simple_field, two_byte_field, three_byte_field, long_field, int_field, short_field," + + "float_field, double_field, smallint_numeric, integer_decimal_1, integer_numeric," + + "integer_decimal_2, bigint_numeric, bigint_decimal, date_field, time_field," + + "timestamp_field " + " from test_p_metadata"; protected String SELECT_QUERY_WITH_BLOBS = "SELECT " + - "id, simple_field, two_byte_field, three_byte_field, long_field, int_field, short_field," + - "float_field, double_field, smallint_numeric, integer_decimal_1, integer_numeric," + - "integer_decimal_2, bigint_numeric, bigint_decimal, date_field, time_field," + - "timestamp_field, blob_field, blob_text_field, blob_minus_one " + - " from test_p_metadata"; + "id, simple_field, two_byte_field, three_byte_field, long_field, int_field, short_field," + + "float_field, double_field, smallint_numeric, integer_decimal_1, integer_numeric," + + "integer_decimal_2, bigint_numeric, bigint_decimal, date_field, time_field," + + "timestamp_field, blob_field, blob_text_field, blob_minus_one " + + " from test_p_metadata"; protected String SELECT_QUERY_ONLY_BLOBS = "SELECT " + - "blob_field, blob_text_field, blob_minus_one " + - " from test_p_metadata"; + "blob_field, blob_text_field, blob_minus_one " + + " from test_p_metadata"; //@formatter:on - @Rule - public final ExpectedException expectedException = ExpectedException.none(); - - private AbstractNativeOODatabaseFactory factory = - (AbstractNativeOODatabaseFactory) FBTestProperties.getFbDatabaseFactory(); - @Override protected Class getExpectedDatabaseType() { return IDatabaseImpl.class; @@ -1327,7 +1326,7 @@ public void testBatchWithBlobNulls() throws Exception { } } - public void checkBlob(long blobID, byte[] originalContent) throws Exception { + private void checkBlob(long blobID, byte[] originalContent) throws Exception { // Use sufficiently large value so that multiple segments are used final int requiredSize = (originalContent == null ? 10 : originalContent.length); final FbBlob blob = db.createBlobForInput(transaction, null, blobID); @@ -1338,8 +1337,8 @@ public void checkBlob(long blobID, byte[] originalContent) throws Exception { } blob.close(); byte[] result = bos.toByteArray(); - assertEquals("Unexpected length read from blob", originalContent.length, result.length); - assertTrue("Unexpected blob content", validateBlobContent(result, originalContent, requiredSize)); + assertEquals(originalContent.length, result.length, "Unexpected length read from blob"); + assertTrue(validateBlobContent(result, originalContent, requiredSize), "Unexpected blob content"); } /** @@ -1350,7 +1349,7 @@ public void checkBlob(long blobID, byte[] originalContent) throws Exception { * @param requiredSize Required size * @return true content matches, false otherwise */ - protected boolean validateBlobContent(byte[] blobContent, byte[] baseContent, int requiredSize) { + private boolean validateBlobContent(byte[] blobContent, byte[] baseContent, int requiredSize) { if (blobContent.length != requiredSize) return false; for (int index = 0; index < blobContent.length; index++) { if (blobContent[index] != baseContent[index % baseContent.length]) return false; diff --git a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IBlobImplTest.java b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IBlobImplTest.java index 2afb67df33..9f068f005d 100755 --- a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IBlobImplTest.java +++ b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IBlobImplTest.java @@ -19,16 +19,15 @@ package org.firebirdsql.nativeoo.gds.ng; import org.firebirdsql.common.FBTestProperties; -import org.firebirdsql.common.rules.GdsTypeRule; +import org.firebirdsql.common.extension.GdsTypeExtension; import org.firebirdsql.gds.BlobParameterBuffer; import org.firebirdsql.gds.ISCConstants; - import org.firebirdsql.gds.ng.*; import org.firebirdsql.gds.ng.fields.RowValue; - import org.firebirdsql.gds.ng.wire.SimpleStatementListener; -import org.junit.*; -import org.junit.rules.ExpectedException; +import org.junit.jupiter.api.Order; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.RegisterExtension; import java.io.ByteArrayOutputStream; import java.sql.SQLException; @@ -38,39 +37,34 @@ import static org.firebirdsql.common.matchers.SQLExceptionMatchers.*; import static org.hamcrest.CoreMatchers.allOf; import static org.hamcrest.CoreMatchers.startsWith; -import static org.junit.Assert.*; -import static org.junit.Assume.assumeTrue; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assumptions.assumeTrue; /** * Test for blobs in the OO API implementation {@link org.firebirdsql.nativeoo.gds.ng.IBlobImpl}. *

- * This class has copied tests from {@link org.firebirdsql.gds.ng.wire.version10.TestV10OutputBlob} and - * {@link org.firebirdsql.gds.ng.wire.version10.TestV10InputBlob}. + * This class has copied tests from {@link org.firebirdsql.gds.ng.wire.version10.V10OutputBlobTest} and + * {@link org.firebirdsql.gds.ng.wire.version10.V10InputBlobTest}. *

* * @author Mark Rotteveel - * @since 4.0 + * @since 5.0 */ -public class IBlobImplTest extends BaseTestBlob { +class IBlobImplTest extends BaseTestBlob { - @ClassRule - public static final GdsTypeRule testType = GdsTypeRule.supportsFBOONativeOnly(); + @RegisterExtension + @Order(1) + public static final GdsTypeExtension testType = GdsTypeExtension.supportsFBOONativeOnly(); - @Rule - public final ExpectedException expectedException = ExpectedException.none(); - - private AbstractNativeOODatabaseFactory factory; - - @Before - public void setFactory() { - factory = (AbstractNativeOODatabaseFactory) FBTestProperties.getFbDatabaseFactory(); - } + private final AbstractNativeOODatabaseFactory factory = + (AbstractNativeOODatabaseFactory) FBTestProperties.getFbDatabaseFactory(); /** * Tests retrieval of a blob (what goes in is what comes out). */ @Test - public void testInputBlobRetrieval() throws Exception { + void testInputBlobRetrieval() throws Exception { final int testId = 1; final byte[] baseContent = generateBaseContent(); // Use sufficiently large value so that multiple segments are used @@ -90,8 +84,8 @@ public void testInputBlobRetrieval() throws Exception { blob.close(); statement.close(); byte[] result = bos.toByteArray(); - assertEquals("Unexpected length read from blob", requiredSize, result.length); - assertTrue("Unexpected blob content", validateBlobContent(result, baseContent, requiredSize)); + assertEquals(requiredSize, result.length, "Unexpected length read from blob"); + assertTrue(validateBlobContent(result, baseContent, requiredSize), "Unexpected blob content"); } finally { if (transaction != null) transaction.commit(); } @@ -102,7 +96,7 @@ public void testInputBlobRetrieval() throws Exception { * Tests absolute seek on a segmented blob. Expectation: fails with an exception */ @Test - public void testInputBlobSeek_segmented() throws Exception { + void testInputBlobSeek_segmented() throws Exception { final int testId = 1; final byte[] baseContent = generateBaseContent(); // Use sufficiently large value so that multiple segments are used @@ -118,13 +112,11 @@ public void testInputBlobSeek_segmented() throws Exception { blob.open(); int offset = baseContent.length / 2; - expectedException.expect(SQLException.class); - expectedException.expect(allOf( + SQLException exception = assertThrows(SQLException.class, + () -> blob.seek(offset, FbBlob.SeekMode.ABSOLUTE)); + assertThat(exception, allOf( errorCodeEquals(ISCConstants.isc_bad_segstr_type), - message(startsWith(getFbMessage(ISCConstants.isc_bad_segstr_type))) - )); - - blob.seek(offset, FbBlob.SeekMode.ABSOLUTE); + message(startsWith(getFbMessage(ISCConstants.isc_bad_segstr_type))))); } finally { if (transaction != null) transaction.commit(); } @@ -135,7 +127,7 @@ public void testInputBlobSeek_segmented() throws Exception { * Tests absolute seek on a stream blob. */ @Test - public void testInputBlobSeek_streamed() throws Exception { + void testInputBlobSeek_streamed() throws Exception { final int testId = 1; final byte[] baseContent = generateBaseContent(); // Use sufficiently large value so that multiple segments are used @@ -157,8 +149,8 @@ public void testInputBlobSeek_streamed() throws Exception { blob.close(); statement.close(); - assertEquals("Unexpected length read from blob", 100, segment.length); - assertArrayEquals("Unexpected segment content", expected, segment); + assertEquals(100, segment.length, "Unexpected length read from blob"); + assertArrayEquals(expected, segment, "Unexpected segment content"); } finally { if (transaction != null) transaction.commit(); } @@ -169,7 +161,7 @@ public void testInputBlobSeek_streamed() throws Exception { * Tests reopen of input blob is allowed. */ @Test - public void testInputBlobReopen() throws Exception { + void testInputBlobReopen() throws Exception { final int testId = 1; final byte[] baseContent = generateBaseContent(); final int requiredSize = 256; @@ -196,8 +188,8 @@ public void testInputBlobReopen() throws Exception { statement.close(); byte[] result = bos.toByteArray(); - assertEquals("Unexpected length read from blob", requiredSize, result.length); - assertTrue("Unexpected blob content", validateBlobContent(result, baseContent, requiredSize)); + assertEquals(requiredSize, result.length, "Unexpected length read from blob"); + assertTrue(validateBlobContent(result, baseContent, requiredSize), "Unexpected blob content"); } finally { if (transaction != null) transaction.commit(); } @@ -208,13 +200,7 @@ public void testInputBlobReopen() throws Exception { * Tests double open of input blob is not allowed. */ @Test - public void testInputBlobDoubleOpen() throws Exception { - expectedException.expect(SQLNonTransientException.class); - expectedException.expect(allOf( - errorCodeEquals(ISCConstants.isc_no_segstr_close), - fbMessageStartsWith(ISCConstants.isc_no_segstr_close) - )); - + void testInputBlobDoubleOpen() throws Exception { final int testId = 1; final byte[] baseContent = generateBaseContent(); final int requiredSize = 256; @@ -227,7 +213,10 @@ public void testInputBlobDoubleOpen() throws Exception { final FbBlob blob = db.createBlobForInput(transaction, null, blobId); blob.open(); // Double open - blob.open(); + SQLException exception = assertThrows(SQLNonTransientException.class, blob::open); + assertThat(exception, allOf( + errorCodeEquals(ISCConstants.isc_no_segstr_close), + fbMessageStartsWith(ISCConstants.isc_no_segstr_close))); } finally { if (transaction != null) transaction.commit(); } @@ -238,7 +227,7 @@ public void testInputBlobDoubleOpen() throws Exception { * Tests storage of a blob (what goes in is what comes out). */ @Test - public void testOutputBlobStorage() throws Exception { + void testOutputBlobStorage() throws Exception { final int testId = 1; final byte[] baseContent = generateBaseContent(); // Use sufficiently large value so that multiple segments are used @@ -249,14 +238,14 @@ public void testOutputBlobStorage() throws Exception { writeBlob(testId, testBytes, db, null); } - assertTrue("Unexpected blob content", validateBlob(testId, baseContent, requiredSize)); + assertTrue(validateBlob(testId, baseContent, requiredSize), "Unexpected blob content"); } /** * Tests storage of a stream blob (what goes in is what comes out). */ @Test - public void testOutputBlobStorage_Stream() throws Exception { + void testOutputBlobStorage_Stream() throws Exception { final int testId = 1; final byte[] baseContent = generateBaseContent(); // Use sufficiently large value so that multiple segments are used @@ -269,22 +258,22 @@ public void testOutputBlobStorage_Stream() throws Exception { writeBlob(testId, testBytes, db, blobParameterBuffer); } - assertTrue("Unexpected blob content", validateBlob(testId, baseContent, requiredSize)); + assertTrue(validateBlob(testId, baseContent, requiredSize), "Unexpected blob content"); } /** * Test if blob is not eof after open. */ @Test - public void testOutputBlobIsEof_afterOpen() throws Exception { + void testOutputBlobIsEof_afterOpen() throws Exception { try (IDatabaseImpl db = createDatabaseConnection()) { final FbTransaction transaction = getTransaction(db); try { FbBlob blob = db.createBlobForOutput(transaction, null); - assumeTrue("Output blob before open should be eof", blob.isEof()); + assumeTrue(blob.isEof(), "Output blob before open should be eof"); blob.open(); - assertFalse("Output blob after open should not be eof", blob.isEof()); + assertFalse(blob.isEof(), "Output blob after open should not be eof"); } finally { transaction.commit(); } @@ -295,16 +284,16 @@ public void testOutputBlobIsEof_afterOpen() throws Exception { * Test if blob is eof after close. */ @Test - public void testOutputBlobIsEof_afterClose() throws Exception { + void testOutputBlobIsEof_afterClose() throws Exception { try (IDatabaseImpl db = createDatabaseConnection()) { final FbTransaction transaction = getTransaction(db); try { FbBlob blob = db.createBlobForOutput(transaction, null); - assumeTrue("Output blob before open should be eof", blob.isEof()); + assumeTrue(blob.isEof(), "Output blob before open should be eof"); blob.open(); blob.close(); - assertTrue("Output blob after close should be eof", blob.isEof()); + assertTrue(blob.isEof(), "Output blob after close should be eof"); } finally { transaction.commit(); } @@ -315,16 +304,16 @@ public void testOutputBlobIsEof_afterClose() throws Exception { * Test if blob is eof after cancel. */ @Test - public void testOutputBlobIsEof_afterCancel() throws Exception { + void testOutputBlobIsEof_afterCancel() throws Exception { try (IDatabaseImpl db = createDatabaseConnection()) { final FbTransaction transaction = getTransaction(db); try { FbBlob blob = db.createBlobForOutput(transaction, null); - assumeTrue("Output blob before open should be eof", blob.isEof()); + assumeTrue(blob.isEof(), "Output blob before open should be eof"); blob.open(); blob.cancel(); - assertTrue("Output blob after cancel should be eof", blob.isEof()); + assertTrue(blob.isEof(), "Output blob after cancel should be eof"); } finally { transaction.commit(); } @@ -335,13 +324,7 @@ public void testOutputBlobIsEof_afterCancel() throws Exception { * Test whether a cancelled blob cannot be used (indicating it was indeed cancelled). */ @Test - public void testOutputBlobUsingCancelledBlob() throws Exception { - expectedException.expect(SQLException.class); - expectedException.expect(allOf( - errorCodeEquals(ISCConstants.isc_bad_segstr_id), - message(startsWith(getFbMessage(ISCConstants.isc_bad_segstr_id))) - )); - + void testOutputBlobUsingCancelledBlob() throws Exception { final int testId = 1; final byte[] baseContent = generateBaseContent(); final int requiredSize = 256; @@ -368,7 +351,13 @@ public void testOutputBlobUsingCancelledBlob() throws Exception { statement.prepare(INSERT_BLOB_TABLE); final DatatypeCoder datatypeCoder = db.getDatatypeCoder(); - statement.execute(RowValue.of(datatypeCoder.encodeInt(testId), datatypeCoder.encodeLong(blob.getBlobId()))); + RowValue rowValue = RowValue.of( + datatypeCoder.encodeInt(testId), + datatypeCoder.encodeLong(blob.getBlobId())); + SQLException exception = assertThrows(SQLException.class, () ->statement.execute(rowValue)); + assertThat(exception, allOf( + errorCodeEquals(ISCConstants.isc_bad_segstr_id), + message(startsWith(getFbMessage(ISCConstants.isc_bad_segstr_id))))); statement.close(); } finally { transaction.commit(); @@ -380,13 +369,7 @@ public void testOutputBlobUsingCancelledBlob() throws Exception { * Test reopen is not allowed. */ @Test - public void testOutputBlobReopen() throws Exception { - expectedException.expect(SQLNonTransientException.class); - expectedException.expect(allOf( - errorCodeEquals(ISCConstants.isc_segstr_no_op), - fbMessageStartsWith(ISCConstants.isc_segstr_no_op) - )); - + void testOutputBlobReopen() throws Exception { final byte[] baseContent = generateBaseContent(); final int requiredSize = 256; final byte[] testBytes = generateBlobContent(baseContent, requiredSize); @@ -407,7 +390,10 @@ public void testOutputBlobReopen() throws Exception { blob.close(); // Reopen - blob.open(); + SQLException exception = assertThrows(SQLNonTransientException.class, blob::open); + assertThat(exception, allOf( + errorCodeEquals(ISCConstants.isc_segstr_no_op), + fbMessageStartsWith(ISCConstants.isc_segstr_no_op))); } finally { transaction.commit(); } @@ -418,19 +404,16 @@ public void testOutputBlobReopen() throws Exception { * Test double open is not allowed. */ @Test - public void testOutputBlobDoubleOpen() throws Exception { - expectedException.expect(SQLNonTransientException.class); - expectedException.expect(allOf( - errorCodeEquals(ISCConstants.isc_segstr_no_op), - fbMessageStartsWith(ISCConstants.isc_segstr_no_op) - )); - + void testOutputBlobDoubleOpen() throws Exception { try (IDatabaseImpl db = createDatabaseConnection()) { final FbTransaction transaction = getTransaction(db); try { final FbBlob blob = db.createBlobForOutput(transaction, null); blob.open(); - blob.open(); + SQLException exception = assertThrows(SQLNonTransientException.class, blob::open); + assertThat(exception, allOf( + errorCodeEquals(ISCConstants.isc_segstr_no_op), + fbMessageStartsWith(ISCConstants.isc_segstr_no_op))); } finally { transaction.commit(); } diff --git a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IDatabaseImplTest.java b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IDatabaseImplTest.java index 13425ec4b5..29482f2aea 100644 --- a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IDatabaseImplTest.java +++ b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IDatabaseImplTest.java @@ -1,131 +1,106 @@ package org.firebirdsql.nativeoo.gds.ng; import org.firebirdsql.common.FBTestProperties; -import org.firebirdsql.common.rules.GdsTypeRule; +import org.firebirdsql.common.extension.GdsTypeExtension; import org.firebirdsql.gds.ISCConstants; -import org.firebirdsql.gds.TransactionParameterBuffer; - import org.firebirdsql.gds.impl.GDSServerVersion; - -import org.firebirdsql.gds.impl.TransactionParameterBufferImpl; -import org.firebirdsql.gds.impl.nativeoo.FbOOEmbeddedGDSFactoryPlugin; +import org.firebirdsql.gds.impl.jni.EmbeddedGDSFactoryPlugin; import org.firebirdsql.gds.ng.FbConnectionProperties; import org.firebirdsql.gds.ng.FbDatabase; import org.firebirdsql.gds.ng.FbTransaction; import org.firebirdsql.gds.ng.TransactionState; - -import org.firebirdsql.jaybird.fb.constants.TpbItems; import org.firebirdsql.jdbc.SQLStateConstants; import org.firebirdsql.management.FBManager; -import org.junit.ClassRule; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.RegisterExtension; import java.io.File; import java.sql.SQLException; import static org.firebirdsql.common.FBTestProperties.*; -import static org.firebirdsql.common.FBTestProperties.DB_PASSWORD; -import static org.firebirdsql.common.FBTestProperties.getDatabasePath; +import static org.firebirdsql.common.JdbcResourceHelper.closeQuietly; +import static org.firebirdsql.common.matchers.GdsTypeMatchers.isEmbeddedType; +import static org.firebirdsql.common.matchers.MatcherAssume.assumeThat; import static org.firebirdsql.common.matchers.SQLExceptionMatchers.*; -import static org.firebirdsql.common.matchers.SQLExceptionMatchers.getFbMessage; import static org.firebirdsql.util.FirebirdSupportInfo.supportInfoFor; import static org.hamcrest.CoreMatchers.*; -import static org.hamcrest.CoreMatchers.equalTo; -import static org.hamcrest.CoreMatchers.not; -import static org.junit.Assert.*; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.junit.Assume.assumeThat; -import static org.junit.Assume.assumeTrue; - -public class IDatabaseImplTest { +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.oneOf; +import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assumptions.assumeTrue; + +/** + * Tests for OO API database. See {@link org.firebirdsql.nativeoo.gds.ng.IDatabaseImpl}. + * + * @since 5.0 + */ +class IDatabaseImplTest { // TODO Assert in tests need to be checked (and more need to be added) - @ClassRule - public static final GdsTypeRule testType = GdsTypeRule.supportsFBOONativeOnly(); + @RegisterExtension + static final GdsTypeExtension testType = GdsTypeExtension.supportsFBOONativeOnly(); - private AbstractNativeOODatabaseFactory factory = + private final AbstractNativeOODatabaseFactory factory = (AbstractNativeOODatabaseFactory) FBTestProperties.getFbDatabaseFactory(); - - @Rule - public final ExpectedException expectedException = ExpectedException.none(); - - - private final FbConnectionProperties connectionInfo; - { - connectionInfo = new FbConnectionProperties(); - connectionInfo.setServerName(FBTestProperties.DB_SERVER_URL); - connectionInfo.setPortNumber(FBTestProperties.DB_SERVER_PORT); - connectionInfo.setUser(DB_USER); - connectionInfo.setPassword(DB_PASSWORD); - connectionInfo.setDatabaseName(FBTestProperties.getDatabasePath()); - connectionInfo.setEncoding("NONE"); - - } + private final FbConnectionProperties connectionInfo = FBTestProperties.getDefaultFbConnectionProperties(); @Test - public void testBasicAttach() throws Exception { + void testBasicAttach() throws Exception { FBManager fbManager = createFBManager(); defaultDatabaseSetUp(fbManager); - try (IDatabaseImpl db = (IDatabaseImpl) factory.connect(connectionInfo)) { + try (IDatabaseImpl db = factory.connect(connectionInfo)) { db.attach(); - assertTrue("Expected isAttached() to return true", db.isAttached()); - assertNotNull("Expected version string to be not null", db.getServerVersion()); - assertNotEquals("Expected version should not be invalid", GDSServerVersion.INVALID_VERSION, db.getServerVersion()); + assertTrue(db.isAttached(), "Expected isAttached() to return true"); + assertNotNull(db.getServerVersion(), "Expected version string to be not null"); + assertNotEquals(GDSServerVersion.INVALID_VERSION, db.getServerVersion(), "Expected version should not be invalid"); } finally { defaultDatabaseTearDown(fbManager); } } @Test - public void doubleAttach() throws Exception { - expectedException.expect(SQLException.class); - expectedException.expectMessage(equalTo("Already attached to a database")); - + void doubleAttach() throws Exception { FBManager fbManager = createFBManager(); defaultDatabaseSetUp(fbManager); - - try (IDatabaseImpl db = (IDatabaseImpl) factory.connect(connectionInfo)) { + try (IDatabaseImpl db = factory.connect(connectionInfo)) { db.attach(); - //Second attach should throw exception - db.attach(); + SQLException exception = assertThrows(SQLException.class, db::attach, + "Second attach should throw exception"); + assertThat(exception, message(equalTo("Already attached to a database"))); } finally { defaultDatabaseTearDown(fbManager); } } @Test - public void basicStatusProcessing_wrongLogin() throws Exception { - assumeThat("Embedded on windows does not use authentication", - FBTestProperties.GDS_TYPE, is(not(FbOOEmbeddedGDSFactoryPlugin.EMBEDDED_TYPE_NAME))); + void basicStatusProcessing_wrongLogin() throws Exception { + assumeThat("Embedded does not use authentication", + FBTestProperties.GDS_TYPE, not(isEmbeddedType())); // set invalid password connectionInfo.setPassword("abcd"); - try (IDatabaseImpl db = (IDatabaseImpl) factory.connect(connectionInfo)) { - - expectedException.expect(allOf( - isA(SQLException.class), + IDatabaseImpl db = factory.connect(connectionInfo); + try { + SQLException exception = assertThrows(SQLException.class, db::attach); + assertThat(exception, allOf( message(startsWith(getFbMessage(ISCConstants.isc_login))), - errorCode(equalTo(ISCConstants.isc_login)) - )); - - db.attach(); + errorCode(equalTo(ISCConstants.isc_login)))); + } finally { + closeQuietly(db); } } @Test - public void testBasicStatusProcessing_wrongDatabase() throws Exception { + void testBasicStatusProcessing_wrongDatabase() throws Exception { // set invalid database final String invalidDatabaseName = FBTestProperties.getDatabasePath() + "doesnotexist"; connectionInfo.setDatabaseName(invalidDatabaseName); - try (IDatabaseImpl db = (IDatabaseImpl) factory.connect(connectionInfo)) { - - expectedException.expect(allOf( - isA(SQLException.class), + IDatabaseImpl db = factory.connect(connectionInfo); + try { + SQLException exception = assertThrows(SQLException.class, db::attach); + assertThat(exception, allOf( // TODO Error parameter is platform dependent anyOf( message(startsWith(getFbMessage(ISCConstants.isc_io_error, "CreateFile (open)", @@ -139,8 +114,8 @@ public void testBasicStatusProcessing_wrongDatabase() throws Exception { ), errorCode(equalTo(ISCConstants.isc_io_error)) )); - - db.attach(); + } finally { + closeQuietly(db); } } @@ -148,70 +123,74 @@ public void testBasicStatusProcessing_wrongDatabase() throws Exception { * Tests creating and subsequently dropping a database */ @Test - public void testBasicCreateAndDrop() throws Exception { + void testBasicCreateAndDrop() throws Exception { connectionInfo.setSqlDialect(3); - IDatabaseImpl db = (IDatabaseImpl) factory.connect(connectionInfo); + IDatabaseImpl db = factory.connect(connectionInfo); File dbFile = new File(connectionInfo.getDatabaseName()); try { db.createDatabase(); - assertTrue("Database should be attached after create", db.isAttached()); - assertTrue("Expected database file to exist (NOTE: only works on localhost)", - dbFile.exists() || !FBTestProperties.DB_SERVER_URL.equalsIgnoreCase("localhost") ); + assertTrue(db.isAttached(), "Database should be attached after create"); + assertTrue(dbFile.exists() || !FBTestProperties.DB_SERVER_URL.equalsIgnoreCase("localhost"), + "Expected database file to exist (NOTE: only works on localhost)"); db.dropDatabase(); - assertFalse("Database should be detached after drop", db.isAttached()); - assertFalse("Expected database file to have been removed after drop", dbFile.exists()); + assertFalse(db.isAttached(), "Database should be detached after drop"); + assertFalse(dbFile.exists(), "Expected database file to have been removed after drop"); } finally { - safelyClose(db); + closeQuietly(db); if (dbFile.exists()) { + //noinspection ResultOfMethodCallIgnored dbFile.delete(); } } } @Test - public void testDrop_NotAttached() throws Exception { - expectedException.expect(SQLException.class); - expectedException.expectMessage(startsWith("The connection is not attached to a database")); - expectedException.expect(sqlStateEquals(SQLStateConstants.SQL_STATE_CONNECTION_ERROR)); - + void testDrop_NotAttached() throws Exception { FBManager fbManager = createFBManager(); defaultDatabaseSetUp(fbManager); try { - IDatabaseImpl db = (IDatabaseImpl) factory.connect(connectionInfo); - db.dropDatabase(); + IDatabaseImpl db = factory.connect(connectionInfo); + try { + SQLException exception = assertThrows(SQLException.class, db::dropDatabase); + assertThat(exception, allOf( + message(startsWith("The connection is not attached to a database")), + sqlStateEquals(SQLStateConstants.SQL_STATE_CONNECTION_ERROR))); + } finally { + closeQuietly(db); + } } finally { defaultDatabaseTearDown(fbManager); } } + @SuppressWarnings("resource") @Test - public void testDetach_NotConnected() throws Exception { - IDatabaseImpl db = (IDatabaseImpl) factory.connect(connectionInfo); + void testDetach_NotConnected() throws Exception { + IDatabaseImpl db = factory.connect(connectionInfo); + SQLException exception = assertThrows(SQLException.class, db::close); // Note: the error is different from the one in the pure java implementation as we cannot discern between // not connected and not attached - expectedException.expect(SQLException.class); - expectedException.expectMessage(startsWith("The connection is not attached to a database")); - expectedException.expect(sqlStateEquals(SQLStateConstants.SQL_STATE_CONNECTION_ERROR)); - - db.close(); + assertThat(exception, allOf( + message(startsWith("The connection is not attached to a database")), + sqlStateEquals(SQLStateConstants.SQL_STATE_CONNECTION_ERROR))); } @Test - public void testBasicDetach() throws Exception { + void testBasicDetach() throws Exception { FBManager fbManager = createFBManager(); defaultDatabaseSetUp(fbManager); try { - IDatabaseImpl db = (IDatabaseImpl) factory.connect(connectionInfo); + IDatabaseImpl db = factory.connect(connectionInfo); try { db.attach(); db.close(); - assertFalse("Expected database not attached", db.isAttached()); + assertFalse(db.isAttached(), "Expected database not attached"); } finally { - safelyClose(db); + closeQuietly(db); } } finally { defaultDatabaseTearDown(fbManager); @@ -219,29 +198,27 @@ public void testBasicDetach() throws Exception { } @Test - public void testDetach_openTransactions() throws Exception { + void testDetach_openTransactions() throws Exception { FBManager fbManager = createFBManager(); defaultDatabaseSetUp(fbManager); try { - IDatabaseImpl db = (IDatabaseImpl) factory.connect(connectionInfo); + IDatabaseImpl db = factory.connect(connectionInfo); FbTransaction transaction = null; try { db.attach(); // Starting an active transaction transaction = getTransaction(db); - expectedException.expect(allOf( + SQLException exception = assertThrows(SQLException.class, db::close); + assertThat(exception, allOf( errorCodeEquals(ISCConstants.isc_open_trans), - message(startsWith(getFbMessage(ISCConstants.isc_open_trans, "1"))) - )); - - db.close(); + message(startsWith(getFbMessage(ISCConstants.isc_open_trans, "1"))))); } finally { if (transaction != null && transaction.getState() == TransactionState.ACTIVE) { transaction.commit(); } - safelyClose(db); + closeQuietly(db); } } finally { defaultDatabaseTearDown(fbManager); @@ -249,21 +226,26 @@ public void testDetach_openTransactions() throws Exception { } @Test - public void testCancelOperation_abortSupported() throws Exception { + void testCancelOperation_abortSupported() throws Exception { + // TODO Investigate why this doesn't work. + assumeThat("Test doesn't work with embedded protocol", + FBTestProperties.GDS_TYPE, + not(oneOf(EmbeddedGDSFactoryPlugin.EMBEDDED_TYPE_NAME))); + FBManager fbManager = createFBManager(); defaultDatabaseSetUp(fbManager); try { - IDatabaseImpl db = (IDatabaseImpl) factory.connect(connectionInfo); + IDatabaseImpl db = factory.connect(connectionInfo); try { db.attach(); - assumeTrue("expected database attached", db.isAttached()); - assumeTrue("Test requires cancel support", supportInfoFor(db).supportsCancelOperation()); + assumeTrue(db.isAttached(), "expected database attached"); + assumeTrue(supportInfoFor(db).supportsCancelOperation(), "Test requires cancel support"); db.cancelOperation(ISCConstants.fb_cancel_abort); - assertFalse("Expected database not attached after abort", db.isAttached()); + assertFalse(db.isAttached(), "Expected database not attached after abort"); } finally { - safelyClose(db); + closeQuietly(db); } } finally { defaultDatabaseTearDown(fbManager); @@ -271,38 +253,23 @@ public void testCancelOperation_abortSupported() throws Exception { } @Test - public void testExecuteImmediate_createDatabase() throws Exception { - IDatabaseImpl db = (IDatabaseImpl) factory.connect(connectionInfo); + void testExecuteImmediate_createDatabase() throws Exception { + IDatabaseImpl db = factory.connect(connectionInfo); try { String createDb = String.format("CREATE DATABASE '%s' USER '%s' PASSWORD '%s'", getDatabasePath(), DB_USER, DB_PASSWORD); db.executeImmediate(createDb, null); - assertTrue("Expected to be attached after create database", db.isAttached()); + assertTrue(db.isAttached(), "Expected to be attached after create database"); db.dropDatabase(); } finally { - safelyClose(db); + closeQuietly(db); + //noinspection ResultOfMethodCallIgnored new File(getDatabasePath()).delete(); } } private FbTransaction getTransaction(FbDatabase db) throws SQLException { - TransactionParameterBuffer tpb = new TransactionParameterBufferImpl(); - tpb.addArgument(TpbItems.isc_tpb_read_committed); - tpb.addArgument(TpbItems.isc_tpb_rec_version); - tpb.addArgument(TpbItems.isc_tpb_write); - tpb.addArgument(TpbItems.isc_tpb_wait); - return db.startTransaction(tpb); + return db.startTransaction(getDefaultTpb()); } - private static void safelyClose(FbDatabase db) { - if (db == null) return; - try { - if (db.isAttached()) { - db.close(); - } - } catch (SQLException ex) { - ex.printStackTrace(); - // ignore - } - } } diff --git a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IEventBlockImplTest.java b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IEventBlockImplTest.java index 728d764668..12e9349c31 100644 --- a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IEventBlockImplTest.java +++ b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IEventBlockImplTest.java @@ -1,49 +1,49 @@ package org.firebirdsql.nativeoo.gds.ng; -import org.firebirdsql.common.FBJUnit4TestBase; import org.firebirdsql.common.FBTestProperties; -import org.firebirdsql.common.rules.GdsTypeRule; +import org.firebirdsql.common.extension.GdsTypeExtension; +import org.firebirdsql.common.extension.UsesDatabaseExtension; import org.firebirdsql.gds.EventHandle; -import org.firebirdsql.gds.EventHandler; -import org.firebirdsql.gds.TransactionParameterBuffer; - -import org.firebirdsql.gds.impl.TransactionParameterBufferImpl; -import org.firebirdsql.gds.ng.*; +import org.firebirdsql.gds.ng.FbConnectionProperties; +import org.firebirdsql.gds.ng.FbDatabase; +import org.firebirdsql.gds.ng.FbStatement; +import org.firebirdsql.gds.ng.FbTransaction; +import org.firebirdsql.gds.ng.SimpleEventHandler; import org.firebirdsql.gds.ng.fields.RowValue; - -import org.firebirdsql.jaybird.fb.constants.TpbItems; -import org.junit.After; -import org.junit.ClassRule; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; +import org.firebirdsql.gds.ng.jna.JnaDatabase; +import org.firebirdsql.logging.Logger; +import org.firebirdsql.logging.LoggerFactory; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Order; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.RegisterExtension; import java.sql.SQLException; -import static org.firebirdsql.common.FBTestProperties.DB_PASSWORD; -import static org.firebirdsql.common.FBTestProperties.DB_USER; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -public class IEventBlockImplTest extends FBJUnit4TestBase { +import static org.firebirdsql.common.FBTestProperties.getDefaultTpb; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; - @ClassRule - public static final GdsTypeRule testType = GdsTypeRule.supportsFBOONativeOnly(); - - private AbstractNativeOODatabaseFactory factory = - (AbstractNativeOODatabaseFactory) FBTestProperties.getFbDatabaseFactory(); +/** + * Tests for OO API events implementation. See {@link org.firebirdsql.nativeoo.gds.ng.IDatabaseImpl}. + * + * @since 5.0 + */ +class IEventBlockImplTest { - @Rule - public final ExpectedException expectedException = ExpectedException.none(); + private final Logger log = LoggerFactory.getLogger(IEventBlockImplTest.class); + @RegisterExtension + @Order(1) + static final GdsTypeExtension testType = GdsTypeExtension.supportsFBOONativeOnly(); //@formatter:off - public static final String TABLE_DEF = + private static final String TABLE_DEF = "CREATE TABLE TEST (" + " TESTVAL INTEGER NOT NULL" + ")"; - public static final String TRIGGER_DEF = + private static final String TRIGGER_DEF = "CREATE TRIGGER INSERT_TRIG " + " FOR TEST AFTER INSERT " + "AS BEGIN " + @@ -51,22 +51,20 @@ public class IEventBlockImplTest extends FBJUnit4TestBase { " POST_EVENT 'TEST_EVENT_B';" + "END"; //@formatter:on - - private final FbConnectionProperties connectionInfo; - { - connectionInfo = new FbConnectionProperties(); - connectionInfo.setServerName(FBTestProperties.DB_SERVER_URL); - connectionInfo.setPortNumber(FBTestProperties.DB_SERVER_PORT); - connectionInfo.setUser(DB_USER); - connectionInfo.setPassword(DB_PASSWORD); - connectionInfo.setDatabaseName(FBTestProperties.getDatabasePath()); - connectionInfo.setEncoding("NONE"); - } + + @RegisterExtension + static final UsesDatabaseExtension.UsesDatabaseForAll usesDatabase = UsesDatabaseExtension.usesDatabaseForAll( + TABLE_DEF, + TRIGGER_DEF); + + private final AbstractNativeOODatabaseFactory factory = + (AbstractNativeOODatabaseFactory) FBTestProperties.getFbDatabaseFactory(); + private final FbConnectionProperties connectionInfo = FBTestProperties.getDefaultFbConnectionProperties(); private IDatabaseImpl db; - @After - public final void tearDown() throws Exception { + @AfterEach + void tearDown() { if (db != null && db.isAttached()) { try { db.close(); @@ -77,32 +75,20 @@ public final void tearDown() throws Exception { } @Test - public void testCreateEventHandle() throws Exception { - db = (IDatabaseImpl) factory.connect(connectionInfo); + void testCreateEventHandle() throws Exception { + db = factory.connect(connectionInfo); db.attach(); - IEventImpl eventBlock = (IEventImpl)db.createEventHandle("TEST_EVENT", new EventHandler() { - @Override - public void eventOccurred(EventHandle eventHandle) { - } - }); + IEventImpl eventHandle = db.createEventHandle("TEST_EVENT", eventHandle1 -> { }); - assertTrue("Event handle should have a size set", eventBlock.getSize() > 0); + assertTrue(eventHandle.getSize() > 0, "Event handle should have a size set"); } @Test - public void testQueueEvent_andNotification() throws Exception { - db = (IDatabaseImpl) factory.connect(connectionInfo); + void testQueueEvent_andNotification() throws Exception { + db = factory.connect(connectionInfo); db.attach(); - FbTransaction transaction = getTransaction(db); - final FbStatement statement = db.createStatement(transaction); - statement.prepare(TABLE_DEF); - statement.execute(RowValue.EMPTY_ROW_VALUE); - statement.prepare(TRIGGER_DEF); - statement.execute(RowValue.EMPTY_ROW_VALUE); - transaction.commit(); - SimpleEventHandler eventHandler = new SimpleEventHandler(); EventHandle eventHandleA = db.createEventHandle("TEST_EVENT_A", eventHandler); @@ -126,10 +112,10 @@ public void testQueueEvent_andNotification() throws Exception { db.queueEvent(eventHandleB); Thread.sleep(50); - assertTrue("Expected events to not have been triggered", eventHandler.getReceivedEventHandles().isEmpty()); + assertTrue(eventHandler.getReceivedEventHandles().isEmpty(), "Expected events to not have been triggered"); - transaction = getTransaction(db); - statement.setTransaction(transaction); + FbTransaction transaction = getTransaction(db); + FbStatement statement = db.createStatement(transaction); statement.prepare("INSERT INTO TEST VALUES (1)"); statement.execute(RowValue.EMPTY_ROW_VALUE); transaction.commit(); @@ -140,13 +126,14 @@ public void testQueueEvent_andNotification() throws Exception { && retry++ < 10) { Thread.sleep(50); } - assertEquals("Unexpected number of events received", 2, eventHandler.getReceivedEventHandles().size()); + assertEquals(2, eventHandler.getReceivedEventHandles().size(), "Unexpected number of events received"); db.countEvents(eventHandleA); db.countEvents(eventHandleB); assertEquals(1, eventHandleA.getEventCount()); assertEquals(1, eventHandleB.getEventCount()); + // TODO Workaround for CORE-4794 db.queueEvent(eventHandleA); db.queueEvent(eventHandleB); @@ -155,13 +142,7 @@ public void testQueueEvent_andNotification() throws Exception { db.cancelEvent(eventHandleB); } - private FbTransaction getTransaction(FbDatabase db) throws SQLException { - TransactionParameterBuffer tpb = new TransactionParameterBufferImpl(); - tpb.addArgument(TpbItems.isc_tpb_read_committed); - tpb.addArgument(TpbItems.isc_tpb_rec_version); - tpb.addArgument(TpbItems.isc_tpb_write); - tpb.addArgument(TpbItems.isc_tpb_wait); - return db.startTransaction(tpb); + return db.startTransaction(getDefaultTpb()); } } diff --git a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IServiceConnectionImplTest.java b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IServiceConnectionImplTest.java index d0aa344595..4082382537 100644 --- a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IServiceConnectionImplTest.java +++ b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IServiceConnectionImplTest.java @@ -1,63 +1,57 @@ package org.firebirdsql.nativeoo.gds.ng; import org.firebirdsql.common.FBTestProperties; -import org.firebirdsql.common.rules.GdsTypeRule; +import org.firebirdsql.common.extension.GdsTypeExtension; import org.firebirdsql.gds.ng.FbService; import org.firebirdsql.gds.ng.FbServiceProperties; - +import org.firebirdsql.gds.ng.jna.JnaServiceConnection; import org.firebirdsql.jna.fbclient.FbClientLibrary; -import org.junit.ClassRule; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; - -import static org.firebirdsql.common.FBTestProperties.DB_PASSWORD; -import static org.firebirdsql.common.FBTestProperties.DB_USER; -import static org.junit.Assert.*; -import static org.junit.Assert.assertNull; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.RegisterExtension; -public class IServiceConnectionImplTest { - @ClassRule - public static final GdsTypeRule testType = GdsTypeRule.supportsFBOONativeOnly(); +import static org.firebirdsql.common.FBTestProperties.getDefaultServiceProperties; +import static org.firebirdsql.common.JdbcResourceHelper.closeQuietly; +import static org.junit.jupiter.api.Assertions.*; - private AbstractNativeOODatabaseFactory factory = - (AbstractNativeOODatabaseFactory) FBTestProperties.getFbDatabaseFactory(); +/** + * Tests for OO API service connection implementation. + * See {@link org.firebirdsql.nativeoo.gds.ng.IServiceConnectionImpl}. + * + * @since 5.0 + */ +class IServiceConnectionImplTest { - @Rule - public final ExpectedException expectedException = ExpectedException.none(); + @RegisterExtension + static final GdsTypeExtension testType = GdsTypeExtension.supportsFBOONativeOnly(); - private final FbServiceProperties connectionInfo; - { - connectionInfo = new FbServiceProperties(); - connectionInfo.setServerName(FBTestProperties.DB_SERVER_URL); - connectionInfo.setPortNumber(FBTestProperties.DB_SERVER_PORT); - connectionInfo.setUser(DB_USER); - connectionInfo.setPassword(DB_PASSWORD); - } + private final AbstractNativeOODatabaseFactory factory = + (AbstractNativeOODatabaseFactory) FBTestProperties.getFbDatabaseFactory(); + private final FbServiceProperties connectionInfo = getDefaultServiceProperties(); @Test - public void construct_clientLibraryNull_IllegalArgument() throws Exception { - expectedException.expect(NullPointerException.class); - - new IServiceConnectionImpl(null, connectionInfo); + void construct_clientLibraryNull_IllegalArgument() { + assertThrows(NullPointerException.class, () -> new IServiceConnectionImpl(null, connectionInfo)); } @Test - public void getClientLibrary_returnsSuppliedLibrary() throws Exception { + void getClientLibrary_returnsSuppliedLibrary() throws Exception { final FbClientLibrary clientLibrary = factory.getClientLibrary(); IServiceConnectionImpl connection = new IServiceConnectionImpl(clientLibrary, connectionInfo); - assertSame("Expected returned client library to be identical", clientLibrary, connection.getClientLibrary()); + assertSame(clientLibrary, connection.getClientLibrary(), "Expected returned client library to be identical"); } @Test - public void identify_unconnected() throws Exception { + void identify_unconnected() throws Exception { IServiceConnectionImpl connection = new IServiceConnectionImpl(factory.getClientLibrary(), connectionInfo); FbService db = connection.identify(); - - assertFalse("Expected isAttached() to return false", db.isAttached()); - assertNull("Expected version string to be null", db.getServerVersion()); - assertNull("Expected version should be null", db.getServerVersion()); + try { + assertFalse(db.isAttached(), "Expected isAttached() to return false"); + assertNull(db.getServerVersion(), "Expected version string to be null"); + assertNull(db.getServerVersion(), "Expected version should be null"); + } finally { + closeQuietly(db); + } } } diff --git a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IServiceImplTest.java b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IServiceImplTest.java index 750e811e60..171a30ae71 100644 --- a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IServiceImplTest.java +++ b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IServiceImplTest.java @@ -1,121 +1,100 @@ package org.firebirdsql.nativeoo.gds.ng; import org.firebirdsql.common.FBTestProperties; -import org.firebirdsql.common.rules.GdsTypeRule; +import org.firebirdsql.common.extension.GdsTypeExtension; import org.firebirdsql.gds.ISCConstants; import org.firebirdsql.gds.ServiceRequestBuffer; - import org.firebirdsql.gds.impl.GDSServerVersion; - -import org.firebirdsql.gds.impl.nativeoo.FbOOEmbeddedGDSFactoryPlugin; import org.firebirdsql.gds.ng.FbServiceProperties; - import org.firebirdsql.jaybird.fb.constants.SpbItems; import org.firebirdsql.management.FBManager; import org.firebirdsql.management.FBStatisticsManager; -import org.junit.ClassRule; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.RegisterExtension; import java.io.ByteArrayOutputStream; import java.sql.SQLException; import static org.firebirdsql.common.FBTestProperties.*; -import static org.firebirdsql.common.FBTestProperties.defaultDatabaseTearDown; -import static org.firebirdsql.common.FBTestProperties.getDatabasePath; +import static org.firebirdsql.common.JdbcResourceHelper.closeQuietly; +import static org.firebirdsql.common.matchers.GdsTypeMatchers.isEmbeddedType; +import static org.firebirdsql.common.matchers.MatcherAssume.assumeThat; import static org.firebirdsql.common.matchers.SQLExceptionMatchers.*; import static org.firebirdsql.gds.ISCConstants.*; -import static org.firebirdsql.gds.ISCConstants.isc_info_end; import static org.firebirdsql.gds.VaxEncoding.iscVaxInteger2; import static org.hamcrest.CoreMatchers.*; -import static org.hamcrest.CoreMatchers.containsString; -import static org.hamcrest.CoreMatchers.endsWith; import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assume.assumeThat; -import static org.junit.Assume.assumeTrue; +import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assumptions.assumeTrue; -public class IServiceImplTest { +/** + * Tests for OO API service implementation. + * See {@link org.firebirdsql.nativeoo.gds.ng.IServiceImpl}. + * + * @since 5.0 + */ +class IServiceImplTest { - @ClassRule - public static final GdsTypeRule testType = GdsTypeRule.supportsFBOONativeOnly(); + @RegisterExtension + static final GdsTypeExtension testType = GdsTypeExtension.supportsFBOONativeOnly(); private AbstractNativeOODatabaseFactory factory = (AbstractNativeOODatabaseFactory) FBTestProperties.getFbDatabaseFactory(); - @Rule - public final ExpectedException expectedException = ExpectedException.none(); - - - - private final FbServiceProperties connectionInfo; - { - connectionInfo = new FbServiceProperties(); - connectionInfo.setServerName(FBTestProperties.DB_SERVER_URL); - connectionInfo.setPortNumber(FBTestProperties.DB_SERVER_PORT); - connectionInfo.setUser(DB_USER); - connectionInfo.setPassword(DB_PASSWORD); - } + private final FbServiceProperties connectionInfo = getDefaultServiceProperties(); @Test - public void testBasicAttach() throws Exception { - try (IServiceImpl service = (IServiceImpl)factory.serviceConnect(connectionInfo)) { + void testBasicAttach() throws Exception { + try (IServiceImpl service = factory.serviceConnect(connectionInfo)) { service.attach(); - assertTrue("Expected isAttached() to return true", service.isAttached()); - assertNotNull("Expected version string to be not null", service.getServerVersion()); - assertNotEquals("Expected version should not be invalid", GDSServerVersion.INVALID_VERSION, service.getServerVersion()); + assertTrue(service.isAttached(), "Expected isAttached() to return true"); + assertNotNull(service.getServerVersion(), "Expected version string to be not null"); + assertNotEquals(GDSServerVersion.INVALID_VERSION, service.getServerVersion(), "Expected version should not be invalid"); } } @Test - public void doubleAttach() throws Exception { - expectedException.expect(SQLException.class); - expectedException.expectMessage(equalTo("Already attached to a service")); - - try (IServiceImpl service = (IServiceImpl)factory.serviceConnect(connectionInfo)) { + void doubleAttach() throws Exception { + try (IServiceImpl service = factory.serviceConnect(connectionInfo)) { service.attach(); //Second attach should throw exception - service.attach(); + SQLException exception = assertThrows(SQLException.class, service::attach, + "Second attach should throw exception"); + assertThat(exception, message(equalTo("Already attached to a service"))); } } @Test - public void basicStatusVectorProcessing_wrongLogin() throws Exception { + void basicStatusVectorProcessing_wrongLogin() throws Exception { assumeThat("Embedded on windows does not use authentication", - FBTestProperties.GDS_TYPE, is(not(FbOOEmbeddedGDSFactoryPlugin.EMBEDDED_TYPE_NAME))); + FBTestProperties.GDS_TYPE, not(isEmbeddedType())); // set invalid password connectionInfo.setPassword("abcd"); - try (IServiceImpl service = (IServiceImpl)factory.serviceConnect(connectionInfo)) { - - expectedException.expect(allOf( - isA(SQLException.class), + IServiceImpl service = factory.serviceConnect(connectionInfo); + try { + SQLException exception = assertThrows(SQLException.class, service::attach); + assertThat(exception, allOf( message(startsWith(getFbMessage(ISCConstants.isc_login))), - errorCode(equalTo(ISCConstants.isc_login)) - )); - - service.attach(); + errorCode(equalTo(ISCConstants.isc_login)))); + } finally { + closeQuietly(service); } } @Test - public void testBasicStatusVectorProcessing_wrongService() throws Exception { - assumeTrue("Incorrect service name ignored in Firebird 4+", getDefaultSupportInfo().isVersionBelow(4, 0)); + void testBasicStatusVectorProcessing_wrongService() throws Exception { + assumeTrue(getDefaultSupportInfo().isVersionBelow(4, 0), "Incorrect service name ignored in Firebird 4+"); // set invalid database final String invalidServiceName = "doesnotexist"; connectionInfo.setServiceName(invalidServiceName); - try (IServiceImpl service = (IServiceImpl)factory.serviceConnect(connectionInfo)) { - - expectedException.expect(allOf( - isA(SQLException.class), - fbMessageStartsWith(ISCConstants.isc_service_att_err)) - ); - - service.attach(); + IServiceImpl service = factory.serviceConnect(connectionInfo); + try { + SQLException exception = assertThrows(SQLException.class, service::attach); + assertThat(exception, fbMessageStartsWith(ISCConstants.isc_service_att_err)); + } finally { + closeQuietly(service); } } @@ -126,10 +105,10 @@ public void testBasicStatusVectorProcessing_wrongService() throws Exception { *

*/ @Test - public void testStartServiceAction() throws Exception { + void testStartServiceAction() throws Exception { FBManager fbManager = createFBManager(); defaultDatabaseSetUp(fbManager); - try (IServiceImpl service = (IServiceImpl)factory.serviceConnect(connectionInfo)) { + try (IServiceImpl service = factory.serviceConnect(connectionInfo)) { service.attach(); ServiceRequestBuffer actionSrb = service.createServiceRequestBuffer(); @@ -172,7 +151,7 @@ public void testStartServiceAction() throws Exception { assertThat("Expected database header page content", headerPage, allOf( startsWith("\nDatabase"), containsString("Database header page information"), - endsWith("\n"))); + containsString("*END*\n"))); } finally { defaultDatabaseTearDown(fbManager); } diff --git a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IStatementImplTest.java b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IStatementImplTest.java index a573e7aa23..d287d5b771 100644 --- a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IStatementImplTest.java +++ b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IStatementImplTest.java @@ -19,35 +19,32 @@ package org.firebirdsql.nativeoo.gds.ng; import org.firebirdsql.common.FBTestProperties; -import org.firebirdsql.common.rules.GdsTypeRule; -import org.firebirdsql.gds.JaybirdErrorCodes; - +import org.firebirdsql.common.extension.GdsTypeExtension; +import org.firebirdsql.common.extension.UsesDatabaseExtension; import org.firebirdsql.gds.ng.AbstractStatementTest; import org.firebirdsql.gds.ng.DatatypeCoder; import org.firebirdsql.gds.ng.FbDatabase; import org.firebirdsql.gds.ng.fields.RowValue; import org.firebirdsql.gds.ng.wire.SimpleStatementListener; -import org.junit.ClassRule; -import org.junit.Test; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.RegisterExtension; import java.sql.SQLException; -import java.sql.SQLNonTransientException; -import static org.firebirdsql.common.matchers.SQLExceptionMatchers.errorCodeEquals; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; /** * Tests for OO API statement. * {@link org.firebirdsql.nativeoo.gds.ng.IStatementImpl}. * - * @since 4.0 + * @since 5.0 */ -public class IStatementImplTest extends AbstractStatementTest { +class IStatementImplTest extends AbstractStatementTest { - @ClassRule - public static final GdsTypeRule testType = GdsTypeRule.supportsFBOONativeOnly(); + @RegisterExtension + static final GdsTypeExtension testType = GdsTypeExtension.supportsFBOONativeOnly(); - private AbstractNativeOODatabaseFactory factory = + private final AbstractNativeOODatabaseFactory factory = (AbstractNativeOODatabaseFactory) FBTestProperties.getFbDatabaseFactory(); @Override @@ -61,6 +58,7 @@ protected FbDatabase createDatabase() throws SQLException { } @Test + @Override public void testSelect_NoParameters_Execute_and_Fetch() throws Exception { allocateStatement(); statement.prepare( @@ -72,22 +70,22 @@ public void testSelect_NoParameters_Execute_and_Fetch() throws Exception { statement.execute(RowValue.EMPTY_ROW_VALUE); - assertEquals("Expected hasResultSet to be set to true", Boolean.TRUE, statementListener.hasResultSet()); - assertEquals("Expected hasSingletonResult to be set to false", Boolean.FALSE, statementListener.hasSingletonResult()); - assertNull("Expected allRowsFetched not set yet", statementListener.isAllRowsFetched()); - assertEquals("Expected no rows to be fetched yet", 0, statementListener.getRows().size()); + assertEquals(Boolean.TRUE, statementListener.hasResultSet(), "Expected hasResultSet to be set to true"); + assertEquals(Boolean.FALSE, statementListener.hasSingletonResult(), "Expected hasSingletonResult to be set to false"); + assertNotEquals(Boolean.TRUE, statementListener.isAfterLast(), "Expected afterLast not set yet"); + assertEquals(0, statementListener.getRows().size(), "Expected no rows to be fetched yet"); - // JNAStatement only executes a single fetch to prevent problems with positioned updates, + // IStatement only executes a single fetch to prevent problems with positioned updates, // so this doesn't get all rows fetched immediately statement.fetchRows(10); - assertEquals("Expected allRowsFetched to haven't been called yet", null, statementListener.isAllRowsFetched()); - assertEquals("Expected a single row to have been fetched", 1, statementListener.getRows().size()); + assertNotEquals(Boolean.TRUE, statementListener.isAfterLast(), "Expected afterLast to haven't been called yet"); + assertEquals(1, statementListener.getRows().size(), "Expected a single row to have been fetched"); statement.fetchRows(1); - assertEquals("Expected allRowsFetched to be set to true", Boolean.TRUE, statementListener.isAllRowsFetched()); - assertEquals("Expected a single row to have been fetched", 1, statementListener.getRows().size()); + assertEquals(Boolean.TRUE, statementListener.isAfterLast(), "Expected afterLast to be set to true"); + assertEquals(1, statementListener.getRows().size(), "Expected a single row to have been fetched"); } @Test @@ -102,45 +100,44 @@ public void testMultipleExecute() throws Exception { statement.execute(RowValue.EMPTY_ROW_VALUE); - assertEquals("Expected hasResultSet to be set to true", Boolean.TRUE, statementListener.hasResultSet()); - assertEquals("Expected hasSingletonResult to be set to false", Boolean.FALSE, statementListener.hasSingletonResult()); - assertNull("Expected allRowsFetched not set yet", statementListener.isAllRowsFetched()); - assertEquals("Expected no rows to be fetched yet", 0, statementListener.getRows().size()); + assertEquals(Boolean.TRUE, statementListener.hasResultSet(), "Expected hasResultSet to be set to true"); + assertEquals(Boolean.FALSE, statementListener.hasSingletonResult(), "Expected hasSingletonResult to be set to false"); + assertNotEquals(Boolean.TRUE, statementListener.isAfterLast(), "Expected afterLast not set yet"); + assertEquals(0, statementListener.getRows().size(), "Expected no rows to be fetched yet"); - // JNAStatement only executes a single fetch to prevent problems with positioned updates, + // IStatement only executes a single fetch to prevent problems with positioned updates, // so this doesn't get all rows fetched immediately statement.fetchRows(10); - assertEquals("Expected allRowsFetched to haven't been called yet", null, statementListener.isAllRowsFetched()); - assertEquals("Expected a single row to have been fetched", 1, statementListener.getRows().size()); + assertNotEquals(Boolean.TRUE, statementListener.isAfterLast(), "Expected afterLast to haven't been called yet"); + assertEquals(1, statementListener.getRows().size(), "Expected a single row to have been fetched"); statement.fetchRows(1); - assertEquals("Expected allRowsFetched to be set to true", Boolean.TRUE, statementListener.isAllRowsFetched()); - assertEquals("Expected a single row to have been fetched", 1, statementListener.getRows().size()); + assertEquals(Boolean.TRUE, statementListener.isAfterLast(), "Expected afterLast to be set to true"); + assertEquals(1, statementListener.getRows().size(), "Expected a single row to have been fetched"); statement.closeCursor(); final SimpleStatementListener statementListener2 = new SimpleStatementListener(); statement.addStatementListener(statementListener2); - statement.execute(RowValue.EMPTY_ROW_VALUE); - assertEquals("Expected hasResultSet to be set to true", Boolean.TRUE, statementListener2.hasResultSet()); - assertEquals("Expected hasSingletonResult to be set to false", Boolean.FALSE, statementListener2.hasSingletonResult()); - assertNull("Expected allRowsFetched not set yet", statementListener2.isAllRowsFetched()); - assertEquals("Expected no rows to be fetched yet", 0, statementListener2.getRows().size()); + assertEquals(Boolean.TRUE, statementListener2.hasResultSet(), "Expected hasResultSet to be set to true"); + assertEquals(Boolean.FALSE, statementListener2.hasSingletonResult(), "Expected hasSingletonResult to be set to false"); + assertNotEquals(Boolean.TRUE, statementListener2.isAfterLast(), "Expected afterLast not set yet"); + assertEquals(0, statementListener2.getRows().size(), "Expected no rows to be fetched yet"); - // JNAStatement only executes a single fetch to prevent problems with positioned updates, + // IStatement only executes a single fetch to prevent problems with positioned updates, // so this doesn't get all rows fetched immediately statement.fetchRows(10); - assertEquals("Expected allRowsFetched to haven't been called yet", null, statementListener2.isAllRowsFetched()); - assertEquals("Expected a single row to have been fetched", 1, statementListener2.getRows().size()); + assertNotEquals(Boolean.TRUE, statementListener2.isAfterLast(), "Expected afterLast to haven't been called yet"); + assertEquals(1, statementListener2.getRows().size(), "Expected a single row to have been fetched"); statement.fetchRows(1); - assertEquals("Expected allRowsFetched to be set to true", Boolean.TRUE, statementListener2.isAllRowsFetched()); - assertEquals("Expected a single row to have been fetched", 1, statementListener2.getRows().size()); + assertEquals(Boolean.TRUE, statementListener2.isAfterLast(), "Expected afterLast to be set to true"); + assertEquals(1, statementListener2.getRows().size(), "Expected a single row to have been fetched"); } @Test @@ -155,22 +152,22 @@ public void testMultiplePrepare() throws Exception { statement.execute(RowValue.EMPTY_ROW_VALUE); - assertEquals("Expected hasResultSet to be set to true", Boolean.TRUE, statementListener.hasResultSet()); - assertEquals("Expected hasSingletonResult to be set to false", Boolean.FALSE, statementListener.hasSingletonResult()); - assertNull("Expected allRowsFetched not set yet", statementListener.isAllRowsFetched()); - assertEquals("Expected no rows to be fetched yet", 0, statementListener.getRows().size()); + assertEquals(Boolean.TRUE, statementListener.hasResultSet(), "Expected hasResultSet to be set to true"); + assertEquals(Boolean.FALSE, statementListener.hasSingletonResult(), "Expected hasSingletonResult to be set to false"); + assertNotEquals(Boolean.TRUE, statementListener.isAfterLast(), "Expected afterLast not set yet"); + assertEquals(0, statementListener.getRows().size(), "Expected no rows to be fetched yet"); - // JNAStatement only executes a single fetch to prevent problems with positioned updates, + // IStatement only executes a single fetch to prevent problems with positioned updates, // so this doesn't get all rows fetched immediately statement.fetchRows(10); - assertEquals("Expected allRowsFetched to haven't been called yet", null, statementListener.isAllRowsFetched()); - assertEquals("Expected a single row to have been fetched", 1, statementListener.getRows().size()); + assertNotEquals(Boolean.TRUE, statementListener.isAfterLast(), "Expected afterLast to haven't been called yet"); + assertEquals(1, statementListener.getRows().size(), "Expected a single row to have been fetched"); statement.fetchRows(1); - assertEquals("Expected allRowsFetched to be set to true", Boolean.TRUE, statementListener.isAllRowsFetched()); - assertEquals("Expected a single row to have been fetched", 1, statementListener.getRows().size()); + assertEquals(Boolean.TRUE, statementListener.isAfterLast(), "Expected afterLast to be set to true"); + assertEquals(1, statementListener.getRows().size(), "Expected a single row to have been fetched"); statement.closeCursor(); @@ -182,22 +179,22 @@ public void testMultiplePrepare() throws Exception { statement.addStatementListener(statementListener2); statement.execute(RowValue.EMPTY_ROW_VALUE); - assertEquals("Expected hasResultSet to be set to true", Boolean.TRUE, statementListener2.hasResultSet()); - assertEquals("Expected hasSingletonResult to be set to false", Boolean.FALSE, statementListener2.hasSingletonResult()); - assertNull("Expected allRowsFetched not set yet", statementListener2.isAllRowsFetched()); - assertEquals("Expected no rows to be fetched yet", 0, statementListener2.getRows().size()); + assertEquals(Boolean.TRUE, statementListener2.hasResultSet(), "Expected hasResultSet to be set to true"); + assertEquals(Boolean.FALSE, statementListener2.hasSingletonResult(), "Expected hasSingletonResult to be set to false"); + assertNotEquals(Boolean.TRUE, statementListener2.isAfterLast(), "Expected afterLast not set yet"); + assertEquals(0, statementListener2.getRows().size(), "Expected no rows to be fetched yet"); - // JNAStatement only executes a single fetch to prevent problems with positioned updates, + // IStatement only executes a single fetch to prevent problems with positioned updates, // so this doesn't get all rows fetched immediately statement.fetchRows(10); - assertEquals("Expected allRowsFetched to haven't been called yet", null, statementListener2.isAllRowsFetched()); - assertEquals("Expected a single row to have been fetched", 1, statementListener2.getRows().size()); + assertNotEquals(Boolean.TRUE, statementListener2.isAfterLast(), "Expected afterLast to haven't been called yet"); + assertEquals(1, statementListener2.getRows().size(), "Expected a single row to have been fetched"); statement.fetchRows(1); - assertEquals("Expected allRowsFetched to be set to true", Boolean.TRUE, statementListener2.isAllRowsFetched()); - assertEquals("Expected a single row to have been fetched", 1, statementListener2.getRows().size()); + assertEquals(Boolean.TRUE, statementListener2.isAfterLast(), "Expected afterLast to be set to true"); + assertEquals(1, statementListener2.getRows().size(), "Expected a single row to have been fetched"); } @Test @@ -211,114 +208,40 @@ public void testSelect_WithParameters_Execute_and_Fetch() throws Exception { final DatatypeCoder coder = db.getDatatypeCoder(); RowValue rowValue = RowValue.of( - coder.encodeShort(3), // smallint = 3 (id of UNICODE_FSS) + coder.encodeShort(3), // smallint = 3 (id of UNICODE_FSS) coder.encodeShort(1)); // smallint = 1 (single byte character sets) statement.execute(rowValue); - assertEquals("Expected hasResultSet to be set to true", Boolean.TRUE, listener.hasResultSet()); - assertEquals("Expected hasSingletonResult to be set to false", Boolean.FALSE, listener.hasSingletonResult()); - assertNull("Expected allRowsFetched not set yet", listener.isAllRowsFetched()); - assertEquals("Expected no rows to be fetched yet", 0, listener.getRows().size()); - assertNull("Expected no SQL counts yet", listener.getSqlCounts()); + assertEquals(Boolean.TRUE, listener.hasResultSet(), "Expected hasResultSet to be set to true"); + assertEquals(Boolean.FALSE, listener.hasSingletonResult(), "Expected hasSingletonResult to be set to false"); + assertNotEquals(Boolean.TRUE, listener.isAfterLast(), "Expected afterLast not set yet"); + assertEquals(0, listener.getRows().size(), "Expected no rows to be fetched yet"); + assertNull(listener.getSqlCounts(), "Expected no SQL counts yet"); - // JNAStatement only executes a single fetch to prevent problems with positioned updates, + // IStatement only executes a single fetch to prevent problems with positioned updates, // so this doesn't get all rows fetched immediately statement.fetchRows(100); - assertEquals("Expected allRowsFetched to haven't been called yet", null, listener.isAllRowsFetched()); - assertEquals("Expected a single row to have been fetched", 1, listener.getRows().size()); + assertNotEquals(Boolean.TRUE, listener.isAfterLast(), "Expected afterLast to haven't been called yet"); + assertEquals(1, listener.getRows().size(), "Expected a single row to have been fetched"); // 100 should be sufficient to fetch all character sets; limit to prevent infinite loop with bugs in fetchRows int count = 0; - while(listener.isAllRowsFetched() != Boolean.TRUE && count < 100) { + while(listener.isAfterLast() != Boolean.TRUE && count < 100) { statement.fetchRows(1); count++; } - assertEquals("Expected allRowsFetched to be set to true", Boolean.TRUE, listener.isAllRowsFetched()); + assertEquals(Boolean.TRUE, listener.isAfterLast(), "Expected afterLast to be set to true"); // Number is database dependent (unicode_fss + all single byte character sets) - assertTrue("Expected more than two rows", listener.getRows().size() > 2); + assertTrue(listener.getRows().size() > 2, "Expected more than two rows"); - assertNull("expected no SQL counts immediately after retrieving all rows", listener.getSqlCounts()); + assertNull(listener.getSqlCounts(), "expected no SQL counts immediately after retrieving all rows"); statement.getSqlCounts(); - assertNotNull("Expected SQL counts", listener.getSqlCounts()); - assertEquals("Unexpected select count", listener.getRows().size(), listener.getSqlCounts().getLongSelectCount()); - } - - @Test - public void test_GetExecutionPlan_noStatementPrepared() throws Exception { - allocateStatement(); - expectedException.expect(SQLNonTransientException.class); - expectedException.expectMessage("Statement not yet allocated"); - - statement.getExecutionPlan(); - } - - @Test - public void test_GetExecutionPlan_StatementClosed() throws Exception { - expectedException.expect(SQLNonTransientException.class); - expectedException.expectMessage("Statement closed"); - allocateStatement(); - statement.prepare( - "SELECT RDB$DESCRIPTION AS \"Description\", RDB$RELATION_ID, RDB$SECURITY_CLASS, RDB$CHARACTER_SET_NAME " + - "FROM RDB$DATABASE"); - statement.close(); - - statement.getExecutionPlan(); - } - - @Test - public void setTimeout_nonZeroThenZero() throws Exception { - allocateStatement(); - - statement.prepare( - "SELECT RDB$DESCRIPTION AS \"Description\", RDB$RELATION_ID, RDB$SECURITY_CLASS, RDB$CHARACTER_SET_NAME " + - "FROM RDB$DATABASE"); - - statement.setTimeout(1); - assertEquals(1, statement.getTimeout()); - - statement.setTimeout(0); - assertEquals(0, statement.getTimeout()); - } - - @Test - public void setTimeout_max_long_allowed() throws Exception { - allocateStatement(); - - statement.prepare( - "SELECT RDB$DESCRIPTION AS \"Description\", RDB$RELATION_ID, RDB$SECURITY_CLASS, RDB$CHARACTER_SET_NAME " + - "FROM RDB$DATABASE"); - - statement.setTimeout(Integer.MAX_VALUE); - assertEquals(Integer.MAX_VALUE, statement.getTimeout()); - } - - @Test - public void setTimeout_negativeValue_throwsException() throws Exception { - allocateStatement(); - - statement.prepare( - "SELECT RDB$DESCRIPTION AS \"Description\", RDB$RELATION_ID, RDB$SECURITY_CLASS, RDB$CHARACTER_SET_NAME " + - "FROM RDB$DATABASE"); - - expectedException.expect(SQLNonTransientException.class); - expectedException.expect(errorCodeEquals(JaybirdErrorCodes.jb_invalidTimeout)); - - statement.setTimeout(-1); - } - - @Test - public void getTimeout_defaultZero() throws Exception { - allocateStatement(); - - statement.prepare( - "SELECT RDB$DESCRIPTION AS \"Description\", RDB$RELATION_ID, RDB$SECURITY_CLASS, RDB$CHARACTER_SET_NAME " + - "FROM RDB$DATABASE"); - - assertEquals(0, statement.getTimeout()); + assertNotNull(listener.getSqlCounts(), "Expected SQL counts"); + assertEquals(listener.getRows().size(), listener.getSqlCounts().getLongSelectCount(), "Unexpected select count"); } } diff --git a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IStatementimplTimeoutTest.java b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IStatementImplTimeoutTest.java similarity index 51% rename from src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IStatementimplTimeoutTest.java rename to src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IStatementImplTimeoutTest.java index 22a1d35eb9..e661e7c9f8 100644 --- a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IStatementimplTimeoutTest.java +++ b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IStatementImplTimeoutTest.java @@ -1,19 +1,26 @@ package org.firebirdsql.nativeoo.gds.ng; import org.firebirdsql.common.FBTestProperties; -import org.firebirdsql.common.rules.GdsTypeRule; +import org.firebirdsql.common.extension.GdsTypeExtension; import org.firebirdsql.gds.ng.AbstractStatementTimeoutTest; import org.firebirdsql.gds.ng.FbDatabase; -import org.junit.ClassRule; +import org.junit.jupiter.api.Order; +import org.junit.jupiter.api.extension.RegisterExtension; import java.sql.SQLException; -public class IStatementimplTimeoutTest extends AbstractStatementTimeoutTest { +/** + * Tests for OO API statement timeouts. See {@link org.firebirdsql.nativeoo.gds.ng.IStatementImpl}. + * + * @since 5.0 + */ +class IStatementImplTimeoutTest extends AbstractStatementTimeoutTest { - @ClassRule - public static final GdsTypeRule testType = GdsTypeRule.supportsFBOONativeOnly(); + @RegisterExtension + @Order(1) + static final GdsTypeExtension testType = GdsTypeExtension.supportsFBOONativeOnly(); - private AbstractNativeOODatabaseFactory factory = + private final AbstractNativeOODatabaseFactory factory = (AbstractNativeOODatabaseFactory) FBTestProperties.getFbDatabaseFactory(); @Override diff --git a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/ITransactionImplTest.java b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/ITransactionImplTest.java index b3eb690107..b9b1e1667c 100644 --- a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/ITransactionImplTest.java +++ b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/ITransactionImplTest.java @@ -1,24 +1,26 @@ package org.firebirdsql.nativeoo.gds.ng; import org.firebirdsql.common.FBTestProperties; -import org.firebirdsql.common.rules.GdsTypeRule; +import org.firebirdsql.common.extension.GdsTypeExtension; import org.firebirdsql.gds.ng.AbstractTransactionTest; import org.firebirdsql.gds.ng.FbDatabase; -import org.junit.ClassRule; +import org.junit.jupiter.api.Order; +import org.junit.jupiter.api.extension.RegisterExtension; import java.sql.SQLException; /** - * Tests for {@link org.firebirdsql.nativeoo.gds.ng.ITransactionImpl}. + * Tests for OO API transaction. See {@link org.firebirdsql.nativeoo.gds.ng.ITransactionImpl}. * - * @since 4.0 + * @since 5.0 */ -public class ITransactionImplTest extends AbstractTransactionTest { +class ITransactionImplTest extends AbstractTransactionTest { - @ClassRule - public static final GdsTypeRule testType = GdsTypeRule.supportsFBOONativeOnly(); + @RegisterExtension + @Order(1) + static final GdsTypeExtension testType = GdsTypeExtension.supportsFBOONativeOnly(); - private AbstractNativeOODatabaseFactory factory = + private final AbstractNativeOODatabaseFactory factory = (AbstractNativeOODatabaseFactory) FBTestProperties.getFbDatabaseFactory(); @Override diff --git a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/NativeDatabaseConnectionTest.java b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/NativeDatabaseConnectionTest.java index 029d20e692..b8d5146c26 100644 --- a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/NativeDatabaseConnectionTest.java +++ b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/NativeDatabaseConnectionTest.java @@ -1,65 +1,57 @@ package org.firebirdsql.nativeoo.gds.ng; import org.firebirdsql.common.FBTestProperties; -import org.firebirdsql.common.rules.GdsTypeRule; +import org.firebirdsql.common.extension.GdsTypeExtension; import org.firebirdsql.gds.ng.FbConnectionProperties; import org.firebirdsql.gds.ng.FbDatabase; import org.firebirdsql.jna.fbclient.FbClientLibrary; -import org.junit.ClassRule; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; - -import static org.firebirdsql.common.FBTestProperties.DB_PASSWORD; -import static org.firebirdsql.common.FBTestProperties.DB_USER; -import static org.junit.Assert.*; - -public class NativeDatabaseConnectionTest { - - @ClassRule - public static final GdsTypeRule testType = GdsTypeRule.supportsFBOONativeOnly(); - - private AbstractNativeOODatabaseFactory factory = +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.RegisterExtension; + +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertSame; +import static org.junit.jupiter.api.Assertions.assertThrows; + +/** + * Tests for OO API database connection. See {@link org.firebirdsql.nativeoo.gds.ng.NativeDatabaseConnection}. + * + * @since 5.0 + */ +class NativeDatabaseConnectionTest { + + @RegisterExtension + static final GdsTypeExtension testType = GdsTypeExtension.supportsFBOONativeOnly(); + + private final AbstractNativeOODatabaseFactory factory = (AbstractNativeOODatabaseFactory) FBTestProperties.getFbDatabaseFactory(); - @Rule - public final ExpectedException expectedException = ExpectedException.none(); - - private final FbConnectionProperties connectionInfo; - { - connectionInfo = new FbConnectionProperties(); - connectionInfo.setServerName(FBTestProperties.DB_SERVER_URL); - connectionInfo.setPortNumber(FBTestProperties.DB_SERVER_PORT); - connectionInfo.setUser(DB_USER); - connectionInfo.setPassword(DB_PASSWORD); - connectionInfo.setDatabaseName(FBTestProperties.getDatabasePath()); - connectionInfo.setEncoding("NONE"); - } + private final FbConnectionProperties connectionInfo = FBTestProperties.getDefaultFbConnectionProperties(); @Test - public void construct_clientLibraryNull_IllegalArgument() throws Exception { - expectedException.expect(NullPointerException.class); - - new NativeDatabaseConnection(null, connectionInfo); + void construct_clientLibraryNull_IllegalArgument() throws Exception { + assertThrows(NullPointerException.class, () -> new NativeDatabaseConnection(null, connectionInfo)); } @Test - public void getClientLibrary_returnsSuppliedLibrary() throws Exception { + void getClientLibrary_returnsSuppliedLibrary() throws Exception { final FbClientLibrary clientLibrary = factory.getClientLibrary(); NativeDatabaseConnection connection = new NativeDatabaseConnection(clientLibrary, connectionInfo); - assertSame("Expected returned client library to be identical", clientLibrary, connection.getClientLibrary()); + assertSame(clientLibrary, connection.getClientLibrary(), "Expected returned client library to be identical"); } @Test - public void identify_unconnected() throws Exception { + void identify_unconnected() throws Exception { NativeDatabaseConnection connection = new NativeDatabaseConnection(factory.getClientLibrary(), connectionInfo); FbDatabase db = connection.identify(); - assertFalse("Expected isAttached() to return false", db.isAttached()); - assertNull("Expected version string to be null", db.getServerVersion()); - assertNull("Expected version should be null", db.getServerVersion()); + assertFalse(db.isAttached(), "Expected isAttached() to return false"); + assertNull(db.getServerVersion(), "Expected version string to be null"); + assertNull(db.getServerVersion(), "Expected version should be null"); } } diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/AbstractNativeConnection.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/AbstractNativeConnection.java index d548789bc4..537ed5990d 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/AbstractNativeConnection.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/AbstractNativeConnection.java @@ -18,6 +18,7 @@ import java.nio.ByteOrder; import java.sql.SQLException; +import java.sql.SQLWarning; import static java.util.Objects.requireNonNull; import static org.firebirdsql.gds.ISCConstants.isc_arg_cstring; @@ -83,27 +84,51 @@ public final FbClientLibrary getClientLibrary() { /** * Processing {@link IStatus} to get result of native calling */ - protected void processStatus(IStatus status, WarningMessageCallback messageCallback) throws SQLException { - Pointer pointer = status.getErrors(); - long[] statusVector = pointer.getLongArray(0, 20); + protected void processStatus(IStatus status, WarningMessageCallback warningMessageCallback) + throws SQLException { + if (warningMessageCallback == null) { + throw new NullPointerException("warningMessageCallback is null"); + } boolean debug = log.isDebugEnabled(); final FbExceptionBuilder builder = new FbExceptionBuilder(); + + if (status.getState() == IStatus.STATE_WARNINGS) { + final long[] warningVector = status.getWarnings().getLongArray(0, 20); + processVector(warningVector, debug, builder); + } + + if (status.getState() == IStatus.STATE_ERRORS) { + final long[] errorVector = status.getErrors().getLongArray(0, 20); + processVector(errorVector, debug, builder); + } + + if (!builder.isEmpty()) { + SQLException exception = builder.toFlatSQLException(); + if (exception instanceof SQLWarning) { + warningMessageCallback.processWarning((SQLWarning) exception); + } else { + throw exception; + } + } + } + + private void processVector(long[] errorVector, boolean debug, FbExceptionBuilder builder) { int vectorIndex = 0; processingLoop: - while (vectorIndex < statusVector.length) { - int arg = (int) statusVector[vectorIndex++]; + while (vectorIndex < errorVector.length) { + int arg = (int) errorVector[vectorIndex++]; int errorCode; switch (arg) { case isc_arg_gds: - errorCode = (int) statusVector[vectorIndex++]; + errorCode = (int) errorVector[vectorIndex++]; if (debug) log.debug("readStatusVector arg:isc_arg_gds int: " + errorCode); if (errorCode != 0) { builder.exception(errorCode); } break; case isc_arg_warning: - errorCode = (int) statusVector[vectorIndex++]; + errorCode = (int) errorVector[vectorIndex++]; if (debug) log.debug("readStatusVector arg:isc_arg_warning int: " + errorCode); if (errorCode != 0) { builder.warning(errorCode); @@ -112,7 +137,7 @@ protected void processStatus(IStatus status, WarningMessageCallback messageCallb case isc_arg_interpreted: case isc_arg_string: case isc_arg_sql_state: - long stringPointerAddress = statusVector[vectorIndex++]; + long stringPointerAddress = errorVector[vectorIndex++]; if (stringPointerAddress == 0L) { log.warn("Received NULL pointer address for isc_arg_interpreted, isc_arg_string or isc_arg_sql_state"); break processingLoop; @@ -128,32 +153,28 @@ protected void processStatus(IStatus status, WarningMessageCallback messageCallb } break; case isc_arg_cstring: - int stringLength = (int) statusVector[vectorIndex++]; - long cStringPointerAddress = statusVector[vectorIndex++]; + int stringLength = (int) errorVector[vectorIndex++]; + long cStringPointerAddress = errorVector[vectorIndex++]; Pointer cStringPointer = new Pointer(cStringPointerAddress); byte[] stringData = cStringPointer.getByteArray(0, stringLength); String cStringValue = getEncoding().decodeFromCharset(stringData); builder.messageParameter(cStringValue); break; case isc_arg_number: - int intValue = (int) statusVector[vectorIndex++]; + int intValue = (int) errorVector[vectorIndex++]; if (debug) log.debug("readStatusVector arg:isc_arg_number int: " + intValue); builder.messageParameter(intValue); break; case isc_arg_end: break processingLoop; default: - int e = (int) statusVector[vectorIndex++]; + int e = (int) errorVector[vectorIndex++]; if (debug) log.debug("readStatusVector arg: " + arg + " int: " + e); builder.messageParameter(e); break; } } - if (!builder.isEmpty()) { - SQLException exception = builder.toFlatSQLException(); - throw exception; - } } public final DatatypeCoder createDatatypeCoder() { diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/AbstractNativeOODatabaseFactory.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/AbstractNativeOODatabaseFactory.java index 8c98b6b952..d995518219 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/AbstractNativeOODatabaseFactory.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/AbstractNativeOODatabaseFactory.java @@ -17,14 +17,14 @@ */ public abstract class AbstractNativeOODatabaseFactory implements FbDatabaseFactory { @Override - public FbDatabase connect(IConnectionProperties connectionProperties) throws SQLException { + public IDatabaseImpl connect(IConnectionProperties connectionProperties) throws SQLException { final NativeDatabaseConnection databaseConnection = new NativeDatabaseConnection(getClientLibrary(), filterProperties(connectionProperties)); return databaseConnection.identify(); } @Override - public FbService serviceConnect(IServiceProperties serviceProperties) throws SQLException { + public IServiceImpl serviceConnect(IServiceProperties serviceProperties) throws SQLException { final IServiceConnectionImpl serviceConnection = new IServiceConnectionImpl(getClientLibrary(), filterProperties(serviceProperties)); return serviceConnection.identify(); diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbInterface.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbInterface.java index 87fbe3e40a..f328e07060 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbInterface.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbInterface.java @@ -22,6 +22,8 @@ */ public interface FbInterface extends FbClientLibrary { + boolean FB_UsedInYValve = false; + /** * Original signature : extern "C" IMaster* ISC_EXPORT fb_get_master_interface();
* native declaration : firebird/include/firebird/interface.h:364 @@ -108,23 +110,15 @@ public static interface IPluginSetIntf extends IReferenceCountedIntf public void set(IStatus status, String s); } - public static interface IListElementCallbackIntf extends IReferenceCountedIntf - { - public int VERSION = 3; - - public void callback(String text); - } - public static interface IConfigEntryIntf extends IReferenceCountedIntf { - public int VERSION = 4; + public int VERSION = 3; public String getName(); public String getValue(); public long getIntValue(); public boolean getBoolValue(); public IConfig getSubConfig(IStatus status); - public void getList(IListElementCallback callback); } public static interface IConfigIntf extends IReferenceCountedIntf @@ -145,7 +139,6 @@ public static interface IFirebirdConfIntf extends IReferenceCountedIntf public String asString(int key); public boolean asBoolean(int key); public int getVersion(IStatus status); - public void asList(int key, IListElementCallback callback); } public static interface IPluginConfigIntf extends IReferenceCountedIntf @@ -188,6 +181,7 @@ public static interface IPluginManagerIntf extends IVersionedIntf public static int TYPE_DB_CRYPT = 9; public static int TYPE_KEY_HOLDER = 10; public static int TYPE_REPLICATOR = 11; + public static int TYPE_COUNT = 12; public void registerPluginFactory(int pluginType, String defaultName, IPluginFactory factory); public void registerModule(IPluginModule cleanup); @@ -229,8 +223,7 @@ public static interface IConfigManagerIntf extends IVersionedIntf public static int DIR_GUARD = 15; public static int DIR_PLUGINS = 16; public static int DIR_TZDATA = 17; - public static int DIR_SCHEDULERDB = 18; - public static int DIR_COUNT = 19; + public static int DIR_COUNT = 18; public String getDirectory(int code); public IFirebirdConf getFirebirdConf(); @@ -326,7 +319,9 @@ public static interface IMetadataBuilderIntf extends IReferenceCountedIntf public static interface IResultSetIntf extends IReferenceCountedIntf { - public int VERSION = 4; + public int VERSION = 5; + + public static byte INF_RECORD_COUNT = 10; public int fetchNext(IStatus status, com.sun.jna.Pointer message); public int fetchPrior(IStatus status, com.sun.jna.Pointer message); @@ -340,6 +335,7 @@ public static interface IResultSetIntf extends IReferenceCountedIntf public void deprecatedClose(IStatus status); public void setDelayedOutputFormat(IStatus status, IMessageMetadata format); public void close(IStatus status); + public void getInfo(IStatus status, int itemsLength, byte[] items, int bufferLength, byte[] buffer); } public static interface IStatementIntf extends IReferenceCountedIntf @@ -382,6 +378,7 @@ public static interface IBatchIntf extends IReferenceCountedIntf public int VERSION = 4; public static byte VERSION1 = 1; + public static byte CURRENT_VERSION = IBatchIntf.VERSION1; public static byte TAG_MULTIERROR = 1; public static byte TAG_RECORD_COUNTS = 2; public static byte TAG_BUFFER_BYTES_SIZE = 3; @@ -472,8 +469,8 @@ public static interface IAttachmentIntf extends IReferenceCountedIntf public int getSlice(IStatus status, ITransaction transaction, com.sun.jna.ptr.LongByReference id, int sdlLength, byte[] sdl, int paramLength, byte[] param, int sliceLength, byte[] slice); public void putSlice(IStatus status, ITransaction transaction, com.sun.jna.ptr.LongByReference id, int sdlLength, byte[] sdl, int paramLength, byte[] param, int sliceLength, byte[] slice); public void executeDyn(IStatus status, ITransaction transaction, int length, byte[] dyn); - public IStatement prepare(IStatus status, ITransaction tra, int stmtLength, String sqlStmt, int dialect, int flags); - public ITransaction execute(IStatus status, ITransaction transaction, int stmtLength, String sqlStmt, int dialect, IMessageMetadata inMetadata, com.sun.jna.Pointer inBuffer, IMessageMetadata outMetadata, com.sun.jna.Pointer outBuffer); + public IStatement prepare(IStatus status, ITransaction tra, int stmtLength, byte[] sqlStmt, int dialect, int flags); + public ITransaction execute(IStatus status, ITransaction transaction, int stmtLength, byte[] sqlStmt, int dialect, IMessageMetadata inMetadata, com.sun.jna.Pointer inBuffer, IMessageMetadata outMetadata, com.sun.jna.Pointer outBuffer); public IResultSet openCursor(IStatus status, ITransaction transaction, int stmtLength, String sqlStmt, int dialect, IMessageMetadata inMetadata, com.sun.jna.Pointer inBuffer, IMessageMetadata outMetadata, String cursorName, int cursorFlags); public IEvents queEvents(IStatus status, IEventCallback callback, int length, byte[] events); public void cancelOperation(IStatus status, int option); @@ -484,7 +481,7 @@ public static interface IAttachmentIntf extends IReferenceCountedIntf public void setIdleTimeout(IStatus status, int timeOut); public int getStatementTimeout(IStatus status); public void setStatementTimeout(IStatus status, int timeOut); - public IBatch createBatch(IStatus status, ITransaction transaction, int stmtLength, String sqlStmt, int dialect, IMessageMetadata inMetadata, int parLength, byte[] par); + public IBatch createBatch(IStatus status, ITransaction transaction, int stmtLength, byte[] sqlStmt, int dialect, IMessageMetadata inMetadata, int parLength, byte[] par); public IReplicator createReplicator(IStatus status); public void detach(IStatus status); public void dropDatabase(IStatus status); @@ -492,12 +489,13 @@ public static interface IAttachmentIntf extends IReferenceCountedIntf public static interface IServiceIntf extends IReferenceCountedIntf { - public int VERSION = 4; + public int VERSION = 5; public void deprecatedDetach(IStatus status); public void query(IStatus status, int sendLength, byte[] sendItems, int receiveLength, byte[] receiveItems, int bufferLength, byte[] buffer); public void start(IStatus status, int spbLength, byte[] spb); public void detach(IStatus status); + public void cancel(IStatus status); } public static interface IProviderIntf extends IPluginBaseIntf @@ -547,7 +545,6 @@ public static interface IWriterIntf extends IVersionedIntf public void add(IStatus status, String name); public void setType(IStatus status, String value); public void setDb(IStatus status, String value); - public void changeLogin(IStatus status, String login); } public static interface IServerBlockIntf extends IVersionedIntf @@ -562,7 +559,7 @@ public static interface IServerBlockIntf extends IVersionedIntf public static interface IClientBlockIntf extends IReferenceCountedIntf { - public int VERSION = 6; + public int VERSION = 4; public String getLogin(); public String getPassword(); @@ -766,7 +763,7 @@ public static interface IExternalProcedureIntf extends IDisposableIntf public static interface IExternalTriggerIntf extends IDisposableIntf { - public int VERSION = 4; + public int VERSION = 3; public static int TYPE_BEFORE = 1; public static int TYPE_AFTER = 2; @@ -782,8 +779,7 @@ public static interface IExternalTriggerIntf extends IDisposableIntf public static int ACTION_DDL = 9; public void getCharSet(IStatus status, IExternalContext context, com.sun.jna.Pointer name, int nameSize); - public void execute(IStatus status, IExternalContext context, int action, com.sun.jna.Pointer oldMsg, com.sun.jna.Pointer newMsg, com.sun.jna.Pointer oldDbKey, com.sun.jna.Pointer newDbKey); - public boolean getDoNotEvaluateField(IStatus status, int index); + public void execute(IStatus status, IExternalContext context, int action, com.sun.jna.Pointer oldMsg, com.sun.jna.Pointer newMsg); } public static interface IRoutineMetadataIntf extends IVersionedIntf @@ -843,7 +839,7 @@ public static interface IUtilIntf extends IVersionedIntf public void loadBlob(IStatus status, com.sun.jna.ptr.LongByReference blobId, IAttachment att, ITransaction tra, String file, boolean txt); public void dumpBlob(IStatus status, com.sun.jna.ptr.LongByReference blobId, IAttachment att, ITransaction tra, String file, boolean txt); public void getPerfCounters(IStatus status, IAttachment att, String countersSet, long[] counters); - public IAttachment executeCreateDatabase(IStatus status, int stmtLength, String creatDBstatement, int dialect, boolean[] stmtIsCreateDb); + public IAttachment executeCreateDatabase(IStatus status, int stmtLength, byte[] creatDBstatement, int dialect, boolean[] stmtIsCreateDb); public void decodeDate(ISC_DATE date, com.sun.jna.Pointer year, com.sun.jna.Pointer month, com.sun.jna.Pointer day); public void decodeTime(ISC_TIME time, com.sun.jna.Pointer hours, com.sun.jna.Pointer minutes, com.sun.jna.Pointer seconds, com.sun.jna.Pointer fractions); public ISC_DATE encodeDate(int year, int month, int day); @@ -922,7 +918,6 @@ public static interface ITraceConnectionIntf extends IVersionedIntf public String getCharSet(); public String getRemoteProtocol(); public String getRemoteAddress(); - public String getRemoteHwAddress(); public int getRemoteProcessID(); public String getRemoteProcessName(); } @@ -1088,17 +1083,15 @@ public static interface ITraceInitInfoIntf extends IVersionedIntf public String getConfigText(); public int getTraceSessionID(); public String getTraceSessionName(); - public int getTraceSessionFlags(); public String getFirebirdRootDirectory(); public String getDatabaseName(); public ITraceDatabaseConnection getConnection(); - public ITraceServiceConnection getService(); public ITraceLogWriter getLogWriter(); } public static interface ITracePluginIntf extends IReferenceCountedIntf { - public int VERSION = 3; + public int VERSION = 4; public static int RESULT_SUCCESS = 0; public static int RESULT_FAILED = 1; @@ -1109,7 +1102,7 @@ public static interface ITracePluginIntf extends IReferenceCountedIntf public static int SWEEP_STATE_PROGRESS = 4; public String trace_get_error(); - public boolean trace_attach(ITraceDatabaseConnection connection, boolean create_db, int dpb_length, byte[] dpb, int att_result); + public boolean trace_attach(ITraceDatabaseConnection connection, boolean create_db, int att_result); public boolean trace_detach(ITraceDatabaseConnection connection, boolean drop_db); public boolean trace_transaction_start(ITraceDatabaseConnection connection, ITraceTransaction transaction, int tpb_length, byte[] tpb, int tra_result); public boolean trace_transaction_end(ITraceDatabaseConnection connection, ITraceTransaction transaction, boolean commit, boolean retain_context, int tra_result); @@ -1122,14 +1115,14 @@ public static interface ITracePluginIntf extends IReferenceCountedIntf public boolean trace_blr_compile(ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceBLRStatement statement, long time_millis, int req_result); public boolean trace_blr_execute(ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceBLRStatement statement, int req_result); public boolean trace_dyn_execute(ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceDYNRequest request, long time_millis, int req_result); - public boolean trace_service_attach(ITraceServiceConnection service, int spb_length, byte[] spb, int att_result); + public boolean trace_service_attach(ITraceServiceConnection service, int att_result); public boolean trace_service_start(ITraceServiceConnection service, int switches_length, String switches, int start_result); public boolean trace_service_query(ITraceServiceConnection service, int send_item_length, byte[] send_items, int recv_item_length, byte[] recv_items, int query_result); public boolean trace_service_detach(ITraceServiceConnection service, int detach_result); public boolean trace_event_error(ITraceConnection connection, ITraceStatusVector status, String function); public boolean trace_event_sweep(ITraceDatabaseConnection connection, ITraceSweepInfo sweep, int sweep_state); public boolean trace_func_execute(ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceFunction function, boolean started, int func_result); - public boolean trace_privilege_change(ITraceDatabaseConnection connection, ITraceTransaction transaction, String executor, String grantor, boolean is_grant, String object_name, String field_name, String user_name, String privileges, int options, int change_result); + public boolean trace_dsql_restart(ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceSQLStatement statement, int number); } public static interface ITraceFactoryIntf extends IPluginBaseIntf @@ -1156,8 +1149,7 @@ public static interface ITraceFactoryIntf extends IPluginBaseIntf public static int TRACE_EVENT_ERROR = 17; public static int TRACE_EVENT_SWEEP = 18; public static int TRACE_EVENT_FUNC_EXECUTE = 19; - public static int TRACE_EVENT_PRIVILEGE_CHANGE = 20; - public static int TRACE_EVENT_MAX = 21; + public static int TRACE_EVENT_MAX = 20; public long trace_needs(); public ITracePlugin trace_create(IStatus status, ITraceInitInfo init_info); @@ -2422,78 +2414,6 @@ public void set(IStatus status, String s) } } - public static class IListElementCallback extends IReferenceCounted implements IListElementCallbackIntf - { - public static class VTable extends IReferenceCounted.VTable - { - public static interface Callback_callback extends com.sun.jna.Callback - { - public void invoke(IListElementCallback self, String text); - } - - public VTable(com.sun.jna.Pointer pointer) - { - super(pointer); - } - - public VTable(final IListElementCallbackIntf obj) - { - super(obj); - - version = IListElementCallbackIntf.VERSION; - - callback = new Callback_callback() { - @Override - public void invoke(IListElementCallback self, String text) - { - obj.callback(text); - } - }; - } - - public VTable() - { - } - - public Callback_callback callback; - - @Override - protected java.util.List getFieldOrder() - { - java.util.List fields = super.getFieldOrder(); - fields.addAll(java.util.Arrays.asList("callback")); - return fields; - } - } - - public IListElementCallback() - { - } - - public IListElementCallback(final IListElementCallbackIntf obj) - { - vTable = new VTable(obj); - vTable.write(); - cloopVTable = vTable.getPointer(); - write(); - } - - @Override - protected VTable createVTable() - { - return new VTable(cloopVTable); - } - - public void callback(String text) - { - VTable vTable = getVTable(); - if (vTable.callback == null) { - return; - } - vTable.callback.invoke(this, text); - } - } - public static class IConfigEntry extends IReferenceCounted implements IConfigEntryIntf { public static class VTable extends IReferenceCounted.VTable @@ -2523,11 +2443,6 @@ public static interface Callback_getSubConfig extends com.sun.jna.Callback public IConfig invoke(IConfigEntry self, IStatus status); } - public static interface Callback_getList extends com.sun.jna.Callback - { - public void invoke(IConfigEntry self, IListElementCallback callback); - } - public VTable(com.sun.jna.Pointer pointer) { super(pointer); @@ -2586,14 +2501,6 @@ public IConfig invoke(IConfigEntry self, IStatus status) } } }; - - getList = new Callback_getList() { - @Override - public void invoke(IConfigEntry self, IListElementCallback callback) - { - obj.getList(callback); - } - }; } public VTable() @@ -2605,13 +2512,12 @@ public VTable() public Callback_getIntValue getIntValue; public Callback_getBoolValue getBoolValue; public Callback_getSubConfig getSubConfig; - public Callback_getList getList; @Override protected java.util.List getFieldOrder() { java.util.List fields = super.getFieldOrder(); - fields.addAll(java.util.Arrays.asList("getName", "getValue", "getIntValue", "getBoolValue", "getSubConfig", "getList")); + fields.addAll(java.util.Arrays.asList("getName", "getValue", "getIntValue", "getBoolValue", "getSubConfig")); return fields; } } @@ -2684,15 +2590,6 @@ public IConfig getSubConfig(IStatus status) IConfig result = vTable.getSubConfig.invoke(this, status); return result; } - - public void getList(IListElementCallback callback) - { - VTable vTable = getVTable(); - if (vTable.getList == null) { - return; - } - vTable.getList.invoke(this, callback); - } } public static class IConfig extends IReferenceCounted implements IConfigIntf @@ -2872,11 +2769,6 @@ public static interface Callback_getVersion extends com.sun.jna.Callback public int invoke(IFirebirdConf self, IStatus status); } - public static interface Callback_asList extends com.sun.jna.Callback - { - public void invoke(IFirebirdConf self, int key, IListElementCallback callback); - } - public VTable(com.sun.jna.Pointer pointer) { super(pointer); @@ -2935,14 +2827,6 @@ public int invoke(IFirebirdConf self, IStatus status) } } }; - - asList = new Callback_asList() { - @Override - public void invoke(IFirebirdConf self, int key, IListElementCallback callback) - { - obj.asList(key, callback); - } - }; } public VTable() @@ -2954,13 +2838,12 @@ public VTable() public Callback_asString asString; public Callback_asBoolean asBoolean; public Callback_getVersion getVersion; - public Callback_asList asList; @Override protected java.util.List getFieldOrder() { java.util.List fields = super.getFieldOrder(); - fields.addAll(java.util.Arrays.asList("getKey", "asInteger", "asString", "asBoolean", "getVersion", "asList")); + fields.addAll(java.util.Arrays.asList("getKey", "asInteger", "asString", "asBoolean", "getVersion")); return fields; } } @@ -3026,6 +2909,11 @@ public boolean asBoolean(int key) public int getVersion(IStatus status) { VTable vTable = getVTable(); + if (vTable.version < 4) + { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IFirebirdConfIntf.VERSION); + return 0; + } if (vTable.getVersion == null) { FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IFirebirdConfIntf.VERSION); return 0; @@ -3033,15 +2921,6 @@ public int getVersion(IStatus status) int result = vTable.getVersion.invoke(this, status); return result; } - - public void asList(int key, IListElementCallback callback) - { - VTable vTable = getVTable(); - if (vTable.asList == null) { - return; - } - vTable.asList.invoke(this, key, callback); - } } public static class IPluginConfig extends IReferenceCounted implements IPluginConfigIntf @@ -4329,6 +4208,15 @@ public int seek(IStatus status, int mode, int offset) public void cancel(IStatus status) { VTable vTable = getVTable(); + if (vTable.version < 4) + { + if (FB_UsedInYValve) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IBlobIntf.VERSION); + } else { + deprecatedCancel(status); + } + return; + } if (vTable.cancel == null) { FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IBlobIntf.VERSION); return; @@ -4339,6 +4227,15 @@ public void cancel(IStatus status) public void close(IStatus status) { VTable vTable = getVTable(); + if (vTable.version < 4) + { + if (FB_UsedInYValve) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IBlobIntf.VERSION); + } else { + deprecatedClose(status); + } + return; + } if (vTable.close == null) { FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IBlobIntf.VERSION); return; @@ -4777,6 +4674,15 @@ public ITransaction enterDtc(IStatus status) public void commit(IStatus status) { VTable vTable = getVTable(); + if (vTable.version < 4) + { + if (FB_UsedInYValve) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, ITransactionIntf.VERSION); + } else { + deprecatedCommit(status); + } + return; + } if (vTable.commit == null) { FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, ITransactionIntf.VERSION); return; @@ -4787,6 +4693,15 @@ public void commit(IStatus status) public void rollback(IStatus status) { VTable vTable = getVTable(); + if (vTable.version < 4) + { + if (FB_UsedInYValve) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, ITransactionIntf.VERSION); + } else { + deprecatedRollback(status); + } + return; + } if (vTable.rollback == null) { FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, ITransactionIntf.VERSION); return; @@ -4797,6 +4712,15 @@ public void rollback(IStatus status) public void disconnect(IStatus status) { VTable vTable = getVTable(); + if (vTable.version < 4) + { + if (FB_UsedInYValve) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, ITransactionIntf.VERSION); + } else { + deprecatedDisconnect(status); + } + return; + } if (vTable.disconnect == null) { FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, ITransactionIntf.VERSION); return; @@ -5395,6 +5319,11 @@ public int getMessageLength(IStatus status) public int getAlignment(IStatus status) { VTable vTable = getVTable(); + if (vTable.version < 4) + { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IMessageMetadataIntf.VERSION); + return 0; + } if (vTable.getAlignment == null) { FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IMessageMetadataIntf.VERSION); return 0; @@ -5406,6 +5335,11 @@ public int getAlignment(IStatus status) public int getAlignedLength(IStatus status) { VTable vTable = getVTable(); + if (vTable.version < 4) + { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IMessageMetadataIntf.VERSION); + return 0; + } if (vTable.getAlignedLength == null) { FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IMessageMetadataIntf.VERSION); return 0; @@ -5864,6 +5798,11 @@ public IMessageMetadata getMetadata(IStatus status) public void setField(IStatus status, int index, String field) { VTable vTable = getVTable(); + if (vTable.version < 4) + { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IMetadataBuilderIntf.VERSION); + return; + } if (vTable.setField == null) { FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IMetadataBuilderIntf.VERSION); return; @@ -5874,6 +5813,11 @@ public void setField(IStatus status, int index, String field) public void setRelation(IStatus status, int index, String relation) { VTable vTable = getVTable(); + if (vTable.version < 4) + { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IMetadataBuilderIntf.VERSION); + return; + } if (vTable.setRelation == null) { FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IMetadataBuilderIntf.VERSION); return; @@ -5884,6 +5828,11 @@ public void setRelation(IStatus status, int index, String relation) public void setOwner(IStatus status, int index, String owner) { VTable vTable = getVTable(); + if (vTable.version < 4) + { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IMetadataBuilderIntf.VERSION); + return; + } if (vTable.setOwner == null) { FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IMetadataBuilderIntf.VERSION); return; @@ -5894,6 +5843,11 @@ public void setOwner(IStatus status, int index, String owner) public void setAlias(IStatus status, int index, String alias) { VTable vTable = getVTable(); + if (vTable.version < 4) + { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IMetadataBuilderIntf.VERSION); + return; + } if (vTable.setAlias == null) { FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IMetadataBuilderIntf.VERSION); return; @@ -5966,6 +5920,11 @@ public static interface Callback_close extends com.sun.jna.Callback public void invoke(IResultSet self, IStatus status); } + public static interface Callback_getInfo extends com.sun.jna.Callback + { + public void invoke(IResultSet self, IStatus status, int itemsLength, byte[] items, int bufferLength, byte[] buffer); + } + public VTable(com.sun.jna.Pointer pointer) { super(pointer); @@ -6165,6 +6124,21 @@ public void invoke(IResultSet self, IStatus status) } } }; + + getInfo = new Callback_getInfo() { + @Override + public void invoke(IResultSet self, IStatus status, int itemsLength, byte[] items, int bufferLength, byte[] buffer) + { + try + { + obj.getInfo(status, itemsLength, items, bufferLength, buffer); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; } public VTable() @@ -6183,12 +6157,13 @@ public VTable() public Callback_deprecatedClose deprecatedClose; public Callback_setDelayedOutputFormat setDelayedOutputFormat; public Callback_close close; + public Callback_getInfo getInfo; @Override protected java.util.List getFieldOrder() { java.util.List fields = super.getFieldOrder(); - fields.addAll(java.util.Arrays.asList("fetchNext", "fetchPrior", "fetchFirst", "fetchLast", "fetchAbsolute", "fetchRelative", "isEof", "isBof", "getMetadata", "deprecatedClose", "setDelayedOutputFormat", "close")); + fields.addAll(java.util.Arrays.asList("fetchNext", "fetchPrior", "fetchFirst", "fetchLast", "fetchAbsolute", "fetchRelative", "isEof", "isBof", "getMetadata", "deprecatedClose", "setDelayedOutputFormat", "close", "getInfo")); return fields; } } @@ -6333,12 +6308,36 @@ public void setDelayedOutputFormat(IStatus status, IMessageMetadata format) public void close(IStatus status) { VTable vTable = getVTable(); + if (vTable.version < 4) + { + if (FB_UsedInYValve) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IResultSetIntf.VERSION); + } else { + deprecatedClose(status); + } + return; + } if (vTable.close == null) { FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IResultSetIntf.VERSION); return; } vTable.close.invoke(this, status); } + + public void getInfo(IStatus status, int itemsLength, byte[] items, int bufferLength, byte[] buffer) + { + VTable vTable = getVTable(); + if (vTable.version < 5) + { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IResultSetIntf.VERSION); + return; + } + if (vTable.getInfo == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IResultSetIntf.VERSION); + return; + } + vTable.getInfo.invoke(this, status, itemsLength, items, bufferLength, buffer); + } } public static class IStatement extends IReferenceCounted implements IStatementIntf @@ -6835,6 +6834,11 @@ public int getFlags(IStatus status) public int getTimeout(IStatus status) { VTable vTable = getVTable(); + if (vTable.version < 4) + { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IStatementIntf.VERSION); + return 0; + } if (vTable.getTimeout == null) { FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IStatementIntf.VERSION); return 0; @@ -6846,6 +6850,11 @@ public int getTimeout(IStatus status) public void setTimeout(IStatus status, int timeOut) { VTable vTable = getVTable(); + if (vTable.version < 4) + { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IStatementIntf.VERSION); + return; + } if (vTable.setTimeout == null) { FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IStatementIntf.VERSION); return; @@ -6856,6 +6865,11 @@ public void setTimeout(IStatus status, int timeOut) public IBatch createBatch(IStatus status, IMessageMetadata inMetadata, int parLength, byte[] par) { VTable vTable = getVTable(); + if (vTable.version < 4) + { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IStatementIntf.VERSION); + return null; + } if (vTable.createBatch == null) { FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IStatementIntf.VERSION); return null; @@ -6867,6 +6881,15 @@ public IBatch createBatch(IStatus status, IMessageMetadata inMetadata, int parLe public void free(IStatus status) { VTable vTable = getVTable(); + if (vTable.version < 5) + { + if (FB_UsedInYValve) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IStatementIntf.VERSION); + } else { + deprecatedFree(status); + } + return; + } if (vTable.free == null) { FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IStatementIntf.VERSION); return; @@ -7315,6 +7338,15 @@ public void deprecatedClose(IStatus status) public void close(IStatus status) { VTable vTable = getVTable(); + if (vTable.version < 4) + { + if (FB_UsedInYValve) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IBatchIntf.VERSION); + } else { + deprecatedClose(status); + } + return; + } if (vTable.close == null) { FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IBatchIntf.VERSION); return; @@ -7325,6 +7357,11 @@ public void close(IStatus status) public void getInfo(IStatus status, int itemsLength, byte[] items, int bufferLength, byte[] buffer) { VTable vTable = getVTable(); + if (vTable.version < 4) + { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IBatchIntf.VERSION); + return; + } if (vTable.getInfo == null) { FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IBatchIntf.VERSION); return; @@ -7646,6 +7683,15 @@ public void deprecatedClose(IStatus status) public void close(IStatus status) { VTable vTable = getVTable(); + if (vTable.version < 4) + { + if (FB_UsedInYValve) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IReplicatorIntf.VERSION); + } else { + deprecatedClose(status); + } + return; + } if (vTable.close == null) { FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IReplicatorIntf.VERSION); return; @@ -7943,6 +7989,15 @@ public void deprecatedFree(IStatus status) public void free(IStatus status) { VTable vTable = getVTable(); + if (vTable.version < 4) + { + if (FB_UsedInYValve) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IRequestIntf.VERSION); + } else { + deprecatedFree(status); + } + return; + } if (vTable.free == null) { FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IRequestIntf.VERSION); return; @@ -8054,6 +8109,15 @@ public void deprecatedCancel(IStatus status) public void cancel(IStatus status) { VTable vTable = getVTable(); + if (vTable.version < 4) + { + if (FB_UsedInYValve) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IEventsIntf.VERSION); + } else { + deprecatedCancel(status); + } + return; + } if (vTable.cancel == null) { FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IEventsIntf.VERSION); return; @@ -8118,12 +8182,12 @@ public static interface Callback_executeDyn extends com.sun.jna.Callback public static interface Callback_prepare extends com.sun.jna.Callback { - public IStatement invoke(IAttachment self, IStatus status, ITransaction tra, int stmtLength, String sqlStmt, int dialect, int flags); + public IStatement invoke(IAttachment self, IStatus status, ITransaction tra, int stmtLength, byte[] sqlStmt, int dialect, int flags); } public static interface Callback_execute extends com.sun.jna.Callback { - public ITransaction invoke(IAttachment self, IStatus status, ITransaction transaction, int stmtLength, String sqlStmt, int dialect, IMessageMetadata inMetadata, com.sun.jna.Pointer inBuffer, IMessageMetadata outMetadata, com.sun.jna.Pointer outBuffer); + public ITransaction invoke(IAttachment self, IStatus status, ITransaction transaction, int stmtLength, byte[] sqlStmt, int dialect, IMessageMetadata inMetadata, com.sun.jna.Pointer inBuffer, IMessageMetadata outMetadata, com.sun.jna.Pointer outBuffer); } public static interface Callback_openCursor extends com.sun.jna.Callback @@ -8178,7 +8242,7 @@ public static interface Callback_setStatementTimeout extends com.sun.jna.Callbac public static interface Callback_createBatch extends com.sun.jna.Callback { - public IBatch invoke(IAttachment self, IStatus status, ITransaction transaction, int stmtLength, String sqlStmt, int dialect, IMessageMetadata inMetadata, int parLength, byte[] par); + public IBatch invoke(IAttachment self, IStatus status, ITransaction transaction, int stmtLength, byte[] sqlStmt, int dialect, IMessageMetadata inMetadata, int parLength, byte[] par); } public static interface Callback_createReplicator extends com.sun.jna.Callback @@ -8365,7 +8429,7 @@ public void invoke(IAttachment self, IStatus status, ITransaction transaction, i prepare = new Callback_prepare() { @Override - public IStatement invoke(IAttachment self, IStatus status, ITransaction tra, int stmtLength, String sqlStmt, int dialect, int flags) + public IStatement invoke(IAttachment self, IStatus status, ITransaction tra, int stmtLength, byte[] sqlStmt, int dialect, int flags) { try { @@ -8381,7 +8445,7 @@ public IStatement invoke(IAttachment self, IStatus status, ITransaction tra, int execute = new Callback_execute() { @Override - public ITransaction invoke(IAttachment self, IStatus status, ITransaction transaction, int stmtLength, String sqlStmt, int dialect, IMessageMetadata inMetadata, com.sun.jna.Pointer inBuffer, IMessageMetadata outMetadata, com.sun.jna.Pointer outBuffer) + public ITransaction invoke(IAttachment self, IStatus status, ITransaction transaction, int stmtLength, byte[] sqlStmt, int dialect, IMessageMetadata inMetadata, com.sun.jna.Pointer inBuffer, IMessageMetadata outMetadata, com.sun.jna.Pointer outBuffer) { try { @@ -8551,7 +8615,7 @@ public void invoke(IAttachment self, IStatus status, int timeOut) createBatch = new Callback_createBatch() { @Override - public IBatch invoke(IAttachment self, IStatus status, ITransaction transaction, int stmtLength, String sqlStmt, int dialect, IMessageMetadata inMetadata, int parLength, byte[] par) + public IBatch invoke(IAttachment self, IStatus status, ITransaction transaction, int stmtLength, byte[] sqlStmt, int dialect, IMessageMetadata inMetadata, int parLength, byte[] par) { try { @@ -8776,7 +8840,7 @@ public void executeDyn(IStatus status, ITransaction transaction, int length, byt vTable.executeDyn.invoke(this, status, transaction, length, dyn); } - public IStatement prepare(IStatus status, ITransaction tra, int stmtLength, String sqlStmt, int dialect, int flags) + public IStatement prepare(IStatus status, ITransaction tra, int stmtLength, byte[] sqlStmt, int dialect, int flags) { VTable vTable = getVTable(); if (vTable.prepare == null) { @@ -8787,7 +8851,7 @@ public IStatement prepare(IStatus status, ITransaction tra, int stmtLength, Stri return result; } - public ITransaction execute(IStatus status, ITransaction transaction, int stmtLength, String sqlStmt, int dialect, IMessageMetadata inMetadata, com.sun.jna.Pointer inBuffer, IMessageMetadata outMetadata, com.sun.jna.Pointer outBuffer) + public ITransaction execute(IStatus status, ITransaction transaction, int stmtLength, byte[] sqlStmt, int dialect, IMessageMetadata inMetadata, com.sun.jna.Pointer inBuffer, IMessageMetadata outMetadata, com.sun.jna.Pointer outBuffer) { VTable vTable = getVTable(); if (vTable.execute == null) { @@ -8863,6 +8927,11 @@ public void deprecatedDropDatabase(IStatus status) public int getIdleTimeout(IStatus status) { VTable vTable = getVTable(); + if (vTable.version < 4) + { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IAttachmentIntf.VERSION); + return 0; + } if (vTable.getIdleTimeout == null) { FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IAttachmentIntf.VERSION); return 0; @@ -8874,6 +8943,11 @@ public int getIdleTimeout(IStatus status) public void setIdleTimeout(IStatus status, int timeOut) { VTable vTable = getVTable(); + if (vTable.version < 4) + { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IAttachmentIntf.VERSION); + return; + } if (vTable.setIdleTimeout == null) { FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IAttachmentIntf.VERSION); return; @@ -8884,6 +8958,11 @@ public void setIdleTimeout(IStatus status, int timeOut) public int getStatementTimeout(IStatus status) { VTable vTable = getVTable(); + if (vTable.version < 4) + { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IAttachmentIntf.VERSION); + return 0; + } if (vTable.getStatementTimeout == null) { FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IAttachmentIntf.VERSION); return 0; @@ -8895,6 +8974,11 @@ public int getStatementTimeout(IStatus status) public void setStatementTimeout(IStatus status, int timeOut) { VTable vTable = getVTable(); + if (vTable.version < 4) + { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IAttachmentIntf.VERSION); + return; + } if (vTable.setStatementTimeout == null) { FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IAttachmentIntf.VERSION); return; @@ -8902,9 +8986,14 @@ public void setStatementTimeout(IStatus status, int timeOut) vTable.setStatementTimeout.invoke(this, status, timeOut); } - public IBatch createBatch(IStatus status, ITransaction transaction, int stmtLength, String sqlStmt, int dialect, IMessageMetadata inMetadata, int parLength, byte[] par) + public IBatch createBatch(IStatus status, ITransaction transaction, int stmtLength, byte[] sqlStmt, int dialect, IMessageMetadata inMetadata, int parLength, byte[] par) { VTable vTable = getVTable(); + if (vTable.version < 4) + { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IAttachmentIntf.VERSION); + return null; + } if (vTable.createBatch == null) { FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IAttachmentIntf.VERSION); return null; @@ -8916,6 +9005,11 @@ public IBatch createBatch(IStatus status, ITransaction transaction, int stmtLeng public IReplicator createReplicator(IStatus status) { VTable vTable = getVTable(); + if (vTable.version < 4) + { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IAttachmentIntf.VERSION); + return null; + } if (vTable.createReplicator == null) { FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IAttachmentIntf.VERSION); return null; @@ -8927,6 +9021,15 @@ public IReplicator createReplicator(IStatus status) public void detach(IStatus status) { VTable vTable = getVTable(); + if (vTable.version < 5) + { + if (FB_UsedInYValve) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IAttachmentIntf.VERSION); + } else { + deprecatedDetach(status); + } + return; + } if (vTable.detach == null) { FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IAttachmentIntf.VERSION); return; @@ -8937,6 +9040,15 @@ public void detach(IStatus status) public void dropDatabase(IStatus status) { VTable vTable = getVTable(); + if (vTable.version < 5) + { + if (FB_UsedInYValve) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IAttachmentIntf.VERSION); + } else { + deprecatedDropDatabase(status); + } + return; + } if (vTable.dropDatabase == null) { FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IAttachmentIntf.VERSION); return; @@ -8969,6 +9081,11 @@ public static interface Callback_detach extends com.sun.jna.Callback public void invoke(IService self, IStatus status); } + public static interface Callback_cancel extends com.sun.jna.Callback + { + public void invoke(IService self, IStatus status); + } + public VTable(com.sun.jna.Pointer pointer) { super(pointer); @@ -9039,6 +9156,21 @@ public void invoke(IService self, IStatus status) } } }; + + cancel = new Callback_cancel() { + @Override + public void invoke(IService self, IStatus status) + { + try + { + obj.cancel(status); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; } public VTable() @@ -9049,12 +9181,13 @@ public VTable() public Callback_query query; public Callback_start start; public Callback_detach detach; + public Callback_cancel cancel; @Override protected java.util.List getFieldOrder() { java.util.List fields = super.getFieldOrder(); - fields.addAll(java.util.Arrays.asList("deprecatedDetach", "query", "start", "detach")); + fields.addAll(java.util.Arrays.asList("deprecatedDetach", "query", "start", "detach", "cancel")); return fields; } } @@ -9110,12 +9243,36 @@ public void start(IStatus status, int spbLength, byte[] spb) public void detach(IStatus status) { VTable vTable = getVTable(); + if (vTable.version < 4) + { + if (FB_UsedInYValve) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IServiceIntf.VERSION); + } else { + deprecatedDetach(status); + } + return; + } if (vTable.detach == null) { FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IServiceIntf.VERSION); return; } vTable.detach.invoke(this, status); } + + public void cancel(IStatus status) + { + VTable vTable = getVTable(); + if (vTable.version < 5) + { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IServiceIntf.VERSION); + return; + } + if (vTable.cancel == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IServiceIntf.VERSION); + return; + } + vTable.cancel.invoke(this, status); + } } public static class IProvider extends IPluginBase implements IProviderIntf @@ -9659,11 +9816,6 @@ public static interface Callback_setDb extends com.sun.jna.Callback public void invoke(IWriter self, IStatus status, String value); } - public static interface Callback_changeLogin extends com.sun.jna.Callback - { - public void invoke(IWriter self, IStatus status, String login); - } - public VTable(com.sun.jna.Pointer pointer) { super(pointer); @@ -9727,21 +9879,6 @@ public void invoke(IWriter self, IStatus status, String value) } } }; - - changeLogin = new Callback_changeLogin() { - @Override - public void invoke(IWriter self, IStatus status, String login) - { - try - { - obj.changeLogin(status, login); - } - catch (Throwable t) - { - FbInterfaceException.catchException(status, t); - } - } - }; } public VTable() @@ -9752,13 +9889,12 @@ public VTable() public Callback_add add; public Callback_setType setType; public Callback_setDb setDb; - public Callback_changeLogin changeLogin; @Override protected java.util.List getFieldOrder() { java.util.List fields = super.getFieldOrder(); - fields.addAll(java.util.Arrays.asList("reset", "add", "setType", "setDb", "changeLogin")); + fields.addAll(java.util.Arrays.asList("reset", "add", "setType", "setDb")); return fields; } } @@ -9819,16 +9955,6 @@ public void setDb(IStatus status, String value) } vTable.setDb.invoke(this, status, value); } - - public void changeLogin(IStatus status, String login) - { - VTable vTable = getVTable(); - if (vTable.changeLogin == null) { - FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IWriterIntf.VERSION); - return; - } - vTable.changeLogin.invoke(this, status, login); - } } public static class IServerBlock extends IVersioned implements IServerBlockIntf @@ -10201,6 +10327,11 @@ public ICryptKey newKey(IStatus status) public IAuthBlock getAuthBlock(IStatus status) { VTable vTable = getVTable(); + if (vTable.version < 4) + { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IClientBlockIntf.VERSION); + return null; + } if (vTable.getAuthBlock == null) { FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IClientBlockIntf.VERSION); return null; @@ -10315,6 +10446,11 @@ public int authenticate(IStatus status, IServerBlock sBlock, IWriter writerInter public void setDbCryptCallback(IStatus status, ICryptKeyCallback cryptCallback) { VTable vTable = getVTable(); + if (vTable.version < 6) + { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IServerIntf.VERSION); + return; + } if (vTable.setDbCryptCallback == null) { FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IServerIntf.VERSION); return; @@ -11356,6 +11492,11 @@ public com.sun.jna.Pointer authBlock(com.sun.jna.Pointer length) public IAttachment attachment(IStatus status) { VTable vTable = getVTable(); + if (vTable.version < 3) + { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, ILogonInfoIntf.VERSION); + return null; + } if (vTable.attachment == null) { FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, ILogonInfoIntf.VERSION); return null; @@ -11367,6 +11508,11 @@ public IAttachment attachment(IStatus status) public ITransaction transaction(IStatus status) { VTable vTable = getVTable(); + if (vTable.version < 3) + { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, ILogonInfoIntf.VERSION); + return null; + } if (vTable.transaction == null) { FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, ILogonInfoIntf.VERSION); return null; @@ -12006,6 +12152,11 @@ public void decrypt(IStatus status, int length, com.sun.jna.Pointer from, com.su public com.sun.jna.Pointer getSpecificData(IStatus status, String keyType, com.sun.jna.Pointer length) { VTable vTable = getVTable(); + if (vTable.version < 5) + { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IWireCryptPluginIntf.VERSION); + return null; + } if (vTable.getSpecificData == null) { FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IWireCryptPluginIntf.VERSION); return null; @@ -12017,6 +12168,11 @@ public com.sun.jna.Pointer getSpecificData(IStatus status, String keyType, com.s public void setSpecificData(IStatus status, String keyType, int length, byte[] data) { VTable vTable = getVTable(); + if (vTable.version < 5) + { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IWireCryptPluginIntf.VERSION); + return; + } if (vTable.setSpecificData == null) { FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IWireCryptPluginIntf.VERSION); return; @@ -12259,6 +12415,11 @@ public ICryptKeyCallback keyHandle(IStatus status, String keyName) public boolean useOnlyOwnKeys(IStatus status) { VTable vTable = getVTable(); + if (vTable.version < 5) + { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IKeyHolderPluginIntf.VERSION); + return false; + } if (vTable.useOnlyOwnKeys == null) { FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IKeyHolderPluginIntf.VERSION); return false; @@ -12270,6 +12431,11 @@ public boolean useOnlyOwnKeys(IStatus status) public ICryptKeyCallback chainHandle(IStatus status) { VTable vTable = getVTable(); + if (vTable.version < 5) + { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IKeyHolderPluginIntf.VERSION); + return null; + } if (vTable.chainHandle == null) { FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IKeyHolderPluginIntf.VERSION); return null; @@ -12526,6 +12692,11 @@ public void decrypt(IStatus status, int length, com.sun.jna.Pointer from, com.su public void setInfo(IStatus status, IDbCryptInfo info) { VTable vTable = getVTable(); + if (vTable.version < 5) + { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IDbCryptPluginIntf.VERSION); + return; + } if (vTable.setInfo == null) { FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IDbCryptPluginIntf.VERSION); return; @@ -13167,12 +13338,7 @@ public static interface Callback_getCharSet extends com.sun.jna.Callback public static interface Callback_execute extends com.sun.jna.Callback { - public void invoke(IExternalTrigger self, IStatus status, IExternalContext context, int action, com.sun.jna.Pointer oldMsg, com.sun.jna.Pointer newMsg, com.sun.jna.Pointer oldDbKey, com.sun.jna.Pointer newDbKey); - } - - public static interface Callback_getDoNotEvaluateField extends com.sun.jna.Callback - { - public boolean invoke(IExternalTrigger self, IStatus status, int index); + public void invoke(IExternalTrigger self, IStatus status, IExternalContext context, int action, com.sun.jna.Pointer oldMsg, com.sun.jna.Pointer newMsg); } public VTable(com.sun.jna.Pointer pointer) @@ -13203,31 +13369,15 @@ public void invoke(IExternalTrigger self, IStatus status, IExternalContext conte execute = new Callback_execute() { @Override - public void invoke(IExternalTrigger self, IStatus status, IExternalContext context, int action, com.sun.jna.Pointer oldMsg, com.sun.jna.Pointer newMsg, com.sun.jna.Pointer oldDbKey, com.sun.jna.Pointer newDbKey) - { - try - { - obj.execute(status, context, action, oldMsg, newMsg, oldDbKey, newDbKey); - } - catch (Throwable t) - { - FbInterfaceException.catchException(status, t); - } - } - }; - - getDoNotEvaluateField = new Callback_getDoNotEvaluateField() { - @Override - public boolean invoke(IExternalTrigger self, IStatus status, int index) + public void invoke(IExternalTrigger self, IStatus status, IExternalContext context, int action, com.sun.jna.Pointer oldMsg, com.sun.jna.Pointer newMsg) { try { - return obj.getDoNotEvaluateField(status, index); + obj.execute(status, context, action, oldMsg, newMsg); } catch (Throwable t) { FbInterfaceException.catchException(status, t); - return false; } } }; @@ -13239,13 +13389,12 @@ public VTable() public Callback_getCharSet getCharSet; public Callback_execute execute; - public Callback_getDoNotEvaluateField getDoNotEvaluateField; @Override protected java.util.List getFieldOrder() { java.util.List fields = super.getFieldOrder(); - fields.addAll(java.util.Arrays.asList("getCharSet", "execute", "getDoNotEvaluateField")); + fields.addAll(java.util.Arrays.asList("getCharSet", "execute")); return fields; } } @@ -13278,25 +13427,14 @@ public void getCharSet(IStatus status, IExternalContext context, com.sun.jna.Poi vTable.getCharSet.invoke(this, status, context, name, nameSize); } - public void execute(IStatus status, IExternalContext context, int action, com.sun.jna.Pointer oldMsg, com.sun.jna.Pointer newMsg, com.sun.jna.Pointer oldDbKey, com.sun.jna.Pointer newDbKey) + public void execute(IStatus status, IExternalContext context, int action, com.sun.jna.Pointer oldMsg, com.sun.jna.Pointer newMsg) { VTable vTable = getVTable(); if (vTable.execute == null) { FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IExternalTriggerIntf.VERSION); return; } - vTable.execute.invoke(this, status, context, action, oldMsg, newMsg, oldDbKey, newDbKey); - } - - public boolean getDoNotEvaluateField(IStatus status, int index) - { - VTable vTable = getVTable(); - if (vTable.getDoNotEvaluateField == null) { - FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IExternalTriggerIntf.VERSION); - return false; - } - boolean result = vTable.getDoNotEvaluateField.invoke(this, status, index); - return result; + vTable.execute.invoke(this, status, context, action, oldMsg, newMsg); } } @@ -14176,7 +14314,7 @@ public static interface Callback_getPerfCounters extends com.sun.jna.Callback public static interface Callback_executeCreateDatabase extends com.sun.jna.Callback { - public IAttachment invoke(IUtil self, IStatus status, int stmtLength, String creatDBstatement, int dialect, boolean[] stmtIsCreateDb); + public IAttachment invoke(IUtil self, IStatus status, int stmtLength, byte[] creatDBstatement, int dialect, boolean[] stmtIsCreateDb); } public static interface Callback_decodeDate extends com.sun.jna.Callback @@ -14337,7 +14475,7 @@ public void invoke(IUtil self, IStatus status, IAttachment att, String countersS executeCreateDatabase = new Callback_executeCreateDatabase() { @Override - public IAttachment invoke(IUtil self, IStatus status, int stmtLength, String creatDBstatement, int dialect, boolean[] stmtIsCreateDb) + public IAttachment invoke(IUtil self, IStatus status, int stmtLength, byte[] creatDBstatement, int dialect, boolean[] stmtIsCreateDb) { try { @@ -14664,7 +14802,7 @@ public void getPerfCounters(IStatus status, IAttachment att, String countersSet, vTable.getPerfCounters.invoke(this, status, att, countersSet, counters); } - public IAttachment executeCreateDatabase(IStatus status, int stmtLength, String creatDBstatement, int dialect, boolean[] stmtIsCreateDb) + public IAttachment executeCreateDatabase(IStatus status, int stmtLength, byte[] creatDBstatement, int dialect, boolean[] stmtIsCreateDb) { VTable vTable = getVTable(); if (vTable.executeCreateDatabase == null) { @@ -14758,6 +14896,11 @@ public int setOffsets(IStatus status, IMessageMetadata metadata, IOffsetsCallbac public IDecFloat16 getDecFloat16(IStatus status) { VTable vTable = getVTable(); + if (vTable.version < 3) + { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IUtilIntf.VERSION); + return null; + } if (vTable.getDecFloat16 == null) { FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IUtilIntf.VERSION); return null; @@ -14769,6 +14912,11 @@ public IDecFloat16 getDecFloat16(IStatus status) public IDecFloat34 getDecFloat34(IStatus status) { VTable vTable = getVTable(); + if (vTable.version < 3) + { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IUtilIntf.VERSION); + return null; + } if (vTable.getDecFloat34 == null) { FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IUtilIntf.VERSION); return null; @@ -14780,6 +14928,11 @@ public IDecFloat34 getDecFloat34(IStatus status) public void decodeTimeTz(IStatus status, ISC_TIME_TZ[] timeTz, com.sun.jna.Pointer hours, com.sun.jna.Pointer minutes, com.sun.jna.Pointer seconds, com.sun.jna.Pointer fractions, int timeZoneBufferLength, com.sun.jna.Pointer timeZoneBuffer) { VTable vTable = getVTable(); + if (vTable.version < 3) + { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IUtilIntf.VERSION); + return; + } if (vTable.decodeTimeTz == null) { FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IUtilIntf.VERSION); return; @@ -14790,6 +14943,11 @@ public void decodeTimeTz(IStatus status, ISC_TIME_TZ[] timeTz, com.sun.jna.Point public void decodeTimeStampTz(IStatus status, ISC_TIMESTAMP_TZ[] timeStampTz, com.sun.jna.Pointer year, com.sun.jna.Pointer month, com.sun.jna.Pointer day, com.sun.jna.Pointer hours, com.sun.jna.Pointer minutes, com.sun.jna.Pointer seconds, com.sun.jna.Pointer fractions, int timeZoneBufferLength, com.sun.jna.Pointer timeZoneBuffer) { VTable vTable = getVTable(); + if (vTable.version < 3) + { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IUtilIntf.VERSION); + return; + } if (vTable.decodeTimeStampTz == null) { FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IUtilIntf.VERSION); return; @@ -14800,6 +14958,11 @@ public void decodeTimeStampTz(IStatus status, ISC_TIMESTAMP_TZ[] timeStampTz, co public void encodeTimeTz(IStatus status, ISC_TIME_TZ[] timeTz, int hours, int minutes, int seconds, int fractions, String timeZone) { VTable vTable = getVTable(); + if (vTable.version < 3) + { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IUtilIntf.VERSION); + return; + } if (vTable.encodeTimeTz == null) { FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IUtilIntf.VERSION); return; @@ -14810,6 +14973,11 @@ public void encodeTimeTz(IStatus status, ISC_TIME_TZ[] timeTz, int hours, int mi public void encodeTimeStampTz(IStatus status, ISC_TIMESTAMP_TZ[] timeStampTz, int year, int month, int day, int hours, int minutes, int seconds, int fractions, String timeZone) { VTable vTable = getVTable(); + if (vTable.version < 3) + { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IUtilIntf.VERSION); + return; + } if (vTable.encodeTimeStampTz == null) { FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IUtilIntf.VERSION); return; @@ -14820,6 +14988,11 @@ public void encodeTimeStampTz(IStatus status, ISC_TIMESTAMP_TZ[] timeStampTz, in public IInt128 getInt128(IStatus status) { VTable vTable = getVTable(); + if (vTable.version < 4) + { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IUtilIntf.VERSION); + return null; + } if (vTable.getInt128 == null) { FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IUtilIntf.VERSION); return null; @@ -14831,6 +15004,11 @@ public IInt128 getInt128(IStatus status) public void decodeTimeTzEx(IStatus status, ISC_TIME_TZ_EX[] timeTz, com.sun.jna.Pointer hours, com.sun.jna.Pointer minutes, com.sun.jna.Pointer seconds, com.sun.jna.Pointer fractions, int timeZoneBufferLength, com.sun.jna.Pointer timeZoneBuffer) { VTable vTable = getVTable(); + if (vTable.version < 4) + { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IUtilIntf.VERSION); + return; + } if (vTable.decodeTimeTzEx == null) { FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IUtilIntf.VERSION); return; @@ -14841,6 +15019,11 @@ public void decodeTimeTzEx(IStatus status, ISC_TIME_TZ_EX[] timeTz, com.sun.jna. public void decodeTimeStampTzEx(IStatus status, ISC_TIMESTAMP_TZ_EX[] timeStampTz, com.sun.jna.Pointer year, com.sun.jna.Pointer month, com.sun.jna.Pointer day, com.sun.jna.Pointer hours, com.sun.jna.Pointer minutes, com.sun.jna.Pointer seconds, com.sun.jna.Pointer fractions, int timeZoneBufferLength, com.sun.jna.Pointer timeZoneBuffer) { VTable vTable = getVTable(); + if (vTable.version < 4) + { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IUtilIntf.VERSION); + return; + } if (vTable.decodeTimeStampTzEx == null) { FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IUtilIntf.VERSION); return; @@ -15659,11 +15842,6 @@ public static interface Callback_getRemoteAddress extends com.sun.jna.Callback public String invoke(ITraceConnection self); } - public static interface Callback_getRemoteHwAddress extends com.sun.jna.Callback - { - public String invoke(ITraceConnection self); - } - public static interface Callback_getRemoteProcessID extends com.sun.jna.Callback { public int invoke(ITraceConnection self); @@ -15741,14 +15919,6 @@ public String invoke(ITraceConnection self) } }; - getRemoteHwAddress = new Callback_getRemoteHwAddress() { - @Override - public String invoke(ITraceConnection self) - { - return obj.getRemoteHwAddress(); - } - }; - getRemoteProcessID = new Callback_getRemoteProcessID() { @Override public int invoke(ITraceConnection self) @@ -15777,7 +15947,6 @@ public VTable() public Callback_getCharSet getCharSet; public Callback_getRemoteProtocol getRemoteProtocol; public Callback_getRemoteAddress getRemoteAddress; - public Callback_getRemoteHwAddress getRemoteHwAddress; public Callback_getRemoteProcessID getRemoteProcessID; public Callback_getRemoteProcessName getRemoteProcessName; @@ -15785,7 +15954,7 @@ public VTable() protected java.util.List getFieldOrder() { java.util.List fields = super.getFieldOrder(); - fields.addAll(java.util.Arrays.asList("getKind", "getProcessID", "getUserName", "getRoleName", "getCharSet", "getRemoteProtocol", "getRemoteAddress", "getRemoteHwAddress", "getRemoteProcessID", "getRemoteProcessName")); + fields.addAll(java.util.Arrays.asList("getKind", "getProcessID", "getUserName", "getRoleName", "getCharSet", "getRemoteProtocol", "getRemoteAddress", "getRemoteProcessID", "getRemoteProcessName")); return fields; } } @@ -15878,16 +16047,6 @@ public String getRemoteAddress() return result; } - public String getRemoteHwAddress() - { - VTable vTable = getVTable(); - if (vTable.getRemoteHwAddress == null) { - return null; - } - String result = vTable.getRemoteHwAddress.invoke(this); - return result; - } - public int getRemoteProcessID() { VTable vTable = getVTable(); @@ -16344,6 +16503,11 @@ public com.sun.jna.Pointer getParam(int idx) public String getTextUTF8(IStatus status, int idx) { VTable vTable = getVTable(); + if (vTable.version < 3) + { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, ITraceParamsIntf.VERSION); + return null; + } if (vTable.getTextUTF8 == null) { FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, ITraceParamsIntf.VERSION); return null; @@ -17949,6 +18113,11 @@ public int write(com.sun.jna.Pointer buf, int size) public int write_s(IStatus status, com.sun.jna.Pointer buf, int size) { VTable vTable = getVTable(); + if (vTable.version < 4) + { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, ITraceLogWriterIntf.VERSION); + return 0; + } if (vTable.write_s == null) { FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, ITraceLogWriterIntf.VERSION); return 0; @@ -17977,11 +18146,6 @@ public static interface Callback_getTraceSessionName extends com.sun.jna.Callbac public String invoke(ITraceInitInfo self); } - public static interface Callback_getTraceSessionFlags extends com.sun.jna.Callback - { - public int invoke(ITraceInitInfo self); - } - public static interface Callback_getFirebirdRootDirectory extends com.sun.jna.Callback { public String invoke(ITraceInitInfo self); @@ -17997,11 +18161,6 @@ public static interface Callback_getConnection extends com.sun.jna.Callback public ITraceDatabaseConnection invoke(ITraceInitInfo self); } - public static interface Callback_getService extends com.sun.jna.Callback - { - public ITraceServiceConnection invoke(ITraceInitInfo self); - } - public static interface Callback_getLogWriter extends com.sun.jna.Callback { public ITraceLogWriter invoke(ITraceInitInfo self); @@ -18042,14 +18201,6 @@ public String invoke(ITraceInitInfo self) } }; - getTraceSessionFlags = new Callback_getTraceSessionFlags() { - @Override - public int invoke(ITraceInitInfo self) - { - return obj.getTraceSessionFlags(); - } - }; - getFirebirdRootDirectory = new Callback_getFirebirdRootDirectory() { @Override public String invoke(ITraceInitInfo self) @@ -18074,14 +18225,6 @@ public ITraceDatabaseConnection invoke(ITraceInitInfo self) } }; - getService = new Callback_getService() { - @Override - public ITraceServiceConnection invoke(ITraceInitInfo self) - { - return obj.getService(); - } - }; - getLogWriter = new Callback_getLogWriter() { @Override public ITraceLogWriter invoke(ITraceInitInfo self) @@ -18098,18 +18241,16 @@ public VTable() public Callback_getConfigText getConfigText; public Callback_getTraceSessionID getTraceSessionID; public Callback_getTraceSessionName getTraceSessionName; - public Callback_getTraceSessionFlags getTraceSessionFlags; public Callback_getFirebirdRootDirectory getFirebirdRootDirectory; public Callback_getDatabaseName getDatabaseName; public Callback_getConnection getConnection; - public Callback_getService getService; public Callback_getLogWriter getLogWriter; @Override protected java.util.List getFieldOrder() { java.util.List fields = super.getFieldOrder(); - fields.addAll(java.util.Arrays.asList("getConfigText", "getTraceSessionID", "getTraceSessionName", "getTraceSessionFlags", "getFirebirdRootDirectory", "getDatabaseName", "getConnection", "getService", "getLogWriter")); + fields.addAll(java.util.Arrays.asList("getConfigText", "getTraceSessionID", "getTraceSessionName", "getFirebirdRootDirectory", "getDatabaseName", "getConnection", "getLogWriter")); return fields; } } @@ -18162,16 +18303,6 @@ public String getTraceSessionName() return result; } - public int getTraceSessionFlags() - { - VTable vTable = getVTable(); - if (vTable.getTraceSessionFlags == null) { - return 0; - } - int result = vTable.getTraceSessionFlags.invoke(this); - return result; - } - public String getFirebirdRootDirectory() { VTable vTable = getVTable(); @@ -18202,16 +18333,6 @@ public ITraceDatabaseConnection getConnection() return result; } - public ITraceServiceConnection getService() - { - VTable vTable = getVTable(); - if (vTable.getService == null) { - return null; - } - ITraceServiceConnection result = vTable.getService.invoke(this); - return result; - } - public ITraceLogWriter getLogWriter() { VTable vTable = getVTable(); @@ -18234,7 +18355,7 @@ public static interface Callback_trace_get_error extends com.sun.jna.Callback public static interface Callback_trace_attach extends com.sun.jna.Callback { - public boolean invoke(ITracePlugin self, ITraceDatabaseConnection connection, boolean create_db, int dpb_length, byte[] dpb, int att_result); + public boolean invoke(ITracePlugin self, ITraceDatabaseConnection connection, boolean create_db, int att_result); } public static interface Callback_trace_detach extends com.sun.jna.Callback @@ -18299,7 +18420,7 @@ public static interface Callback_trace_dyn_execute extends com.sun.jna.Callback public static interface Callback_trace_service_attach extends com.sun.jna.Callback { - public boolean invoke(ITracePlugin self, ITraceServiceConnection service, int spb_length, byte[] spb, int att_result); + public boolean invoke(ITracePlugin self, ITraceServiceConnection service, int att_result); } public static interface Callback_trace_service_start extends com.sun.jna.Callback @@ -18332,9 +18453,9 @@ public static interface Callback_trace_func_execute extends com.sun.jna.Callback public boolean invoke(ITracePlugin self, ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceFunction function, boolean started, int func_result); } - public static interface Callback_trace_privilege_change extends com.sun.jna.Callback + public static interface Callback_trace_dsql_restart extends com.sun.jna.Callback { - public boolean invoke(ITracePlugin self, ITraceDatabaseConnection connection, ITraceTransaction transaction, String executor, String grantor, boolean is_grant, String object_name, String field_name, String user_name, String privileges, int options, int change_result); + public boolean invoke(ITracePlugin self, ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceSQLStatement statement, int number); } public VTable(com.sun.jna.Pointer pointer) @@ -18358,9 +18479,9 @@ public String invoke(ITracePlugin self) trace_attach = new Callback_trace_attach() { @Override - public boolean invoke(ITracePlugin self, ITraceDatabaseConnection connection, boolean create_db, int dpb_length, byte[] dpb, int att_result) + public boolean invoke(ITracePlugin self, ITraceDatabaseConnection connection, boolean create_db, int att_result) { - return obj.trace_attach(connection, create_db, dpb_length, dpb, att_result); + return obj.trace_attach(connection, create_db, att_result); } }; @@ -18462,9 +18583,9 @@ public boolean invoke(ITracePlugin self, ITraceDatabaseConnection connection, IT trace_service_attach = new Callback_trace_service_attach() { @Override - public boolean invoke(ITracePlugin self, ITraceServiceConnection service, int spb_length, byte[] spb, int att_result) + public boolean invoke(ITracePlugin self, ITraceServiceConnection service, int att_result) { - return obj.trace_service_attach(service, spb_length, spb, att_result); + return obj.trace_service_attach(service, att_result); } }; @@ -18516,11 +18637,11 @@ public boolean invoke(ITracePlugin self, ITraceDatabaseConnection connection, IT } }; - trace_privilege_change = new Callback_trace_privilege_change() { + trace_dsql_restart = new Callback_trace_dsql_restart() { @Override - public boolean invoke(ITracePlugin self, ITraceDatabaseConnection connection, ITraceTransaction transaction, String executor, String grantor, boolean is_grant, String object_name, String field_name, String user_name, String privileges, int options, int change_result) + public boolean invoke(ITracePlugin self, ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceSQLStatement statement, int number) { - return obj.trace_privilege_change(connection, transaction, executor, grantor, is_grant, object_name, field_name, user_name, privileges, options, change_result); + return obj.trace_dsql_restart(connection, transaction, statement, number); } }; } @@ -18550,13 +18671,13 @@ public VTable() public Callback_trace_event_error trace_event_error; public Callback_trace_event_sweep trace_event_sweep; public Callback_trace_func_execute trace_func_execute; - public Callback_trace_privilege_change trace_privilege_change; + public Callback_trace_dsql_restart trace_dsql_restart; @Override protected java.util.List getFieldOrder() { java.util.List fields = super.getFieldOrder(); - fields.addAll(java.util.Arrays.asList("trace_get_error", "trace_attach", "trace_detach", "trace_transaction_start", "trace_transaction_end", "trace_proc_execute", "trace_trigger_execute", "trace_set_context", "trace_dsql_prepare", "trace_dsql_free", "trace_dsql_execute", "trace_blr_compile", "trace_blr_execute", "trace_dyn_execute", "trace_service_attach", "trace_service_start", "trace_service_query", "trace_service_detach", "trace_event_error", "trace_event_sweep", "trace_func_execute", "trace_privilege_change")); + fields.addAll(java.util.Arrays.asList("trace_get_error", "trace_attach", "trace_detach", "trace_transaction_start", "trace_transaction_end", "trace_proc_execute", "trace_trigger_execute", "trace_set_context", "trace_dsql_prepare", "trace_dsql_free", "trace_dsql_execute", "trace_blr_compile", "trace_blr_execute", "trace_dyn_execute", "trace_service_attach", "trace_service_start", "trace_service_query", "trace_service_detach", "trace_event_error", "trace_event_sweep", "trace_func_execute", "trace_dsql_restart")); return fields; } } @@ -18589,13 +18710,13 @@ public String trace_get_error() return result; } - public boolean trace_attach(ITraceDatabaseConnection connection, boolean create_db, int dpb_length, byte[] dpb, int att_result) + public boolean trace_attach(ITraceDatabaseConnection connection, boolean create_db, int att_result) { VTable vTable = getVTable(); if (vTable.trace_attach == null) { return false; } - boolean result = vTable.trace_attach.invoke(this, connection, create_db, dpb_length, dpb, att_result); + boolean result = vTable.trace_attach.invoke(this, connection, create_db, att_result); return result; } @@ -18719,13 +18840,13 @@ public boolean trace_dyn_execute(ITraceDatabaseConnection connection, ITraceTran return result; } - public boolean trace_service_attach(ITraceServiceConnection service, int spb_length, byte[] spb, int att_result) + public boolean trace_service_attach(ITraceServiceConnection service, int att_result) { VTable vTable = getVTable(); if (vTable.trace_service_attach == null) { return false; } - boolean result = vTable.trace_service_attach.invoke(this, service, spb_length, spb, att_result); + boolean result = vTable.trace_service_attach.invoke(this, service, att_result); return result; } @@ -18789,13 +18910,13 @@ public boolean trace_func_execute(ITraceDatabaseConnection connection, ITraceTra return result; } - public boolean trace_privilege_change(ITraceDatabaseConnection connection, ITraceTransaction transaction, String executor, String grantor, boolean is_grant, String object_name, String field_name, String user_name, String privileges, int options, int change_result) + public boolean trace_dsql_restart(ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceSQLStatement statement, int number) { VTable vTable = getVTable(); - if (vTable.trace_privilege_change == null) { + if (vTable.trace_dsql_restart == null) { return false; } - boolean result = vTable.trace_privilege_change.invoke(this, connection, transaction, executor, grantor, is_grant, object_name, field_name, user_name, privileges, options, change_result); + boolean result = vTable.trace_dsql_restart.invoke(this, connection, transaction, statement, number); return result; } } diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbInterfaceException.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbInterfaceException.java index c455a00e09..077e6c4b0b 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbInterfaceException.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/FbInterfaceException.java @@ -13,13 +13,14 @@ public static void catchException(FbInterface.IStatus status, Throwable t) { java.io.PrintWriter pw = new java.io.PrintWriter(sw); t.printStackTrace(pw); String msg = sw.toString(); - try (CloseableMemory memory = new CloseableMemory(msg.length() + 1)) { + final int msgLength = msg.getBytes().length + 1; + try (CloseableMemory memory = new CloseableMemory(msgLength)) { memory.setString(0, msg); com.sun.jna.Pointer[] vector = new com.sun.jna.Pointer[]{ new com.sun.jna.Pointer(org.firebirdsql.gds.ISCConstants.isc_arg_gds), new com.sun.jna.Pointer(org.firebirdsql.gds.ISCConstants.isc_random), new com.sun.jna.Pointer(org.firebirdsql.gds.ISCConstants.isc_arg_cstring), - new com.sun.jna.Pointer(msg.length()), + new com.sun.jna.Pointer(msgLength), memory, new com.sun.jna.Pointer(org.firebirdsql.gds.ISCConstants.isc_arg_end) }; diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IBatchImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IBatchImpl.java index a8ce8afbd7..6e3bd13c04 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IBatchImpl.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IBatchImpl.java @@ -89,15 +89,15 @@ private void init() throws SQLException { statement.prepare(statementText); metadata = (IMessageMetadataImpl) statement.getInputMetadata(); } - + final byte[] statementArray = getDatabase().getEncoding().encodeToCharset(statementText); if (parameterBuffer == null) { - batch = attachment.createBatch(getStatus(), ((ITransactionImpl) transaction).getTransaction(), statementText.length(), - statementText, getDatabase().getDatabaseDialect(), + batch = attachment.createBatch(getStatus(), ((ITransactionImpl) transaction).getTransaction(), + statementArray.length, statementArray, getDatabase().getDatabaseDialect(), metadata.getMetadata(), 0, null); } else { - batch = attachment.createBatch(getStatus(), ((ITransactionImpl) transaction).getTransaction(), statementText.length(), - statementText, getDatabase().getDatabaseDialect(), - metadata.getMetadata(), parameterBuffer.toBytesWithType().length, parameterBuffer.toBytesWithType()); + batch = attachment.createBatch(getStatus(), ((ITransactionImpl) transaction).getTransaction(), + statementArray.length, statementArray, getDatabase().getDatabaseDialect(), metadata.getMetadata(), + parameterBuffer.toBytesWithType().length, parameterBuffer.toBytesWithType()); } processStatus(); } diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IDatabaseImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IDatabaseImpl.java index 75684dd208..b012f5ad16 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IDatabaseImpl.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IDatabaseImpl.java @@ -38,6 +38,8 @@ import java.sql.SQLException; import java.sql.SQLNonTransientException; import java.sql.SQLTransientException; +import java.util.HashMap; +import java.util.Map; import static org.firebirdsql.gds.ISCConstants.fb_cancel_abort; import static org.firebirdsql.gds.ng.TransactionHelper.checkTransactionActive; @@ -58,7 +60,7 @@ public class IDatabaseImpl extends AbstractFbDatabase private final IProvider provider; private final IUtil util; protected IAttachment attachment; - private IEvents events; + private final Map events = new HashMap<>(); protected IStatus status; @@ -266,17 +268,16 @@ public void executeImmediate(String statementText, FbTransaction transaction) th .forException(JaybirdErrorCodes.jb_executeImmediateRequiresNoTransactionDetached) .toFlatSQLException(); } - + final byte[] statementArray = getEncoding().encodeToCharset(statementText); synchronized (getSynchronizationObject()) { if (attachment == null) { - attachment = util.executeCreateDatabase(getStatus(), statementText.length(), - statementText, getConnectionDialect(), new boolean[]{false}); + attachment = util.executeCreateDatabase(getStatus(), statementArray.length, statementArray, + getConnectionDialect(), new boolean[]{false}); } else { attachment.execute(getStatus(), transaction != null ? ((ITransactionImpl) transaction).getTransaction() : attachment.startTransaction(getStatus(), 0, null), - statementText.length(), - statementText, getConnectionDialect(), null, null, + statementArray.length, statementArray, getConnectionDialect(), null, null, null, null); } if (!isAttached()) { @@ -316,7 +317,7 @@ protected IEventImpl validateEventHandle(EventHandle eventHandle) throws SQLExce } @Override - public EventHandle createEventHandle(String eventName, EventHandler eventHandler) throws SQLException { + public IEventImpl createEventHandle(String eventName, EventHandler eventHandler) throws SQLException { final IEventImpl eventHandle = new IEventImpl(eventName, eventHandler, getEncoding()); synchronized (getSynchronizationObject()) { synchronized (eventHandle) { @@ -358,9 +359,10 @@ public void queueEvent(EventHandle eventHandle) throws SQLException { synchronized (event) { int length = event.getSize(); byte[] array = event.getEventBuffer().getValue().getByteArray(0, length); - events = attachment.queEvents(getStatus(), event.getCallback(), + IEvents iEvents = attachment.queEvents(getStatus(), event.getCallback(), length, array); + events.put(eventHandle, iEvents); } } } catch (SQLException e) { @@ -378,7 +380,8 @@ public void cancelEvent(EventHandle eventHandle) throws SQLException { synchronized (getSynchronizationObject()) { synchronized (event) { try { - events.cancel(getStatus()); + IEvents iEvents = events.remove(eventHandle); + iEvents.cancel(getStatus()); } finally { event.releaseMemory(); } diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IMetadataBuilderImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IMetadataBuilderImpl.java index 26979b96bd..4286ae2a6f 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IMetadataBuilderImpl.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IMetadataBuilderImpl.java @@ -30,7 +30,7 @@ * Implementation of {@link org.firebirdsql.gds.ng.FbMetadataBuilder} for native OO API. * * @author Vasiliy Yashkov - * @since 4.0 + * @since 5.0 */ public class IMetadataBuilderImpl implements FbMetadataBuilder { diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IParameterConverterImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IParameterConverterImpl.java index f15a9e4170..fd147509f4 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IParameterConverterImpl.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IParameterConverterImpl.java @@ -9,6 +9,12 @@ import java.sql.SQLException; +/** + * Implementation of {@link org.firebirdsql.gds.ng.ParameterConverter} for native OO API. + * + * @author Vasiliy Yashkov + * @since 5.0 + */ public class IParameterConverterImpl extends AbstractParameterConverter { @Override diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IServiceConnectionImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IServiceConnectionImpl.java index f0694cef92..930cc90950 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IServiceConnectionImpl.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IServiceConnectionImpl.java @@ -13,7 +13,7 @@ * Class handling the initial setup of the native service connection. * * @author Vasiliy Yashkov - * @since 4.0 + * @since 5.0 */ public class IServiceConnectionImpl extends AbstractNativeConnection { /** diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IServiceImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IServiceImpl.java index 0702e47b13..9ad8280477 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IServiceImpl.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IServiceImpl.java @@ -24,7 +24,7 @@ * Implementation of {@link FbInterface.IService} for native client access using OO API. * * @author Vasiliy Yashkov - * @since 4.0 + * @since 5.0 */ public class IServiceImpl extends AbstractFbService implements FbAttachment { diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IStatementImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IStatementImpl.java index b4c7a9406d..ec4ff56b1d 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IStatementImpl.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IStatementImpl.java @@ -40,7 +40,7 @@ * Implementation of {@link org.firebirdsql.gds.ng.FbStatement} for native client access using OO API. * * @author Vasiliy Yashkov - * @since 4.0 + * @since 5.0 */ public class IStatementImpl extends AbstractFbStatement { @@ -63,11 +63,15 @@ public IStatementImpl(IDatabaseImpl database) { @Override protected void free(int option) throws SQLException { synchronized (getSynchronizationObject()) { - if (option == ISCConstants.DSQL_close) + if (option == ISCConstants.DSQL_close) { cursor.close(getStatus()); - else if (statement != null) + cursor = null; + processStatus(); + } else if (statement != null) { statement.free(getStatus()); - processStatus(); + statement = null; + processStatus(); + } // Reset statement information reset(option == ISCConstants.DSQL_drop); } @@ -92,12 +96,6 @@ public int getHandle() { public void prepare(String statementText) throws SQLException { try { final byte[] statementArray = getDatabase().getEncoding().encodeToCharset(statementText); - if (statementArray.length > JnaDatabase.MAX_STATEMENT_LENGTH) { - throw FbExceptionBuilder.forException(JaybirdErrorCodes.jb_maxStatementLengthExceeded) - .messageParameter(JnaDatabase.MAX_STATEMENT_LENGTH) - .messageParameter(statementArray.length) - .toFlatSQLException(); - } synchronized (getSynchronizationObject()) { checkTransactionActive(getTransaction()); final StatementState currentState = getState(); @@ -115,8 +113,9 @@ public void prepare(String statementText) throws SQLException { } ITransactionImpl transaction = (ITransactionImpl) getTransaction(); - statement = getDatabase().getAttachment().prepare(getStatus(), transaction.getTransaction(), statementText.length(), statementText, - getDatabase().getConnectionDialect(), IStatement.PREPARE_PREFETCH_METADATA); + statement = getDatabase().getAttachment().prepare(getStatus(), transaction.getTransaction(), + statementArray.length, statementArray, getDatabase().getConnectionDialect(), + IStatement.PREPARE_PREFETCH_METADATA); processStatus(); outMeta = statement.getOutputMetadata(getStatus()); processStatus(); @@ -177,18 +176,19 @@ public void execute(RowValue parameters) throws SQLException { outPtr.write(0, outMessage.array(), 0, outMessage.array().length); statement.execute(getStatus(), transaction.getTransaction(), inMeta, inPtr, outMeta, outPtr); } - processStatus(); if (hasSingletonResult) { /* A type with a singleton result (ie an execute procedure with return fields), doesn't actually * have a result set that will be fetched, instead we have a singleton result if we have fields */ statementListenerDispatcher.statementExecuted(this, false, true); + processStatus(); queueRowData(toRowValue(getRowDescriptor(), outMeta, outPtr)); - setAllRowsFetched(true); + setAfterLast(); } else { // A normal execute is never a singleton result (even if it only produces a single result) statementListenerDispatcher.statementExecuted(this, hasFields(), false); + processStatus(); } } @@ -216,24 +216,23 @@ protected void setMetaData(final RowDescriptor rowDescriptor, final RowValue par byte[] nullShort = new byte[]{-1, -1}; byte[] notNullShort = new byte[]{0, 0}; int shift; - + // Values must be aligned, otherwise, data will be lost + int alignment = inMeta.getAlignment(status); for (int idx = 0; idx < parameters.getCount(); idx++) { - byte[] fieldData = parameters.getFieldData(idx); final FieldDescriptor fieldDescriptor = rowDescriptor.getFieldDescriptor(idx); if (fieldData == null) { - // Note this only works because we mark the type as nullable in inMessage - // clear status getStatus(); - int nullOffset = inMeta.getNullOffset(status, idx); - processStatus(); // clear status getStatus(); int length = inMeta.getLength(status, idx); processStatus(); + if (offset != 0) + offset += offset % alignment; + inMessage.position(offset); offset += length; inMessage.position(nullOffset); inMessage.put(nullShort); @@ -244,11 +243,8 @@ protected void setMetaData(final RowDescriptor rowDescriptor, final RowValue par metadataBuilder.setLength(status, idx, inMeta.getLength(status, idx)); metadataBuilder.setCharSet(status, idx, inMeta.getCharSet(status, idx)); } else { - // clear status getStatus(); - // Values must be aligned, otherwise, data will be lost - int alignment = inMeta.getAlignment(status); shift = (fieldData.length ^ alignment) & 1; inMessage.position(offset); if (fieldDescriptor.isVarying()) { @@ -260,7 +256,6 @@ protected void setMetaData(final RowDescriptor rowDescriptor, final RowValue par inMessage.put(encodeShort); offset += encodeShort.length; inMessage.position(offset); - } else if (fieldDescriptor.isFbType(ISCConstants.SQL_TEXT)) { metadataBuilder.setType(status, idx, ISCConstants.SQL_TEXT + 1); metadataBuilder.setLength(status, idx, Math.min(fieldDescriptor.getLength(), fieldData.length)); @@ -286,11 +281,57 @@ protected void setMetaData(final RowDescriptor rowDescriptor, final RowValue par metadataBuilder.setType(status, idx, ISCConstants.SQL_TIMESTAMP + 1); metadataBuilder.setLength(status, idx, inMeta.getLength(status, idx)); metadataBuilder.setCharSet(status, idx, inMeta.getCharSet(status, idx)); + } else if (fieldDescriptor.isFbType(ISCConstants.SQL_INT64)) { + metadataBuilder.setType(status, idx, ISCConstants.SQL_INT64); + metadataBuilder.setLength(status, idx, inMeta.getLength(status, idx)); + metadataBuilder.setScale(status, idx, inMeta.getScale(status, idx)); + metadataBuilder.setCharSet(status, idx, inMeta.getCharSet(status, idx)); + if (offset != 0) + offset += offset % alignment; + inMessage.position(offset); + } else if (fieldDescriptor.isFbType(ISCConstants.SQL_INT128)) { + metadataBuilder.setType(status, idx, ISCConstants.SQL_INT128); + metadataBuilder.setLength(status, idx, inMeta.getLength(status, idx)); + metadataBuilder.setScale(status, idx, inMeta.getScale(status, idx)); + metadataBuilder.setCharSet(status, idx, inMeta.getCharSet(status, idx)); + byte[] encodeShort = fieldDescriptor.getDatatypeCoder().encodeShort(fieldData.length); + inMessage.put(encodeShort); + offset += encodeShort.length; + if (offset != 0) + offset += offset % alignment; + inMessage.position(offset); + } else if (fieldDescriptor.isFbType(ISCConstants.SQL_DEC16)) { + metadataBuilder.setType(status, idx, ISCConstants.SQL_DEC16); + metadataBuilder.setLength(status, idx, inMeta.getLength(status, idx)); + metadataBuilder.setScale(status, idx, inMeta.getScale(status, idx)); + metadataBuilder.setCharSet(status, idx, inMeta.getCharSet(status, idx)); + byte[] encodeShort = fieldDescriptor.getDatatypeCoder().encodeShort(fieldData.length); + inMessage.put(encodeShort); + offset += encodeShort.length; + if (offset != 0) + offset += offset % alignment; + inMessage.position(offset); + } else if (fieldDescriptor.isFbType(ISCConstants.SQL_DEC34)) { + metadataBuilder.setType(status, idx, ISCConstants.SQL_DEC34); + metadataBuilder.setLength(status, idx, inMeta.getLength(status, idx)); + metadataBuilder.setScale(status, idx, inMeta.getScale(status, idx)); + metadataBuilder.setCharSet(status, idx, inMeta.getCharSet(status, idx)); + byte[] encodeShort = fieldDescriptor.getDatatypeCoder().encodeShort(fieldData.length); + inMessage.put(encodeShort); + offset += encodeShort.length; + if (offset != 0) + offset += offset % alignment; + inMessage.position(offset); + } else if (fieldDescriptor.isFbType(ISCConstants.SQL_BOOLEAN)) { + inMessage.position(offset); + metadataBuilder.setType(status, idx, ISCConstants.SQL_BOOLEAN); + metadataBuilder.setLength(status, idx, inMeta.getLength(status, idx)); + metadataBuilder.setCharSet(status, idx, 0); } else { if (offset % alignment != 0) offset += offset % alignment; inMessage.position(offset); - metadataBuilder.setType(status, idx, fieldDescriptor.getType()); + metadataBuilder.setType(status, idx, inMeta.getType(status, idx) | 1); metadataBuilder.setLength(status, idx, inMeta.getLength(status, idx)); metadataBuilder.setCharSet(status, idx, 0); } @@ -316,7 +357,7 @@ public void fetchRows(int fetchSize) throws SQLException { if (!getState().isCursorOpen()) { throw new FbExceptionBuilder().exception(ISCConstants.isc_cursor_not_open).toSQLException(); } - if (isAllRowsFetched()) return; + if (isAfterLast()) return; try (OperationCloseHandle operationCloseHandle = signalFetch()) { if (operationCloseHandle.isCancelled()) { @@ -332,7 +373,7 @@ public void fetchRows(int fetchSize) throws SQLException { if (fetchStatus == IStatus.RESULT_OK) { queueRowData(toRowValue(getRowDescriptor(), outMeta, ptr)); } else if (fetchStatus == IStatus.RESULT_NO_DATA) { - setAllRowsFetched(true); + setAfterLast(); // Note: we are not explicitly 'closing' the cursor here } else { final String errorMessage = "Unexpected fetch status (expected 0 or 100): " + fetchStatus; diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/ITransactionImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/ITransactionImpl.java index f50777b920..9093fdca7f 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/ITransactionImpl.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/ITransactionImpl.java @@ -14,7 +14,7 @@ * Implementation of {@link org.firebirdsql.gds.ng.FbTransaction} for native client access using OO API. * * @author Vasiliy Yashkov - * @since 4.0 + * @since 5.0 */ public class ITransactionImpl extends AbstractFbTransaction { diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/NativeDatabaseConnection.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/NativeDatabaseConnection.java index 44e74cf82c..48b01d3dba 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/NativeDatabaseConnection.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/NativeDatabaseConnection.java @@ -13,7 +13,7 @@ /** * Class handling the initial setup of the native OO API database connection. * - * @since 4.0 + * @since 5.0 */ public class NativeDatabaseConnection extends AbstractNativeConnection { diff --git a/src/test/org/firebirdsql/common/FBTestProperties.java b/src/test/org/firebirdsql/common/FBTestProperties.java index 09d13c5995..b0371ca780 100644 --- a/src/test/org/firebirdsql/common/FBTestProperties.java +++ b/src/test/org/firebirdsql/common/FBTestProperties.java @@ -105,7 +105,7 @@ public static String getDatabasePath(String name) { */ public static String getdbpath(String name) { final String gdsType = getProperty("test.gds_type", null); - if ("EMBEDDED".equalsIgnoreCase(gdsType)) { + if ("EMBEDDED".equalsIgnoreCase(gdsType) || "FBOOEMBEDDED".equalsIgnoreCase(gdsType)) { return new File(DB_PATH, name).getAbsolutePath(); } else { return DB_SERVER_URL + "/" + DB_SERVER_PORT + ":" + getDatabasePath(name); @@ -240,7 +240,7 @@ public static String getUrl() { * @return JDBC URL (without parameters) for this testrun */ public static String getUrl(String dbPath) { - if ("EMBEDDED".equalsIgnoreCase(GDS_TYPE)) { + if ("EMBEDDED".equalsIgnoreCase(GDS_TYPE) || "FBOOEMBEDDED".equalsIgnoreCase(GDS_TYPE)) { return gdsTypeToUrlPrefixMap.get(getGdsType()) + dbPath; } else { return gdsTypeToUrlPrefixMap.get(getGdsType()) + DB_SERVER_URL + "/" + DB_SERVER_PORT + ":" + dbPath; diff --git a/src/test/org/firebirdsql/common/extension/GdsTypeExtension.java b/src/test/org/firebirdsql/common/extension/GdsTypeExtension.java index 5f55cbddf2..76f9275483 100644 --- a/src/test/org/firebirdsql/common/extension/GdsTypeExtension.java +++ b/src/test/org/firebirdsql/common/extension/GdsTypeExtension.java @@ -21,6 +21,8 @@ import org.firebirdsql.common.FBTestProperties; import org.firebirdsql.gds.impl.jni.EmbeddedGDSFactoryPlugin; import org.firebirdsql.gds.impl.jni.NativeGDSFactoryPlugin; +import org.firebirdsql.gds.impl.nativeoo.FbOOEmbeddedGDSFactoryPlugin; +import org.firebirdsql.gds.impl.nativeoo.FbOONativeGDSFactoryPlugin; import org.hamcrest.Matcher; import org.junit.jupiter.api.extension.BeforeAllCallback; import org.junit.jupiter.api.extension.ExtensionContext; @@ -76,6 +78,16 @@ public static GdsTypeExtension excludes(String... excludedTypes) { return new GdsTypeExtension(not(in(excludedTypesSet))); } + /** + * Creates an instance that supports only all (known) OO API native test types. + * + * @return Instance + */ + public static GdsTypeExtension supportsFBOONativeOnly() { + return supports(FbOONativeGDSFactoryPlugin.NATIVE_TYPE_NAME, + FbOOEmbeddedGDSFactoryPlugin.EMBEDDED_TYPE_NAME); + } + /** * Creates an instance that supports only all (known) native test types. * @@ -91,6 +103,7 @@ public static GdsTypeExtension supportsNativeOnly() { * @return Instance */ public static GdsTypeExtension excludesNativeOnly() { - return excludes(NativeGDSFactoryPlugin.NATIVE_TYPE_NAME, EmbeddedGDSFactoryPlugin.EMBEDDED_TYPE_NAME); + return excludes(NativeGDSFactoryPlugin.NATIVE_TYPE_NAME, EmbeddedGDSFactoryPlugin.EMBEDDED_TYPE_NAME, + FbOONativeGDSFactoryPlugin.NATIVE_TYPE_NAME, FbOOEmbeddedGDSFactoryPlugin.EMBEDDED_TYPE_NAME); } } diff --git a/src/test/org/firebirdsql/ds/FBConnectionPoolTestBase.java b/src/test/org/firebirdsql/ds/FBConnectionPoolTestBase.java index 0f34acd28d..b5ac7ce3e5 100644 --- a/src/test/org/firebirdsql/ds/FBConnectionPoolTestBase.java +++ b/src/test/org/firebirdsql/ds/FBConnectionPoolTestBase.java @@ -50,7 +50,8 @@ void setUp() { FBConnectionPoolDataSource newDs = new FBConnectionPoolDataSource(); newDs.setType(getProperty("test.gds_type", null)); if (getGdsType() == GDSType.getType("PURE_JAVA") - || getGdsType() == GDSType.getType("NATIVE")) { + || getGdsType() == GDSType.getType("NATIVE") + || getGdsType() == GDSType.getType("FBOONATIVE")) { newDs.setServerName(DB_SERVER_URL); newDs.setPortNumber(DB_SERVER_PORT); } diff --git a/src/test/org/firebirdsql/ds/FBXADataSourceTest.java b/src/test/org/firebirdsql/ds/FBXADataSourceTest.java index 3086663e2b..635ca0d487 100644 --- a/src/test/org/firebirdsql/ds/FBXADataSourceTest.java +++ b/src/test/org/firebirdsql/ds/FBXADataSourceTest.java @@ -69,7 +69,8 @@ void setUp() { FBXADataSource newDs = new FBXADataSource(); newDs.setType(getProperty("test.gds_type", null)); if (getGdsType() == GDSType.getType("PURE_JAVA") - || getGdsType() == GDSType.getType("NATIVE")) { + || getGdsType() == GDSType.getType("NATIVE") + || getGdsType() == GDSType.getType("FBOONATIVE")) { newDs.setServerName(DB_SERVER_URL); newDs.setPortNumber(DB_SERVER_PORT); } diff --git a/src/test/org/firebirdsql/event/FBEventManagerTest.java b/src/test/org/firebirdsql/event/FBEventManagerTest.java index 0eca965096..aa96e07952 100644 --- a/src/test/org/firebirdsql/event/FBEventManagerTest.java +++ b/src/test/org/firebirdsql/event/FBEventManagerTest.java @@ -77,7 +77,8 @@ class FBEventManagerTest { private void setupDefaultEventManager() throws SQLException { eventManager = new FBEventManager(getGdsType()); - if (getGdsType() == GDSType.getType("PURE_JAVA") || getGdsType() == GDSType.getType("NATIVE")) { + if (getGdsType() == GDSType.getType("PURE_JAVA") || getGdsType() == GDSType.getType("NATIVE") + || getGdsType() == GDSType.getType("FBOONATIVE")) { eventManager.setServerName(DB_SERVER_URL); } eventManager.setUser(DB_USER); diff --git a/src/test/org/firebirdsql/gds/impl/jni/EmbeddedServicesAPITest.java b/src/test/org/firebirdsql/gds/impl/jni/EmbeddedServicesAPITest.java new file mode 100644 index 0000000000..e7a7bbef94 --- /dev/null +++ b/src/test/org/firebirdsql/gds/impl/jni/EmbeddedServicesAPITest.java @@ -0,0 +1,18 @@ +package org.firebirdsql.gds.impl.jni; + +import org.firebirdsql.common.extension.GdsTypeExtension; +import org.firebirdsql.gds.impl.GDSType; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.RegisterExtension; + +public class EmbeddedServicesAPITest extends ServicesAPITest { + + @RegisterExtension + static final GdsTypeExtension testType = GdsTypeExtension.supports(EmbeddedGDSFactoryPlugin.EMBEDDED_TYPE_NAME); + + @Test + void testEmbeddedServicesAPI() { + gdsType = GDSType.getType(EmbeddedGDSFactoryPlugin.EMBEDDED_TYPE_NAME); + protocol = "jdbc:firebirdsql:embedded:"; + } +} diff --git a/src/test/org/firebirdsql/gds/impl/jni/FbOOEmbeddedServicesAPITest.java b/src/test/org/firebirdsql/gds/impl/jni/FbOOEmbeddedServicesAPITest.java new file mode 100644 index 0000000000..1c099bfb15 --- /dev/null +++ b/src/test/org/firebirdsql/gds/impl/jni/FbOOEmbeddedServicesAPITest.java @@ -0,0 +1,19 @@ +package org.firebirdsql.gds.impl.jni; + +import org.firebirdsql.common.extension.GdsTypeExtension; +import org.firebirdsql.gds.impl.GDSType; +import org.firebirdsql.gds.impl.nativeoo.FbOOEmbeddedGDSFactoryPlugin; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.RegisterExtension; + +public class FbOOEmbeddedServicesAPITest extends ServicesAPITest { + + @RegisterExtension + static final GdsTypeExtension testType = GdsTypeExtension.supports(FbOOEmbeddedGDSFactoryPlugin.EMBEDDED_TYPE_NAME); + + @Test + void testFbOOEmbeddedServicesAPI() { + gdsType = GDSType.getType(FbOOEmbeddedGDSFactoryPlugin.EMBEDDED_TYPE_NAME); + protocol = "jdbc:firebirdsql:fboo:embedded:"; + } +} diff --git a/src/test/org/firebirdsql/gds/impl/jni/FbOONativeServicesAPITest.java b/src/test/org/firebirdsql/gds/impl/jni/FbOONativeServicesAPITest.java new file mode 100644 index 0000000000..0808e3840d --- /dev/null +++ b/src/test/org/firebirdsql/gds/impl/jni/FbOONativeServicesAPITest.java @@ -0,0 +1,20 @@ +package org.firebirdsql.gds.impl.jni; + +import org.firebirdsql.common.extension.GdsTypeExtension; +import org.firebirdsql.gds.impl.GDSType; +import org.firebirdsql.gds.impl.nativeoo.FbOONativeGDSFactoryPlugin; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.RegisterExtension; + +public class FbOONativeServicesAPITest extends ServicesAPITest { + + @RegisterExtension + static final GdsTypeExtension testType = GdsTypeExtension.supports(FbOONativeGDSFactoryPlugin.NATIVE_TYPE_NAME); + + @Test + void testFbOONativeServicesAPI() { + gdsType = GDSType.getType(FbOONativeGDSFactoryPlugin.NATIVE_TYPE_NAME); + protocol = "jdbc:firebirdsql:fboo:native:"; + port = 5066; + } +} diff --git a/src/test/org/firebirdsql/gds/impl/jni/NativeServicesAPITest.java b/src/test/org/firebirdsql/gds/impl/jni/NativeServicesAPITest.java new file mode 100644 index 0000000000..e27e37758f --- /dev/null +++ b/src/test/org/firebirdsql/gds/impl/jni/NativeServicesAPITest.java @@ -0,0 +1,19 @@ +package org.firebirdsql.gds.impl.jni; + +import org.firebirdsql.common.extension.GdsTypeExtension; +import org.firebirdsql.gds.impl.GDSType; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.RegisterExtension; + +public class NativeServicesAPITest extends ServicesAPITest { + + @RegisterExtension + static final GdsTypeExtension testType = GdsTypeExtension.supports(NativeGDSFactoryPlugin.NATIVE_TYPE_NAME); + + @Test + void testNativeServicesAPI() { + gdsType = GDSType.getType(NativeGDSFactoryPlugin.NATIVE_TYPE_NAME); + protocol = "jdbc:firebirdsql:native:"; + port = 5066; + } +} diff --git a/src/test/org/firebirdsql/gds/impl/jni/ServicesAPITest.java b/src/test/org/firebirdsql/gds/impl/jni/ServicesAPITest.java index aa95ddaa2e..ef91241378 100644 --- a/src/test/org/firebirdsql/gds/impl/jni/ServicesAPITest.java +++ b/src/test/org/firebirdsql/gds/impl/jni/ServicesAPITest.java @@ -49,14 +49,10 @@ import static org.junit.jupiter.api.Assertions.assertTrue; /** - * Initial tests for Services API. Currently run only against embedded server. - * TODO: Make run against other types + * Initial tests for Services API. */ class ServicesAPITest { - @RegisterExtension - static final GdsTypeExtension testType = GdsTypeExtension.supports(EmbeddedGDSFactoryPlugin.EMBEDDED_TYPE_NAME); - @TempDir private Path tempDir; @@ -65,20 +61,21 @@ class ServicesAPITest { private String mAbsoluteDatabasePath; private String mAbsoluteBackupPath; private FBManager fbManager; - private GDSType gdsType; + protected String protocol; + protected GDSType gdsType; + protected int port = 5066; private FbDatabaseFactory dbFactory; private Path logFolder; @BeforeEach void setUp() throws Exception { Class.forName(FBDriver.class.getName()); - gdsType = GDSType.getType(EmbeddedGDSFactoryPlugin.EMBEDDED_TYPE_NAME); dbFactory = GDSFactory.getDatabaseFactoryForType(gdsType); fbManager = new FBManager(gdsType); fbManager.setServer("localhost"); - fbManager.setPort(5066); + fbManager.setPort(port); fbManager.start(); Path dbFolder = tempDir.resolve("db"); @@ -130,7 +127,7 @@ void testBackupAndRestore() throws Exception { private void connectToDatabase() throws SQLException { Connection connection = DriverManager.getConnection( - "jdbc:firebirdsql:embedded:" + mAbsoluteDatabasePath + "?encoding=NONE", "SYSDBA", "masterkey"); + protocol + mAbsoluteDatabasePath + "?encoding=NONE", "SYSDBA", "masterkey"); connection.close(); } diff --git a/src/test/org/firebirdsql/gds/impl/jni/SpecialFbOOEmbeddedServerUrlsTest.java b/src/test/org/firebirdsql/gds/impl/jni/SpecialFbOOEmbeddedServerUrlsTest.java new file mode 100644 index 0000000000..f17b19f3da --- /dev/null +++ b/src/test/org/firebirdsql/gds/impl/jni/SpecialFbOOEmbeddedServerUrlsTest.java @@ -0,0 +1,125 @@ +/* + * Firebird Open Source JavaEE Connector - JDBC Driver + * + * Distributable under LGPL license. + * You may obtain a copy of the License at http://www.gnu.org/copyleft/lgpl.html + * + * This program 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 + * LGPL License for more details. + * + * This file was created by members of the firebird development team. + * All individual contributions remain the Copyright (C) of those + * individuals. Contributors to this file are either listed here or + * can be obtained from a source control history command. + * + * All rights reserved. + */ +package org.firebirdsql.gds.impl.jni; + +import org.firebirdsql.common.extension.GdsTypeExtension; +import org.firebirdsql.gds.impl.GDSType; +import org.firebirdsql.gds.impl.nativeoo.FbOOEmbeddedGDSFactoryPlugin; +import org.firebirdsql.jdbc.FBDriver; +import org.firebirdsql.management.FBManager; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.RegisterExtension; +import org.junit.jupiter.api.io.TempDir; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.sql.Connection; +import java.sql.DriverManager; + +public class SpecialFbOOEmbeddedServerUrlsTest { + + @RegisterExtension + static final GdsTypeExtension testType = GdsTypeExtension.supports(EmbeddedGDSFactoryPlugin.EMBEDDED_TYPE_NAME); + + @TempDir + private Path tempDir; + + private String mRelativeDatabasePath; + private String mAbsoluteDatabasePath; + private FBManager fbManager; + private GDSType gdsType; + + @BeforeEach + void setUp() throws Exception { + Class.forName(FBDriver.class.getName()); + gdsType = GDSType.getType(FbOOEmbeddedGDSFactoryPlugin.EMBEDDED_TYPE_NAME); + fbManager = new FBManager(gdsType); + + fbManager.setServer("localhost"); + fbManager.setPort(5066); + fbManager.start(); + + Path dbFolder = tempDir.resolve("db"); + Files.createDirectories(dbFolder); + + mRelativeDatabasePath = "testES01874.fdb"; + mAbsoluteDatabasePath = dbFolder.resolve(mRelativeDatabasePath).toString(); + + fbManager.createDatabase(mAbsoluteDatabasePath, "SYSDBA", "masterkey"); + } + + @AfterEach + void tearDown() throws Exception { + fbManager.dropDatabase(mAbsoluteDatabasePath, "SYSDBA", "masterkey"); + fbManager.stop(); + fbManager = null; + + cleanUpFile(mRelativeDatabasePath); + } + + @Test + void testFBManagerWithoutSettingServerAndPort() throws Exception { + try (FBManager testFBManager = new FBManager(gdsType)) { + testFBManager.start(); + + testFBManager.dropDatabase(mAbsoluteDatabasePath, "SYSDBA", "masterkey"); + testFBManager.createDatabase(mAbsoluteDatabasePath, "SYSDBA", "masterkey"); + } + } + + @Test + void testFBManagerWithRelativeDatabaseFile() throws Exception { + try (FBManager testFBManager = new FBManager(gdsType)) { + testFBManager.setDropOnStop(true); + testFBManager.start(); + + testFBManager.createDatabase(mRelativeDatabasePath, "SYSDBA", "masterkey"); + } + } + + @Test + void testDriverManagerGetConnectionWithoutServerAndPortInUrl() throws Exception { + Connection connection = DriverManager.getConnection( + "jdbc:firebirdsql:fboo:embedded:" + mAbsoluteDatabasePath +"?encoding=NONE", "SYSDBA", "masterkey"); + connection.close(); + } + + @Test + void testDriverManagerGetConnectionWithoutServerAndPortInUrlWithRelativeDatabasePath() throws Exception { + try (FBManager testFBManager = new FBManager(gdsType)) { + testFBManager.setDropOnStop(true); + testFBManager.start(); + + testFBManager.createDatabase(mRelativeDatabasePath, "SYSDBA", "masterkey"); + + Connection connection = DriverManager.getConnection( + "jdbc:firebirdsql:fboo:embedded:" + mRelativeDatabasePath + "?encoding=NONE", "SYSDBA", "masterkey"); + connection.close(); + } + } + + private static void cleanUpFile(String path) throws IOException { + Path filePath = Paths.get(path); + Files.deleteIfExists(filePath); + } +} diff --git a/src/test/org/firebirdsql/gds/impl/jni/TestEmbeddedServicesAPI.java b/src/test/org/firebirdsql/gds/impl/jni/TestEmbeddedServicesAPI.java deleted file mode 100644 index a680833faf..0000000000 --- a/src/test/org/firebirdsql/gds/impl/jni/TestEmbeddedServicesAPI.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.firebirdsql.gds.impl.jni; - -import org.firebirdsql.gds.impl.GDSType; - -public class TestEmbeddedServicesAPI extends TestServicesAPI { - - public TestEmbeddedServicesAPI() { - gdsType = GDSType.getType(EmbeddedGDSFactoryPlugin.EMBEDDED_TYPE_NAME); - protocol = "jdbc:firebirdsql:embedded:"; - } -} diff --git a/src/test/org/firebirdsql/gds/impl/jni/TestFbOOEmbeddedServicesAPI.java b/src/test/org/firebirdsql/gds/impl/jni/TestFbOOEmbeddedServicesAPI.java deleted file mode 100644 index c1315c1c83..0000000000 --- a/src/test/org/firebirdsql/gds/impl/jni/TestFbOOEmbeddedServicesAPI.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.firebirdsql.gds.impl.jni; - -import org.firebirdsql.gds.impl.GDSType; -import org.firebirdsql.gds.impl.nativeoo.FbOOEmbeddedGDSFactoryPlugin; - -public class TestFbOOEmbeddedServicesAPI extends TestServicesAPI { - - public TestFbOOEmbeddedServicesAPI() { - gdsType = GDSType.getType(FbOOEmbeddedGDSFactoryPlugin.EMBEDDED_TYPE_NAME); - protocol = "jdbc:firebirdsql:fboo:embedded:"; - } -} diff --git a/src/test/org/firebirdsql/gds/impl/jni/TestFbOONativeServicesAPI.java b/src/test/org/firebirdsql/gds/impl/jni/TestFbOONativeServicesAPI.java deleted file mode 100644 index 959abb348b..0000000000 --- a/src/test/org/firebirdsql/gds/impl/jni/TestFbOONativeServicesAPI.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.firebirdsql.gds.impl.jni; - -import org.firebirdsql.gds.impl.GDSType; -import org.firebirdsql.gds.impl.nativeoo.FbOONativeGDSFactoryPlugin; - -public class TestFbOONativeServicesAPI extends TestServicesAPI { - - public TestFbOONativeServicesAPI() { - gdsType = GDSType.getType(FbOONativeGDSFactoryPlugin.NATIVE_TYPE_NAME); - protocol = "jdbc:firebirdsql:fboo:native:"; - port = 3050; - } -} diff --git a/src/test/org/firebirdsql/gds/impl/jni/TestNativeServicesAPI.java b/src/test/org/firebirdsql/gds/impl/jni/TestNativeServicesAPI.java deleted file mode 100644 index a94ecd2755..0000000000 --- a/src/test/org/firebirdsql/gds/impl/jni/TestNativeServicesAPI.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.firebirdsql.gds.impl.jni; - -import org.firebirdsql.gds.impl.GDSType; - -public class TestNativeServicesAPI extends TestServicesAPI { - - public TestNativeServicesAPI() { - gdsType = GDSType.getType(NativeGDSFactoryPlugin.NATIVE_TYPE_NAME); - protocol = "jdbc:firebirdsql:native:"; - port = 3050; - } -} diff --git a/src/test/org/firebirdsql/gds/impl/jni/TestSpecialFbOOEmbeddedServerUrls.java b/src/test/org/firebirdsql/gds/impl/jni/TestSpecialFbOOEmbeddedServerUrls.java deleted file mode 100644 index 8e4ef6b9ea..0000000000 --- a/src/test/org/firebirdsql/gds/impl/jni/TestSpecialFbOOEmbeddedServerUrls.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Firebird Open Source JavaEE Connector - JDBC Driver - * - * Distributable under LGPL license. - * You may obtain a copy of the License at http://www.gnu.org/copyleft/lgpl.html - * - * This program 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 - * LGPL License for more details. - * - * This file was created by members of the firebird development team. - * All individual contributions remain the Copyright (C) of those - * individuals. Contributors to this file are either listed here or - * can be obtained from a source control history command. - * - * All rights reserved. - */ -package org.firebirdsql.gds.impl.jni; - -import org.firebirdsql.common.rules.GdsTypeRule; -import org.firebirdsql.gds.impl.GDSType; -import org.firebirdsql.gds.impl.nativeoo.FbOOEmbeddedGDSFactoryPlugin; -import org.firebirdsql.jdbc.FBDriver; -import org.firebirdsql.management.FBManager; -import org.junit.*; -import org.junit.rules.TemporaryFolder; - -import java.io.File; -import java.sql.Connection; -import java.sql.DriverManager; - -public class TestSpecialFbOOEmbeddedServerUrls { - - @ClassRule - public static final GdsTypeRule testType = GdsTypeRule.supports(FbOOEmbeddedGDSFactoryPlugin.EMBEDDED_TYPE_NAME); - - @Rule - public final TemporaryFolder temporaryFolder = new TemporaryFolder(); - - private String mRelativeDatabasePath; - private String mAbsoluteDatabasePath; - private FBManager fbManager; - private GDSType gdsType; - - @Before - public void setUp() throws Exception { - Class.forName(FBDriver.class.getName()); - gdsType = GDSType.getType(FbOOEmbeddedGDSFactoryPlugin.EMBEDDED_TYPE_NAME); - fbManager = new FBManager(gdsType); - - fbManager.setServer("localhost"); - fbManager.setPort(5066); - fbManager.start(); - - File dbFolder = temporaryFolder.newFolder("db"); - - mRelativeDatabasePath = "testES01874.fdb"; - mAbsoluteDatabasePath = new File(dbFolder, mRelativeDatabasePath).getAbsolutePath(); - - fbManager.createDatabase(mAbsoluteDatabasePath, "SYSDBA", "masterkey"); - } - - @After - public void tearDown() throws Exception { - fbManager.dropDatabase(mAbsoluteDatabasePath, "SYSDBA", "masterkey"); - fbManager.stop(); - fbManager = null; - } - - @Test - public void testFBManagerWithoutSettingServerAndPort() throws Exception { - FBManager testFBManager = new FBManager(gdsType); - testFBManager.start(); - - testFBManager.dropDatabase(mAbsoluteDatabasePath, "SYSDBA", "masterkey"); - testFBManager.createDatabase(mAbsoluteDatabasePath, "SYSDBA", "masterkey"); - - testFBManager.stop(); - } - - @Test - public void testFBManagerWithRelativeDatabaseFile() throws Exception { - FBManager testFBManager = new FBManager(gdsType); - testFBManager.setDropOnStop(true); - try { - testFBManager.start(); - - testFBManager.createDatabase(mRelativeDatabasePath, "SYSDBA", "masterkey"); - } finally { - testFBManager.stop(); - } - } - - @Test - public void testDriverManagerGetConnectionWithoutServerAndPortInUrl() throws Exception { - Connection connection = DriverManager.getConnection("jdbc:firebirdsql:fboo:embedded:" + mAbsoluteDatabasePath +"?encoding=NONE", - "SYSDBA", "masterkey"); - connection.close(); - } - - @Test - public void testDriverManagerGetConnectionWithoutServerAndPortInUrlWithRelativeDatabasePath() throws Exception { - FBManager testFBManager = new FBManager(gdsType); - testFBManager.setDropOnStop(true); - try { - testFBManager.start(); - - testFBManager.createDatabase(mRelativeDatabasePath, "SYSDBA", "masterkey"); - - Connection connection = - DriverManager.getConnection("jdbc:firebirdsql:fboo:embedded:" + mRelativeDatabasePath + "?encoding=NONE", - "SYSDBA", "masterkey"); - connection.close(); - } finally { - testFBManager.stop(); - } - } -} diff --git a/src/test/org/firebirdsql/gds/ng/AbstractBatchTest.java b/src/test/org/firebirdsql/gds/ng/AbstractBatchTest.java index 53cf0978bb..ce596740e6 100644 --- a/src/test/org/firebirdsql/gds/ng/AbstractBatchTest.java +++ b/src/test/org/firebirdsql/gds/ng/AbstractBatchTest.java @@ -2,26 +2,23 @@ import org.firebirdsql.common.DdlHelper; import org.firebirdsql.common.FBTestProperties; -import org.firebirdsql.common.rules.UsesDatabase; +import org.firebirdsql.common.extension.UsesDatabaseExtension; import org.firebirdsql.gds.BatchParameterBuffer; -import org.firebirdsql.gds.TransactionParameterBuffer; import org.firebirdsql.gds.impl.BatchParameterBufferImpl; -import org.firebirdsql.gds.impl.TransactionParameterBufferImpl; -import org.firebirdsql.jaybird.fb.constants.TpbItems; import org.firebirdsql.jdbc.FirebirdConnection; import org.firebirdsql.management.FBManager; import org.firebirdsql.util.FirebirdSupportInfo; -import org.junit.After; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.RegisterExtension; import java.sql.*; import static org.firebirdsql.common.FBTestProperties.*; +import static org.firebirdsql.common.JdbcResourceHelper.closeQuietly; import static org.firebirdsql.util.FirebirdSupportInfo.supportInfoFor; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.*; /** * Generic tests for FbBatch. @@ -30,37 +27,37 @@ *

* * @author Vasiliy Yashkov - * @since 4.0 + * @since 5.0 */ public abstract class AbstractBatchTest { //@formatter:off protected String CREATE_TABLE = "CREATE TABLE test_p_metadata (" + - " id INTEGER, " + - " simple_field VARCHAR(60) CHARACTER SET WIN1251 COLLATE PXW_CYRL, " + - " two_byte_field VARCHAR(60) CHARACTER SET BIG_5, " + - " three_byte_field VARCHAR(60) CHARACTER SET UNICODE_FSS, " + - " long_field BIGINT, " + - " int_field INTEGER, " + - " short_field SMALLINT, " + - " float_field FLOAT, " + - " double_field DOUBLE PRECISION, " + - " smallint_numeric NUMERIC(3,1), " + - " integer_decimal_1 DECIMAL(3,1), " + - " integer_numeric NUMERIC(5,2), " + - " integer_decimal_2 DECIMAL(9,3), " + - " bigint_numeric NUMERIC(10,4), " + - " bigint_decimal DECIMAL(18,9), " + - " date_field DATE, " + - " time_field TIME, " + - " timestamp_field TIMESTAMP, " + - " blob_field BLOB, " + - " blob_text_field BLOB SUB_TYPE TEXT, " + - " blob_minus_one BLOB SUB_TYPE -1 " + - " /* boolean */ " + - " /* decfloat */ " + - " /* extended numerics */ " + - ")"; + " id INTEGER, " + + " simple_field VARCHAR(60) CHARACTER SET WIN1251 COLLATE PXW_CYRL, " + + " two_byte_field VARCHAR(60) CHARACTER SET BIG_5, " + + " three_byte_field VARCHAR(60) CHARACTER SET UNICODE_FSS, " + + " long_field BIGINT, " + + " int_field INTEGER, " + + " short_field SMALLINT, " + + " float_field FLOAT, " + + " double_field DOUBLE PRECISION, " + + " smallint_numeric NUMERIC(3,1), " + + " integer_decimal_1 DECIMAL(3,1), " + + " integer_numeric NUMERIC(5,2), " + + " integer_decimal_2 DECIMAL(9,3), " + + " bigint_numeric NUMERIC(10,4), " + + " bigint_decimal DECIMAL(18,9), " + + " date_field DATE, " + + " time_field TIME, " + + " timestamp_field TIMESTAMP, " + + " blob_field BLOB, " + + " blob_text_field BLOB SUB_TYPE TEXT, " + + " blob_minus_one BLOB SUB_TYPE -1 " + + " /* boolean */ " + + " /* decfloat */ " + + " /* extended numerics */ " + + ")"; protected String INSERT_QUERY = "INSERT INTO test_p_metadata (" + " id, " + @@ -91,94 +88,90 @@ public abstract class AbstractBatchTest { protected String TEST_QUERY = "SELECT " + - "simple_field, two_byte_field, three_byte_field, long_field, int_field, short_field," + - "float_field, double_field, smallint_numeric, integer_decimal_1, integer_numeric," + - "integer_decimal_2, bigint_numeric, bigint_decimal, date_field, time_field," + - "timestamp_field, blob_field, blob_text_field, blob_minus_one " + - "/* boolean */ " + - "/* decfloat */ " + - "/* extended numerics */ " + - "FROM test_p_metadata"; + "simple_field, two_byte_field, three_byte_field, long_field, int_field, short_field," + + "float_field, double_field, smallint_numeric, integer_decimal_1, integer_numeric," + + "integer_decimal_2, bigint_numeric, bigint_decimal, date_field, time_field," + + "timestamp_field, blob_field, blob_text_field, blob_minus_one " + + "/* boolean */ " + + "/* decfloat */ " + + "/* extended numerics */ " + + "FROM test_p_metadata"; //@formatter:on + @RegisterExtension + final UsesDatabaseExtension.UsesDatabaseForEach usesDatabase = UsesDatabaseExtension.usesDatabase(); + protected FbDatabase db; - protected static FBManager fbManager; - // private Connection connection; + protected Connection connection; protected FbTransaction transaction; protected PreparedStatement pstmt; protected ParameterMetaData parameterMetaData; protected FirebirdSupportInfo supportInfo; protected FbMetadataBuilder metadataBuilder; - // protected FbStatement statement; - protected final FbConnectionProperties connectionInfo; - - { - connectionInfo = new FbConnectionProperties(); - connectionInfo.setServerName(FBTestProperties.DB_SERVER_URL); - connectionInfo.setPortNumber(FBTestProperties.DB_SERVER_PORT); - connectionInfo.setUser(DB_USER); - connectionInfo.setPassword(DB_PASSWORD); - connectionInfo.setDatabaseName(FBTestProperties.getDatabasePath()); - connectionInfo.setEncoding("NONE"); - } - - @Rule - public final ExpectedException expectedException = ExpectedException.none(); - - @Rule - public final UsesDatabase usesDatabase = UsesDatabase.usesDatabase(); + protected final FbConnectionProperties connectionInfo = FBTestProperties.getDefaultFbConnectionProperties(); protected abstract Class getExpectedDatabaseType(); - @Before - public final void setUp() throws Exception { - - fbManager = createFBManager(); - defaultDatabaseSetUp(fbManager); + @BeforeEach + void setUp() throws Exception { - try (Connection con = FBTestProperties.getConnectionViaDriverManager()) { - supportInfo = supportInfoFor(con); + connection = getConnectionViaDriverManager(); + supportInfo = supportInfoFor(connection); - if (!supportInfo.supportsBigint()) { - // No BIGINT support, replacing type so number of columns remain the same - CREATE_TABLE = CREATE_TABLE.replace("long_field BIGINT,", "long field DOUBLE PRECISION,"); - } - if (supportInfo.supportsBoolean()) { - CREATE_TABLE = CREATE_TABLE.replace("/* boolean */", ", boolean_field BOOLEAN"); - TEST_QUERY = TEST_QUERY.replace("/* boolean */", ", boolean_field").replace("/* boolean-param */", ", ?"); - INSERT_QUERY = INSERT_QUERY.replace("/* boolean */", ", boolean_field") - .replace("/* boolean-param */", ", ?"); - } - if (supportInfo.supportsDecfloat()) { - CREATE_TABLE = CREATE_TABLE.replace("/* decfloat */", - ", decfloat16_field DECFLOAT(16), decfloat34_field DECFLOAT(34)"); - TEST_QUERY = TEST_QUERY.replace("/* decfloat */", ", decfloat16_field, decfloat34_field") - .replace("/* decfloat-param */", ", ?, ?"); - INSERT_QUERY = INSERT_QUERY.replace("/* decfloat */", ", decfloat16_field, decfloat34_field") - .replace("/* decfloat-param */", ", ?, ?"); - } - if (supportInfo.supportsDecimalPrecision(34)) { - CREATE_TABLE = CREATE_TABLE.replace("/* extended numerics */", - ", col_numeric25_20 NUMERIC(25, 20), col_decimal30_5 DECIMAL(30,5)"); - TEST_QUERY = TEST_QUERY.replace("/* extended numerics */", ", col_numeric25_20, col_decimal30_5") - .replace("/* extended-num-param*/", ", ?, ?"); - INSERT_QUERY = INSERT_QUERY.replace("/* extended numerics */", ", col_numeric25_20, col_decimal30_5") - .replace("/* extended numerics-param */", ", ?, ?"); - } + if (!supportInfo.supportsBigint()) { + // No BIGINT support, replacing type so number of columns remain the same + CREATE_TABLE = CREATE_TABLE.replace("long_field BIGINT,", "long field DOUBLE PRECISION,"); + } + if (supportInfo.supportsBoolean()) { + CREATE_TABLE = CREATE_TABLE.replace("/* boolean */", ", boolean_field BOOLEAN"); + TEST_QUERY = TEST_QUERY.replace("/* boolean */", ", boolean_field").replace("/* boolean-param */", ", ?"); + INSERT_QUERY = INSERT_QUERY.replace("/* boolean */", ", boolean_field") + .replace("/* boolean-param */", ", ?"); + } + if (supportInfo.supportsDecfloat()) { + CREATE_TABLE = CREATE_TABLE.replace("/* decfloat */", + ", decfloat16_field DECFLOAT(16), decfloat34_field DECFLOAT(34)"); + TEST_QUERY = TEST_QUERY.replace("/* decfloat */", ", decfloat16_field, decfloat34_field") + .replace("/* decfloat-param */", ", ?, ?"); + INSERT_QUERY = INSERT_QUERY.replace("/* decfloat */", ", decfloat16_field, decfloat34_field") + .replace("/* decfloat-param */", ", ?, ?"); + } + if (supportInfo.supportsDecimalPrecision(34)) { + CREATE_TABLE = CREATE_TABLE.replace("/* extended numerics */", + ", col_numeric25_20 NUMERIC(25, 20), col_decimal30_5 DECIMAL(30,5)"); + TEST_QUERY = TEST_QUERY.replace("/* extended numerics */", ", col_numeric25_20, col_decimal30_5") + .replace("/* extended-num-param*/", ", ?, ?"); + INSERT_QUERY = INSERT_QUERY.replace("/* extended numerics */", ", col_numeric25_20, col_decimal30_5") + .replace("/* extended numerics-param */", ", ?, ?"); + } - DdlHelper.executeCreateTable(con, CREATE_TABLE); + DdlHelper.executeCreateTable(connection, CREATE_TABLE); - pstmt = con.prepareStatement(TEST_QUERY); - parameterMetaData = pstmt.getParameterMetaData(); - } + pstmt = connection.prepareStatement(TEST_QUERY); + parameterMetaData = pstmt.getParameterMetaData(); db = createDatabase(); - assertEquals("Unexpected FbDatabase implementation", getExpectedDatabaseType(), db.getClass()); + assertEquals(getExpectedDatabaseType(), db.getClass(), "Unexpected FbDatabase implementation"); db.attach(); } + @AfterEach + void tearDown() throws Exception { + try { + transaction.commit(); + closeQuietly(pstmt, connection); + closeQuietly(db); + } finally { + transaction = null; + parameterMetaData = null; + pstmt = null; + connection = null; + supportInfo = null; + } + } + public static FBManager createFBManager() { return new FBManager(getGdsType()); } @@ -239,16 +232,11 @@ public void testCreateBatchWithMetadata() throws SQLException { BatchParameterBuffer buffer = new BatchParameterBufferImpl(); buffer.addArgument(BatchParameterBuffer.TAG_RECORD_COUNTS, 1); - db.createBatch(transaction, INSERT_QUERY, metadataBuilder.getMessageMetadata(), buffer); + FbBatch batch = db.createBatch(transaction, INSERT_QUERY, metadataBuilder.getMessageMetadata(), buffer); } private FbTransaction getTransaction() throws SQLException { - TransactionParameterBuffer tpb = new TransactionParameterBufferImpl(); - tpb.addArgument(TpbItems.isc_tpb_read_committed); - tpb.addArgument(TpbItems.isc_tpb_rec_version); - tpb.addArgument(TpbItems.isc_tpb_write); - tpb.addArgument(TpbItems.isc_tpb_wait); - return db.startTransaction(tpb); + return db.startTransaction(getDefaultTpb()); } protected void allocateTransaction() throws SQLException { @@ -257,23 +245,4 @@ protected void allocateTransaction() throws SQLException { } } - @After - public final void tearDown() throws Exception { - if (transaction != null) { - try { - transaction.commit(); - } catch (SQLException ex) { - System.out.println("Exception on transaction commit"); - ex.printStackTrace(); - } - } - if (db != null) { - try { - db.close(); - } catch (SQLException ex) { - System.out.println("Exception on detach"); - ex.printStackTrace(); - } - } - } } diff --git a/src/test/org/firebirdsql/jdbc/DatabaseEncryptionTest.java b/src/test/org/firebirdsql/jdbc/DatabaseEncryptionTest.java index ddbb48f5a0..967d79e4d3 100644 --- a/src/test/org/firebirdsql/jdbc/DatabaseEncryptionTest.java +++ b/src/test/org/firebirdsql/jdbc/DatabaseEncryptionTest.java @@ -172,7 +172,8 @@ void testFBSimpleDataSource() throws Exception { void testFBConnectionPoolDataSource() throws Exception { final FBConnectionPoolDataSource ds = new FBConnectionPoolDataSource(); ds.setDatabaseName(CRYPTTEST_DB); - if (getGdsType() == GDSType.getType("PURE_JAVA") || getGdsType() == GDSType.getType("NATIVE")) { + if (getGdsType() == GDSType.getType("PURE_JAVA") || getGdsType() == GDSType.getType("NATIVE") + || getGdsType() == GDSType.getType("FBOONATIVE")) { ds.setServerName(FBTestProperties.DB_SERVER_URL); ds.setPortNumber(FBTestProperties.DB_SERVER_PORT); } @@ -195,7 +196,8 @@ void testFBConnectionPoolDataSource() throws Exception { void testFBXADataSource() throws Exception { final FBXADataSource ds = new FBXADataSource(); ds.setDatabaseName(CRYPTTEST_DB); - if (getGdsType() == GDSType.getType("PURE_JAVA") || getGdsType() == GDSType.getType("NATIVE")) { + if (getGdsType() == GDSType.getType("PURE_JAVA") || getGdsType() == GDSType.getType("NATIVE") + || getGdsType() == GDSType.getType("FBOONATIVE")) { ds.setServerName(FBTestProperties.DB_SERVER_URL); ds.setPortNumber(FBTestProperties.DB_SERVER_PORT); } @@ -218,7 +220,8 @@ void testFBXADataSource() throws Exception { @Disabled("Requires global KeyHolderPlugin configuration") void testServiceManagerConnection_gstatException() { FBStatisticsManager statManager = new FBStatisticsManager(getGdsType()); - if (getGdsType() == GDSType.getType("PURE_JAVA") || getGdsType() == GDSType.getType("NATIVE")) { + if (getGdsType() == GDSType.getType("PURE_JAVA") || getGdsType() == GDSType.getType("NATIVE") + || getGdsType() == GDSType.getType("FBOONATIVE")) { statManager.setServerName(DB_SERVER_URL); statManager.setPortNumber(DB_SERVER_PORT); } @@ -240,7 +243,8 @@ void testServiceManagerConnection_gstatException() { @Disabled("Requires global KeyHolderPlugin configuration") void testDatabaseValidation() throws Exception { FBMaintenanceManager maintenanceManager = new FBMaintenanceManager(getGdsType()); - if (getGdsType() == GDSType.getType("PURE_JAVA") || getGdsType() == GDSType.getType("NATIVE")) { + if (getGdsType() == GDSType.getType("PURE_JAVA") || getGdsType() == GDSType.getType("NATIVE") + || getGdsType() == GDSType.getType("FBOONATIVE")) { maintenanceManager.setServerName(DB_SERVER_URL); maintenanceManager.setPortNumber(DB_SERVER_PORT); } @@ -273,7 +277,8 @@ void testEncryptedSelfSecurityDb() throws Exception { @SuppressWarnings("SameParameterValue") private static String getUrlWithoutProtocol(String dbPath) { - if ("EMBEDDED".equalsIgnoreCase(FBTestProperties.GDS_TYPE)) { + if ("EMBEDDED".equalsIgnoreCase(FBTestProperties.GDS_TYPE) || + "FBOOEMBEDDED".equalsIgnoreCase(FBTestProperties.GDS_TYPE)) { return dbPath; } else { return FBTestProperties.DB_SERVER_URL + "/" + FBTestProperties.DB_SERVER_PORT + ":" + dbPath; diff --git a/src/test/org/firebirdsql/jdbc/Dialect1SpecificsTest.java b/src/test/org/firebirdsql/jdbc/Dialect1SpecificsTest.java index 8330354190..cbcd664f11 100644 --- a/src/test/org/firebirdsql/jdbc/Dialect1SpecificsTest.java +++ b/src/test/org/firebirdsql/jdbc/Dialect1SpecificsTest.java @@ -68,7 +68,8 @@ void basicSetUp() throws Exception { fbManager = createFBManager(); if (getGdsType() == GDSType.getType("PURE_JAVA") - || getGdsType() == GDSType.getType("NATIVE")) { + || getGdsType() == GDSType.getType("NATIVE") + || getGdsType() == GDSType.getType("FBOONATIVE")) { fbManager.setServer(DB_SERVER_URL); fbManager.setPort(DB_SERVER_PORT); } diff --git a/src/test/org/firebirdsql/management/FBBackupManagerTest.java b/src/test/org/firebirdsql/management/FBBackupManagerTest.java index b239e709a4..fbe2583c78 100644 --- a/src/test/org/firebirdsql/management/FBBackupManagerTest.java +++ b/src/test/org/firebirdsql/management/FBBackupManagerTest.java @@ -70,7 +70,8 @@ class FBBackupManagerTest { @BeforeEach void setUp() { backupManager = new FBBackupManager(getGdsType()); - if (getGdsType() == GDSType.getType("PURE_JAVA") || getGdsType() == GDSType.getType("NATIVE")) { + if (getGdsType() == GDSType.getType("PURE_JAVA") || getGdsType() == GDSType.getType("NATIVE") + || getGdsType() == GDSType.getType("FBOONATIVE")) { assumeTrue(isLocalHost(DB_SERVER_URL), "Test needs to run on localhost for proper clean up"); backupManager.setServerName(DB_SERVER_URL); backupManager.setPortNumber(DB_SERVER_PORT); diff --git a/src/test/org/firebirdsql/management/FBMaintenanceManagerTest.java b/src/test/org/firebirdsql/management/FBMaintenanceManagerTest.java index 55b4287c23..66e2f50482 100644 --- a/src/test/org/firebirdsql/management/FBMaintenanceManagerTest.java +++ b/src/test/org/firebirdsql/management/FBMaintenanceManagerTest.java @@ -71,7 +71,8 @@ class FBMaintenanceManagerTest { @BeforeEach void setUp() { maintenanceManager = new FBMaintenanceManager(getGdsType()); - if (getGdsType() == GDSType.getType("PURE_JAVA") || getGdsType() == GDSType.getType("NATIVE")) { + if (getGdsType() == GDSType.getType("PURE_JAVA") || getGdsType() == GDSType.getType("NATIVE") + || getGdsType() == GDSType.getType("FBOONATIVE")) { maintenanceManager.setServerName(DB_SERVER_URL); maintenanceManager.setPortNumber(DB_SERVER_PORT); } diff --git a/src/test/org/firebirdsql/management/FBStatisticsManagerTest.java b/src/test/org/firebirdsql/management/FBStatisticsManagerTest.java index ab593862d9..a2d049fc51 100644 --- a/src/test/org/firebirdsql/management/FBStatisticsManagerTest.java +++ b/src/test/org/firebirdsql/management/FBStatisticsManagerTest.java @@ -64,7 +64,8 @@ void setUp() { loggingStream = new ByteArrayOutputStream(); statManager = new FBStatisticsManager(getGdsType()); - if (getGdsType() == GDSType.getType("PURE_JAVA") || getGdsType() == GDSType.getType("NATIVE")) { + if (getGdsType() == GDSType.getType("PURE_JAVA") || getGdsType() == GDSType.getType("NATIVE") + || getGdsType() == GDSType.getType("FBOONATIVE")) { statManager.setServerName(DB_SERVER_URL); statManager.setPortNumber(DB_SERVER_PORT); } diff --git a/src/test/org/firebirdsql/management/FBStreamingBackupManagerTest.java b/src/test/org/firebirdsql/management/FBStreamingBackupManagerTest.java index 355cd66ab1..f5358b6057 100644 --- a/src/test/org/firebirdsql/management/FBStreamingBackupManagerTest.java +++ b/src/test/org/firebirdsql/management/FBStreamingBackupManagerTest.java @@ -63,7 +63,8 @@ class FBStreamingBackupManagerTest { @BeforeEach void setUp() { backupManager = new FBStreamingBackupManager(getGdsType()); - if (getGdsType() == GDSType.getType("PURE_JAVA") || getGdsType() == GDSType.getType("NATIVE")) { + if (getGdsType() == GDSType.getType("PURE_JAVA") || getGdsType() == GDSType.getType("NATIVE") + || getGdsType() == GDSType.getType("FBOONATIVE")) { backupManager.setServerName(DB_SERVER_URL); backupManager.setPortNumber(DB_SERVER_PORT); } From f8f18e5010641289d2f63bbc7065dbb5b1133210 Mon Sep 17 00:00:00 2001 From: Vasiliy Yashkov Date: Mon, 5 Sep 2022 16:16:45 +0300 Subject: [PATCH 07/12] Add support for batch updates to the native OO API statement implementation --- build.gradle | 9 +- .../firebirdsql/jna/fbclient/ISC_DATE.java | 3 - .../gds/impl/BatchParameterBufferImpl.java | 58 --- .../gds/ng/AbstractFbMessageBuilder.java | 5 +- src/main/org/firebirdsql/gds/ng/FbBatch.java | 10 +- .../gds/ng/FbBatchCompletionState.java | 7 +- .../nativeoo/gds/ng/IBatchImplTest.java | 43 +- .../gds/ng/AbstractNativeConnection.java | 9 +- .../nativeoo/gds/ng/CloseableMemory.java | 5 - .../gds/ng/IBatchCompletionStateImpl.java | 90 ++++- .../nativeoo/gds/ng/IBatchImpl.java | 60 ++- .../nativeoo/gds/ng/IBlobImpl.java | 9 +- .../nativeoo/gds/ng/IDatabaseImpl.java | 15 +- .../nativeoo/gds/ng/IMetadataBuilderImpl.java | 19 +- .../nativeoo/gds/ng/IStatementImpl.java | 369 ++++++++++-------- .../gds/ng/NativeDatabaseConnection.java | 3 +- .../firebirdsql/gds/ng/AbstractBatchTest.java | 11 +- 17 files changed, 411 insertions(+), 314 deletions(-) delete mode 100644 src/main/org/firebirdsql/gds/impl/BatchParameterBufferImpl.java diff --git a/build.gradle b/build.gradle index b9fa9e34b5..15293b316a 100644 --- a/build.gradle +++ b/build.gradle @@ -71,7 +71,6 @@ dependencies { testImplementation "org.hamcrest:hamcrest-core:$hamcrest" testImplementation "org.hamcrest:hamcrest-library:$hamcrest" - testImplementation "org.hamcrest:hamcrest-core:$hamcrest" testImplementation "org.assertj:assertj-core:$assertj" testImplementation "org.mockito:mockito-core:$mockito" @@ -211,11 +210,11 @@ test { ) if (project.hasProperty('test.jna.library.path')) { systemProperty 'jna.library.path', project.'test.jna.library.path' - } else if (project.'test.gds_type' == 'NATIVE' || project.'test.gds_type' == 'EMBEDDED' - || project.'test.gds_type' == 'FBOONATIVE' || project.'test.gds_type' == 'FBOOEMBEDDED') { + } else if (project.'test.gds_type' == 'NATIVE' || project.'test.gds_type' == 'EMBEDDED' || + project.'test.gds_type' == 'FBOONATIVE' || project.'test.gds_type' == 'FBOOEMBEDDED') { println "Running test type ${project.'test.gds_type'} without explicit native library path. " + - "Specify property 'test.jna.library.path' to point to a Firebird client location (NATIVE) or " + - "Firebird install (EMBEDDED)." + "Specify property 'test.jna.library.path' to point to a Firebird client location (NATIVE/FBOONATIVE) or " + + "Firebird install (EMBEDDED/FBOOEMBEDDED)." } doFirst { diff --git a/src/jna-client/org/firebirdsql/jna/fbclient/ISC_DATE.java b/src/jna-client/org/firebirdsql/jna/fbclient/ISC_DATE.java index d5c72fa403..3bba974681 100644 --- a/src/jna-client/org/firebirdsql/jna/fbclient/ISC_DATE.java +++ b/src/jna-client/org/firebirdsql/jna/fbclient/ISC_DATE.java @@ -5,9 +5,6 @@ import java.util.Arrays; import java.util.List; - - - /** * JNA wrapper for ISC_DATE. *

diff --git a/src/main/org/firebirdsql/gds/impl/BatchParameterBufferImpl.java b/src/main/org/firebirdsql/gds/impl/BatchParameterBufferImpl.java deleted file mode 100644 index 4a229198ca..0000000000 --- a/src/main/org/firebirdsql/gds/impl/BatchParameterBufferImpl.java +++ /dev/null @@ -1,58 +0,0 @@ -package org.firebirdsql.gds.impl; - -import org.firebirdsql.gds.BatchParameterBuffer; -import org.firebirdsql.gds.ParameterBuffer; -import org.firebirdsql.gds.impl.argument.ArgumentType; - -/** - * - * @author Vasiliy Yashkov - * @since 4.0 - */ -public class BatchParameterBufferImpl extends ParameterBufferBase implements BatchParameterBuffer { - - public BatchParameterBufferImpl() { - super(BatchMetaData.BATCH_VERSION_1); - } - - private enum BatchMetaData implements ParameterBufferMetaData { - - BATCH_VERSION_1(VERSION1); - - private final int batchVersion; - - BatchMetaData(int batchVersion) { - this.batchVersion = batchVersion; - } - - @Override - public final int getType() { - return batchVersion; - } - - @Override - public final void addPreamble(ParameterBuffer parameterBuffer) { - // Do nothing - } - - @Override - public final ArgumentType getStringArgumentType(int tag) { - return ArgumentType.TraditionalDpb; - } - - @Override - public final ArgumentType getByteArrayArgumentType(int tag) { - return ArgumentType.TraditionalDpb; - } - - @Override - public final ArgumentType getIntegerArgumentType(int tag) { - return ArgumentType.Wide; - } - - @Override - public ArgumentType getSingleArgumentType(int tag) { - return ArgumentType.SingleTpb; - } - } -} diff --git a/src/main/org/firebirdsql/gds/ng/AbstractFbMessageBuilder.java b/src/main/org/firebirdsql/gds/ng/AbstractFbMessageBuilder.java index 4d04fa1653..75650499c0 100644 --- a/src/main/org/firebirdsql/gds/ng/AbstractFbMessageBuilder.java +++ b/src/main/org/firebirdsql/gds/ng/AbstractFbMessageBuilder.java @@ -3,6 +3,7 @@ import org.firebirdsql.gds.BatchParameterBuffer; import org.firebirdsql.gds.BlobParameterBuffer; import org.firebirdsql.gds.ng.fields.FieldDescriptor; +import org.firebirdsql.jaybird.fb.constants.BatchItems; import java.io.IOException; import java.nio.ByteBuffer; @@ -153,7 +154,7 @@ public long addBlobHeader(long blobId, BlobParameterBuffer buffer) throws IOExce @Override public void addBlobSegment(byte[] data, boolean lastSegment) throws IOException { - int align = align(blobStream.size(), BatchParameterBuffer.BLOB_SEGHDR_ALIGN); + int align = align(blobStream.size(), BatchItems.BLOB_SEGHDR_ALIGN); if (align != 0 && blobStream.size() - align < 0) { byte[] shift = ByteBuffer.allocate(Math.abs(blobStream.size() - align)).array(); blobStream.write(shift); @@ -162,7 +163,7 @@ public void addBlobSegment(byte[] data, boolean lastSegment) throws IOException blobStream.seek(segmentedBlobOffset); byte[] dataLength = statement.getDatabase().getDatatypeCoder().encodeShort(data.length); - segmentedBlobSize += align(data.length + dataLength.length, BatchParameterBuffer.BLOB_SEGHDR_ALIGN); + segmentedBlobSize += align(data.length + dataLength.length, BatchItems.BLOB_SEGHDR_ALIGN); blobStream.write(statement.getDatabase().getDatatypeCoder().encodeShort(segmentedBlobSize)); blobStream.seek(oldPosition); diff --git a/src/main/org/firebirdsql/gds/ng/FbBatch.java b/src/main/org/firebirdsql/gds/ng/FbBatch.java index d2a82b7487..46962188ab 100644 --- a/src/main/org/firebirdsql/gds/ng/FbBatch.java +++ b/src/main/org/firebirdsql/gds/ng/FbBatch.java @@ -2,6 +2,7 @@ import org.firebirdsql.gds.BlobParameterBuffer; +import org.firebirdsql.gds.ng.fields.RowValue; import org.firebirdsql.gds.ng.listeners.ExceptionListenable; import java.io.IOException; @@ -30,10 +31,15 @@ public interface FbBatch extends ExceptionListenable { FbDatabase getDatabase(); /** - * Add data in this batch. + * Add data to this batch. */ void addBatch() throws SQLException; + /** + * Add a row to this batch. + */ + void addBatch(RowValue rowValue) throws SQLException; + /** * Add existing blob in this batch. */ @@ -109,4 +115,6 @@ public interface FbBatch extends ExceptionListenable { * @return The statement that contains prepared fields info. */ FbStatement getStatement() throws SQLException; + + void release() throws SQLException; } diff --git a/src/main/org/firebirdsql/gds/ng/FbBatchCompletionState.java b/src/main/org/firebirdsql/gds/ng/FbBatchCompletionState.java index b23b958498..00ec791859 100644 --- a/src/main/org/firebirdsql/gds/ng/FbBatchCompletionState.java +++ b/src/main/org/firebirdsql/gds/ng/FbBatchCompletionState.java @@ -39,7 +39,12 @@ public interface FbBatchCompletionState { String printAllStates() throws SQLException; /** - * @return Returns a array with the result of all statements. + * @return Returns an array with the result of all statements. */ int[] getAllStates() throws SQLException; + + /** + * @return a result of a batch execution. + */ + BatchCompletion getBatchCompletion() throws SQLException; } diff --git a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IBatchImplTest.java b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IBatchImplTest.java index 933e3e2668..a282449be7 100644 --- a/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IBatchImplTest.java +++ b/src/nativeoo-test/org/firebirdsql/nativeoo/gds/ng/IBatchImplTest.java @@ -9,6 +9,7 @@ import org.firebirdsql.gds.ng.*; import org.firebirdsql.gds.ng.fields.RowValue; import org.firebirdsql.gds.ng.wire.SimpleStatementListener; +import org.firebirdsql.jaybird.fb.constants.BatchItems; import org.firebirdsql.jdbc.FBBlob; import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Test; @@ -132,7 +133,7 @@ protected FbDatabase createDatabase() throws SQLException { @Test public void testSingleExecuteBatchWithoutBlobs() throws SQLException { allocateTransaction(); - BatchParameterBuffer buffer = new BatchParameterBufferImpl(); + BatchParameterBuffer buffer = new BatchParameterBufferImp(); buffer.addArgument(FbInterface.IBatch.TAG_RECORD_COUNTS, 1); IBatchImpl batch = (IBatchImpl) db.createBatch(transaction, INSERT_QUERY_WITHOUT_BLOBS, buffer); @@ -282,12 +283,12 @@ public void testSingleExecuteBatchWithoutBlobs() throws SQLException { @Test public void testSingleExecuteBatchWithBlobs() throws Exception { allocateTransaction(); - BatchParameterBuffer buffer = new BatchParameterBufferImpl(); + BatchParameterBuffer buffer = new BatchParameterBufferImp(); buffer.addArgument(FbInterface.IBatch.TAG_RECORD_COUNTS, 1); // continue batch processing in case of errors in some messages - buffer.addArgument(BatchParameterBuffer.TAG_MULTIERROR, 1); + buffer.addArgument(BatchItems.TAG_MULTIERROR, 1); // enable blobs processing - IDs generated by firebird engine - buffer.addArgument(BatchParameterBuffer.TAG_BLOB_POLICY, BatchParameterBuffer.BLOB_ID_ENGINE); + buffer.addArgument(BatchItems.TAG_BLOB_POLICY, BatchItems.BLOB_ID_ENGINE); IBatchImpl batch = (IBatchImpl) db.createBatch(transaction, INSERT_QUERY_WITH_BLOBS, buffer); int testInteger = 42; @@ -451,8 +452,8 @@ public void testSingleExecuteBatchWithBlobs() throws Exception { @Test public void testMultipleMessagesBatchWithoutBlobs() throws SQLException { allocateTransaction(); - BatchParameterBuffer buffer = new BatchParameterBufferImpl(); - buffer.addArgument(BatchParameterBuffer.TAG_RECORD_COUNTS, 1); + BatchParameterBuffer buffer = new BatchParameterBufferImp(); + buffer.addArgument(BatchItems.TAG_RECORD_COUNTS, 1); IBatchImpl batch = (IBatchImpl) db.createBatch(transaction, INSERT_QUERY_WITHOUT_BLOBS, buffer); int testInteger = 42; @@ -641,12 +642,12 @@ public void testMultipleMessagesBatchWithoutBlobs() throws SQLException { @Test public void testMultipleMessagesBatchWithBlobs() throws Exception { allocateTransaction(); - BatchParameterBuffer buffer = new BatchParameterBufferImpl(); + BatchParameterBuffer buffer = new BatchParameterBufferImp(); buffer.addArgument(FbInterface.IBatch.TAG_RECORD_COUNTS, 1); // continue batch processing in case of errors in some messages - buffer.addArgument(BatchParameterBuffer.TAG_MULTIERROR, 1); + buffer.addArgument(BatchItems.TAG_MULTIERROR, 1); // enable blobs processing - IDs generated by firebird engine - buffer.addArgument(BatchParameterBuffer.TAG_BLOB_POLICY, BatchParameterBuffer.BLOB_ID_ENGINE); + buffer.addArgument(BatchItems.TAG_BLOB_POLICY, BatchItems.BLOB_ID_ENGINE); IBatchImpl batch = (IBatchImpl) db.createBatch(transaction, INSERT_QUERY_WITH_BLOBS, buffer); int testInteger = 42; @@ -860,9 +861,9 @@ public void testMultipleMessagesBatchWithBlobs() throws Exception { @Test public void testBatchWithBlobStream() throws Exception { allocateTransaction(); - BatchParameterBuffer buffer = new BatchParameterBufferImpl(); + BatchParameterBuffer buffer = new BatchParameterBufferImp(); // Blobs are placed in a stream - buffer.addArgument(BatchParameterBuffer.TAG_BLOB_POLICY, BatchParameterBuffer.BLOB_STREAM); + buffer.addArgument(BatchItems.TAG_BLOB_POLICY, BatchItems.BLOB_STREAM); IBatchImpl batch = (IBatchImpl) db.createBatch(transaction, INSERT_QUERY_ONLY_BLOBS, buffer); GDSHelper h = new GDSHelper(db); @@ -921,9 +922,9 @@ public void testBatchWithBlobStream() throws Exception { @Test public void testBatchWithSegmentedBlobs() throws Exception { allocateTransaction(); - BatchParameterBuffer buffer = new BatchParameterBufferImpl(); + BatchParameterBuffer buffer = new BatchParameterBufferImp(); // Blobs are placed in a stream - buffer.addArgument(BatchParameterBuffer.TAG_BLOB_POLICY, BatchParameterBuffer.BLOB_STREAM); + buffer.addArgument(BatchItems.TAG_BLOB_POLICY, BatchItems.BLOB_STREAM); FbBatch batch = db.createBatch(transaction, INSERT_QUERY_ONLY_BLOBS, buffer); GDSHelper h = new GDSHelper(db); @@ -1002,9 +1003,9 @@ public void testBatchWithSegmentedBlobs() throws Exception { @Test public void testMultipleMessagesBatchWithSegmentedBlobs() throws Exception { allocateTransaction(); - BatchParameterBuffer buffer = new BatchParameterBufferImpl(); + BatchParameterBuffer buffer = new BatchParameterBufferImp(); // Blobs are placed in a stream - buffer.addArgument(BatchParameterBuffer.TAG_BLOB_POLICY, BatchParameterBuffer.BLOB_STREAM); + buffer.addArgument(BatchItems.TAG_BLOB_POLICY, BatchItems.BLOB_STREAM); FbBatch batch = db.createBatch(transaction, INSERT_QUERY_ONLY_BLOBS, buffer); GDSHelper h = new GDSHelper(db); @@ -1140,9 +1141,9 @@ public void testMultipleMessagesBatchWithSegmentedBlobs() throws Exception { @Test public void testBatchWithRegisteredBlobs() throws Exception { allocateTransaction(); - BatchParameterBuffer buffer = new BatchParameterBufferImpl(); + BatchParameterBuffer buffer = new BatchParameterBufferImp(); // Blobs are placed in a stream - buffer.addArgument(BatchParameterBuffer.TAG_BLOB_POLICY, BatchParameterBuffer.BLOB_STREAM); + buffer.addArgument(BatchItems.TAG_BLOB_POLICY, BatchItems.BLOB_STREAM); FbBatch batch = db.createBatch(transaction, INSERT_QUERY_ONLY_BLOBS, buffer); GDSHelper h = new GDSHelper(db); @@ -1206,7 +1207,7 @@ public void testBatchWithRegisteredBlobs() throws Exception { @Test public void testBatchWithNulls() throws Exception { allocateTransaction(); - BatchParameterBuffer buffer = new BatchParameterBufferImpl(); + BatchParameterBuffer buffer = new BatchParameterBufferImp(); buffer.addArgument(FbInterface.IBatch.TAG_RECORD_COUNTS, 1); IBatchImpl batch = (IBatchImpl) db.createBatch(transaction, INSERT_QUERY_WITHOUT_BLOBS, buffer); @@ -1265,10 +1266,10 @@ public void testBatchWithNulls() throws Exception { @Test public void testBatchWithBlobNulls() throws Exception { allocateTransaction(); - BatchParameterBuffer buffer = new BatchParameterBufferImpl(); + BatchParameterBuffer buffer = new BatchParameterBufferImp(); buffer.addArgument(FbInterface.IBatch.TAG_RECORD_COUNTS, 1); - buffer.addArgument(BatchParameterBuffer.TAG_MULTIERROR, 1); - buffer.addArgument(BatchParameterBuffer.TAG_BLOB_POLICY, BatchParameterBuffer.BLOB_ID_ENGINE); + buffer.addArgument(BatchItems.TAG_MULTIERROR, 1); + buffer.addArgument(BatchItems.TAG_BLOB_POLICY, BatchItems.BLOB_ID_ENGINE); IBatchImpl batch = (IBatchImpl) db.createBatch(transaction, INSERT_QUERY_WITH_BLOBS, buffer); int testInteger = 42; diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/AbstractNativeConnection.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/AbstractNativeConnection.java index 537ed5990d..a8050dea49 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/AbstractNativeConnection.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/AbstractNativeConnection.java @@ -53,7 +53,8 @@ public abstract class AbstractNativeConnection, C * @param attachProperties Attach properties * @param encodingFactory Encoding factory */ - protected AbstractNativeConnection(FbClientLibrary clientLibrary, T attachProperties, IEncodingFactory encodingFactory) + protected AbstractNativeConnection(FbClientLibrary clientLibrary, T attachProperties, + IEncodingFactory encodingFactory) throws SQLException { super(attachProperties, encodingFactory); this.clientLibrary = requireNonNull(clientLibrary, "parameter clientLibrary cannot be null"); @@ -139,11 +140,13 @@ private void processVector(long[] errorVector, boolean debug, FbExceptionBuilder case isc_arg_sql_state: long stringPointerAddress = errorVector[vectorIndex++]; if (stringPointerAddress == 0L) { - log.warn("Received NULL pointer address for isc_arg_interpreted, isc_arg_string or isc_arg_sql_state"); + log.warn("Received NULL pointer address for isc_arg_interpreted, isc_arg_string or " + + "isc_arg_sql_state"); break processingLoop; } Pointer stringPointer = new Pointer(stringPointerAddress); - String stringValue = stringPointer.getString(0, getEncodingDefinition().getJavaEncodingName()); + String stringValue = stringPointer.getString(0, + getEncodingDefinition().getJavaEncodingName()); if (arg != isc_arg_sql_state) { if (debug) log.debug("readStatusVector string: " + stringValue); builder.messageParameter(stringValue); diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/CloseableMemory.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/CloseableMemory.java index 792905f5d0..07b9d12045 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/CloseableMemory.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/CloseableMemory.java @@ -12,9 +12,4 @@ public class CloseableMemory extends Memory implements AutoCloseable { public CloseableMemory(long size) { super(size); } - - @Override - public void close() { - dispose(); - } } diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IBatchCompletionStateImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IBatchCompletionStateImpl.java index fec8175758..2a0fbb769c 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IBatchCompletionStateImpl.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IBatchCompletionStateImpl.java @@ -1,11 +1,14 @@ package org.firebirdsql.nativeoo.gds.ng; +import org.firebirdsql.gds.ng.BatchCompletion; import org.firebirdsql.gds.ng.FbBatchCompletionState; import org.firebirdsql.nativeoo.gds.ng.FbInterface.IBatchCompletionState; import org.firebirdsql.nativeoo.gds.ng.FbInterface.IStatus; import org.firebirdsql.nativeoo.gds.ng.FbInterface.IUtil; import java.sql.SQLException; +import java.util.*; +import java.util.stream.IntStream; /** * Implementation of {@link org.firebirdsql.gds.ng.FbBatchCompletionState} for native batch execution. @@ -15,10 +18,9 @@ */ public class IBatchCompletionStateImpl implements FbBatchCompletionState { - private IBatchCompletionState state; - private IDatabaseImpl database; - private IUtil util; - private IStatus status; + private final IBatchCompletionState state; + private final IDatabaseImpl database; + private final IStatus status; public IBatchCompletionStateImpl(IDatabaseImpl database, IBatchCompletionState state, IStatus status) { this.database = database; @@ -42,12 +44,14 @@ public int getState(int index) throws SQLException { @Override public String getError(int index) throws SQLException { - if (state.findError(status, index) != FbBatchCompletionState.NO_MORE_ERRORS) { + if (state.findError(status, index) != NO_MORE_ERRORS) { StringBuilder builder = new StringBuilder(); IStatus errorStatus = database.getMaster().getStatus(); state.getStatus(getStatus(), errorStatus, index); processStatus(); + final IUtil util = database.getMaster().getUtilInterface(); + try (CloseableMemory memory = new CloseableMemory(1024)) { util.formatStatus(memory, (int) memory.size() - 1, errorStatus); builder.append(memory.getString(0, getDatabase().getEncoding().getCharsetName())); @@ -59,13 +63,12 @@ public String getError(int index) throws SQLException { @Override public String printAllStates() throws SQLException { - StringBuilder builder = new StringBuilder(); boolean print1 = false; boolean print2 = false; - util = database.getMaster().getUtilInterface(); + final IUtil util = database.getMaster().getUtilInterface(); int updateCount = state.getSize(getStatus()); processStatus(); @@ -75,21 +78,21 @@ public String printAllStates() throws SQLException { int s = state.getState(getStatus(), p); processStatus(); switch (s) { - case FbBatchCompletionState.EXECUTE_FAILED: + case EXECUTE_FAILED: if (!print1) { - builder.append(String.format("Message Status\n", p)); + builder.append(String.format("Message Status %d\n", p)); print1 = true; } builder.append(String.format("%5d Execute failed\n", p)); break; - case FbBatchCompletionState.SUCCESS_NO_INFO: + case SUCCESS_NO_INFO: ++unknownCount; break; default: if (!print1) { - builder.append(String.format("Message Status\n", p)); + builder.append(String.format("Message Status %d\n", p)); print1 = true; } builder.append(String.format("%5d Updated %d record(s)\n", p, s)); @@ -101,7 +104,7 @@ public String printAllStates() throws SQLException { updateCount, successCount, unknownCount)); IStatus errorStatus = database.getMaster().getStatus(); - for (int p = 0; (p = state.findError(status, p)) != FbBatchCompletionState.NO_MORE_ERRORS; ++p) { + for (int p = 0; (p = state.findError(status, p)) != NO_MORE_ERRORS; ++p) { state.getStatus(getStatus(), errorStatus, p); processStatus(); @@ -109,7 +112,7 @@ public String printAllStates() throws SQLException { util.formatStatus(memory, (int) memory.size() - 1, errorStatus); if (!print2) { - builder.append(String.format("\nDetailed errors status:\n", p)); + builder.append(String.format("\nDetailed errors status %d:\n", p)); print2 = true; } builder.append(String.format("Message %d: %s\n", p, memory.getString(0, @@ -125,9 +128,6 @@ public String printAllStates() throws SQLException { @Override public int[] getAllStates() throws SQLException { - - util = database.getMaster().getUtilInterface(); - int updateCount = state.getSize(getStatus()); processStatus(); @@ -141,6 +141,64 @@ public int[] getAllStates() throws SQLException { return states; } + @Override + public BatchCompletion getBatchCompletion() throws SQLException { + final IUtil util = database.getMaster().getUtilInterface(); + + int elementCount = state.getSize(getStatus()); + processStatus(); + int updateCountsCount = 0; + int detailedErrorsCount = 0; + int simplifiedErrorsCount = 0; + + int[] updateCounts = new int[elementCount]; + int[] simplifiedErrors = new int[elementCount]; + + for (int p = 0; p < elementCount; ++p) { + int s = state.getState(getStatus(), p); + processStatus(); + switch (s) { + case EXECUTE_FAILED: + updateCounts[p] = s; + simplifiedErrors[p] = s; + updateCountsCount++; + simplifiedErrorsCount++; + break; + + case SUCCESS_NO_INFO: + updateCounts[p] = s; + updateCountsCount++; + break; + + default: + updateCounts[p] = s; + updateCountsCount++; + break; + } + } + + List detailedErrors = new ArrayList<>(); + IStatus errorStatus = database.getMaster().getStatus(); + for (int p = 0; (p = state.findError(status, p)) != NO_MORE_ERRORS; ++p) { + state.getStatus(getStatus(), errorStatus, p); + processStatus(); + + try (CloseableMemory memory = new CloseableMemory(1024)) { + util.formatStatus(memory, (int) memory.size() - 1, errorStatus); + detailedErrors.add(new BatchCompletion.DetailedError(p, new SQLException(memory.getString(0, + database.getEncoding().getCharsetName())))); + } + } + + if (errorStatus != null) + errorStatus.dispose(); + + updateCounts = Arrays.copyOf(updateCounts, updateCountsCount); + simplifiedErrors = Arrays.copyOf(simplifiedErrors, simplifiedErrorsCount); + + return new BatchCompletion(elementCount, updateCounts, detailedErrors, simplifiedErrors); + } + private IStatus getStatus() { status.init(); return status; diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IBatchImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IBatchImpl.java index 6e3bd13c04..88c32dd50b 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IBatchImpl.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IBatchImpl.java @@ -3,6 +3,7 @@ import com.sun.jna.ptr.LongByReference; import org.firebirdsql.gds.BatchParameterBuffer; import org.firebirdsql.gds.BlobParameterBuffer; +import org.firebirdsql.gds.ISCConstants; import org.firebirdsql.gds.impl.GDSHelper; import org.firebirdsql.gds.ng.AbstractFbBatch; import org.firebirdsql.gds.ng.FbBatchCompletionState; @@ -21,6 +22,8 @@ import java.io.IOException; import java.sql.SQLException; +import static org.firebirdsql.gds.ISCConstants.SQL_BLOB; + /** * Implementation of {@link org.firebirdsql.gds.ng.FbBatch} for native OO API. * @@ -38,7 +41,8 @@ public class IBatchImpl extends AbstractFbBatch { private IStatementImpl statement; private IMessageBuilderImpl messageBuilder; - public IBatchImpl(FbDatabase database, FbTransaction transaction, String statementText, FbMessageMetadata metadata, BatchParameterBuffer parameters) throws SQLException { + public IBatchImpl(FbDatabase database, FbTransaction transaction, String statementText, FbMessageMetadata metadata, + BatchParameterBuffer parameters) throws SQLException { super(database, parameters); this.transaction = transaction; this.attachment = getDatabase().getAttachment(); @@ -50,7 +54,8 @@ public IBatchImpl(FbDatabase database, FbTransaction transaction, String stateme init(); } - public IBatchImpl(FbDatabase database, FbTransaction transaction, String statementText, BatchParameterBuffer parameters) throws SQLException { + public IBatchImpl(FbDatabase database, FbTransaction transaction, String statementText, + BatchParameterBuffer parameters) throws SQLException { super(database, parameters); this.transaction = transaction; this.attachment = getDatabase().getAttachment(); @@ -70,6 +75,7 @@ public IBatchImpl(IBatch batch, IStatementImpl statement, BatchParameterBuffer p this.status = getDatabase().getStatus(); this.batch = batch; this.statement = statement; + this.metadata = (IMessageMetadataImpl) statement.getInputMetadata(); this.statementText = null; this.messageBuilder = new IMessageBuilderImpl(this); prepareBatch(); @@ -84,9 +90,11 @@ public IBatchImpl(IBatch batch, IStatementImpl statement, BatchParameterBuffer p private void init() throws SQLException { synchronized (getSynchronizationObject()) { if (metadata == null) { - statement = new IStatementImpl(getDatabase()); - statement.setTransaction(transaction); - statement.prepare(statementText); + if (statement == null) { + statement = new IStatementImpl(getDatabase()); + statement.setTransaction(transaction); + statement.prepare(statementText); + } metadata = (IMessageMetadataImpl) statement.getInputMetadata(); } final byte[] statementArray = getDatabase().getEncoding().encodeToCharset(statementText); @@ -131,6 +139,40 @@ public void addBatch() throws SQLException { } } + /** + * Build batch message from field values. + * + * @throws SQLException + */ + @Override + public void addBatch(RowValue fieldValues) throws SQLException { + for (int i = 0; i < fieldValues.getCount(); i++) { + messageBuilder.addData(i, fieldValues.getFieldData(i), getParameterDescriptor(i + 1)); + if (fieldValues.getFieldData(i) != null && getParameterDescriptor(i + 1).isFbType(SQL_BLOB)) { + long l = getParameterDescriptor(i + 1).getDatatypeCoder().decodeLong(fieldValues.getFieldData(i)); + LongByReference longByReference = new LongByReference(l); + LongByReference existLong = new LongByReference(l); + synchronized (getSynchronizationObject()) { + batch.registerBlob(getStatus(), existLong, longByReference); + processStatus(); + } + } + } + byte[] data = messageBuilder.getData(); + try (CloseableMemory memory = new CloseableMemory(data.length)) { + synchronized (getSynchronizationObject()) { + memory.write(0, data, 0, data.length); + batch.add(getStatus(), 1, memory); + processStatus(); + messageBuilder.clear(); + } + } + if (messageBuilder.getBlobStreamData().length != 0) { + addBlobStream(messageBuilder.getBlobStreamData()); + messageBuilder.clearBlobStream(); + } + } + @Override public void addBlob(int index, long blobId) throws SQLException { FBBlob tmpBlob = new FBBlob(new GDSHelper(getDatabase()), blobId); @@ -226,7 +268,8 @@ public void registerBlob(int index, long existingBlob, long blobId) throws SQLEx @Override public FbBatchCompletionState execute() throws SQLException { synchronized (getSynchronizationObject()) { - IBatchCompletionState execute = batch.execute(getStatus(), ((ITransactionImpl) transaction).getTransaction()); + IBatchCompletionState execute = batch.execute(getStatus(), ((ITransactionImpl) + transaction).getTransaction()); processStatus(); return new IBatchCompletionStateImpl(getDatabase(), execute, getDatabase().getStatus()); } @@ -267,6 +310,11 @@ public FbStatement getStatement() throws SQLException { return this.statement; } + @Override + public void release() throws SQLException { + batch.release(); + } + private IStatus getStatus() { status.init(); return status; diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IBlobImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IBlobImpl.java index 832562c1a6..d4efbff694 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IBlobImpl.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IBlobImpl.java @@ -103,8 +103,7 @@ public void open() throws SQLException { checkTransactionActive(); checkBlobClosed(); - IDatabaseImpl database = (IDatabaseImpl)getDatabase(); - IAttachment attachment = database.getAttachment(); + IAttachment attachment = getDatabase().getAttachment(); if (isOutput()) { blob = attachment.createBlob(getStatus(), ((ITransactionImpl)getTransaction()).getTransaction(), blobId, bpb.length, bpb); @@ -135,10 +134,9 @@ public byte[] getSegment(int sizeRequested) throws SQLException { .messageParameter(sizeRequested) .toSQLException(); } - // TODO Honour request for larger sizes by looping? sizeRequested = Math.min(sizeRequested, getMaximumSegmentSize()); final ByteBuffer responseBuffer; - final com.sun.jna.Pointer actualLength = new CloseableMemory(1024); + final CloseableMemory actualLength = new CloseableMemory(1024); synchronized (getSynchronizationObject()) { checkDatabaseAttached(); checkTransactionActive(); @@ -158,7 +156,7 @@ public byte[] getSegment(int sizeRequested) throws SQLException { } } final int actualLengthInt = actualLength.getInt(0) & 0xFFFF; - ((CloseableMemory) actualLength).close(); + actualLength.close(); final byte[] segment = new byte[actualLengthInt]; responseBuffer.get(segment); return segment; @@ -174,7 +172,6 @@ public void putSegment(byte[] segment) throws SQLException { if (segment.length == 0) { throw new FbExceptionBuilder().exception(jb_blobPutSegmentEmpty).toSQLException(); } - // TODO Handle by performing multiple puts? (Wrap in byte buffer, use position to move pointer?) if (segment.length > getMaximumSegmentSize()) { throw new FbExceptionBuilder().exception(jb_blobPutSegmentTooLong).toSQLException(); } diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IDatabaseImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IDatabaseImpl.java index b012f5ad16..9eae2d26d8 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IDatabaseImpl.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IDatabaseImpl.java @@ -271,13 +271,14 @@ public void executeImmediate(String statementText, FbTransaction transaction) th final byte[] statementArray = getEncoding().encodeToCharset(statementText); synchronized (getSynchronizationObject()) { if (attachment == null) { - attachment = util.executeCreateDatabase(getStatus(), statementArray.length, statementArray, - getConnectionDialect(), new boolean[]{false}); + attachment = util.executeCreateDatabase(getStatus(), statementArray.length, + statementArray, getConnectionDialect(), new boolean[]{false}); } else { attachment.execute(getStatus(), transaction != null ? ((ITransactionImpl) transaction).getTransaction() : attachment.startTransaction(getStatus(), 0, null), - statementArray.length, statementArray, getConnectionDialect(), null, null, + statementArray.length, + statementArray, getConnectionDialect(), null, null, null, null); } if (!isAttached()) { @@ -394,12 +395,14 @@ public void cancelEvent(EventHandle eventHandle) throws SQLException { } @Override - public FbBatch createBatch(FbTransaction transaction, String statement, FbMessageMetadata metadata, BatchParameterBuffer parameters) throws SQLException { + public FbBatch createBatch(FbTransaction transaction, String statement, FbMessageMetadata metadata, + BatchParameterBuffer parameters) throws SQLException { return new IBatchImpl(this, transaction, statement, metadata, parameters); } @Override - public FbBatch createBatch(FbTransaction transaction, String statement, BatchParameterBuffer parameters) throws SQLException { + public FbBatch createBatch(FbTransaction transaction, String statement, BatchParameterBuffer parameters) + throws SQLException { return new IBatchImpl(this, transaction, statement, parameters); } @@ -450,7 +453,7 @@ public IMaster getMaster() { } public IStatus getStatus() { - status.init(); + status.clear(); return status; } diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IMetadataBuilderImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IMetadataBuilderImpl.java index 4286ae2a6f..1fcc819328 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IMetadataBuilderImpl.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IMetadataBuilderImpl.java @@ -37,28 +37,21 @@ public class IMetadataBuilderImpl implements FbMetadataBuilder { private static final int SUBTYPE_NUMERIC = 1; private static final int SUBTYPE_DECIMAL = 2; - private IDatabaseImpl database; - private IMaster master; - private IStatus status; - private int fieldCount; - private IMetadataBuilder metadataBuilder; - private IMessageMetadata messageMetadata; + private final IDatabaseImpl database; + private final IStatus status; + private final IMetadataBuilder metadataBuilder; public IMetadataBuilderImpl(FbDatabase database, int fieldCount) throws SQLException { this.database = (IDatabaseImpl)database; - this.master = this.database.getMaster(); + IMaster master = this.database.getMaster(); this.status = this.database.getStatus(); - this.fieldCount = fieldCount; this.metadataBuilder = master.getMetadataBuilder(status, fieldCount); } @Override public FbMessageMetadata getMessageMetadata() throws SQLException { - messageMetadata = metadataBuilder.getMetadata(status); - IMessageMetadataImpl metadata = new IMessageMetadataImpl(this); - - return metadata; + return new IMessageMetadataImpl(this); } public IMetadataBuilder getMetadataBuilder() { @@ -102,7 +95,7 @@ public void addFloat(int index) throws SQLException { @Override public void addNumeric(int index, int size, int scale) throws SQLException { - int length = 0; + int length; if (size < 5) { metadataBuilder.setType(status, index, SQL_SHORT); length = 2; diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IStatementImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IStatementImpl.java index ec4ff56b1d..2e6f0da248 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IStatementImpl.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IStatementImpl.java @@ -4,20 +4,20 @@ import com.sun.jna.Pointer; import org.firebirdsql.gds.BatchParameterBuffer; import org.firebirdsql.gds.ISCConstants; -import org.firebirdsql.gds.JaybirdErrorCodes; import org.firebirdsql.gds.ng.AbstractFbStatement; +import org.firebirdsql.gds.ng.BatchCompletion; +import org.firebirdsql.gds.ng.DeferredResponse; import org.firebirdsql.gds.ng.FbBatch; +import org.firebirdsql.gds.ng.FbBatchConfig; +import org.firebirdsql.gds.ng.FbBatchCompletionState; import org.firebirdsql.gds.ng.FbExceptionBuilder; import org.firebirdsql.gds.ng.FbMessageMetadata; import org.firebirdsql.gds.ng.FbTransaction; import org.firebirdsql.gds.ng.OperationCloseHandle; import org.firebirdsql.gds.ng.StatementState; import org.firebirdsql.gds.ng.StatementType; -import org.firebirdsql.gds.ng.fields.FieldDescriptor; -import org.firebirdsql.gds.ng.fields.RowDescriptor; -import org.firebirdsql.gds.ng.fields.RowValue; -import org.firebirdsql.gds.ng.fields.RowValueBuilder; -import org.firebirdsql.gds.ng.jna.JnaDatabase; +import org.firebirdsql.gds.ng.fields.*; +import org.firebirdsql.gds.impl.BatchParameterBufferImp; import org.firebirdsql.jna.fbclient.XSQLVAR; import org.firebirdsql.logging.Logger; import org.firebirdsql.logging.LoggerFactory; @@ -33,6 +33,7 @@ import java.nio.ByteBuffer; import java.sql.SQLException; import java.sql.SQLNonTransientException; +import java.util.Collection; import static org.firebirdsql.gds.ng.TransactionHelper.checkTransactionActive; @@ -50,9 +51,9 @@ public class IStatementImpl extends AbstractFbStatement { private final IStatus status; private IStatement statement; private IResultSet cursor; - private IMessageMetadata inMeta; - private IMessageMetadata outMeta; - private ByteBuffer inMessage; + private IMessageMetadata inMetadata; + private IMessageMetadata outMetadata; + private FbBatch batch; public IStatementImpl(IDatabaseImpl database) { super(database.getSynchronizationObject()); @@ -98,35 +99,47 @@ public void prepare(String statementText) throws SQLException { final byte[] statementArray = getDatabase().getEncoding().encodeToCharset(statementText); synchronized (getSynchronizationObject()) { checkTransactionActive(getTransaction()); - final StatementState currentState = getState(); - if (!isPrepareAllowed(currentState)) { - throw new SQLNonTransientException(String.format("Current statement state (%s) does not allow call to prepare", currentState)); + final StatementState initialState = getState(); + if (!isPrepareAllowed(initialState)) { + throw new SQLNonTransientException(String.format( + "Current statement state (%s) does not allow call to prepare", initialState)); } resetAll(); - if (currentState == StatementState.NEW) { - // allocated when prepare call - switchState(StatementState.ALLOCATED); - setType(StatementType.NONE); + if (initialState == StatementState.NEW) { + try { + // allocated when prepare call + switchState(StatementState.ALLOCATED); + setType(StatementType.NONE); + } catch (SQLException e) { + forceState(StatementState.NEW); + throw e; + } } else { checkStatementValid(); } - ITransactionImpl transaction = (ITransactionImpl) getTransaction(); - statement = getDatabase().getAttachment().prepare(getStatus(), transaction.getTransaction(), - statementArray.length, statementArray, getDatabase().getConnectionDialect(), - IStatement.PREPARE_PREFETCH_METADATA); - processStatus(); - outMeta = statement.getOutputMetadata(getStatus()); - processStatus(); - inMeta = statement.getInputMetadata(getStatus()); - processStatus(); + switchState(StatementState.PREPARING); + try { + ITransactionImpl transaction = (ITransactionImpl) getTransaction(); + statement = getDatabase().getAttachment().prepare(getStatus(), transaction.getTransaction(), + statementArray.length, statementArray, getDatabase().getConnectionDialect(), + IStatement.PREPARE_PREFETCH_METADATA); + processStatus(); + outMetadata = statement.getOutputMetadata(getStatus()); + processStatus(); + inMetadata = statement.getInputMetadata(getStatus()); + processStatus(); - final byte[] statementInfoRequestItems = getStatementInfoRequestItems(); - final int responseLength = getDefaultSqlInfoSize(); - byte[] statementInfo = getSqlInfo(statementInfoRequestItems, responseLength); - parseStatementInfo(statementInfo); - switchState(StatementState.PREPARED); + final byte[] statementInfoRequestItems = getStatementInfoRequestItems(); + final int responseLength = getDefaultSqlInfoSize(); + byte[] statementInfo = getSqlInfo(statementInfoRequestItems, responseLength); + parseStatementInfo(statementInfo); + switchState(StatementState.PREPARED); + } catch (SQLException e) { + switchState(StatementState.ALLOCATED); + throw e; + } } } catch (SQLException e) { exceptionListenerDispatcher.errorOccurred(e); @@ -150,6 +163,11 @@ public void execute(RowValue parameters) throws SQLException { setMetaData(getParameterDescriptor(), parameters); + ByteBuffer inMessage = ByteBuffer.allocate(inMetadata.getMessageLength(getStatus())); + processStatus(); + + setDataToBuffer(getParameterDescriptor(), parameters, inMessage); + final StatementType statementType = getType(); final boolean hasSingletonResult = hasSingletonResult(); ITransactionImpl transaction = (ITransactionImpl) getTransaction(); @@ -169,12 +187,14 @@ public void execute(RowValue parameters) throws SQLException { throw FbExceptionBuilder.forException(ISCConstants.isc_cancelled).toFlatSQLException(); } if ((statement.getFlags(getStatus()) & IStatement.FLAG_HAS_CURSOR) == IStatement.FLAG_HAS_CURSOR) { - cursor = statement.openCursor(getStatus(), transaction.getTransaction(), inMeta, inPtr, outMeta, 0); + cursor = statement.openCursor(getStatus(), transaction.getTransaction(), inMetadata, inPtr, + outMetadata, 0); } else { ByteBuffer outMessage = ByteBuffer.allocate(getMaxSqlInfoSize()); outPtr = new Memory(outMessage.array().length); outPtr.write(0, outMessage.array(), 0, outMessage.array().length); - statement.execute(getStatus(), transaction.getTransaction(), inMeta, inPtr, outMeta, outPtr); + statement.execute(getStatus(), transaction.getTransaction(), inMetadata, inPtr, outMetadata, + outPtr); } if (hasSingletonResult) { @@ -183,7 +203,7 @@ public void execute(RowValue parameters) throws SQLException { */ statementListenerDispatcher.statementExecuted(this, false, true); processStatus(); - queueRowData(toRowValue(getRowDescriptor(), outMeta, outPtr)); + queueRowData(toRowValue(getRowDescriptor(), outMetadata, outPtr)); setAfterLast(); } else { // A normal execute is never a singleton result (even if it only produces a single result) @@ -209,146 +229,65 @@ protected void setMetaData(final RowDescriptor rowDescriptor, final RowValue par IMaster master = database.getMaster(); IMetadataBuilder metadataBuilder = master.getMetadataBuilder(getStatus(), parameters.getCount()); - // We will be sure that we have enough memory for message - inMessage = ByteBuffer.allocate(Short.MAX_VALUE); processStatus(); - int offset = 0; - byte[] nullShort = new byte[]{-1, -1}; - byte[] notNullShort = new byte[]{0, 0}; - int shift; - // Values must be aligned, otherwise, data will be lost - int alignment = inMeta.getAlignment(status); for (int idx = 0; idx < parameters.getCount(); idx++) { byte[] fieldData = parameters.getFieldData(idx); final FieldDescriptor fieldDescriptor = rowDescriptor.getFieldDescriptor(idx); if (fieldData == null) { - // clear status - getStatus(); - int nullOffset = inMeta.getNullOffset(status, idx); - processStatus(); - // clear status - getStatus(); - int length = inMeta.getLength(status, idx); - processStatus(); - if (offset != 0) - offset += offset % alignment; - inMessage.position(offset); - offset += length; - inMessage.position(nullOffset); - inMessage.put(nullShort); - offset += nullShort.length; - inMessage.position(offset); // Although we pass a null value, length and type must still be specified - metadataBuilder.setType(status, idx, inMeta.getType(status, idx) | 1); - metadataBuilder.setLength(status, idx, inMeta.getLength(status, idx)); - metadataBuilder.setCharSet(status, idx, inMeta.getCharSet(status, idx)); + metadataBuilder.setType(getStatus(), idx, inMetadata.getType(getStatus(), idx) | 1); + metadataBuilder.setLength(getStatus(), idx, inMetadata.getLength(getStatus(), idx)); + metadataBuilder.setCharSet(getStatus(), idx, inMetadata.getCharSet(getStatus(), idx)); } else { - // clear status - getStatus(); - shift = (fieldData.length ^ alignment) & 1; - inMessage.position(offset); - if (fieldDescriptor.isVarying()) { - int length = Math.min(fieldDescriptor.getLength(), fieldData.length); - metadataBuilder.setType(status, idx, ISCConstants.SQL_VARYING + 1); - metadataBuilder.setLength(status, idx, length); - metadataBuilder.setCharSet(status, idx, inMeta.getCharSet(status, idx)); - byte[] encodeShort = fieldDescriptor.getDatatypeCoder().encodeShort(fieldData.length); - inMessage.put(encodeShort); - offset += encodeShort.length; - inMessage.position(offset); - } else if (fieldDescriptor.isFbType(ISCConstants.SQL_TEXT)) { - metadataBuilder.setType(status, idx, ISCConstants.SQL_TEXT + 1); - metadataBuilder.setLength(status, idx, Math.min(fieldDescriptor.getLength(), fieldData.length)); - metadataBuilder.setCharSet(status, idx, inMeta.getCharSet(status, idx)); - } else if (fieldDescriptor.isFbType(ISCConstants.SQL_BLOB)) { - if (offset != 0) - offset += offset % alignment; - inMessage.position(offset); - metadataBuilder.setType(status, idx, ISCConstants.SQL_BLOB + 1); - metadataBuilder.setLength(status, idx, inMeta.getLength(status, idx)); - metadataBuilder.setCharSet(status, idx, inMeta.getCharSet(status, idx)); - } else if (fieldDescriptor.isFbType(ISCConstants.SQL_TYPE_TIME)) { - if (offset != 0) - offset += offset % alignment; - inMessage.position(offset); - metadataBuilder.setType(status, idx, ISCConstants.SQL_TYPE_TIME + 1); - metadataBuilder.setLength(status, idx, inMeta.getLength(status, idx)); - metadataBuilder.setCharSet(status, idx, inMeta.getCharSet(status, idx)); - } else if (fieldDescriptor.isFbType(ISCConstants.SQL_TIMESTAMP)) { - if (offset != 0) - offset += offset % alignment; - inMessage.position(offset); - metadataBuilder.setType(status, idx, ISCConstants.SQL_TIMESTAMP + 1); - metadataBuilder.setLength(status, idx, inMeta.getLength(status, idx)); - metadataBuilder.setCharSet(status, idx, inMeta.getCharSet(status, idx)); - } else if (fieldDescriptor.isFbType(ISCConstants.SQL_INT64)) { - metadataBuilder.setType(status, idx, ISCConstants.SQL_INT64); - metadataBuilder.setLength(status, idx, inMeta.getLength(status, idx)); - metadataBuilder.setScale(status, idx, inMeta.getScale(status, idx)); - metadataBuilder.setCharSet(status, idx, inMeta.getCharSet(status, idx)); - if (offset != 0) - offset += offset % alignment; - inMessage.position(offset); - } else if (fieldDescriptor.isFbType(ISCConstants.SQL_INT128)) { - metadataBuilder.setType(status, idx, ISCConstants.SQL_INT128); - metadataBuilder.setLength(status, idx, inMeta.getLength(status, idx)); - metadataBuilder.setScale(status, idx, inMeta.getScale(status, idx)); - metadataBuilder.setCharSet(status, idx, inMeta.getCharSet(status, idx)); - byte[] encodeShort = fieldDescriptor.getDatatypeCoder().encodeShort(fieldData.length); - inMessage.put(encodeShort); - offset += encodeShort.length; - if (offset != 0) - offset += offset % alignment; - inMessage.position(offset); - } else if (fieldDescriptor.isFbType(ISCConstants.SQL_DEC16)) { - metadataBuilder.setType(status, idx, ISCConstants.SQL_DEC16); - metadataBuilder.setLength(status, idx, inMeta.getLength(status, idx)); - metadataBuilder.setScale(status, idx, inMeta.getScale(status, idx)); - metadataBuilder.setCharSet(status, idx, inMeta.getCharSet(status, idx)); - byte[] encodeShort = fieldDescriptor.getDatatypeCoder().encodeShort(fieldData.length); - inMessage.put(encodeShort); - offset += encodeShort.length; - if (offset != 0) - offset += offset % alignment; - inMessage.position(offset); - } else if (fieldDescriptor.isFbType(ISCConstants.SQL_DEC34)) { - metadataBuilder.setType(status, idx, ISCConstants.SQL_DEC34); - metadataBuilder.setLength(status, idx, inMeta.getLength(status, idx)); - metadataBuilder.setScale(status, idx, inMeta.getScale(status, idx)); - metadataBuilder.setCharSet(status, idx, inMeta.getCharSet(status, idx)); - byte[] encodeShort = fieldDescriptor.getDatatypeCoder().encodeShort(fieldData.length); - inMessage.put(encodeShort); - offset += encodeShort.length; - if (offset != 0) - offset += offset % alignment; - inMessage.position(offset); - } else if (fieldDescriptor.isFbType(ISCConstants.SQL_BOOLEAN)) { - inMessage.position(offset); - metadataBuilder.setType(status, idx, ISCConstants.SQL_BOOLEAN); - metadataBuilder.setLength(status, idx, inMeta.getLength(status, idx)); - metadataBuilder.setCharSet(status, idx, 0); + if (fieldDescriptor.isVarying() || fieldDescriptor.isFbType(ISCConstants.SQL_TEXT)) { + metadataBuilder.setType(getStatus(), idx, inMetadata.getType(getStatus(), idx) | 1); + metadataBuilder.setLength(getStatus(), idx, Math.min(fieldDescriptor.getLength(), fieldData.length)); + metadataBuilder.setCharSet(getStatus(), idx, inMetadata.getCharSet(getStatus(), idx)); } else { - if (offset % alignment != 0) - offset += offset % alignment; - inMessage.position(offset); - metadataBuilder.setType(status, idx, inMeta.getType(status, idx) | 1); - metadataBuilder.setLength(status, idx, inMeta.getLength(status, idx)); - metadataBuilder.setCharSet(status, idx, 0); + metadataBuilder.setType(getStatus(), idx, inMetadata.getType(getStatus(), idx) | 1); + metadataBuilder.setLength(getStatus(), idx, inMetadata.getLength(getStatus(), idx)); + metadataBuilder.setScale(getStatus(), idx, inMetadata.getScale(getStatus(), idx)); + metadataBuilder.setCharSet(getStatus(), idx, inMetadata.getCharSet(getStatus(), idx)); } - inMessage.put(fieldData); - offset += fieldData.length; - if (offset + shift < inMessage.limit()) - offset += shift; - inMessage.position(offset); - inMessage.put(notNullShort); } - offset += notNullShort.length; } - inMeta = metadataBuilder.getMetadata(getStatus()); + inMetadata = metadataBuilder.getMetadata(getStatus()); processStatus(); metadataBuilder.release(); } + private void setDataToBuffer(RowDescriptor rowDescriptor, RowValue parameters, ByteBuffer inMessage) { + final byte[] nulls = new byte[] {0, 0}; + + for (int index = 0; index < parameters.getCount(); index++) { + byte[] data = parameters.getFieldData(index); + final FieldDescriptor fieldDescriptor = rowDescriptor.getFieldDescriptor(index); + int nullOffset = inMetadata.getNullOffset(getStatus(), index); + int offset = inMetadata.getOffset(getStatus(), index); + + if (fieldDescriptor.isVarying()) { + byte[] dataLen; + if (data == null) + dataLen = fieldDescriptor.getDatatypeCoder().encodeShort(0); + else + dataLen = fieldDescriptor.getDatatypeCoder().encodeShort(data.length); + inMessage.position(offset); + inMessage.put(dataLen); + offset += dataLen.length; + } + + inMessage.position(offset); + if (data == null) { + inMessage.position(nullOffset); + inMessage.put(fieldDescriptor.getDatatypeCoder().encodeShort(1)); + } else { + inMessage.put(data); + inMessage.position(nullOffset); + inMessage.put(nulls); + } + } + } + @Override public void fetchRows(int fetchSize) throws SQLException { try { @@ -365,13 +304,13 @@ public void fetchRows(int fetchSize) throws SQLException { throw FbExceptionBuilder.forException(ISCConstants.isc_cancelled).toFlatSQLException(); } - ByteBuffer message = ByteBuffer.allocate(outMeta.getMessageLength(getStatus()) + 1); + ByteBuffer message = ByteBuffer.allocate(outMetadata.getMessageLength(getStatus()) + 1); processStatus(); Pointer ptr = new Memory(message.array().length); int fetchStatus = cursor.fetchNext(getStatus(), ptr); processStatus(); if (fetchStatus == IStatus.RESULT_OK) { - queueRowData(toRowValue(getRowDescriptor(), outMeta, ptr)); + queueRowData(toRowValue(getRowDescriptor(), outMetadata, ptr)); } else if (fetchStatus == IStatus.RESULT_NO_DATA) { setAfterLast(); // Note: we are not explicitly 'closing' the cursor here @@ -458,6 +397,112 @@ public void setCursorName(String cursorName) throws SQLException { } } + @Override + public boolean supportBatchUpdates() { + return true; + } + + @Override + public BatchParameterBuffer createBatchParameterBuffer() throws SQLException { + checkStatementValid(); + return new BatchParameterBufferImp(); + } + + @Override + public void deferredBatchCreate(FbBatchConfig batchConfig, DeferredResponse onResponse) throws SQLException { + try { + synchronized (getSynchronizationObject()) { + checkStatementValid(); + try { + BatchParameterBuffer batchPb = createBatchParameterBuffer(); + batchConfig.populateBatchParameterBuffer(batchPb); + batch = createBatch(batchPb); + } catch (SQLException e) { + switchState(StatementState.ERROR); + throw e; + } + } + } catch (SQLException e) { + exceptionListenerDispatcher.errorOccurred(e); + throw e; + } + } + + @Override + public void deferredBatchSend(Collection rowValues, DeferredResponse onResponse) throws SQLException { + try { + synchronized (getSynchronizationObject()) { + checkStatementValid(); + try { + for (RowValue rowValue : rowValues) { + batch.addBatch(rowValue); + } + } catch (SQLException e) { + switchState(StatementState.ERROR); + throw e; + } + } + } catch (SQLException e) { + exceptionListenerDispatcher.errorOccurred(e); + throw e; + } + } + + @Override + public BatchCompletion batchExecute() throws SQLException { + try { + synchronized (getSynchronizationObject()) { + checkStatementValid(); + try { + FbBatchCompletionState state = batch.execute(); + return state.getBatchCompletion(); + } catch (SQLException e) { + switchState(StatementState.ERROR); + throw e; + } + } + } catch (SQLException e) { + exceptionListenerDispatcher.errorOccurred(e); + throw e; + } + } + + @Override + public void batchCancel() throws SQLException { + try { + synchronized (getSynchronizationObject()) { + try { + batch.cancel(); + } catch (SQLException e) { + switchState(StatementState.ERROR); + throw FbExceptionBuilder.forException(ISCConstants.isc_net_read_err).cause(e) + .toSQLException(); + } + } + } catch (SQLException e) { + exceptionListenerDispatcher.errorOccurred(e); + throw e; + } + } + + @Override + public void deferredBatchRelease(DeferredResponse onResponse) throws SQLException { + try { + synchronized (getSynchronizationObject()) { + checkStatementValid(); + try { + batch.release(); + } catch (SQLException e) { + switchState(StatementState.ERROR); + throw e; + } + } + } catch (SQLException e) { + exceptionListenerDispatcher.errorOccurred(e); + throw e; + } + } + @Override public RowDescriptor emptyRowDescriptor() { return database.emptyRowDescriptor(); @@ -466,12 +511,12 @@ public RowDescriptor emptyRowDescriptor() { @Override public FbBatch createBatch(BatchParameterBuffer parameters) throws SQLException { IBatch batch = statement.createBatch(getStatus(), - inMeta, parameters.toBytesWithType().length, parameters.toBytesWithType()); + inMetadata, parameters.toBytesWithType().length, parameters.toBytesWithType()); return new IBatchImpl(batch, this, parameters); } public FbMessageMetadata getInputMetadata() throws SQLException { - return new IMessageMetadataImpl(database, inMeta); + return new IMessageMetadataImpl(database, inMetadata); } private IStatus getStatus() { diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/NativeDatabaseConnection.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/NativeDatabaseConnection.java index 48b01d3dba..5ccbe1c510 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/NativeDatabaseConnection.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/NativeDatabaseConnection.java @@ -37,7 +37,8 @@ public NativeDatabaseConnection(FbClientLibrary clientLibrary, IConnectionProper * @param attachProperties Attach properties * @param encodingFactory */ - protected NativeDatabaseConnection(FbClientLibrary clientLibrary, IConnectionProperties attachProperties, IEncodingFactory encodingFactory) throws SQLException { + protected NativeDatabaseConnection(FbClientLibrary clientLibrary, IConnectionProperties attachProperties, + IEncodingFactory encodingFactory) throws SQLException { super(clientLibrary, attachProperties, encodingFactory); } diff --git a/src/test/org/firebirdsql/gds/ng/AbstractBatchTest.java b/src/test/org/firebirdsql/gds/ng/AbstractBatchTest.java index ce596740e6..54359804c3 100644 --- a/src/test/org/firebirdsql/gds/ng/AbstractBatchTest.java +++ b/src/test/org/firebirdsql/gds/ng/AbstractBatchTest.java @@ -4,7 +4,8 @@ import org.firebirdsql.common.FBTestProperties; import org.firebirdsql.common.extension.UsesDatabaseExtension; import org.firebirdsql.gds.BatchParameterBuffer; -import org.firebirdsql.gds.impl.BatchParameterBufferImpl; +import org.firebirdsql.gds.impl.BatchParameterBufferImp; +import org.firebirdsql.jaybird.fb.constants.BatchItems; import org.firebirdsql.jdbc.FirebirdConnection; import org.firebirdsql.management.FBManager; import org.firebirdsql.util.FirebirdSupportInfo; @@ -186,8 +187,8 @@ public static FirebirdConnection getConnectionViaDriverManager() throws SQLExcep @Test public void testCreateBatchWithoutMetadata() throws SQLException { allocateTransaction(); - BatchParameterBuffer buffer = new BatchParameterBufferImpl(); - buffer.addArgument(BatchParameterBuffer.TAG_RECORD_COUNTS, 1); + BatchParameterBuffer buffer = new BatchParameterBufferImp(); + buffer.addArgument(BatchItems.TAG_RECORD_COUNTS, 1); FbBatch batch = db.createBatch(transaction, INSERT_QUERY, buffer); } @@ -230,8 +231,8 @@ public void testCreateBatchWithMetadata() throws SQLException { metadataBuilder.addDecDecimal(25, 30, 5); } - BatchParameterBuffer buffer = new BatchParameterBufferImpl(); - buffer.addArgument(BatchParameterBuffer.TAG_RECORD_COUNTS, 1); + BatchParameterBuffer buffer = new BatchParameterBufferImp(); + buffer.addArgument(BatchItems.TAG_RECORD_COUNTS, 1); FbBatch batch = db.createBatch(transaction, INSERT_QUERY, metadataBuilder.getMessageMetadata(), buffer); } From a57ca08728da45b1b97fd095964c15da66fe80fb Mon Sep 17 00:00:00 2001 From: Vasiliy Yashkov Date: Mon, 12 Sep 2022 18:31:53 +0300 Subject: [PATCH 08/12] Use `ReentrantLock` instead of synchronized object for native OO API implementations --- .../firebirdsql/gds/ng/AbstractFbBatch.java | 10 +- .../nativeoo/gds/ng/IBatchImpl.java | 26 +- .../nativeoo/gds/ng/IBlobImpl.java | 49 ++-- .../nativeoo/gds/ng/IDatabaseImpl.java | 45 ++- .../nativeoo/gds/ng/IServiceImpl.java | 9 +- .../nativeoo/gds/ng/IStatementImpl.java | 274 +++++++++--------- .../nativeoo/gds/ng/ITransactionImpl.java | 63 ++-- 7 files changed, 226 insertions(+), 250 deletions(-) diff --git a/src/main/org/firebirdsql/gds/ng/AbstractFbBatch.java b/src/main/org/firebirdsql/gds/ng/AbstractFbBatch.java index 1296e6c946..e3b231ab6f 100644 --- a/src/main/org/firebirdsql/gds/ng/AbstractFbBatch.java +++ b/src/main/org/firebirdsql/gds/ng/AbstractFbBatch.java @@ -35,7 +35,6 @@ public abstract class AbstractFbBatch implements FbBatch { "This method is only supported on Statement and not supported on PreparedStatement and CallableStatement"; private static final String UNICODE_STREAM_NOT_SUPPORTED = "Unicode stream not supported."; - private final Object syncObject; protected final ExceptionListenerDispatcher exceptionListenerDispatcher = new ExceptionListenerDispatcher(this); private final BatchParameterBuffer batchParameterBuffer; protected FbTransaction transaction; @@ -46,7 +45,6 @@ public abstract class AbstractFbBatch implements FbBatch { private RowValue fieldValues; protected AbstractFbBatch(FbDatabase database, BatchParameterBuffer batchParameterBuffer) { - this.syncObject = database.getSynchronizationObject(); this.database = database; this.batchParameterBuffer = batchParameterBuffer; } @@ -61,10 +59,6 @@ public void removeExceptionListener(ExceptionListener listener) { exceptionListenerDispatcher.removeListener(listener); } - protected final Object getSynchronizationObject() { - return syncObject; - } - public BatchParameterBuffer getBatchParameterBuffer() { return batchParameterBuffer; } @@ -388,4 +382,8 @@ public void setCharacterStream(int parameterIndex, Reader reader, long length) t public void setCharacterStream(int parameterIndex, Reader reader) throws SQLException { getField(parameterIndex).setCharacterStream(reader); } + + public final LockCloseable withLock() { + return database.withLock(); + } } diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IBatchImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IBatchImpl.java index 88c32dd50b..d09e8b9ee5 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IBatchImpl.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IBatchImpl.java @@ -3,7 +3,6 @@ import com.sun.jna.ptr.LongByReference; import org.firebirdsql.gds.BatchParameterBuffer; import org.firebirdsql.gds.BlobParameterBuffer; -import org.firebirdsql.gds.ISCConstants; import org.firebirdsql.gds.impl.GDSHelper; import org.firebirdsql.gds.ng.AbstractFbBatch; import org.firebirdsql.gds.ng.FbBatchCompletionState; @@ -12,6 +11,7 @@ import org.firebirdsql.gds.ng.FbMessageMetadata; import org.firebirdsql.gds.ng.FbStatement; import org.firebirdsql.gds.ng.FbTransaction; +import org.firebirdsql.gds.ng.LockCloseable; import org.firebirdsql.gds.ng.fields.RowValue; import org.firebirdsql.jdbc.FBBlob; import org.firebirdsql.nativeoo.gds.ng.FbInterface.IAttachment; @@ -88,7 +88,7 @@ public IBatchImpl(IBatch batch, IStatementImpl statement, BatchParameterBuffer p * @throws SQLException */ private void init() throws SQLException { - synchronized (getSynchronizationObject()) { + try (LockCloseable ignored = withLock()) { if (metadata == null) { if (statement == null) { statement = new IStatementImpl(getDatabase()); @@ -126,7 +126,7 @@ public void addBatch() throws SQLException { } byte[] data = messageBuilder.getData(); try (CloseableMemory memory = new CloseableMemory(data.length)) { - synchronized (getSynchronizationObject()) { + try (LockCloseable ignored = withLock()) { memory.write(0, data, 0, data.length); batch.add(getStatus(), 1, memory); processStatus(); @@ -152,7 +152,7 @@ public void addBatch(RowValue fieldValues) throws SQLException { long l = getParameterDescriptor(i + 1).getDatatypeCoder().decodeLong(fieldValues.getFieldData(i)); LongByReference longByReference = new LongByReference(l); LongByReference existLong = new LongByReference(l); - synchronized (getSynchronizationObject()) { + try (LockCloseable ignored = withLock()) { batch.registerBlob(getStatus(), existLong, longByReference); processStatus(); } @@ -160,7 +160,7 @@ public void addBatch(RowValue fieldValues) throws SQLException { } byte[] data = messageBuilder.getData(); try (CloseableMemory memory = new CloseableMemory(data.length)) { - synchronized (getSynchronizationObject()) { + try (LockCloseable ignored = withLock()) { memory.write(0, data, 0, data.length); batch.add(getStatus(), 1, memory); processStatus(); @@ -198,7 +198,7 @@ public FbBlob addBlob(int index, byte[] inBuffer, long blobId, BlobParameterBuff memory.write(0, new byte[] {}, 0, 0); LongByReference longByReference = new LongByReference(blobId); - synchronized (getSynchronizationObject()) { + try (LockCloseable ignored = withLock()) { if (buffer == null) batch.addBlob(getStatus(), inBuffer.length, memory, longByReference, 0, null); else @@ -221,7 +221,7 @@ public void addSegmentedBlob(int index, long blobId, BlobParameterBuffer buffer) @Override public void appendBlobData(byte[] inBuffer) throws SQLException { try (CloseableMemory memory = new CloseableMemory(inBuffer.length)) { - synchronized (getSynchronizationObject()) { + try (LockCloseable ignored = withLock()) { memory.write(0, inBuffer, 0, inBuffer.length); batch.appendBlobData(getStatus(), inBuffer.length, memory); processStatus(); @@ -246,7 +246,7 @@ public void addBlobSegment(byte[] data, boolean lastSegment) throws IOException, @Override public void addBlobStream(byte[] inBuffer) throws SQLException { try (CloseableMemory memory = new CloseableMemory(inBuffer.length)) { - synchronized (getSynchronizationObject()) { + try (LockCloseable ignored = withLock()) { memory.write(0, inBuffer, 0, inBuffer.length); batch.addBlobStream(getStatus(), inBuffer.length, memory); processStatus(); @@ -259,7 +259,7 @@ public void registerBlob(int index, long existingBlob, long blobId) throws SQLEx addBlob(index, blobId); LongByReference longByReference = new LongByReference(blobId); LongByReference existLong = new LongByReference(existingBlob); - synchronized (getSynchronizationObject()) { + try (LockCloseable ignored = withLock()) { batch.registerBlob(getStatus(), existLong, longByReference); processStatus(); } @@ -267,7 +267,7 @@ public void registerBlob(int index, long existingBlob, long blobId) throws SQLEx @Override public FbBatchCompletionState execute() throws SQLException { - synchronized (getSynchronizationObject()) { + try (LockCloseable ignored = withLock()) { IBatchCompletionState execute = batch.execute(getStatus(), ((ITransactionImpl) transaction).getTransaction()); processStatus(); @@ -277,7 +277,7 @@ public FbBatchCompletionState execute() throws SQLException { @Override public void cancel() throws SQLException { - synchronized (getSynchronizationObject()) { + try (LockCloseable ignored = withLock()) { batch.cancel(getStatus()); processStatus(); } @@ -285,7 +285,7 @@ public void cancel() throws SQLException { @Override public int getBlobAlignment() throws SQLException { - synchronized (getSynchronizationObject()) { + try (LockCloseable ignored = withLock()) { int result = batch.getBlobAlignment(getStatus()); processStatus(); return result; @@ -299,7 +299,7 @@ public FbMessageMetadata getMetadata() throws SQLException { @Override public void setDefaultBpb(int parLength, byte[] par) throws SQLException { - synchronized (getSynchronizationObject()) { + try (LockCloseable ignored = withLock()) { batch.setDefaultBpb(getStatus(), parLength, par); processStatus(); } diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IBlobImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IBlobImpl.java index d4efbff694..3462c395be 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IBlobImpl.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IBlobImpl.java @@ -6,6 +6,7 @@ import org.firebirdsql.gds.ng.AbstractFbBlob; import org.firebirdsql.gds.ng.FbBlob; import org.firebirdsql.gds.ng.FbExceptionBuilder; +import org.firebirdsql.gds.ng.LockCloseable; import org.firebirdsql.gds.ng.listeners.DatabaseListener; import org.firebirdsql.nativeoo.gds.ng.FbInterface.IAttachment; import org.firebirdsql.nativeoo.gds.ng.FbInterface.IBlob; @@ -47,25 +48,21 @@ public IBlobImpl(IDatabaseImpl database, ITransactionImpl transaction, BlobParam @Override protected void closeImpl() throws SQLException { - synchronized (getSynchronizationObject()) { - try { - blob.close(getStatus()); - processStatus(); - } finally { - byteBuffer = null; - } + try (LockCloseable ignored = withLock()) { + blob.close(getStatus()); + processStatus(); + } finally { + byteBuffer = null; } } @Override protected void cancelImpl() throws SQLException { - synchronized (getSynchronizationObject()) { - try { - blob.cancel(getStatus()); - processStatus(); - } finally { - byteBuffer = null; - } + try (LockCloseable ignored = withLock()) { + blob.cancel(getStatus()); + processStatus(); + } finally { + byteBuffer = null; } } @@ -98,7 +95,7 @@ public void open() throws SQLException { } else { bpb = new byte[0]; } - synchronized (getSynchronizationObject()) { + try (LockCloseable ignored = withLock()) { checkDatabaseAttached(); checkTransactionActive(); checkBlobClosed(); @@ -137,7 +134,7 @@ public byte[] getSegment(int sizeRequested) throws SQLException { sizeRequested = Math.min(sizeRequested, getMaximumSegmentSize()); final ByteBuffer responseBuffer; final CloseableMemory actualLength = new CloseableMemory(1024); - synchronized (getSynchronizationObject()) { + try (LockCloseable ignored = withLock()) { checkDatabaseAttached(); checkTransactionActive(); checkBlobOpen(); @@ -175,7 +172,7 @@ public void putSegment(byte[] segment) throws SQLException { if (segment.length > getMaximumSegmentSize()) { throw new FbExceptionBuilder().exception(jb_blobPutSegmentTooLong).toSQLException(); } - synchronized (getSynchronizationObject()) { + try (LockCloseable ignored = withLock()) { checkDatabaseAttached(); checkTransactionActive(); checkBlobOpen(); @@ -194,15 +191,13 @@ public void putSegment(byte[] segment) throws SQLException { @Override public void seek(int offset, SeekMode seekMode) throws SQLException { - try { - synchronized (getSynchronizationObject()) { - checkDatabaseAttached(); - checkTransactionActive(); - // result is the current position in the blob - // We ignore the result - blob.seek(getStatus(), seekMode.getSeekModeId(), offset); - processStatus(); - } + try (LockCloseable ignored = withLock()) { + checkDatabaseAttached(); + checkTransactionActive(); + // result is the current position in the blob + // We ignore the result + blob.seek(getStatus(), seekMode.getSeekModeId(), offset); + processStatus(); } catch (SQLException e) { exceptionListenerDispatcher.errorOccurred(e); throw e; @@ -213,7 +208,7 @@ public void seek(int offset, SeekMode seekMode) throws SQLException { public byte[] getBlobInfo(byte[] requestItems, int bufferLength) throws SQLException { try { byte[] responseArr = new byte[bufferLength]; - synchronized (getSynchronizationObject()) { + try (LockCloseable ignored = withLock()) { checkDatabaseAttached(); checkBlobOpen(); blob.getInfo(getStatus(), requestItems.length, requestItems, bufferLength, responseArr); diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IDatabaseImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IDatabaseImpl.java index 9eae2d26d8..fe199db34a 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IDatabaseImpl.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IDatabaseImpl.java @@ -17,6 +17,7 @@ import org.firebirdsql.gds.ng.FbMetadataBuilder; import org.firebirdsql.gds.ng.FbStatement; import org.firebirdsql.gds.ng.FbTransaction; +import org.firebirdsql.gds.ng.LockCloseable; import org.firebirdsql.gds.ng.ParameterConverter; import org.firebirdsql.gds.ng.TransactionState; import org.firebirdsql.gds.ng.WarningMessageCallback; @@ -94,15 +95,13 @@ public void attach() throws SQLException { @Override protected void internalDetach() throws SQLException { - synchronized (getSynchronizationObject()) { - try { - attachment.detach(getStatus()); - processStatus(); - } catch (SQLException e) { - throw e; - } finally { - setDetached(); - } + try (LockCloseable ignored = withLock()) { + attachment.detach(getStatus()); + processStatus(); + } catch (SQLException e) { + throw e; + } finally { + setDetached(); } } @@ -121,12 +120,10 @@ public void createDatabase() throws SQLException { public void dropDatabase() throws SQLException { try { checkConnected(); - synchronized (getSynchronizationObject()) { - try { - attachment.dropDatabase(getStatus()); - } finally { - setDetached(); - } + try (LockCloseable ignored = withLock()) { + attachment.dropDatabase(getStatus()); + } finally { + setDetached(); } } catch (SQLException e) { exceptionListenerDispatcher.errorOccurred(e); @@ -160,7 +157,7 @@ public FbTransaction startTransaction(TransactionParameterBuffer tpb) throws SQL try { checkConnected(); final byte[] tpbArray = tpb.toBytesWithType(); - synchronized (getSynchronizationObject()) { + try (LockCloseable ignored = withLock()) { ITransaction transaction = attachment.startTransaction(getStatus(), tpbArray.length, tpbArray); processStatus(); final ITransactionImpl transactionImpl = new ITransactionImpl(this, transaction, @@ -180,7 +177,7 @@ public FbTransaction reconnectTransaction(long transactionId) throws SQLExceptio checkConnected(); final byte[] transactionIdBuffer = getTransactionIdBuffer(transactionId); - synchronized (getSynchronizationObject()) { + try (LockCloseable ignored = withLock()) { ITransaction iTransaction = attachment.reconnectTransaction(getStatus(), transactionIdBuffer.length, transactionIdBuffer); processStatus(); @@ -237,7 +234,7 @@ public FbBlob createBlobForInput(FbTransaction transaction, BlobParameterBuffer public byte[] getDatabaseInfo(byte[] requestItems, int maxBufferLength) throws SQLException { try { final byte[] responseArray = new byte[maxBufferLength]; - synchronized (getSynchronizationObject()) { + try (LockCloseable ignored = withLock()) { attachment.getInfo(getStatus(), requestItems.length, requestItems, (short) maxBufferLength, responseArray); } processStatus(); @@ -269,7 +266,7 @@ public void executeImmediate(String statementText, FbTransaction transaction) th .toFlatSQLException(); } final byte[] statementArray = getEncoding().encodeToCharset(statementText); - synchronized (getSynchronizationObject()) { + try (LockCloseable ignored = withLock()) { if (attachment == null) { attachment = util.executeCreateDatabase(getStatus(), statementArray.length, statementArray, getConnectionDialect(), new boolean[]{false}); @@ -320,7 +317,7 @@ protected IEventImpl validateEventHandle(EventHandle eventHandle) throws SQLExce @Override public IEventImpl createEventHandle(String eventName, EventHandler eventHandler) throws SQLException { final IEventImpl eventHandle = new IEventImpl(eventName, eventHandler, getEncoding()); - synchronized (getSynchronizationObject()) { + try (LockCloseable ignored = withLock()) { synchronized (eventHandle) { int size = clientLibrary.isc_event_block(eventHandle.getEventBuffer(), eventHandle.getResultBuffer(), (short) 1, eventHandle.getEventNameMemory()); @@ -335,7 +332,7 @@ public void countEvents(EventHandle eventHandle) throws SQLException { try { final IEventImpl event = validateEventHandle(eventHandle); int count; - synchronized (getSynchronizationObject()) { + try (LockCloseable ignored = withLock()) { synchronized (event) { ISC_STATUS[] status = new ISC_STATUS[20]; clientLibrary.isc_event_counts(status, (short) event.getSize(), @@ -356,7 +353,7 @@ public void queueEvent(EventHandle eventHandle) throws SQLException { checkConnected(); final IEventImpl event = validateEventHandle(eventHandle); - synchronized (getSynchronizationObject()) { + try (LockCloseable ignored = withLock()) { synchronized (event) { int length = event.getSize(); byte[] array = event.getEventBuffer().getValue().getByteArray(0, length); @@ -378,7 +375,7 @@ public void cancelEvent(EventHandle eventHandle) throws SQLException { checkConnected(); final IEventImpl event = validateEventHandle(eventHandle); - synchronized (getSynchronizationObject()) { + try (LockCloseable ignored = withLock()) { synchronized (event) { try { IEvents iEvents = events.remove(eventHandle); @@ -427,7 +424,7 @@ protected void attachOrCreate(final DatabaseParameterBuffer dpb, final boolean c final String dbName = connection.getAttachUrl(); final byte[] dpbArray = dpb.toBytesWithType(); - synchronized (getSynchronizationObject()) { + try (LockCloseable ignored = withLock()) { try { if (create) { attachment = provider.createDatabase(getStatus(), dbName, (short) dpbArray.length, dpbArray); diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IServiceImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IServiceImpl.java index 9ad8280477..d3440d4cf3 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IServiceImpl.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IServiceImpl.java @@ -9,6 +9,7 @@ import org.firebirdsql.gds.ng.AbstractFbService; import org.firebirdsql.gds.ng.FbAttachment; import org.firebirdsql.gds.ng.FbExceptionBuilder; +import org.firebirdsql.gds.ng.LockCloseable; import org.firebirdsql.gds.ng.ParameterConverter; import org.firebirdsql.gds.ng.WarningMessageCallback; import org.firebirdsql.jdbc.FBDriverNotCapableException; @@ -75,7 +76,7 @@ public byte[] getServiceInfo(ServiceParameterBuffer serviceParameterBuffer, final byte[] serviceRequestBufferBytes = serviceRequestBuffer == null ? null : serviceRequestBuffer.toBytes(); final byte[] responseBuffer = new byte[maxBufferLength]; - synchronized (getSynchronizationObject()) { + try (LockCloseable ignored = withLock()) { service.query(getStatus(), (serviceParameterBufferBytes != null ? serviceParameterBufferBytes.length : 0), serviceParameterBufferBytes, (serviceRequestBufferBytes != null ? serviceRequestBufferBytes.length @@ -97,7 +98,7 @@ public void startServiceAction(ServiceRequestBuffer serviceRequestBuffer) throws final byte[] serviceRequestBufferBytes = serviceRequestBuffer == null ? null : serviceRequestBuffer.toBytes(); - synchronized (getSynchronizationObject()) { + try (LockCloseable ignored = withLock()) { service.start(getStatus(), (serviceRequestBufferBytes != null ? serviceRequestBufferBytes.length : 0), serviceRequestBufferBytes); processStatus(); @@ -118,7 +119,7 @@ public void attach() throws SQLException { final byte[] serviceName = getEncoding().encodeToCharset(connection.getAttachUrl()); final byte[] spbArray = spb.toBytesWithType(); - synchronized (getSynchronizationObject()) { + try (LockCloseable ignored = withLock()) { try { service = provider.attachServiceManager(getStatus(), connection.getAttachUrl(), spbArray.length, spbArray); processStatus(); @@ -170,7 +171,7 @@ protected void afterAttachActions() throws SQLException { @Override protected void internalDetach() throws SQLException { checkConnected(); - synchronized (getSynchronizationObject()) { + try (LockCloseable ignored = withLock()) { try { service.detach(getStatus()); processStatus(); diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IStatementImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IStatementImpl.java index 2e6f0da248..8be5843813 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IStatementImpl.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/IStatementImpl.java @@ -13,6 +13,7 @@ import org.firebirdsql.gds.ng.FbExceptionBuilder; import org.firebirdsql.gds.ng.FbMessageMetadata; import org.firebirdsql.gds.ng.FbTransaction; +import org.firebirdsql.gds.ng.LockCloseable; import org.firebirdsql.gds.ng.OperationCloseHandle; import org.firebirdsql.gds.ng.StatementState; import org.firebirdsql.gds.ng.StatementType; @@ -35,6 +36,7 @@ import java.sql.SQLNonTransientException; import java.util.Collection; +import static java.util.Objects.requireNonNull; import static org.firebirdsql.gds.ng.TransactionHelper.checkTransactionActive; /** @@ -56,14 +58,18 @@ public class IStatementImpl extends AbstractFbStatement { private FbBatch batch; public IStatementImpl(IDatabaseImpl database) { - super(database.getSynchronizationObject()); - this.database = database; + this.database = requireNonNull(database, "database"); this.status = this.database.getStatus(); } + @Override + public final LockCloseable withLock() { + return database.withLock(); + } + @Override protected void free(int option) throws SQLException { - synchronized (getSynchronizationObject()) { + try (LockCloseable ignored = withLock()) { if (option == ISCConstants.DSQL_close) { cursor.close(getStatus()); cursor = null; @@ -97,7 +103,7 @@ public int getHandle() { public void prepare(String statementText) throws SQLException { try { final byte[] statementArray = getDatabase().getEncoding().encodeToCharset(statementText); - synchronized (getSynchronizationObject()) { + try (LockCloseable ignored = withLock()) { checkTransactionActive(getTransaction()); final StatementState initialState = getState(); if (!isPrepareAllowed(initialState)) { @@ -150,72 +156,70 @@ statementArray.length, statementArray, getDatabase().getConnectionDialect(), @Override public void execute(RowValue parameters) throws SQLException { final StatementState initialState = getState(); - try { - synchronized (getSynchronizationObject()) { - checkStatementValid(); - checkTransactionActive(getTransaction()); - validateParameters(parameters); - reset(false); + try (LockCloseable ignored = withLock()) { + checkStatementValid(); + checkTransactionActive(getTransaction()); + validateParameters(parameters); + reset(false); - switchState(StatementState.EXECUTING); - if (this.statement.vTable.version >= IStatementIntf.VERSION) - updateStatementTimeout(); + switchState(StatementState.EXECUTING); + if (this.statement.vTable.version >= IStatementIntf.VERSION) + updateStatementTimeout(); - setMetaData(getParameterDescriptor(), parameters); + setMetaData(getParameterDescriptor(), parameters); - ByteBuffer inMessage = ByteBuffer.allocate(inMetadata.getMessageLength(getStatus())); - processStatus(); + ByteBuffer inMessage = ByteBuffer.allocate(inMetadata.getMessageLength(getStatus())); + processStatus(); - setDataToBuffer(getParameterDescriptor(), parameters, inMessage); + setDataToBuffer(getParameterDescriptor(), parameters, inMessage); - final StatementType statementType = getType(); - final boolean hasSingletonResult = hasSingletonResult(); - ITransactionImpl transaction = (ITransactionImpl) getTransaction(); + final StatementType statementType = getType(); + final boolean hasSingletonResult = hasSingletonResult(); + ITransactionImpl transaction = (ITransactionImpl) getTransaction(); - Pointer inPtr = null; - // Actually the message size may be smaller than previously declared, - // so we take pointer position as message size - if (inMessage.position() > 0) { - inPtr = new Memory(inMessage.position()); - inPtr.write(0, inMessage.array(), 0, inMessage.position()); - } - Pointer outPtr = null; - - try (OperationCloseHandle operationCloseHandle = signalExecute()) { - if (operationCloseHandle.isCancelled()) { - // operation was synchronously cancelled from an OperationAware implementation - throw FbExceptionBuilder.forException(ISCConstants.isc_cancelled).toFlatSQLException(); - } - if ((statement.getFlags(getStatus()) & IStatement.FLAG_HAS_CURSOR) == IStatement.FLAG_HAS_CURSOR) { - cursor = statement.openCursor(getStatus(), transaction.getTransaction(), inMetadata, inPtr, - outMetadata, 0); - } else { - ByteBuffer outMessage = ByteBuffer.allocate(getMaxSqlInfoSize()); - outPtr = new Memory(outMessage.array().length); - outPtr.write(0, outMessage.array(), 0, outMessage.array().length); - statement.execute(getStatus(), transaction.getTransaction(), inMetadata, inPtr, outMetadata, - outPtr); - } + Pointer inPtr = null; + // Actually the message size may be smaller than previously declared, + // so we take pointer position as message size + if (inMessage.position() > 0) { + inPtr = new Memory(inMessage.position()); + inPtr.write(0, inMessage.array(), 0, inMessage.position()); + } + Pointer outPtr = null; - if (hasSingletonResult) { - /* A type with a singleton result (ie an execute procedure with return fields), doesn't actually - * have a result set that will be fetched, instead we have a singleton result if we have fields - */ - statementListenerDispatcher.statementExecuted(this, false, true); - processStatus(); - queueRowData(toRowValue(getRowDescriptor(), outMetadata, outPtr)); - setAfterLast(); - } else { - // A normal execute is never a singleton result (even if it only produces a single result) - statementListenerDispatcher.statementExecuted(this, hasFields(), false); - processStatus(); - } + try (OperationCloseHandle operationCloseHandle = signalExecute()) { + if (operationCloseHandle.isCancelled()) { + // operation was synchronously cancelled from an OperationAware implementation + throw FbExceptionBuilder.forException(ISCConstants.isc_cancelled).toFlatSQLException(); + } + if ((statement.getFlags(getStatus()) & IStatement.FLAG_HAS_CURSOR) == IStatement.FLAG_HAS_CURSOR) { + cursor = statement.openCursor(getStatus(), transaction.getTransaction(), inMetadata, inPtr, + outMetadata, 0); + } else { + ByteBuffer outMessage = ByteBuffer.allocate(getMaxSqlInfoSize()); + outPtr = new Memory(outMessage.array().length); + outPtr.write(0, outMessage.array(), 0, outMessage.array().length); + statement.execute(getStatus(), transaction.getTransaction(), inMetadata, inPtr, outMetadata, + outPtr); } - if (getState() != StatementState.ERROR) { - switchState(statementType.isTypeWithCursor() ? StatementState.CURSOR_OPEN : StatementState.PREPARED); + if (hasSingletonResult) { + /* A type with a singleton result (ie an execute procedure with return fields), doesn't actually + * have a result set that will be fetched, instead we have a singleton result if we have fields + */ + statementListenerDispatcher.statementExecuted(this, false, true); + processStatus(); + queueRowData(toRowValue(getRowDescriptor(), outMetadata, outPtr)); + setAfterLast(); + } else { + // A normal execute is never a singleton result (even if it only produces a single result) + statementListenerDispatcher.statementExecuted(this, hasFields(), false); + processStatus(); } } + + if (getState() != StatementState.ERROR) { + switchState(statementType.isTypeWithCursor() ? StatementState.CURSOR_OPEN : StatementState.PREPARED); + } } catch (SQLException e) { if (getState() != StatementState.ERROR) { switchState(initialState); @@ -290,35 +294,33 @@ private void setDataToBuffer(RowDescriptor rowDescriptor, RowValue parameters, B @Override public void fetchRows(int fetchSize) throws SQLException { - try { - synchronized (getSynchronizationObject()) { - checkStatementValid(); - if (!getState().isCursorOpen()) { - throw new FbExceptionBuilder().exception(ISCConstants.isc_cursor_not_open).toSQLException(); - } - if (isAfterLast()) return; + try (LockCloseable ignored = withLock()) { + checkStatementValid(); + if (!getState().isCursorOpen()) { + throw new FbExceptionBuilder().exception(ISCConstants.isc_cursor_not_open).toSQLException(); + } + if (isAfterLast()) return; - try (OperationCloseHandle operationCloseHandle = signalFetch()) { - if (operationCloseHandle.isCancelled()) { - // operation was synchronously cancelled from an OperationAware implementation - throw FbExceptionBuilder.forException(ISCConstants.isc_cancelled).toFlatSQLException(); - } + try (OperationCloseHandle operationCloseHandle = signalFetch()) { + if (operationCloseHandle.isCancelled()) { + // operation was synchronously cancelled from an OperationAware implementation + throw FbExceptionBuilder.forException(ISCConstants.isc_cancelled).toFlatSQLException(); + } - ByteBuffer message = ByteBuffer.allocate(outMetadata.getMessageLength(getStatus()) + 1); - processStatus(); - Pointer ptr = new Memory(message.array().length); - int fetchStatus = cursor.fetchNext(getStatus(), ptr); - processStatus(); - if (fetchStatus == IStatus.RESULT_OK) { - queueRowData(toRowValue(getRowDescriptor(), outMetadata, ptr)); - } else if (fetchStatus == IStatus.RESULT_NO_DATA) { - setAfterLast(); - // Note: we are not explicitly 'closing' the cursor here - } else { - final String errorMessage = "Unexpected fetch status (expected 0 or 100): " + fetchStatus; - log.error(errorMessage); - throw new SQLException(errorMessage); - } + ByteBuffer message = ByteBuffer.allocate(outMetadata.getMessageLength(getStatus()) + 1); + processStatus(); + Pointer ptr = new Memory(message.array().length); + int fetchStatus = cursor.fetchNext(getStatus(), ptr); + processStatus(); + if (fetchStatus == IStatus.RESULT_OK) { + queueRowData(toRowValue(getRowDescriptor(), outMetadata, ptr)); + } else if (fetchStatus == IStatus.RESULT_NO_DATA) { + setAfterLast(); + // Note: we are not explicitly 'closing' the cursor here + } else { + final String errorMessage = "Unexpected fetch status (expected 0 or 100): " + fetchStatus; + log.error(errorMessage); + throw new SQLException(errorMessage); } } } catch (SQLException e) { @@ -358,7 +360,7 @@ protected RowValue toRowValue(RowDescriptor rowDescriptor, IMessageMetadata meta public byte[] getSqlInfo(byte[] requestItems, int bufferLength) throws SQLException { try { final byte[] responseArr = new byte[bufferLength]; - synchronized (getSynchronizationObject()) { + try (LockCloseable ignored = withLock()) { checkStatementValid(); statement.getInfo(getStatus(), requestItems.length, requestItems, bufferLength, responseArr); @@ -385,12 +387,10 @@ public int getMaxSqlInfoSize() { @Override public void setCursorName(String cursorName) throws SQLException { - try { - synchronized (getSynchronizationObject()) { - checkStatementValid(); - statement.setCursorName(getStatus(), cursorName + '\0'); - processStatus(); - } + try (LockCloseable ignored = withLock()) { + checkStatementValid(); + statement.setCursorName(getStatus(), cursorName + '\0'); + processStatus(); } catch (SQLException e) { exceptionListenerDispatcher.errorOccurred(e); throw e; @@ -410,17 +410,15 @@ public BatchParameterBuffer createBatchParameterBuffer() throws SQLException { @Override public void deferredBatchCreate(FbBatchConfig batchConfig, DeferredResponse onResponse) throws SQLException { - try { - synchronized (getSynchronizationObject()) { - checkStatementValid(); - try { - BatchParameterBuffer batchPb = createBatchParameterBuffer(); - batchConfig.populateBatchParameterBuffer(batchPb); - batch = createBatch(batchPb); - } catch (SQLException e) { - switchState(StatementState.ERROR); - throw e; - } + try (LockCloseable ignored = withLock()) { + checkStatementValid(); + try { + BatchParameterBuffer batchPb = createBatchParameterBuffer(); + batchConfig.populateBatchParameterBuffer(batchPb); + batch = createBatch(batchPb); + } catch (SQLException e) { + switchState(StatementState.ERROR); + throw e; } } catch (SQLException e) { exceptionListenerDispatcher.errorOccurred(e); @@ -430,17 +428,15 @@ public void deferredBatchCreate(FbBatchConfig batchConfig, DeferredResponse rowValues, DeferredResponse onResponse) throws SQLException { - try { - synchronized (getSynchronizationObject()) { - checkStatementValid(); - try { - for (RowValue rowValue : rowValues) { - batch.addBatch(rowValue); - } - } catch (SQLException e) { - switchState(StatementState.ERROR); - throw e; + try (LockCloseable ignored = withLock()) { + checkStatementValid(); + try { + for (RowValue rowValue : rowValues) { + batch.addBatch(rowValue); } + } catch (SQLException e) { + switchState(StatementState.ERROR); + throw e; } } catch (SQLException e) { exceptionListenerDispatcher.errorOccurred(e); @@ -450,16 +446,14 @@ public void deferredBatchSend(Collection rowValues, DeferredResponse onResponse) throws SQLException { - try { - synchronized (getSynchronizationObject()) { - checkStatementValid(); - try { - batch.release(); - } catch (SQLException e) { - switchState(StatementState.ERROR); - throw e; - } + try (LockCloseable ignored = withLock()) { + checkStatementValid(); + try { + batch.release(); + } catch (SQLException e) { + switchState(StatementState.ERROR); + throw e; } } catch (SQLException e) { exceptionListenerDispatcher.errorOccurred(e); diff --git a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/ITransactionImpl.java b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/ITransactionImpl.java index 9093fdca7f..37ce64c8fc 100644 --- a/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/ITransactionImpl.java +++ b/src/nativeoo/org/firebirdsql/nativeoo/gds/ng/ITransactionImpl.java @@ -1,6 +1,7 @@ package org.firebirdsql.nativeoo.gds.ng; import org.firebirdsql.gds.ng.AbstractFbTransaction; +import org.firebirdsql.gds.ng.LockCloseable; import org.firebirdsql.gds.ng.TransactionState; import org.firebirdsql.jna.fbclient.FbClientLibrary; import org.firebirdsql.nativeoo.gds.ng.FbInterface.IStatus; @@ -47,15 +48,13 @@ public ITransaction getTransaction() { @Override public void commit() throws SQLException { - try { - synchronized (getSynchronizationObject()) { - final IDatabaseImpl db = getDatabase(); - db.checkConnected(); - switchState(TransactionState.COMMITTING); - transaction.commit(getStatus()); - processStatus(); - switchState(TransactionState.COMMITTED); - } + try (LockCloseable ignored = withLock()) { + final IDatabaseImpl db = getDatabase(); + db.checkConnected(); + switchState(TransactionState.COMMITTING); + transaction.commit(getStatus()); + processStatus(); + switchState(TransactionState.COMMITTED); } catch (SQLException e) { exceptionListenerDispatcher.errorOccurred(e); throw e; @@ -70,15 +69,13 @@ public void commit() throws SQLException { @Override public void rollback() throws SQLException { - try { - synchronized (getSynchronizationObject()) { - final IDatabaseImpl db = getDatabase(); - db.checkConnected(); - switchState(TransactionState.ROLLING_BACK); - transaction.rollback(getStatus()); - processStatus(); - switchState(TransactionState.ROLLED_BACK); - } + try (LockCloseable ignored = withLock()) { + final IDatabaseImpl db = getDatabase(); + db.checkConnected(); + switchState(TransactionState.ROLLING_BACK); + transaction.rollback(getStatus()); + processStatus(); + switchState(TransactionState.ROLLED_BACK); } catch (SQLException e) { exceptionListenerDispatcher.errorOccurred(e); throw e; @@ -94,22 +91,20 @@ public void rollback() throws SQLException { @Override public void prepare(byte[] recoveryInformation) throws SQLException { boolean noRecoveryInfo = recoveryInformation == null || recoveryInformation.length == 0; - try { - synchronized (getSynchronizationObject()) { - final IDatabaseImpl db = getDatabase(); - db.checkConnected(); - switchState(TransactionState.PREPARING); - if (noRecoveryInfo) { - // TODO check for recovery information - transaction.prepare(getStatus(), 0, - null); - } else { - transaction.prepare(getStatus(), (short) recoveryInformation.length, - recoveryInformation); - } - processStatus(); - switchState(TransactionState.PREPARED); + try (LockCloseable ignored = withLock()) { + final IDatabaseImpl db = getDatabase(); + db.checkConnected(); + switchState(TransactionState.PREPARING); + if (noRecoveryInfo) { + // TODO check for recovery information + transaction.prepare(getStatus(), 0, + null); + } else { + transaction.prepare(getStatus(), (short) recoveryInformation.length, + recoveryInformation); } + processStatus(); + switchState(TransactionState.PREPARED); } catch (SQLException e) { exceptionListenerDispatcher.errorOccurred(e); throw e; @@ -124,7 +119,7 @@ public void prepare(byte[] recoveryInformation) throws SQLException { public byte[] getTransactionInfo(byte[] requestItems, int maxBufferLength) throws SQLException { try { final byte[] responseArray = new byte[maxBufferLength]; - synchronized (getSynchronizationObject()) { + try (LockCloseable ignored = withLock()) { final IDatabaseImpl db = getDatabase(); db.checkConnected(); transaction.getInfo(getStatus(), (short) requestItems.length, requestItems, From b4e6adef93842dbb5981d9298c6b71f11cb10975 Mon Sep 17 00:00:00 2001 From: Vasiliy Yashkov Date: Mon, 5 Jun 2023 11:14:02 +0300 Subject: [PATCH 09/12] Use correct invalid descriptor field identifier for exception in case of getting field --- src/main/org/firebirdsql/gds/ng/AbstractFbBatch.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/org/firebirdsql/gds/ng/AbstractFbBatch.java b/src/main/org/firebirdsql/gds/ng/AbstractFbBatch.java index 1ee0a9b90f..bed0ed779d 100644 --- a/src/main/org/firebirdsql/gds/ng/AbstractFbBatch.java +++ b/src/main/org/firebirdsql/gds/ng/AbstractFbBatch.java @@ -225,7 +225,8 @@ protected FieldDescriptor getParameterDescriptor(int columnIndex) throws SQLExce */ protected FBField getField(int columnIndex) throws SQLException { if (columnIndex > fields.length) { - throw new SQLException("Invalid column index: " + columnIndex, SQLStateConstants.SQL_STATE_INVALID_COLUMN); + throw new SQLException("Invalid column index: " + columnIndex, + SQLStateConstants.SQL_STATE_INVALID_DESC_FIELD_ID); } return fields[columnIndex - 1]; From a6fdaba3e08f296ea2baba1d0fa9320bec440437 Mon Sep 17 00:00:00 2001 From: Vasiliy Yashkov Date: Mon, 5 Jun 2023 11:25:34 +0300 Subject: [PATCH 10/12] Minor cleanup and comments --- .../gds/ng/nativeoo/IBatchImpl.java | 6 ++--- .../firebirdsql/gds/ng/AbstractFbBatch.java | 22 ++----------------- 2 files changed, 5 insertions(+), 23 deletions(-) diff --git a/jaybird-native/src/main/java/org/firebirdsql/gds/ng/nativeoo/IBatchImpl.java b/jaybird-native/src/main/java/org/firebirdsql/gds/ng/nativeoo/IBatchImpl.java index 46ef2432f6..67cc9a8ea6 100644 --- a/jaybird-native/src/main/java/org/firebirdsql/gds/ng/nativeoo/IBatchImpl.java +++ b/jaybird-native/src/main/java/org/firebirdsql/gds/ng/nativeoo/IBatchImpl.java @@ -86,7 +86,7 @@ public IBatchImpl(IBatch batch, IStatementImpl statement, BatchParameterBuffer p * If batch is created from a database, * it is necessary to initialize it to obtain metadata. * - * @throws SQLException + * @throws SQLException For errors when initializing batch */ private void init() throws SQLException { try (LockCloseable ignored = withLock()) { @@ -117,7 +117,7 @@ statementArray.length, statementArray, getDatabase().getDatabaseDialect(), metad /** * Build batch message from field values. * - * @throws SQLException + * @throws SQLException For errors when adding field values to batch */ @Override public void addBatch() throws SQLException { @@ -143,7 +143,7 @@ public void addBatch() throws SQLException { /** * Build batch message from field values. * - * @throws SQLException + * @throws SQLException For errors when adding fields values to batch */ @Override public void addBatch(RowValue fieldValues) throws SQLException { diff --git a/src/main/org/firebirdsql/gds/ng/AbstractFbBatch.java b/src/main/org/firebirdsql/gds/ng/AbstractFbBatch.java index bed0ed779d..81b433382c 100644 --- a/src/main/org/firebirdsql/gds/ng/AbstractFbBatch.java +++ b/src/main/org/firebirdsql/gds/ng/AbstractFbBatch.java @@ -28,10 +28,6 @@ */ public abstract class AbstractFbBatch implements FbBatch { - public static final String METHOD_NOT_SUPPORTED = - "This method is only supported on Statement and not supported on PreparedStatement and CallableStatement"; - private static final String UNICODE_STREAM_NOT_SUPPORTED = "Unicode stream not supported."; - protected final ExceptionListenerDispatcher exceptionListenerDispatcher = new ExceptionListenerDispatcher(this); private final BatchParameterBuffer batchParameterBuffer; protected FbTransaction transaction; @@ -85,7 +81,8 @@ protected RowValue getFieldValues() { /** * Creating a string descriptor from metadata. * - * @throws SQLException + * @throws SQLException For errors when preparing batch + * */ protected void prepareBatch() throws SQLException { @@ -259,21 +256,6 @@ public final void setAsciiStream(int parameterIndex, InputStream x) throws SQLEx setBinaryStream(parameterIndex, x); } - /** - * Method is no longer supported since Jaybird 3.0. - *

- * For old behavior use {@link #setBinaryStream(int, InputStream, int)}. For JDBC suggested behavior, - * use {@link #setCharacterStream(int, Reader, int)}. - *

- * - * @throws SQLFeatureNotSupportedException Always - * @deprecated - */ - @Deprecated - public void setUnicodeStream(int parameterIndex, InputStream x, int length) throws SQLException { - throw new SQLFeatureNotSupportedException(UNICODE_STREAM_NOT_SUPPORTED); - } - /** *

* Jaybird does not support array types. From 11ee8f0aade9bfe7990595bc294f1f71358b5a0a Mon Sep 17 00:00:00 2001 From: Vasiliy Yashkov Date: Wed, 7 Jun 2023 15:58:15 +0300 Subject: [PATCH 11/12] Use `org.firebirdsql.jdbc.FirebirdBlob` as arguments when working with blobs in native batch Also fix creation of `org.firebirdsql.jdbc.FBBlob` instances. --- .../gds/ng/nativeoo/IBatchImpl.java | 32 +++--- .../firebirdsql/gds/ng/AbstractFbBatch.java | 2 +- src/main/org/firebirdsql/gds/ng/FbBatch.java | 11 ++- .../gds/ng/nativeoo/IBatchImplTest.java | 97 ++++++++++--------- 4 files changed, 79 insertions(+), 63 deletions(-) diff --git a/jaybird-native/src/main/java/org/firebirdsql/gds/ng/nativeoo/IBatchImpl.java b/jaybird-native/src/main/java/org/firebirdsql/gds/ng/nativeoo/IBatchImpl.java index 67cc9a8ea6..50624ed65b 100644 --- a/jaybird-native/src/main/java/org/firebirdsql/gds/ng/nativeoo/IBatchImpl.java +++ b/jaybird-native/src/main/java/org/firebirdsql/gds/ng/nativeoo/IBatchImpl.java @@ -3,6 +3,7 @@ import com.sun.jna.ptr.LongByReference; import org.firebirdsql.gds.BatchParameterBuffer; import org.firebirdsql.gds.BlobParameterBuffer; +import org.firebirdsql.gds.ISCConstants; import org.firebirdsql.gds.impl.GDSHelper; import org.firebirdsql.gds.ng.AbstractFbBatch; import org.firebirdsql.gds.ng.FbBatchCompletionState; @@ -14,6 +15,7 @@ import org.firebirdsql.gds.ng.LockCloseable; import org.firebirdsql.gds.ng.fields.RowValue; import org.firebirdsql.jdbc.FBBlob; +import org.firebirdsql.jdbc.FirebirdBlob; import org.firebirdsql.jna.fbclient.CloseableMemory; import org.firebirdsql.jna.fbclient.FbInterface.IAttachment; import org.firebirdsql.jna.fbclient.FbInterface.IBatch; @@ -175,10 +177,9 @@ public void addBatch(RowValue fieldValues) throws SQLException { } @Override - public void addBlob(int index, long blobId) throws SQLException { - FBBlob tmpBlob = new FBBlob(new GDSHelper(getDatabase()), blobId); - setBlob(index, tmpBlob); - tmpBlob.free(); + public void addBlob(int index, FirebirdBlob blob) + throws SQLException { + setBlob(index, blob); } /* @@ -203,20 +204,25 @@ public FbBlob addBlob(int index, byte[] inBuffer, long blobId, BlobParameterBuff if (buffer == null) batch.addBlob(getStatus(), inBuffer.length, memory, longByReference, 0, null); else - batch.addBlob(getStatus(), inBuffer.length, memory, longByReference, buffer.toBytesWithType().length, buffer.toBytesWithType()); + batch.addBlob(getStatus(), inBuffer.length, memory, longByReference, + buffer.toBytesWithType().length, buffer.toBytesWithType()); processStatus(); } - IBlobImpl blob = new IBlobImpl(getDatabase(), (ITransactionImpl) transaction, buffer, longByReference.getValue()); - FBBlob tmpBlob = new FBBlob(new GDSHelper(getDatabase()), blob.getBlobId()); + IBlobImpl blob = new IBlobImpl(getDatabase(), (ITransactionImpl) transaction, buffer, + longByReference.getValue()); + FBBlob tmpBlob = new FBBlob(new GDSHelper(getDatabase()), blob.getBlobId(), null, + FBBlob.createConfig(ISCConstants.BLOB_SUB_TYPE_BINARY, getDatabase().getConnectionProperties(), + getDatabase().getDatatypeCoder())); setBlob(index, tmpBlob); return blob; } } @Override - public void addSegmentedBlob(int index, long blobId, BlobParameterBuffer buffer) throws SQLException, IOException { - messageBuilder.addBlobHeader(blobId, buffer); - addBlob(index, blobId); + public void addSegmentedBlob(int index, BlobParameterBuffer buffer, FirebirdBlob blob) + throws SQLException, IOException { + messageBuilder.addBlobHeader(((FBBlob) blob).getBlobId(), buffer); + addBlob(index, blob); } @Override @@ -256,9 +262,9 @@ public void addBlobStream(byte[] inBuffer) throws SQLException { } @Override - public void registerBlob(int index, long existingBlob, long blobId) throws SQLException { - addBlob(index, blobId); - LongByReference longByReference = new LongByReference(blobId); + public void registerBlob(int index, long existingBlob, FirebirdBlob blob) throws SQLException { + addBlob(index, blob); + LongByReference longByReference = new LongByReference(((FBBlob) blob).getBlobId()); LongByReference existLong = new LongByReference(existingBlob); try (LockCloseable ignored = withLock()) { batch.registerBlob(getStatus(), existLong, longByReference); diff --git a/src/main/org/firebirdsql/gds/ng/AbstractFbBatch.java b/src/main/org/firebirdsql/gds/ng/AbstractFbBatch.java index 81b433382c..be213167b9 100644 --- a/src/main/org/firebirdsql/gds/ng/AbstractFbBatch.java +++ b/src/main/org/firebirdsql/gds/ng/AbstractFbBatch.java @@ -24,7 +24,7 @@ /** * * @author Vasiliy Yashkov - * @since 4.0 + * @since 6.0 */ public abstract class AbstractFbBatch implements FbBatch { diff --git a/src/main/org/firebirdsql/gds/ng/FbBatch.java b/src/main/org/firebirdsql/gds/ng/FbBatch.java index 46962188ab..7ddce0838f 100644 --- a/src/main/org/firebirdsql/gds/ng/FbBatch.java +++ b/src/main/org/firebirdsql/gds/ng/FbBatch.java @@ -4,6 +4,7 @@ import org.firebirdsql.gds.BlobParameterBuffer; import org.firebirdsql.gds.ng.fields.RowValue; import org.firebirdsql.gds.ng.listeners.ExceptionListenable; +import org.firebirdsql.jdbc.FirebirdBlob; import java.io.IOException; import java.sql.SQLException; @@ -16,7 +17,7 @@ *

* * @author Vasiliy Yashkov - * @since 4.0 + * @since 6.0 */ public interface FbBatch extends ExceptionListenable { @@ -43,7 +44,8 @@ public interface FbBatch extends ExceptionListenable { /** * Add existing blob in this batch. */ - void addBlob(int index, long blobId) throws SQLException; + void addBlob(int index, FirebirdBlob blob) + throws SQLException; /** * Add blob in this batch and ID will be generated by engine. @@ -58,7 +60,8 @@ public interface FbBatch extends ExceptionListenable { /** * Add blob in this batch. */ - void addSegmentedBlob(int index, long blobId, BlobParameterBuffer buffer) throws SQLException, IOException; + void addSegmentedBlob(int index, BlobParameterBuffer buffer, FirebirdBlob blob) + throws SQLException, IOException; /** * Append blob data. @@ -83,7 +86,7 @@ public interface FbBatch extends ExceptionListenable { /** * Register existing blob. */ - void registerBlob(int index, long existingBlob, long blobId) throws SQLException; + void registerBlob(int index, long existingBlob, FirebirdBlob blob) throws SQLException; /** * Execute tis batch and diff --git a/src/nativeoo-test/org/firebirdsql/gds/ng/nativeoo/IBatchImplTest.java b/src/nativeoo-test/org/firebirdsql/gds/ng/nativeoo/IBatchImplTest.java index e5d4bf40f8..108edcbb08 100644 --- a/src/nativeoo-test/org/firebirdsql/gds/ng/nativeoo/IBatchImplTest.java +++ b/src/nativeoo-test/org/firebirdsql/gds/ng/nativeoo/IBatchImplTest.java @@ -870,13 +870,16 @@ public void testBatchWithBlobStream() throws Exception { GDSHelper h = new GDSHelper(db); h.setCurrentTransaction(batch.getTransaction()); - FBBlob b1 = new FBBlob(h, 1); - FBBlob b2 = new FBBlob(h, 2); - FBBlob b3 = new FBBlob(h, 3); + FBBlob.Config config = FBBlob.createConfig(ISCConstants.BLOB_SUB_TYPE_BINARY, + db.getConnectionProperties(), db.getDatatypeCoder()); - batch.addBlob(1, b1.getBlobId()); - batch.addBlob(2, b2.getBlobId()); - batch.addBlob(3, b3.getBlobId()); + FBBlob b1 = new FBBlob(h, 1, null, config); + FBBlob b2 = new FBBlob(h, 2, null, config); + FBBlob b3 = new FBBlob(h, 3, null, config); + + batch.addBlob(1, b1); + batch.addBlob(2, b2); + batch.addBlob(3, b3); // blobs String d1 = "1111111111111111111"; @@ -932,9 +935,12 @@ public void testBatchWithSegmentedBlobs() throws Exception { h.setCurrentTransaction(batch.getTransaction()); // Create blobs - FBBlob b1 = new FBBlob(h, 4242); - FBBlob b2 = new FBBlob(h, 242); - FBBlob b3 = new FBBlob(h, 42); + FBBlob.Config config = FBBlob.createConfig(ISCConstants.BLOB_SUB_TYPE_BINARY, + db.getConnectionProperties(), db.getDatatypeCoder()); + + FBBlob b1 = new FBBlob(h, 4242, null, config); + FBBlob b2 = new FBBlob(h, 242, null, config); + FBBlob b3 = new FBBlob(h, 42, null, config); // blobs String blobSegment1 = INSERT_QUERY_WITHOUT_BLOBS; @@ -944,21 +950,21 @@ public void testBatchWithSegmentedBlobs() throws Exception { BlobParameterBuffer bpb = new BlobParameterBufferImp(); bpb.addArgument(BpbItems.isc_bpb_type, BpbItems.TypeValues.isc_bpb_type_segmented); - batch.addSegmentedBlob(1, b1.getBlobId(), bpb); + batch.addSegmentedBlob(1, bpb, b1); batch.addBlobSegment(blobSegment1.getBytes(), false); batch.addBlobSegment("\n".getBytes(), false); batch.addBlobSegment(blobSegment2.getBytes(), false); batch.addBlobSegment("\n".getBytes(), false); batch.addBlobSegment(blobSegment3.getBytes(), true); - batch.addSegmentedBlob(2, b2.getBlobId(), bpb); + batch.addSegmentedBlob(2, bpb, b2); batch.addBlobSegment(blobSegment1.getBytes(), false); batch.addBlobSegment("\n".getBytes(), false); batch.addBlobSegment(blobSegment2.getBytes(), false); batch.addBlobSegment("\n".getBytes(), false); batch.addBlobSegment(blobSegment3.getBytes(), true); - batch.addSegmentedBlob(3, b3.getBlobId(), bpb); + batch.addSegmentedBlob(3, bpb, b3); batch.addBlobSegment(blobSegment1.getBytes(), false); batch.addBlobSegment("\n".getBytes(), false); batch.addBlobSegment(blobSegment2.getBytes(), false); @@ -1013,9 +1019,12 @@ public void testMultipleMessagesBatchWithSegmentedBlobs() throws Exception { h.setCurrentTransaction(batch.getTransaction()); // Create blobs - FBBlob b1 = new FBBlob(h, 4242); - FBBlob b2 = new FBBlob(h, 242); - FBBlob b3 = new FBBlob(h, 42); + FBBlob.Config config = FBBlob.createConfig(ISCConstants.BLOB_SUB_TYPE_BINARY, + db.getConnectionProperties(), db.getDatatypeCoder()); + + FBBlob b1 = new FBBlob(h, 4242, null, config); + FBBlob b2 = new FBBlob(h, 242, null, config); + FBBlob b3 = new FBBlob(h, 42, null, config); // blobs String blobSegment1 = INSERT_QUERY_WITHOUT_BLOBS; @@ -1025,21 +1034,21 @@ public void testMultipleMessagesBatchWithSegmentedBlobs() throws Exception { BlobParameterBuffer bpb = new BlobParameterBufferImp(); bpb.addArgument(BpbItems.isc_bpb_type, BpbItems.TypeValues.isc_bpb_type_segmented); - batch.addSegmentedBlob(1, b1.getBlobId(), bpb); + batch.addSegmentedBlob(1, bpb, b1); batch.addBlobSegment(blobSegment1.getBytes(), false); batch.addBlobSegment("\n".getBytes(), false); batch.addBlobSegment(blobSegment2.getBytes(), false); batch.addBlobSegment("\n".getBytes(), false); batch.addBlobSegment(blobSegment3.getBytes(), true); - batch.addSegmentedBlob(2, b2.getBlobId(), bpb); + batch.addSegmentedBlob(2, bpb, b2); batch.addBlobSegment(blobSegment1.getBytes(), false); batch.addBlobSegment("\n".getBytes(), false); batch.addBlobSegment(blobSegment2.getBytes(), false); batch.addBlobSegment("\n".getBytes(), false); batch.addBlobSegment(blobSegment3.getBytes(), true); - batch.addSegmentedBlob(3, b3.getBlobId(), bpb); + batch.addSegmentedBlob(3, bpb, b3); batch.addBlobSegment(blobSegment1.getBytes(), false); batch.addBlobSegment("\n".getBytes(), false); batch.addBlobSegment(blobSegment2.getBytes(), false); @@ -1049,25 +1058,25 @@ public void testMultipleMessagesBatchWithSegmentedBlobs() throws Exception { batch.addBatch(); // Create blobs - FBBlob b4 = new FBBlob(h, 34242); - FBBlob b5 = new FBBlob(h, 3242); - FBBlob b6 = new FBBlob(h, 342); + FBBlob b4 = new FBBlob(h, 34242, null, config); + FBBlob b5 = new FBBlob(h, 3242, null, config); + FBBlob b6 = new FBBlob(h, 342, null, config); - batch.addSegmentedBlob(1, b4.getBlobId(), bpb); + batch.addSegmentedBlob(1, bpb, b4); batch.addBlobSegment(blobSegment1.getBytes(), false); batch.addBlobSegment("\n".getBytes(), false); batch.addBlobSegment(blobSegment2.getBytes(), false); batch.addBlobSegment("\n".getBytes(), false); batch.addBlobSegment(blobSegment3.getBytes(), true); - batch.addSegmentedBlob(2, b5.getBlobId(), bpb); + batch.addSegmentedBlob(2, bpb, b5); batch.addBlobSegment(blobSegment1.getBytes(), false); batch.addBlobSegment("\n".getBytes(), false); batch.addBlobSegment(blobSegment2.getBytes(), false); batch.addBlobSegment("\n".getBytes(), false); batch.addBlobSegment(blobSegment3.getBytes(), true); - batch.addSegmentedBlob(3, b6.getBlobId(), bpb); + batch.addSegmentedBlob(3, bpb, b6); batch.addBlobSegment(blobSegment1.getBytes(), false); batch.addBlobSegment("\n".getBytes(), false); batch.addBlobSegment(blobSegment2.getBytes(), false); @@ -1077,25 +1086,25 @@ public void testMultipleMessagesBatchWithSegmentedBlobs() throws Exception { batch.addBatch(); // Create blobs - FBBlob b7 = new FBBlob(h, 14242); - FBBlob b8 = new FBBlob(h, 1242); - FBBlob b9 = new FBBlob(h, 142); + FBBlob b7 = new FBBlob(h, 14242, null, config); + FBBlob b8 = new FBBlob(h, 1242, null, config); + FBBlob b9 = new FBBlob(h, 142, null, config); - batch.addSegmentedBlob(1, b7.getBlobId(), bpb); + batch.addSegmentedBlob(1, bpb, b7); batch.addBlobSegment(blobSegment1.getBytes(), false); batch.addBlobSegment("\n".getBytes(), false); batch.addBlobSegment(blobSegment2.getBytes(), false); batch.addBlobSegment("\n".getBytes(), false); batch.addBlobSegment(blobSegment3.getBytes(), true); - batch.addSegmentedBlob(2, b8.getBlobId(), bpb); + batch.addSegmentedBlob(2, bpb, b8); batch.addBlobSegment(blobSegment1.getBytes(), false); batch.addBlobSegment("\n".getBytes(), false); batch.addBlobSegment(blobSegment2.getBytes(), false); batch.addBlobSegment("\n".getBytes(), false); batch.addBlobSegment(blobSegment3.getBytes(), true); - batch.addSegmentedBlob(3, b9.getBlobId(), bpb); + batch.addSegmentedBlob(3, bpb, b9); batch.addBlobSegment(blobSegment1.getBytes(), false); batch.addBlobSegment("\n".getBytes(), false); batch.addBlobSegment(blobSegment2.getBytes(), false); @@ -1151,19 +1160,17 @@ public void testBatchWithRegisteredBlobs() throws Exception { h.setCurrentTransaction(batch.getTransaction()); // Create blobs - FBBlob b1 = new FBBlob(h, 4242, null, null); - FBBlob b2 = new FBBlob(h, 242, null, null); - FBBlob b3 = new FBBlob(h, 42,null, null); - - FbBlob regBlob1 = h.createBlob(FBBlob.createConfig(ISCConstants.BLOB_SUB_TYPE_BINARY, + final FBBlob.Config config = FBBlob.createConfig(ISCConstants.BLOB_SUB_TYPE_BINARY, db.getConnectionProperties(), - db.getDatatypeCoder())); - FbBlob regBlob2 = h.createBlob(FBBlob.createConfig(ISCConstants.BLOB_SUB_TYPE_BINARY, - db.getConnectionProperties(), - db.getDatatypeCoder())); - FbBlob regBlob3 = h.createBlob(FBBlob.createConfig(ISCConstants.BLOB_SUB_TYPE_BINARY, - db.getConnectionProperties(), - db.getDatatypeCoder())); + db.getDatatypeCoder()); + + FBBlob b1 = new FBBlob(h, 4242, null, config); + FBBlob b2 = new FBBlob(h, 242, null, config); + FBBlob b3 = new FBBlob(h, 42,null, config); + + FbBlob regBlob1 = h.createBlob(config); + FbBlob regBlob2 = h.createBlob(config); + FbBlob regBlob3 = h.createBlob(config); regBlob1.putSegment(INSERT_QUERY_WITH_BLOBS.getBytes()); regBlob1.close(); @@ -1173,9 +1180,9 @@ public void testBatchWithRegisteredBlobs() throws Exception { regBlob3.close(); // Register blobs - batch.registerBlob(1, regBlob1.getBlobId(), b1.getBlobId()); - batch.registerBlob(2, regBlob2.getBlobId(), b2.getBlobId()); - batch.registerBlob(3, regBlob3.getBlobId(), b3.getBlobId()); + batch.registerBlob(1, regBlob1.getBlobId(), b1); + batch.registerBlob(2, regBlob2.getBlobId(), b2); + batch.registerBlob(3, regBlob3.getBlobId(), b3); batch.addBatch(); From 0d55f0d6172dcaca8b372a9c104c327fa8e63fd3 Mon Sep 17 00:00:00 2001 From: Vasiliy Yashkov Date: Wed, 7 Jun 2023 16:02:14 +0300 Subject: [PATCH 12/12] Do not check connection when cancel operation in case of forced abort --- .../java/org/firebirdsql/gds/ng/nativeoo/IDatabaseImpl.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/jaybird-native/src/main/java/org/firebirdsql/gds/ng/nativeoo/IDatabaseImpl.java b/jaybird-native/src/main/java/org/firebirdsql/gds/ng/nativeoo/IDatabaseImpl.java index 2868c5faea..8211f1533b 100644 --- a/jaybird-native/src/main/java/org/firebirdsql/gds/ng/nativeoo/IDatabaseImpl.java +++ b/jaybird-native/src/main/java/org/firebirdsql/gds/ng/nativeoo/IDatabaseImpl.java @@ -135,7 +135,9 @@ public void dropDatabase() throws SQLException { @Override public void cancelOperation(int kind) throws SQLException { try { - checkConnected(); + if (kind != fb_cancel_abort) { + checkConnected(); + } // No synchronization, otherwise cancel will never work try { attachment.cancelOperation(getStatus(), kind);