diff --git a/build.gradle b/build.gradle index 61be007996..a342639247 100644 --- a/build.gradle +++ b/build.gradle @@ -69,7 +69,7 @@ sourceSets { } test { java { - srcDirs = ['src/test', 'src/jna-test'] + srcDirs = ['src/test', 'src/jna-test', 'src/nativeoo-test'] } resources { srcDirs = ['src/test_resources'] @@ -201,10 +201,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') { + } 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/gradle.properties b/gradle.properties index 558e9f1f53..3549c39066 100644 --- a/gradle.properties +++ b/gradle.properties @@ -21,7 +21,7 @@ test.db.dir=build/tmp/db test.db.host=localhost test.db.port=3050 test.db.lc_ctype=NONE -test.gds_type=PURE_JAVA +test.gds_type=FBOONATIVE test.use.firebird.autocommit=false test.enableProtocol=* diff --git a/jaybird-native/src/main/java/org/firebirdsql/gds/impl/jni/FbOOEmbeddedGDSFactoryPlugin.java b/jaybird-native/src/main/java/org/firebirdsql/gds/impl/jni/FbOOEmbeddedGDSFactoryPlugin.java new file mode 100644 index 0000000000..f0a79c86a5 --- /dev/null +++ b/jaybird-native/src/main/java/org/firebirdsql/gds/impl/jni/FbOOEmbeddedGDSFactoryPlugin.java @@ -0,0 +1,70 @@ +package org.firebirdsql.gds.impl.jni; + +import org.firebirdsql.gds.impl.BaseGDSFactoryPlugin; +import org.firebirdsql.gds.ng.nativeoo.FbOOEmbeddedDatabaseFactory; + +import java.sql.SQLException; +import java.sql.SQLNonTransientConnectionException; +import java.util.List; + +/** + * GDS factory plugin implementation for embedded OO API + * + * @since 6.0 + */ +public class FbOOEmbeddedGDSFactoryPlugin extends BaseGDSFactoryPlugin { + + public static final String EMBEDDED_TYPE_NAME = "FBOOEMBEDDED"; + private static final String DEFAULT_PROTOCOL = "jdbc:firebirdsql:fboo:embedded:"; + private static final List JDBC_PROTOCOLS = List.of(DEFAULT_PROTOCOL, "jdbc:firebird:fboo:embedded:"); + + public String getPluginName() { + return "GDS implementation for embedded server via OO API."; + } + + public String getTypeName() { + return EMBEDDED_TYPE_NAME; + } + + @SuppressWarnings("removal") + @Deprecated(since = "6", forRemoval = true) + @Override + public String[] getTypeAliases() { + return new String[0]; + } + + @Override + public List getTypeAliasList() { + return List.of(); + } + + @SuppressWarnings("removal") + @Deprecated(since = "6", forRemoval = true) + @Override + public String[] getSupportedProtocols() { + return JDBC_PROTOCOLS.toArray(new String[0]); + } + + @Override + public List getSupportedProtocolList() { + return JDBC_PROTOCOLS; + } + + @Override + public String getDefaultProtocol() { + return DEFAULT_PROTOCOL; + } + + public String getDatabasePath(String server, Integer port, String path) throws SQLException { + if (path == null) { + throw new SQLNonTransientConnectionException("Database name/path is required."); + } + + return path; + } + + @Override + public FbOOEmbeddedDatabaseFactory getDatabaseFactory() { + return FbOOEmbeddedDatabaseFactory.getInstance(); + } +} diff --git a/jaybird-native/src/main/java/org/firebirdsql/gds/impl/jni/FbOONativeGDSFactoryPlugin.java b/jaybird-native/src/main/java/org/firebirdsql/gds/impl/jni/FbOONativeGDSFactoryPlugin.java new file mode 100644 index 0000000000..de79361767 --- /dev/null +++ b/jaybird-native/src/main/java/org/firebirdsql/gds/impl/jni/FbOONativeGDSFactoryPlugin.java @@ -0,0 +1,78 @@ +package org.firebirdsql.gds.impl.jni; + +import org.firebirdsql.gds.impl.BaseGDSFactoryPlugin; +import org.firebirdsql.gds.ng.nativeoo.FbOOClientDatabaseFactory; + +import java.sql.SQLException; +import java.sql.SQLNonTransientConnectionException; +import java.util.List; + +/** + * GDS factory plugin implementation for native OO API + * + * @since 6.0 + */ +public class FbOONativeGDSFactoryPlugin extends BaseGDSFactoryPlugin { + + public static final String NATIVE_TYPE_NAME = "FBOONATIVE"; + private static final String DEFAULT_PROTOCOL = "jdbc:firebirdsql:fboo:native:"; + private static final List JDBC_PROTOCOLS = List.of(DEFAULT_PROTOCOL, "jdbc:firebird:fboo:native:"); + + @Override + public String getPluginName() { + return "JNA-based GDS implementation via OO API."; + } + + @Override + public String getTypeName() { + return NATIVE_TYPE_NAME; + } + + @SuppressWarnings("removal") + @Deprecated(since = "6", forRemoval = true) + @Override + public String[] getTypeAliases() { + return new String[0]; + } + + @SuppressWarnings("removal") + @Deprecated(since = "6", forRemoval = true) + @Override + public String[] getSupportedProtocols() { + return JDBC_PROTOCOLS.toArray(new String[0]); + } + + @Override + public List getSupportedProtocolList() { + return JDBC_PROTOCOLS; + } + + @Override + public String getDefaultProtocol() { + return DEFAULT_PROTOCOL; + } + + @Override + public String getDatabasePath(String server, Integer port, String path) throws SQLException { + if (path == null) { + throw new SQLNonTransientConnectionException("Server name/address is required for native implementation."); + } + if (server == null) { + return path; + } + + var 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/jaybird-native/src/main/java/org/firebirdsql/gds/ng/jna/JnaDatabase.java b/jaybird-native/src/main/java/org/firebirdsql/gds/ng/jna/JnaDatabase.java index 64cd7a2c1f..a14e8ff2ab 100644 --- a/jaybird-native/src/main/java/org/firebirdsql/gds/ng/jna/JnaDatabase.java +++ b/jaybird-native/src/main/java/org/firebirdsql/gds/ng/jna/JnaDatabase.java @@ -478,6 +478,21 @@ public void cancelEvent(EventHandle eventHandle) throws SQLException { } } + @Override + public FbBatch createBatch(FbTransaction transaction, String statement, FbMessageMetadata metadata, BatchParameterBuffer parameters) throws SQLException { + throw new FBDriverNotCapableException(); + } + + @Override + public FbBatch createBatch(FbTransaction transaction, String statement, BatchParameterBuffer parameters) throws SQLException { + throw new FBDriverNotCapableException(); + } + + @Override + public FbMetadataBuilder getMetadataBuilder(int fieldCount) throws SQLException { + throw new FBDriverNotCapableException(); + } + private void processStatusVector() throws SQLException { processStatusVector(statusVector, getDatabaseWarningCallback()); } diff --git a/jaybird-native/src/main/java/org/firebirdsql/gds/ng/nativeoo/AbstractNativeConnection.java b/jaybird-native/src/main/java/org/firebirdsql/gds/ng/nativeoo/AbstractNativeConnection.java new file mode 100644 index 0000000000..850ddc5bfa --- /dev/null +++ b/jaybird-native/src/main/java/org/firebirdsql/gds/ng/nativeoo/AbstractNativeConnection.java @@ -0,0 +1,218 @@ +package org.firebirdsql.gds.ng.nativeoo; + +import com.sun.jna.Pointer; +import org.firebirdsql.encodings.IEncodingFactory; +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; +import org.firebirdsql.jna.fbclient.FbInterface.IStatus; + +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; +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. + * That's using for native OO API. + * + * @param Type of attach properties + * @param Type of connection handle + * @since 6.0 + */ +public abstract class AbstractNativeConnection, C extends FbAttachment> + extends AbstractConnection { + private static final System.Logger log = System.getLogger(AbstractNativeConnection.class.getName()); + 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). + * + * @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"); + this.attachUrl = createAttachUrl(toDbAttachInfo(attachProperties), attachProperties); + } + + private DbAttachInfo toDbAttachInfo(T attachProperties) throws SQLException { + DbAttachInfo initialDbAttachInfo = DbAttachInfo.of(attachProperties); + + if (!initialDbAttachInfo.hasServerName() && initialDbAttachInfo.hasAttachObjectName() + && initialDbAttachInfo.attachObjectName().startsWith("//")) { + // This is a connection string using the default URL format which is not directly supported by fbclient + return DbAttachInfo.parseConnectString(initialDbAttachInfo.attachObjectName()); + } + + return initialDbAttachInfo; + } + + protected abstract String createAttachUrl(DbAttachInfo dbAttachInfo, T attachProperties) throws SQLException; + + /** + * @return The client library instance associated with the connection. + */ + public final FbClientLibrary getClientLibrary() { + return clientLibrary; + } + + /** + * Processing {@link IStatus} to get result of native calling + */ + protected void processStatus(IStatus status, WarningMessageCallback warningMessageCallback) + throws SQLException { + if (warningMessageCallback == null) { + throw new NullPointerException("warningMessageCallback is null"); + } + + final FbExceptionBuilder builder = new FbExceptionBuilder(); + + if (status.getState() == IStatus.STATE_WARNINGS) { + final long[] warningVector = status.getWarnings().getLongArray(0, 20); + processVector(warningVector, builder); + } + + if (status.getState() == IStatus.STATE_ERRORS) { + final long[] errorVector = status.getErrors().getLongArray(0, 20); + processVector(errorVector, builder); + } + + if (!builder.isEmpty()) { + SQLException exception = builder.toFlatSQLException(); + if (exception instanceof SQLWarning) { + warningMessageCallback.processWarning((SQLWarning) exception); + } else { + throw exception; + } + } + } + + private void processVector(long[] errorVector, FbExceptionBuilder builder) { + int vectorIndex = 0; + processingLoop: + while (vectorIndex < errorVector.length) { + int arg = (int) errorVector[vectorIndex++]; + int errorCode; + switch (arg) { + case isc_arg_gds: + errorCode = (int) errorVector[vectorIndex++]; + log.log(System.Logger.Level.DEBUG, "readStatusVector arg:isc_arg_gds int: " + errorCode); + if (errorCode != 0) { + builder.exception(errorCode); + } + break; + case isc_arg_warning: + errorCode = (int) errorVector[vectorIndex++]; + log.log(System.Logger.Level.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 = errorVector[vectorIndex++]; + if (stringPointerAddress == 0L) { + log.log(System.Logger.Level.WARNING, "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) { + log.log(System.Logger.Level.DEBUG, "readStatusVector string: " + stringValue); + builder.messageParameter(stringValue); + } else { + log.log(System.Logger.Level.DEBUG, "readStatusVector sqlstate: " + stringValue); + builder.sqlState(stringValue); + } + break; + case isc_arg_cstring: + 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) errorVector[vectorIndex++]; + log.log(System.Logger.Level.DEBUG, "readStatusVector arg:isc_arg_number int: " + intValue); + builder.messageParameter(intValue); + break; + case isc_arg_end: + break processingLoop; + default: + int e = (int) errorVector[vectorIndex++]; + log.log(System.Logger.Level.DEBUG, "readStatusVector arg: " + arg + " int: " + e); + builder.messageParameter(e); + break; + } + } + + } + + public final DatatypeCoder createDatatypeCoder() { + if (bigEndian) { + return BigEndianDatatypeCoder.forEncodingFactory(getEncodingFactory()); + } + return LittleEndianDatatypeCoder.forEncodingFactory(getEncodingFactory()); + } + + /** + * Gets the attach URL for the library. + * + * @return Attach URL + */ + public String getAttachUrl() { + return attachUrl; + } + + /** + * Builds the attach URL for the library. + * + * @return Attach URL + */ + protected static String toAttachUrl(DbAttachInfo dbAttachInfo) { + if (!dbAttachInfo.hasServerName()) { + return dbAttachInfo.attachObjectName(); + } + String serverName = dbAttachInfo.serverName(); + String attachObjectName = dbAttachInfo.attachObjectName(); + 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('/').append(dbAttachInfo.portNumber()) + .append(':').append(attachObjectName); + return sb.toString(); + } +} diff --git a/jaybird-native/src/main/java/org/firebirdsql/gds/ng/nativeoo/AbstractNativeOODatabaseFactory.java b/jaybird-native/src/main/java/org/firebirdsql/gds/ng/nativeoo/AbstractNativeOODatabaseFactory.java new file mode 100644 index 0000000000..b4d07c3272 --- /dev/null +++ b/jaybird-native/src/main/java/org/firebirdsql/gds/ng/nativeoo/AbstractNativeOODatabaseFactory.java @@ -0,0 +1,47 @@ +package org.firebirdsql.gds.ng.nativeoo; + +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.jna.fbclient.FbClientLibrary; + +import java.sql.SQLException; + +/** + * Implementation of {@link org.firebirdsql.gds.ng.FbDatabaseFactory} for the Native OO protocol implementation. + * + * @since 6.0 + */ +public abstract class AbstractNativeOODatabaseFactory implements FbDatabaseFactory { + @Override + public IDatabaseImpl connect(IConnectionProperties connectionProperties) throws SQLException { + final NativeDatabaseConnection databaseConnection = new NativeDatabaseConnection(getClientLibrary(), + filterProperties(connectionProperties)); + return databaseConnection.identify(); + } + + @Override + public IServiceImpl 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/jaybird-native/src/main/java/org/firebirdsql/gds/ng/nativeoo/FbOOClientDatabaseFactory.java b/jaybird-native/src/main/java/org/firebirdsql/gds/ng/nativeoo/FbOOClientDatabaseFactory.java new file mode 100644 index 0000000000..d613989c14 --- /dev/null +++ b/jaybird-native/src/main/java/org/firebirdsql/gds/ng/nativeoo/FbOOClientDatabaseFactory.java @@ -0,0 +1,45 @@ +package org.firebirdsql.gds.ng.nativeoo; + +import com.sun.jna.Native; +import org.firebirdsql.gds.JaybirdSystemProperties; +import org.firebirdsql.jna.fbclient.FbClientLibrary; +import org.firebirdsql.jna.fbclient.FbInterface; + +/** + * Implementation of {@link org.firebirdsql.gds.ng.nativeoo.AbstractNativeOODatabaseFactory} to connect with native + * client library via OO API. + * + * @since 6.0 + */ +public class FbOOClientDatabaseFactory extends AbstractNativeOODatabaseFactory { + private static final FbOOClientDatabaseFactory INSTANCE = new FbOOClientDatabaseFactory(); + static final String LIBRARY_NAME_FBCLIENT = "fbclient"; + + @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.load(LIBRARY_NAME_FBCLIENT, FbInterface.class); + } + + private static FbClientLibrary syncWrapIfNecessary(FbClientLibrary clientLibrary) { + if (JaybirdSystemProperties.isSyncWrapNativeLibrary()) { + return (FbClientLibrary) Native.synchronizedLibrary(clientLibrary); + } + return clientLibrary; + } + } +} diff --git a/jaybird-native/src/main/java/org/firebirdsql/gds/ng/nativeoo/FbOOEmbeddedDatabaseFactory.java b/jaybird-native/src/main/java/org/firebirdsql/gds/ng/nativeoo/FbOOEmbeddedDatabaseFactory.java new file mode 100644 index 0000000000..3bd7be5a4f --- /dev/null +++ b/jaybird-native/src/main/java/org/firebirdsql/gds/ng/nativeoo/FbOOEmbeddedDatabaseFactory.java @@ -0,0 +1,86 @@ +package org.firebirdsql.gds.ng.nativeoo; + +import com.sun.jna.Native; +import org.firebirdsql.gds.JaybirdSystemProperties; +import org.firebirdsql.gds.ng.IAttachProperties; +import org.firebirdsql.jna.fbclient.FbClientLibrary; +import org.firebirdsql.jna.fbclient.FbInterface; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +/** + * Implementation of {@link org.firebirdsql.gds.ng.nativeoo.AbstractNativeOODatabaseFactory} to connect with embedded + * client library via OO API. + * + * @since 6.0 + */ +public class FbOOEmbeddedDatabaseFactory extends AbstractNativeOODatabaseFactory { + + private static final System.Logger log = System.getLogger(FbOOEmbeddedDatabaseFactory.class.getName()); + private static final List LIBRARIES_TO_TRY = + List.of("fbembed", FbOOClientDatabaseFactory.LIBRARY_NAME_FBCLIENT); + 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<>(); + final List librariesToTry = findLibrariesToTry(); + for (String libraryName : LIBRARIES_TO_TRY) { + try { + return Native.load(libraryName, FbInterface.class); + } catch (UnsatisfiedLinkError e) { + throwables.add(e); + log.log(System.Logger.Level.DEBUG, "Attempt to load " + libraryName + " failed", e); + // continue with next + } + } + assert throwables.size() == librariesToTry.size(); + log.log(System.Logger.Level.ERROR, "Could not load any of the libraries in " + librariesToTry + ":"); + for (int idx = 0; idx < librariesToTry.size(); idx++) { + log.log(System.Logger.Level.ERROR, "Loading " + librariesToTry.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; + } + + private static List findLibrariesToTry() { + return LIBRARIES_TO_TRY; + } + } +} diff --git a/jaybird-native/src/main/java/org/firebirdsql/gds/ng/nativeoo/IBatchCompletionStateImpl.java b/jaybird-native/src/main/java/org/firebirdsql/gds/ng/nativeoo/IBatchCompletionStateImpl.java new file mode 100644 index 0000000000..8ddefcc2a6 --- /dev/null +++ b/jaybird-native/src/main/java/org/firebirdsql/gds/ng/nativeoo/IBatchCompletionStateImpl.java @@ -0,0 +1,215 @@ +package org.firebirdsql.gds.ng.nativeoo; + +import org.firebirdsql.gds.ng.BatchCompletion; +import org.firebirdsql.gds.ng.FbBatchCompletionState; +import org.firebirdsql.jna.fbclient.CloseableMemory; +import org.firebirdsql.jna.fbclient.FbInterface.IBatchCompletionState; +import org.firebirdsql.jna.fbclient.FbInterface.IStatus; +import org.firebirdsql.jna.fbclient.FbInterface.IUtil; + +import java.sql.SQLException; +import java.util.*; + +/** + * Implementation of {@link org.firebirdsql.gds.ng.FbBatchCompletionState} for native batch execution. + * + * @author Vasiliy Yashkov + * @since 6.0 + */ +public class IBatchCompletionStateImpl implements FbBatchCompletionState { + + private final IBatchCompletionState state; + private final IDatabaseImpl database; + private final IStatus status; + + public IBatchCompletionStateImpl(IDatabaseImpl database, IBatchCompletionState state, IStatus status) { + this.database = database; + this.state = state; + this.status = status; + } + + @Override + public int getSize() throws SQLException { + int result = state.getSize(getStatus()); + processStatus(); + return result; + } + + @Override + public int getState(int index) throws SQLException { + int result = state.getState(getStatus(), index); + processStatus(); + return result; + } + + @Override + public String getError(int index) throws SQLException { + 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())); + return builder.toString(); + } + } + return ""; + } + + @Override + public String printAllStates() throws SQLException { + StringBuilder builder = new StringBuilder(); + + boolean print1 = false; + boolean print2 = false; + + final IUtil util = database.getMaster().getUtilInterface(); + + int updateCount = state.getSize(getStatus()); + processStatus(); + int unknownCount = 0; + int successCount = 0; + for (int p = 0; p < updateCount; ++p) { + int s = state.getState(getStatus(), p); + processStatus(); + switch (s) { + case EXECUTE_FAILED: + if (!print1) { + builder.append(String.format("Message Status %d\n", p)); + print1 = true; + } + builder.append(String.format("%5d Execute failed\n", p)); + break; + + case SUCCESS_NO_INFO: + ++unknownCount; + break; + + default: + if (!print1) { + builder.append(String.format("Message Status %d\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)) != NO_MORE_ERRORS; ++p) { + state.getStatus(getStatus(), errorStatus, p); + processStatus(); + + try (CloseableMemory memory = new CloseableMemory(1024)) { + + util.formatStatus(memory, (int) memory.size() - 1, errorStatus); + if (!print2) { + builder.append(String.format("\nDetailed errors status %d:\n", p)); + print2 = true; + } + builder.append(String.format("Message %d: %s\n", p, memory.getString(0, + database.getEncoding().getCharsetName()))); + } + } + + if (errorStatus != null) + errorStatus.dispose(); + + return builder.toString(); + } + + @Override + public int[] getAllStates() throws SQLException { + 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; + } + + @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; + } + + private IDatabaseImpl getDatabase() { + return database; + } + + private void processStatus() throws SQLException { + getDatabase().processStatus(status, null); + } + +} 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 new file mode 100644 index 0000000000..50624ed65b --- /dev/null +++ b/jaybird-native/src/main/java/org/firebirdsql/gds/ng/nativeoo/IBatchImpl.java @@ -0,0 +1,338 @@ +package org.firebirdsql.gds.ng.nativeoo; + +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; +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.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; +import org.firebirdsql.jna.fbclient.FbInterface.IBatchCompletionState; +import org.firebirdsql.jna.fbclient.FbInterface.IStatus; + +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. + * + * @author Vasiliy Yashkov + * @since 6.0 + */ +public class IBatchImpl extends AbstractFbBatch { + + 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.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 statementText, + BatchParameterBuffer parameters) throws SQLException { + super(database, parameters); + this.transaction = transaction; + 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.metadata = (IMessageMetadataImpl) statement.getInputMetadata(); + 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 For errors when initializing batch + */ + private void init() throws SQLException { + try (LockCloseable ignored = withLock()) { + if (metadata == null) { + if (statement == null) { + statement = new IStatementImpl(getDatabase()); + statement.setTransaction(transaction); + statement.prepare(statementText); + } + metadata = (IMessageMetadataImpl) statement.getInputMetadata(); + } + final byte[] statementArray = getDatabase().getEncoding().encodeToCharset(statementText); + if (parameterBuffer == null) { + batch = attachment.createBatch(getStatus(), ((ITransactionImpl) transaction).getTransaction(), + statementArray.length, statementArray, getDatabase().getDatabaseDialect(), + metadata.getMetadata(), 0, null); + } else { + batch = attachment.createBatch(getStatus(), ((ITransactionImpl) transaction).getTransaction(), + statementArray.length, statementArray, getDatabase().getDatabaseDialect(), metadata.getMetadata(), + parameterBuffer.toBytesWithType().length, parameterBuffer.toBytesWithType()); + } + processStatus(); + } + this.messageBuilder = new IMessageBuilderImpl(this); + prepareBatch(); + } + + /** + * Build batch message from field values. + * + * @throws SQLException For errors when adding field values to batch + */ + @Override + 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)) { + try (LockCloseable ignored = withLock()) { + 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(); + } + } + + /** + * Build batch message from field values. + * + * @throws SQLException For errors when adding fields values to batch + */ + @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); + try (LockCloseable ignored = withLock()) { + batch.registerBlob(getStatus(), existLong, longByReference); + processStatus(); + } + } + } + byte[] data = messageBuilder.getData(); + try (CloseableMemory memory = new CloseableMemory(data.length)) { + try (LockCloseable ignored = withLock()) { + 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, FirebirdBlob blob) + throws SQLException { + setBlob(index, blob); + } + + /* + * Before use, сheck the buffer contains BLOB_ID_ENGINE that blob ID will be generated by engine + */ + @Override + public FbBlob addBlob(int index, byte[] inBuffer, BlobParameterBuffer buffer) throws SQLException { + return addBlob(index, inBuffer, 0, buffer); + } + + @Override + public FbBlob addBlob(int index, byte[] inBuffer, long blobId, BlobParameterBuffer buffer) throws SQLException { + try (CloseableMemory memory = new CloseableMemory(inBuffer.length)) { + + if (inBuffer != null) + memory.write(0, inBuffer, 0, inBuffer.length); + else + memory.write(0, new byte[] {}, 0, 0); + LongByReference longByReference = new LongByReference(blobId); + + try (LockCloseable ignored = withLock()) { + 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(), null, + FBBlob.createConfig(ISCConstants.BLOB_SUB_TYPE_BINARY, getDatabase().getConnectionProperties(), + getDatabase().getDatatypeCoder())); + setBlob(index, tmpBlob); + return blob; + } + } + + @Override + public void addSegmentedBlob(int index, BlobParameterBuffer buffer, FirebirdBlob blob) + throws SQLException, IOException { + messageBuilder.addBlobHeader(((FBBlob) blob).getBlobId(), buffer); + addBlob(index, blob); + } + + @Override + public void appendBlobData(byte[] inBuffer) throws SQLException { + try (CloseableMemory memory = new CloseableMemory(inBuffer.length)) { + try (LockCloseable ignored = withLock()) { + 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)) { + try (LockCloseable ignored = withLock()) { + memory.write(0, inBuffer, 0, inBuffer.length); + batch.addBlobStream(getStatus(), inBuffer.length, memory); + processStatus(); + } + } + } + + @Override + 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); + processStatus(); + } + } + + @Override + public FbBatchCompletionState execute() throws SQLException { + try (LockCloseable ignored = withLock()) { + IBatchCompletionState execute = batch.execute(getStatus(), ((ITransactionImpl) + transaction).getTransaction()); + processStatus(); + return new IBatchCompletionStateImpl(getDatabase(), execute, getDatabase().getStatus()); + } + } + + @Override + public void cancel() throws SQLException { + try (LockCloseable ignored = withLock()) { + batch.cancel(getStatus()); + processStatus(); + } + } + + @Override + public int getBlobAlignment() throws SQLException { + try (LockCloseable ignored = withLock()) { + int result = batch.getBlobAlignment(getStatus()); + processStatus(); + return result; + } + } + + @Override + public FbMessageMetadata getMetadata() throws SQLException { + return metadata; + } + + @Override + public void setDefaultBpb(int parLength, byte[] par) throws SQLException { + try (LockCloseable ignored = withLock()) { + batch.setDefaultBpb(getStatus(), parLength, par); + processStatus(); + } + } + + @Override + public FbStatement getStatement() throws SQLException { + return this.statement; + } + + @Override + public void release() throws SQLException { + batch.release(); + } + + 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/jaybird-native/src/main/java/org/firebirdsql/gds/ng/nativeoo/IBlobImpl.java b/jaybird-native/src/main/java/org/firebirdsql/gds/ng/nativeoo/IBlobImpl.java new file mode 100644 index 0000000000..dabfc6a0d8 --- /dev/null +++ b/jaybird-native/src/main/java/org/firebirdsql/gds/ng/nativeoo/IBlobImpl.java @@ -0,0 +1,247 @@ +package org.firebirdsql.gds.ng.nativeoo; + +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.LockCloseable; +import org.firebirdsql.gds.ng.listeners.DatabaseListener; +import org.firebirdsql.jna.fbclient.CloseableMemory; +import org.firebirdsql.jna.fbclient.FbInterface.IAttachment; +import org.firebirdsql.jna.fbclient.FbInterface.IBlob; +import org.firebirdsql.jna.fbclient.FbInterface.IStatus; + +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; + +/** + * Implementation of {@link org.firebirdsql.gds.ng.FbBlob} for native OO API. + * + * @author Vasiliy Yashkov + * @since 6.0 + */ +public class IBlobImpl extends AbstractFbBlob implements FbBlob, DatabaseListener { + + 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); + } + + public IBlobImpl(IDatabaseImpl database, ITransactionImpl transaction, BlobParameterBuffer blobParameterBuffer, + long blobId) { + super(database, transaction, blobParameterBuffer); + this.blobId = new LongByReference(blobId); + outputBlob = blobId == NO_BLOB_ID; + this.status = database.getStatus(); + } + + @Override + protected void closeImpl() throws SQLException { + try (LockCloseable ignored = withLock()) { + blob.close(getStatus()); + processStatus(); + } finally { + byteBuffer = null; + } + } + + @Override + protected void cancelImpl() throws SQLException { + try (LockCloseable ignored = withLock()) { + blob.cancel(getStatus()); + processStatus(); + } finally { + byteBuffer = null; + } + } + + @Override + protected void releaseResources() { + 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]; + } + try (LockCloseable ignored = withLock()) { + checkDatabaseAttached(); + checkTransactionActive(); + checkBlobClosed(); + + IAttachment attachment = getDatabase().getAttachment(); + if (isOutput()) { + blob = attachment.createBlob(getStatus(), ((ITransactionImpl)getTransaction()).getTransaction(), + blobId, bpb.length, bpb); + } else { + blob = attachment.openBlob(getStatus(), ((ITransactionImpl)getTransaction()).getTransaction(), + blobId, bpb.length, bpb); + } + processStatus(); + 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(); + } + sizeRequested = Math.min(sizeRequested, getMaximumSegmentSize()); + final ByteBuffer responseBuffer; + final CloseableMemory actualLength = new CloseableMemory(1024); + try (LockCloseable ignored = withLock()) { + checkDatabaseAttached(); + checkTransactionActive(); + checkBlobOpen(); + responseBuffer = getByteBuffer(sizeRequested); + try (CloseableMemory memory = new CloseableMemory(sizeRequested)) { + 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)) { + if (result == IStatus.RESULT_NO_DATA) { + setEof(); + } + } + memory.read(0, responseBuffer.array(), 0, sizeRequested); + } + } + final int actualLengthInt = actualLength.getInt(0) & 0xFFFF; + 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(); + } + if (segment.length > getMaximumSegmentSize()) { + throw new FbExceptionBuilder().exception(jb_blobPutSegmentTooLong).toSQLException(); + } + try (LockCloseable ignored = withLock()) { + checkDatabaseAttached(); + checkTransactionActive(); + checkBlobOpen(); + + try (CloseableMemory memory = new CloseableMemory(segment.length)) { + memory.write(0, segment, 0, segment.length); + blob.putSegment(getStatus(), segment.length, memory); + processStatus(); + } + } + } catch (SQLException e) { + exceptionListenerDispatcher.errorOccurred(e); + throw e; + } + } + + @Override + public void seek(int offset, SeekMode seekMode) throws SQLException { + 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; + } + } + + @Override + public byte[] getBlobInfo(byte[] requestItems, int bufferLength) throws SQLException { + try { + byte[] responseArr = new byte[bufferLength]; + try (LockCloseable ignored = withLock()) { + checkDatabaseAttached(); + checkBlobOpen(); + blob.getInfo(getStatus(), requestItems.length, requestItems, bufferLength, responseArr); + processStatus(); + } + 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; + } + + 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/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 new file mode 100644 index 0000000000..8211f1533b --- /dev/null +++ b/jaybird-native/src/main/java/org/firebirdsql/gds/ng/nativeoo/IDatabaseImpl.java @@ -0,0 +1,475 @@ +package org.firebirdsql.gds.ng.nativeoo; + +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.LockCloseable; +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.FbInterface; +import org.firebirdsql.jna.fbclient.ISC_STATUS; +import org.firebirdsql.jna.fbclient.FbInterface.IAttachment; +import org.firebirdsql.jna.fbclient.FbInterface.IEvents; +import org.firebirdsql.jna.fbclient.FbInterface.IMaster; +import org.firebirdsql.jna.fbclient.FbInterface.IProvider; +import org.firebirdsql.jna.fbclient.FbInterface.IStatus; +import org.firebirdsql.jna.fbclient.FbInterface.ITransaction; +import org.firebirdsql.jna.fbclient.FbInterface.IUtil; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +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; + +/** + * Implementation of {@link org.firebirdsql.gds.ng.FbDatabase} for native OO API. + * + * @author Vasiliy Yashkov + * @since 6.0 + */ +public class IDatabaseImpl extends AbstractFbDatabase + implements FbAttachment, TransactionListener { + + private static final ParameterConverter PARAMETER_CONVERTER = new IParameterConverterImpl(); + + private FbClientLibrary clientLibrary; + private IMaster master; + private final IProvider provider; + private final IUtil util; + protected IAttachment attachment; + private final Map events = new HashMap<>(); + protected IStatus status; + + + public IDatabaseImpl(NativeDatabaseConnection connection) { + super(connection, connection.createDatatypeCoder()); + clientLibrary = connection.getClientLibrary(); + master = ((FbInterface)clientLibrary).fb_get_master_interface(); + provider = master.getDispatcher(); + util = master.getUtilInterface(); + attachment = null; + status = master.getStatus(); + } + + /** + * @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 = PARAMETER_CONVERTER.toDatabaseParameterBuffer(connection); + attachOrCreate(dpb, false); + } catch (SQLException e) { + exceptionListenerDispatcher.errorOccurred(e); + throw e; + } + } + + @Override + protected void internalDetach() throws SQLException { + try (LockCloseable ignored = withLock()) { + attachment.detach(getStatus()); + processStatus(); + } catch (SQLException e) { + throw e; + } finally { + setDetached(); + } + } + + @Override + public void createDatabase() throws SQLException { + try { + final DatabaseParameterBuffer dpb = PARAMETER_CONVERTER.toDatabaseParameterBuffer(connection); + attachOrCreate(dpb, true); + } catch (SQLException e) { + exceptionListenerDispatcher.errorOccurred(e); + throw e; + } + } + + @Override + public void dropDatabase() throws SQLException { + try { + checkConnected(); + try (LockCloseable ignored = withLock()) { + attachment.dropDatabase(getStatus()); + } finally { + setDetached(); + } + } catch (SQLException e) { + exceptionListenerDispatcher.errorOccurred(e); + throw e; + } + } + + @Override + public void cancelOperation(int kind) throws SQLException { + try { + if (kind != fb_cancel_abort) { + checkConnected(); + } + // No synchronization, otherwise cancel will never work + try { + attachment.cancelOperation(getStatus(), kind); + processStatus(); + } finally { + if (kind == fb_cancel_abort) { + attachment.detach(getStatus()); + processStatus(); + setDetached(); + } + } + } catch (SQLException e) { + exceptionListenerDispatcher.errorOccurred(e); + throw e; + } + } + + @Override + public FbTransaction startTransaction(TransactionParameterBuffer tpb) throws SQLException { + try { + checkConnected(); + final byte[] tpbArray = tpb.toBytesWithType(); + try (LockCloseable ignored = withLock()) { + ITransaction transaction = attachment.startTransaction(getStatus(), tpbArray.length, tpbArray); + processStatus(); + 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); + + try (LockCloseable ignored = withLock()) { + ITransaction iTransaction = attachment.reconnectTransaction(getStatus(), transactionIdBuffer.length, + transactionIdBuffer); + processStatus(); + 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]; + try (LockCloseable ignored = withLock()) { + attachment.getInfo(getStatus(), requestItems.length, requestItems, (short) maxBufferLength, responseArray); + } + processStatus(); + return responseArray; + } catch (SQLException 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(); + } + final byte[] statementArray = getEncoding().encodeToCharset(statementText); + try (LockCloseable ignored = withLock()) { + if (attachment == null) { + 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, + 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" ); + } + + @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(), IEventImpl.class)); + } + IEventImpl event = (IEventImpl) 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 IEventImpl createEventHandle(String eventName, EventHandler eventHandler) throws SQLException { + final IEventImpl eventHandle = new IEventImpl(eventName, eventHandler, getEncoding()); + try (LockCloseable ignored = withLock()) { + synchronized (eventHandle) { + int size = clientLibrary.isc_event_block(eventHandle.getEventBuffer(), eventHandle.getResultBuffer(), + (short) 1, eventHandle.getEventNameMemory()); + eventHandle.setSize(size); + } + } + return eventHandle; + } + + @Override + public void countEvents(EventHandle eventHandle) throws SQLException { + try { + final IEventImpl event = validateEventHandle(eventHandle); + int count; + try (LockCloseable ignored = withLock()) { + 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(); + } + } + event.setEventCount(count); + } catch (SQLException e) { + exceptionListenerDispatcher.errorOccurred(e); + throw e; + } + } + + @Override + public void queueEvent(EventHandle eventHandle) throws SQLException { + try { + checkConnected(); + final IEventImpl event = validateEventHandle(eventHandle); + + try (LockCloseable ignored = withLock()) { + synchronized (event) { + int length = event.getSize(); + byte[] array = event.getEventBuffer().getValue().getByteArray(0, length); + IEvents iEvents = attachment.queEvents(getStatus(), event.getCallback(), + length, + array); + events.put(eventHandle, iEvents); + } + } + } catch (SQLException e) { + exceptionListenerDispatcher.errorOccurred(e); + throw e; + } + } + + @Override + public void cancelEvent(EventHandle eventHandle) throws SQLException { + try { + checkConnected(); + final IEventImpl event = validateEventHandle(eventHandle); + + try (LockCloseable ignored = withLock()) { + synchronized (event) { + try { + IEvents iEvents = events.remove(eventHandle); + iEvents.cancel(getStatus()); + } finally { + event.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(); + + try (LockCloseable ignored = withLock()) { + try { + if (create) { + attachment = provider.createDatabase(getStatus(), dbName, (short) dpbArray.length, dpbArray); + } else { + attachment = provider.attachDatabase(getStatus(), dbName, (short) dpbArray.length, dpbArray); + } + processStatus(); + } 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() { + status.clear(); + 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/jaybird-native/src/main/java/org/firebirdsql/gds/ng/nativeoo/IEventImpl.java b/jaybird-native/src/main/java/org/firebirdsql/gds/ng/nativeoo/IEventImpl.java new file mode 100644 index 0000000000..59e22e551b --- /dev/null +++ b/jaybird-native/src/main/java/org/firebirdsql/gds/ng/nativeoo/IEventImpl.java @@ -0,0 +1,154 @@ +package org.firebirdsql.gds.ng.nativeoo; + +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.gds.ng.jna.JnaEventHandle; +import org.firebirdsql.jna.fbclient.CloseableMemory; +import org.firebirdsql.jna.fbclient.FbInterface.IEventCallback; +import org.firebirdsql.jna.fbclient.FbInterface.IEventCallbackIntf; + +/** + * Event handle for the native OO API. + * + * @author Vasiliy Yashkov + * @since 6.0 + */ +public class IEventImpl extends AbstractEventHandle { + + private static final System.Logger log = System.getLogger(IEventImpl.class.getName()); + + private final CloseableMemory eventNameMemory; + private int size = -1; + private final PointerByReference eventBuffer = new PointerByReference(); + private final PointerByReference resultBuffer = new PointerByReference(); + private IEventCallback callback = new IEventCallback(new IEventCallbackImpl()); + private volatile int referenceCount = 0; + + IEventImpl(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 this.size; + } + + /** + * @return Event callback. + */ + IEventCallback getCallback() { + return callback; + } + + /** + * Dumps the event buffers to the logger, if debug is enabled. + */ + @SuppressWarnings("unused") + public void debugMemoryDump() { + if (!log.isLoggable(System.Logger.Level.DEBUG)) return; + if (size == -1) { + log.log(System.Logger.Level.DEBUG, "Event handle not allocated"); + } + synchronized (JnaEventHandle.class) { + log.log(System.Logger.Level.DEBUG, "{0}: Event Buffer: {1}, Result Buffer: {2}", getEventName(), + getEventBuffer().getValue().dump(0, size), getResultBuffer().getValue().dump(0, size)); + } + } + + 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(); + } + } + + /** + * @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 + public void addRef() { + ++referenceCount; + } + + @Override + public int release() { + return --referenceCount; + } + + @Override + public void eventCallbackFunction(int length, com.sun.jna.Pointer events) { + if (events != null) { + resultBuffer.getValue().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/jaybird-native/src/main/java/org/firebirdsql/gds/ng/nativeoo/IMessageBuilderImpl.java b/jaybird-native/src/main/java/org/firebirdsql/gds/ng/nativeoo/IMessageBuilderImpl.java new file mode 100644 index 0000000000..f6262fb0b2 --- /dev/null +++ b/jaybird-native/src/main/java/org/firebirdsql/gds/ng/nativeoo/IMessageBuilderImpl.java @@ -0,0 +1,20 @@ +package org.firebirdsql.gds.ng.nativeoo; + +import org.firebirdsql.gds.ng.AbstractFbMessageBuilder; +import org.firebirdsql.gds.ng.FbBatch; + +import java.sql.SQLException; + +/** + * Implementation of {@link org.firebirdsql.gds.ng.AbstractFbMessageBuilder} to build messages for a native connection + * using OO API. + * + * @author Vasiliy Yashkov + * @since 6.0 + */ +public class IMessageBuilderImpl extends AbstractFbMessageBuilder { + + public IMessageBuilderImpl(FbBatch batch) throws SQLException { + super(batch); + } +} diff --git a/jaybird-native/src/main/java/org/firebirdsql/gds/ng/nativeoo/IMessageMetadataImpl.java b/jaybird-native/src/main/java/org/firebirdsql/gds/ng/nativeoo/IMessageMetadataImpl.java new file mode 100644 index 0000000000..f54079f6be --- /dev/null +++ b/jaybird-native/src/main/java/org/firebirdsql/gds/ng/nativeoo/IMessageMetadataImpl.java @@ -0,0 +1,161 @@ +package org.firebirdsql.gds.ng.nativeoo; + +import org.firebirdsql.gds.ng.FbMessageMetadata; +import org.firebirdsql.gds.ng.FbMetadataBuilder; +import org.firebirdsql.jna.fbclient.FbInterface.IMessageMetadata; +import org.firebirdsql.jna.fbclient.FbInterface.IMetadataBuilder; +import org.firebirdsql.jna.fbclient.FbInterface.IStatus; + +import java.sql.SQLException; + +/** + * Implementation of {@link org.firebirdsql.gds.ng.FbMessageMetadata} for native OO API. + * + * @author Vasiliy Yashkov + * @since 6.0 + */ +public class IMessageMetadataImpl implements FbMessageMetadata { + + private final IDatabaseImpl database; + private 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.status = this.database.getStatus(); + this.metadata = this.metadataBuilder.getMetadata(getStatus()); + processStatus(); + } + + 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 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 String getAlias(int index) throws SQLException { + String result = metadata.getAlias(getStatus(), index); + processStatus(); + return result; + } + + public String getField(int index) throws SQLException { + String result = metadata.getField(getStatus(), index); + processStatus(); + return result; + } + + public String getOwner(int index) throws SQLException { + String result = metadata.getOwner(getStatus(), index); + processStatus(); + return result; + } + + public String getRelation(int index) throws SQLException { + String result = metadata.getRelation(getStatus(), index); + processStatus(); + return result; + } + + public int getAlignedLength() throws SQLException { + int result = metadata.getAlignedLength(getStatus()); + processStatus(); + return result; + } + + public int getAlignment() throws SQLException { + int result = metadata.getAlignment(getStatus()); + processStatus(); + return result; + } + + public int getCount() throws SQLException { + int result = metadata.getCount(getStatus()); + processStatus(); + return result; + } + + public int getCharSet(int index) throws SQLException { + int result = metadata.getCharSet(getStatus(), index); + processStatus(); + return result; + } + + public int getMessageLength() throws SQLException { + int result = metadata.getMessageLength(getStatus()); + processStatus(); + return result; + } + + public int getScale(int index) throws SQLException { + int result = metadata.getScale(getStatus(), index); + processStatus(); + return result; + } + + public int getSubType(int index) throws SQLException { + int result = metadata.getSubType(getStatus(), index); + processStatus(); + return result; + } + + public int getType(int index) throws SQLException { + int result = metadata.getType(getStatus(), index); + processStatus(); + 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())); + processStatus(); + return metadataBuilderImpl; + } + + private IStatus getStatus() { + status.init(); + return status; + } + + private IDatabaseImpl getDatabase() { + return database; + } + + private void processStatus() throws SQLException { + getDatabase().processStatus(status, null); + } +} diff --git a/jaybird-native/src/main/java/org/firebirdsql/gds/ng/nativeoo/IMetadataBuilderImpl.java b/jaybird-native/src/main/java/org/firebirdsql/gds/ng/nativeoo/IMetadataBuilderImpl.java new file mode 100644 index 0000000000..045b0cdc35 --- /dev/null +++ b/jaybird-native/src/main/java/org/firebirdsql/gds/ng/nativeoo/IMetadataBuilderImpl.java @@ -0,0 +1,229 @@ +package org.firebirdsql.gds.ng.nativeoo; + +import org.firebirdsql.gds.ng.FbDatabase; +import org.firebirdsql.gds.ng.FbMessageMetadata; +import org.firebirdsql.gds.ng.FbMetadataBuilder; +import org.firebirdsql.jna.fbclient.FbInterface.IMaster; +import org.firebirdsql.jna.fbclient.FbInterface.IMetadataBuilder; +import org.firebirdsql.jna.fbclient.FbInterface.IStatus; + +import java.sql.SQLException; + +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 6.0 + */ +public class IMetadataBuilderImpl implements FbMetadataBuilder { + + private static final int SUBTYPE_NUMERIC = 1; + private static final int SUBTYPE_DECIMAL = 2; + + private final IDatabaseImpl database; + private final IStatus status; + private final IMetadataBuilder metadataBuilder; + + public IMetadataBuilderImpl(FbDatabase database, int fieldCount) throws SQLException { + this.database = (IDatabaseImpl)database; + IMaster master = this.database.getMaster(); + this.status = this.database.getStatus(); + this.metadataBuilder = master.getMetadataBuilder(status, fieldCount); + } + + @Override + public FbMessageMetadata getMessageMetadata() throws SQLException { + + return new IMessageMetadataImpl(this); + } + + public IMetadataBuilder getMetadataBuilder() { + return this.metadataBuilder; + } + + public FbDatabase getDatabase() { + return this.database; + } + + public int addField() throws SQLException { + return this.metadataBuilder.addField(status); + } + + @Override + 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 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 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 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 SQLException { + int length; + 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); + metadataBuilder.setSubType(status, index, SUBTYPE_NUMERIC); + } + + @Override + public void addDecimal(int index, int size, int scale) throws SQLException { + 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); + } + + @Override + 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 SQLException { + metadataBuilder.setType(status, index, SQL_DEC16); + metadataBuilder.setLength(status, index, Byte.SIZE); + } + + @Override + public void addDecfloat34(int index) throws SQLException { + metadataBuilder.setType(status, index, SQL_DEC34); + metadataBuilder.setLength(status, index, Byte.SIZE * 2); + } + + @Override + 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 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 SQLException { + metadataBuilder.setType(status, index, SQL_BOOLEAN); + metadataBuilder.setLength(status, index, 1); + } + + @Override + 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 SQLException { + metadataBuilder.setType(status, index, SQL_TYPE_TIME); + metadataBuilder.setLength(status, index, Integer.SIZE / Byte.SIZE); + } + + @Override + 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 SQLException { + metadataBuilder.setType(status, index, SQL_TEXT); + metadataBuilder.setLength(status, index, length); + } + + @Override + 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 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 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 SQLException { + addDecimal(index, size, scale); + } + + @Override + public void addDecNumeric(int index, int size, int scale) throws SQLException { + addNumeric(index, size, scale); + } +} diff --git a/jaybird-native/src/main/java/org/firebirdsql/gds/ng/nativeoo/IParameterConverterImpl.java b/jaybird-native/src/main/java/org/firebirdsql/gds/ng/nativeoo/IParameterConverterImpl.java new file mode 100644 index 0000000000..a65471a432 --- /dev/null +++ b/jaybird-native/src/main/java/org/firebirdsql/gds/ng/nativeoo/IParameterConverterImpl.java @@ -0,0 +1,62 @@ +package org.firebirdsql.gds.ng.nativeoo; + +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 java.sql.SQLException; +import java.util.HashMap; +import java.util.Map; + +/** + * Implementation of {@link org.firebirdsql.gds.ng.ParameterConverter} for native OO API. + * + * @author Vasiliy Yashkov + * @since 6.0 + */ +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()); + } + + Map configMap = new HashMap<>(); + + if (props.getWireCryptAsEnum() != WireCrypt.DEFAULT) { + configMap.put("WireCrypt", props.getWireCrypt()); + } + + String authPlugins = props.getAuthPlugins(); + if (authPlugins != null && !authPlugins.isEmpty()) { + configMap.put("AuthClient", authPlugins); + } + + if (!configMap.isEmpty()) { + String configString = buildConfigString(configMap); + pb.addArgument(tagMapping.getConfigTag(), configString); + } + } + + private String buildConfigString(Map configMap) { + StringBuilder builder = new StringBuilder(); + for (Map.Entry configEntry : configMap.entrySet()) { + builder.append(configEntry.getKey()) + .append('=') + .append(configEntry.getValue()) + .append('\n'); + } + return builder.toString(); + } +} diff --git a/jaybird-native/src/main/java/org/firebirdsql/gds/ng/nativeoo/IServiceConnectionImpl.java b/jaybird-native/src/main/java/org/firebirdsql/gds/ng/nativeoo/IServiceConnectionImpl.java new file mode 100644 index 0000000000..c86e334263 --- /dev/null +++ b/jaybird-native/src/main/java/org/firebirdsql/gds/ng/nativeoo/IServiceConnectionImpl.java @@ -0,0 +1,66 @@ +package org.firebirdsql.gds.ng.nativeoo; + +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; + +/** + * Class handling the initial setup of the native service connection. + * + * @author Vasiliy Yashkov + * @since 6.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); + } + + @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. + * + * @return FbDatabase instance + * @throws SQLException + */ + @Override + public IServiceImpl identify() throws SQLException { + return new IServiceImpl(this); + } +} diff --git a/jaybird-native/src/main/java/org/firebirdsql/gds/ng/nativeoo/IServiceImpl.java b/jaybird-native/src/main/java/org/firebirdsql/gds/ng/nativeoo/IServiceImpl.java new file mode 100644 index 0000000000..1630f3c64e --- /dev/null +++ b/jaybird-native/src/main/java/org/firebirdsql/gds/ng/nativeoo/IServiceImpl.java @@ -0,0 +1,221 @@ +package org.firebirdsql.gds.ng.nativeoo; + +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.LockCloseable; +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.jna.fbclient.FbInterface; +import org.firebirdsql.jna.fbclient.FbInterface.IMaster; +import org.firebirdsql.jna.fbclient.FbInterface.IProvider; +import org.firebirdsql.jna.fbclient.FbInterface.IService; +import org.firebirdsql.jna.fbclient.FbInterface.IStatus; + +import java.sql.SQLException; + +/** + * Implementation of {@link FbInterface.IService} for native client access using OO API. + * + * @author Vasiliy Yashkov + * @since 6.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 = ((FbInterface) 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.toBytes(); + final byte[] serviceRequestBufferBytes = + serviceRequestBuffer == null ? null : serviceRequestBuffer.toBytes(); + final byte[] responseBuffer = new byte[maxBufferLength]; + try (LockCloseable ignored = withLock()) { + service.query(getStatus(), (serviceParameterBufferBytes != null ? serviceParameterBufferBytes.length + : 0), serviceParameterBufferBytes, + (serviceRequestBufferBytes != null ? serviceRequestBufferBytes.length + : 0), serviceRequestBufferBytes, + maxBufferLength, responseBuffer); + processStatus(); + } + 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(); + try (LockCloseable ignored = withLock()) { + service.start(getStatus(), (serviceRequestBufferBytes != null ? serviceRequestBufferBytes.length : 0), + serviceRequestBufferBytes); + processStatus(); + } + } 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(); + + try (LockCloseable ignored = withLock()) { + try { + service = provider.attachServiceManager(getStatus(), connection.getAttachUrl(), spbArray.length, spbArray); + processStatus(); + } 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.getAttachUrl()) + .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" ); + } + + @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. + *

+ * 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(); + try (LockCloseable ignored = withLock()) { + try { + service.detach(getStatus()); + processStatus(); + } 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.getAttachUrl()) + .cause(ex) + .toSQLException(); + } finally { + setDetached(); + } + } + } + + 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 { + if (isAttached()) { + safelyDetach(); + } + } finally { + super.finalize(); + } + } +} diff --git a/jaybird-native/src/main/java/org/firebirdsql/gds/ng/nativeoo/IStatementImpl.java b/jaybird-native/src/main/java/org/firebirdsql/gds/ng/nativeoo/IStatementImpl.java new file mode 100644 index 0000000000..8df190d49f --- /dev/null +++ b/jaybird-native/src/main/java/org/firebirdsql/gds/ng/nativeoo/IStatementImpl.java @@ -0,0 +1,527 @@ +package org.firebirdsql.gds.ng.nativeoo; + +import com.sun.jna.Memory; +import com.sun.jna.Pointer; +import org.firebirdsql.gds.BatchParameterBuffer; +import org.firebirdsql.gds.ISCConstants; +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.LockCloseable; +import org.firebirdsql.gds.ng.OperationCloseHandle; +import org.firebirdsql.gds.ng.StatementState; +import org.firebirdsql.gds.ng.StatementType; +import org.firebirdsql.gds.ng.fields.*; +import org.firebirdsql.gds.impl.BatchParameterBufferImp; +import org.firebirdsql.jna.fbclient.XSQLVAR; +import org.firebirdsql.jna.fbclient.FbInterface.IBatch; +import org.firebirdsql.jna.fbclient.FbInterface.IMaster; +import org.firebirdsql.jna.fbclient.FbInterface.IMessageMetadata; +import org.firebirdsql.jna.fbclient.FbInterface.IMetadataBuilder; +import org.firebirdsql.jna.fbclient.FbInterface.IResultSet; +import org.firebirdsql.jna.fbclient.FbInterface.IStatement; +import org.firebirdsql.jna.fbclient.FbInterface.IStatementIntf; +import org.firebirdsql.jna.fbclient.FbInterface.IStatus; + +import java.nio.ByteBuffer; +import java.sql.SQLException; +import java.sql.SQLNonTransientException; +import java.util.Collection; + +import static java.util.Objects.requireNonNull; +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 6.0 + */ +public class IStatementImpl extends AbstractFbStatement { + + private static final System.Logger log = System.getLogger(IStatementImpl.class.getName()); + + private final IDatabaseImpl database; + private final IStatus status; + private IStatement statement; + private IResultSet cursor; + private IMessageMetadata inMetadata; + private IMessageMetadata outMetadata; + private FbBatch batch; + + public IStatementImpl(IDatabaseImpl 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 { + try (LockCloseable ignored = withLock()) { + if (cursor != null && option == ISCConstants.DSQL_close) { + cursor.close(getStatus()); + cursor = null; + processStatus(); + } else if (statement != null) { + statement.free(getStatus()); + statement = null; + processStatus(); + } + // Reset statement information + reset(option == ISCConstants.DSQL_drop); + } + } + + @Override + protected boolean isValidTransactionClass(Class transactionClass) { + return ITransactionImpl.class.isAssignableFrom(transactionClass); + } + + @Override + public IDatabaseImpl 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); + try (LockCloseable ignored = withLock()) { + checkTransactionActive(getTransaction()); + 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 (initialState == StatementState.NEW) { + try { + // allocated when prepare call + switchState(StatementState.ALLOCATED); + setType(StatementType.NONE); + } catch (SQLException e) { + forceState(StatementState.NEW); + throw e; + } + } else { + checkStatementValid(); + if (statement != null) { + statement.free(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); + } catch (SQLException e) { + switchState(StatementState.ALLOCATED); + throw e; + } + } + } catch (SQLException e) { + exceptionListenerDispatcher.errorOccurred(e); + throw e; + } + } + + @Override + public void execute(RowValue parameters) throws SQLException { + final StatementState initialState = getState(); + try (LockCloseable ignored = withLock()) { + checkStatementValid(); + checkTransactionActive(getTransaction()); + validateParameters(parameters); + reset(false); + + switchState(StatementState.EXECUTING); + if (this.statement.getVTable().version >= IStatementIntf.VERSION) + updateStatementTimeout(); + + 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(); + + 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); + } + + 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); + } + exceptionListenerDispatcher.errorOccurred(e); + throw e; + } + } + + protected void setMetaData(final RowDescriptor rowDescriptor, final RowValue parameters) throws SQLException { + + IMaster master = database.getMaster(); + IMetadataBuilder metadataBuilder = master.getMetadataBuilder(getStatus(), parameters.getCount()); + processStatus(); + for (int idx = 0; idx < parameters.getCount(); idx++) { + byte[] fieldData = parameters.getFieldData(idx); + final FieldDescriptor fieldDescriptor = rowDescriptor.getFieldDescriptor(idx); + if (fieldData == null) { + // Although we pass a null value, length and type must still be specified + 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 { + 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 { + 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)); + } + } + } + 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 (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(); + } + + 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.log(System.Logger.Level.DEBUG, errorMessage); + throw new SQLException(errorMessage); + } + } + } catch (SQLException e) { + exceptionListenerDispatcher.errorOccurred(e); + throw e; + } + } + + protected RowValue toRowValue(RowDescriptor rowDescriptor, IMessageMetadata meta, Pointer ptr) throws SQLException { + final RowValue row = rowDescriptor.createDefaultFieldValues(); + int columns = meta.getCount(getStatus()); + processStatus(); + for (int idx = 0; idx < columns; idx++) { + int nullOffset = meta.getNullOffset(getStatus(), idx); + processStatus(); + if (ptr.getShort(nullOffset) == XSQLVAR.SQLIND_NULL) { + row.setFieldData(idx, null); + } else { + 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.setFieldData(idx, data); + } + } + return row; + } + + @Override + public byte[] getSqlInfo(byte[] requestItems, int bufferLength) throws SQLException { + try { + final byte[] responseArr = new byte[bufferLength]; + try (LockCloseable ignored = withLock()) { + checkStatementValid(); + statement.getInfo(getStatus(), requestItems.length, requestItems, + bufferLength, responseArr); + processStatus(); + } + 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 (LockCloseable ignored = withLock()) { + checkStatementValid(); + statement.setCursorName(getStatus(), cursorName + '\0'); + processStatus(); + } catch (SQLException e) { + exceptionListenerDispatcher.errorOccurred(e); + throw e; + } + } + + @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 (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); + throw e; + } + } + + @Override + public void deferredBatchSend(Collection rowValues, DeferredResponse onResponse) throws SQLException { + 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); + throw e; + } + } + + @Override + public BatchCompletion batchExecute() throws SQLException { + try (LockCloseable ignored = withLock()) { + 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 (LockCloseable ignored = withLock()) { + 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 (LockCloseable ignored = withLock()) { + 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(); + } + + @Override + public FbBatch createBatch(BatchParameterBuffer parameters) throws SQLException { + IBatch batch = statement.createBatch(getStatus(), + inMetadata, parameters.toBytesWithType().length, parameters.toBytesWithType()); + return new IBatchImpl(batch, this, parameters); + } + + public FbMessageMetadata getInputMetadata() throws SQLException { + return new IMessageMetadataImpl(database, inMetadata); + } + + private IStatus getStatus() { + status.init(); + return status; + } + + private void processStatus() throws SQLException { + getDatabase().processStatus(status, getStatementWarningCallback()); + } + + private void updateStatementTimeout() throws SQLException { + int allowedTimeout = (int) getAllowedTimeout(); + statement.setTimeout(getStatus(), allowedTimeout); + processStatus(); + } +} diff --git a/jaybird-native/src/main/java/org/firebirdsql/gds/ng/nativeoo/ITransactionImpl.java b/jaybird-native/src/main/java/org/firebirdsql/gds/ng/nativeoo/ITransactionImpl.java new file mode 100644 index 0000000000..e10637b9cb --- /dev/null +++ b/jaybird-native/src/main/java/org/firebirdsql/gds/ng/nativeoo/ITransactionImpl.java @@ -0,0 +1,139 @@ +package org.firebirdsql.gds.ng.nativeoo; + +import org.firebirdsql.gds.ng.AbstractFbTransaction; +import org.firebirdsql.gds.ng.LockCloseable; +import org.firebirdsql.gds.ng.TransactionState; +import org.firebirdsql.jna.fbclient.FbInterface.IStatus; +import org.firebirdsql.jna.fbclient.FbInterface.ITransaction; + +import java.sql.SQLException; + +/** + * Implementation of {@link org.firebirdsql.gds.ng.FbTransaction} for native client access using OO API. + * + * @author Vasiliy Yashkov + * @since 6.0 + */ +public class ITransactionImpl extends AbstractFbTransaction { + + private static final System.Logger log = System.getLogger(ITransactionImpl.class.getName()); + + private final ITransaction transaction; + private final IStatus status; + + public ITransactionImpl(IDatabaseImpl database, ITransaction iTransaction, TransactionState initialState) { + super(initialState, database); + transaction = iTransaction; + status = database.getStatus(); + } + + @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 (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; + } finally { + final TransactionState transactionState = getState(); + if (transactionState != TransactionState.COMMITTED) { + log.log(System.Logger.Level.WARNING, "Commit not completed, state was " + transactionState, + new RuntimeException("Commit not completed")); + } + } + } + + @Override + public void rollback() throws SQLException { + 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; + } finally { + final TransactionState transactionState = getState(); + if (transactionState != TransactionState.ROLLED_BACK) { + log.log(System.Logger.Level.WARNING, "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 (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; + } finally { + if (getState() != TransactionState.PREPARED) { + log.log(System.Logger.Level.WARNING, "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]; + try (LockCloseable ignored = withLock()) { + final IDatabaseImpl db = getDatabase(); + db.checkConnected(); + transaction.getInfo(getStatus(), (short) requestItems.length, requestItems, + (short) maxBufferLength, responseArray); + processStatus(); + } + return responseArray; + } catch (SQLException e) { + exceptionListenerDispatcher.errorOccurred(e); + throw e; + } + } + + private IStatus getStatus() { + status.init(); + return status; + } + + private void processStatus() throws SQLException { + getDatabase().processStatus(status, null); + } +} diff --git a/jaybird-native/src/main/java/org/firebirdsql/gds/ng/nativeoo/NativeDatabaseConnection.java b/jaybird-native/src/main/java/org/firebirdsql/gds/ng/nativeoo/NativeDatabaseConnection.java new file mode 100644 index 0000000000..cb02ea64cb --- /dev/null +++ b/jaybird-native/src/main/java/org/firebirdsql/gds/ng/nativeoo/NativeDatabaseConnection.java @@ -0,0 +1,68 @@ +package org.firebirdsql.gds.ng.nativeoo; + +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; + +import java.sql.SQLException; + +/** + * Class handling the initial setup of the native OO API database connection. + * + * @since 6.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 Factory for encoding definitions + */ + protected NativeDatabaseConnection(FbClientLibrary clientLibrary, IConnectionProperties attachProperties, + IEncodingFactory encodingFactory) throws SQLException { + 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); + } + + /** + * Contrary to the description in the super class, this will simply return an unconnected instance. + * + * @return FbDatabase instance + */ + @Override + public IDatabaseImpl identify() throws SQLException { + return new IDatabaseImpl(this); + } +} diff --git a/jaybird-native/src/main/java/org/firebirdsql/jna/fbclient/CloseableMemory.java b/jaybird-native/src/main/java/org/firebirdsql/jna/fbclient/CloseableMemory.java new file mode 100644 index 0000000000..6a3101c598 --- /dev/null +++ b/jaybird-native/src/main/java/org/firebirdsql/jna/fbclient/CloseableMemory.java @@ -0,0 +1,15 @@ +package org.firebirdsql.jna.fbclient; + +import com.sun.jna.Memory; + +/** + * Memory class for send and receive native messages using OO API. + * + * @since 6.0 + */ +public class CloseableMemory extends Memory implements AutoCloseable { + + public CloseableMemory(long size) { + super(size); + } +} diff --git a/jaybird-native/src/main/java/org/firebirdsql/jna/fbclient/FB_DEC16.java b/jaybird-native/src/main/java/org/firebirdsql/jna/fbclient/FB_DEC16.java new file mode 100644 index 0000000000..8d003cd3cd --- /dev/null +++ b/jaybird-native/src/main/java/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/jaybird-native/src/main/java/org/firebirdsql/jna/fbclient/FB_DEC34.java b/jaybird-native/src/main/java/org/firebirdsql/jna/fbclient/FB_DEC34.java new file mode 100644 index 0000000000..2c40e9098d --- /dev/null +++ b/jaybird-native/src/main/java/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/jaybird-native/src/main/java/org/firebirdsql/jna/fbclient/FB_I128.java b/jaybird-native/src/main/java/org/firebirdsql/jna/fbclient/FB_I128.java new file mode 100644 index 0000000000..11f0a63327 --- /dev/null +++ b/jaybird-native/src/main/java/org/firebirdsql/jna/fbclient/FB_I128.java @@ -0,0 +1,40 @@ +package org.firebirdsql.jna.fbclient; + +import com.sun.jna.Pointer; +import com.sun.jna.Structure; + +import java.util.Arrays; +import java.util.List; + +/** + * JNA wrapper for FB_I128. + *

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

+ * @author Vasiliy Yashkov + * @since 6.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/jaybird-native/src/main/java/org/firebirdsql/jna/fbclient/FbInterface.java b/jaybird-native/src/main/java/org/firebirdsql/jna/fbclient/FbInterface.java new file mode 100644 index 0000000000..4cf63e3a1b --- /dev/null +++ b/jaybird-native/src/main/java/org/firebirdsql/jna/fbclient/FbInterface.java @@ -0,0 +1,21590 @@ +// This file was autogenerated by cloop - Cross Language Object Oriented Programming + +package org.firebirdsql.jna.fbclient; + + +/** + * JNA Wrapper for library implementing interface.h. + * + * @since 6.0 + */ +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 + */ + IMaster fb_get_master_interface(); + + 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 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; + 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 int VERSION = 2; + + 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); + public int serverMode(int mode); + public IUtil getUtilInterface(); + public IConfigManager getConfigManager(); + public boolean getProcessExiting(); + } + + 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); + public void next(IStatus status); + public void set(IStatus status, String s); + } + + public static interface IConfigEntryIntf extends IReferenceCountedIntf + { + public int VERSION = 3; + + public String getName(); + public String getValue(); + public long getIntValue(); + public boolean getBoolValue(); + public IConfig getSubConfig(IStatus status); + } + + 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); + } + + 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 static interface IPluginConfigIntf extends IReferenceCountedIntf + { + public int VERSION = 3; + + public String getConfigFileName(); + public IConfig getDefaultConfig(IStatus status); + public IFirebirdConf getFirebirdConf(IStatus status); + public void setReleaseDelay(IStatus status, long microSeconds); + } + + 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; + 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_REPLICATOR = 11; + public static int TYPE_PROFILER = 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); + public IConfig getConfig(IStatus status, String filename); + public void releasePlugin(IPluginBase plugin); + } + + 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); + public com.sun.jna.Pointer getDecryptKey(com.sun.jna.Pointer length); + } + + 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; + 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_TZDATA = 17; + public static int DIR_COUNT = 18; + + 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 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 = 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 static interface ITransactionIntf extends IReferenceCountedIntf + { + 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 deprecatedCommit(IStatus status); + public void commitRetaining(IStatus status); + public void deprecatedRollback(IStatus status); + public void rollbackRetaining(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 + { + public int VERSION = 4; + + 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 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); + 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 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 = 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); + 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 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 + { + public int VERSION = 5; + + 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 = 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); + 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 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 = 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; + 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; + 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); + 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 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 + { + public int VERSION = 3; + + public static int EXECUTE_FAILED = -1; + public static int SUCCESS_NO_INFO = -2; + public static int NO_MORE_ERRORS = 0xffffffff; + + 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 IReplicatorIntf extends IReferenceCountedIntf + { + 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 = 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); + 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 deprecatedFree(IStatus status); + public void free(IStatus status); + } + + public static interface IEventsIntf extends IReferenceCountedIntf + { + public int VERSION = 4; + + public void deprecatedCancel(IStatus status); + public void cancel(IStatus status); + } + + public static interface IAttachmentIntf extends IReferenceCountedIntf + { + 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); + 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, 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); + public void ping(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, 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); + } + + public static interface IServiceIntf extends IReferenceCountedIntf + { + 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 + { + 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); + public void shutdown(IStatus status, int timeout, int reason); + public void setDbCryptCallback(IStatus status, ICryptKeyCallback cryptCallback); + } + + 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); + } + + 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; + public static int AUTH_CONTINUE = 2; + + } + + 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 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); + public ICryptKey newKey(IStatus status); + } + + public static interface IClientBlockIntf extends IReferenceCountedIntf + { + public int VERSION = 4; + + 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 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); + } + + 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; + 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); + } + + 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 = 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 + { + 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); + public void rollback(IStatus status); + } + + public static interface IAuthBlockIntf extends IVersionedIntf + { + public int VERSION = 2; + + public String getType(); + public String getName(); + public String getPlugin(); + public String getSecurityDb(); + public String getOriginalPlugin(); + public boolean next(IStatus status); + public boolean first(IStatus status); + } + + 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); + 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 + { + 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); + public ICryptKeyCallback chainHandle(IStatus status); + } + + 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); + public void setInfo(IStatus status, IDbCryptInfo info); + } + + public static interface IExternalContextIntf extends IVersionedIntf + { + public int VERSION = 2; + + public IMaster getMaster(); + public IExternalEngine getEngine(IStatus status); + public IAttachment getAttachment(IStatus status); + public ITransaction getTransaction(IStatus status); + 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 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 = 3; + + 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); + 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 + { + public int VERSION = 2; + + 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 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); + 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 + { + 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); + public void getPerfCounters(IStatus status, IAttachment att, String countersSet, long[] counters); + 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); + 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); + public int setOffsets(IStatus status, IMessageMetadata metadata, IOffsetsCallback callback); + public IDecFloat16 getDecFloat16(IStatus status); + 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); + 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 static int INFO_SEND = 10; + public static int INFO_RESPONSE = 11; + + 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 + { + public int VERSION = 2; + + 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 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; + 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 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); + } + + 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(); + public String getTextUTF8(); + public String getExplainedPlan(); + } + + public static interface ITraceBLRStatementIntf extends ITraceStatementIntf + { + public int VERSION = 3; + + public com.sun.jna.Pointer getData(); + public int getDataLength(); + public String getText(); + } + + public static interface ITraceDYNRequestIntf extends IVersionedIntf + { + public int VERSION = 2; + + public com.sun.jna.Pointer getData(); + public int getDataLength(); + public String getText(); + } + + public static interface ITraceContextVariableIntf extends IVersionedIntf + { + public int VERSION = 2; + + public String getNameSpace(); + public String getVarName(); + public String getVarValue(); + } + + public static interface ITraceProcedureIntf extends IVersionedIntf + { + public int VERSION = 2; + + public String getProcName(); + public ITraceParams getInputs(); + public com.sun.jna.Pointer getPerf(); + } + + public static interface ITraceFunctionIntf extends IVersionedIntf + { + public int VERSION = 2; + + public String getFuncName(); + public ITraceParams getInputs(); + public ITraceParams getResult(); + public com.sun.jna.Pointer getPerf(); + } + + 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; + + 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 int VERSION = 3; + + public com.sun.jna.Pointer getServiceID(); + public String getServiceMgr(); + public String getServiceName(); + } + + public static interface ITraceStatusVectorIntf extends IVersionedIntf + { + public int VERSION = 2; + + public boolean hasError(); + public boolean hasWarning(); + public IStatus getStatus(); + public String getText(); + } + + public static interface ITraceSweepInfoIntf extends IVersionedIntf + { + public int VERSION = 2; + + 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 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 String getFirebirdRootDirectory(); + public String getDatabaseName(); + public ITraceDatabaseConnection getConnection(); + public ITraceLogWriter getLogWriter(); + } + + public static interface ITracePluginIntf extends IReferenceCountedIntf + { + public int VERSION = 4; + + 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 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 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_dsql_restart(ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceSQLStatement statement, int number); + } + + 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; + 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_MAX = 20; + + public long trace_needs(); + public ITracePlugin trace_create(IStatus status, ITraceInitInfo init_info); + } + + 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); + public void registerTrigger(IStatus status, String name, IUdrTriggerFactory factory); + } + + public static interface IDecFloat16Intf extends IVersionedIntf + { + public int VERSION = 2; + + 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); + public void fromBcd(int sign, byte[] bcd, int exp, FB_DEC16[] to); + public void fromString(IStatus status, String from, FB_DEC16[] to); + } + + public static interface IDecFloat34Intf extends IVersionedIntf + { + public int VERSION = 2; + + 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); + public void fromBcd(int sign, byte[] bcd, int exp, FB_DEC34[] to); + public void fromString(IStatus status, String from, FB_DEC34[] to); + } + + 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); + public void fromString(IStatus status, int scale, String from, FB_I128[] to); + } + + public static interface IReplicatedFieldIntf extends IVersionedIntf + { + public int VERSION = 2; + + 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 IReplicatedRecordIntf extends IVersionedIntf + { + public int VERSION = 2; + + 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 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 IPluginBaseIntf + { + public int VERSION = 4; + + 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 interface IProfilerPluginIntf extends IPluginBaseIntf + { + public int VERSION = 4; + + public void init(IStatus status, IAttachment attachment); + public IProfilerSession startSession(IStatus status, String description, String options, ISC_TIMESTAMP_TZ timestamp); + public void flush(IStatus status); + } + + public static interface IProfilerSessionIntf extends IDisposableIntf + { + public int VERSION = 3; + + public static int FLAG_BEFORE_EVENTS = 0x1; + public static int FLAG_AFTER_EVENTS = 0x2; + + public long getId(); + public int getFlags(); + public void cancel(IStatus status); + public void finish(IStatus status, ISC_TIMESTAMP_TZ timestamp); + public void defineStatement(IStatus status, long statementId, long parentStatementId, String type, String packageName, String routineName, String sqlText); + public void defineCursor(long statementId, int cursorId, String name, int line, int column); + public void defineRecordSource(long statementId, int cursorId, int recSourceId, String accessPath, int parentRecSourceId); + public void onRequestStart(IStatus status, long requestId, long statementId, long callerRequestId, ISC_TIMESTAMP_TZ timestamp); + public void onRequestFinish(IStatus status, long requestId, ISC_TIMESTAMP_TZ timestamp, IProfilerStats stats); + public void beforePsqlLineColumn(long requestId, int line, int column); + public void afterPsqlLineColumn(long requestId, int line, int column, IProfilerStats stats); + public void beforeRecordSourceOpen(long requestId, int cursorId, int recSourceId); + public void afterRecordSourceOpen(long requestId, int cursorId, int recSourceId, IProfilerStats stats); + public void beforeRecordSourceGetRecord(long requestId, int cursorId, int recSourceId); + public void afterRecordSourceGetRecord(long requestId, int cursorId, int recSourceId, IProfilerStats stats); + } + + public static interface IProfilerStatsIntf extends IVersionedIntf + { + public int VERSION = 2; + + public long getElapsedTime(); + } + + 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 int 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); + + version = IReferenceCountedIntf.VERSION; + + 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(); + 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; + } + } + + 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); + + version = IDisposableIntf.VERSION; + + 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(); + if (vTable.dispose == null) { + return; + } + 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); + + version = IStatusIntf.VERSION; + + 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(); + 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; + } + + 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; + } + + 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; + } + + public IStatus clone() + { + VTable vTable = getVTable(); + if (vTable.clone == null) { + return null; + } + 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); + + version = IMasterIntf.VERSION; + + 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) + { + FbInterfaceException.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(); + if (vTable.getStatus == null) { + return null; + } + IStatus result = vTable.getStatus.invoke(this); + return result; + } + + public IProvider getDispatcher() + { + VTable vTable = getVTable(); + if (vTable.getDispatcher == null) { + return null; + } + IProvider result = vTable.getDispatcher.invoke(this); + return result; + } + + public IPluginManager getPluginManager() + { + VTable vTable = getVTable(); + if (vTable.getPluginManager == null) { + return null; + } + IPluginManager result = vTable.getPluginManager.invoke(this); + return result; + } + + public ITimerControl getTimerControl() + { + VTable vTable = getVTable(); + if (vTable.getTimerControl == null) { + return null; + } + ITimerControl result = vTable.getTimerControl.invoke(this); + return result; + } + + public IDtc getDtc() + { + VTable vTable = getVTable(); + if (vTable.getDtc == null) { + return null; + } + IDtc result = vTable.getDtc.invoke(this); + return result; + } + + 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; + } + + 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; + } + + 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; + } + + public int serverMode(int mode) + { + VTable vTable = getVTable(); + if (vTable.serverMode == null) { + return 0; + } + int result = vTable.serverMode.invoke(this, mode); + return result; + } + + public IUtil getUtilInterface() + { + VTable vTable = getVTable(); + if (vTable.getUtilInterface == null) { + return null; + } + IUtil result = vTable.getUtilInterface.invoke(this); + return result; + } + + public IConfigManager getConfigManager() + { + VTable vTable = getVTable(); + if (vTable.getConfigManager == null) { + return null; + } + IConfigManager result = vTable.getConfigManager.invoke(this); + return result; + } + + public boolean getProcessExiting() + { + VTable vTable = getVTable(); + if (vTable.getProcessExiting == null) { + return false; + } + 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); + + version = IPluginBaseIntf.VERSION; + + 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(); + 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; + } + } + + 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); + + version = IPluginSetIntf.VERSION; + + 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) + { + FbInterfaceException.catchException(status, t); + return null; + } + } + }; + + next = new Callback_next() { + @Override + public void invoke(IPluginSet self, IStatus status) + { + try + { + obj.next(status); + } + catch (Throwable t) + { + FbInterfaceException.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) + { + FbInterfaceException.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(); + if (vTable.getName == null) { + return null; + } + String result = vTable.getName.invoke(this); + return result; + } + + public String getModuleName() + { + VTable vTable = getVTable(); + if (vTable.getModuleName == null) { + return null; + } + String result = vTable.getModuleName.invoke(this); + return result; + } + + 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; + } + + 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 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); + + version = IConfigEntryIntf.VERSION; + + 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) + { + FbInterfaceException.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(); + if (vTable.getName == null) { + return null; + } + String result = vTable.getName.invoke(this); + return result; + } + + public String getValue() + { + VTable vTable = getVTable(); + if (vTable.getValue == null) { + return null; + } + String result = vTable.getValue.invoke(this); + return result; + } + + public long getIntValue() + { + VTable vTable = getVTable(); + if (vTable.getIntValue == null) { + return 0; + } + long result = vTable.getIntValue.invoke(this); + return result; + } + + public boolean getBoolValue() + { + VTable vTable = getVTable(); + if (vTable.getBoolValue == null) { + return false; + } + boolean result = vTable.getBoolValue.invoke(this); + return result; + } + + 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 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); + + version = IConfigIntf.VERSION; + + find = new Callback_find() { + @Override + public IConfigEntry invoke(IConfig self, IStatus status, String name) + { + try + { + return obj.find(status, name); + } + catch (Throwable t) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + 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; + } + + 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; + } + + 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; + } + } + + 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 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); + } + + public VTable(final IFirebirdConfIntf obj) + { + super(obj); + + version = IFirebirdConfIntf.VERSION; + + 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); + } + }; + + 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() + { + } + + public Callback_getKey getKey; + 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", "getVersion")); + 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(); + if (vTable.getKey == null) { + return 0; + } + int result = vTable.getKey.invoke(this, name); + return result; + } + + public long asInteger(int key) + { + VTable vTable = getVTable(); + if (vTable.asInteger == null) { + return 0; + } + long result = vTable.asInteger.invoke(this, key); + return result; + } + + public String asString(int key) + { + VTable vTable = getVTable(); + if (vTable.asString == null) { + return null; + } + String result = vTable.asString.invoke(this, key); + return result; + } + + public boolean asBoolean(int key) + { + VTable vTable = getVTable(); + if (vTable.asBoolean == null) { + return false; + } + boolean result = vTable.asBoolean.invoke(this, key); + return result; + } + + 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; + } + int result = vTable.getVersion.invoke(this, status); + 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); + + version = IPluginConfigIntf.VERSION; + + 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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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(); + if (vTable.getConfigFileName == null) { + return null; + } + String result = vTable.getConfigFileName.invoke(this); + return result; + } + + 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; + } + + 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; + } + + 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); + } + } + + 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); + + version = IPluginFactoryIntf.VERSION; + + createPlugin = new Callback_createPlugin() { + @Override + public IPluginBase invoke(IPluginFactory self, IStatus status, IPluginConfig factoryParameter) + { + try + { + return obj.createPlugin(status, factoryParameter); + } + catch (Throwable t) + { + FbInterfaceException.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) + { + 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; + } + } + + 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); + + version = IPluginModuleIntf.VERSION; + + 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(); + if (vTable.doClean == null) { + return; + } + vTable.doClean.invoke(this); + } + + public void threadDetach() + { + VTable vTable = getVTable(); + if (vTable.version < 3) + { + return; + } + if (vTable.threadDetach == null) { + return; + } + 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); + + version = IPluginManagerIntf.VERSION; + + 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) + { + FbInterfaceException.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) + { + FbInterfaceException.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(); + 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; + } + + 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; + } + + public void releasePlugin(IPluginBase plugin) + { + VTable vTable = getVTable(); + if (vTable.releasePlugin == null) { + return; + } + 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); + + version = ICryptKeyIntf.VERSION; + + 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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + 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; + } + + 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; + } + } + + 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 static interface Callback_getDefaultSecurityDb 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); + + version = IConfigManagerIntf.VERSION; + + 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(); + } + }; + + getDefaultSecurityDb = new Callback_getDefaultSecurityDb() { + @Override + public String invoke(IConfigManager self) + { + return obj.getDefaultSecurityDb(); + } + }; + } + + 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; + 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", "getDefaultSecurityDb")); + 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(); + if (vTable.getDirectory == null) { + return null; + } + String result = vTable.getDirectory.invoke(this, code); + return result; + } + + public IFirebirdConf getFirebirdConf() + { + VTable vTable = getVTable(); + if (vTable.getFirebirdConf == null) { + return null; + } + IFirebirdConf result = vTable.getFirebirdConf.invoke(this); + return result; + } + + public IFirebirdConf getDatabaseConf(String dbName) + { + VTable vTable = getVTable(); + if (vTable.getDatabaseConf == null) { + return null; + } + IFirebirdConf result = vTable.getDatabaseConf.invoke(this, dbName); + return result; + } + + public IConfig getPluginConfig(String configuredPlugin) + { + VTable vTable = getVTable(); + if (vTable.getPluginConfig == null) { + return null; + } + IConfig result = vTable.getPluginConfig.invoke(this, configuredPlugin); + return result; + } + + public String getInstallDirectory() + { + VTable vTable = getVTable(); + if (vTable.getInstallDirectory == null) { + return null; + } + String result = vTable.getInstallDirectory.invoke(this); + return result; + } + + 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.version < 3) + { + return null; + } + if (vTable.getDefaultSecurityDb == null) { + return null; + } + String result = vTable.getDefaultSecurityDb.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); + + version = IEventCallbackIntf.VERSION; + + 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(); + if (vTable.eventCallbackFunction == null) { + return; + } + 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_deprecatedCancel extends com.sun.jna.Callback + { + public void invoke(IBlob self, IStatus status); + } + + public static interface Callback_deprecatedClose 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 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); + } + + 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) + { + try + { + obj.getInfo(status, itemsLength, items, bufferLength, buffer); + } + catch (Throwable t) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + deprecatedCancel = new Callback_deprecatedCancel() { + @Override + public void invoke(IBlob self, IStatus status) + { + try + { + obj.deprecatedCancel(status); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + deprecatedClose = new Callback_deprecatedClose() { + @Override + public void invoke(IBlob self, IStatus status) + { + try + { + obj.deprecatedClose(status); + } + catch (Throwable t) + { + FbInterfaceException.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) + { + FbInterfaceException.catchException(status, t); + return 0; + } + } + }; + + 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() + { + } + + 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; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("getInfo", "getSegment", "putSegment", "deprecatedCancel", "deprecatedClose", "seek", "cancel", "close")); + 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) + { + 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; + } + + 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 deprecatedCancel(IStatus status) + { + VTable vTable = getVTable(); + if (vTable.deprecatedCancel == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IBlobIntf.VERSION); + return; + } + vTable.deprecatedCancel.invoke(this, status); + } + + public void deprecatedClose(IStatus status) + { + VTable vTable = getVTable(); + if (vTable.deprecatedClose == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IBlobIntf.VERSION); + return; + } + vTable.deprecatedClose.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; + } + + 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; + } + vTable.cancel.invoke(this, 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; + } + vTable.close.invoke(this, status); + } + } + + 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_deprecatedCommit 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_deprecatedRollback 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_deprecatedDisconnect 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 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); + } + + 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) + { + try + { + obj.getInfo(status, itemsLength, items, bufferLength, buffer); + } + catch (Throwable t) + { + FbInterfaceException.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) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + deprecatedCommit = new Callback_deprecatedCommit() { + @Override + public void invoke(ITransaction self, IStatus status) + { + try + { + obj.deprecatedCommit(status); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + commitRetaining = new Callback_commitRetaining() { + @Override + public void invoke(ITransaction self, IStatus status) + { + try + { + obj.commitRetaining(status); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + deprecatedRollback = new Callback_deprecatedRollback() { + @Override + public void invoke(ITransaction self, IStatus status) + { + try + { + obj.deprecatedRollback(status); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + rollbackRetaining = new Callback_rollbackRetaining() { + @Override + public void invoke(ITransaction self, IStatus status) + { + try + { + obj.rollbackRetaining(status); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + deprecatedDisconnect = new Callback_deprecatedDisconnect() { + @Override + public void invoke(ITransaction self, IStatus status) + { + try + { + obj.deprecatedDisconnect(status); + } + catch (Throwable t) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.catchException(status, t); + return null; + } + } + }; + + 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() + { + } + + public Callback_getInfo getInfo; + public Callback_prepare prepare; + public Callback_deprecatedCommit deprecatedCommit; + public Callback_commitRetaining commitRetaining; + public Callback_deprecatedRollback deprecatedRollback; + public Callback_rollbackRetaining rollbackRetaining; + 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", "deprecatedCommit", "commitRetaining", "deprecatedRollback", "rollbackRetaining", "deprecatedDisconnect", "join", "validate", "enterDtc", "commit", "rollback", "disconnect")); + 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) + { + 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 deprecatedCommit(IStatus status) + { + VTable vTable = getVTable(); + if (vTable.deprecatedCommit == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, ITransactionIntf.VERSION); + return; + } + vTable.deprecatedCommit.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 deprecatedRollback(IStatus status) + { + VTable vTable = getVTable(); + if (vTable.deprecatedRollback == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, ITransactionIntf.VERSION); + return; + } + vTable.deprecatedRollback.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 deprecatedDisconnect(IStatus status) + { + VTable vTable = getVTable(); + if (vTable.deprecatedDisconnect == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, ITransactionIntf.VERSION); + return; + } + vTable.deprecatedDisconnect.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; + } + + 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; + } + + 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; + } + + 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; + } + vTable.commit.invoke(this, 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; + } + vTable.rollback.invoke(this, 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; + } + 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); + } + + 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); + + version = IMessageMetadataIntf.VERSION; + + getCount = new Callback_getCount() { + @Override + public int invoke(IMessageMetadata self, IStatus status) + { + try + { + return obj.getCount(status); + } + catch (Throwable t) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + 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; + } + + 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; + } + + 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; + } + + 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; + } + + 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; + } + + 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; + } + + 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; + } + + 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; + } + + 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; + } + + 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; + } + + 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; + } + + 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; + } + + 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; + } + + 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; + } + + 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; + } + + 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; + } + int result = vTable.getAlignment.invoke(this, status); + return result; + } + + 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; + } + int result = vTable.getAlignedLength.invoke(this, 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 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); + } + + 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) + { + try + { + obj.setType(status, index, type); + } + catch (Throwable t) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + addField = new Callback_addField() { + @Override + public int invoke(IMetadataBuilder self, IStatus status) + { + try + { + return obj.addField(status); + } + catch (Throwable t) + { + FbInterfaceException.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) + { + FbInterfaceException.catchException(status, t); + return null; + } + } + }; + + 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() + { + } + + 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; + 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", "setField", "setRelation", "setOwner", "setAlias")); + 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) + { + 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; + } + + 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.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; + } + vTable.setField.invoke(this, status, index, 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; + } + vTable.setRelation.invoke(this, status, index, 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; + } + vTable.setOwner.invoke(this, status, index, 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; + } + vTable.setAlias.invoke(this, status, index, alias); + } + } + + 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_deprecatedClose 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 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); + } + + 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) + { + try + { + return obj.fetchNext(status, message); + } + catch (Throwable t) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.catchException(status, t); + return null; + } + } + }; + + deprecatedClose = new Callback_deprecatedClose() { + @Override + public void invoke(IResultSet self, IStatus status) + { + try + { + obj.deprecatedClose(status); + } + catch (Throwable t) + { + FbInterfaceException.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) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + close = new Callback_close() { + @Override + public void invoke(IResultSet self, IStatus status) + { + try + { + obj.close(status); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + 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() + { + } + + 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_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", "getInfo")); + 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) + { + 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; + } + + 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; + } + + 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; + } + + 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; + } + + 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; + } + + 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; + } + + 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; + } + + 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; + } + + 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; + } + + public void deprecatedClose(IStatus status) + { + VTable vTable = getVTable(); + if (vTable.deprecatedClose == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IResultSetIntf.VERSION); + return; + } + vTable.deprecatedClose.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); + } + + 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 + { + 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_deprecatedFree 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 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); + } + + 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) + { + try + { + obj.getInfo(status, itemsLength, items, bufferLength, buffer); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + getType = new Callback_getType() { + @Override + public int invoke(IStatement self, IStatus status) + { + try + { + return obj.getType(status); + } + catch (Throwable t) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + deprecatedFree = new Callback_deprecatedFree() { + @Override + public void invoke(IStatement self, IStatus status) + { + try + { + obj.deprecatedFree(status); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + getFlags = new Callback_getFlags() { + @Override + public int invoke(IStatement self, IStatus status) + { + try + { + return obj.getFlags(status); + } + catch (Throwable t) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.catchException(status, t); + return null; + } + } + }; + + 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() + { + } + + 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_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", "deprecatedFree", "getFlags", "getTimeout", "setTimeout", "createBatch", "free")); + 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) + { + 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; + } + + 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; + } + + 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; + } + + 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; + } + + 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; + } + + 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; + } + + 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; + } + + 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 deprecatedFree(IStatus status) + { + VTable vTable = getVTable(); + if (vTable.deprecatedFree == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IStatementIntf.VERSION); + return; + } + vTable.deprecatedFree.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; + } + + 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; + } + int result = vTable.getTimeout.invoke(this, status); + return result; + } + + 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; + } + vTable.setTimeout.invoke(this, status, 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; + } + IBatch result = vTable.createBatch.invoke(this, status, inMetadata, parLength, par); + return result; + } + + 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; + } + vTable.free.invoke(this, status); + } + } + + 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 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); + } + + 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) + { + try + { + obj.add(status, count, inBuffer); + } + catch (Throwable t) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.catchException(status, t); + return null; + } + } + }; + + cancel = new Callback_cancel() { + @Override + public void invoke(IBatch self, IStatus status) + { + try + { + obj.cancel(status); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + getBlobAlignment = new Callback_getBlobAlignment() { + @Override + public int invoke(IBatch self, IStatus status) + { + try + { + return obj.getBlobAlignment(status); + } + catch (Throwable t) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + 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() + { + } + + 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; + 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", "deprecatedClose", "close", "getInfo")); + 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) + { + 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; + } + + 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; + } + + 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; + } + + 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); + } + + 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.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; + } + vTable.close.invoke(this, 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; + } + vTable.getInfo.invoke(this, status, itemsLength, items, bufferLength, buffer); + } + } + + 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); + + version = IBatchCompletionStateIntf.VERSION; + + getSize = new Callback_getSize() { + @Override + public int invoke(IBatchCompletionState self, IStatus status) + { + try + { + return obj.getSize(status); + } + catch (Throwable t) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + 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; + } + + 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; + } + + 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; + } + + 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); + } + } + + 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_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); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + 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) + { + try + { + obj.process(status, length, data); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + 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) + { + try + { + obj.close(status); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; + } + + 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", "deprecatedClose", "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(); + if (vTable.process == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IReplicatorIntf.VERSION); + return; + } + 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(); + 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; + } + vTable.close.invoke(this, 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_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); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + 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) + { + try + { + obj.receive(status, level, msgType, length, message); + } + catch (Throwable t) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + 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) + { + try + { + obj.free(status); + } + catch (Throwable t) + { + FbInterfaceException.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_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", "deprecatedFree", "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) + { + 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 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(); + 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; + } + vTable.free.invoke(this, status); + } + } + + 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); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IEventsIntf obj) + { + super(obj); + + version = IEventsIntf.VERSION; + + deprecatedCancel = new Callback_deprecatedCancel() { + @Override + public void invoke(IEvents self, IStatus status) + { + try + { + obj.deprecatedCancel(status); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + 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("deprecatedCancel", "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 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(); + 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; + } + vTable.cancel.invoke(this, status); + } + } + + 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, 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, 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 + { + 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_deprecatedDetach extends com.sun.jna.Callback + { + public void invoke(IAttachment self, IStatus status); + } + + public static interface Callback_deprecatedDropDatabase 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, byte[] 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 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); + } + + 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) + { + try + { + obj.getInfo(status, itemsLength, items, bufferLength, buffer); + } + catch (Throwable t) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + prepare = new Callback_prepare() { + @Override + public IStatement invoke(IAttachment self, IStatus status, ITransaction tra, int stmtLength, byte[] sqlStmt, int dialect, int flags) + { + try + { + return obj.prepare(status, tra, stmtLength, sqlStmt, dialect, flags); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + return null; + } + } + }; + + execute = new Callback_execute() { + @Override + 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 + { + return obj.execute(status, transaction, stmtLength, sqlStmt, dialect, inMetadata, inBuffer, outMetadata, outBuffer); + } + catch (Throwable t) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + ping = new Callback_ping() { + @Override + public void invoke(IAttachment self, IStatus status) + { + try + { + obj.ping(status); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + deprecatedDetach = new Callback_deprecatedDetach() { + @Override + public void invoke(IAttachment self, IStatus status) + { + try + { + obj.deprecatedDetach(status); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + deprecatedDropDatabase = new Callback_deprecatedDropDatabase() { + @Override + public void invoke(IAttachment self, IStatus status) + { + try + { + obj.deprecatedDropDatabase(status); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + getIdleTimeout = new Callback_getIdleTimeout() { + @Override + public int invoke(IAttachment self, IStatus status) + { + try + { + return obj.getIdleTimeout(status); + } + catch (Throwable t) + { + FbInterfaceException.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) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + getStatementTimeout = new Callback_getStatementTimeout() { + @Override + public int invoke(IAttachment self, IStatus status) + { + try + { + return obj.getStatementTimeout(status); + } + catch (Throwable t) + { + FbInterfaceException.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) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + createBatch = new Callback_createBatch() { + @Override + public IBatch invoke(IAttachment self, IStatus status, ITransaction transaction, int stmtLength, byte[] sqlStmt, int dialect, IMessageMetadata inMetadata, int parLength, byte[] par) + { + try + { + return obj.createBatch(status, transaction, stmtLength, sqlStmt, dialect, inMetadata, parLength, par); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + return null; + } + } + }; + + 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; + } + } + }; + + 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() + { + } + + 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_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", "deprecatedDetach", "deprecatedDropDatabase", "getIdleTimeout", "setIdleTimeout", "getStatementTimeout", "setStatementTimeout", "createBatch", "createReplicator", "detach", "dropDatabase")); + 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) + { + 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; + } + + 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; + } + + 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; + } + + 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; + } + + 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; + } + + 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; + } + + 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, byte[] 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; + } + + 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) { + 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; + } + + 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; + } + + 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; + } + + 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 deprecatedDetach(IStatus status) + { + VTable vTable = getVTable(); + if (vTable.deprecatedDetach == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IAttachmentIntf.VERSION); + return; + } + vTable.deprecatedDetach.invoke(this, status); + } + + public void deprecatedDropDatabase(IStatus status) + { + VTable vTable = getVTable(); + if (vTable.deprecatedDropDatabase == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IAttachmentIntf.VERSION); + return; + } + vTable.deprecatedDropDatabase.invoke(this, 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; + } + int result = vTable.getIdleTimeout.invoke(this, status); + return result; + } + + 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; + } + vTable.setIdleTimeout.invoke(this, status, 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; + } + int result = vTable.getStatementTimeout.invoke(this, status); + return result; + } + + 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; + } + vTable.setStatementTimeout.invoke(this, status, timeOut); + } + + 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; + } + IBatch result = vTable.createBatch.invoke(this, status, transaction, stmtLength, sqlStmt, dialect, inMetadata, parLength, par); + return result; + } + + 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; + } + IReplicator result = vTable.createReplicator.invoke(this, status); + return result; + } + + 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; + } + vTable.detach.invoke(this, 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; + } + vTable.dropDatabase.invoke(this, status); + } + } + + public static class IService extends IReferenceCounted implements IServiceIntf + { + public static class VTable extends IReferenceCounted.VTable + { + public static interface Callback_deprecatedDetach 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 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); + } + + public VTable(final IServiceIntf obj) + { + super(obj); + + version = IServiceIntf.VERSION; + + deprecatedDetach = new Callback_deprecatedDetach() { + @Override + public void invoke(IService self, IStatus status) + { + try + { + obj.deprecatedDetach(status); + } + catch (Throwable t) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + detach = new Callback_detach() { + @Override + public void invoke(IService self, IStatus status) + { + try + { + obj.detach(status); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + 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() + { + } + + public Callback_deprecatedDetach deprecatedDetach; + 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", "cancel")); + 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 deprecatedDetach(IStatus status) + { + VTable vTable = getVTable(); + if (vTable.deprecatedDetach == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IServiceIntf.VERSION); + return; + } + vTable.deprecatedDetach.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); + } + + 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 + { + 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); + + version = IProviderIntf.VERSION; + + 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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + 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; + } + + 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; + } + + 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; + } + + 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); + } + } + + 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); + + version = IDtcStartIntf.VERSION; + + addAttachment = new Callback_addAttachment() { + @Override + public void invoke(IDtcStart self, IStatus status, IAttachment att) + { + try + { + obj.addAttachment(status, att); + } + catch (Throwable t) + { + FbInterfaceException.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) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + start = new Callback_start() { + @Override + public ITransaction invoke(IDtcStart self, IStatus status) + { + try + { + return obj.start(status); + } + catch (Throwable t) + { + FbInterfaceException.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) + { + 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; + } + } + + 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); + + version = IDtcIntf.VERSION; + + 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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + 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; + } + + 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; + } + } + + 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); + + version = IAuthIntf.VERSION; + + } + + 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); + + version = IWriterIntf.VERSION; + + 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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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(); + 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 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); + + version = IServerBlockIntf.VERSION; + + 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) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + newKey = new Callback_newKey() { + @Override + public ICryptKey invoke(IServerBlock self, IStatus status) + { + try + { + return obj.newKey(status); + } + catch (Throwable t) + { + FbInterfaceException.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(); + if (vTable.getLogin == null) { + return null; + } + String result = vTable.getLogin.invoke(this); + return result; + } + + 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; + } + + 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; + } + } + + 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_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); + + version = IClientBlockIntf.VERSION; + + 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(); + } + }; + + 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) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + newKey = new Callback_newKey() { + @Override + public ICryptKey invoke(IClientBlock self, IStatus status) + { + try + { + return obj.newKey(status); + } + catch (Throwable t) + { + FbInterfaceException.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) + { + FbInterfaceException.catchException(status, t); + return null; + } + } + }; + } + + public VTable() + { + } + + public Callback_getLogin getLogin; + public Callback_getPassword getPassword; + 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", "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(); + if (vTable.getLogin == null) { + return null; + } + String result = vTable.getLogin.invoke(this); + return result; + } + + public String getPassword() + { + VTable vTable = getVTable(); + if (vTable.getPassword == null) { + return null; + } + String result = vTable.getPassword.invoke(this); + return result; + } + + 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; + } + + 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; + } + + 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; + } + IAuthBlock result = vTable.getAuthBlock.invoke(this, 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); + + version = IServerIntf.VERSION; + + 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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + 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; + } + + 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; + } + vTable.setDbCryptCallback.invoke(this, status, cryptCallback); + } + } + + 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); + + version = IClientIntf.VERSION; + + authenticate = new Callback_authenticate() { + @Override + public int invoke(IClient self, IStatus status, IClientBlock cBlock) + { + try + { + return obj.authenticate(status, cBlock); + } + catch (Throwable t) + { + FbInterfaceException.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) + { + 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; + } + } + + 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); + + version = IUserFieldIntf.VERSION; + + 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) + { + FbInterfaceException.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(); + if (vTable.entered == null) { + return 0; + } + int result = vTable.entered.invoke(this); + return result; + } + + public int specified() + { + VTable vTable = getVTable(); + if (vTable.specified == null) { + return 0; + } + int result = vTable.specified.invoke(this); + return result; + } + + 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); + } + } + + 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); + + version = ICharUserFieldIntf.VERSION; + + 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) + { + FbInterfaceException.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(); + if (vTable.get == null) { + return null; + } + String result = vTable.get.invoke(this); + return result; + } + + 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); + } + } + + 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); + + version = IIntUserFieldIntf.VERSION; + + 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) + { + FbInterfaceException.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(); + if (vTable.get == null) { + return 0; + } + int result = vTable.get.invoke(this); + return result; + } + + 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); + } + } + + 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); + + version = IUserIntf.VERSION; + + 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) + { + FbInterfaceException.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(); + if (vTable.operation == null) { + return 0; + } + int result = vTable.operation.invoke(this); + return result; + } + + public ICharUserField userName() + { + VTable vTable = getVTable(); + if (vTable.userName == null) { + return null; + } + ICharUserField result = vTable.userName.invoke(this); + return result; + } + + public ICharUserField password() + { + VTable vTable = getVTable(); + if (vTable.password == null) { + return null; + } + ICharUserField result = vTable.password.invoke(this); + return result; + } + + public ICharUserField firstName() + { + VTable vTable = getVTable(); + if (vTable.firstName == null) { + return null; + } + ICharUserField result = vTable.firstName.invoke(this); + return result; + } + + public ICharUserField lastName() + { + VTable vTable = getVTable(); + if (vTable.lastName == null) { + return null; + } + ICharUserField result = vTable.lastName.invoke(this); + return result; + } + + public ICharUserField middleName() + { + VTable vTable = getVTable(); + if (vTable.middleName == null) { + return null; + } + ICharUserField result = vTable.middleName.invoke(this); + return result; + } + + public ICharUserField comment() + { + VTable vTable = getVTable(); + if (vTable.comment == null) { + return null; + } + ICharUserField result = vTable.comment.invoke(this); + return result; + } + + public ICharUserField attributes() + { + VTable vTable = getVTable(); + if (vTable.attributes == null) { + return null; + } + ICharUserField result = vTable.attributes.invoke(this); + return result; + } + + public IIntUserField active() + { + VTable vTable = getVTable(); + if (vTable.active == null) { + return null; + } + IIntUserField result = vTable.active.invoke(this); + return result; + } + + public IIntUserField admin() + { + VTable vTable = getVTable(); + if (vTable.admin == null) { + return null; + } + IIntUserField result = vTable.admin.invoke(this); + return result; + } + + 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); + } + } + + 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); + + version = IListUsersIntf.VERSION; + + list = new Callback_list() { + @Override + public void invoke(IListUsers self, IStatus status, IUser user) + { + try + { + obj.list(status, user); + } + catch (Throwable t) + { + FbInterfaceException.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) + { + VTable vTable = getVTable(); + if (vTable.list == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IListUsersIntf.VERSION); + return; + } + vTable.list.invoke(this, status, user); + } + } + + 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 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); + } + + public VTable(final ILogonInfoIntf obj) + { + super(obj); + + version = ILogonInfoIntf.VERSION; + + 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); + } + }; + + 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() + { + } + + public Callback_name name; + public Callback_role role; + 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", "attachment", "transaction")); + 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(); + if (vTable.name == null) { + return null; + } + String result = vTable.name.invoke(this); + return result; + } + + public String role() + { + VTable vTable = getVTable(); + if (vTable.role == null) { + return null; + } + String result = vTable.role.invoke(this); + return result; + } + + public String networkProtocol() + { + VTable vTable = getVTable(); + if (vTable.networkProtocol == null) { + return null; + } + String result = vTable.networkProtocol.invoke(this); + return result; + } + + public String remoteAddress() + { + VTable vTable = getVTable(); + if (vTable.remoteAddress == null) { + return null; + } + String result = vTable.remoteAddress.invoke(this); + return result; + } + + 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; + } + + 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; + } + IAttachment result = vTable.attachment.invoke(this, status); + return result; + } + + 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; + } + ITransaction result = vTable.transaction.invoke(this, status); + 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); + + version = IManagementIntf.VERSION; + + start = new Callback_start() { + @Override + public void invoke(IManagement self, IStatus status, ILogonInfo logonInfo) + { + try + { + obj.start(status, logonInfo); + } + catch (Throwable t) + { + FbInterfaceException.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) + { + FbInterfaceException.catchException(status, t); + return 0; + } + } + }; + + commit = new Callback_commit() { + @Override + public void invoke(IManagement self, IStatus status) + { + try + { + obj.commit(status); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + rollback = new Callback_rollback() { + @Override + public void invoke(IManagement self, IStatus status) + { + try + { + obj.rollback(status); + } + catch (Throwable t) + { + FbInterfaceException.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) + { + 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; + } + + 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); + } + } + + 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); + + version = IAuthBlockIntf.VERSION; + + 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) + { + FbInterfaceException.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) + { + FbInterfaceException.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(); + if (vTable.getType == null) { + return null; + } + String result = vTable.getType.invoke(this); + return result; + } + + public String getName() + { + VTable vTable = getVTable(); + if (vTable.getName == null) { + return null; + } + String result = vTable.getName.invoke(this); + return result; + } + + public String getPlugin() + { + VTable vTable = getVTable(); + if (vTable.getPlugin == null) { + return null; + } + String result = vTable.getPlugin.invoke(this); + return result; + } + + public String getSecurityDb() + { + VTable vTable = getVTable(); + if (vTable.getSecurityDb == null) { + return null; + } + String result = vTable.getSecurityDb.invoke(this); + return result; + } + + public String getOriginalPlugin() + { + VTable vTable = getVTable(); + if (vTable.getOriginalPlugin == null) { + return null; + } + String result = vTable.getOriginalPlugin.invoke(this); + return result; + } + + 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; + } + + 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; + } + } + + 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 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); + } + + public VTable(final IWireCryptPluginIntf obj) + { + super(obj); + + version = IWireCryptPluginIntf.VERSION; + + getKnownTypes = new Callback_getKnownTypes() { + @Override + public String invoke(IWireCryptPlugin self, IStatus status) + { + try + { + return obj.getKnownTypes(status); + } + catch (Throwable t) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + 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() + { + } + + public Callback_getKnownTypes getKnownTypes; + 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", "getSpecificData", "setSpecificData")); + 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) + { + 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; + } + + 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.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; + } + 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(); + 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; + } + vTable.setSpecificData.invoke(this, status, keyType, length, data); + } + } + + 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); + + 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) + { + 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(); + if (vTable.callback == null) { + return 0; + } + 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); + + version = IKeyHolderPluginIntf.VERSION; + + keyCallback = new Callback_keyCallback() { + @Override + public int invoke(IKeyHolderPlugin self, IStatus status, ICryptKeyCallback callback) + { + try + { + return obj.keyCallback(status, callback); + } + catch (Throwable t) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + 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; + } + + 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; + } + + 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; + } + boolean result = vTable.useOnlyOwnKeys.invoke(this, status); + return result; + } + + 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; + } + ICryptKeyCallback result = vTable.chainHandle.invoke(this, 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); + + version = IDbCryptInfoIntf.VERSION; + + getDatabaseFullPath = new Callback_getDatabaseFullPath() { + @Override + public String invoke(IDbCryptInfo self, IStatus status) + { + try + { + return obj.getDatabaseFullPath(status); + } + catch (Throwable t) + { + FbInterfaceException.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) + { + 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; + } + } + + 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); + + version = IDbCryptPluginIntf.VERSION; + + 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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + 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.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; + } + vTable.setInfo.invoke(this, status, info); + } + } + + 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); + + version = IExternalContextIntf.VERSION; + + 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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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(); + if (vTable.getMaster == null) { + return null; + } + IMaster result = vTable.getMaster.invoke(this); + return result; + } + + 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; + } + + 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; + } + + 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; + } + + public String getUserName() + { + VTable vTable = getVTable(); + if (vTable.getUserName == null) { + return null; + } + String result = vTable.getUserName.invoke(this); + return result; + } + + public String getDatabaseName() + { + VTable vTable = getVTable(); + if (vTable.getDatabaseName == null) { + return null; + } + String result = vTable.getDatabaseName.invoke(this); + return result; + } + + public String getClientCharSet() + { + VTable vTable = getVTable(); + if (vTable.getClientCharSet == null) { + return null; + } + String result = vTable.getClientCharSet.invoke(this); + return result; + } + + public int obtainInfoCode() + { + VTable vTable = getVTable(); + if (vTable.obtainInfoCode == null) { + return 0; + } + int result = vTable.obtainInfoCode.invoke(this); + return result; + } + + 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; + } + + 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; + } + } + + 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); + + version = IExternalResultSetIntf.VERSION; + + fetch = new Callback_fetch() { + @Override + public boolean invoke(IExternalResultSet self, IStatus status) + { + try + { + return obj.fetch(status); + } + catch (Throwable t) + { + FbInterfaceException.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) + { + 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; + } + } + + 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); + + version = IExternalFunctionIntf.VERSION; + + 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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + 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); + } + } + + 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); + + version = IExternalProcedureIntf.VERSION; + + 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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + 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; + } + } + + 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); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + 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) + { + try + { + obj.getCharSet(status, context, name, nameSize); + } + catch (Throwable t) + { + FbInterfaceException.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) + { + try + { + obj.execute(status, context, action, oldMsg, newMsg); + } + catch (Throwable t) + { + FbInterfaceException.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) + { + 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) + { + 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); + } + } + + 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); + + version = IRoutineMetadataIntf.VERSION; + + getPackage = new Callback_getPackage() { + @Override + public String invoke(IRoutineMetadata self, IStatus status) + { + try + { + return obj.getPackage(status); + } + catch (Throwable t) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + 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; + } + + 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; + } + + 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; + } + + 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; + } + + 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; + } + + 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; + } + + 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; + } + + 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; + } + + 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; + } + } + + 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); + + version = IExternalEngineIntf.VERSION; + + 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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + 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; + } + + 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; + } + + 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; + } + } + + 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); + + version = ITimerIntf.VERSION; + + 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(); + if (vTable.handler == null) { + return; + } + 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); + + version = ITimerControlIntf.VERSION; + + 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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + 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); + } + } + + 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); + + version = IVersionCallbackIntf.VERSION; + + callback = new Callback_callback() { + @Override + public void invoke(IVersionCallback self, IStatus status, String text) + { + try + { + obj.callback(status, text); + } + catch (Throwable t) + { + FbInterfaceException.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) + { + VTable vTable = getVTable(); + if (vTable.callback == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IVersionCallbackIntf.VERSION); + return; + } + vTable.callback.invoke(this, status, text); + } + } + + 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, byte[] 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_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_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 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); + } + + 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) + { + try + { + obj.getFbVersion(status, att, callback); + } + catch (Throwable t) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + executeCreateDatabase = new Callback_executeCreateDatabase() { + @Override + public IAttachment invoke(IUtil self, IStatus status, int stmtLength, byte[] creatDBstatement, int dialect, boolean[] stmtIsCreateDb) + { + try + { + return obj.executeCreateDatabase(status, stmtLength, creatDBstatement, dialect, stmtIsCreateDb); + } + catch (Throwable t) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.catchException(status, t); + return 0; + } + } + }; + + getDecFloat16 = new Callback_getDecFloat16() { + @Override + public IDecFloat16 invoke(IUtil self, IStatus status) + { + try + { + return obj.getDecFloat16(status); + } + catch (Throwable t) + { + FbInterfaceException.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) + { + FbInterfaceException.catchException(status, t); + return null; + } + } + }; + + 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; + } + } + }; + + decodeTimeTzEx = new Callback_decodeTimeTzEx() { + @Override + 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.decodeTimeTzEx(status, timeTz, hours, minutes, seconds, fractions, timeZoneBufferLength, timeZoneBuffer); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + decodeTimeStampTzEx = new Callback_decodeTimeStampTzEx() { + @Override + 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 + { + obj.decodeTimeStampTzEx(status, timeStampTz, year, month, day, hours, minutes, seconds, fractions, timeZoneBufferLength, timeZoneBuffer); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; + } + + 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_getDecFloat16 getDecFloat16; + public Callback_getDecFloat34 getDecFloat34; + 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", "decodeTimeTz", "decodeTimeStampTz", "encodeTimeTz", "encodeTimeStampTz", "getInt128", "decodeTimeTzEx", "decodeTimeStampTzEx")); + 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) + { + 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, byte[] 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; + } + + 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; + } + + 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; + } + + 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; + } + + public int getClientVersion() + { + VTable vTable = getVTable(); + if (vTable.getClientVersion == null) { + return 0; + } + int result = vTable.getClientVersion.invoke(this); + return result; + } + + 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; + } + + 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; + } + + 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; + } + IDecFloat16 result = vTable.getDecFloat16.invoke(this, status); + return result; + } + + 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; + } + IDecFloat34 result = vTable.getDecFloat34.invoke(this, status); + 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.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; + } + 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.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; + } + 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.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; + } + 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.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; + } + vTable.encodeTimeStampTz.invoke(this, status, timeStampTz, year, month, day, hours, minutes, seconds, fractions, timeZone); + } + + 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; + } + 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.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; + } + 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.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; + } + vTable.decodeTimeStampTzEx.invoke(this, status, timeStampTz, year, month, day, hours, minutes, seconds, fractions, timeZoneBufferLength, timeZoneBuffer); + } + } + + 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); + + version = IOffsetsCallbackIntf.VERSION; + + 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) + { + FbInterfaceException.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) + { + 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); + } + } + + 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); + + version = IXpbBuilderIntf.VERSION; + + clear = new Callback_clear() { + @Override + public void invoke(IXpbBuilder self, IStatus status) + { + try + { + obj.clear(status); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + removeCurrent = new Callback_removeCurrent() { + @Override + public void invoke(IXpbBuilder self, IStatus status) + { + try + { + obj.removeCurrent(status); + } + catch (Throwable t) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + isEof = new Callback_isEof() { + @Override + public boolean invoke(IXpbBuilder self, IStatus status) + { + try + { + return obj.isEof(status); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + return false; + } + } + }; + + moveNext = new Callback_moveNext() { + @Override + public void invoke(IXpbBuilder self, IStatus status) + { + try + { + obj.moveNext(status); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + rewind = new Callback_rewind() { + @Override + public void invoke(IXpbBuilder self, IStatus status) + { + try + { + obj.rewind(status); + } + catch (Throwable t) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + 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; + } + + 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; + } + + 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; + } + + 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; + } + + 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; + } + + 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; + } + + 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; + } + + 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; + } + + 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; + } + + 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; + } + + 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; + } + } + + 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_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); + + version = ITraceConnectionIntf.VERSION; + + 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(); + } + }; + + 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_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", "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(); + if (vTable.getKind == null) { + return 0; + } + int result = vTable.getKind.invoke(this); + return result; + } + + public int getProcessID() + { + VTable vTable = getVTable(); + if (vTable.getProcessID == null) { + return 0; + } + int result = vTable.getProcessID.invoke(this); + return result; + } + + public String getUserName() + { + VTable vTable = getVTable(); + if (vTable.getUserName == null) { + return null; + } + String result = vTable.getUserName.invoke(this); + return result; + } + + public String getRoleName() + { + VTable vTable = getVTable(); + if (vTable.getRoleName == null) { + return null; + } + String result = vTable.getRoleName.invoke(this); + return result; + } + + public String getCharSet() + { + VTable vTable = getVTable(); + if (vTable.getCharSet == null) { + return null; + } + String result = vTable.getCharSet.invoke(this); + return result; + } + + public String getRemoteProtocol() + { + VTable vTable = getVTable(); + if (vTable.getRemoteProtocol == null) { + return null; + } + String result = vTable.getRemoteProtocol.invoke(this); + return result; + } + + public String getRemoteAddress() + { + VTable vTable = getVTable(); + if (vTable.getRemoteAddress == null) { + return null; + } + String result = vTable.getRemoteAddress.invoke(this); + return result; + } + + public int getRemoteProcessID() + { + VTable vTable = getVTable(); + if (vTable.getRemoteProcessID == null) { + return 0; + } + int result = vTable.getRemoteProcessID.invoke(this); + return result; + } + + public String getRemoteProcessName() + { + VTable vTable = getVTable(); + if (vTable.getRemoteProcessName == null) { + return null; + } + 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); + + version = ITraceDatabaseConnectionIntf.VERSION; + + 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(); + if (vTable.getConnectionID == null) { + return 0; + } + long result = vTable.getConnectionID.invoke(this); + return result; + } + + public String getDatabaseName() + { + VTable vTable = getVTable(); + if (vTable.getDatabaseName == null) { + return null; + } + 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 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); + } + + public VTable(final ITraceTransactionIntf obj) + { + super(obj); + + version = ITraceTransactionIntf.VERSION; + + 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(); + } + }; + + 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() + { + } + + public Callback_getTransactionID getTransactionID; + public Callback_getReadOnly getReadOnly; + 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", "getInitialID", "getPreviousID")); + 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(); + if (vTable.getTransactionID == null) { + return 0; + } + long result = vTable.getTransactionID.invoke(this); + return result; + } + + public boolean getReadOnly() + { + VTable vTable = getVTable(); + if (vTable.getReadOnly == null) { + return false; + } + boolean result = vTable.getReadOnly.invoke(this); + return result; + } + + public int getWait() + { + VTable vTable = getVTable(); + if (vTable.getWait == null) { + return 0; + } + int result = vTable.getWait.invoke(this); + return result; + } + + public int getIsolation() + { + VTable vTable = getVTable(); + if (vTable.getIsolation == null) { + return 0; + } + int result = vTable.getIsolation.invoke(this); + return result; + } + + 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.version < 3) + { + return 0; + } + if (vTable.getInitialID == null) { + return 0; + } + long result = vTable.getInitialID.invoke(this); + return result; + } + + public long getPreviousID() + { + VTable vTable = getVTable(); + if (vTable.version < 3) + { + return 0; + } + if (vTable.getPreviousID == null) { + return 0; + } + long result = vTable.getPreviousID.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); + + version = ITraceParamsIntf.VERSION; + + 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) + { + FbInterfaceException.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(); + if (vTable.getCount == null) { + return 0; + } + int result = vTable.getCount.invoke(this); + return result; + } + + 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; + } + + 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; + } + String result = vTable.getTextUTF8.invoke(this, status, idx); + 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); + + version = ITraceStatementIntf.VERSION; + + 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(); + if (vTable.getStmtID == null) { + return 0; + } + long result = vTable.getStmtID.invoke(this); + return result; + } + + 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 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); + + version = ITraceSQLStatementIntf.VERSION; + + 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(); + if (vTable.getText == null) { + return null; + } + String result = vTable.getText.invoke(this); + return result; + } + + public String getPlan() + { + VTable vTable = getVTable(); + if (vTable.getPlan == null) { + return null; + } + String result = vTable.getPlan.invoke(this); + return result; + } + + public ITraceParams getInputs() + { + VTable vTable = getVTable(); + if (vTable.getInputs == null) { + return null; + } + ITraceParams result = vTable.getInputs.invoke(this); + return result; + } + + public String getTextUTF8() + { + VTable vTable = getVTable(); + if (vTable.getTextUTF8 == null) { + return null; + } + String result = vTable.getTextUTF8.invoke(this); + return result; + } + + public String getExplainedPlan() + { + VTable vTable = getVTable(); + if (vTable.getExplainedPlan == null) { + return null; + } + 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); + + version = ITraceBLRStatementIntf.VERSION; + + 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(); + if (vTable.getData == null) { + return null; + } + com.sun.jna.Pointer result = vTable.getData.invoke(this); + return result; + } + + public int getDataLength() + { + VTable vTable = getVTable(); + if (vTable.getDataLength == null) { + return 0; + } + int result = vTable.getDataLength.invoke(this); + return result; + } + + public String getText() + { + VTable vTable = getVTable(); + if (vTable.getText == null) { + return null; + } + 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); + + version = ITraceDYNRequestIntf.VERSION; + + 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(); + if (vTable.getData == null) { + return null; + } + com.sun.jna.Pointer result = vTable.getData.invoke(this); + return result; + } + + public int getDataLength() + { + VTable vTable = getVTable(); + if (vTable.getDataLength == null) { + return 0; + } + int result = vTable.getDataLength.invoke(this); + return result; + } + + public String getText() + { + VTable vTable = getVTable(); + if (vTable.getText == null) { + return null; + } + 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); + + version = ITraceContextVariableIntf.VERSION; + + 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(); + if (vTable.getNameSpace == null) { + return null; + } + String result = vTable.getNameSpace.invoke(this); + return result; + } + + public String getVarName() + { + VTable vTable = getVTable(); + if (vTable.getVarName == null) { + return null; + } + String result = vTable.getVarName.invoke(this); + return result; + } + + public String getVarValue() + { + VTable vTable = getVTable(); + if (vTable.getVarValue == null) { + return null; + } + 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); + + version = ITraceProcedureIntf.VERSION; + + 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(); + if (vTable.getProcName == null) { + return null; + } + String result = vTable.getProcName.invoke(this); + return result; + } + + public ITraceParams getInputs() + { + VTable vTable = getVTable(); + if (vTable.getInputs == null) { + return null; + } + ITraceParams result = vTable.getInputs.invoke(this); + return result; + } + + 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 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); + + version = ITraceFunctionIntf.VERSION; + + 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(); + if (vTable.getFuncName == null) { + return null; + } + String result = vTable.getFuncName.invoke(this); + return result; + } + + public ITraceParams getInputs() + { + VTable vTable = getVTable(); + if (vTable.getInputs == null) { + return null; + } + ITraceParams result = vTable.getInputs.invoke(this); + return result; + } + + public ITraceParams getResult() + { + VTable vTable = getVTable(); + if (vTable.getResult == null) { + return null; + } + ITraceParams result = vTable.getResult.invoke(this); + return result; + } + + 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 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); + + version = ITraceTriggerIntf.VERSION; + + 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(); + if (vTable.getTriggerName == null) { + return null; + } + String result = vTable.getTriggerName.invoke(this); + return result; + } + + public String getRelationName() + { + VTable vTable = getVTable(); + if (vTable.getRelationName == null) { + return null; + } + String result = vTable.getRelationName.invoke(this); + return result; + } + + public int getAction() + { + VTable vTable = getVTable(); + if (vTable.getAction == null) { + return 0; + } + int result = vTable.getAction.invoke(this); + return result; + } + + public int getWhich() + { + VTable vTable = getVTable(); + if (vTable.getWhich == null) { + return 0; + } + int result = vTable.getWhich.invoke(this); + return result; + } + + 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 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); + + version = ITraceServiceConnectionIntf.VERSION; + + 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(); + if (vTable.getServiceID == null) { + return null; + } + com.sun.jna.Pointer result = vTable.getServiceID.invoke(this); + return result; + } + + public String getServiceMgr() + { + VTable vTable = getVTable(); + if (vTable.getServiceMgr == null) { + return null; + } + String result = vTable.getServiceMgr.invoke(this); + return result; + } + + public String getServiceName() + { + VTable vTable = getVTable(); + if (vTable.getServiceName == null) { + return null; + } + 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); + + version = ITraceStatusVectorIntf.VERSION; + + 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(); + if (vTable.hasError == null) { + return false; + } + boolean result = vTable.hasError.invoke(this); + return result; + } + + public boolean hasWarning() + { + VTable vTable = getVTable(); + if (vTable.hasWarning == null) { + return false; + } + boolean result = vTable.hasWarning.invoke(this); + return result; + } + + public IStatus getStatus() + { + VTable vTable = getVTable(); + if (vTable.getStatus == null) { + return null; + } + IStatus result = vTable.getStatus.invoke(this); + return result; + } + + public String getText() + { + VTable vTable = getVTable(); + if (vTable.getText == null) { + return null; + } + 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); + + version = ITraceSweepInfoIntf.VERSION; + + 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(); + if (vTable.getOIT == null) { + return 0; + } + long result = vTable.getOIT.invoke(this); + return result; + } + + public long getOST() + { + VTable vTable = getVTable(); + if (vTable.getOST == null) { + return 0; + } + long result = vTable.getOST.invoke(this); + return result; + } + + public long getOAT() + { + VTable vTable = getVTable(); + if (vTable.getOAT == null) { + return 0; + } + long result = vTable.getOAT.invoke(this); + return result; + } + + public long getNext() + { + VTable vTable = getVTable(); + if (vTable.getNext == null) { + return 0; + } + long result = vTable.getNext.invoke(this); + return result; + } + + 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 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 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); + } + + 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) + { + 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() + { + } + + 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", "write_s")); + 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(); + if (vTable.write == null) { + return 0; + } + 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(); + 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; + } + int result = vTable.write_s.invoke(this, status, 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_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_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); + + version = ITraceInitInfoIntf.VERSION; + + 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(); + } + }; + + 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(); + } + }; + + 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_getFirebirdRootDirectory getFirebirdRootDirectory; + public Callback_getDatabaseName getDatabaseName; + public Callback_getConnection getConnection; + 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")); + 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(); + if (vTable.getConfigText == null) { + return null; + } + String result = vTable.getConfigText.invoke(this); + return result; + } + + public int getTraceSessionID() + { + VTable vTable = getVTable(); + if (vTable.getTraceSessionID == null) { + return 0; + } + int result = vTable.getTraceSessionID.invoke(this); + return result; + } + + public String getTraceSessionName() + { + VTable vTable = getVTable(); + if (vTable.getTraceSessionName == null) { + return null; + } + String result = vTable.getTraceSessionName.invoke(this); + return result; + } + + public String getFirebirdRootDirectory() + { + VTable vTable = getVTable(); + if (vTable.getFirebirdRootDirectory == null) { + return null; + } + String result = vTable.getFirebirdRootDirectory.invoke(this); + return result; + } + + public String getDatabaseName() + { + VTable vTable = getVTable(); + if (vTable.getDatabaseName == null) { + return null; + } + String result = vTable.getDatabaseName.invoke(this); + return result; + } + + public ITraceDatabaseConnection getConnection() + { + VTable vTable = getVTable(); + if (vTable.getConnection == null) { + return null; + } + ITraceDatabaseConnection result = vTable.getConnection.invoke(this); + return result; + } + + public ITraceLogWriter getLogWriter() + { + VTable vTable = getVTable(); + if (vTable.getLogWriter == null) { + return null; + } + 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 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 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_dsql_restart extends com.sun.jna.Callback + { + public boolean invoke(ITracePlugin self, ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceSQLStatement statement, int number); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final ITracePluginIntf obj) + { + super(obj); + + version = ITracePluginIntf.VERSION; + + 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 att_result) + { + return obj.trace_attach(connection, create_db, 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 att_result) + { + return obj.trace_service_attach(service, 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_dsql_restart = new Callback_trace_dsql_restart() { + @Override + public boolean invoke(ITracePlugin self, ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceSQLStatement statement, int number) + { + return obj.trace_dsql_restart(connection, transaction, statement, number); + } + }; + } + + 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_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_dsql_restart")); + 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(); + 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) + { + VTable vTable = getVTable(); + if (vTable.trace_attach == null) { + return false; + } + boolean result = vTable.trace_attach.invoke(this, connection, create_db, 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; + } + + 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; + } + + 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; + } + + 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; + } + + 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; + } + + 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; + } + + 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; + } + + 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; + } + + 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; + } + + 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; + } + + 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; + } + + 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) + { + VTable vTable = getVTable(); + if (vTable.trace_service_attach == null) { + return false; + } + boolean result = vTable.trace_service_attach.invoke(this, service, 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; + } + + 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; + } + + 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; + } + + 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; + } + + 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; + } + + 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_dsql_restart(ITraceDatabaseConnection connection, ITraceTransaction transaction, ITraceSQLStatement statement, int number) + { + VTable vTable = getVTable(); + if (vTable.version < 4) + { + return false; + } + if (vTable.trace_dsql_restart == null) { + return false; + } + boolean result = vTable.trace_dsql_restart.invoke(this, connection, transaction, statement, number); + 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); + + version = ITraceFactoryIntf.VERSION; + + 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) + { + FbInterfaceException.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(); + if (vTable.trace_needs == null) { + return 0; + } + long result = vTable.trace_needs.invoke(this); + return result; + } + + 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; + } + } + + 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); + + version = IUdrFunctionFactoryIntf.VERSION; + + 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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + 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; + } + } + + 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); + + version = IUdrProcedureFactoryIntf.VERSION; + + 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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + 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; + } + } + + 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); + + version = IUdrTriggerFactoryIntf.VERSION; + + 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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + 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; + } + } + + 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); + + version = IUdrPluginIntf.VERSION; + + 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) + { + FbInterfaceException.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) + { + FbInterfaceException.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) + { + FbInterfaceException.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(); + if (vTable.getMaster == null) { + return null; + } + IMaster result = vTable.getMaster.invoke(this); + return result; + } + + 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); + } + } + + 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); + + 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) + { + 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) + { + FbInterfaceException.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) + { + FbInterfaceException.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(); + 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); + } + } + + 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); + + 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) + { + 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) + { + FbInterfaceException.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) + { + FbInterfaceException.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(); + 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); + } + } + + public static class IInt128 extends IVersioned implements IInt128Intf + { + public static class VTable extends IVersioned.VTable + { + public static interface Callback_toString extends com.sun.jna.Callback + { + public void invoke(IInt128 self, IStatus status, FB_I128[] from, int scale, int bufferLength, com.sun.jna.Pointer buffer); + } + + public static interface Callback_fromString extends com.sun.jna.Callback + { + public void invoke(IInt128 self, IStatus status, int scale, String from, FB_I128[] to); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + 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) + { + try + { + obj.toString(status, from, scale, bufferLength, buffer); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + 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 VTable() + { + } + + public Callback_toString toString; + public Callback_fromString fromString; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("toString", "fromString")); + return fields; + } + } + + public IInt128() + { + } + + 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(); + 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); + } + } + + public static class IReplicatedField extends IVersioned implements IReplicatedFieldIntf + { + public static class VTable extends IVersioned.VTable + { + public static interface Callback_getName extends com.sun.jna.Callback + { + public String invoke(IReplicatedField self); + } + + public static interface Callback_getType extends com.sun.jna.Callback + { + 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) + { + super(pointer); + } + + public VTable(final IReplicatedFieldIntf obj) + { + super(obj); + + version = IReplicatedFieldIntf.VERSION; + + getName = new Callback_getName() { + @Override + public String invoke(IReplicatedField self) + { + return obj.getName(); + } + }; + + getType = new Callback_getType() { + @Override + public int invoke(IReplicatedField self) + { + 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(); + } + }; + } + + public VTable() + { + } + + 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("getName", "getType", "getSubType", "getScale", "getLength", "getCharSet", "getData")); + return fields; + } + } + + public IReplicatedField() + { + } + + public IReplicatedField(final IReplicatedFieldIntf 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(); + 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.getType.invoke(this); + return result; + } + + public int getSubType() + { + VTable vTable = getVTable(); + 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.getData.invoke(this); + return result; + } + } + + public static class IReplicatedRecord extends IVersioned implements IReplicatedRecordIntf + { + public static class VTable extends IVersioned.VTable + { + public static interface Callback_getCount extends com.sun.jna.Callback + { + public int invoke(IReplicatedRecord self); + } + + public static interface Callback_getField extends com.sun.jna.Callback + { + public IReplicatedField invoke(IReplicatedRecord self, int index); + } + + 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 com.sun.jna.Pointer invoke(IReplicatedRecord self); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IReplicatedRecordIntf obj) + { + super(obj); + + version = IReplicatedRecordIntf.VERSION; + + getCount = new Callback_getCount() { + @Override + public int invoke(IReplicatedRecord self) + { + return obj.getCount(); + } + }; + + getField = new Callback_getField() { + @Override + public IReplicatedField invoke(IReplicatedRecord self, int index) + { + return obj.getField(index); + } + }; + + getRawLength = new Callback_getRawLength() { + @Override + public int invoke(IReplicatedRecord self) + { + return obj.getRawLength(); + } + }; + + getRawData = new Callback_getRawData() { + @Override + public com.sun.jna.Pointer invoke(IReplicatedRecord self) + { + return obj.getRawData(); + } + }; + } + + public VTable() + { + } + + 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("getCount", "getField", "getRawLength", "getRawData")); + return fields; + } + } + + public IReplicatedRecord() + { + } + + public IReplicatedRecord(final IReplicatedRecordIntf 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(); + if (vTable.getCount == null) { + return 0; + } + int result = vTable.getCount.invoke(this); + return result; + } + + public IReplicatedField getField(int index) + { + VTable vTable = getVTable(); + if (vTable.getField == null) { + return null; + } + IReplicatedField result = vTable.getField.invoke(this, index); + return result; + } + + public int getRawLength() + { + VTable vTable = getVTable(); + if (vTable.getRawLength == null) { + return 0; + } + 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; + } + } + + public static class IReplicatedTransaction extends IDisposable implements IReplicatedTransactionIntf + { + public static class VTable extends IDisposable.VTable + { + public static interface Callback_prepare extends com.sun.jna.Callback + { + public void invoke(IReplicatedTransaction self, IStatus status); + } + + public static interface Callback_commit extends com.sun.jna.Callback + { + public void invoke(IReplicatedTransaction self, IStatus status); + } + + public static interface Callback_rollback extends com.sun.jna.Callback + { + public void invoke(IReplicatedTransaction self, IStatus status); + } + + public static interface Callback_startSavepoint extends com.sun.jna.Callback + { + public void invoke(IReplicatedTransaction self, IStatus status); + } + + public static interface Callback_releaseSavepoint extends com.sun.jna.Callback + { + public void invoke(IReplicatedTransaction self, IStatus status); + } + + public static interface Callback_rollbackSavepoint extends com.sun.jna.Callback + { + public void invoke(IReplicatedTransaction self, IStatus status); + } + + public static interface Callback_insertRecord extends com.sun.jna.Callback + { + public void invoke(IReplicatedTransaction self, IStatus status, String name, IReplicatedRecord record); + } + + public static interface Callback_updateRecord extends com.sun.jna.Callback + { + public void invoke(IReplicatedTransaction self, IStatus status, String name, IReplicatedRecord orgRecord, IReplicatedRecord newRecord); + } + + public static interface Callback_deleteRecord extends com.sun.jna.Callback + { + public void invoke(IReplicatedTransaction self, IStatus status, String name, IReplicatedRecord record); + } + + public static interface Callback_executeSql extends com.sun.jna.Callback + { + public void invoke(IReplicatedTransaction self, IStatus status, String sql); + } + + public static interface Callback_executeSqlIntl extends com.sun.jna.Callback + { + public void invoke(IReplicatedTransaction self, IStatus status, int charset, String sql); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IReplicatedTransactionIntf obj) + { + super(obj); + + version = IReplicatedTransactionIntf.VERSION; + + prepare = new Callback_prepare() { + @Override + public void invoke(IReplicatedTransaction self, IStatus status) + { + try + { + obj.prepare(status); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + commit = new Callback_commit() { + @Override + public void invoke(IReplicatedTransaction self, IStatus status) + { + try + { + obj.commit(status); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + rollback = new Callback_rollback() { + @Override + public void invoke(IReplicatedTransaction self, IStatus status) + { + try + { + obj.rollback(status); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + startSavepoint = new Callback_startSavepoint() { + @Override + public void invoke(IReplicatedTransaction self, IStatus status) + { + try + { + obj.startSavepoint(status); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + releaseSavepoint = new Callback_releaseSavepoint() { + @Override + public void invoke(IReplicatedTransaction self, IStatus status) + { + try + { + obj.releaseSavepoint(status); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + rollbackSavepoint = new Callback_rollbackSavepoint() { + @Override + public void invoke(IReplicatedTransaction self, IStatus status) + { + try + { + obj.rollbackSavepoint(status); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + insertRecord = new Callback_insertRecord() { + @Override + public void invoke(IReplicatedTransaction self, IStatus status, String name, IReplicatedRecord record) + { + try + { + obj.insertRecord(status, name, record); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + updateRecord = new Callback_updateRecord() { + @Override + public void invoke(IReplicatedTransaction self, IStatus status, String name, IReplicatedRecord orgRecord, IReplicatedRecord newRecord) + { + try + { + obj.updateRecord(status, name, orgRecord, newRecord); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + deleteRecord = new Callback_deleteRecord() { + @Override + public void invoke(IReplicatedTransaction self, IStatus status, String name, IReplicatedRecord record) + { + try + { + obj.deleteRecord(status, name, record); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + executeSql = new Callback_executeSql() { + @Override + public void invoke(IReplicatedTransaction self, IStatus status, String sql) + { + try + { + obj.executeSql(status, sql); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + executeSqlIntl = new Callback_executeSqlIntl() { + @Override + public void invoke(IReplicatedTransaction self, IStatus status, int charset, String sql) + { + try + { + obj.executeSqlIntl(status, charset, sql); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; + } + + public VTable() + { + } + + 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_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", "executeSql", "executeSqlIntl")); + return fields; + } + } + + public IReplicatedTransaction() + { + } + + public IReplicatedTransaction(final IReplicatedTransactionIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public void prepare(IStatus status) + { + VTable vTable = getVTable(); + if (vTable.prepare == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IReplicatedTransactionIntf.VERSION); + return; + } + vTable.prepare.invoke(this, status); + } + + public void commit(IStatus status) + { + VTable vTable = getVTable(); + if (vTable.commit == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IReplicatedTransactionIntf.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, IReplicatedTransactionIntf.VERSION); + return; + } + vTable.rollback.invoke(this, status); + } + + public void startSavepoint(IStatus status) + { + VTable vTable = getVTable(); + if (vTable.startSavepoint == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IReplicatedTransactionIntf.VERSION); + return; + } + vTable.startSavepoint.invoke(this, status); + } + + public void releaseSavepoint(IStatus status) + { + VTable vTable = getVTable(); + if (vTable.releaseSavepoint == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IReplicatedTransactionIntf.VERSION); + return; + } + vTable.releaseSavepoint.invoke(this, status); + } + + public void rollbackSavepoint(IStatus status) + { + VTable vTable = getVTable(); + if (vTable.rollbackSavepoint == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IReplicatedTransactionIntf.VERSION); + return; + } + vTable.rollbackSavepoint.invoke(this, status); + } + + public void insertRecord(IStatus status, String name, IReplicatedRecord record) + { + VTable vTable = getVTable(); + if (vTable.insertRecord == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IReplicatedTransactionIntf.VERSION); + return; + } + vTable.insertRecord.invoke(this, status, name, record); + } + + public void updateRecord(IStatus status, String name, IReplicatedRecord orgRecord, IReplicatedRecord newRecord) + { + VTable vTable = getVTable(); + if (vTable.updateRecord == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IReplicatedTransactionIntf.VERSION); + return; + } + vTable.updateRecord.invoke(this, status, name, orgRecord, newRecord); + } + + public void deleteRecord(IStatus status, String name, IReplicatedRecord record) + { + VTable vTable = getVTable(); + if (vTable.deleteRecord == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IReplicatedTransactionIntf.VERSION); + return; + } + vTable.deleteRecord.invoke(this, status, name, record); + } + + public void executeSql(IStatus status, String sql) + { + VTable vTable = getVTable(); + if (vTable.executeSql == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IReplicatedTransactionIntf.VERSION); + return; + } + vTable.executeSql.invoke(this, status, sql); + } + + public void executeSqlIntl(IStatus status, int charset, String sql) + { + VTable vTable = getVTable(); + if (vTable.executeSqlIntl == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IReplicatedTransactionIntf.VERSION); + return; + } + vTable.executeSqlIntl.invoke(this, status, charset, sql); + } + } + + public static class IReplicatedSession extends IPluginBase implements IReplicatedSessionIntf + { + public static class VTable extends IPluginBase.VTable + { + public static interface Callback_init extends com.sun.jna.Callback + { + public boolean invoke(IReplicatedSession self, IStatus status, IAttachment attachment); + } + + public static interface Callback_startTransaction extends com.sun.jna.Callback + { + public IReplicatedTransaction invoke(IReplicatedSession self, IStatus status, ITransaction transaction, long number); + } + + public static interface Callback_cleanupTransaction extends com.sun.jna.Callback + { + public void invoke(IReplicatedSession self, IStatus status, long number); + } + + public static interface Callback_setSequence extends com.sun.jna.Callback + { + public void invoke(IReplicatedSession self, IStatus status, String name, long value); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IReplicatedSessionIntf obj) + { + super(obj); + + version = IReplicatedSessionIntf.VERSION; + + init = new Callback_init() { + @Override + public boolean invoke(IReplicatedSession self, IStatus status, IAttachment attachment) + { + 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, IStatus status, ITransaction transaction, long number) + { + try + { + return obj.startTransaction(status, transaction, number); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + return null; + } + } + }; + + cleanupTransaction = new Callback_cleanupTransaction() { + @Override + public void invoke(IReplicatedSession self, IStatus status, long number) + { + try + { + obj.cleanupTransaction(status, number); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + setSequence = new Callback_setSequence() { + @Override + public void invoke(IReplicatedSession self, IStatus status, String name, long value) + { + try + { + obj.setSequence(status, name, value); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; + } + + public VTable() + { + } + + public Callback_init init; + 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("init", "startTransaction", "cleanupTransaction", "setSequence")); + return fields; + } + } + + public IReplicatedSession() + { + } + + public IReplicatedSession(final IReplicatedSessionIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public boolean init(IStatus status, IAttachment attachment) + { + VTable vTable = getVTable(); + if (vTable.init == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IReplicatedSessionIntf.VERSION); + return false; + } + boolean result = vTable.init.invoke(this, status, attachment); + return result; + } + + 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, status, transaction, number); + return result; + } + + public void cleanupTransaction(IStatus status, long number) + { + VTable vTable = getVTable(); + if (vTable.cleanupTransaction == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IReplicatedSessionIntf.VERSION); + return; + } + vTable.cleanupTransaction.invoke(this, status, number); + } + + public void setSequence(IStatus status, String name, long value) + { + VTable vTable = getVTable(); + if (vTable.setSequence == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IReplicatedSessionIntf.VERSION); + return; + } + vTable.setSequence.invoke(this, status, name, value); + } + } + + public static class IProfilerPlugin extends IPluginBase implements IProfilerPluginIntf + { + public static class VTable extends IPluginBase.VTable + { + public static interface Callback_init extends com.sun.jna.Callback + { + public void invoke(IProfilerPlugin self, IStatus status, IAttachment attachment); + } + + public static interface Callback_startSession extends com.sun.jna.Callback + { + public IProfilerSession invoke(IProfilerPlugin self, IStatus status, String description, String options, ISC_TIMESTAMP_TZ timestamp); + } + + public static interface Callback_flush extends com.sun.jna.Callback + { + public void invoke(IProfilerPlugin self, IStatus status); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IProfilerPluginIntf obj) + { + super(obj); + + version = IProfilerPluginIntf.VERSION; + + init = new Callback_init() { + @Override + public void invoke(IProfilerPlugin self, IStatus status, IAttachment attachment) + { + try + { + obj.init(status, attachment); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + startSession = new Callback_startSession() { + @Override + public IProfilerSession invoke(IProfilerPlugin self, IStatus status, String description, String options, ISC_TIMESTAMP_TZ timestamp) + { + try + { + return obj.startSession(status, description, options, timestamp); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + return null; + } + } + }; + + flush = new Callback_flush() { + @Override + public void invoke(IProfilerPlugin self, IStatus status) + { + try + { + obj.flush(status); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; + } + + public VTable() + { + } + + public Callback_init init; + public Callback_startSession startSession; + public Callback_flush flush; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("init", "startSession", "flush")); + return fields; + } + } + + public IProfilerPlugin() + { + } + + public IProfilerPlugin(final IProfilerPluginIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public void init(IStatus status, IAttachment attachment) + { + VTable vTable = getVTable(); + if (vTable.init == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IProfilerPluginIntf.VERSION); + return; + } + vTable.init.invoke(this, status, attachment); + } + + public IProfilerSession startSession(IStatus status, String description, String options, ISC_TIMESTAMP_TZ timestamp) + { + VTable vTable = getVTable(); + if (vTable.startSession == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IProfilerPluginIntf.VERSION); + return null; + } + IProfilerSession result = vTable.startSession.invoke(this, status, description, options, timestamp); + return result; + } + + public void flush(IStatus status) + { + VTable vTable = getVTable(); + if (vTable.flush == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IProfilerPluginIntf.VERSION); + return; + } + vTable.flush.invoke(this, status); + } + } + + public static class IProfilerSession extends IDisposable implements IProfilerSessionIntf + { + public static class VTable extends IDisposable.VTable + { + public static interface Callback_getId extends com.sun.jna.Callback + { + public long invoke(IProfilerSession self); + } + + public static interface Callback_getFlags extends com.sun.jna.Callback + { + public int invoke(IProfilerSession self); + } + + public static interface Callback_cancel extends com.sun.jna.Callback + { + public void invoke(IProfilerSession self, IStatus status); + } + + public static interface Callback_finish extends com.sun.jna.Callback + { + public void invoke(IProfilerSession self, IStatus status, ISC_TIMESTAMP_TZ timestamp); + } + + public static interface Callback_defineStatement extends com.sun.jna.Callback + { + public void invoke(IProfilerSession self, IStatus status, long statementId, long parentStatementId, String type, String packageName, String routineName, String sqlText); + } + + public static interface Callback_defineCursor extends com.sun.jna.Callback + { + public void invoke(IProfilerSession self, long statementId, int cursorId, String name, int line, int column); + } + + public static interface Callback_defineRecordSource extends com.sun.jna.Callback + { + public void invoke(IProfilerSession self, long statementId, int cursorId, int recSourceId, String accessPath, int parentRecSourceId); + } + + public static interface Callback_onRequestStart extends com.sun.jna.Callback + { + public void invoke(IProfilerSession self, IStatus status, long requestId, long statementId, long callerRequestId, ISC_TIMESTAMP_TZ timestamp); + } + + public static interface Callback_onRequestFinish extends com.sun.jna.Callback + { + public void invoke(IProfilerSession self, IStatus status, long requestId, ISC_TIMESTAMP_TZ timestamp, IProfilerStats stats); + } + + public static interface Callback_beforePsqlLineColumn extends com.sun.jna.Callback + { + public void invoke(IProfilerSession self, long requestId, int line, int column); + } + + public static interface Callback_afterPsqlLineColumn extends com.sun.jna.Callback + { + public void invoke(IProfilerSession self, long requestId, int line, int column, IProfilerStats stats); + } + + public static interface Callback_beforeRecordSourceOpen extends com.sun.jna.Callback + { + public void invoke(IProfilerSession self, long requestId, int cursorId, int recSourceId); + } + + public static interface Callback_afterRecordSourceOpen extends com.sun.jna.Callback + { + public void invoke(IProfilerSession self, long requestId, int cursorId, int recSourceId, IProfilerStats stats); + } + + public static interface Callback_beforeRecordSourceGetRecord extends com.sun.jna.Callback + { + public void invoke(IProfilerSession self, long requestId, int cursorId, int recSourceId); + } + + public static interface Callback_afterRecordSourceGetRecord extends com.sun.jna.Callback + { + public void invoke(IProfilerSession self, long requestId, int cursorId, int recSourceId, IProfilerStats stats); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IProfilerSessionIntf obj) + { + super(obj); + + version = IProfilerSessionIntf.VERSION; + + getId = new Callback_getId() { + @Override + public long invoke(IProfilerSession self) + { + return obj.getId(); + } + }; + + getFlags = new Callback_getFlags() { + @Override + public int invoke(IProfilerSession self) + { + return obj.getFlags(); + } + }; + + cancel = new Callback_cancel() { + @Override + public void invoke(IProfilerSession self, IStatus status) + { + try + { + obj.cancel(status); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + finish = new Callback_finish() { + @Override + public void invoke(IProfilerSession self, IStatus status, ISC_TIMESTAMP_TZ timestamp) + { + try + { + obj.finish(status, timestamp); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + defineStatement = new Callback_defineStatement() { + @Override + public void invoke(IProfilerSession self, IStatus status, long statementId, long parentStatementId, String type, String packageName, String routineName, String sqlText) + { + try + { + obj.defineStatement(status, statementId, parentStatementId, type, packageName, routineName, sqlText); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + defineCursor = new Callback_defineCursor() { + @Override + public void invoke(IProfilerSession self, long statementId, int cursorId, String name, int line, int column) + { + obj.defineCursor(statementId, cursorId, name, line, column); + } + }; + + defineRecordSource = new Callback_defineRecordSource() { + @Override + public void invoke(IProfilerSession self, long statementId, int cursorId, int recSourceId, String accessPath, int parentRecSourceId) + { + obj.defineRecordSource(statementId, cursorId, recSourceId, accessPath, parentRecSourceId); + } + }; + + onRequestStart = new Callback_onRequestStart() { + @Override + public void invoke(IProfilerSession self, IStatus status, long requestId, long statementId, long callerRequestId, ISC_TIMESTAMP_TZ timestamp) + { + try + { + obj.onRequestStart(status, requestId, statementId, callerRequestId, timestamp); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + onRequestFinish = new Callback_onRequestFinish() { + @Override + public void invoke(IProfilerSession self, IStatus status, long requestId, ISC_TIMESTAMP_TZ timestamp, IProfilerStats stats) + { + try + { + obj.onRequestFinish(status, requestId, timestamp, stats); + } + catch (Throwable t) + { + FbInterfaceException.catchException(status, t); + } + } + }; + + beforePsqlLineColumn = new Callback_beforePsqlLineColumn() { + @Override + public void invoke(IProfilerSession self, long requestId, int line, int column) + { + obj.beforePsqlLineColumn(requestId, line, column); + } + }; + + afterPsqlLineColumn = new Callback_afterPsqlLineColumn() { + @Override + public void invoke(IProfilerSession self, long requestId, int line, int column, IProfilerStats stats) + { + obj.afterPsqlLineColumn(requestId, line, column, stats); + } + }; + + beforeRecordSourceOpen = new Callback_beforeRecordSourceOpen() { + @Override + public void invoke(IProfilerSession self, long requestId, int cursorId, int recSourceId) + { + obj.beforeRecordSourceOpen(requestId, cursorId, recSourceId); + } + }; + + afterRecordSourceOpen = new Callback_afterRecordSourceOpen() { + @Override + public void invoke(IProfilerSession self, long requestId, int cursorId, int recSourceId, IProfilerStats stats) + { + obj.afterRecordSourceOpen(requestId, cursorId, recSourceId, stats); + } + }; + + beforeRecordSourceGetRecord = new Callback_beforeRecordSourceGetRecord() { + @Override + public void invoke(IProfilerSession self, long requestId, int cursorId, int recSourceId) + { + obj.beforeRecordSourceGetRecord(requestId, cursorId, recSourceId); + } + }; + + afterRecordSourceGetRecord = new Callback_afterRecordSourceGetRecord() { + @Override + public void invoke(IProfilerSession self, long requestId, int cursorId, int recSourceId, IProfilerStats stats) + { + obj.afterRecordSourceGetRecord(requestId, cursorId, recSourceId, stats); + } + }; + } + + public VTable() + { + } + + public Callback_getId getId; + public Callback_getFlags getFlags; + public Callback_cancel cancel; + public Callback_finish finish; + public Callback_defineStatement defineStatement; + public Callback_defineCursor defineCursor; + public Callback_defineRecordSource defineRecordSource; + public Callback_onRequestStart onRequestStart; + public Callback_onRequestFinish onRequestFinish; + public Callback_beforePsqlLineColumn beforePsqlLineColumn; + public Callback_afterPsqlLineColumn afterPsqlLineColumn; + public Callback_beforeRecordSourceOpen beforeRecordSourceOpen; + public Callback_afterRecordSourceOpen afterRecordSourceOpen; + public Callback_beforeRecordSourceGetRecord beforeRecordSourceGetRecord; + public Callback_afterRecordSourceGetRecord afterRecordSourceGetRecord; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("getId", "getFlags", "cancel", "finish", "defineStatement", "defineCursor", "defineRecordSource", "onRequestStart", "onRequestFinish", "beforePsqlLineColumn", "afterPsqlLineColumn", "beforeRecordSourceOpen", "afterRecordSourceOpen", "beforeRecordSourceGetRecord", "afterRecordSourceGetRecord")); + return fields; + } + } + + public IProfilerSession() + { + } + + public IProfilerSession(final IProfilerSessionIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public long getId() + { + VTable vTable = getVTable(); + if (vTable.getId == null) { + return 0; + } + long result = vTable.getId.invoke(this); + return result; + } + + public int getFlags() + { + VTable vTable = getVTable(); + if (vTable.getFlags == null) { + return 0; + } + int result = vTable.getFlags.invoke(this); + return result; + } + + public void cancel(IStatus status) + { + VTable vTable = getVTable(); + if (vTable.cancel == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IProfilerSessionIntf.VERSION); + return; + } + vTable.cancel.invoke(this, status); + } + + public void finish(IStatus status, ISC_TIMESTAMP_TZ timestamp) + { + VTable vTable = getVTable(); + if (vTable.finish == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IProfilerSessionIntf.VERSION); + return; + } + vTable.finish.invoke(this, status, timestamp); + } + + public void defineStatement(IStatus status, long statementId, long parentStatementId, String type, String packageName, String routineName, String sqlText) + { + VTable vTable = getVTable(); + if (vTable.defineStatement == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IProfilerSessionIntf.VERSION); + return; + } + vTable.defineStatement.invoke(this, status, statementId, parentStatementId, type, packageName, routineName, sqlText); + } + + public void defineCursor(long statementId, int cursorId, String name, int line, int column) + { + VTable vTable = getVTable(); + if (vTable.defineCursor == null) { + return; + } + vTable.defineCursor.invoke(this, statementId, cursorId, name, line, column); + } + + public void defineRecordSource(long statementId, int cursorId, int recSourceId, String accessPath, int parentRecSourceId) + { + VTable vTable = getVTable(); + if (vTable.defineRecordSource == null) { + return; + } + vTable.defineRecordSource.invoke(this, statementId, cursorId, recSourceId, accessPath, parentRecSourceId); + } + + public void onRequestStart(IStatus status, long requestId, long statementId, long callerRequestId, ISC_TIMESTAMP_TZ timestamp) + { + VTable vTable = getVTable(); + if (vTable.onRequestStart == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IProfilerSessionIntf.VERSION); + return; + } + vTable.onRequestStart.invoke(this, status, requestId, statementId, callerRequestId, timestamp); + } + + public void onRequestFinish(IStatus status, long requestId, ISC_TIMESTAMP_TZ timestamp, IProfilerStats stats) + { + VTable vTable = getVTable(); + if (vTable.onRequestFinish == null) { + FbInterfaceException.setVersionError(status, this.getClass().getName(), vTable.version, IProfilerSessionIntf.VERSION); + return; + } + vTable.onRequestFinish.invoke(this, status, requestId, timestamp, stats); + } + + public void beforePsqlLineColumn(long requestId, int line, int column) + { + VTable vTable = getVTable(); + if (vTable.beforePsqlLineColumn == null) { + return; + } + vTable.beforePsqlLineColumn.invoke(this, requestId, line, column); + } + + public void afterPsqlLineColumn(long requestId, int line, int column, IProfilerStats stats) + { + VTable vTable = getVTable(); + if (vTable.afterPsqlLineColumn == null) { + return; + } + vTable.afterPsqlLineColumn.invoke(this, requestId, line, column, stats); + } + + public void beforeRecordSourceOpen(long requestId, int cursorId, int recSourceId) + { + VTable vTable = getVTable(); + if (vTable.beforeRecordSourceOpen == null) { + return; + } + vTable.beforeRecordSourceOpen.invoke(this, requestId, cursorId, recSourceId); + } + + public void afterRecordSourceOpen(long requestId, int cursorId, int recSourceId, IProfilerStats stats) + { + VTable vTable = getVTable(); + if (vTable.afterRecordSourceOpen == null) { + return; + } + vTable.afterRecordSourceOpen.invoke(this, requestId, cursorId, recSourceId, stats); + } + + public void beforeRecordSourceGetRecord(long requestId, int cursorId, int recSourceId) + { + VTable vTable = getVTable(); + if (vTable.beforeRecordSourceGetRecord == null) { + return; + } + vTable.beforeRecordSourceGetRecord.invoke(this, requestId, cursorId, recSourceId); + } + + public void afterRecordSourceGetRecord(long requestId, int cursorId, int recSourceId, IProfilerStats stats) + { + VTable vTable = getVTable(); + if (vTable.afterRecordSourceGetRecord == null) { + return; + } + vTable.afterRecordSourceGetRecord.invoke(this, requestId, cursorId, recSourceId, stats); + } + } + + public static class IProfilerStats extends IVersioned implements IProfilerStatsIntf + { + public static class VTable extends IVersioned.VTable + { + public static interface Callback_getElapsedTime extends com.sun.jna.Callback + { + public long invoke(IProfilerStats self); + } + + public VTable(com.sun.jna.Pointer pointer) + { + super(pointer); + } + + public VTable(final IProfilerStatsIntf obj) + { + super(obj); + + version = IProfilerStatsIntf.VERSION; + + getElapsedTime = new Callback_getElapsedTime() { + @Override + public long invoke(IProfilerStats self) + { + return obj.getElapsedTime(); + } + }; + } + + public VTable() + { + } + + public Callback_getElapsedTime getElapsedTime; + + @Override + protected java.util.List getFieldOrder() + { + java.util.List fields = super.getFieldOrder(); + fields.addAll(java.util.Arrays.asList("getElapsedTime")); + return fields; + } + } + + public IProfilerStats() + { + } + + public IProfilerStats(final IProfilerStatsIntf obj) + { + vTable = new VTable(obj); + vTable.write(); + cloopVTable = vTable.getPointer(); + write(); + } + + @Override + protected VTable createVTable() + { + return new VTable(cloopVTable); + } + + public long getElapsedTime() + { + VTable vTable = getVTable(); + if (vTable.getElapsedTime == null) { + return 0; + } + long result = vTable.getElapsedTime.invoke(this); + return result; + } + } +} diff --git a/jaybird-native/src/main/java/org/firebirdsql/jna/fbclient/FbInterfaceException.java b/jaybird-native/src/main/java/org/firebirdsql/jna/fbclient/FbInterfaceException.java new file mode 100644 index 0000000000..e82ed58f8d --- /dev/null +++ b/jaybird-native/src/main/java/org/firebirdsql/jna/fbclient/FbInterfaceException.java @@ -0,0 +1,51 @@ +package org.firebirdsql.jna.fbclient; + +/** + * Class with for wrapping an exception thrown by the native interface. + * + * @since 6.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(); + 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(msgLength), + memory, + new com.sun.jna.Pointer(org.firebirdsql.gds.ISCConstants.isc_arg_end) + }; + 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/jaybird-native/src/main/java/org/firebirdsql/jna/fbclient/ISC_DATE.java b/jaybird-native/src/main/java/org/firebirdsql/jna/fbclient/ISC_DATE.java new file mode 100644 index 0000000000..5013db8ddc --- /dev/null +++ b/jaybird-native/src/main/java/org/firebirdsql/jna/fbclient/ISC_DATE.java @@ -0,0 +1,25 @@ +package org.firebirdsql.jna.fbclient; + +import com.sun.jna.Structure; + +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 6.0 + */ +public class ISC_DATE extends Structure implements Structure.ByValue +{ + public int value; + + @Override + protected List getFieldOrder() + { + return Arrays.asList("value"); + } +} diff --git a/jaybird-native/src/main/java/org/firebirdsql/jna/fbclient/ISC_QUAD.java b/jaybird-native/src/main/java/org/firebirdsql/jna/fbclient/ISC_QUAD.java new file mode 100644 index 0000000000..ac93212976 --- /dev/null +++ b/jaybird-native/src/main/java/org/firebirdsql/jna/fbclient/ISC_QUAD.java @@ -0,0 +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 6.0 + */ +public class ISC_QUAD extends GDS_QUAD_t { +} diff --git a/jaybird-native/src/main/java/org/firebirdsql/jna/fbclient/ISC_TIME.java b/jaybird-native/src/main/java/org/firebirdsql/jna/fbclient/ISC_TIME.java new file mode 100644 index 0000000000..191127b0ee --- /dev/null +++ b/jaybird-native/src/main/java/org/firebirdsql/jna/fbclient/ISC_TIME.java @@ -0,0 +1,25 @@ +package org.firebirdsql.jna.fbclient; + +import com.sun.jna.Structure; + +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 6.0 + */ +public class ISC_TIME extends Structure implements Structure.ByValue +{ + public int value; + + @Override + protected List getFieldOrder() + { + return Arrays.asList("value"); + } +} diff --git a/jaybird-native/src/main/java/org/firebirdsql/jna/fbclient/ISC_TIMESTAMP_TZ.java b/jaybird-native/src/main/java/org/firebirdsql/jna/fbclient/ISC_TIMESTAMP_TZ.java new file mode 100644 index 0000000000..59eacd0093 --- /dev/null +++ b/jaybird-native/src/main/java/org/firebirdsql/jna/fbclient/ISC_TIMESTAMP_TZ.java @@ -0,0 +1,26 @@ +package org.firebirdsql.jna.fbclient; + +import com.sun.jna.Structure; + +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 6.0 + */ +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/jaybird-native/src/main/java/org/firebirdsql/jna/fbclient/ISC_TIMESTAMP_TZ_EX.java b/jaybird-native/src/main/java/org/firebirdsql/jna/fbclient/ISC_TIMESTAMP_TZ_EX.java new file mode 100644 index 0000000000..b4c58ac8a9 --- /dev/null +++ b/jaybird-native/src/main/java/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 6.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/jaybird-native/src/main/java/org/firebirdsql/jna/fbclient/ISC_TIME_TZ.java b/jaybird-native/src/main/java/org/firebirdsql/jna/fbclient/ISC_TIME_TZ.java new file mode 100644 index 0000000000..99b226c163 --- /dev/null +++ b/jaybird-native/src/main/java/org/firebirdsql/jna/fbclient/ISC_TIME_TZ.java @@ -0,0 +1,26 @@ +package org.firebirdsql.jna.fbclient; + +import com.sun.jna.Structure; + +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 6.0 + */ +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/jaybird-native/src/main/java/org/firebirdsql/jna/fbclient/ISC_TIME_TZ_EX.java b/jaybird-native/src/main/java/org/firebirdsql/jna/fbclient/ISC_TIME_TZ_EX.java new file mode 100644 index 0000000000..8e6820334e --- /dev/null +++ b/jaybird-native/src/main/java/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 6.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/jaybird-native/src/main/resources/META-INF/services/org.firebirdsql.gds.impl.GDSFactoryPlugin b/jaybird-native/src/main/resources/META-INF/services/org.firebirdsql.gds.impl.GDSFactoryPlugin index 4d178850a4..70bf527aef 100644 --- a/jaybird-native/src/main/resources/META-INF/services/org.firebirdsql.gds.impl.GDSFactoryPlugin +++ b/jaybird-native/src/main/resources/META-INF/services/org.firebirdsql.gds.impl.GDSFactoryPlugin @@ -1,2 +1,4 @@ +org.firebirdsql.gds.impl.jni.FbOONativeGDSFactoryPlugin +org.firebirdsql.gds.impl.jni.FbOOEmbeddedGDSFactoryPlugin org.firebirdsql.gds.impl.jni.NativeGDSFactoryPlugin org.firebirdsql.gds.impl.jni.EmbeddedGDSFactoryPlugin diff --git a/src/jna-test/org/firebirdsql/gds/ng/jna/JnaBlobTest.java b/src/jna-test/org/firebirdsql/gds/ng/jna/JnaBlobTest.java index 673301a15b..583c58c4af 100644 --- a/src/jna-test/org/firebirdsql/gds/ng/jna/JnaBlobTest.java +++ b/src/jna-test/org/firebirdsql/gds/ng/jna/JnaBlobTest.java @@ -422,7 +422,7 @@ 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/main/org/firebirdsql/gds/ng/AbstractFbBatch.java b/src/main/org/firebirdsql/gds/ng/AbstractFbBatch.java new file mode 100644 index 0000000000..be213167b9 --- /dev/null +++ b/src/main/org/firebirdsql/gds/ng/AbstractFbBatch.java @@ -0,0 +1,347 @@ +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.FieldDataProvider; + +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 + * @since 6.0 + */ +public abstract class AbstractFbBatch implements FbBatch { + + protected final ExceptionListenerDispatcher exceptionListenerDispatcher = new ExceptionListenerDispatcher(this); + private final BatchParameterBuffer batchParameterBuffer; + protected FbTransaction transaction; + private FbDatabase database; + + private RowDescriptor rowDescriptor; + private FBField[] fields = null; + private RowValue fieldValues; + + protected AbstractFbBatch(FbDatabase database, BatchParameterBuffer batchParameterBuffer) { + this.database = database; + this.batchParameterBuffer = batchParameterBuffer; + } + + @Override + public void addExceptionListener(ExceptionListener listener) { + exceptionListenerDispatcher.addListener(listener); + } + + @Override + public void removeExceptionListener(ExceptionListener listener) { + exceptionListenerDispatcher.removeListener(listener); + } + + 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(final FbDatabase database) { + this.database = database; + } + + protected RowValue getFieldValues() { + return fieldValues; + } + + /** + * Creating a string descriptor from metadata. + * + * @throws SQLException For errors when preparing batch + * + */ + 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_DESC_FIELD_ID); + } + + 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); + } + + /** + *

+ * 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)}. + *

+ */ + 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); + } + + 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); + } + + 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); + } + + public final LockCloseable withLock() { + return database.withLock(); + } +} 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..75650499c0 --- /dev/null +++ b/src/main/org/firebirdsql/gds/ng/AbstractFbMessageBuilder.java @@ -0,0 +1,196 @@ +package org.firebirdsql.gds.ng; + +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; +import java.sql.SQLException; + +/** + * 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 final FbMessageMetadata metadata; + private final FbStatement statement; + private final ByteBuffer buffer; + private final SeekableByteArrayOutputStream stream = new SeekableByteArrayOutputStream(); + private final SeekableByteArrayOutputStream blobStream = new SeekableByteArrayOutputStream(); + 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)); + } + + 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(); + buffer = ByteBuffer.allocate(this.messageLength); + } + + @Override + public void addData(int index, byte[] data, FieldDescriptor parameterDescriptor) throws SQLException { + int nullOffset = metadata.getNullOffset(index); + int offset = metadata.getOffset(index); + + 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; + } + + buffer.position(offset); + if (data == null) { + buffer.position(nullOffset); + buffer.put(parameterDescriptor.getDatatypeCoder().encodeShort(1)); + } else { + buffer.put(data); + buffer.position(nullOffset); + buffer.put(nulls); + } + } + + @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(statement.getDatabase().getDatatypeCoder().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(statement.getDatabase().getDatatypeCoder().encodeLong(blobId)); + + segmentedBlobOffset = blobStream.size(); + segmentedBlobSize = segmentedBlobOffset; + + if (buffer != null) { + byte[] bytes = buffer.toBytesWithType(); + byte[] bytesLength = statement.getDatabase().getDatatypeCoder().encodeInt(bytes.length); + blobStream.write(bytesLength); + blobStream.write(bytesLength); + blobStream.write(bytes); + } else { + byte[] bytesLength = statement.getDatabase().getDatatypeCoder().encodeInt(0); + blobStream.write(bytesLength); + blobStream.write(bytesLength); + } + + return segmentedBlobOffset; + } + + @Override + public void addBlobSegment(byte[] data, boolean lastSegment) throws IOException { + 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); + } + long oldPosition = blobStream.getStreamPosition(); + blobStream.seek(segmentedBlobOffset); + + byte[] dataLength = statement.getDatabase().getDatatypeCoder().encodeShort(data.length); + segmentedBlobSize += align(data.length + dataLength.length, BatchItems.BLOB_SEGHDR_ALIGN); + blobStream.write(statement.getDatabase().getDatatypeCoder().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/AbstractFbStatement.java b/src/main/org/firebirdsql/gds/ng/AbstractFbStatement.java index d4c56223f6..55ea379162 100644 --- a/src/main/org/firebirdsql/gds/ng/AbstractFbStatement.java +++ b/src/main/org/firebirdsql/gds/ng/AbstractFbStatement.java @@ -18,6 +18,7 @@ */ package org.firebirdsql.gds.ng; +import org.firebirdsql.gds.BatchParameterBuffer; import org.firebirdsql.gds.ISCConstants; import org.firebirdsql.gds.JaybirdErrorCodes; import org.firebirdsql.gds.ng.fields.RowDescriptor; @@ -835,6 +836,10 @@ private void fetchExecuted() { fetched = true; } + 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. */ 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..7ddce0838f --- /dev/null +++ b/src/main/org/firebirdsql/gds/ng/FbBatch.java @@ -0,0 +1,123 @@ +package org.firebirdsql.gds.ng; + + +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; + +/** + * 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 6.0 + */ +public interface FbBatch extends ExceptionListenable { + + /** + * @return Transaction currently associated with this batch. + */ + FbTransaction getTransaction(); + + /** + * @return The database connection that created this batch. + */ + FbDatabase getDatabase(); + + /** + * 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. + */ + void addBlob(int index, FirebirdBlob blob) + throws SQLException; + + /** + * Add blob in this batch and ID will be generated by engine. + */ + 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. + */ + void addSegmentedBlob(int index, BlobParameterBuffer buffer, FirebirdBlob blob) + 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. + */ + void addBlobStream(byte[] inBuffer) throws SQLException; + + /** + * Register existing blob. + */ + void registerBlob(int index, long existingBlob, FirebirdBlob blob) throws SQLException; + + /** + * Execute tis batch and + * @return {@link FbBatchCompletionState} 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; + + /** + * @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 new file mode 100644 index 0000000000..00ec791859 --- /dev/null +++ b/src/main/org/firebirdsql/gds/ng/FbBatchCompletionState.java @@ -0,0 +1,50 @@ +package org.firebirdsql.gds.ng; + +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 + */ +public interface FbBatchCompletionState { + + int EXECUTE_FAILED = -1; + int SUCCESS_NO_INFO = -2; + int NO_MORE_ERRORS = 0xFFFFFFFF; + + /** + * @return Count of executed statements. + */ + int getSize() throws SQLException; + + /** + * @return The state of a statement with a specific index. + */ + int getState(int index) throws SQLException; + + /** + * @return The string with error of a statement with a specific index. + */ + String getError(int index) throws SQLException; + + /** + * @return Returns a string with the result of all statements, + * including error descriptions. + */ + String printAllStates() throws SQLException; + + /** + * @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/main/org/firebirdsql/gds/ng/FbDatabase.java b/src/main/org/firebirdsql/gds/ng/FbDatabase.java index cfc577b76a..bf2fa5019c 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; @@ -402,4 +399,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..40cabc679a --- /dev/null +++ b/src/main/org/firebirdsql/gds/ng/FbMessageBuilder.java @@ -0,0 +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.sql.SQLException; + +/** + * Interface to building row message for {@link FbBatch}. + * + * @author Vasiliy Yashkov + * @since 4.0 + */ +public interface FbMessageBuilder { + + /** + * 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; + + /** + * 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 new file mode 100644 index 0000000000..8646aff39c --- /dev/null +++ b/src/main/org/firebirdsql/gds/ng/FbMessageMetadata.java @@ -0,0 +1,46 @@ +package org.firebirdsql.gds.ng; + +import java.sql.SQLException; + +/** + * Interface to access batch fields metadata + * + * @author Vasiliy Yashkov + * @since 4.0 + */ +public interface FbMessageMetadata { + + int getOffset(int index) throws SQLException; + + int getNullOffset(int index) throws SQLException; + + int getLength(int index) throws SQLException; + + String getAlias(int index) throws SQLException; + + String getField(int index) throws SQLException; + + String getOwner(int index) throws SQLException; + + String getRelation(int index) throws SQLException; + + int getAlignedLength() throws SQLException; + + int getAlignment() throws SQLException; + + int getCount() throws SQLException; + + int getCharSet(int index) throws SQLException; + + int getMessageLength() throws SQLException; + + int getScale(int index) throws SQLException; + + int getSubType(int index) throws SQLException; + + int getType(int index) throws SQLException; + + boolean isNullable(int index) throws SQLException; + + FbMetadataBuilder getBuilder() throws SQLException; +} 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..04a154a40c --- /dev/null +++ b/src/main/org/firebirdsql/gds/ng/FbMetadataBuilder.java @@ -0,0 +1,57 @@ +package org.firebirdsql.gds.ng; + +import java.sql.SQLException; + +/** + * + * @author Vasiliy Yashkov + * @since 4.0 + */ +public interface FbMetadataBuilder { + + FbMessageMetadata getMessageMetadata() throws SQLException; + + int addField() throws SQLException; + + void addSmallint(int index) throws SQLException; + + void addInteger(int index) throws SQLException; + + void addBigint(int index) throws SQLException; + + void addFloat(int index) throws SQLException; + + void addNumeric(int index, int size, int scale) throws SQLException; + + void addDecimal(int index, int size, int scale) throws SQLException; + + void addDouble(int index) throws SQLException; + + void addDecfloat16(int index) throws SQLException; + + void addDecfloat34(int index) throws SQLException; + + void addBlob(int index) throws SQLException; + + void addBlob(int index, int subtype) throws SQLException; + + void addBoolean(int index) throws SQLException; + + void addDate(int index) throws SQLException; + + void addTime(int index) throws SQLException; + + void addTimestamp(int index) throws SQLException; + + void addChar(int index, int length) throws SQLException; + + void addVarchar(int index, int length) throws SQLException; + + void addChar(int index, int length, int charSet) throws SQLException; + + void addVarchar(int index, int length, int charSet) throws SQLException; + + void addDecDecimal(int index, int size, int scale) throws SQLException; + + void addDecNumeric(int index, int size, int scale) throws SQLException; +} 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 6bd1835621..b73830d98b 100644 --- a/src/main/org/firebirdsql/gds/ng/wire/version10/V10Database.java +++ b/src/main/org/firebirdsql/gds/ng/wire/version10/V10Database.java @@ -21,7 +21,10 @@ import org.firebirdsql.encodings.Encoding; import org.firebirdsql.gds.*; 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.LockCloseable; @@ -29,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 java.io.IOException; @@ -63,6 +67,21 @@ protected V10Database(WireDatabaseConnection connection, ProtocolDescriptor desc super(connection, descriptor); } + @Override + public FbBatch createBatch(FbTransaction transaction, String statement, FbMessageMetadata metadata, BatchParameterBuffer parameters) throws SQLException { + throw new FBDriverNotCapableException(); + } + + @Override + public FbBatch createBatch(FbTransaction transaction, String statement, BatchParameterBuffer parameters) throws SQLException { + throw new FBDriverNotCapableException(); + } + + @Override + public FbMetadataBuilder getMetadataBuilder(int fieldCount) throws SQLException { + throw new FBDriverNotCapableException(); + } + @Override public final void attach() throws SQLException { try { diff --git a/src/nativeoo-test/org/firebirdsql/gds/ng/nativeoo/IBatchImplTest.java b/src/nativeoo-test/org/firebirdsql/gds/ng/nativeoo/IBatchImplTest.java new file mode 100644 index 0000000000..108edcbb08 --- /dev/null +++ b/src/nativeoo-test/org/firebirdsql/gds/ng/nativeoo/IBatchImplTest.java @@ -0,0 +1,1374 @@ +package org.firebirdsql.gds.ng.nativeoo; + +import org.firebirdsql.common.FBTestProperties; +import org.firebirdsql.common.extension.GdsTypeExtension; +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.wire.SimpleStatementListener; +import org.firebirdsql.jaybird.fb.constants.BatchItems; +import org.firebirdsql.jaybird.fb.constants.BpbItems; +import org.firebirdsql.jdbc.FBBlob; +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; +import java.sql.*; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Calendar; + +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.jupiter.api.Assertions.*; + +/** + * Test for batch in the OO API implementation. + * + * {@link org.firebirdsql.gds.ng.nativeoo.IBatchImpl}. + * + * @author Vasiliy Yashkov + * @since 6.0 + */ +class IBatchImplTest extends AbstractBatchTest { + + @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 (" + + " 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 + + @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 BatchParameterBufferImp(); + buffer.addArgument(BatchItems.TAG_RECORD_COUNTS, 1); + IBatchImpl batch = (IBatchImpl) 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())); + + 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.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.getRowDescriptor().getFieldDescriptor(0).getDatatypeCoder().decodeInt(fieldData)); + fieldData = fieldValues.getFieldData(1); + assertEquals(testVarchar, + statement.getRowDescriptor().getFieldDescriptor(1).getDatatypeCoder().decodeString(fieldData)); + fieldData = fieldValues.getFieldData(2); + assertEquals(testVarchar, + statement.getRowDescriptor().getFieldDescriptor(2).getDatatypeCoder().decodeString(fieldData)); + fieldData = fieldValues.getFieldData(3); + assertEquals(testVarchar, + statement.getRowDescriptor().getFieldDescriptor(3).getDatatypeCoder().decodeString(fieldData)); + fieldData = fieldValues.getFieldData(4); + assertEquals(testBigInteger, + statement.getRowDescriptor().getFieldDescriptor(4).getDatatypeCoder().decodeLong(fieldData)); + fieldData = fieldValues.getFieldData(5); + assertEquals(testInteger, + statement.getRowDescriptor().getFieldDescriptor(5).getDatatypeCoder().decodeInt(fieldData)); + fieldData = fieldValues.getFieldData(6); + assertEquals(testShort, + statement.getRowDescriptor().getFieldDescriptor(6).getDatatypeCoder().decodeShort(fieldData)); + fieldData = fieldValues.getFieldData(7); + assertEquals(testFloat, + statement.getRowDescriptor().getFieldDescriptor(7).getDatatypeCoder().decodeFloat(fieldData), + 0); + fieldData = fieldValues.getFieldData(8); + assertEquals(testDouble, + statement.getRowDescriptor().getFieldDescriptor(8).getDatatypeCoder().decodeDouble(fieldData), + 0); + fieldData = fieldValues.getFieldData(9); + 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.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.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.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.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.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.getRowDescriptor().getFieldDescriptor(15).getDatatypeCoder().decodeDateCalendar(fieldData, Calendar.getInstance())); + fieldData = fieldValues.getFieldData(16); + assertEquals(testTime, + statement.getRowDescriptor().getFieldDescriptor(16).getDatatypeCoder().decodeTimeCalendar(fieldData, Calendar.getInstance())); + fieldData = fieldValues.getFieldData(17); + assertEquals(testTimestamp, + statement.getRowDescriptor().getFieldDescriptor(17).getDatatypeCoder().decodeTimestampCalendar(fieldData, Calendar.getInstance())); + + } + + @Test + public void testSingleExecuteBatchWithBlobs() throws Exception { + allocateTransaction(); + BatchParameterBuffer buffer = new BatchParameterBufferImp(); + buffer.addArgument(BatchItems.TAG_RECORD_COUNTS, 1); + // continue batch processing in case of errors in some messages + buffer.addArgument(BatchItems.TAG_MULTIERROR, 1); + // enable blobs processing - IDs generated by firebird 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; + 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())); + + 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.appendBlobData("\n".getBytes()); + batch.appendBlobData(INSERT_QUERY_ONLY_BLOBS.getBytes()); + + 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.getRowDescriptor().getFieldDescriptor(0).getDatatypeCoder().decodeInt(fieldData)); + fieldData = fieldValues.getFieldData(1); + assertEquals(testVarchar, + statement.getRowDescriptor().getFieldDescriptor(1).getDatatypeCoder().decodeString(fieldData)); + fieldData = fieldValues.getFieldData(2); + assertEquals(testVarchar, + statement.getRowDescriptor().getFieldDescriptor(2).getDatatypeCoder().decodeString(fieldData)); + fieldData = fieldValues.getFieldData(3); + assertEquals(testVarchar, + statement.getRowDescriptor().getFieldDescriptor(3).getDatatypeCoder().decodeString(fieldData)); + fieldData = fieldValues.getFieldData(4); + assertEquals(testBigInteger, + statement.getRowDescriptor().getFieldDescriptor(4).getDatatypeCoder().decodeLong(fieldData)); + fieldData = fieldValues.getFieldData(5); + assertEquals(testInteger, + statement.getRowDescriptor().getFieldDescriptor(5).getDatatypeCoder().decodeInt(fieldData)); + fieldData = fieldValues.getFieldData(6); + assertEquals(testShort, + statement.getRowDescriptor().getFieldDescriptor(6).getDatatypeCoder().decodeShort(fieldData)); + fieldData = fieldValues.getFieldData(7); + assertEquals(testFloat, + statement.getRowDescriptor().getFieldDescriptor(7).getDatatypeCoder().decodeFloat(fieldData), + 0); + fieldData = fieldValues.getFieldData(8); + assertEquals(testDouble, + statement.getRowDescriptor().getFieldDescriptor(8).getDatatypeCoder().decodeDouble(fieldData), + 0); + fieldData = fieldValues.getFieldData(9); + 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.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.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.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.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.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.getRowDescriptor().getFieldDescriptor(15).getDatatypeCoder().decodeDateCalendar(fieldData, Calendar.getInstance())); + fieldData = fieldValues.getFieldData(16); + assertEquals(testTime, + statement.getRowDescriptor().getFieldDescriptor(16).getDatatypeCoder().decodeTimeCalendar(fieldData, Calendar.getInstance())); + fieldData = fieldValues.getFieldData(17); + assertEquals(testTimestamp, + 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()); + fieldData = fieldValues.getFieldData(19); + blobID = statement.getRowDescriptor().getFieldDescriptor(19).getDatatypeCoder().decodeLong(fieldData); + checkBlob(blobID, INSERT_QUERY_WITH_BLOBS.getBytes()); + fieldData = fieldValues.getFieldData(20); + blobID = statement.getRowDescriptor().getFieldDescriptor(20).getDatatypeCoder().decodeLong(fieldData); + checkBlob(blobID, new String(INSERT_QUERY_WITH_BLOBS + "\n" + INSERT_QUERY_ONLY_BLOBS).getBytes()); + } + + @Test + public void testMultipleMessagesBatchWithoutBlobs() throws SQLException { + allocateTransaction(); + 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; + 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())); + + 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.printAllStates()); + + assertThat("Expected successful batch execution", execute.printAllStates(), 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.getRowDescriptor().getFieldDescriptor(0).getDatatypeCoder().decodeInt(fieldData)); + fieldData = fieldValues.getFieldData(1); + assertEquals(testVarchar, + statement.getRowDescriptor().getFieldDescriptor(1).getDatatypeCoder().decodeString(fieldData)); + fieldData = fieldValues.getFieldData(2); + assertEquals(testVarchar, + statement.getRowDescriptor().getFieldDescriptor(2).getDatatypeCoder().decodeString(fieldData)); + fieldData = fieldValues.getFieldData(3); + assertEquals(testVarchar, + statement.getRowDescriptor().getFieldDescriptor(3).getDatatypeCoder().decodeString(fieldData)); + fieldData = fieldValues.getFieldData(4); + assertEquals(testBigInteger, + statement.getRowDescriptor().getFieldDescriptor(4).getDatatypeCoder().decodeLong(fieldData)); + fieldData = fieldValues.getFieldData(5); + assertEquals(testInteger, + statement.getRowDescriptor().getFieldDescriptor(5).getDatatypeCoder().decodeInt(fieldData)); + fieldData = fieldValues.getFieldData(6); + assertEquals(testShort, + statement.getRowDescriptor().getFieldDescriptor(6).getDatatypeCoder().decodeShort(fieldData)); + fieldData = fieldValues.getFieldData(7); + assertEquals(testFloat, + statement.getRowDescriptor().getFieldDescriptor(7).getDatatypeCoder().decodeFloat(fieldData), + 0); + fieldData = fieldValues.getFieldData(8); + assertEquals(testDouble, + statement.getRowDescriptor().getFieldDescriptor(8).getDatatypeCoder().decodeDouble(fieldData), + 0); + fieldData = fieldValues.getFieldData(9); + 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.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.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.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.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.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.getRowDescriptor().getFieldDescriptor(15).getDatatypeCoder().decodeDateCalendar(fieldData, Calendar.getInstance())); + fieldData = fieldValues.getFieldData(16); + assertEquals(testTime, + statement.getRowDescriptor().getFieldDescriptor(16).getDatatypeCoder().decodeTimeCalendar(fieldData, Calendar.getInstance())); + fieldData = fieldValues.getFieldData(17); + assertEquals(testTimestamp, + statement.getRowDescriptor().getFieldDescriptor(17).getDatatypeCoder().decodeTimestampCalendar(fieldData, Calendar.getInstance())); + } + + @Test + public void testMultipleMessagesBatchWithBlobs() throws Exception { + allocateTransaction(); + BatchParameterBuffer buffer = new BatchParameterBufferImp(); + buffer.addArgument(BatchItems.TAG_RECORD_COUNTS, 1); + // continue batch processing in case of errors in some messages + buffer.addArgument(BatchItems.TAG_MULTIERROR, 1); + // enable blobs processing - IDs generated by firebird 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; + 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); + + 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(); + 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(); + 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.printAllStates()); + + assertThat("Expected successful batch execution", execute.printAllStates(), 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.getRowDescriptor().getFieldDescriptor(0).getDatatypeCoder().decodeInt(fieldData)); + fieldData = fieldValues.getFieldData(1); + assertEquals(testVarchar, + statement.getRowDescriptor().getFieldDescriptor(1).getDatatypeCoder().decodeString(fieldData)); + fieldData = fieldValues.getFieldData(2); + assertEquals(testVarchar, + statement.getRowDescriptor().getFieldDescriptor(2).getDatatypeCoder().decodeString(fieldData)); + fieldData = fieldValues.getFieldData(3); + assertEquals(testVarchar, + statement.getRowDescriptor().getFieldDescriptor(3).getDatatypeCoder().decodeString(fieldData)); + fieldData = fieldValues.getFieldData(4); + assertEquals(testBigInteger, + statement.getRowDescriptor().getFieldDescriptor(4).getDatatypeCoder().decodeLong(fieldData)); + fieldData = fieldValues.getFieldData(5); + assertEquals(testInteger, + statement.getRowDescriptor().getFieldDescriptor(5).getDatatypeCoder().decodeInt(fieldData)); + fieldData = fieldValues.getFieldData(6); + assertEquals(testShort, + statement.getRowDescriptor().getFieldDescriptor(6).getDatatypeCoder().decodeShort(fieldData)); + fieldData = fieldValues.getFieldData(7); + assertEquals(testFloat, + statement.getRowDescriptor().getFieldDescriptor(7).getDatatypeCoder().decodeFloat(fieldData), + 0); + fieldData = fieldValues.getFieldData(8); + assertEquals(testDouble, + statement.getRowDescriptor().getFieldDescriptor(8).getDatatypeCoder().decodeDouble(fieldData), + 0); + fieldData = fieldValues.getFieldData(9); + 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.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.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.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.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.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.getRowDescriptor().getFieldDescriptor(15).getDatatypeCoder().decodeDateCalendar(fieldData, Calendar.getInstance())); + fieldData = fieldValues.getFieldData(16); + assertEquals(testTime, + statement.getRowDescriptor().getFieldDescriptor(16).getDatatypeCoder().decodeTimeCalendar(fieldData, Calendar.getInstance())); + fieldData = fieldValues.getFieldData(17); + assertEquals(testTimestamp, + statement.getRowDescriptor().getFieldDescriptor(17).getDatatypeCoder().decodeTimestampCalendar(fieldData, Calendar.getInstance())); + fieldData = fieldValues.getFieldData(18); + blobID = statement.getRowDescriptor().getFieldDescriptor(18).getDatatypeCoder().decodeLong(fieldData); + checkBlob(blobID, testBytes); + fieldData = fieldValues.getFieldData(19); + blobID = statement.getRowDescriptor().getFieldDescriptor(19).getDatatypeCoder().decodeLong(fieldData); + checkBlob(blobID, testBytes); + fieldData = fieldValues.getFieldData(20); + blobID = statement.getRowDescriptor().getFieldDescriptor(20).getDatatypeCoder().decodeLong(fieldData); + checkBlob(blobID, testBytes); + } + + @Test + public void testBatchWithBlobStream() throws Exception { + allocateTransaction(); + BatchParameterBuffer buffer = new BatchParameterBufferImp(); + // Blobs are placed in a 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); + h.setCurrentTransaction(batch.getTransaction()); + + FBBlob.Config config = FBBlob.createConfig(ISCConstants.BLOB_SUB_TYPE_BINARY, + db.getConnectionProperties(), db.getDatatypeCoder()); + + 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"; + String d2 = "22222222222222222222"; + String d3 = "333333333333333333333333333333333333333333333333333333333333333"; + + batch.appendBlobData(d1.getBytes(), b1.getBlobId()); + batch.appendBlobData(d2.getBytes(), b2.getBlobId()); + batch.appendBlobData(d3.getBytes(), b3.getBlobId()); + + batch.addBatch(); + + FbBatchCompletionState execute = batch.execute(); + + System.out.println(execute.printAllStates()); + + assertThat("Expected successful batch execution", execute.printAllStates(), 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.getRowDescriptor().getFieldDescriptor(0).getDatatypeCoder().decodeLong(fieldData); + checkBlob(blobID, d1.getBytes()); + fieldData = fieldValues.getFieldData(1); + blobID = statement.getRowDescriptor().getFieldDescriptor(1).getDatatypeCoder().decodeLong(fieldData); + checkBlob(blobID, d2.getBytes()); + fieldData = fieldValues.getFieldData(2); + blobID = statement.getRowDescriptor().getFieldDescriptor(2).getDatatypeCoder().decodeLong(fieldData); + checkBlob(blobID, d3.getBytes()); + } + + @Test + public void testBatchWithSegmentedBlobs() throws Exception { + allocateTransaction(); + BatchParameterBuffer buffer = new BatchParameterBufferImp(); + // Blobs are placed in a 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); + h.setCurrentTransaction(batch.getTransaction()); + + // Create blobs + 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; + String blobSegment2 = INSERT_QUERY_WITH_BLOBS; + String blobSegment3 = INSERT_QUERY_ONLY_BLOBS; + + BlobParameterBuffer bpb = new BlobParameterBufferImp(); + bpb.addArgument(BpbItems.isc_bpb_type, BpbItems.TypeValues.isc_bpb_type_segmented); + + 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, 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, bpb, b3); + 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.printAllStates()); + + assertThat("Expected successful batch execution", execute.printAllStates(), 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.getRowDescriptor().getFieldDescriptor(0).getDatatypeCoder().decodeLong(fieldData); + checkBlob(blobID, allSegments.getBytes()); + fieldData = fieldValues.getFieldData(1); + blobID = statement.getRowDescriptor().getFieldDescriptor(1).getDatatypeCoder().decodeLong(fieldData); + checkBlob(blobID, allSegments.getBytes()); + fieldData = fieldValues.getFieldData(2); + blobID = statement.getRowDescriptor().getFieldDescriptor(2).getDatatypeCoder().decodeLong(fieldData); + checkBlob(blobID, allSegments.getBytes()); + } + + @Test + public void testMultipleMessagesBatchWithSegmentedBlobs() throws Exception { + allocateTransaction(); + BatchParameterBuffer buffer = new BatchParameterBufferImp(); + // Blobs are placed in a 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); + h.setCurrentTransaction(batch.getTransaction()); + + // Create blobs + 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; + String blobSegment2 = INSERT_QUERY_WITH_BLOBS; + String blobSegment3 = INSERT_QUERY_ONLY_BLOBS; + + BlobParameterBuffer bpb = new BlobParameterBufferImp(); + bpb.addArgument(BpbItems.isc_bpb_type, BpbItems.TypeValues.isc_bpb_type_segmented); + + 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, 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, bpb, b3); + 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, null, config); + FBBlob b5 = new FBBlob(h, 3242, null, config); + FBBlob b6 = new FBBlob(h, 342, null, config); + + 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, 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, bpb, b6); + 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, null, config); + FBBlob b8 = new FBBlob(h, 1242, null, config); + FBBlob b9 = new FBBlob(h, 142, null, config); + + 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, 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, bpb, b9); + 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.printAllStates()); + + assertThat("Expected successful batch execution", execute.printAllStates(), 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.getRowDescriptor().getFieldDescriptor(0).getDatatypeCoder().decodeLong(fieldData); + checkBlob(blobID, allSegments.getBytes()); + fieldData = fieldValues.getFieldData(1); + blobID = statement.getRowDescriptor().getFieldDescriptor(1).getDatatypeCoder().decodeLong(fieldData); + checkBlob(blobID, allSegments.getBytes()); + fieldData = fieldValues.getFieldData(2); + blobID = statement.getRowDescriptor().getFieldDescriptor(2).getDatatypeCoder().decodeLong(fieldData); + checkBlob(blobID, allSegments.getBytes()); + } + + @Test + public void testBatchWithRegisteredBlobs() throws Exception { + allocateTransaction(); + BatchParameterBuffer buffer = new BatchParameterBufferImp(); + // Blobs are placed in a 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); + h.setCurrentTransaction(batch.getTransaction()); + + // Create blobs + final 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); + + FbBlob regBlob1 = h.createBlob(config); + FbBlob regBlob2 = h.createBlob(config); + FbBlob regBlob3 = h.createBlob(config); + + 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(); + + // Register blobs + batch.registerBlob(1, regBlob1.getBlobId(), b1); + batch.registerBlob(2, regBlob2.getBlobId(), b2); + batch.registerBlob(3, regBlob3.getBlobId(), b3); + + batch.addBatch(); + + FbBatchCompletionState execute = batch.execute(); + + System.out.println(execute.printAllStates()); + + assertThat("Expected successful batch execution", execute.printAllStates(), 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.getRowDescriptor().getFieldDescriptor(0).getDatatypeCoder().decodeLong(fieldData); + checkBlob(blobID, INSERT_QUERY_WITH_BLOBS.getBytes()); + fieldData = fieldValues.getFieldData(1); + blobID = statement.getRowDescriptor().getFieldDescriptor(1).getDatatypeCoder().decodeLong(fieldData); + checkBlob(blobID, INSERT_QUERY_WITHOUT_BLOBS.getBytes()); + fieldData = fieldValues.getFieldData(2); + blobID = statement.getRowDescriptor().getFieldDescriptor(2).getDatatypeCoder().decodeLong(fieldData); + checkBlob(blobID, INSERT_QUERY_ONLY_BLOBS.getBytes()); + } + + @Test + public void testBatchWithNulls() throws Exception { + allocateTransaction(); + 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; + + 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.getRowDescriptor().getFieldDescriptor(0).getDatatypeCoder().decodeInt(fieldData)); + for (int i = 1; i < statement.getRowDescriptor().getCount(); i++) { + fieldData = fieldValues.getFieldData(i); + assertEquals(null, fieldData); + } + } + + @Test + public void testBatchWithBlobNulls() throws Exception { + allocateTransaction(); + BatchParameterBuffer buffer = new BatchParameterBufferImp(); + buffer.addArgument(BatchItems.TAG_RECORD_COUNTS, 1); + 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; + + 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.getRowDescriptor().getFieldDescriptor(0).getDatatypeCoder().decodeInt(fieldData)); + for (int i = 1; i < statement.getRowDescriptor().getCount(); i++) { + fieldData = fieldValues.getFieldData(i); + assertEquals(null, fieldData); + } + } + + 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, blobID); + blob.open(); + ByteArrayOutputStream bos = new ByteArrayOutputStream(requiredSize); + while (!blob.isEof()) { + bos.write(blob.getSegment(blob.getMaximumSegmentSize())); + } + blob.close(); + byte[] result = bos.toByteArray(); + assertEquals(originalContent.length, result.length, "Unexpected length read from blob"); + assertTrue(validateBlobContent(result, originalContent, requiredSize), "Unexpected blob content"); + } + + /** + * 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 + */ + 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; + } + return true; + } +} diff --git a/src/nativeoo-test/org/firebirdsql/gds/ng/nativeoo/IBlobImplTest.java b/src/nativeoo-test/org/firebirdsql/gds/ng/nativeoo/IBlobImplTest.java new file mode 100755 index 0000000000..c051121a74 --- /dev/null +++ b/src/nativeoo-test/org/firebirdsql/gds/ng/nativeoo/IBlobImplTest.java @@ -0,0 +1,435 @@ +/* + * 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.ng.nativeoo; + +import org.firebirdsql.common.FBTestProperties; +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.firebirdsql.jaybird.fb.constants.BpbItems; +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; +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.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.gds.ng.nativeoo.IBlobImpl}. + *

+ * 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 6.0 + */ +class IBlobImplTest extends BaseTestBlob { + + @RegisterExtension + @Order(1) + public static final GdsTypeExtension testType = GdsTypeExtension.supportsFBOONativeOnly(); + + private final AbstractNativeOODatabaseFactory factory = + (AbstractNativeOODatabaseFactory) FBTestProperties.getFbDatabaseFactory(); + + /** + * Tests retrieval of a blob (what goes in is what comes out). + */ + @Test + 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, 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(requiredSize, result.length, "Unexpected length read from blob"); + assertTrue(validateBlobContent(result, baseContent, requiredSize), "Unexpected blob content"); + } finally { + if (transaction != null) transaction.commit(); + } + } + } + + /** + * Tests absolute seek on a segmented blob. Expectation: fails with an exception + */ + @Test + 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, blobId); + blob.open(); + int offset = baseContent.length / 2; + + 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))))); + } finally { + if (transaction != null) transaction.commit(); + } + } + } + + /** + * Tests absolute seek on a stream blob. + */ + @Test + 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, 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(100, segment.length, "Unexpected length read from blob"); + assertArrayEquals(expected, segment, "Unexpected segment content"); + } finally { + if (transaction != null) transaction.commit(); + } + } + } + + /** + * Tests reopen of input blob is allowed. + */ + @Test + 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, 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(requiredSize, result.length, "Unexpected length read from blob"); + assertTrue(validateBlobContent(result, baseContent, requiredSize), "Unexpected blob content"); + } finally { + if (transaction != null) transaction.commit(); + } + } + } + + /** + * Tests double open of input blob is not allowed. + */ + @Test + void testInputBlobDoubleOpen() 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, blobId); + blob.open(); + // Double 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(); + } + } + } + + /** + * Tests storage of a blob (what goes in is what comes out). + */ + @Test + 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(validateBlob(testId, baseContent, requiredSize), "Unexpected blob content"); + } + + /** + * Tests storage of a stream blob (what goes in is what comes out). + */ + @Test + 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(BpbItems.isc_bpb_type, BpbItems.TypeValues.isc_bpb_type_stream); + writeBlob(testId, testBytes, db, blobParameterBuffer); + } + + assertTrue(validateBlob(testId, baseContent, requiredSize), "Unexpected blob content"); + } + + /** + * Test if blob is not eof after open. + */ + @Test + void testOutputBlobIsEof_afterOpen() throws Exception { + try (IDatabaseImpl db = createDatabaseConnection()) { + final FbTransaction transaction = getTransaction(db); + try { + FbBlob blob = db.createBlobForOutput(transaction); + assumeTrue(blob.isEof(), "Output blob before open should be eof"); + + blob.open(); + assertFalse(blob.isEof(), "Output blob after open should not be eof"); + } finally { + transaction.commit(); + } + } + } + + /** + * Test if blob is eof after close. + */ + @Test + void testOutputBlobIsEof_afterClose() throws Exception { + try (IDatabaseImpl db = createDatabaseConnection()) { + final FbTransaction transaction = getTransaction(db); + try { + FbBlob blob = db.createBlobForOutput(transaction); + assumeTrue(blob.isEof(), "Output blob before open should be eof"); + blob.open(); + + blob.close(); + assertTrue(blob.isEof(), "Output blob after close should be eof"); + } finally { + transaction.commit(); + } + } + } + + /** + * Test if blob is eof after cancel. + */ + @Test + void testOutputBlobIsEof_afterCancel() throws Exception { + try (IDatabaseImpl db = createDatabaseConnection()) { + final FbTransaction transaction = getTransaction(db); + try { + FbBlob blob = db.createBlobForOutput(transaction); + assumeTrue(blob.isEof(), "Output blob before open should be eof"); + blob.open(); + + blob.cancel(); + assertTrue(blob.isEof(), "Output blob after cancel should be eof"); + } finally { + transaction.commit(); + } + } + } + + /** + * Test whether a cancelled blob cannot be used (indicating it was indeed cancelled). + */ + @Test + void testOutputBlobUsingCancelledBlob() throws Exception { + 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); + 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(); + 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(); + } + } + } + + /** + * Test reopen is not allowed. + */ + @Test + void testOutputBlobReopen() throws Exception { + 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); + 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 + 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(); + } + } + } + + /** + * Test double open is not allowed. + */ + @Test + void testOutputBlobDoubleOpen() throws Exception { + try (IDatabaseImpl db = createDatabaseConnection()) { + final FbTransaction transaction = getTransaction(db); + try { + final FbBlob blob = db.createBlobForOutput(transaction); + 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(); + } + } + } + + @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/gds/ng/nativeoo/IDatabaseImplTest.java b/src/nativeoo-test/org/firebirdsql/gds/ng/nativeoo/IDatabaseImplTest.java new file mode 100644 index 0000000000..789b6e3f3c --- /dev/null +++ b/src/nativeoo-test/org/firebirdsql/gds/ng/nativeoo/IDatabaseImplTest.java @@ -0,0 +1,275 @@ +package org.firebirdsql.gds.ng.nativeoo; + +import org.firebirdsql.common.FBTestProperties; +import org.firebirdsql.common.extension.GdsTypeExtension; +import org.firebirdsql.gds.ISCConstants; +import org.firebirdsql.gds.impl.GDSServerVersion; +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.jdbc.SQLStateConstants; +import org.firebirdsql.management.FBManager; +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.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.util.FirebirdSupportInfo.supportInfoFor; +import static org.hamcrest.CoreMatchers.*; +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.gds.ng.nativeoo.IDatabaseImpl}. + * + * @since 6.0 + */ +class IDatabaseImplTest { + + // TODO Assert in tests need to be checked (and more need to be added) + + @RegisterExtension + static final GdsTypeExtension testType = GdsTypeExtension.supportsFBOONativeOnly(); + + private final AbstractNativeOODatabaseFactory factory = + (AbstractNativeOODatabaseFactory) FBTestProperties.getFbDatabaseFactory(); + private final FbConnectionProperties connectionInfo = FBTestProperties.getDefaultFbConnectionProperties(); + + @Test + void testBasicAttach() throws Exception { + FBManager fbManager = createFBManager(); + defaultDatabaseSetUp(fbManager); + try (IDatabaseImpl db = factory.connect(connectionInfo)) { + db.attach(); + + 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 + void doubleAttach() throws Exception { + FBManager fbManager = createFBManager(); + defaultDatabaseSetUp(fbManager); + try (IDatabaseImpl db = factory.connect(connectionInfo)) { + 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 + void basicStatusProcessing_wrongLogin() throws Exception { + assumeThat("Embedded does not use authentication", + FBTestProperties.GDS_TYPE, not(isEmbeddedType())); + // set invalid password + connectionInfo.setPassword("abcd"); + 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)))); + } finally { + closeQuietly(db); + } + } + + @Test + void testBasicStatusProcessing_wrongDatabase() throws Exception { + // set invalid database + final String invalidDatabaseName = FBTestProperties.getDatabasePath() + "doesnotexist"; + connectionInfo.setDatabaseName(invalidDatabaseName); + 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)", + 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)) + )); + } finally { + closeQuietly(db); + } + } + + /** + * Tests creating and subsequently dropping a database + */ + @Test + void testBasicCreateAndDrop() throws Exception { + connectionInfo.setSqlDialect(3); + IDatabaseImpl db = factory.connect(connectionInfo); + File dbFile = new File(connectionInfo.getDatabaseName()); + try { + db.createDatabase(); + 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(db.isAttached(), "Database should be detached after drop"); + assertFalse(dbFile.exists(), "Expected database file to have been removed after drop"); + } finally { + closeQuietly(db); + if (dbFile.exists()) { + //noinspection ResultOfMethodCallIgnored + dbFile.delete(); + } + } + } + + @Test + void testDrop_NotAttached() throws Exception { + FBManager fbManager = createFBManager(); + defaultDatabaseSetUp(fbManager); + try { + 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 + 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 + assertThat(exception, allOf( + message(startsWith("The connection is not attached to a database")), + sqlStateEquals(SQLStateConstants.SQL_STATE_CONNECTION_ERROR))); + } + + @Test + void testBasicDetach() throws Exception { + FBManager fbManager = createFBManager(); + defaultDatabaseSetUp(fbManager); + try { + IDatabaseImpl db = factory.connect(connectionInfo); + try { + db.attach(); + + db.close(); + + assertFalse(db.isAttached(), "Expected database not attached"); + } finally { + closeQuietly(db); + } + } finally { + defaultDatabaseTearDown(fbManager); + } + } + + @Test + void testDetach_openTransactions() throws Exception { + FBManager fbManager = createFBManager(); + defaultDatabaseSetUp(fbManager); + + try { + IDatabaseImpl db = factory.connect(connectionInfo); + FbTransaction transaction = null; + try { + db.attach(); + // Starting an active transaction + transaction = getTransaction(db); + + SQLException exception = assertThrows(SQLException.class, db::close); + assertThat(exception, allOf( + errorCodeEquals(ISCConstants.isc_open_trans), + message(startsWith(getFbMessage(ISCConstants.isc_open_trans, "1"))))); + } finally { + if (transaction != null && transaction.getState() == TransactionState.ACTIVE) { + transaction.commit(); + } + closeQuietly(db); + } + } finally { + defaultDatabaseTearDown(fbManager); + } + } + + @Test + 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 = factory.connect(connectionInfo); + try { + db.attach(); + assumeTrue(db.isAttached(), "expected database attached"); + assumeTrue(supportInfoFor(db).supportsCancelOperation(), "Test requires cancel support"); + + db.cancelOperation(ISCConstants.fb_cancel_abort); + + assertFalse(db.isAttached(), "Expected database not attached after abort"); + } finally { + closeQuietly(db); + } + } finally { + defaultDatabaseTearDown(fbManager); + } + } + + @Test + 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(db.isAttached(), "Expected to be attached after create database"); + db.dropDatabase(); + } finally { + closeQuietly(db); + //noinspection ResultOfMethodCallIgnored + new File(getDatabasePath()).delete(); + } + } + + private FbTransaction getTransaction(FbDatabase db) throws SQLException { + return db.startTransaction(getDefaultTpb()); + } + +} diff --git a/src/nativeoo-test/org/firebirdsql/gds/ng/nativeoo/IEventBlockImplTest.java b/src/nativeoo-test/org/firebirdsql/gds/ng/nativeoo/IEventBlockImplTest.java new file mode 100644 index 0000000000..6220973c4a --- /dev/null +++ b/src/nativeoo-test/org/firebirdsql/gds/ng/nativeoo/IEventBlockImplTest.java @@ -0,0 +1,145 @@ +package org.firebirdsql.gds.ng.nativeoo; + +import org.firebirdsql.common.FBTestProperties; +import org.firebirdsql.common.extension.GdsTypeExtension; +import org.firebirdsql.common.extension.UsesDatabaseExtension; +import org.firebirdsql.gds.EventHandle; +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.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.getDefaultTpb; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +/** + * Tests for OO API events implementation. See {@link org.firebirdsql.gds.ng.nativeoo.IDatabaseImpl}. + * + * @since 6.0 + */ +class IEventBlockImplTest { + + private static final System.Logger log = System.getLogger(IEventBlockImplTest.class.getName()); + + @RegisterExtension + @Order(1) + static final GdsTypeExtension testType = GdsTypeExtension.supportsFBOONativeOnly(); + + //@formatter:off + private static final String TABLE_DEF = + "CREATE TABLE TEST (" + + " TESTVAL INTEGER NOT NULL" + + ")"; + + private 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 + + @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; + + @AfterEach + void tearDown() { + if (db != null && db.isAttached()) { + try { + db.close(); + } catch (SQLException ex) { + log.log(System.Logger.Level.DEBUG, "Exception on detach", ex); + } + } + } + + @Test + void testCreateEventHandle() throws Exception { + db = factory.connect(connectionInfo); + db.attach(); + + IEventImpl eventHandle = db.createEventHandle("TEST_EVENT", eventHandle1 -> { }); + + assertTrue(eventHandle.getSize() > 0, "Event handle should have a size set"); + } + + @Test + void testQueueEvent_andNotification() throws Exception { + db = factory.connect(connectionInfo); + db.attach(); + + 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(eventHandler.getReceivedEventHandles().isEmpty(), "Expected events to not have been triggered"); + + FbTransaction transaction = getTransaction(db); + FbStatement statement = db.createStatement(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(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); + + db.cancelEvent(eventHandleA); + db.cancelEvent(eventHandleB); + } + + private FbTransaction getTransaction(FbDatabase db) throws SQLException { + return db.startTransaction(getDefaultTpb()); + } +} diff --git a/src/nativeoo-test/org/firebirdsql/gds/ng/nativeoo/IServiceConnectionImplTest.java b/src/nativeoo-test/org/firebirdsql/gds/ng/nativeoo/IServiceConnectionImplTest.java new file mode 100644 index 0000000000..e808848c7a --- /dev/null +++ b/src/nativeoo-test/org/firebirdsql/gds/ng/nativeoo/IServiceConnectionImplTest.java @@ -0,0 +1,57 @@ +package org.firebirdsql.gds.ng.nativeoo; + +import org.firebirdsql.common.FBTestProperties; +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.jupiter.api.Test; +import org.junit.jupiter.api.extension.RegisterExtension; + +import static org.firebirdsql.common.FBTestProperties.getDefaultServiceProperties; +import static org.firebirdsql.common.JdbcResourceHelper.closeQuietly; +import static org.junit.jupiter.api.Assertions.*; + +/** + * Tests for OO API service connection implementation. + * See {@link org.firebirdsql.gds.ng.nativeoo.IServiceConnectionImpl}. + * + * @since 6.0 + */ +class IServiceConnectionImplTest { + + @RegisterExtension + static final GdsTypeExtension testType = GdsTypeExtension.supportsFBOONativeOnly(); + + private final AbstractNativeOODatabaseFactory factory = + (AbstractNativeOODatabaseFactory) FBTestProperties.getFbDatabaseFactory(); + private final FbServiceProperties connectionInfo = getDefaultServiceProperties(); + + @Test + void construct_clientLibraryNull_IllegalArgument() { + assertThrows(NullPointerException.class, () -> new IServiceConnectionImpl(null, connectionInfo)); + } + + @Test + void getClientLibrary_returnsSuppliedLibrary() throws Exception { + final FbClientLibrary clientLibrary = factory.getClientLibrary(); + IServiceConnectionImpl connection = new IServiceConnectionImpl(clientLibrary, connectionInfo); + + assertSame(clientLibrary, connection.getClientLibrary(), "Expected returned client library to be identical"); + } + + @Test + void identify_unconnected() throws Exception { + IServiceConnectionImpl connection = new IServiceConnectionImpl(factory.getClientLibrary(), connectionInfo); + + FbService db = connection.identify(); + 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/gds/ng/nativeoo/IServiceImplTest.java b/src/nativeoo-test/org/firebirdsql/gds/ng/nativeoo/IServiceImplTest.java new file mode 100644 index 0000000000..09c154dc6b --- /dev/null +++ b/src/nativeoo-test/org/firebirdsql/gds/ng/nativeoo/IServiceImplTest.java @@ -0,0 +1,159 @@ +package org.firebirdsql.gds.ng.nativeoo; + +import org.firebirdsql.common.FBTestProperties; +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.ng.FbServiceProperties; +import org.firebirdsql.jaybird.fb.constants.SpbItems; +import org.firebirdsql.management.FBManager; +import org.firebirdsql.management.FBStatisticsManager; +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.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.VaxEncoding.iscVaxInteger2; +import static org.hamcrest.CoreMatchers.*; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assumptions.assumeTrue; + +/** + * Tests for OO API service implementation. + * See {@link org.firebirdsql.gds.ng.nativeoo.IServiceImpl}. + * + * @since 6.0 + */ +class IServiceImplTest { + + @RegisterExtension + static final GdsTypeExtension testType = GdsTypeExtension.supportsFBOONativeOnly(); + + private AbstractNativeOODatabaseFactory factory = + (AbstractNativeOODatabaseFactory) FBTestProperties.getFbDatabaseFactory(); + + private final FbServiceProperties connectionInfo = getDefaultServiceProperties(); + + @Test + void testBasicAttach() throws Exception { + try (IServiceImpl service = factory.serviceConnect(connectionInfo)) { + service.attach(); + + 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 + void doubleAttach() throws Exception { + try (IServiceImpl service = factory.serviceConnect(connectionInfo)) { + service.attach(); + + //Second attach should throw exception + SQLException exception = assertThrows(SQLException.class, service::attach, + "Second attach should throw exception"); + assertThat(exception, message(equalTo("Already attached to a service"))); + } + } + + @Test + void basicStatusVectorProcessing_wrongLogin() throws Exception { + assumeThat("Embedded on windows does not use authentication", + FBTestProperties.GDS_TYPE, not(isEmbeddedType())); + // set invalid password + connectionInfo.setPassword("abcd"); + 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)))); + } finally { + closeQuietly(service); + } + } + + @Test + 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); + IServiceImpl service = factory.serviceConnect(connectionInfo); + try { + SQLException exception = assertThrows(SQLException.class, service::attach); + assertThat(exception, fbMessageStartsWith(ISCConstants.isc_service_att_err)); + } finally { + closeQuietly(service); + } + } + + /** + * Test for service action. + *

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

