mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-29 08:01:23 +03:00
Make the JNI-internal metrics opt-in rather than opt-out so client builds won't have them by default. Unrelated doc tweaks.
FossilOrigin-Name: aa72d25a22c80a7a376127266b8923f0661147c8bc483baa327230364851a255
This commit is contained in:
@ -420,8 +420,8 @@ struct S3JniHook{
|
||||
/* We lookup the jObj.xDestroy() method as-needed for contexts which
|
||||
** have custom finalizers. */
|
||||
jobject jExtra /* Global ref to a per-hook-type value */;
|
||||
int doXDestroy /* If true call jObj->xDestroy() when
|
||||
this object is S3JniHook_unref()'d. */;
|
||||
int doXDestroy /* If true then S3JniHook_unref() will call
|
||||
jObj->xDestroy() if it's available. */;
|
||||
S3JniHook * pNext /* Next entry in S3Global.hooks.aFree */;
|
||||
};
|
||||
/* For clean bitwise-copy init of local instances. */
|
||||
@ -543,10 +543,8 @@ struct S3JniUdf {
|
||||
S3JniUdf * pNext /* Next entry in SJG.udf.aFree. */;
|
||||
};
|
||||
|
||||
#if !defined(SQLITE_JNI_OMIT_METRICS) && !defined(SQLITE_JNI_ENABLE_METRICS)
|
||||
# ifdef SQLITE_DEBUG
|
||||
# define SQLITE_JNI_ENABLE_METRICS
|
||||
# endif
|
||||
#if defined(SQLITE_JNI_ENABLE_METRICS) && 0==SQLITE_JNI_ENABLE_METRICS
|
||||
# undef SQLITE_JNI_ENABLE_METRICS
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -1105,10 +1103,10 @@ static void s3jni__call_xDestroy(JNIEnv * const env, jobject jObj){
|
||||
|
||||
/*
|
||||
** Internal helper for many hook callback impls. Locks the S3JniDb
|
||||
** mutex, makes a copy of src into dest, with a some differences: (1) if
|
||||
** src->jObj or src->jExtra are not NULL then dest will be a new LOCAL
|
||||
** ref to it instead of a copy of the prior GLOBAL ref. (2) dest->doXDestroy
|
||||
** is always false.
|
||||
** mutex, makes a copy of src into dest, with a some differences: (1)
|
||||
** if src->jObj or src->jExtra are not NULL then dest will be a new
|
||||
** LOCAL ref to it instead of a copy of the prior GLOBAL ref. (2)
|
||||
** dest->doXDestroy is always false.
|
||||
**
|
||||
** If dest->jObj is not NULL when this returns then the caller is
|
||||
** obligated to eventually free the new ref by passing *dest to
|
||||
@ -1186,8 +1184,8 @@ static S3JniHook *S3JniHook__alloc(JNIEnv * const env){
|
||||
#define S3JniHook_alloc() S3JniHook__alloc(env)
|
||||
|
||||
/*
|
||||
** The rightful fate of all results from S3JniHook_alloc(). doXDestroy
|
||||
** is passed on as-is to S3JniHook_unref(). Locks the global mutex.
|
||||
** The rightful fate of all results from S3JniHook_alloc(). Locks the
|
||||
** global mutex.
|
||||
*/
|
||||
static void S3JniHook__free(JNIEnv * const env, S3JniHook * const p){
|
||||
if(p){
|
||||
@ -1637,7 +1635,7 @@ static int encodingTypeIsValid(int eTextRep){
|
||||
}
|
||||
|
||||
/* For use with sqlite3_result/value_pointer() */
|
||||
#define ResultJavaValuePtrStr "org.sqlite.jni.ResultJavaVal"
|
||||
static const char * const ResultJavaValuePtrStr = "org.sqlite.jni.ResultJavaVal";
|
||||
|
||||
/*
|
||||
** If v is not NULL, it must be a jobject global reference. Its
|
||||
@ -1804,7 +1802,9 @@ typedef struct {
|
||||
** Converts the given (cx, argc, argv) into arguments for the given
|
||||
** UDF, writing the result (Java wrappers for cx and argv) in the
|
||||
** final 2 arguments. Returns 0 on success, SQLITE_NOMEM on allocation
|
||||
** error. On error *jCx and *jArgv will be set to 0.
|
||||
** error. On error *jCx and *jArgv will be set to 0. The output
|
||||
** objects are of type org.sqlite.jni.sqlite3_context and
|
||||
** array-of-org.sqlite3.jni.sqlite3_value, respectively.
|
||||
*/
|
||||
static int udf_args(JNIEnv *env,
|
||||
sqlite3_context * const cx,
|
||||
@ -2831,8 +2831,10 @@ S3JniApi(sqlite3_context_db_handle(),jobject,1context_1db_1handle)(
|
||||
return ps ? ps->jDb : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
State for CollationCallbacks.
|
||||
/*
|
||||
** State for CollationCallbacks. This used to be its own separate
|
||||
** type, but has since been consolidated with S3JniHook. It retains
|
||||
** its own typedef for code legibility and searchability reasons.
|
||||
*/
|
||||
typedef S3JniHook S3JniCollationCallback;
|
||||
|
||||
@ -2915,7 +2917,8 @@ S3JniApi(sqlite3_create_collation() sqlite3_create_collation_v2(),
|
||||
return (jint)rc;
|
||||
}
|
||||
|
||||
S3JniApi(sqlite3_create_function() sqlite3_create_function_v2() sqlite3_create_window_function(),
|
||||
S3JniApi(sqlite3_create_function() sqlite3_create_function_v2()
|
||||
sqlite3_create_window_function(),
|
||||
jint,1create_1function
|
||||
)(JniArgsEnvClass, jobject jDb, jstring jFuncName, jint nArg,
|
||||
jint eTextRep, jobject jFunctor){
|
||||
|
@ -217,13 +217,19 @@ public final class SQLite3Jni {
|
||||
|
||||
/**
|
||||
Requires that paramName be a NUL-terminated UTF-8 string.
|
||||
|
||||
This overload is private because: (A) to keep users from
|
||||
inadvertently passing non-NUL-terminated byte arrays (an easy
|
||||
thing to do). (B) it is cheaper to NUL-terminate the
|
||||
String-to-byte-array conversion in the public-facing Java-side
|
||||
overload than to do that in C, so that signature is the
|
||||
public-facing one.
|
||||
*/
|
||||
@Canonical
|
||||
public static native int sqlite3_bind_parameter_index(
|
||||
@NotNull sqlite3_stmt stmt, byte[] paramName
|
||||
private static native int sqlite3_bind_parameter_index(
|
||||
@NotNull sqlite3_stmt stmt, @NotNull byte[] paramName
|
||||
);
|
||||
|
||||
@Canonical
|
||||
public static int sqlite3_bind_parameter_index(
|
||||
@NotNull sqlite3_stmt stmt, @NotNull String paramName
|
||||
){
|
||||
@ -316,9 +322,9 @@ public final class SQLite3Jni {
|
||||
);
|
||||
|
||||
/**
|
||||
As for the C-level function of the same name, with a BusyHandlerCallback
|
||||
instance in place of a callback function. Pass it a null handler
|
||||
to clear the busy handler.
|
||||
As for the C-level function of the same name, with a
|
||||
BusyHandlerCallback instance in place of a callback
|
||||
function. Pass it a null handler to clear the busy handler.
|
||||
*/
|
||||
@Canonical
|
||||
public static native int sqlite3_busy_handler(
|
||||
@ -420,6 +426,8 @@ public final class SQLite3Jni {
|
||||
stress that the returned bytes are encoded as UTF-8. It returns
|
||||
null if the underlying C-level sqlite3_column_text() returns NULL
|
||||
or on allocation error.
|
||||
|
||||
@see #sqlite3_column_text16(sqlite3_stmt,int)
|
||||
*/
|
||||
@Canonical
|
||||
public static native byte[] sqlite3_column_text(
|
||||
@ -480,7 +488,7 @@ public final class SQLite3Jni {
|
||||
|
||||
/**
|
||||
This functions like C's sqlite3_collation_needed16() because
|
||||
Java's string type is compatible with that interface.
|
||||
Java's string type is inherently compatible with that interface.
|
||||
*/
|
||||
@Canonical
|
||||
public static native int sqlite3_collation_needed(
|
||||
@ -1344,7 +1352,7 @@ public final class SQLite3Jni {
|
||||
|
||||
/**
|
||||
Internal impl of the public sqlite3_strglob() method. Neither
|
||||
argument may be NULL and both MUST be NUL-terminated UTF-8.
|
||||
argument may be null and both must be NUL-terminated UTF-8.
|
||||
|
||||
This overload is private because: (A) to keep users from
|
||||
inadvertently passing non-NUL-terminated byte arrays (an easy
|
||||
|
Reference in New Issue
Block a user