mirror of
https://github.com/aljazceru/turso.git
synced 2026-01-06 09:44:21 +01:00
Add invokeFrom field to NativeInvocation.java
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user