Add invokeFrom field to NativeInvocation.java

This commit is contained in:
김선우 2025-01-19 16:08:15 +09:00
parent 33effdbfd4
commit 6967b62bc0
3 changed files with 5 additions and 3 deletions

View file

@ -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 "";
}

View file

@ -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);
}

View file

@ -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);
}