Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Native OO API implementations #19

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
0be6537
Native OO API implementations
Oct 29, 2018
48a1188
Native OO interface fix
Dec 5, 2018
f117647
Merge branch 'master' into native_oo_batch
vasiliy-yashkov Jan 28, 2020
ceb90bb
Update native OO API implementation
vasiliy-yashkov Jan 30, 2020
15b0855
Merge remote-tracking branch 'origin/master' into native_oo_batch
vasiliy-yashkov Jul 27, 2020
c426c70
Add versioning support of native interfaces and update existing class…
vasiliy-yashkov Jul 28, 2020
e0d14ad
Merge remote-tracking branch 'origin/master' into native_oo_batch
vasiliy-yashkov Apr 14, 2022
7b1f4ac
Update native OO API implementations
vasiliy-yashkov Apr 15, 2022
826f698
Merge branch 'master' into native_oo_batch
vasiliy-yashkov Jul 25, 2022
d79b0a5
Update native OO API implementations
vasiliy-yashkov Jul 25, 2022
bf59522
Merge branch 'master' into native_oo_batch
vasiliy-yashkov Sep 5, 2022
f8f18e5
Add support for batch updates to the native OO API statement implemen…
vasiliy-yashkov Sep 5, 2022
5bb1b93
Merge remote-tracking branch 'origin/master' into native_oo_batch
vasiliy-yashkov Sep 12, 2022
a57ca08
Use `ReentrantLock` instead of synchronized object for native OO API …
vasiliy-yashkov Sep 12, 2022
c122329
Update implementation of native OO API
vasiliy-yashkov May 31, 2023
e874a6f
Merge commit '7c3652071766feba1c3e356a292632d1f4c1c1f9' into native_o…
vasiliy-yashkov Jun 5, 2023
b4e6ade
Use correct invalid descriptor field identifier for exception in case…
vasiliy-yashkov Jun 5, 2023
a6fdaba
Minor cleanup and comments
vasiliy-yashkov Jun 5, 2023
63cd757
Merge commit '7a493a89a79e058b171b8dde8e7e37aa0cd4d3d6' into native_o…
vasiliy-yashkov Jun 7, 2023
11ee8f0
Use `org.firebirdsql.jdbc.FirebirdBlob` as arguments when working wit…
vasiliy-yashkov Jun 7, 2023
0d55f0d
Do not check connection when cancel operation in case of forced abort
vasiliy-yashkov Jun 7, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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=*

Expand Down
Original file line number Diff line number Diff line change
@@ -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<String> 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<String> 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<String> 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();
}
}
Original file line number Diff line number Diff line change
@@ -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<String> 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<String> 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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down
Loading