-
-
Notifications
You must be signed in to change notification settings - Fork 23
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
base: master
Are you sure you want to change the base?
Changes from 1 commit
0be6537
48a1188
f117647
ceb90bb
15b0855
c426c70
e0d14ad
7b1f4ac
826f698
d79b0a5
bf59522
f8f18e5
5bb1b93
a57ca08
c122329
e874a6f
b4e6ade
a6fdaba
63cd757
11ee8f0
0d55f0d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,10 +18,7 @@ | |
*/ | ||
package org.firebirdsql.gds.ng.jna; | ||
|
||
import org.firebirdsql.gds.ng.FbDatabaseFactory; | ||
import org.firebirdsql.gds.ng.IAttachProperties; | ||
import org.firebirdsql.gds.ng.IConnectionProperties; | ||
import org.firebirdsql.gds.ng.IServiceProperties; | ||
import org.firebirdsql.gds.ng.*; | ||
import org.firebirdsql.jna.fbclient.FbClientLibrary; | ||
|
||
import java.sql.SQLException; | ||
|
@@ -35,14 +32,14 @@ | |
public abstract class AbstractNativeDatabaseFactory implements FbDatabaseFactory { | ||
|
||
@Override | ||
public JnaDatabase connect(IConnectionProperties connectionProperties) throws SQLException { | ||
public FbDatabase connect(IConnectionProperties connectionProperties) throws SQLException { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As discussed, revert back to covariant inheritance There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok. |
||
final JnaDatabaseConnection jnaDatabaseConnection = new JnaDatabaseConnection(getClientLibrary(), | ||
filterProperties(connectionProperties)); | ||
return jnaDatabaseConnection.identify(); | ||
} | ||
|
||
@Override | ||
public JnaService serviceConnect(IServiceProperties serviceProperties) throws SQLException { | ||
public FbService serviceConnect(IServiceProperties serviceProperties) throws SQLException { | ||
final JnaServiceConnection jnaServiceConnection = new JnaServiceConnection(getClientLibrary(), | ||
filterProperties(serviceProperties)); | ||
return jnaServiceConnection.identify(); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -471,6 +471,21 @@ public void cancelEvent(EventHandle eventHandle) throws SQLException { | |
} | ||
} | ||
|
||
@Override | ||
public FbBatch createBatch(FbTransaction transaction, String statement, FbMessageMetadata metadata, BatchParameterBuffer parameters) throws SQLException { | ||
throw new SQLException("Not implemented"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agree. |
||
} | ||
|
||
@Override | ||
public FbBatch createBatch(FbTransaction transaction, String statement, BatchParameterBuffer parameters) throws SQLException { | ||
throw new SQLException("Not implemented"); | ||
} | ||
|
||
@Override | ||
public FbMetadataBuilder getMetadataBuilder(int fieldCount) throws SQLException { | ||
throw new SQLException("Not implemented"); | ||
} | ||
|
||
private void processStatusVector() throws SQLException { | ||
processStatusVector(statusVector, getDatabaseWarningCallback()); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package org.firebirdsql.jna.fbclient; | ||
|
||
/** | ||
* @author <a href="mailto:[email protected]">Vasiliy Yashkov</a> | ||
* @since 4.0 | ||
*/ | ||
public class CryptoObjectInfo { | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <a href="http://jnaerator.googlecode.com/">JNAerator</a>,<br> | ||
* a tool written by <a href="http://ochafik.com/">Olivier Chafik</a> that <a href="http://code.google.com/p/jnaerator/wiki/CreditsAndLicense">uses a few opensource projects.</a>.<br> | ||
* For help, please visit <a href="http://nativelibs4java.googlecode.com/">NativeLibs4Java</a> , <a href="http://rococoa.dev.java.net/">Rococoa</a>, or <a href="http://jna.dev.java.net/">JNA</a>. | ||
* @since 4.0 | ||
*/ | ||
public class FB_DEC16 extends Structure { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this form compatible/usable with the form used within Jaybird? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not tested. |
||
|
||
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 { | ||
|
||
}; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <a href="http://jnaerator.googlecode.com/">JNAerator</a>,<br> | ||
* a tool written by <a href="http://ochafik.com/">Olivier Chafik</a> that <a href="http://code.google.com/p/jnaerator/wiki/CreditsAndLicense">uses a few opensource projects.</a>.<br> | ||
* For help, please visit <a href="http://nativelibs4java.googlecode.com/">NativeLibs4Java</a> , <a href="http://rococoa.dev.java.net/">Rococoa</a>, or <a href="http://jna.dev.java.net/">JNA</a>. | ||
* @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 { | ||
|
||
}; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package org.firebirdsql.jna.fbclient; | ||
|
||
import com.sun.jna.Structure; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
public class ISC_DATE extends Structure implements Structure.ByValue | ||
{ | ||
public int value; | ||
|
||
@Override | ||
protected List<String> getFieldOrder() | ||
{ | ||
return Arrays.asList("value"); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package org.firebirdsql.jna.fbclient; | ||
|
||
public class ISC_QUAD extends GDS_QUAD_t { | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package org.firebirdsql.jna.fbclient; | ||
|
||
import com.sun.jna.Structure; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
public class ISC_TIME extends Structure implements Structure.ByValue | ||
{ | ||
public int value; | ||
|
||
@Override | ||
protected List<String> getFieldOrder() | ||
{ | ||
return Arrays.asList("value"); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you remove the covariant inheritance here? This also introduces casts in TestJnaDatabase and TestJnaBlob (and other tests) that were previously unnecessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I forgot. It was a rough initial version, need to reverse it.