+ */ + @Test + void testStartServiceAction() throws Exception { + FBManager fbManager = createFBManager(); + defaultDatabaseSetUp(fbManager); + try (IServiceImpl service = factory.serviceConnect(connectionInfo)) { + service.attach(); + + ServiceRequestBuffer actionSrb = service.createServiceRequestBuffer(); + actionSrb.addArgument(isc_action_svc_db_stats); + actionSrb.addArgument(SpbItems.isc_spb_dbname, getDatabasePath()); + actionSrb.addArgument(SpbItems.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"), + containsString("*END*\n"))); + } finally { + defaultDatabaseTearDown(fbManager); + } + } +} diff --git a/src/nativeoo-test/org/firebirdsql/gds/ng/nativeoo/IStatementImplTest.java b/src/nativeoo-test/org/firebirdsql/gds/ng/nativeoo/IStatementImplTest.java new file mode 100644 index 0000000000..c64dc83748 --- /dev/null +++ b/src/nativeoo-test/org/firebirdsql/gds/ng/nativeoo/IStatementImplTest.java @@ -0,0 +1,247 @@ +/* + * 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.ng.nativeoo; + +import org.firebirdsql.common.FBTestProperties; +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.jupiter.api.Test; +import org.junit.jupiter.api.extension.RegisterExtension; + +import java.sql.SQLException; + +import static org.junit.jupiter.api.Assertions.*; + +/** + * Tests for OO API statement. + * {@link org.firebirdsql.gds.ng.nativeoo.IStatementImpl}. + * + * @since 6.0 + */ +class IStatementImplTest extends AbstractStatementTest { + + @RegisterExtension + static final GdsTypeExtension testType = GdsTypeExtension.supportsFBOONativeOnly(); + + private final AbstractNativeOODatabaseFactory factory = + (AbstractNativeOODatabaseFactory) FBTestProperties.getFbDatabaseFactory(); + + @Override + protected Class getExpectedDatabaseType() { + return IDatabaseImpl.class; + } + + @Override + protected FbDatabase createDatabase() throws SQLException { + return factory.connect(connectionInfo); + } + + @Test + @Override + 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(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"); + + // IStatement only executes a single fetch to prevent problems with positioned updates, + // so this doesn't get all rows fetched immediately + statement.fetchRows(10); + + 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(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 + 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(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"); + + // IStatement only executes a single fetch to prevent problems with positioned updates, + // so this doesn't get all rows fetched immediately + statement.fetchRows(10); + + 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(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(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"); + + // IStatement only executes a single fetch to prevent problems with positioned updates, + // so this doesn't get all rows fetched immediately + statement.fetchRows(10); + + 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(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 + 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(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"); + + // IStatement only executes a single fetch to prevent problems with positioned updates, + // so this doesn't get all rows fetched immediately + statement.fetchRows(10); + + 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(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(); + + 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(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"); + + // IStatement only executes a single fetch to prevent problems with positioned updates, + // so this doesn't get all rows fetched immediately + statement.fetchRows(10); + + 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(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 + 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(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"); + + // IStatement only executes a single fetch to prevent problems with positioned updates, + // so this doesn't get all rows fetched immediately + statement.fetchRows(100); + + 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.isAfterLast() != Boolean.TRUE && count < 100) { + statement.fetchRows(1); + count++; + } + + assertEquals(Boolean.TRUE, listener.isAfterLast(), "Expected afterLast to be set to true"); + // Number is database dependent (unicode_fss + all single byte character sets) + assertTrue(listener.getRows().size() > 2, "Expected more than two rows"); + + assertNull(listener.getSqlCounts(), "expected no SQL counts immediately after retrieving all rows"); + + statement.getSqlCounts(); + + assertNotNull(listener.getSqlCounts(), "Expected SQL counts"); + assertEquals(listener.getRows().size(), listener.getSqlCounts().getLongSelectCount(), "Unexpected select count"); + } +} diff --git a/src/nativeoo-test/org/firebirdsql/gds/ng/nativeoo/IStatementImplTimeoutTest.java b/src/nativeoo-test/org/firebirdsql/gds/ng/nativeoo/IStatementImplTimeoutTest.java new file mode 100644 index 0000000000..3817e41671 --- /dev/null +++ b/src/nativeoo-test/org/firebirdsql/gds/ng/nativeoo/IStatementImplTimeoutTest.java @@ -0,0 +1,35 @@ +package org.firebirdsql.gds.ng.nativeoo; + +import org.firebirdsql.common.FBTestProperties; +import org.firebirdsql.common.extension.GdsTypeExtension; +import org.firebirdsql.gds.ng.AbstractStatementTimeoutTest; +import org.firebirdsql.gds.ng.FbDatabase; +import org.junit.jupiter.api.Order; +import org.junit.jupiter.api.extension.RegisterExtension; + +import java.sql.SQLException; + +/** + * Tests for OO API statement timeouts. See {@link org.firebirdsql.gds.ng.nativeoo.IStatementImpl}. + * + * @since 6.0 + */ +class IStatementImplTimeoutTest extends AbstractStatementTimeoutTest { + + @RegisterExtension + @Order(1) + static final GdsTypeExtension testType = GdsTypeExtension.supportsFBOONativeOnly(); + + 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/gds/ng/nativeoo/ITransactionImplTest.java b/src/nativeoo-test/org/firebirdsql/gds/ng/nativeoo/ITransactionImplTest.java new file mode 100644 index 0000000000..7bd248b92e --- /dev/null +++ b/src/nativeoo-test/org/firebirdsql/gds/ng/nativeoo/ITransactionImplTest.java @@ -0,0 +1,35 @@ +package org.firebirdsql.gds.ng.nativeoo; + +import org.firebirdsql.common.FBTestProperties; +import org.firebirdsql.common.extension.GdsTypeExtension; +import org.firebirdsql.gds.ng.AbstractTransactionTest; +import org.firebirdsql.gds.ng.FbDatabase; +import org.junit.jupiter.api.Order; +import org.junit.jupiter.api.extension.RegisterExtension; + +import java.sql.SQLException; + +/** + * Tests for OO API transaction. See {@link org.firebirdsql.gds.ng.nativeoo.ITransactionImpl}. + * + * @since 6.0 + */ +class ITransactionImplTest extends AbstractTransactionTest { + + @RegisterExtension + @Order(1) + static final GdsTypeExtension testType = GdsTypeExtension.supportsFBOONativeOnly(); + + private final AbstractNativeOODatabaseFactory factory = + (AbstractNativeOODatabaseFactory) FBTestProperties.getFbDatabaseFactory(); + + @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/gds/ng/nativeoo/NativeDatabaseConnectionTest.java b/src/nativeoo-test/org/firebirdsql/gds/ng/nativeoo/NativeDatabaseConnectionTest.java new file mode 100644 index 0000000000..e7706ea1b6 --- /dev/null +++ b/src/nativeoo-test/org/firebirdsql/gds/ng/nativeoo/NativeDatabaseConnectionTest.java @@ -0,0 +1,57 @@ +package org.firebirdsql.gds.ng.nativeoo; + +import org.firebirdsql.common.FBTestProperties; +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.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.gds.ng.nativeoo.NativeDatabaseConnection}. + * + * @since 6.0 + */ +class NativeDatabaseConnectionTest { + + @RegisterExtension + static final GdsTypeExtension testType = GdsTypeExtension.supportsFBOONativeOnly(); + + private final AbstractNativeOODatabaseFactory factory = + (AbstractNativeOODatabaseFactory) FBTestProperties.getFbDatabaseFactory(); + + private final FbConnectionProperties connectionInfo = FBTestProperties.getDefaultFbConnectionProperties(); + + @Test + void construct_clientLibraryNull_IllegalArgument() throws Exception { + assertThrows(NullPointerException.class, () -> new NativeDatabaseConnection(null, connectionInfo)); + } + + @Test + void getClientLibrary_returnsSuppliedLibrary() throws Exception { + final FbClientLibrary clientLibrary = factory.getClientLibrary(); + NativeDatabaseConnection connection = new NativeDatabaseConnection(clientLibrary, connectionInfo); + + assertSame(clientLibrary, connection.getClientLibrary(), "Expected returned client library to be identical"); + } + + @Test + void identify_unconnected() throws Exception { + NativeDatabaseConnection connection = new NativeDatabaseConnection(factory.getClientLibrary(), connectionInfo); + + FbDatabase db = connection.identify(); + + 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/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 057d536d2f..e480a5ced8 100644 --- a/src/test/org/firebirdsql/common/FBTestProperties.java +++ b/src/test/org/firebirdsql/common/FBTestProperties.java @@ -113,7 +113,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); @@ -283,7 +283,8 @@ public static FirebirdConnection getConnectionViaDriverManager() throws SQLExcep public static void configureFBManager(FBManager fbManager) throws Exception { final GDSType gdsType = getGdsType(); if (gdsType == GDSType.getType("PURE_JAVA") - || gdsType == GDSType.getType("NATIVE")) { + || gdsType == GDSType.getType("NATIVE") + || gdsType == GDSType.getType("FBOONATIVE")) { fbManager.setServer(DB_SERVER_URL); fbManager.setPort(DB_SERVER_PORT); } diff --git a/src/test/org/firebirdsql/common/extension/GdsTypeExtension.java b/src/test/org/firebirdsql/common/extension/GdsTypeExtension.java index 71a4278532..7698c30189 100644 --- a/src/test/org/firebirdsql/common/extension/GdsTypeExtension.java +++ b/src/test/org/firebirdsql/common/extension/GdsTypeExtension.java @@ -20,6 +20,8 @@ import org.firebirdsql.common.FBTestProperties; import org.firebirdsql.gds.impl.jni.EmbeddedGDSFactoryPlugin; +import org.firebirdsql.gds.impl.jni.FbOOEmbeddedGDSFactoryPlugin; +import org.firebirdsql.gds.impl.jni.FbOONativeGDSFactoryPlugin; import org.firebirdsql.gds.impl.jni.NativeGDSFactoryPlugin; import org.hamcrest.Matcher; import org.junit.jupiter.api.extension.BeforeAllCallback; @@ -75,6 +77,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. * @@ -90,6 +102,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/common/matchers/GdsTypeMatchers.java b/src/test/org/firebirdsql/common/matchers/GdsTypeMatchers.java index fd4fef17f6..f1379a33b9 100644 --- a/src/test/org/firebirdsql/common/matchers/GdsTypeMatchers.java +++ b/src/test/org/firebirdsql/common/matchers/GdsTypeMatchers.java @@ -19,13 +19,14 @@ package org.firebirdsql.common.matchers; import org.firebirdsql.gds.impl.jni.EmbeddedGDSFactoryPlugin; +import org.firebirdsql.gds.impl.jni.FbOOEmbeddedGDSFactoryPlugin; +import org.firebirdsql.gds.impl.jni.FbOONativeGDSFactoryPlugin; import org.firebirdsql.gds.impl.jni.NativeGDSFactoryPlugin; import org.firebirdsql.gds.impl.wire.WireGDSFactoryPlugin; import org.hamcrest.Matcher; import java.util.List; -import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.in; import static org.hamcrest.Matchers.is; @@ -37,7 +38,10 @@ public class GdsTypeMatchers { private static final List PURE_JAVA_TYPES = List.of(WireGDSFactoryPlugin.PURE_JAVA_TYPE_NAME); - private static final List OTHER_NATIVE_TYPES = List.of(NativeGDSFactoryPlugin.NATIVE_TYPE_NAME); + private static final List EMBEDDED_TYPES = List.of(EmbeddedGDSFactoryPlugin.EMBEDDED_TYPE_NAME, + FbOOEmbeddedGDSFactoryPlugin.EMBEDDED_TYPE_NAME); + private static final List OTHER_NATIVE_TYPES = List.of(NativeGDSFactoryPlugin.NATIVE_TYPE_NAME, + FbOONativeGDSFactoryPlugin.NATIVE_TYPE_NAME); /** * @return Matcher for pure java types @@ -50,7 +54,7 @@ public static Matcher isPureJavaType() { * @return Matcher for embedded types */ public static Matcher isEmbeddedType() { - return equalTo(EmbeddedGDSFactoryPlugin.EMBEDDED_TYPE_NAME); + return is(in(EMBEDDED_TYPES)); } /** 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..7eb12f30bd --- /dev/null +++ b/src/test/org/firebirdsql/gds/impl/jni/SpecialFbOOEmbeddedServerUrlsTest.java @@ -0,0 +1,124 @@ +/* + * 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.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/ng/AbstractBatchTest.java b/src/test/org/firebirdsql/gds/ng/AbstractBatchTest.java new file mode 100644 index 0000000000..54359804c3 --- /dev/null +++ b/src/test/org/firebirdsql/gds/ng/AbstractBatchTest.java @@ -0,0 +1,249 @@ +package org.firebirdsql.gds.ng; + +import org.firebirdsql.common.DdlHelper; +import org.firebirdsql.common.FBTestProperties; +import org.firebirdsql.common.extension.UsesDatabaseExtension; +import org.firebirdsql.gds.BatchParameterBuffer; +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; +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.jupiter.api.Assertions.*; + +/** + * Generic tests for FbBatch. + *

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

+ * + * @author Vasiliy Yashkov + * @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 */ " + + ")"; + + 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 + + @RegisterExtension + final UsesDatabaseExtension.UsesDatabaseForEach usesDatabase = UsesDatabaseExtension.usesDatabase(); + + protected FbDatabase db; + protected Connection connection; + protected FbTransaction transaction; + protected PreparedStatement pstmt; + protected ParameterMetaData parameterMetaData; + protected FirebirdSupportInfo supportInfo; + protected FbMetadataBuilder metadataBuilder; + + protected final FbConnectionProperties connectionInfo = FBTestProperties.getDefaultFbConnectionProperties(); + + protected abstract Class getExpectedDatabaseType(); + + @BeforeEach + void setUp() throws Exception { + + 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 */", ", ?, ?"); + } + + DdlHelper.executeCreateTable(connection, CREATE_TABLE); + + pstmt = connection.prepareStatement(TEST_QUERY); + parameterMetaData = pstmt.getParameterMetaData(); + + db = createDatabase(); + 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()); + } + + 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 BatchParameterBufferImp(); + buffer.addArgument(BatchItems.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 BatchParameterBufferImp(); + buffer.addArgument(BatchItems.TAG_RECORD_COUNTS, 1); + FbBatch batch = db.createBatch(transaction, INSERT_QUERY, metadataBuilder.getMessageMetadata(), buffer); + } + + private FbTransaction getTransaction() throws SQLException { + return db.startTransaction(getDefaultTpb()); + } + + protected void allocateTransaction() throws SQLException { + if (transaction == null || transaction.getState() != TransactionState.ACTIVE) { + transaction = getTransaction(); + } + } + +} diff --git a/src/test/org/firebirdsql/jdbc/Dialect1SpecificsTest.java b/src/test/org/firebirdsql/jdbc/Dialect1SpecificsTest.java index ec74fc5723..4d66e0d7ec 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/jdbc/JDBCUrlPrefixTest.java b/src/test/org/firebirdsql/jdbc/JDBCUrlPrefixTest.java index e643dcc6c7..ee4eac4eba 100644 --- a/src/test/org/firebirdsql/jdbc/JDBCUrlPrefixTest.java +++ b/src/test/org/firebirdsql/jdbc/JDBCUrlPrefixTest.java @@ -21,6 +21,8 @@ import org.firebirdsql.common.FBTestProperties; import org.firebirdsql.common.extension.UsesDatabaseExtension; import org.firebirdsql.gds.impl.jni.EmbeddedGDSFactoryPlugin; +import org.firebirdsql.gds.impl.jni.FbOOEmbeddedGDSFactoryPlugin; +import org.firebirdsql.gds.impl.jni.FbOONativeGDSFactoryPlugin; import org.firebirdsql.gds.impl.jni.NativeGDSFactoryPlugin; import org.firebirdsql.gds.impl.wire.WireGDSFactoryPlugin; import org.firebirdsql.jaybird.xca.FBManagedConnectionFactory; @@ -61,8 +63,12 @@ static Stream parameters() { testCase("jdbc:firebird:java:", WireGDSFactoryPlugin.PURE_JAVA_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), // For backwards compatibility testCase("jdbc:firebird:local:", NativeGDSFactoryPlugin.NATIVE_TYPE_NAME), testCase("jdbc:firebird:local:", NativeGDSFactoryPlugin.NATIVE_TYPE_NAME)); diff --git a/src/test/org/firebirdsql/management/FBBackupManagerTest.java b/src/test/org/firebirdsql/management/FBBackupManagerTest.java index b3d5ff5e54..d5ed531c36 100644 --- a/src/test/org/firebirdsql/management/FBBackupManagerTest.java +++ b/src/test/org/firebirdsql/management/FBBackupManagerTest.java @@ -75,7 +75,8 @@ class FBBackupManagerTest { @BeforeEach void setUp() { backupManager = configureDefaultServiceProperties(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.setDatabase(getDatabasePath()); @@ -296,7 +297,8 @@ void testBackupReplace_customSecurityDb() throws Exception { FirebirdSupportInfo supportInfo = getDefaultSupportInfo(); assumeTrue(supportInfo.supportsCustomSecurityDb(), "Requires custom security DB support"); try (FBManager mgr = new FBManager(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")) { mgr.setServer(DB_SERVER_URL); mgr.setPort(DB_SERVER_PORT); }