annotation/Canonical.java \
annotation/NotNull.java \
annotation/Nullable.java \
+ annotation/package-info.java \
+ AbstractCollationCallback.java \
AggregateFunction.java \
AuthorizerCallback.java \
AutoExtensionCallback.java \
doc.index := $(dir.doc)/index.html
$(doc.index): $(JAVA_FILES.main) $(MAKEFILE)
@if [ -d $(dir.doc) ]; then rm -fr $(dir.doc)/*; fi
- $(bin.javadoc) -cp $(classpath) -d $(dir.doc) -quiet org.sqlite.jni
+ $(bin.javadoc) -cp $(classpath) -d $(dir.doc) -quiet -subpackages org.sqlite.jni
@echo "javadoc output is in $@"
.PHONY: doc javadoc docserve
return p ? s3jni_new_jbyteArray(p, n) : NULL;
}
+S3JniApi(sqlite3_column_text(),jstring,1column_1text)(
+ JniArgsEnvClass, jobject jpStmt, jint ndx
+){
+ sqlite3_stmt * const stmt = PtrGet_sqlite3_stmt(jpStmt);
+ const int n = sqlite3_column_bytes(stmt, (int)ndx);
+ const unsigned char * const p = sqlite3_column_text(stmt, (int)ndx);
+ return p ? s3jni_utf8_to_jstring( (const char *)p, n) : 0;
+}
+
S3JniApi(sqlite3_column_text16(),jstring,1column_1text16)(
JniArgsEnvClass, jobject jpStmt, jint ndx
){
JNIEXPORT jbyteArray JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1column_1text_1utf8
(JNIEnv *, jclass, jobject, jint);
+/*
+ * Class: org_sqlite_jni_SQLite3Jni
+ * Method: sqlite3_column_text
+ * Signature: (Lorg/sqlite/jni/sqlite3_stmt;I)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1column_1text
+ (JNIEnv *, jclass, jobject, jint);
+
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_column_text16
--- /dev/null
+/*
+** 2023-08-25
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+*************************************************************************
+** This file is part of the JNI bindings for the sqlite3 C API.
+*/
+package org.sqlite.jni;
+import org.sqlite.jni.annotation.NotNull;
+
+/**
+ An implementation of {@link CollationCallback} which provides a
+ no-op xDestroy() method.
+*/
+public abstract class AbstractCollationCallback
+ implements CollationCallback, XDestroyCallback {
+ /**
+ Must compare the given byte arrays and return the result using
+ {@code memcmp()} semantics.
+ */
+ public abstract int call(@NotNull byte[] lhs, @NotNull byte[] rhs);
+
+ /**
+ Optionally override to be notified when the UDF is finalized by
+ SQLite. This implementation does nothing.
+ */
+ public void xDestroy(){}
+}
/**
- SQLFunction subclass for creating aggregate functions. Its T is
- the data type of its "accumulator" state, an instance of which is
+ A SQLFunction implementation for aggregate functions. Its T is the
+ data type of its "accumulator" state, an instance of which is
intended to be be managed using the getAggregateState() and
takeAggregateState() methods.
*/
-public abstract class AggregateFunction<T> extends SQLFunction {
+public abstract class AggregateFunction<T> implements SQLFunction {
/**
As for the xStep() argument of the C API's
/**
To be called from the implementation's xStep() method, as well
- as the xValue() and xInverse() methods of the Window<T>
+ as the xValue() and xInverse() methods of the {@link WindowFunction}
subclass, to fetch the current per-call UDF state. On the
first call to this method for any given sqlite3_context
argument, the context is set to the given initial value. On all other
import org.sqlite.jni.annotation.*;
/**
- Callback for use with sqlite3_set_authorizer().
+ Callback for use with {@link SQLite3Jni#sqlite3_set_authorizer}.
*/
public interface AuthorizerCallback extends SQLite3CallbackProxy {
/**
Must function as described for the C-level
sqlite3_set_authorizer() callback.
-
- Must not throw.
*/
int call(int opId, @Nullable String s1, @Nullable String s2,
@Nullable String s3, @Nullable String s4);
package org.sqlite.jni;
/**
- A callback for use with the sqlite3_auto_extension() family of
- APIs.
+ Callback for use with the {@link SQLite3Jni#sqlite3_auto_extension}
+ family of APIs.
*/
public interface AutoExtensionCallback extends SQLite3CallbackProxy {
/**
Must function as described for a C-level
- sqlite3_auto_extension() callback, with the caveat that the
- signature is shorter.
+ sqlite3_auto_extension() callback.
- This callback may throw and the exception's error message will
+ <p>This callback may throw and the exception's error message will
be set as the db's error string.
- Tips for implementations:
+ <p>Tips for implementations:
- - Opening a database from an auto-extension handler will lead to
+ <p>- Opening a database from an auto-extension handler will lead to
an endless recursion of the auto-handler triggering itself
indirectly for each newly-opened database.
- - If this routine is stateful, it may be useful to make the
+ <p>- If this routine is stateful, it may be useful to make the
overridden method synchronized.
- - Results are undefined if db is closed by an auto-extension.
+ <p>- Results are undefined if the given db is closed by an auto-extension.
*/
int call(sqlite3 db);
}
*/
package org.sqlite.jni;
-
/**
- Callback for use with sqlite3_busy_handler()
+ Callback for use with {@link SQLite3Jni#sqlite3_busy_handler}.
*/
-public abstract class BusyHandlerCallback implements SQLite3CallbackProxy {
+public interface BusyHandlerCallback extends SQLite3CallbackProxy {
/**
Must function as documented for the C-level
sqlite3_busy_handler() callback argument, minus the (void*)
argument the C-level function requires.
-
- Any exceptions thrown by this callback are suppressed in order to
- retain the C-style API semantics of the JNI bindings.
*/
- public abstract int call(int n);
+ int call(int n);
}
** This file is part of the JNI bindings for the sqlite3 C API.
*/
package org.sqlite.jni;
+import org.sqlite.jni.annotation.NotNull;
/**
- Callback for use with sqlite3_create_collation()
+ Callback for use with {@link SQLite3Jni#sqlite3_create_collation}.
+
+ @see AbstractCollationCallback
*/
-public abstract class CollationCallback
- implements SQLite3CallbackProxy, XDestroyCallback {
+public interface CollationCallback
+ extends SQLite3CallbackProxy, XDestroyCallback {
/**
- Must compare the given byte arrays using memcmp() semantics.
+ Must compare the given byte arrays and return the result using
+ {@code memcmp()} semantics.
*/
- public abstract int call(byte[] lhs, byte[] rhs);
+ int call(@NotNull byte[] lhs, @NotNull byte[] rhs);
/**
Called by SQLite when the collation is destroyed. If a collation
requires custom cleanup, override this method.
*/
- public void xDestroy(){}
+ void xDestroy();
}
package org.sqlite.jni;
/**
- Callback for use with sqlite3_collation_needed().
+ Callback for use with {@link SQLite3Jni#sqlite3_collation_needed}.
*/
public interface CollationNeededCallback extends SQLite3CallbackProxy {
/**
package org.sqlite.jni;
/**
- Callback for use with sqlite3_commit_hook()
+ Callback for use with {@link SQLite3Jni#sqlite3_commit_hook}.
*/
public interface CommitHookCallback extends SQLite3CallbackProxy {
/**
package org.sqlite.jni;
/**
- Callback for use with sqlite3_preupdate_hook().
+ Callback for use with {@link SQLite3Jni#sqlite3_preupdate_hook}.
*/
public interface PreupdateHookCallback extends SQLite3CallbackProxy {
/**
Must function as described for the C-level sqlite3_preupdate_hook()
- callback. Must not throw.
+ callback.
*/
void call(sqlite3 db, int op, String dbName, String dbTable,
long iKey1, long iKey2 );
package org.sqlite.jni;
/**
- Callback for use with sqlite3_progress_handler()
+ Callback for use with {@link SQLite3Jni#sqlite3_progress_handler}.
*/
public interface ProgressHandlerCallback extends SQLite3CallbackProxy {
/**
Works as documented for the C-level sqlite3_progress_handler() callback.
- If it throws, the exception message is passed on to the db and
+ <p>If it throws, the exception message is passed on to the db and
the exception is suppressed.
*/
int call();
package org.sqlite.jni;
/**
- Callback for use with sqlite3_rollback_hook()
+ Callback for use with {@link SQLite3Jni#sqlite3_rollback_hook}.
*/
public interface RollbackHookCallback extends SQLite3CallbackProxy {
/**
Works as documented for the C-level sqlite3_rollback_hook()
- callback. Must not throw.
+ callback.
*/
void call();
}
SQLFunction base class and the method names and signatures used by
the UDF callback interfaces.
*/
-public abstract class SQLFunction {
+public interface SQLFunction {
/**
PerContextState assists aggregate and window functions in
state, of a client-defined type (the T part of this class), which
persists across a "matching set" of the UDF's callbacks.
- <p>This class is a helper providing commonly-needed functionality -
- it is not required for use with aggregate or window functions.
+ <p>This class is a helper providing commonly-needed functionality
+ - it is not required for use with aggregate or window functions.
Client UDFs are free to perform such mappings using custom
- approaches. The provided Aggregate<T> and Window<T> classes
- use this.
+ approaches. The provided {@link AggregateFunction} and {@link
+ WindowFunction} classes use this.
*/
public static final class PerContextState<T> {
private final java.util.Map<Long,ValueHolder<T>> map
classes which have a call() method implementing some specific
callback interface on behalf of the C library.
+ <p>Unless very explicitely documented otherwise, callbacks must
+ never throw. Any which do throw but should not might trigger debug
+ output regarding the error, but the exception will not be
+ propagated. For callback interfaces which support returning error
+ info to the core, the JNI binding will convert any exceptions to
+ C-level error information. For callback interfaces which do not
+ support, all exceptions will necessarily be suppressed in order to
+ retain the C-style no-throw semantics.
+
<p>Callbacks of this style follow a common naming convention:
<p>1) They use the UpperCamelCase form of the C function they're
- proxying for, minus the sqlite3_ prefix, plus a Callback
- suffix. e.g. sqlite3_busy_handler()'s callback is named
- BusyHandlerCallback. Exceptions are made where that would
- potentially be ambiguous, e.g. ConfigSqllogCallback instead of
- config_callback because the sqlite3_config() interface may need to
- support more callback types in the future.
+ proxying for, minus the {@code sqlite3_} prefix, plus a {@code
+ Callback} suffix. e.g. {@code sqlite3_busy_handler()}'s callback is
+ named {@code BusyHandlerCallback}. Exceptions are made where that
+ would potentially be ambiguous, e.g. {@link ConfigSqllogCallback}
+ instead of {@code ConfigCallback} because the {@code
+ sqlite3_config()} interface may need to support more callback types
+ in the future.
- <p>2) They all have a call() method but its signature is
+ <p>2) They all have a {@code call()} method but its signature is
callback-specific.
*/
public interface SQLite3CallbackProxy {}
@NotNull sqlite3 db, int ms
);
+ @Canonical
public static native boolean sqlite3_cancel_auto_extension(
@NotNull AutoExtensionCallback ax
);
+ @Canonical
public static native int sqlite3_changes(
@NotNull sqlite3 db
);
+ @Canonical
public static native long sqlite3_changes64(
@NotNull sqlite3 db
);
+ @Canonical
public static native int sqlite3_clear_bindings(
@NotNull sqlite3_stmt stmt
);
+ @Canonical
public static native int sqlite3_close(
@Nullable sqlite3 db
);
+ @Canonical
public static native int sqlite3_close_v2(
@Nullable sqlite3 db
);
+ @Canonical
public static native byte[] sqlite3_column_blob(
@NotNull sqlite3_stmt stmt, int ndx
);
+ @Canonical
public static native int sqlite3_column_bytes(
@NotNull sqlite3_stmt stmt, int ndx
);
+ @Canonical
public static native int sqlite3_column_bytes16(
@NotNull sqlite3_stmt stmt, int ndx
);
+ @Canonical
public static native int sqlite3_column_count(
@NotNull sqlite3_stmt stmt
);
+ @Canonical
public static native double sqlite3_column_double(
@NotNull sqlite3_stmt stmt, int ndx
);
+ @Canonical
public static native int sqlite3_column_int(
@NotNull sqlite3_stmt stmt, int ndx
);
+ @Canonical
public static native long sqlite3_column_int64(
@NotNull sqlite3_stmt stmt, int ndx
);
+ @Canonical
public static native String sqlite3_column_name(
@NotNull sqlite3_stmt stmt, int ndx
);
+ @Canonical
public static native String sqlite3_column_database_name(
@NotNull sqlite3_stmt stmt, int ndx
);
+ @Canonical
public static native String sqlite3_column_origin_name(
@NotNull sqlite3_stmt stmt, int ndx
);
+ @Canonical
public static native String sqlite3_column_table_name(
@NotNull sqlite3_stmt stmt, int ndx
);
Returns the given column's contents as UTF-8-encoded (not MUTF-8)
text. Returns null if the C-level sqlite3_column_text() returns
NULL.
+
+ @see #sqlite3_column_text
*/
+ @Canonical(cname="sqlite3_column_text")
public static native byte[] sqlite3_column_text_utf8(
@NotNull sqlite3_stmt stmt, int ndx
);
- public static String sqlite3_column_text(
+ /**
+ Provides the same feature as the same-named C API but returns the
+ text in Java-native encoding rather than the C API's UTF-8.
+
+ @see #sqlite3_column_text16
+ */
+ public static native String sqlite3_column_text(
@NotNull sqlite3_stmt stmt, int ndx
- ){
- final byte[] ba = sqlite3_column_text_utf8(stmt, ndx);
- return ba==null ? null : new String(ba, StandardCharsets.UTF_8);
- }
+ );
+ @Canonical
public static native String sqlite3_column_text16(
@NotNull sqlite3_stmt stmt, int ndx
);
// return rv;
// }
+ @Canonical
public static native int sqlite3_column_type(
@NotNull sqlite3_stmt stmt, int ndx
);
+ @Canonical
public static native sqlite3_value sqlite3_column_value(
@NotNull sqlite3_stmt stmt, int ndx
);
This functions like C's sqlite3_collation_needed16() because
Java's string type is compatible with that interface.
*/
+ @Canonical
public static native int sqlite3_collation_needed(
@NotNull sqlite3 db, @Nullable CollationNeededCallback callback
);
+ @Canonical
public static native sqlite3 sqlite3_context_db_handle(
@NotNull sqlite3_context cx
);
+ @Canonical
public static native CommitHookCallback sqlite3_commit_hook(
@NotNull sqlite3 db, @Nullable CommitHookCallback hook
);
+ @Canonical
public static native String sqlite3_compileoption_get(
int n
);
+ @Canonical
public static native boolean sqlite3_compileoption_used(
@NotNull String optName
);
library APIs are being called.
*/
+ @Canonical(comment="Option subset: "+
+ "SQLITE_CONFIG_SINGLETHREAD, SQLITE_CONFIG_MULTITHREAD, "+
+ "SQLITE_CONFIG_SERIALIZED")
public static native int sqlite3_config(int op);
/**
library APIs are being called.
*/
+ @Canonical(comment="Option subset: SQLITE_CONFIG_SQLLOG")
public static native int sqlite3_config( @Nullable ConfigSqllogCallback logger );
+ @Canonical
public static native int sqlite3_create_collation(
@NotNull sqlite3 db, @NotNull String name, int eTextRep,
@NotNull CollationCallback col
SQLFunction's subclasses (ScalarFunction, AggregateFunction<T>,
and WindowFunction<T>) for details.
*/
+ @Canonical
public static native int sqlite3_create_function(
@NotNull sqlite3 db, @NotNull String functionName,
int nArg, int eTextRep, @NotNull SQLFunction func
);
+ @Canonical
public static native int sqlite3_data_count(
@NotNull sqlite3_stmt stmt
);
variadic arguments. Returns SQLITE_MISUSE if op is not one of the
SQLITE_DBCONFIG_... options which uses this call form.
*/
+ @Canonical
public static native int sqlite3_db_config(
@NotNull sqlite3 db, int op, int onOff, @Nullable OutputPointer.Int32 out
);
SQLITE_DBCONFIG_MAINDBNAME, but that set of options may be
extended in future versions.
*/
+ @Canonical(comment="Supports only a subset of options.")
public static native int sqlite3_db_config(
@NotNull sqlite3 db, int op, @NotNull String val
);
+ @Canonical
public static native String sqlite3_db_filename(
@NotNull sqlite3 db, @NotNull String dbName
);
+ @Canonical
public static native sqlite3 sqlite3_db_handle( @NotNull sqlite3_stmt stmt );
+ @Canonical
public static native int sqlite3_db_status(
@NotNull sqlite3 db, int op, @NotNull OutputPointer.Int32 pCurrent,
@NotNull OutputPointer.Int32 pHighwater, boolean reset
);
+ @Canonical
public static native int sqlite3_errcode(@NotNull sqlite3 db);
+ @Canonical
public static native String sqlite3_expanded_sql(@NotNull sqlite3_stmt stmt);
+ @Canonical
public static native int sqlite3_extended_errcode(@NotNull sqlite3 db);
+ @Canonical
public static native boolean sqlite3_extended_result_codes(
@NotNull sqlite3 db, boolean onoff
);
+ @Canonical
public static native String sqlite3_errmsg(@NotNull sqlite3 db);
+ @Canonical
public static native String sqlite3_errstr(int resultCode);
/**
Note that the returned byte offset values assume UTF-8-encoded
inputs, so won't always match character offsets in Java Strings.
*/
+ @Canonical
public static native int sqlite3_error_offset(@NotNull sqlite3 db);
+ @Canonical
public static native int sqlite3_finalize(@NotNull sqlite3_stmt stmt);
+ @Canonical
public static native int sqlite3_initialize();
+ @Canonical
public static native void sqlite3_interrupt(@NotNull sqlite3 db);
+ @Canonical
public static native boolean sqlite3_is_interrupted(@NotNull sqlite3 db);
+ @Canonical
public static native long sqlite3_last_insert_rowid(@NotNull sqlite3 db);
+ @Canonical
public static native String sqlite3_libversion();
+ @Canonical
public static native int sqlite3_libversion_number();
/**
object and it is up to the caller to sqlite3_close() that
db handle.
*/
+ @Canonical
public static native int sqlite3_open(
@Nullable String filename, @NotNull OutputPointer.sqlite3 ppDb
);
return out.take();
};
+ @Canonical
public static native int sqlite3_open_v2(
@Nullable String filename, @NotNull OutputPointer.sqlite3 ppDb,
int flags, @Nullable String zVfs
necessary, however, and overloads are provided which gloss over
that.
*/
+ @Canonical
private static native int sqlite3_prepare(
@NotNull sqlite3 db, @NotNull byte[] sqlUtf8, int maxBytes,
@NotNull OutputPointer.sqlite3_stmt outStmt,
See sqlite3_prepare() for details about the slight API differences
from the C API.
*/
+ @Canonical
private static native int sqlite3_prepare_v2(
@NotNull sqlite3 db, @NotNull byte[] sqlUtf8, int maxBytes,
@NotNull OutputPointer.sqlite3_stmt outStmt,
return out.take();
}
+ @Canonical
private static native int sqlite3_prepare_v3(
@NotNull sqlite3 db, @NotNull byte[] sqlUtf8, int maxBytes,
int prepFlags, @NotNull OutputPointer.sqlite3_stmt outStmt,
acts as a proxy for C's sqlite3_preupdate_blobwrite(), else it returns
SQLITE_MISUSE with no side effects.
*/
+ @Canonical
public static native int sqlite3_preupdate_blobwrite(@NotNull sqlite3 db);
/**
If the C API was built with SQLITE_ENABLE_PREUPDATE_HOOK defined, this
acts as a proxy for C's sqlite3_preupdate_count(), else it returns
SQLITE_MISUSE with no side effects.
*/
+ @Canonical
public static native int sqlite3_preupdate_count(@NotNull sqlite3 db);
/**
If the C API was built with SQLITE_ENABLE_PREUPDATE_HOOK defined, this
acts as a proxy for C's sqlite3_preupdate_depth(), else it returns
SQLITE_MISUSE with no side effects.
*/
+ @Canonical
public static native int sqlite3_preupdate_depth(@NotNull sqlite3 db);
/**
acts as a proxy for C's sqlite3_preupdate_hook(), else it returns null
with no side effects.
*/
+ @Canonical
public static native PreupdateHookCallback sqlite3_preupdate_hook(
@NotNull sqlite3 db, @Nullable PreupdateHookCallback hook
);
this acts as a proxy for C's sqlite3_preupdate_new(), else it
returns SQLITE_MISUSE with no side effects.
*/
+ @Canonical
public static native int sqlite3_preupdate_new(@NotNull sqlite3 db, int col,
@NotNull OutputPointer.sqlite3_value out);
this acts as a proxy for C's sqlite3_preupdate_old(), else it
returns SQLITE_MISUSE with no side effects.
*/
+ @Canonical
public static native int sqlite3_preupdate_old(@NotNull sqlite3 db, int col,
@NotNull OutputPointer.sqlite3_value out);
return out.take();
}
+ @Canonical
public static native void sqlite3_progress_handler(
@NotNull sqlite3 db, int n, @Nullable ProgressHandlerCallback h
);
+ @Canonical
public static native int sqlite3_reset(@NotNull sqlite3_stmt stmt);
/**
extensions are currently running. (The JNI-level list of
extensions cannot be manipulated while it is being traversed.)
*/
+ @Canonical
public static native void sqlite3_reset_auto_extension();
+ @Canonical
public static native void sqlite3_result_double(
@NotNull sqlite3_context cx, double v
);
results in the C-level sqlite3_result_error() being called with
a complaint about the invalid argument.
*/
+ @Canonical
private static native void sqlite3_result_error(
@NotNull sqlite3_context cx, @NotNull byte[] msg, int eTextRep
);
sqlite3_result_error(cx, e.getMessage());
}
+ @Canonical
public static native void sqlite3_result_error_toobig(
@NotNull sqlite3_context cx
);
+ @Canonical
public static native void sqlite3_result_error_nomem(
@NotNull sqlite3_context cx
);
+ @Canonical
public static native void sqlite3_result_error_code(
@NotNull sqlite3_context cx, int c
);
+ @Canonical
public static native void sqlite3_result_null(
@NotNull sqlite3_context cx
);
+ @Canonical
public static native void sqlite3_result_int(
@NotNull sqlite3_context cx, int v
);
+ @Canonical
public static native void sqlite3_result_int64(
@NotNull sqlite3_context cx, long v
);
sqlite3_result_text(cx, v);
}
+ @Canonical
public static native void sqlite3_result_value(
@NotNull sqlite3_context cx, @NotNull sqlite3_value v
);
+ @Canonical
public static native void sqlite3_result_zeroblob(
@NotNull sqlite3_context cx, int n
);
+ @Canonical
public static native int sqlite3_result_zeroblob64(
@NotNull sqlite3_context cx, long n
);
+ @Canonical
private static native void sqlite3_result_blob(
@NotNull sqlite3_context cx, @Nullable byte[] blob, int maxLen
);
If @param maxLen is larger than blob.length, it is truncated to
that value. If it is negative, results are undefined.
*/
+ @Canonical
private static native void sqlite3_result_blob64(
@NotNull sqlite3_context cx, @Nullable byte[] blob, long maxLen
);
sqlite3_result_blob64(cx, blob, (long)(null==blob ? 0 : blob.length));
}
+ @Canonical
private static native void sqlite3_result_text(
@NotNull sqlite3_context cx, @Nullable byte[] utf8, int maxLen
);
negative, results are undefined. If text is null, the subsequent
arguments are ignored.
*/
+ @Canonical
private static native void sqlite3_result_text64(
@NotNull sqlite3_context cx, @Nullable byte[] text,
long maxLength, int encoding
}
}
+ @Canonical
public static native RollbackHookCallback sqlite3_rollback_hook(
@NotNull sqlite3 db, @Nullable RollbackHookCallback hook
);
- //! Sets or unsets (if auth is null) the current authorizer.
+ @Canonical
public static native int sqlite3_set_authorizer(
@NotNull sqlite3 db, @Nullable AuthorizerCallback auth
);
+ @Canonical
public static native void sqlite3_set_last_insert_rowid(
@NotNull sqlite3 db, long rowid
);
to use those objects after this routine is called invoked
undefined behavior.
*/
+ @Canonical
public static synchronized native int sqlite3_shutdown();
+ @Canonical
public static native int sqlite3_sleep(int ms);
+ @Canonical
public static native String sqlite3_sourceid();
+ @Canonical
public static native String sqlite3_sql(@NotNull sqlite3_stmt stmt);
+ @Canonical
public static native int sqlite3_status(
int op, @NotNull OutputPointer.Int32 pCurrent,
@NotNull OutputPointer.Int32 pHighwater, boolean reset
);
+ @Canonical
public static native int sqlite3_status64(
int op, @NotNull OutputPointer.Int64 pCurrent,
@NotNull OutputPointer.Int64 pHighwater, boolean reset
);
+ @Canonical
public static native int sqlite3_step(@NotNull sqlite3_stmt stmt);
/**
Internal impl of the public sqlite3_strglob() method. Neither
argument may be NULL and both MUST be NUL-terminated UTF-8.
*/
+ @Canonical
private static native int sqlite3_strglob(
@NotNull byte[] glob, @NotNull byte[] txt
);
Internal impl of the public sqlite3_strlike() method. Neither
argument may be NULL and both MUST be NUL-terminated UTF-8.
*/
+ @Canonical
private static native int sqlite3_strlike(
@NotNull byte[] glob, @NotNull byte[] txt, int escChar
);
);
}
+ @Canonical
public static native int sqlite3_threadsafe();
+ @Canonical
public static native int sqlite3_total_changes(@NotNull sqlite3 db);
+ @Canonical
public static native long sqlite3_total_changes64(@NotNull sqlite3 db);
/**
implementation returns non-0 if initialization of the tracer
mapping state fails.
*/
+ @Canonical
public static native int sqlite3_trace_v2(
@NotNull sqlite3 db, int traceMask, @Nullable TraceV2Callback tracer
);
+ @Canonical
public static native UpdateHookCallback sqlite3_update_hook(
sqlite3 db, UpdateHookCallback hook
);
+ @Canonical
public static native byte[] sqlite3_value_blob(@NotNull sqlite3_value v);
+ @Canonical
public static native int sqlite3_value_bytes(@NotNull sqlite3_value v);
+ @Canonical
public static native int sqlite3_value_bytes16(@NotNull sqlite3_value v);
+ @Canonical
public static native double sqlite3_value_double(@NotNull sqlite3_value v);
+ @Canonical
public static native sqlite3_value sqlite3_value_dup(
@NotNull sqlite3_value v
);
+ @Canonical
public static native int sqlite3_value_encoding(@NotNull sqlite3_value v);
+ @Canonical
public static native void sqlite3_value_free(@Nullable sqlite3_value v);
+ @Canonical
public static native int sqlite3_value_int(@NotNull sqlite3_value v);
+ @Canonical
public static native long sqlite3_value_int64(@NotNull sqlite3_value v);
/**
Returns the given value as UTF-8-encoded bytes, or null if the
underlying C-level sqlite3_value_text() returns NULL.
*/
+ @Canonical(cname="sqlite3_value_text",
+ comment="Renamed because its String-returning overload would "+
+ "otherwise be ambiguous.")
public static native byte[] sqlite3_value_text_utf8(@NotNull sqlite3_value v);
+ /**
+ Provides the same feature as the same-named C API but returns the
+ text in Java-native encoding rather than the C API's UTF-8.
+
+ @see #sqlite3_value_text16
+ */
public static native String sqlite3_value_text(@NotNull sqlite3_value v);
/**
sqlite3_value_text() fetches UTF-8 (SQLite's default encoding)
and converts it to UTF-16 in Java.
*/
+ @Canonical
public static native String sqlite3_value_text16(@NotNull sqlite3_value v);
+ @Canonical
public static native int sqlite3_value_type(@NotNull sqlite3_value v);
+ @Canonical
public static native int sqlite3_value_numeric_type(@NotNull sqlite3_value v);
+ @Canonical
public static native int sqlite3_value_nochange(@NotNull sqlite3_value v);
+ @Canonical
public static native int sqlite3_value_frombind(@NotNull sqlite3_value v);
+ @Canonical
public static native int sqlite3_value_subtype(@NotNull sqlite3_value v);
/**
/**
- SQLFunction subclass for creating scalar functions.
+ A SQLFunction implementation for scalar functions.
*/
-public abstract class ScalarFunction extends SQLFunction {
+public abstract class ScalarFunction implements SQLFunction {
/**
As for the xFunc() argument of the C API's
sqlite3_create_function(). If this function throws, it is
/**
Optionally override to be notified when the UDF is finalized by
- SQLite.
+ SQLite. This implementation does nothing.
*/
public void xDestroy() {}
}
** This file is part of the JNI bindings for the sqlite3 C API.
*/
package org.sqlite.jni;
+import org.sqlite.jni.annotation.Nullable;
/**
- Callback proxy for use with sqlite3_trace_v2().
+ Callback for use with {@link SQLite3Jni#sqlite3_trace_v2}.
*/
public interface TraceV2Callback extends SQLite3CallbackProxy {
/**
argument to the native trace callback, as that role is better
filled by instance-local state.
- These callbacks may throw, in which case their exceptions are
+ <p>These callbacks may throw, in which case their exceptions are
converted to C-level error information.
<p>The 2nd argument to this function, if non-null, will be a an
<p>- SQLITE_TRACE_CLOSE: pNative is a sqlite3. pX is null.
*/
- int call(int traceFlag, Object pNative, Object pX);
+ int call(int traceFlag, Object pNative, @Nullable Object pX);
}
package org.sqlite.jni;
/**
- Callback for use with sqlite3_update_hook().
+ Callback for use with {@link SQLite3Jni#sqlite3_update_hook}.
*/
public interface UpdateHookCallback extends SQLite3CallbackProxy {
/**
Must function as described for the C-level sqlite3_update_hook()
- callback. Must not throw.
+ callback.
*/
void call(int opId, String dbName, String tableName, long rowId);
}
/**
- An SQLFunction subclass for creating window functions. Note that
- Window<T> inherits from Aggregate<T> and each instance is
- required to implement the inherited abstract methods from that
- class. See Aggregate<T> for information on managing the UDF's
- invocation-specific state.
+ A SQLFunction implementation for window functions. Note that
+ WindowFunction inherits from {@link AggregateFunction} and each
+ instance is required to implement the inherited abstract methods
+ from that class. See {@link AggregateFunction} for information on
+ managing the UDF's invocation-specific state.
*/
public abstract class WindowFunction<T> extends AggregateFunction<T> {
/**
This annotation is for marking functions as "canonical", meaning
- that they exist in the C API. The intent is to distinguish them
- from functions added specifically to the Java API.
+ that they map directly to a function in the core sqlite3 C API. The
+ intent is to distinguish them from functions added specifically to
+ the Java API.
<p>Canonical functions, unless specifically documented, have the
- same semantics as their counterparts in @{link
- https://sqlite.org/c3ref/intro.html the C API documentation}, despite
- their signatures perhaps differing.
+ same semantics as their counterparts in
+ <a href="https://sqlite.org/c3ref/intro.html">the C API documentation</a>,
+ despite their signatures perhaps differing. The Java API adds a
+ number of overloads to simplify use, as well as a few Java-specific
+ functions, and those are never flagged as @Canonical.
+
+ <p>In some cases, the canonical version of a function is private
+ and exposed to Java via public overloads.
+
+ <p>In rare cases, the Java interface for a canonical function has a
+ different name than its C counterpart. For such cases,
+ (cname=the-C-side-name) is passed to this annotation and a
+ Java-side implementation with a slightly different signature is
+ added to with the canonical name. As of this writing, that applies
+ only to {@link org.sqlite.jni.SQLite3Jni#sqlite3_value_text_utf8}
+ and {@link org.sqlite.jni.SQLite3Jni#sqlite3_column_text_utf8}.
+
+ <p>The comment property can be used to add a comment.
*/
@java.lang.annotation.Documented
@java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE)
@java.lang.annotation.Target(java.lang.annotation.ElementType.METHOD)
-public @interface Canonical{}
+public @interface Canonical{
+ /**
+ Java functions which directly map to a canonical function but
+ change its name for some reason should not the original name
+ in this property.
+ */
+ String cname() default ""/*doesn't allow null*/;
+ /**
+ Brief comments about the binding, e.g. noting any major
+ semantic differences.
+ */
+ String comment() default "";
+}
/**
This annotation is for flagging parameters which may not legally be
- null. Note that the C-style API does not throw any exceptions on
- its own because it has a no-throw policy in order to retain its
- C-style semantics, but it may trigger NullPointerExceptions (or
- similar) if passed a null for a parameter flagged with this
- annotation.
+ null. When used in the context of callback methods which are
+ called into from the C APIs, this annotation communicates that the
+ C API will never pass a null value to the callback.
+
+ <p>Note that the C-style API does not throw any exceptions on its
+ own because it has a no-throw policy in order to retain its C-style
+ semantics, but it may trigger NullPointerExceptions (or similar) if
+ passed a null for a parameter flagged with this annotation.
<p>This annotation is informational only. No policy is in place to
programmatically ensure that NotNull is conformed to in client
/**
This annotation is for flagging parameters which may legally be
null, noting that they may behave differently if passed null but
- are prepared to expect null as a value.
+ are prepared to expect null as a value. When used in the context of
+ callback methods which are called into from the C APIs, this
+ annotation communicates that the C API may pass a null value to the
+ callback.
<p>This annotation is solely for the use by the classes in this
package but is made public so that javadoc will link to it from the
--- /dev/null
+/**
+ This package houses annotations specific a JNI binding to the SQLite3 C API.
+*/
+package org.sqlite.jni.annotation;
/**
This class provides an application which aims to implement the
rudimentary SQL-driven test tool described in the accompanying
- test-script-interpreter.md.
+ {@code test-script-interpreter.md}.
- This is a work in progress.
+ <p>This is a work in progress.
- An instance of this application provides a core set of services
+ <p>An instance of this application provides a core set of services
which TestScript instances use for processing testing logic.
TestScripts, in turn, delegate the concrete test work to Command
objects, which the TestScript parses on their behalf.
-C Correct\sa\spackage\srenaming\sbug\sin\sthe\sprevious\scheck-in\sand\sstart\sapplying\sthe\s@Canonical\sannotation\sto\sfunctions\sto\sdistinguish\scanonical\sAPI\sfunctions\sand\sJava-specific\sAPIs.
-D 2023-08-28T05:48:34.397
+C Lots\sof\sjavadoc-related\stweaks.
+D 2023-08-28T07:28:36.868
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
F ext/icu/README.txt 7ab7ced8ae78e3a645b57e78570ff589d4c672b71370f5aa9e1cd7024f400fc9
F ext/icu/icu.c c074519b46baa484bb5396c7e01e051034da8884bad1a1cb7f09bbe6be3f0282
F ext/icu/sqliteicu.h fa373836ed5a1ee7478bdf8a1650689294e41d0c89c1daab26e9ae78a32075a8
-F ext/jni/GNUmakefile e582f0e36b80c9588d52f520bf07c37ddbd63199029a97de0925014e73127972
+F ext/jni/GNUmakefile 8bb7f82029eb7d6182f4af9c42f99abaf4cf476984f5aebd6dcf05d85da340c5
F ext/jni/README.md 1332b1fa27918bd5d9ca2d0d4f3ac3a6ab86b9e3699dc5bfe32904a027f3d2a9
F ext/jni/jar-dist.make 030aaa4ae71dd86e4ec5e7c1e6cd86f9dfa47c4592c070d2e35157e42498e1fa
-F ext/jni/src/c/sqlite3-jni.c 5d43a4a29d16f6a593091eb60371e166d56d0c019cb75a6b741bc41e3b946344
-F ext/jni/src/c/sqlite3-jni.h a43832a04347433e640f1b135f3a8b2a4293369a963659216c51d04daf934b43
-F ext/jni/src/org/sqlite/jni/AggregateFunction.java 0a5a74bea5ee12a99407e9432d0ca393525af912c2b0ca55c7ee5dbd019c00ef
-F ext/jni/src/org/sqlite/jni/AuthorizerCallback.java 91442d9871423d01cb1750d63ccf991b3dadcf0a4efaf1d5bc49696469aeae2f
-F ext/jni/src/org/sqlite/jni/AutoExtensionCallback.java 4290d8b0937b07d466b50e6ca4136cec037f3ce658277af0d0c2d371e5f4b459
-F ext/jni/src/org/sqlite/jni/BusyHandlerCallback.java efef1892e404f5780d81c46a7997cab874aff5db5131985dd3af319fc5e3adc7
-F ext/jni/src/org/sqlite/jni/CollationCallback.java 4391351e10f26ca61e9c461f969c12f36e0146e50a8c5b66ff549142bbf41f64
-F ext/jni/src/org/sqlite/jni/CollationNeededCallback.java b2adbe0cb41b67bcb638885e00950abe0265e885326a96451f6ab114fb11ef59
-F ext/jni/src/org/sqlite/jni/CommitHookCallback.java c2b4deec20acf9c72ab487ba1a408c54cb5cc12c45baa46490b555b80bd3579f
+F ext/jni/src/c/sqlite3-jni.c 064d3a14650221582a1d1621bd1109efb2a455f556387613cd583731eac28674
+F ext/jni/src/c/sqlite3-jni.h 12e1a5ef5ee1795dc22577c285b4518dfd8aa4af45757f6cb81a555d967bf201
+F ext/jni/src/org/sqlite/jni/AbstractCollationCallback.java 95e88ba04f4aac51ffec65693e878e234088b2f21b387f4e4285c8b72b33e436
+F ext/jni/src/org/sqlite/jni/AggregateFunction.java 7312486bc65fecdb91753c0a4515799194e031f45edbe16a6373cea18f404dc4
+F ext/jni/src/org/sqlite/jni/AuthorizerCallback.java d00a2409ab76cae168927e2ca6a7ffbd0621a42547cce88768b4eeebc13827e0
+F ext/jni/src/org/sqlite/jni/AutoExtensionCallback.java 1470e14d09f10729d35568506c6e61318edfb17aa322802e386764fa6d582f14
+F ext/jni/src/org/sqlite/jni/BusyHandlerCallback.java cd12c26dafd3e6c097fc73f80d328aebac0f58b985f66a96ee567ddf8d195f30
+F ext/jni/src/org/sqlite/jni/CollationCallback.java 7d5b246f1a7c9d6b8e974d970bbbb2d05c6264e65448d7be6a85edbf703c823d
+F ext/jni/src/org/sqlite/jni/CollationNeededCallback.java 1707b50146c6b805b79e84f89a57c8dbb0134e431799f041f0bec403eca5f841
+F ext/jni/src/org/sqlite/jni/CommitHookCallback.java e4de82c97560982e996e358958268e1e4e307b6115cd9aac0ff4f947d4380d90
F ext/jni/src/org/sqlite/jni/ConfigSqllogCallback.java e3656909eab7ed0f7e457c5b82df160ca22dd5e954c0a306ec1fca61b0d266b4
F ext/jni/src/org/sqlite/jni/Fts5.java 3ebfbd5b95fdb9d7bc40306f2e682abd12e247d9224e92510b8dd103b4f96fe8
F ext/jni/src/org/sqlite/jni/Fts5Context.java 0a5a02047a6a1dd3e4a38b0e542a8dd2de365033ba30e6ae019a676305959890
F ext/jni/src/org/sqlite/jni/Fts5Tokenizer.java 91489893596b6528c0df5cd7180bd5b55809c26e2b797fb321dfcdbc1298c060
F ext/jni/src/org/sqlite/jni/NativePointerHolder.java 564087036449a16df148dcf0a067408bd251170bf23286c655f46b5f973e8b2d
F ext/jni/src/org/sqlite/jni/OutputPointer.java 4ae06135decef35eb04498daa2868939d91a294e948747c580ef9ce31563a6b3
-F ext/jni/src/org/sqlite/jni/PreupdateHookCallback.java 8925c58797a90caeb4a7728a964227db3ba6f953cc89b8be38a5ae6fea063818
-F ext/jni/src/org/sqlite/jni/ProgressHandlerCallback.java 7c46660c6b07a765a3f053ae06a10d7ccb4966b49979143d605a3bfb4f14f806
+F ext/jni/src/org/sqlite/jni/PreupdateHookCallback.java 500c968b3893edbddf67e8eb773852c3a8ae58097a77bd22320ada6b1af06db1
+F ext/jni/src/org/sqlite/jni/ProgressHandlerCallback.java 0da841810319f5a9dc372d0f2348930d54fac1a4b53e4298884f44c720d67830
F ext/jni/src/org/sqlite/jni/ResultCode.java ba701f20213a5f259e94cfbfdd36eb7ac7ce7797f2c6c7fca2004ff12ce20f86
-F ext/jni/src/org/sqlite/jni/RollbackHookCallback.java be7f7a26d1102fb514d835e11198d51302af8053d97188bfb2e34c2133208568
-F ext/jni/src/org/sqlite/jni/SQLFunction.java d060f302b2cc4cf7a4f5a6b2d36458a2e6fc9648374b5d09c36a43665af41207
-F ext/jni/src/org/sqlite/jni/SQLite3CallbackProxy.java 13c4ea6f35871261eba63fa4117715515e0beecbdebfb879ec5b1f340ed36904
-F ext/jni/src/org/sqlite/jni/SQLite3Jni.java 953288346d99520bbc9ec94a28ec3a47262ef0c81fc7b11d82f8ba5143589518
-F ext/jni/src/org/sqlite/jni/ScalarFunction.java 21301a947e49f0dd9c682dfe2cc8a6518226c837253dd791cd512f847eeca52c
+F ext/jni/src/org/sqlite/jni/RollbackHookCallback.java 16042be9d072a26dbb2f1b1b63e7639989b747bb80d2bd667ba4f7555f56a825
+F ext/jni/src/org/sqlite/jni/SQLFunction.java 544a875d33fd160467d82e2397ac33157b29971d715a821a4fad3c899113ee8c
+F ext/jni/src/org/sqlite/jni/SQLite3CallbackProxy.java c2748ab52856075b053a55b317988d95dc7fb4d3d42520f8c33573effe1cd185
+F ext/jni/src/org/sqlite/jni/SQLite3Jni.java 54b39846ee0540f8d8fc700739cd6701ba1231e12c3964c1d367b51e9315ed3b
+F ext/jni/src/org/sqlite/jni/ScalarFunction.java 6d387bb499fbe3bc13c53315335233dbf6a0c711e8fa7c521683219b041c614c
F ext/jni/src/org/sqlite/jni/Tester1.java 8653c7b0b50116cf9bd8bf19b83b3e76896b75df09f5debe57a70c556d90203b
F ext/jni/src/org/sqlite/jni/TesterFts5.java 6f135c60e24c89e8eecb9fe61dde0f3bb2906de668ca6c9186bcf34bdaf94629
-F ext/jni/src/org/sqlite/jni/TraceV2Callback.java 25a45e800b0c57f506c237d111bcfd09da584e936fee395d4bd802100ebeff8c
-F ext/jni/src/org/sqlite/jni/UpdateHookCallback.java f5eadfa44462c050658230884b41477274f34306accd85c8201a7afbc00d2429
+F ext/jni/src/org/sqlite/jni/TraceV2Callback.java 641926b05a772c2c05c842a81aa839053ba4a13b78ef04b402f5705d060c6246
+F ext/jni/src/org/sqlite/jni/UpdateHookCallback.java be2bc96ff4f56b3c1fd18ae7dba9b207b25b6c123b8a5fd2f7aaf3cc208d8b7d
F ext/jni/src/org/sqlite/jni/ValueHolder.java f022873abaabf64f3dd71ab0d6037c6e71cece3b8819fa10bf26a5461dc973ee
-F ext/jni/src/org/sqlite/jni/WindowFunction.java 3e24a0f2615f9a232b1ecbb3f243b05dd7c007dc43be238499af93a459fe8253
+F ext/jni/src/org/sqlite/jni/WindowFunction.java 488980f4dbb6bdd7067d6cb9c43e4075475e51c54d9b74a5834422654b126246
F ext/jni/src/org/sqlite/jni/XDestroyCallback.java 95fb66353e62e4aca8d6ab60e8f14f9235bd10373c34db0a64f5f13f016f0471
-F ext/jni/src/org/sqlite/jni/annotation/Canonical.java 87e59ab0ee5e454bc8b6a6e659996b2141041dd46e71638b42baf3360a990126
-F ext/jni/src/org/sqlite/jni/annotation/NotNull.java 3a105502c56c0e4f1a826122db356be713cda975b3c17877d0805e45652f5937
-F ext/jni/src/org/sqlite/jni/annotation/Nullable.java 38a2cf9b780484ca7950b76445f65133463afba6d593fd8d4a381a5937135b1c
+F ext/jni/src/org/sqlite/jni/annotation/Canonical.java e55b82c8259b617ff754ac493fd8b79602631d659b87a858b987540e4c4fdf56
+F ext/jni/src/org/sqlite/jni/annotation/NotNull.java d48ebd7ae6bbb78bd47d54431c85e1521c89b1d3864a2b6eafd9c0e1b2341457
+F ext/jni/src/org/sqlite/jni/annotation/Nullable.java 6f962a98c9a5c6e9d21c50ae8716b16bdfdc934a191608cbb7e12ea588ddb6af
+F ext/jni/src/org/sqlite/jni/annotation/package-info.java f66bfb621c6494e67c03ed38a9e26a3bd6af99b9f9f6ef79556bcec30a025a22
F ext/jni/src/org/sqlite/jni/fts5_api.java ee47f1837d32968f7bb62278c7504c0fb572a68ec107371b714578312e9f734b
F ext/jni/src/org/sqlite/jni/fts5_extension_function.java ac825035d7d83fc7fd960347abfa6803e1614334a21533302041823ad5fc894c
F ext/jni/src/org/sqlite/jni/fts5_tokenizer.java a92c2e55bda492e4c76d48ddc73369bcc0d5e8727940840f9339e3292ea58fa7
F ext/jni/src/org/sqlite/jni/sqlite3_context.java 66ca95ce904044263a4aff684abe262d56f73e6b06bca6cf650761d79d7779ad
F ext/jni/src/org/sqlite/jni/sqlite3_stmt.java 78e6d1b95ac600a9475e9db4623f69449322b0c93d1bd4e1616e76ed547ed9fc
F ext/jni/src/org/sqlite/jni/sqlite3_value.java 3d1d4903e267bc0bc81d57d21f5e85978eff389a1a6ed46726dbe75f85e6914a
-F ext/jni/src/org/sqlite/jni/tester/SQLTester.java 439d28ac92570e4d16a5361423656f3eae6916c6d4777afde490f77dbb3ec1bc
+F ext/jni/src/org/sqlite/jni/tester/SQLTester.java bf350903abe04a9bed2d8a2a71692ed4291dbb4eece2d3329ed91d15b0321e6d
F ext/jni/src/org/sqlite/jni/tester/test-script-interpreter.md f9f25126127045d051e918fe59004a1485311c50a13edbf18c79a6ff9160030e
F ext/jni/src/tests/000-000-sanity.test cfe6dc1b950751d6096e3f5695becaadcdaa048bfe9567209d6eb676e693366d
F ext/jni/src/tests/000-001-ignored.test e17e874c6ab3c437f1293d88093cf06286083b65bf162317f91bbfd92f961b70
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P e4dedf90a92a069daef967dfe975469bf8ec7883c44c95e73345d4eded48e996
-R 2d3e956453c21ac2865e49e96e7183c2
+P 8a016006805b08b72bfc4093c795d8cd8d7fe72f8ae234c175a8b7be3a841cbf
+R 9e09f148c76497a018ec611f2deafbbd
U stephan
-Z 2de3d392080a8d73c4c451d28e259756
+Z cceffc0e8c2aa755651a9db7f05913c5
# Remove this line to create a well-formed Fossil manifest.
-8a016006805b08b72bfc4093c795d8cd8d7fe72f8ae234c175a8b7be3a841cbf
\ No newline at end of file
+cfe06f90e2c0231efded98767ef3cc646d3a7daa34d77b62b7c04b5aae9448fd
\ No newline at end of file