mirror of
https://github.com/tursodatabase/limbo.git
synced 2025-08-04 10:08:20 +00:00
Add invokeFrom
field to NativeInvocation.java
This commit is contained in:
parent
33effdbfd4
commit
6967b62bc0
3 changed files with 5 additions and 3 deletions
|
@ -8,8 +8,10 @@ import java.lang.annotation.Target;
|
|||
|
||||
/**
|
||||
* Annotation to mark methods that are called by native functions.
|
||||
* For example, throwing exceptions or creating java objects.
|
||||
*/
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
@Target({ElementType.METHOD, ElementType.CONSTRUCTOR})
|
||||
public @interface NativeInvocation {
|
||||
String invokedFrom() default "";
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@ public abstract class LimboConnection implements Connection {
|
|||
if (sqlBytes == null) {
|
||||
throw new SQLException("Failed to convert " + sql + " into bytes");
|
||||
}
|
||||
return new LimboStatement(prepareUtf8(connectionPtr, sqlBytes));
|
||||
return new LimboStatement(sql, prepareUtf8(connectionPtr, sqlBytes));
|
||||
}
|
||||
|
||||
private native long prepareUtf8(long connectionPtr, byte[] sqlUtf8) throws SQLException;
|
||||
|
@ -133,7 +133,7 @@ public abstract class LimboConnection implements Connection {
|
|||
* @param errorCode Error code.
|
||||
* @param errorMessageBytes Error message.
|
||||
*/
|
||||
@NativeInvocation
|
||||
@NativeInvocation(invokedFrom = "limbo_connection.rs")
|
||||
private void throwLimboException(int errorCode, byte[] errorMessageBytes) throws SQLException {
|
||||
LimboExceptionUtils.throwLimboException(errorCode, errorMessageBytes);
|
||||
}
|
||||
|
|
|
@ -113,7 +113,7 @@ public final class LimboDB extends AbstractDB {
|
|||
* @param errorCode Error code.
|
||||
* @param errorMessageBytes Error message.
|
||||
*/
|
||||
@NativeInvocation
|
||||
@NativeInvocation(invokedFrom = "limbo_db.rs")
|
||||
private void throwLimboException(int errorCode, byte[] errorMessageBytes) throws SQLException {
|
||||
LimboExceptionUtils.throwLimboException(errorCode, errorMessageBytes);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue