1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

Merge in and close jni-ptr-passing branch. The remaining pointer-passing adaptation can be done incrementally without affecting the interface.

FossilOrigin-Name: 7927c42410ba0d5fc8e6e08caaa5cbaaeb359869f17d1afaa082f1aa47fdb2fc
This commit is contained in:
stephan
2023-09-30 10:37:36 +00:00
19 changed files with 1328 additions and 826 deletions

View File

@ -811,13 +811,13 @@ static void s3jni_incr( volatile unsigned int * const p ){
#endif
/* Helpers for jstring and jbyteArray. */
static const char * s3jni__jstring_to_mutf8_bytes(JNIEnv * const env, jstring v ){
static const char * s3jni__jstring_to_mutf8(JNIEnv * const env, jstring v ){
const char *z = v ? (*env)->GetStringUTFChars(env, v, NULL) : 0;
s3jni_oom_check( v ? !!z : !z );
return z;
}
#define s3jni_jstring_to_mutf8(ARG) s3jni__jstring_to_mutf8_bytes(env, (ARG))
#define s3jni_jstring_to_mutf8(ARG) s3jni__jstring_to_mutf8(env, (ARG))
#define s3jni_mutf8_release(ARG,VAR) if( VAR ) (*env)->ReleaseStringUTFChars(env, ARG, VAR)
static jbyte * s3jni__jbyteArray_bytes(JNIEnv * const env, jbyteArray jBA ){
@ -1176,6 +1176,8 @@ static void S3JniHook__unref(JNIEnv * const env, S3JniHook * const s){
}
S3JniUnrefGlobal(s->jObj);
S3JniUnrefGlobal(s->jExtra);
}else{
assert( !s->jExtra );
}
*s = S3JniHook_empty;
}
@ -1183,8 +1185,8 @@ static void S3JniHook__unref(JNIEnv * const env, S3JniHook * const s){
/*
** Allocates one blank S3JniHook object from the recycling bin, if
** available, else from the heap. Returns NULL or dies on OOM. Locks
** the global mutex.
** available, else from the heap. Returns NULL or dies on OOM,
** depending on build options. Locks on SJG.hooks.mutex.
*/
static S3JniHook *S3JniHook__alloc(JNIEnv * const env){
S3JniHook * p = 0;
@ -1211,7 +1213,7 @@ static S3JniHook *S3JniHook__alloc(JNIEnv * const env){
/*
** The rightful fate of all results from S3JniHook_alloc(). Locks on
** SJG>hooks.mutex.
** SJG.hook.mutex.
*/
static void S3JniHook__free(JNIEnv * const env, S3JniHook * const p){
if(p){
@ -1290,10 +1292,11 @@ static void S3JniDb__set_aside(JNIEnv * const env, S3JniDb * const s){
/*
** Uncache any state for the given JNIEnv, clearing all Java
** references the cache owns. Returns true if env was cached and false
** if it was not found in the cache. Ownership of the given object is
** passed over to this function, which makes it free for re-use.
** if it was not found in the cache. Ownership of the S3JniEnv object
** associated with the given argument is transferred to this function,
** which makes it free for re-use.
**
** Requires that the Env mutex be locked.
** Requires that the env mutex be locked.
*/
static int S3JniEnv_uncache(JNIEnv * const env){
struct S3JniEnv * row;
@ -1307,7 +1310,7 @@ static int S3JniEnv_uncache(JNIEnv * const env){
}
}
if( !row ){
return 0;
return 0;
}
if( pPrev) pPrev->pNext = row->pNext;
else{
@ -1440,29 +1443,27 @@ static void * NativePointerHolder__get(JNIEnv * env, jobject jNph,
#define PtrGet_sqlite3_context(OBJ) PtrGet_T(sqlite3_context, OBJ)
#define PtrGet_sqlite3_stmt(OBJ) PtrGet_T(sqlite3_stmt, OBJ)
#define PtrGet_sqlite3_value(OBJ) PtrGet_T(sqlite3_value, OBJ)
#if 0
/*
** Enters the S3JniDb mutex and PtrGet_sqlite3()'s jObj. If that's
** NULL then it leaves the mutex, else the mutex is still entered
** when this returns and the caller is obligated to leave it.
** S3JniLongPtr_T(X,Y) expects X to be an unqualified sqlite3
** struct type name and Y to be a native pointer to such an object in
** the form of a jlong value. The jlong is simply cast to (X*). This
** approach is, as of 2023-09-27, supplanting the former approach. We
** now do the native pointer extraction in the Java side, rather than
** the C side, because it's reportedly significantly faster.
*/
static sqlite3* PtrGet__sqlite3_lock(JNIEnv * const env, jobject jObj){
sqlite3 *rv;
S3JniDb_mutex_enter;
rv = PtrGet_sqlite3(jObj);
if( !rv ){ S3JniDb_mutex_leave; }
return rv;
}
#undef PtrGet_sqlite3
#define PtrGet_sqlite3(JOBJ) PtrGet__sqlite3_lock(env, (JOBJ))
#endif
#define S3JniLongPtr_T(T,JLongPtr) (T*)(JLongPtr)
#define S3JniLongPtr_sqlite3(JLongPtr) S3JniLongPtr_T(sqlite3,JLongPtr)
#define S3JniLongPtr_sqlite3_backup(JLongPtr) S3JniLongPtr_T(sqlite3_backup,JLongPtr)
#define S3JniLongPtr_sqlite3_blob(JLongPtr) S3JniLongPtr_T(sqlite3_blob,JLongPtr)
#define S3JniLongPtr_sqlite3_stmt(JLongPtr) S3JniLongPtr_T(sqlite3_stmt,JLongPtr)
#define S3JniLongPtr_sqlite3_value(JLongPtr) S3JniLongPtr_T(sqlite3_value,JLongPtr)
/*
** Extracts the new S3JniDb instance from the free-list, or allocates
** one if needed, associats it with pDb, and returns. Returns NULL on
** OOM. pDb MUST, on success of the calling operation, subsequently be
** associated with jDb via NativePointerHolder_set().
** one if needed, associates it with pDb, and returns. Returns NULL
** on OOM. The returned object MUST, on success of the calling
** operation, subsequently be associated with jDb via
** NativePointerHolder_set() or freed using S3JniDb_set_aside().
*/
static S3JniDb * S3JniDb_alloc(JNIEnv * const env, jobject jDb){
S3JniDb * rv = 0;
@ -1475,7 +1476,7 @@ static S3JniDb * S3JniDb_alloc(JNIEnv * const env, jobject jDb){
}
S3JniDb_mutex_leave;
if( 0==rv ){
rv = s3jni_malloc( sizeof(S3JniDb));
rv = s3jni_malloc(sizeof(S3JniDb));
if( rv ){
s3jni_incr( &SJG.metrics.nPdbAlloc );
}
@ -1514,6 +1515,8 @@ static void S3JniDb_xDestroy(void *p){
*/
#define S3JniDb_from_c(sqlite3Ptr) \
((sqlite3Ptr) ? S3JniDb_from_clientdata(sqlite3Ptr) : 0)
#define S3JniDb_from_jlong(sqlite3PtrAsLong) \
S3JniDb_from_c(S3JniLongPtr_T(sqlite3,sqlite3PtrAsLong))
/*
** Unref any Java-side state in (S3JniAutoExtension*) AX and zero out
@ -1992,51 +1995,48 @@ static void udf_xInverse(sqlite3_context* cx, int argc,
return rv; \
}
/** Create a trivial JNI wrapper for (int CName(sqlite3_stmt*)). */
#define WRAP_INT_STMT(JniNameSuffix,CName) \
JniDecl(jint,JniNameSuffix)(JniArgsEnvClass, jobject jpStmt){ \
jint const rc = (jint)CName(PtrGet_sqlite3_stmt(jpStmt)); \
S3JniExceptionIgnore /* squelch -Xcheck:jni */; \
return rc; \
#define WRAP_INT_STMT(JniNameSuffix,CName) \
JniDecl(jint,JniNameSuffix)(JniArgsEnvClass, jlong jpStmt){ \
return (jint)CName(S3JniLongPtr_sqlite3_stmt(jpStmt)); \
}
/** Create a trivial JNI wrapper for (int CName(sqlite3_stmt*,int)). */
#define WRAP_INT_STMT_INT(JniNameSuffix,CName) \
JniDecl(jint,JniNameSuffix)(JniArgsEnvClass, jobject pStmt, jint n){ \
return (jint)CName(PtrGet_sqlite3_stmt(pStmt), (int)n); \
JniDecl(jint,JniNameSuffix)(JniArgsEnvClass, jlong jpStmt, jint n){ \
return (jint)CName(S3JniLongPtr_sqlite3_stmt(jpStmt), (int)n); \
}
/** Create a trivial JNI wrapper for (boolish-int CName(sqlite3_stmt*)). */
#define WRAP_BOOL_STMT(JniNameSuffix,CName) \
JniDecl(jboolean,JniNameSuffix)(JniArgsEnvClass, jobject pStmt){ \
return CName(PtrGet_sqlite3_stmt(pStmt)) ? JNI_TRUE : JNI_FALSE; \
JniDecl(jboolean,JniNameSuffix)(JniArgsEnvClass, jlong jpStmt){ \
return CName(S3JniLongPtr_sqlite3_stmt(jpStmt)) ? JNI_TRUE : JNI_FALSE; \
}
/** Create a trivial JNI wrapper for (jstring CName(sqlite3_stmt*,int)). */
#define WRAP_STR_STMT_INT(JniNameSuffix,CName) \
JniDecl(jstring,JniNameSuffix)(JniArgsEnvClass, jobject pStmt, jint ndx){ \
#define WRAP_STR_STMT_INT(JniNameSuffix,CName) \
JniDecl(jstring,JniNameSuffix)(JniArgsEnvClass, jlong jpStmt, jint ndx){ \
return s3jni_utf8_to_jstring( \
CName(PtrGet_sqlite3_stmt(pStmt), (int)ndx), \
-1); \
}
/** Create a trivial JNI wrapper for (int CName(sqlite3*)). */
#define WRAP_INT_DB(JniNameSuffix,CName) \
JniDecl(jint,JniNameSuffix)(JniArgsEnvClass, jobject pDb){ \
return (jint)CName(PtrGet_sqlite3(pDb)); \
CName(S3JniLongPtr_sqlite3_stmt(jpStmt), (int)ndx), \
-1); \
}
/** Create a trivial JNI wrapper for (boolean CName(sqlite3*)). */
#define WRAP_BOOL_DB(JniNameSuffix,CName) \
JniDecl(jboolean,JniNameSuffix)(JniArgsEnvClass, jobject pDb){ \
return CName(PtrGet_sqlite3(pDb)) ? JNI_TRUE : JNI_FALSE; \
#define WRAP_BOOL_DB(JniNameSuffix,CName) \
JniDecl(jboolean,JniNameSuffix)(JniArgsEnvClass, jlong jpDb){ \
return CName(S3JniLongPtr_sqlite3(jpDb)) ? JNI_TRUE : JNI_FALSE; \
}
/** Create a trivial JNI wrapper for (int CName(sqlite3*)). */
#define WRAP_INT_DB(JniNameSuffix,CName) \
JniDecl(jint,JniNameSuffix)(JniArgsEnvClass, jlong jpDb){ \
return (jint)CName(S3JniLongPtr_sqlite3(jpDb)); \
}
/** Create a trivial JNI wrapper for (int64 CName(sqlite3*)). */
#define WRAP_INT64_DB(JniNameSuffix,CName) \
JniDecl(jlong,JniNameSuffix)(JniArgsEnvClass, jobject pDb){ \
return (jlong)CName(PtrGet_sqlite3(pDb)); \
#define WRAP_INT64_DB(JniNameSuffix,CName) \
JniDecl(jlong,JniNameSuffix)(JniArgsEnvClass, jlong jpDb){ \
return (jlong)CName(S3JniLongPtr_sqlite3(jpDb)); \
}
/** Create a trivial JNI wrapper for (int CName(sqlite3_value*)). */
#define WRAP_INT_SVALUE(JniNameSuffix,CName) \
JniDecl(jint,JniNameSuffix)(JniArgsEnvClass, jobject jpSValue){ \
return (jint)CName(PtrGet_sqlite3_value(jpSValue)); \
JniDecl(jint,JniNameSuffix)(JniArgsEnvClass, jlong jpSValue){ \
return (jint)CName(S3JniLongPtr_sqlite3_value(jpSValue)); \
}
WRAP_INT_STMT(1bind_1parameter_1count, sqlite3_bind_parameter_count)
WRAP_INT_DB(1changes, sqlite3_changes)
WRAP_INT64_DB(1changes64, sqlite3_changes64)
WRAP_INT_STMT(1clear_1bindings, sqlite3_clear_bindings)
@ -2236,19 +2236,21 @@ S3JniApi(sqlite3_auto_extension(),jint,1auto_1extension)(
}
S3JniApi(sqlite3_backup_finish(),jint,1backup_1finish)(
JniArgsEnvClass, jobject jBack
JniArgsEnvClass, jlong jpBack
){
sqlite3_backup * const pB = PtrGet_sqlite3_backup(jBack);
NativePointerHolder_set(S3JniNph(sqlite3_backup), jBack, 0);
return sqlite3_backup_finish(pB);
int rc = 0;
if( jpBack!=0 ){
rc = sqlite3_backup_finish( S3JniLongPtr_sqlite3_backup(jpBack) );
}
return rc;
}
S3JniApi(sqlite3_backup_init(),jobject,1backup_1init)(
JniArgsEnvClass, jobject jDbDest, jstring jTDest,
jobject jDbSrc, jstring jTSrc
JniArgsEnvClass, jlong jpDbDest, jstring jTDest,
jlong jpDbSrc, jstring jTSrc
){
sqlite3 * const pDest = PtrGet_sqlite3(jDbDest);
sqlite3 * const pSrc = PtrGet_sqlite3(jDbSrc);
sqlite3 * const pDest = S3JniLongPtr_sqlite3(jpDbDest);
sqlite3 * const pSrc = S3JniLongPtr_sqlite3(jpDbSrc);
char * const zDest = s3jni_jstring_to_utf8(jTDest, 0);
char * const zSrc = s3jni_jstring_to_utf8(jTSrc, 0);
jobject rv = 0;
@ -2269,66 +2271,67 @@ S3JniApi(sqlite3_backup_init(),jobject,1backup_1init)(
}
S3JniApi(sqlite3_backup_pagecount(),jint,1backup_1pagecount)(
JniArgsEnvClass, jobject jBack
JniArgsEnvClass, jlong jpBack
){
return sqlite3_backup_pagecount(PtrGet_sqlite3_backup(jBack));
return sqlite3_backup_pagecount(S3JniLongPtr_sqlite3_backup(jpBack));
}
S3JniApi(sqlite3_backup_remaining(),jint,1backup_1remaining)(
JniArgsEnvClass, jobject jBack
JniArgsEnvClass, jlong jpBack
){
return sqlite3_backup_remaining(PtrGet_sqlite3_backup(jBack));
return sqlite3_backup_remaining(S3JniLongPtr_sqlite3_backup(jpBack));
}
S3JniApi(sqlite3_backup_step(),jint,1backup_1step)(
JniArgsEnvClass, jobject jBack, jint nPage
JniArgsEnvClass, jlong jpBack, jint nPage
){
return sqlite3_backup_step(PtrGet_sqlite3_backup(jBack), (int)nPage);
return sqlite3_backup_step(S3JniLongPtr_sqlite3_backup(jpBack), (int)nPage);
}
S3JniApi(sqlite3_bind_blob(),jint,1bind_1blob)(
JniArgsEnvClass, jobject jpStmt, jint ndx, jbyteArray baData, jint nMax
JniArgsEnvClass, jlong jpStmt, jint ndx, jbyteArray baData, jint nMax
){
jbyte * const pBuf = baData ? s3jni_jbyteArray_bytes(baData) : 0;
int rc;
if( pBuf ){
rc = sqlite3_bind_blob(PtrGet_sqlite3_stmt(jpStmt), (int)ndx,
rc = sqlite3_bind_blob(S3JniLongPtr_sqlite3_stmt(jpStmt), (int)ndx,
pBuf, (int)nMax, SQLITE_TRANSIENT);
s3jni_jbyteArray_release(baData, pBuf);
}else{
rc = baData
? SQLITE_NOMEM
: sqlite3_bind_null( PtrGet_sqlite3_stmt(jpStmt), ndx );
: sqlite3_bind_null( S3JniLongPtr_sqlite3_stmt(jpStmt), ndx );
}
return (jint)rc;
}
S3JniApi(sqlite3_bind_double(),jint,1bind_1double)(
JniArgsEnvClass, jobject jpStmt, jint ndx, jdouble val
JniArgsEnvClass, jlong jpStmt, jint ndx, jdouble val
){
return (jint)sqlite3_bind_double(PtrGet_sqlite3_stmt(jpStmt), (int)ndx, (double)val);
return (jint)sqlite3_bind_double(S3JniLongPtr_sqlite3_stmt(jpStmt),
(int)ndx, (double)val);
}
S3JniApi(sqlite3_bind_int(),jint,1bind_1int)(
JniArgsEnvClass, jobject jpStmt, jint ndx, jint val
JniArgsEnvClass, jlong jpStmt, jint ndx, jint val
){
return (jint)sqlite3_bind_int(PtrGet_sqlite3_stmt(jpStmt), (int)ndx, (int)val);
return (jint)sqlite3_bind_int(S3JniLongPtr_sqlite3_stmt(jpStmt), (int)ndx, (int)val);
}
S3JniApi(sqlite3_bind_int64(),jint,1bind_1int64)(
JniArgsEnvClass, jobject jpStmt, jint ndx, jlong val
JniArgsEnvClass, jlong jpStmt, jint ndx, jlong val
){
return (jint)sqlite3_bind_int64(PtrGet_sqlite3_stmt(jpStmt), (int)ndx, (sqlite3_int64)val);
return (jint)sqlite3_bind_int64(S3JniLongPtr_sqlite3_stmt(jpStmt), (int)ndx, (sqlite3_int64)val);
}
/*
** Bind a new global ref to Object `val` using sqlite3_bind_pointer().
*/
S3JniApi(sqlite3_bind_java_object(),jint,1bind_1java_1object)(
JniArgsEnvClass, jobject jpStmt, jint ndx, jobject val
JniArgsEnvClass, jlong jpStmt, jint ndx, jobject val
){
sqlite3_stmt * const pStmt = PtrGet_sqlite3_stmt(jpStmt);
int rc = 0;
sqlite3_stmt * const pStmt = S3JniLongPtr_sqlite3_stmt(jpStmt);
int rc = SQLITE_MISUSE;
if(pStmt){
jobject const rv = val ? S3JniRefGlobal(val) : 0;
@ -2337,26 +2340,32 @@ S3JniApi(sqlite3_bind_java_object(),jint,1bind_1java_1object)(
S3Jni_jobject_finalizer);
}else if(val){
rc = SQLITE_NOMEM;
}else{
rc = sqlite3_bind_null(pStmt, ndx);
}
}else{
rc = SQLITE_MISUSE;
}
return rc;
}
S3JniApi(sqlite3_bind_null(),jint,1bind_1null)(
JniArgsEnvClass, jobject jpStmt, jint ndx
JniArgsEnvClass, jlong jpStmt, jint ndx
){
return (jint)sqlite3_bind_null(PtrGet_sqlite3_stmt(jpStmt), (int)ndx);
return (jint)sqlite3_bind_null(S3JniLongPtr_sqlite3_stmt(jpStmt), (int)ndx);
}
S3JniApi(sqlite3_bind_parameter_count(),jint,1bind_1parameter_1count)(
JniArgsEnvClass, jlong jpStmt
){
return (jint)sqlite3_bind_parameter_count(S3JniLongPtr_sqlite3_stmt(jpStmt));
}
S3JniApi(sqlite3_bind_parameter_index(),jint,1bind_1parameter_1index)(
JniArgsEnvClass, jobject jpStmt, jbyteArray jName
JniArgsEnvClass, jlong jpStmt, jbyteArray jName
){
int rc = 0;
jbyte * const pBuf = s3jni_jbyteArray_bytes(jName);
if( pBuf ){
rc = sqlite3_bind_parameter_index(PtrGet_sqlite3_stmt(jpStmt),
rc = sqlite3_bind_parameter_index(S3JniLongPtr_sqlite3_stmt(jpStmt),
(const char *)pBuf);
s3jni_jbyteArray_release(jName, pBuf);
}
@ -2364,23 +2373,18 @@ S3JniApi(sqlite3_bind_parameter_index(),jint,1bind_1parameter_1index)(
}
S3JniApi(sqlite3_bind_parameter_name(),jstring,1bind_1parameter_1name)(
JniArgsEnvClass, jobject jpStmt, jint ndx
JniArgsEnvClass, jlong jpStmt, jint ndx
){
jstring rv = 0;
const char *z =
sqlite3_bind_parameter_name(PtrGet_sqlite3_stmt(jpStmt), (int)ndx);
if( z ){
rv = s3jni_utf8_to_jstring(z, -1);
}
return rv;
sqlite3_bind_parameter_name(S3JniLongPtr_sqlite3_stmt(jpStmt), (int)ndx);
return z ? s3jni_utf8_to_jstring(z, -1) : 0;
}
S3JniApi(sqlite3_bind_text(),jint,1bind_1text)(
JniArgsEnvClass, jobject jpStmt, jint ndx, jbyteArray baData, jint nMax
JniArgsEnvClass, jlong jpStmt, jint ndx, jbyteArray baData, jint nMax
){
jbyte * const pBuf = baData ? s3jni_jbyteArray_bytes(baData) : 0;
int const rc = sqlite3_bind_text(PtrGet_sqlite3_stmt(jpStmt), (int)ndx,
int const rc = sqlite3_bind_text(S3JniLongPtr_sqlite3_stmt(jpStmt), (int)ndx,
(const char *)pBuf,
(int)nMax, SQLITE_TRANSIENT);
s3jni_jbyteArray_release(baData, pBuf);
@ -2388,49 +2392,47 @@ S3JniApi(sqlite3_bind_text(),jint,1bind_1text)(
}
S3JniApi(sqlite3_bind_text16(),jint,1bind_1text16)(
JniArgsEnvClass, jobject jpStmt, jint ndx, jbyteArray baData, jint nMax
JniArgsEnvClass, jlong jpStmt, jint ndx, jbyteArray baData, jint nMax
){
jbyte * const pBuf = baData ? s3jni_jbyteArray_bytes(baData) : 0;
int const rc = sqlite3_bind_text16(PtrGet_sqlite3_stmt(jpStmt), (int)ndx,
int const rc = sqlite3_bind_text16(S3JniLongPtr_sqlite3_stmt(jpStmt), (int)ndx,
pBuf, (int)nMax, SQLITE_TRANSIENT);
s3jni_jbyteArray_release(baData, pBuf);
return (jint)rc;
}
S3JniApi(sqlite3_bind_zeroblob(),jint,1bind_1zeroblob)(
JniArgsEnvClass, jobject jpStmt, jint ndx, jint n
JniArgsEnvClass, jlong jpStmt, jint ndx, jint n
){
return (jint)sqlite3_bind_zeroblob(PtrGet_sqlite3_stmt(jpStmt), (int)ndx, (int)n);
return (jint)sqlite3_bind_zeroblob(S3JniLongPtr_sqlite3_stmt(jpStmt),
(int)ndx, (int)n);
}
S3JniApi(sqlite3_bind_zeroblob(),jint,1bind_1zeroblob64)(
JniArgsEnvClass, jobject jpStmt, jint ndx, jlong n
S3JniApi(sqlite3_bind_zeroblob64(),jint,1bind_1zeroblob64)(
JniArgsEnvClass, jlong jpStmt, jint ndx, jlong n
){
return (jint)sqlite3_bind_zeroblob(PtrGet_sqlite3_stmt(jpStmt), (int)ndx, (sqlite3_uint64)n);
return (jint)sqlite3_bind_zeroblob64(S3JniLongPtr_sqlite3_stmt(jpStmt),
(int)ndx, (sqlite3_uint64)n);
}
S3JniApi(sqlite3_blob_bytes(),jint,1blob_1bytes)(
JniArgsEnvClass, jobject jBlob
JniArgsEnvClass, jlong jpBlob
){
return sqlite3_blob_bytes(PtrGet_sqlite3_blob(jBlob));
return sqlite3_blob_bytes(S3JniLongPtr_sqlite3_blob(jpBlob));
}
S3JniApi(sqlite3_blob_close(),jint,1blob_1close)(
JniArgsEnvClass, jobject jBlob
JniArgsEnvClass, jlong jpBlob
){
sqlite3_blob * const b = PtrGet_sqlite3_blob(jBlob);
jint const rc = b ? (jint)sqlite3_blob_close(b) : SQLITE_MISUSE;
if( b ){
NativePointerHolder_set(S3JniNph(sqlite3_blob), jBlob, 0);
}
return rc;
sqlite3_blob * const b = S3JniLongPtr_sqlite3_blob(jpBlob);
return b ? (jint)sqlite3_blob_close(b) : SQLITE_MISUSE;
}
S3JniApi(sqlite3_blob_open(),jint,1blob_1open)(
JniArgsEnvClass, jobject jDb, jstring jDbName, jstring jTbl, jstring jCol,
JniArgsEnvClass, jlong jpDb, jstring jDbName, jstring jTbl, jstring jCol,
jlong jRowId, jint flags, jobject jOut
){
sqlite3 * const db = PtrGet_sqlite3(jDb);
sqlite3 * const db = S3JniLongPtr_sqlite3(jpDb);
sqlite3_blob * pBlob = 0;
char * zDbName = 0, * zTableName = 0, * zColumnName = 0;
int rc;
@ -2458,13 +2460,13 @@ S3JniApi(sqlite3_blob_open(),jint,1blob_1open)(
}
S3JniApi(sqlite3_blob_read(),jint,1blob_1read)(
JniArgsEnvClass, jobject jBlob, jbyteArray jTgt, jint iOffset
JniArgsEnvClass, jlong jpBlob, jbyteArray jTgt, jint iOffset
){
jbyte * const pBa = s3jni_jbyteArray_bytes(jTgt);
int rc = jTgt ? (pBa ? SQLITE_MISUSE : SQLITE_NOMEM) : SQLITE_MISUSE;
if( pBa ){
jsize const nTgt = (*env)->GetArrayLength(env, jTgt);
rc = sqlite3_blob_read(PtrGet_sqlite3_blob(jBlob), pBa,
rc = sqlite3_blob_read(S3JniLongPtr_sqlite3_blob(jpBlob), pBa,
(int)nTgt, (int)iOffset);
if( 0==rc ){
s3jni_jbyteArray_commit(jTgt, pBa);
@ -2476,16 +2478,16 @@ S3JniApi(sqlite3_blob_read(),jint,1blob_1read)(
}
S3JniApi(sqlite3_blob_reopen(),jint,1blob_1reopen)(
JniArgsEnvClass, jobject jBlob, jlong iNewRowId
JniArgsEnvClass, jlong jpBlob, jlong iNewRowId
){
return (jint)sqlite3_blob_reopen(PtrGet_sqlite3_blob(jBlob),
return (jint)sqlite3_blob_reopen(S3JniLongPtr_sqlite3_blob(jpBlob),
(sqlite3_int64)iNewRowId);
}
S3JniApi(sqlite3_blob_write(),jint,1blob_1write)(
JniArgsEnvClass, jobject jBlob, jbyteArray jBa, jint iOffset
JniArgsEnvClass, jlong jpBlob, jbyteArray jBa, jint iOffset
){
sqlite3_blob * const b = PtrGet_sqlite3_blob(jBlob);
sqlite3_blob * const b = S3JniLongPtr_sqlite3_blob(jpBlob);
jbyte * const pBuf = b ? s3jni_jbyteArray_bytes(jBa) : 0;
const jsize nBa = pBuf ? (*env)->GetArrayLength(env, jBa) : 0;
int rc = SQLITE_MISUSE;
@ -2503,7 +2505,7 @@ static int s3jni_busy_handler(void* pState, int n){
S3JniDeclLocal_env;
S3JniHook hook;
S3JniHook_localdup(&ps->hooks.busyHandler, &hook );
S3JniHook_localdup(&ps->hooks.busyHandler, &hook);
if( hook.jObj ){
rc = (*env)->CallIntMethod(env, hook.jObj,
hook.midCallback, (jint)n);
@ -2518,9 +2520,9 @@ static int s3jni_busy_handler(void* pState, int n){
}
S3JniApi(sqlite3_busy_handler(),jint,1busy_1handler)(
JniArgsEnvClass, jobject jDb, jobject jBusy
JniArgsEnvClass, jlong jpDb, jobject jBusy
){
S3JniDb * const ps = S3JniDb_from_java(jDb);
S3JniDb * const ps = S3JniDb_from_jlong(jpDb);
S3JniHook * const pHook = ps ? &ps->hooks.busyHandler : 0;
S3JniHook hook = S3JniHook_empty;
int rc = 0;
@ -2563,9 +2565,9 @@ S3JniApi(sqlite3_busy_handler(),jint,1busy_1handler)(
}
S3JniApi(sqlite3_busy_timeout(),jint,1busy_1timeout)(
JniArgsEnvClass, jobject jDb, jint ms
JniArgsEnvClass, jlong jpDb, jint ms
){
S3JniDb * const ps = S3JniDb_from_java(jDb);
S3JniDb * const ps = S3JniDb_from_jlong(jpDb);
int rc = SQLITE_MISUSE;
if( ps ){
S3JniDb_mutex_enter;
@ -2602,32 +2604,25 @@ S3JniApi(sqlite3_cancel_auto_extension(),jboolean,1cancel_1auto_1extension)(
}
/* Wrapper for sqlite3_close(_v2)(). */
static jint s3jni_close_db(JNIEnv * const env, jobject jDb, int version){
static jint s3jni_close_db(JNIEnv * const env, jlong jpDb, int version){
int rc = 0;
S3JniDb * const ps = S3JniDb_from_java(jDb);
S3JniDb * const ps = S3JniDb_from_jlong(jpDb);
assert(version == 1 || version == 2);
if( ps ){
rc = 1==version
? (jint)sqlite3_close(ps->pDb)
: (jint)sqlite3_close_v2(ps->pDb);
if( 0==rc ){
NativePointerHolder_set(S3JniNph(sqlite3), jDb, 0);
}
}
return (jint)rc;
}
S3JniApi(sqlite3_close_v2(),jint,1close_1v2)(
JniArgsEnvClass, jobject pDb
){
return s3jni_close_db(env, pDb, 2);
S3JniApi(sqlite3_close(),jint,1close)(JniArgsEnvClass, jlong pDb){
return s3jni_close_db(env, pDb, 1);
}
S3JniApi(sqlite3_close(),jint,1close)(
JniArgsEnvClass, jobject pDb
){
return s3jni_close_db(env, pDb, 1);
S3JniApi(sqlite3_close_v2(),jint,1close_1v2)(JniArgsEnvClass, jlong pDb){
return s3jni_close_db(env, pDb, 2);
}
/*
@ -2673,14 +2668,14 @@ static void s3jni_collation_needed_impl16(void *pState, sqlite3 *pDb,
}
S3JniApi(sqlite3_collation_needed(),jint,1collation_1needed)(
JniArgsEnvClass, jobject jDb, jobject jHook
JniArgsEnvClass, jlong jpDb, jobject jHook
){
S3JniDb * ps;
S3JniCollationNeeded * pHook;
int rc = 0;
S3JniDb_mutex_enter;
ps = S3JniDb_from_java(jDb);
ps = S3JniDb_from_jlong(jpDb);
if( !ps ){
S3JniDb_mutex_leave;
return SQLITE_MISUSE;
@ -2823,13 +2818,13 @@ static void s3jni_rollback_hook_impl(void *pP){
** sqlite3_rollback_hook().
*/
static jobject s3jni_commit_rollback_hook(int isCommit, JNIEnv * const env,
jobject jDb, jobject jHook){
jlong jpDb, jobject jHook){
S3JniDb * ps;
jobject pOld = 0; /* previous hoook */
S3JniHook * pHook; /* ps->hooks.commit|rollback */
S3JniDb_mutex_enter;
ps = S3JniDb_from_java(jDb);
ps = S3JniDb_from_jlong(jpDb);
if( !ps ){
s3jni_db_error(ps->pDb, SQLITE_NOMEM, 0);
S3JniDb_mutex_leave;
@ -2877,9 +2872,9 @@ static jobject s3jni_commit_rollback_hook(int isCommit, JNIEnv * const env,
}
S3JniApi(sqlite3_commit_hook(),jobject,1commit_1hook)(
JniArgsEnvClass,jobject jDb, jobject jHook
JniArgsEnvClass, jlong jpDb, jobject jHook
){
return s3jni_commit_rollback_hook(1, env, jDb, jHook);
return s3jni_commit_rollback_hook(1, env, jpDb, jHook);
}
S3JniApi(sqlite3_compileoption_get(),jstring,1compileoption_1get)(
@ -2912,7 +2907,8 @@ S3JniApi(sqlite3_compileoption_used(),jboolean,1compileoption_1used)(
JniArgsEnvClass, jstring name
){
const char *zUtf8 = s3jni_jstring_to_mutf8(name)
/* We know these to be ASCII, so MUTF-8 is fine. */;
/* We know these to be ASCII, so MUTF-8 is fine (and
hypothetically faster to convert). */;
const jboolean rc =
0==sqlite3_compileoption_used(zUtf8) ? JNI_FALSE : JNI_TRUE;
s3jni_mutf8_release(name, zUtf8);
@ -3125,7 +3121,7 @@ S3JniApi(sqlite3_create_collation() sqlite3_create_collation_v2(),
S3JniDb_mutex_enter;
ps = S3JniDb_from_java(jDb);
if( !ps ){
if( !ps || !name ){
rc = SQLITE_MISUSE;
}else{
jclass const klazz = (*env)->GetObjectClass(env, oCollation);
@ -3171,7 +3167,9 @@ S3JniApi(sqlite3_create_function() sqlite3_create_function_v2()
sqlite3 * const pDb = PtrGet_sqlite3(jDb);
char * zFuncName = 0;
if( !encodingTypeIsValid(eTextRep) ){
if( !pDb || !jFuncName ){
return SQLITE_MISUSE;
}else if( !encodingTypeIsValid(eTextRep) ){
return s3jni_db_error(pDb, SQLITE_FORMAT,
"Invalid function encoding option.");
}
@ -3408,15 +3406,11 @@ S3JniApi(sqlite3_extended_result_codes(),jboolean,1extended_1result_1codes)(
}
S3JniApi(sqlite3_finalize(),jint,1finalize)(
JniArgsEnvClass, jobject jpStmt
JniArgsEnvClass, jlong jpStmt
){
int rc = 0;
sqlite3_stmt * const pStmt = PtrGet_sqlite3_stmt(jpStmt);
if( pStmt ){
rc = sqlite3_finalize(pStmt);
NativePointerHolder_set(S3JniNph(sqlite3_stmt), jpStmt, 0);
}
return rc;
return jpStmt
? sqlite3_finalize(S3JniLongPtr_sqlite3_stmt(jpStmt))
: 0;
}
S3JniApi(sqlite3_get_auxdata(),jobject,1get_1auxdata)(
@ -3637,7 +3631,7 @@ S3JniApi(sqlite3_open_v2(),jint,1open_1v2)(
/* Proxy for the sqlite3_prepare[_v2/3]() family. */
jint sqlite3_jni_prepare_v123( int prepVersion, JNIEnv * const env, jclass self,
jobject jDb, jbyteArray baSql,
jlong jpDb, jbyteArray baSql,
jint nMax, jint prepFlags,
jobject jOutStmt, jobject outTail){
sqlite3_stmt * pStmt = 0;
@ -3656,18 +3650,18 @@ jint sqlite3_jni_prepare_v123( int prepVersion, JNIEnv * const env, jclass self,
goto end;
}
switch( prepVersion ){
case 1: rc = sqlite3_prepare(PtrGet_sqlite3(jDb), (const char *)pBuf,
case 1: rc = sqlite3_prepare(S3JniLongPtr_sqlite3(jpDb), (const char *)pBuf,
(int)nMax, &pStmt, &zTail);
break;
case 2: rc = sqlite3_prepare_v2(PtrGet_sqlite3(jDb), (const char *)pBuf,
case 2: rc = sqlite3_prepare_v2(S3JniLongPtr_sqlite3(jpDb), (const char *)pBuf,
(int)nMax, &pStmt, &zTail);
break;
case 3: rc = sqlite3_prepare_v3(PtrGet_sqlite3(jDb), (const char *)pBuf,
case 3: rc = sqlite3_prepare_v3(S3JniLongPtr_sqlite3(jpDb), (const char *)pBuf,
(int)nMax, (unsigned int)prepFlags,
&pStmt, &zTail);
break;
default:
assert(0 && "Invalid prepare() version");
assert(!"Invalid prepare() version");
}
end:
s3jni_jbyteArray_release(baSql,pBuf);
@ -3697,24 +3691,24 @@ end:
return (jint)rc;
}
S3JniApi(sqlite3_prepare(),jint,1prepare)(
JNIEnv * const env, jclass self, jobject jDb, jbyteArray baSql,
JNIEnv * const env, jclass self, jlong jpDb, jbyteArray baSql,
jint nMax, jobject jOutStmt, jobject outTail
){
return sqlite3_jni_prepare_v123(1, env, self, jDb, baSql, nMax, 0,
return sqlite3_jni_prepare_v123(1, env, self, jpDb, baSql, nMax, 0,
jOutStmt, outTail);
}
S3JniApi(sqlite3_prepare_v2(),jint,1prepare_1v2)(
JNIEnv * const env, jclass self, jobject jDb, jbyteArray baSql,
JNIEnv * const env, jclass self, jlong jpDb, jbyteArray baSql,
jint nMax, jobject jOutStmt, jobject outTail
){
return sqlite3_jni_prepare_v123(2, env, self, jDb, baSql, nMax, 0,
return sqlite3_jni_prepare_v123(2, env, self, jpDb, baSql, nMax, 0,
jOutStmt, outTail);
}
S3JniApi(sqlite3_prepare_v3(),jint,1prepare_1v3)(
JNIEnv * const env, jclass self, jobject jDb, jbyteArray baSql,
JNIEnv * const env, jclass self, jlong jpDb, jbyteArray baSql,
jint nMax, jint prepFlags, jobject jOutStmt, jobject outTail
){
return sqlite3_jni_prepare_v123(3, env, self, jDb, baSql, nMax,
return sqlite3_jni_prepare_v123(3, env, self, jpDb, baSql, nMax,
prepFlags, jOutStmt, outTail);
}
@ -3803,8 +3797,8 @@ S3JniApi(sqlite3_preupdate_depth(),int,1preupdate_1depth)(
** JNI wrapper for both sqlite3_update_hook() and
** sqlite3_preupdate_hook() (if isPre is true).
*/
static jobject s3jni_updatepre_hook(JNIEnv * env, int isPre, jobject jDb, jobject jHook){
S3JniDb * const ps = S3JniDb_from_java(jDb);
static jobject s3jni_updatepre_hook(JNIEnv * env, int isPre, jlong jpDb, jobject jHook){
S3JniDb * const ps = S3JniDb_from_jlong(jpDb);
jclass klazz;
jobject pOld = 0;
jmethodID xCallback;
@ -3877,20 +3871,20 @@ end:
S3JniApi(sqlite3_preupdate_hook(),jobject,1preupdate_1hook)(
JniArgsEnvClass, jobject jDb, jobject jHook
JniArgsEnvClass, jlong jpDb, jobject jHook
){
#ifdef SQLITE_ENABLE_PREUPDATE_HOOK
return s3jni_updatepre_hook(env, 1, jDb, jHook);
return s3jni_updatepre_hook(env, 1, jpDb, jHook);
#else
return NULL;
#endif /* SQLITE_ENABLE_PREUPDATE_HOOK */
}
/* Impl for sqlite3_preupdate_{new,old}(). */
static int s3jni_preupdate_newold(JNIEnv * const env, int isNew, jobject jDb,
static int s3jni_preupdate_newold(JNIEnv * const env, int isNew, jlong jpDb,
jint iCol, jobject jOut){
#ifdef SQLITE_ENABLE_PREUPDATE_HOOK
sqlite3 * const pDb = PtrGet_sqlite3(jDb);
sqlite3 * const pDb = S3JniLongPtr_sqlite3(jpDb);
int rc = SQLITE_MISUSE;
if( pDb ){
sqlite3_value * pOut = 0;
@ -3914,15 +3908,15 @@ static int s3jni_preupdate_newold(JNIEnv * const env, int isNew, jobject jDb,
}
S3JniApi(sqlite3_preupdate_new(),jint,1preupdate_1new)(
JniArgsEnvClass, jobject jDb, jint iCol, jobject jOut
JniArgsEnvClass, jlong jpDb, jint iCol, jobject jOut
){
return s3jni_preupdate_newold(env, 1, jDb, iCol, jOut);
return s3jni_preupdate_newold(env, 1, jpDb, iCol, jOut);
}
S3JniApi(sqlite3_preupdate_old(),jint,1preupdate_1old)(
JniArgsEnvClass, jobject jDb, jint iCol, jobject jOut
JniArgsEnvClass, jlong jpDb, jint iCol, jobject jOut
){
return s3jni_preupdate_newold(env, 0, jDb, iCol, jOut);
return s3jni_preupdate_newold(env, 0, jpDb, iCol, jOut);
}
@ -4222,9 +4216,9 @@ S3JniApi(sqlite3_result_zeroblob64(),jint,1result_1zeroblob64)(
}
S3JniApi(sqlite3_rollback_hook(),jobject,1rollback_1hook)(
JniArgsEnvClass, jobject jDb, jobject jHook
JniArgsEnvClass, jlong jpDb, jobject jHook
){
return s3jni_commit_rollback_hook(0, env, jDb, jHook);
return s3jni_commit_rollback_hook(0, env, jpDb, jHook);
}
/* Callback for sqlite3_set_authorizer(). */
@ -4630,16 +4624,16 @@ S3JniApi(sqlite3_txn_state(),jint,1txn_1state)(
}
S3JniApi(sqlite3_update_hook(),jobject,1update_1hook)(
JniArgsEnvClass, jobject jDb, jobject jHook
JniArgsEnvClass, jlong jpDb, jobject jHook
){
return s3jni_updatepre_hook(env, 0, jDb, jHook);
return s3jni_updatepre_hook(env, 0, jpDb, jHook);
}
S3JniApi(sqlite3_value_blob(),jbyteArray,1value_1blob)(
JniArgsEnvClass, jobject jpSVal
JniArgsEnvClass, jlong jpSVal
){
sqlite3_value * const sv = PtrGet_sqlite3_value(jpSVal);
sqlite3_value * const sv = S3JniLongPtr_sqlite3_value(jpSVal);
int const nLen = sqlite3_value_bytes(sv);
const jbyte * pBytes = sqlite3_value_blob(sv);
@ -4651,48 +4645,48 @@ S3JniApi(sqlite3_value_blob(),jbyteArray,1value_1blob)(
S3JniApi(sqlite3_value_double(),jdouble,1value_1double)(
JniArgsEnvClass, jobject jpSVal
JniArgsEnvClass, jlong jpSVal
){
return (jdouble) sqlite3_value_double(PtrGet_sqlite3_value(jpSVal));
return (jdouble) sqlite3_value_double(S3JniLongPtr_sqlite3_value(jpSVal));
}
S3JniApi(sqlite3_value_dup(),jobject,1value_1dup)(
JniArgsEnvClass, jobject jpSVal
JniArgsEnvClass, jlong jpSVal
){
sqlite3_value * const sv = sqlite3_value_dup(PtrGet_sqlite3_value(jpSVal));
sqlite3_value * const sv = sqlite3_value_dup(S3JniLongPtr_sqlite3_value(jpSVal));
return sv ? new_java_sqlite3_value(env, sv) : 0;
}
S3JniApi(sqlite3_value_free(),void,1value_1free)(
JniArgsEnvClass, jobject jpSVal
JniArgsEnvClass, jlong jpSVal
){
sqlite3_value_free(PtrGet_sqlite3_value(jpSVal));
sqlite3_value_free(S3JniLongPtr_sqlite3_value(jpSVal));
}
S3JniApi(sqlite3_value_int(),jint,1value_1int)(
JniArgsEnvClass, jobject jpSVal
JniArgsEnvClass, jlong jpSVal
){
return (jint) sqlite3_value_int(PtrGet_sqlite3_value(jpSVal));
return (jint) sqlite3_value_int(S3JniLongPtr_sqlite3_value(jpSVal));
}
S3JniApi(sqlite3_value_int64(),jlong,1value_1int64)(
JniArgsEnvClass, jobject jpSVal
JniArgsEnvClass, jlong jpSVal
){
return (jlong) sqlite3_value_int64(PtrGet_sqlite3_value(jpSVal));
return (jlong) sqlite3_value_int64(S3JniLongPtr_sqlite3_value(jpSVal));
}
S3JniApi(sqlite3_value_java_object(),jobject,1value_1java_1object)(
JniArgsEnvClass, jobject jpSVal
JniArgsEnvClass, jlong jpSVal
){
return sqlite3_value_pointer(PtrGet_sqlite3_value(jpSVal),
return sqlite3_value_pointer(S3JniLongPtr_sqlite3_value(jpSVal),
ResultJavaValuePtrStr);
}
S3JniApi(sqlite3_value_text(),jbyteArray,1value_1text)(
JniArgsEnvClass, jobject jpSVal
JniArgsEnvClass, jlong jpSVal
){
sqlite3_value * const sv = PtrGet_sqlite3_value(jpSVal);
sqlite3_value * const sv = S3JniLongPtr_sqlite3_value(jpSVal);
int const n = sqlite3_value_bytes(sv);
const unsigned char * const p = sqlite3_value_text(sv);
return p ? s3jni_new_jbyteArray(p, n) : 0;
@ -4701,9 +4695,9 @@ S3JniApi(sqlite3_value_text(),jbyteArray,1value_1text)(
#if 0
// this impl might prove useful.
S3JniApi(sqlite3_value_text(),jstring,1value_1text)(
JniArgsEnvClass, jobject jpSVal
JniArgsEnvClass, jlong jpSVal
){
sqlite3_value * const sv = PtrGet_sqlite3_value(jpSVal);
sqlite3_value * const sv = S3JniLongPtr_sqlite3_value(jpSVal);
int const n = sqlite3_value_bytes(sv);
const unsigned char * const p = sqlite3_value_text(sv);
return p ? s3jni_utf8_to_jstring( (const char *)p, n) : 0;
@ -4711,9 +4705,9 @@ S3JniApi(sqlite3_value_text(),jstring,1value_1text)(
#endif
S3JniApi(sqlite3_value_text16(),jstring,1value_1text16)(
JniArgsEnvClass, jobject jpSVal
JniArgsEnvClass, jlong jpSVal
){
sqlite3_value * const sv = PtrGet_sqlite3_value(jpSVal);
sqlite3_value * const sv = S3JniLongPtr_sqlite3_value(jpSVal);
const int n = sqlite3_value_bytes16(sv);
const void * const p = sqlite3_value_text16(sv);
return s3jni_text16_to_jstring(env, p, n);
@ -5575,7 +5569,7 @@ static int SQLTester_strnotglob(const char *zGlob, const char *z){
}
JNIEXPORT jint JNICALL
Java_org_sqlite_jni_tester_SQLTester_strglob(
Java_org_sqlite_jni_SQLTester_strglob(
JniArgsEnvClass, jbyteArray baG, jbyteArray baT
){
int rc = 0;
@ -5602,7 +5596,7 @@ static int SQLTester_auto_extension(sqlite3 *pDb, const char **pzErr,
}
JNIEXPORT void JNICALL
Java_org_sqlite_jni_tester_SQLTester_installCustomExtensions(JniArgsEnvClass){
Java_org_sqlite_jni_SQLTester_installCustomExtensions(JniArgsEnvClass){
sqlite3_auto_extension( (void(*)(void))SQLTester_auto_extension );
}

View File

@ -814,210 +814,210 @@ JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1auto_1extension
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_backup_finish
* Signature: (Lorg/sqlite/jni/sqlite3_backup;)I
* Signature: (J)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1backup_1finish
(JNIEnv *, jclass, jobject);
(JNIEnv *, jclass, jlong);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_backup_init
* Signature: (Lorg/sqlite/jni/sqlite3;Ljava/lang/String;Lorg/sqlite/jni/sqlite3;Ljava/lang/String;)Lorg/sqlite/jni/sqlite3_backup;
* Signature: (JLjava/lang/String;JLjava/lang/String;)Lorg/sqlite/jni/sqlite3_backup;
*/
JNIEXPORT jobject JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1backup_1init
(JNIEnv *, jclass, jobject, jstring, jobject, jstring);
(JNIEnv *, jclass, jlong, jstring, jlong, jstring);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_backup_pagecount
* Signature: (Lorg/sqlite/jni/sqlite3_backup;)I
* Signature: (J)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1backup_1pagecount
(JNIEnv *, jclass, jobject);
(JNIEnv *, jclass, jlong);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_backup_remaining
* Signature: (Lorg/sqlite/jni/sqlite3_backup;)I
* Signature: (J)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1backup_1remaining
(JNIEnv *, jclass, jobject);
(JNIEnv *, jclass, jlong);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_backup_step
* Signature: (Lorg/sqlite/jni/sqlite3_backup;I)I
* Signature: (JI)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1backup_1step
(JNIEnv *, jclass, jobject, jint);
(JNIEnv *, jclass, jlong, jint);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_bind_blob
* Signature: (Lorg/sqlite/jni/sqlite3_stmt;I[BI)I
* Signature: (JI[BI)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1bind_1blob
(JNIEnv *, jclass, jobject, jint, jbyteArray, jint);
(JNIEnv *, jclass, jlong, jint, jbyteArray, jint);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_bind_double
* Signature: (Lorg/sqlite/jni/sqlite3_stmt;ID)I
* Signature: (JID)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1bind_1double
(JNIEnv *, jclass, jobject, jint, jdouble);
(JNIEnv *, jclass, jlong, jint, jdouble);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_bind_int
* Signature: (Lorg/sqlite/jni/sqlite3_stmt;II)I
* Signature: (JII)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1bind_1int
(JNIEnv *, jclass, jobject, jint, jint);
(JNIEnv *, jclass, jlong, jint, jint);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_bind_int64
* Signature: (Lorg/sqlite/jni/sqlite3_stmt;IJ)I
* Signature: (JIJ)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1bind_1int64
(JNIEnv *, jclass, jobject, jint, jlong);
(JNIEnv *, jclass, jlong, jint, jlong);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_bind_java_object
* Signature: (Lorg/sqlite/jni/sqlite3_stmt;ILjava/lang/Object;)I
* Signature: (JILjava/lang/Object;)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1bind_1java_1object
(JNIEnv *, jclass, jobject, jint, jobject);
(JNIEnv *, jclass, jlong, jint, jobject);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_bind_null
* Signature: (Lorg/sqlite/jni/sqlite3_stmt;I)I
* Signature: (JI)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1bind_1null
(JNIEnv *, jclass, jobject, jint);
(JNIEnv *, jclass, jlong, jint);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_bind_parameter_count
* Signature: (Lorg/sqlite/jni/sqlite3_stmt;)I
* Signature: (J)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1bind_1parameter_1count
(JNIEnv *, jclass, jobject);
(JNIEnv *, jclass, jlong);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_bind_parameter_index
* Signature: (Lorg/sqlite/jni/sqlite3_stmt;[B)I
* Signature: (J[B)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1bind_1parameter_1index
(JNIEnv *, jclass, jobject, jbyteArray);
(JNIEnv *, jclass, jlong, jbyteArray);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_bind_parameter_name
* Signature: (Lorg/sqlite/jni/sqlite3_stmt;I)Ljava/lang/String;
* Signature: (JI)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1bind_1parameter_1name
(JNIEnv *, jclass, jobject, jint);
(JNIEnv *, jclass, jlong, jint);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_bind_text
* Signature: (Lorg/sqlite/jni/sqlite3_stmt;I[BI)I
* Signature: (JI[BI)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1bind_1text
(JNIEnv *, jclass, jobject, jint, jbyteArray, jint);
(JNIEnv *, jclass, jlong, jint, jbyteArray, jint);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_bind_text16
* Signature: (Lorg/sqlite/jni/sqlite3_stmt;I[BI)I
* Signature: (JI[BI)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1bind_1text16
(JNIEnv *, jclass, jobject, jint, jbyteArray, jint);
(JNIEnv *, jclass, jlong, jint, jbyteArray, jint);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_bind_zeroblob
* Signature: (Lorg/sqlite/jni/sqlite3_stmt;II)I
* Signature: (JII)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1bind_1zeroblob
(JNIEnv *, jclass, jobject, jint, jint);
(JNIEnv *, jclass, jlong, jint, jint);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_bind_zeroblob64
* Signature: (Lorg/sqlite/jni/sqlite3_stmt;IJ)I
* Signature: (JIJ)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1bind_1zeroblob64
(JNIEnv *, jclass, jobject, jint, jlong);
(JNIEnv *, jclass, jlong, jint, jlong);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_blob_bytes
* Signature: (Lorg/sqlite/jni/sqlite3_blob;)I
* Signature: (J)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1blob_1bytes
(JNIEnv *, jclass, jobject);
(JNIEnv *, jclass, jlong);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_blob_close
* Signature: (Lorg/sqlite/jni/sqlite3_blob;)I
* Signature: (J)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1blob_1close
(JNIEnv *, jclass, jobject);
(JNIEnv *, jclass, jlong);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_blob_open
* Signature: (Lorg/sqlite/jni/sqlite3;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;JILorg/sqlite/jni/OutputPointer/sqlite3_blob;)I
* Signature: (JLjava/lang/String;Ljava/lang/String;Ljava/lang/String;JILorg/sqlite/jni/OutputPointer/sqlite3_blob;)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1blob_1open
(JNIEnv *, jclass, jobject, jstring, jstring, jstring, jlong, jint, jobject);
(JNIEnv *, jclass, jlong, jstring, jstring, jstring, jlong, jint, jobject);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_blob_read
* Signature: (Lorg/sqlite/jni/sqlite3_blob;[BI)I
* Signature: (J[BI)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1blob_1read
(JNIEnv *, jclass, jobject, jbyteArray, jint);
(JNIEnv *, jclass, jlong, jbyteArray, jint);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_blob_reopen
* Signature: (Lorg/sqlite/jni/sqlite3_blob;J)I
* Signature: (JJ)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1blob_1reopen
(JNIEnv *, jclass, jobject, jlong);
(JNIEnv *, jclass, jlong, jlong);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_blob_write
* Signature: (Lorg/sqlite/jni/sqlite3_blob;[BI)I
* Signature: (J[BI)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1blob_1write
(JNIEnv *, jclass, jobject, jbyteArray, jint);
(JNIEnv *, jclass, jlong, jbyteArray, jint);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_busy_handler
* Signature: (Lorg/sqlite/jni/sqlite3;Lorg/sqlite/jni/BusyHandlerCallback;)I
* Signature: (JLorg/sqlite/jni/BusyHandlerCallback;)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1busy_1handler
(JNIEnv *, jclass, jobject, jobject);
(JNIEnv *, jclass, jlong, jobject);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_busy_timeout
* Signature: (Lorg/sqlite/jni/sqlite3;I)I
* Signature: (JI)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1busy_1timeout
(JNIEnv *, jclass, jobject, jint);
(JNIEnv *, jclass, jlong, jint);
/*
* Class: org_sqlite_jni_SQLite3Jni
@ -1030,42 +1030,42 @@ JNIEXPORT jboolean JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1cancel_1auto_
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_changes
* Signature: (Lorg/sqlite/jni/sqlite3;)I
* Signature: (J)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1changes
(JNIEnv *, jclass, jobject);
(JNIEnv *, jclass, jlong);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_changes64
* Signature: (Lorg/sqlite/jni/sqlite3;)J
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1changes64
(JNIEnv *, jclass, jobject);
(JNIEnv *, jclass, jlong);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_clear_bindings
* Signature: (Lorg/sqlite/jni/sqlite3_stmt;)I
* Signature: (J)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1clear_1bindings
(JNIEnv *, jclass, jobject);
(JNIEnv *, jclass, jlong);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_close
* Signature: (Lorg/sqlite/jni/sqlite3;)I
* Signature: (J)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1close
(JNIEnv *, jclass, jobject);
(JNIEnv *, jclass, jlong);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_close_v2
* Signature: (Lorg/sqlite/jni/sqlite3;)I
* Signature: (J)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1close_1v2
(JNIEnv *, jclass, jobject);
(JNIEnv *, jclass, jlong);
/*
* Class: org_sqlite_jni_SQLite3Jni
@ -1078,26 +1078,34 @@ JNIEXPORT jbyteArray JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1column_1blo
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_column_bytes
* Signature: (Lorg/sqlite/jni/sqlite3_stmt;I)I
* Signature: (JI)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1column_1bytes
(JNIEnv *, jclass, jobject, jint);
(JNIEnv *, jclass, jlong, jint);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_column_bytes16
* Signature: (Lorg/sqlite/jni/sqlite3_stmt;I)I
* Signature: (JI)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1column_1bytes16
(JNIEnv *, jclass, jobject, jint);
(JNIEnv *, jclass, jlong, jint);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_column_count
* Signature: (Lorg/sqlite/jni/sqlite3_stmt;)I
* Signature: (J)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1column_1count
(JNIEnv *, jclass, jobject);
(JNIEnv *, jclass, jlong);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_column_decltype
* Signature: (JI)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1column_1decltype
(JNIEnv *, jclass, jlong, jint);
/*
* Class: org_sqlite_jni_SQLite3Jni
@ -1126,34 +1134,34 @@ JNIEXPORT jlong JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1column_1int64
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_column_name
* Signature: (Lorg/sqlite/jni/sqlite3_stmt;I)Ljava/lang/String;
* Signature: (JI)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1column_1name
(JNIEnv *, jclass, jobject, jint);
(JNIEnv *, jclass, jlong, jint);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_column_database_name
* Signature: (Lorg/sqlite/jni/sqlite3_stmt;I)Ljava/lang/String;
* Signature: (JI)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1column_1database_1name
(JNIEnv *, jclass, jobject, jint);
(JNIEnv *, jclass, jlong, jint);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_column_origin_name
* Signature: (Lorg/sqlite/jni/sqlite3_stmt;I)Ljava/lang/String;
* Signature: (JI)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1column_1origin_1name
(JNIEnv *, jclass, jobject, jint);
(JNIEnv *, jclass, jlong, jint);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_column_table_name
* Signature: (Lorg/sqlite/jni/sqlite3_stmt;I)Ljava/lang/String;
* Signature: (JI)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1column_1table_1name
(JNIEnv *, jclass, jobject, jint);
(JNIEnv *, jclass, jlong, jint);
/*
* Class: org_sqlite_jni_SQLite3Jni
@ -1174,10 +1182,10 @@ JNIEXPORT jstring JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1column_1text16
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_column_type
* Signature: (Lorg/sqlite/jni/sqlite3_stmt;I)I
* Signature: (JI)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1column_1type
(JNIEnv *, jclass, jobject, jint);
(JNIEnv *, jclass, jlong, jint);
/*
* Class: org_sqlite_jni_SQLite3Jni
@ -1190,18 +1198,18 @@ JNIEXPORT jobject JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1column_1value
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_collation_needed
* Signature: (Lorg/sqlite/jni/sqlite3;Lorg/sqlite/jni/CollationNeededCallback;)I
* Signature: (JLorg/sqlite/jni/CollationNeededCallback;)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1collation_1needed
(JNIEnv *, jclass, jobject, jobject);
(JNIEnv *, jclass, jlong, jobject);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_commit_hook
* Signature: (Lorg/sqlite/jni/sqlite3;Lorg/sqlite/jni/CommitHookCallback;)Lorg/sqlite/jni/CommitHookCallback;
* Signature: (JLorg/sqlite/jni/CommitHookCallback;)Lorg/sqlite/jni/CommitHookCallback;
*/
JNIEXPORT jobject JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1commit_1hook
(JNIEnv *, jclass, jobject, jobject);
(JNIEnv *, jclass, jlong, jobject);
/*
* Class: org_sqlite_jni_SQLite3Jni
@ -1278,10 +1286,10 @@ JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1create_1function
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_data_count
* Signature: (Lorg/sqlite/jni/sqlite3_stmt;)I
* Signature: (J)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1data_1count
(JNIEnv *, jclass, jobject);
(JNIEnv *, jclass, jlong);
/*
* Class: org_sqlite_jni_SQLite3Jni
@ -1347,6 +1355,14 @@ JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1errcode
JNIEXPORT jstring JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1errmsg16
(JNIEnv *, jclass, jobject);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_error_offset
* Signature: (J)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1error_1offset
(JNIEnv *, jclass, jlong);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_errstr
@ -1366,10 +1382,10 @@ JNIEXPORT jstring JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1expanded_1sql
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_extended_errcode
* Signature: (Lorg/sqlite/jni/sqlite3;)I
* Signature: (J)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1extended_1errcode
(JNIEnv *, jclass, jobject);
(JNIEnv *, jclass, jlong);
/*
* Class: org_sqlite_jni_SQLite3Jni
@ -1382,10 +1398,10 @@ JNIEXPORT jboolean JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1extended_1res
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_get_autocommit
* Signature: (Lorg/sqlite/jni/sqlite3;)Z
* Signature: (J)Z
*/
JNIEXPORT jboolean JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1get_1autocommit
(JNIEnv *, jclass, jobject);
(JNIEnv *, jclass, jlong);
/*
* Class: org_sqlite_jni_SQLite3Jni
@ -1395,21 +1411,13 @@ JNIEXPORT jboolean JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1get_1autocomm
JNIEXPORT jobject JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1get_1auxdata
(JNIEnv *, jclass, jobject, jint);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_error_offset
* Signature: (Lorg/sqlite/jni/sqlite3;)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1error_1offset
(JNIEnv *, jclass, jobject);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_finalize
* Signature: (Lorg/sqlite/jni/sqlite3_stmt;)I
* Signature: (J)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1finalize
(JNIEnv *, jclass, jobject);
(JNIEnv *, jclass, jlong);
/*
* Class: org_sqlite_jni_SQLite3Jni
@ -1510,74 +1518,74 @@ JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1open_1v2
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_prepare
* Signature: (Lorg/sqlite/jni/sqlite3;[BILorg/sqlite/jni/OutputPointer/sqlite3_stmt;Lorg/sqlite/jni/OutputPointer/Int32;)I
* Signature: (J[BILorg/sqlite/jni/OutputPointer/sqlite3_stmt;Lorg/sqlite/jni/OutputPointer/Int32;)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1prepare
(JNIEnv *, jclass, jobject, jbyteArray, jint, jobject, jobject);
(JNIEnv *, jclass, jlong, jbyteArray, jint, jobject, jobject);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_prepare_v2
* Signature: (Lorg/sqlite/jni/sqlite3;[BILorg/sqlite/jni/OutputPointer/sqlite3_stmt;Lorg/sqlite/jni/OutputPointer/Int32;)I
* Signature: (J[BILorg/sqlite/jni/OutputPointer/sqlite3_stmt;Lorg/sqlite/jni/OutputPointer/Int32;)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1prepare_1v2
(JNIEnv *, jclass, jobject, jbyteArray, jint, jobject, jobject);
(JNIEnv *, jclass, jlong, jbyteArray, jint, jobject, jobject);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_prepare_v3
* Signature: (Lorg/sqlite/jni/sqlite3;[BIILorg/sqlite/jni/OutputPointer/sqlite3_stmt;Lorg/sqlite/jni/OutputPointer/Int32;)I
* Signature: (J[BIILorg/sqlite/jni/OutputPointer/sqlite3_stmt;Lorg/sqlite/jni/OutputPointer/Int32;)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1prepare_1v3
(JNIEnv *, jclass, jobject, jbyteArray, jint, jint, jobject, jobject);
(JNIEnv *, jclass, jlong, jbyteArray, jint, jint, jobject, jobject);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_preupdate_blobwrite
* Signature: (Lorg/sqlite/jni/sqlite3;)I
* Signature: (J)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1preupdate_1blobwrite
(JNIEnv *, jclass, jobject);
(JNIEnv *, jclass, jlong);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_preupdate_count
* Signature: (Lorg/sqlite/jni/sqlite3;)I
* Signature: (J)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1preupdate_1count
(JNIEnv *, jclass, jobject);
(JNIEnv *, jclass, jlong);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_preupdate_depth
* Signature: (Lorg/sqlite/jni/sqlite3;)I
* Signature: (J)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1preupdate_1depth
(JNIEnv *, jclass, jobject);
(JNIEnv *, jclass, jlong);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_preupdate_hook
* Signature: (Lorg/sqlite/jni/sqlite3;Lorg/sqlite/jni/PreupdateHookCallback;)Lorg/sqlite/jni/PreupdateHookCallback;
* Signature: (JLorg/sqlite/jni/PreupdateHookCallback;)Lorg/sqlite/jni/PreupdateHookCallback;
*/
JNIEXPORT jobject JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1preupdate_1hook
(JNIEnv *, jclass, jobject, jobject);
(JNIEnv *, jclass, jlong, jobject);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_preupdate_new
* Signature: (Lorg/sqlite/jni/sqlite3;ILorg/sqlite/jni/OutputPointer/sqlite3_value;)I
* Signature: (JILorg/sqlite/jni/OutputPointer/sqlite3_value;)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1preupdate_1new
(JNIEnv *, jclass, jobject, jint, jobject);
(JNIEnv *, jclass, jlong, jint, jobject);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_preupdate_old
* Signature: (Lorg/sqlite/jni/sqlite3;ILorg/sqlite/jni/OutputPointer/sqlite3_value;)I
* Signature: (JILorg/sqlite/jni/OutputPointer/sqlite3_value;)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1preupdate_1old
(JNIEnv *, jclass, jobject, jint, jobject);
(JNIEnv *, jclass, jlong, jint, jobject);
/*
* Class: org_sqlite_jni_SQLite3Jni
@ -1750,10 +1758,10 @@ JNIEXPORT void JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1result_1text64
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_rollback_hook
* Signature: (Lorg/sqlite/jni/sqlite3;Lorg/sqlite/jni/RollbackHookCallback;)Lorg/sqlite/jni/RollbackHookCallback;
* Signature: (JLorg/sqlite/jni/RollbackHookCallback;)Lorg/sqlite/jni/RollbackHookCallback;
*/
JNIEXPORT jobject JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1rollback_1hook
(JNIEnv *, jclass, jobject, jobject);
(JNIEnv *, jclass, jlong, jobject);
/*
* Class: org_sqlite_jni_SQLite3Jni
@ -1838,26 +1846,26 @@ JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1step
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_stmt_explain
* Signature: (Lorg/sqlite/jni/sqlite3_stmt;I)I
* Signature: (JI)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1stmt_1explain
(JNIEnv *, jclass, jobject, jint);
(JNIEnv *, jclass, jlong, jint);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_stmt_isexplain
* Signature: (Lorg/sqlite/jni/sqlite3_stmt;)I
* Signature: (J)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1stmt_1isexplain
(JNIEnv *, jclass, jobject);
(JNIEnv *, jclass, jlong);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_stmt_readonly
* Signature: (Lorg/sqlite/jni/sqlite3_stmt;)Z
* Signature: (J)Z
*/
JNIEXPORT jboolean JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1stmt_1readonly
(JNIEnv *, jclass, jobject);
(JNIEnv *, jclass, jlong);
/*
* Class: org_sqlite_jni_SQLite3Jni
@ -1886,10 +1894,10 @@ JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1strlike
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_system_errno
* Signature: (Lorg/sqlite/jni/sqlite3;)I
* Signature: (J)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1system_1errno
(JNIEnv *, jclass, jobject);
(JNIEnv *, jclass, jlong);
/*
* Class: org_sqlite_jni_SQLite3Jni
@ -1910,18 +1918,18 @@ JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1threadsafe
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_total_changes
* Signature: (Lorg/sqlite/jni/sqlite3;)I
* Signature: (J)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1total_1changes
(JNIEnv *, jclass, jobject);
(JNIEnv *, jclass, jlong);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_total_changes64
* Signature: (Lorg/sqlite/jni/sqlite3;)J
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1total_1changes64
(JNIEnv *, jclass, jobject);
(JNIEnv *, jclass, jlong);
/*
* Class: org_sqlite_jni_SQLite3Jni
@ -1942,146 +1950,146 @@ JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1txn_1state
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_update_hook
* Signature: (Lorg/sqlite/jni/sqlite3;Lorg/sqlite/jni/UpdateHookCallback;)Lorg/sqlite/jni/UpdateHookCallback;
* Signature: (JLorg/sqlite/jni/UpdateHookCallback;)Lorg/sqlite/jni/UpdateHookCallback;
*/
JNIEXPORT jobject JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1update_1hook
(JNIEnv *, jclass, jobject, jobject);
(JNIEnv *, jclass, jlong, jobject);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_value_blob
* Signature: (Lorg/sqlite/jni/sqlite3_value;)[B
* Signature: (J)[B
*/
JNIEXPORT jbyteArray JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1value_1blob
(JNIEnv *, jclass, jobject);
(JNIEnv *, jclass, jlong);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_value_bytes
* Signature: (Lorg/sqlite/jni/sqlite3_value;)I
* Signature: (J)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1value_1bytes
(JNIEnv *, jclass, jobject);
(JNIEnv *, jclass, jlong);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_value_bytes16
* Signature: (Lorg/sqlite/jni/sqlite3_value;)I
* Signature: (J)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1value_1bytes16
(JNIEnv *, jclass, jobject);
(JNIEnv *, jclass, jlong);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_value_double
* Signature: (Lorg/sqlite/jni/sqlite3_value;)D
* Signature: (J)D
*/
JNIEXPORT jdouble JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1value_1double
(JNIEnv *, jclass, jobject);
(JNIEnv *, jclass, jlong);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_value_dup
* Signature: (Lorg/sqlite/jni/sqlite3_value;)Lorg/sqlite/jni/sqlite3_value;
* Signature: (J)Lorg/sqlite/jni/sqlite3_value;
*/
JNIEXPORT jobject JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1value_1dup
(JNIEnv *, jclass, jobject);
(JNIEnv *, jclass, jlong);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_value_encoding
* Signature: (Lorg/sqlite/jni/sqlite3_value;)I
* Signature: (J)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1value_1encoding
(JNIEnv *, jclass, jobject);
(JNIEnv *, jclass, jlong);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_value_free
* Signature: (Lorg/sqlite/jni/sqlite3_value;)V
* Signature: (J)V
*/
JNIEXPORT void JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1value_1free
(JNIEnv *, jclass, jobject);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_value_int
* Signature: (Lorg/sqlite/jni/sqlite3_value;)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1value_1int
(JNIEnv *, jclass, jobject);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_value_int64
* Signature: (Lorg/sqlite/jni/sqlite3_value;)J
*/
JNIEXPORT jlong JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1value_1int64
(JNIEnv *, jclass, jobject);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_value_java_object
* Signature: (Lorg/sqlite/jni/sqlite3_value;)Ljava/lang/Object;
*/
JNIEXPORT jobject JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1value_1java_1object
(JNIEnv *, jclass, jobject);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_value_text
* Signature: (Lorg/sqlite/jni/sqlite3_value;)[B
*/
JNIEXPORT jbyteArray JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1value_1text
(JNIEnv *, jclass, jobject);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_value_text16
* Signature: (Lorg/sqlite/jni/sqlite3_value;)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1value_1text16
(JNIEnv *, jclass, jobject);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_value_type
* Signature: (Lorg/sqlite/jni/sqlite3_value;)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1value_1type
(JNIEnv *, jclass, jobject);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_value_numeric_type
* Signature: (Lorg/sqlite/jni/sqlite3_value;)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1value_1numeric_1type
(JNIEnv *, jclass, jobject);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_value_nochange
* Signature: (Lorg/sqlite/jni/sqlite3_value;)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1value_1nochange
(JNIEnv *, jclass, jobject);
(JNIEnv *, jclass, jlong);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_value_frombind
* Signature: (Lorg/sqlite/jni/sqlite3_value;)I
* Signature: (J)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1value_1frombind
(JNIEnv *, jclass, jobject);
(JNIEnv *, jclass, jlong);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_value_int
* Signature: (J)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1value_1int
(JNIEnv *, jclass, jlong);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_value_int64
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1value_1int64
(JNIEnv *, jclass, jlong);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_value_java_object
* Signature: (J)Ljava/lang/Object;
*/
JNIEXPORT jobject JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1value_1java_1object
(JNIEnv *, jclass, jlong);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_value_nochange
* Signature: (J)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1value_1nochange
(JNIEnv *, jclass, jlong);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_value_numeric_type
* Signature: (J)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1value_1numeric_1type
(JNIEnv *, jclass, jlong);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_value_subtype
* Signature: (Lorg/sqlite/jni/sqlite3_value;)I
* Signature: (J)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1value_1subtype
(JNIEnv *, jclass, jobject);
(JNIEnv *, jclass, jlong);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_value_text
* Signature: (J)[B
*/
JNIEXPORT jbyteArray JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1value_1text
(JNIEnv *, jclass, jlong);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_value_text16
* Signature: (J)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1value_1text16
(JNIEnv *, jclass, jlong);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_value_type
* Signature: (J)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1value_1type
(JNIEnv *, jclass, jlong);
/*
* Class: org_sqlite_jni_SQLite3Jni
@ -2091,6 +2099,35 @@ JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1value_1subtype
JNIEXPORT void JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1jni_1internal_1details
(JNIEnv *, jclass);
#ifdef __cplusplus
}
#endif
#endif
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_sqlite_jni_SQLTester */
#ifndef _Included_org_sqlite_jni_SQLTester
#define _Included_org_sqlite_jni_SQLTester
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: org_sqlite_jni_SQLTester
* Method: strglob
* Signature: ([B[B)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLTester_strglob
(JNIEnv *, jclass, jbyteArray, jbyteArray);
/*
* Class: org_sqlite_jni_SQLTester
* Method: installCustomExtensions
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_sqlite_jni_SQLTester_installCustomExtensions
(JNIEnv *, jclass);
#ifdef __cplusplus
}
#endif
@ -2320,32 +2357,3 @@ JNIEXPORT jint JNICALL Java_org_sqlite_jni_fts5_fts5_1tokenizer_xTokenize
}
#endif
#endif
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_sqlite_jni_tester_SQLTester */
#ifndef _Included_org_sqlite_jni_tester_SQLTester
#define _Included_org_sqlite_jni_tester_SQLTester
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: org_sqlite_jni_tester_SQLTester
* Method: strglob
* Signature: ([B[B)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_tester_SQLTester_strglob
(JNIEnv *, jclass, jbyteArray, jbyteArray);
/*
* Class: org_sqlite_jni_tester_SQLTester
* Method: installCustomExtensions
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_sqlite_jni_tester_SQLTester_installCustomExtensions
(JNIEnv *, jclass);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -29,5 +29,18 @@ package org.sqlite.jni;
public class NativePointerHolder<ContextType> {
//! Only set from JNI, where access permissions don't matter.
private volatile long nativePointer = 0;
/**
For use ONLY by package-level APIs which act as proxies for
close/finalize operations. Such ops must call this to zero out
the pointer so that this object is not carrying a stale
pointer. This function returns the prior value of the pointer and
sets it to 0.
*/
final long clearNativePointer() {
final long rv = nativePointer;
nativePointer= 0;
return rv;
}
public final long getNativePointer(){ return nativePointer; }
}

View File

@ -12,16 +12,13 @@
** This file contains the main application entry pointer for the
** SQLTester framework.
*/
package org.sqlite.jni.tester;
package org.sqlite.jni;
import java.util.List;
import java.util.ArrayList;
import java.util.Arrays;
import java.nio.charset.StandardCharsets;
import java.util.regex.*;
import org.sqlite.jni.*;
import static org.sqlite.jni.SQLite3Jni.*;
import org.sqlite.jni.sqlite3;
/**
Modes for how to escape (or not) column values and names from
@ -150,12 +147,15 @@ class Outer {
}
/**
This class provides an application which aims to implement the
<p>This class provides an application which aims to implement the
rudimentary SQL-driven test tool described in the accompanying
{@code test-script-interpreter.md}.
<p>This is a work in progress.
<p>This class is an internal testing tool, not part of the public
interface but is (A) in the same package as the library because
access permissions require it to be so and (B) the JDK8 javadoc
offers no way to filter individual classes out of the doc
generation process (it can only exclude packages, but see (A)).
<p>An instance of this application provides a core set of services
which TestScript instances use for processing testing logic.

File diff suppressed because it is too large Load Diff

View File

@ -1283,7 +1283,7 @@ public class Tester1 implements Runnable {
}
Exception err = null;
try {
Class t = Class.forName("org.sqlite.jni.fts5.TesterFts5");
Class t = Class.forName("org.sqlite.jni.TesterFts5");
java.lang.reflect.Constructor ctor = t.getConstructor();
ctor.setAccessible(true);
final long timeStart = System.currentTimeMillis();
@ -1515,35 +1515,34 @@ public class Tester1 implements Runnable {
}
private void testBackup(){
final sqlite3 db1 = createNewDb();
final sqlite3 db2 = createNewDb();
final sqlite3 dbDest = createNewDb();
execSql(db1, new String[]{
"pragma page_size=512; VACUUM;",
"create table t(a);",
"insert into t(a) values(1),(2),(3);"
});
affirm( null==sqlite3_backup_init(db1,"main",db1,"main") );
final sqlite3_backup b = sqlite3_backup_init(db2,"main",db1,"main");
affirm( null!=b );
affirm( b.getNativePointer()!=0 );
int rc;
while( SQLITE_DONE!=(rc = sqlite3_backup_step(b, 1)) ){
affirm( 0==rc );
try (sqlite3 dbSrc = createNewDb()) {
execSql(dbSrc, new String[]{
"pragma page_size=512; VACUUM;",
"create table t(a);",
"insert into t(a) values(1),(2),(3);"
});
affirm( null==sqlite3_backup_init(dbSrc,"main",dbSrc,"main") );
try (sqlite3_backup b = sqlite3_backup_init(dbDest,"main",dbSrc,"main")) {
affirm( null!=b );
affirm( b.getNativePointer()!=0 );
int rc;
while( SQLITE_DONE!=(rc = sqlite3_backup_step(b, 1)) ){
affirm( 0==rc );
}
affirm( sqlite3_backup_pagecount(b) > 0 );
rc = sqlite3_backup_finish(b);
affirm( 0==rc );
affirm( b.getNativePointer()==0 );
}
}
affirm( sqlite3_backup_pagecount(b) > 0 );
rc = sqlite3_backup_finish(b);
affirm( 0==rc );
affirm( b.getNativePointer()==0 );
sqlite3_close_v2(db1);
final sqlite3_stmt stmt = prepare(db2,"SELECT sum(a) from t");
sqlite3_step(stmt);
affirm( sqlite3_column_int(stmt,0) == 6 );
sqlite3_finalize(stmt);
sqlite3_close_v2(db2);
try (sqlite3_stmt stmt = prepare(dbDest,"SELECT sum(a) from t")) {
sqlite3_step(stmt);
affirm( sqlite3_column_int(stmt,0) == 6 );
}
sqlite3_close_v2(dbDest);
}
private void testRandomness(){

View File

@ -11,10 +11,11 @@
*************************************************************************
** This file contains a set of tests for the sqlite3 JNI bindings.
*/
package org.sqlite.jni.fts5;
package org.sqlite.jni;
import static org.sqlite.jni.SQLite3Jni.*;
import static org.sqlite.jni.Tester1.*;
import org.sqlite.jni.*;
import org.sqlite.jni.fts5.*;
import java.util.*;

View File

@ -1,3 +1,16 @@
/*
** 2023-09-27
**
** 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 houses the Canonical annotaion for the sqlite3 C API.
*/
package org.sqlite.jni.annotation;
/**

View File

@ -1,3 +1,16 @@
/*
** 2023-09-27
**
** 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 houses the NotNull annotaion for the sqlite3 C API.
*/
package org.sqlite.jni.annotation;
/**
@ -20,6 +33,11 @@ package org.sqlite.jni.annotation;
any parameter marked with this annoation specifically invokes
undefined behavior.</p>
<p>Passing 0 (i.e. C NULL) or a negative value for any long-type
parameter marked with this annoation specifically invokes undefined
behavior. Such values are treated as C pointers in the JNI
layer.</p>
<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
@ -29,10 +47,11 @@ package org.sqlite.jni.annotation;
programmatically ensure that NotNull is conformed to in client
code.</p>
<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
annotated functions. It is not part of the public API and
client-level code must not rely on it.</p>
<p>This annotation is solely for the use by the classes in the
org.sqlite package and subpackages, but is made public so that
javadoc will link to it from the annotated functions. It is not
part of the public API and client-level code must not rely on
it.</p>
*/
@java.lang.annotation.Documented
@java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE)

View File

@ -1,3 +1,16 @@
/*
** 2023-09-27
**
** 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 houses the Nullable annotaion for the sqlite3 C API.
*/
package org.sqlite.jni.annotation;
/**

View File

@ -1,4 +1,17 @@
/*
** 2023-09-27
**
** 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 package houses annotations specific a JNI binding to the SQLite3 C API.
This package houses annotations specific to the JNI bindings of the
SQLite3 C API.
*/
package org.sqlite.jni.annotation;

View File

@ -39,10 +39,10 @@ public final class sqlite3 extends NativePointerHolder<sqlite3>
@Override protected void finalize(){
//System.out.println(this+".finalize()");
SQLite3Jni.sqlite3_close_v2(this);
SQLite3Jni.sqlite3_close_v2(this.clearNativePointer());
}
@Override public void close(){
SQLite3Jni.sqlite3_close_v2(this);
SQLite3Jni.sqlite3_close_v2(this.clearNativePointer());
}
}

View File

@ -19,7 +19,13 @@ package org.sqlite.jni;
simply provide a type-safe way to communicate it between Java and C
via JNI.
*/
public final class sqlite3_backup extends NativePointerHolder<sqlite3_backup> {
public final class sqlite3_backup extends NativePointerHolder<sqlite3_backup>
implements AutoCloseable {
// Only invoked from JNI.
private sqlite3_backup(){}
@Override public void close(){
SQLite3Jni.sqlite3_backup_finish(this);
}
}

View File

@ -19,7 +19,13 @@ package org.sqlite.jni;
simply provide a type-safe way to communicate it between Java and C
via JNI.
*/
public final class sqlite3_blob extends NativePointerHolder<sqlite3_blob> {
public final class sqlite3_blob extends NativePointerHolder<sqlite3_blob>
implements AutoCloseable {
// Only invoked from JNI.
private sqlite3_blob(){}
@Override public void close(){
SQLite3Jni.sqlite3_blob_close(this.clearNativePointer());
}
}

View File

@ -26,10 +26,10 @@ public final class sqlite3_stmt extends NativePointerHolder<sqlite3_stmt>
//For as-yet-unknown reasons, this triggers a JVM crash.
//@Override protected void finalize(){
// SQLite3Jni.sqlite3_finalize(this);
// SQLite3Jni.sqlite3_finalize(this.clearNativePointer());
//}
@Override public void close(){
SQLite3Jni.sqlite3_finalize(this);
SQLite3Jni.sqlite3_finalize(this.clearNativePointer());
}
}