mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-29 08:01:23 +03:00
Correct a Tester1.java test which inadvertently created a spurious db file in the current dir. Unrelated minor cleanups.
FossilOrigin-Name: 016bbdadbf9f95cef185d2606c23e3b3c724586fcca470e11e6fbdbaefd75c79
This commit is contained in:
@ -2303,7 +2303,7 @@ S3JniApi(sqlite3_bind_text(),jint,1bind_1text)(
|
||||
return (jint)rc;
|
||||
}
|
||||
|
||||
S3JniApi(sqlite3_text16(),jint,1bind_1text16)(
|
||||
S3JniApi(sqlite3_bind_text16(),jint,1bind_1text16)(
|
||||
JniArgsEnvClass, jobject jpStmt, jint ndx, jbyteArray baData, jint nMax
|
||||
){
|
||||
jbyte * const pBuf = baData ? s3jni_jbytearray_bytes(baData) : 0;
|
||||
@ -2412,7 +2412,7 @@ S3JniApi(sqlite3_cancel_auto_extension(),jboolean,1cancel_1auto_1extension)(
|
||||
jboolean rc = JNI_FALSE;
|
||||
int i;
|
||||
S3JniAutoExt_mutex_enter;
|
||||
/* This algo mirrors the one in the core. */
|
||||
/* This algo corresponds to the one in the core. */
|
||||
for( i = SJG.autoExt.nExt-1; i >= 0; --i ){
|
||||
ax = &SJG.autoExt.aExt[i];
|
||||
if( ax->jObj && (*env)->IsSameObject(env, ax->jObj, jAutoExt) ){
|
||||
@ -2430,7 +2430,6 @@ S3JniApi(sqlite3_cancel_auto_extension(),jboolean,1cancel_1auto_1extension)(
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
/* Wrapper for sqlite3_close(_v2)(). */
|
||||
static jint s3jni_close_db(JNIEnv * const env, jobject jDb, int version){
|
||||
int rc = 0;
|
||||
@ -2586,8 +2585,7 @@ S3JniApi(sqlite3_column_text(),jbyteArray,1column_1text)(
|
||||
}
|
||||
|
||||
#if 0
|
||||
// this impl might prove useful, but we'd need to publish the
|
||||
// bytearray-returning impl with a different name.
|
||||
// this impl might prove useful.
|
||||
S3JniApi(sqlite3_column_text(),jstring,1column_1text)(
|
||||
JniArgsEnvClass, jobject jpStmt, jint ndx
|
||||
){
|
||||
@ -2648,11 +2646,15 @@ static void s3jni_rollback_hook_impl(void *pP){
|
||||
(void)s3jni_commit_rollback_hook_impl(0, pP);
|
||||
}
|
||||
|
||||
/*
|
||||
** Proxy for sqlite3_commit_hook() (if isCommit is true) or
|
||||
** sqlite3_rollback_hook().
|
||||
*/
|
||||
static jobject s3jni_commit_rollback_hook(int isCommit, JNIEnv * const env,
|
||||
jobject jDb, jobject jHook){
|
||||
S3JniDb * ps;
|
||||
jobject pOld = 0;
|
||||
S3JniHook * pHook;
|
||||
jobject pOld = 0; /* previous hoook */
|
||||
S3JniHook * pHook; /* ps->hooks.commit|rollback */
|
||||
|
||||
S3JniDb_mutex_enter;
|
||||
ps = S3JniDb_from_java(jDb);
|
||||
@ -2684,7 +2686,7 @@ static jobject s3jni_commit_rollback_hook(int isCommit, JNIEnv * const env,
|
||||
S3JniExceptionReport;
|
||||
S3JniExceptionClear;
|
||||
s3jni_db_error(ps->pDb, SQLITE_ERROR,
|
||||
"Cannot not find matching call() in"
|
||||
"Cannot not find matching call() method in"
|
||||
"hook object.");
|
||||
}else{
|
||||
pHook->midCallback = xCallback;
|
||||
@ -2711,9 +2713,10 @@ S3JniApi(sqlite3_commit_hook(),jobject,1commit_1hook)(
|
||||
S3JniApi(sqlite3_compileoption_get(),jstring,1compileoption_1get)(
|
||||
JniArgsEnvClass, jint n
|
||||
){
|
||||
jstring const rv = (*env)->NewStringUTF( env, sqlite3_compileoption_get(n) )
|
||||
const char * z = sqlite3_compileoption_get(n);
|
||||
jstring const rv = z ? (*env)->NewStringUTF( env, z ) : 0;
|
||||
/* We know these to be ASCII, so MUTF-8 is fine. */;
|
||||
s3jni_oom_check(rv);
|
||||
s3jni_oom_check(z ? !!rv : 1);
|
||||
return rv;
|
||||
}
|
||||
|
||||
@ -4382,8 +4385,7 @@ S3JniApi(sqlite3_value_text(),jbyteArray,1value_1text)(
|
||||
}
|
||||
|
||||
#if 0
|
||||
// this impl might prove useful, but we'd need to publish the
|
||||
// bytearray-returning impl with a different name.
|
||||
// this impl might prove useful.
|
||||
S3JniApi(sqlite3_value_text(),jstring,1value_1text)(
|
||||
JniArgsEnvClass, jobject jpSVal
|
||||
){
|
||||
|
@ -220,7 +220,15 @@ public class Tester1 implements Runnable {
|
||||
outln("\t"+optName+"\t (used="+
|
||||
sqlite3_compileoption_used(optName)+")");
|
||||
}
|
||||
}
|
||||
|
||||
private void testCompileOption(){
|
||||
int i = 0;
|
||||
String optName;
|
||||
for( ; null != (optName = sqlite3_compileoption_get(i)); ++i){
|
||||
}
|
||||
affirm( i > 10 );
|
||||
affirm( null==sqlite3_compileoption_get(-1) );
|
||||
}
|
||||
|
||||
private void testOpenDb1(){
|
||||
@ -1330,7 +1338,7 @@ public class Tester1 implements Runnable {
|
||||
|
||||
sqlite3 db = createNewDb();
|
||||
affirm( 4==val.value );
|
||||
execSql(db, "ATTACH ':memory' as foo");
|
||||
execSql(db, "ATTACH ':memory:' as foo");
|
||||
affirm( 4==val.value, "ATTACH uses the same connection, not sub-connections." );
|
||||
sqlite3_close(db);
|
||||
db = null;
|
||||
@ -1450,19 +1458,17 @@ public class Tester1 implements Runnable {
|
||||
rc = sqlite3_stmt_explain(stmt, 2);
|
||||
affirm( 2 == sqlite3_stmt_isexplain(stmt) );
|
||||
sqlite3_finalize(stmt);
|
||||
|
||||
|
||||
sqlite3_close_v2(db);
|
||||
}
|
||||
|
||||
private void testLimit(){
|
||||
final sqlite3 db = createNewDb();
|
||||
int v;
|
||||
|
||||
int v1, v2;
|
||||
v1 = sqlite3_limit(db, SQLITE_LIMIT_LENGTH, -1);
|
||||
affirm( v1 > 0 );
|
||||
affirm( v1 == sqlite3_limit(db, SQLITE_LIMIT_LENGTH, v1-1) );
|
||||
affirm( v1-1 == sqlite3_limit(db, SQLITE_LIMIT_LENGTH, -1) );
|
||||
v = sqlite3_limit(db, SQLITE_LIMIT_LENGTH, -1);
|
||||
affirm( v > 0 );
|
||||
affirm( v == sqlite3_limit(db, SQLITE_LIMIT_LENGTH, v-1) );
|
||||
affirm( v-1 == sqlite3_limit(db, SQLITE_LIMIT_LENGTH, -1) );
|
||||
sqlite3_close_v2(db);
|
||||
}
|
||||
|
||||
|
@ -475,12 +475,12 @@ public class SQLTester {
|
||||
the db's result code.
|
||||
|
||||
appendMode specifies how/whether to append results to the result
|
||||
buffer. lineMode specifies whether to output all results in a
|
||||
buffer. rowMode specifies whether to output all results in a
|
||||
single line or one line per row. If appendMode is
|
||||
ResultBufferMode.NONE then lineMode is ignored and may be null.
|
||||
ResultBufferMode.NONE then rowMode is ignored and may be null.
|
||||
*/
|
||||
public int execSql(sqlite3 db, boolean throwOnError,
|
||||
ResultBufferMode appendMode, ResultRowMode lineMode,
|
||||
ResultBufferMode appendMode, ResultRowMode rowMode,
|
||||
String sql) throws SQLTesterException {
|
||||
if( null==db && null==aDb[0] ){
|
||||
// Delay opening of the initial db to enable tests to change its
|
||||
@ -562,7 +562,7 @@ public class SQLTester {
|
||||
throw new SQLTesterException("Unhandled ResultBufferMode: "+appendMode);
|
||||
}
|
||||
}
|
||||
if( ResultRowMode.NEWLINE == lineMode ){
|
||||
if( ResultRowMode.NEWLINE == rowMode ){
|
||||
spacing = 0;
|
||||
sb.append('\n');
|
||||
}
|
||||
@ -1128,8 +1128,9 @@ class TestScript {
|
||||
}
|
||||
|
||||
public String getOutputPrefix(){
|
||||
String rc = "["+(moduleName==null ? filename : moduleName)+"]";
|
||||
String rc = "["+(moduleName==null ? "<unnamed>" : moduleName)+"]";
|
||||
if( null!=testCaseName ) rc += "["+testCaseName+"]";
|
||||
if( null!=filename ) rc += "["+filename+"]";
|
||||
return rc + " line "+ cur.lineNo;
|
||||
}
|
||||
|
||||
@ -1273,6 +1274,7 @@ class TestScript {
|
||||
}
|
||||
|
||||
private boolean checkRequiredProperties(SQLTester t, String[] props) throws SQLTesterException{
|
||||
if( true ) return false;
|
||||
int nOk = 0;
|
||||
for(String rp : props){
|
||||
verbose1("REQUIRED_PROPERTIES: ",rp);
|
||||
@ -1293,6 +1295,12 @@ class TestScript {
|
||||
t.appendDbInitSql("pragma temp_store=0;");
|
||||
++nOk;
|
||||
break;
|
||||
case "AUTOVACUUM":
|
||||
t.appendDbInitSql("pragma auto_vacuum=full;");
|
||||
++nOk;
|
||||
case "INCRVACUUM":
|
||||
t.appendDbInitSql("pragma auto_vacuum=incremental;");
|
||||
++nOk;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -1331,9 +1339,9 @@ class TestScript {
|
||||
m = patternRequiredProperties.matcher(line);
|
||||
if( m.find() ){
|
||||
final String rp = m.group(1);
|
||||
//if( ! checkRequiredProperties( tester, rp.split("\\s+") ) ){
|
||||
throw new IncompatibleDirective(this, "REQUIRED_PROPERTIES: "+rp);
|
||||
//}
|
||||
if( ! checkRequiredProperties( tester, rp.split("\\s+") ) ){
|
||||
throw new IncompatibleDirective(this, "REQUIRED_PROPERTIES: "+rp);
|
||||
}
|
||||
}
|
||||
m = patternMixedModuleName.matcher(line);
|
||||
if( m.find() ){
|
||||
|
@ -6,7 +6,8 @@
|
||||
** xMODULE_NAME: module-name
|
||||
** xREQUIRED_PROPERTIES: small fast reliable
|
||||
** xREQUIRED_PROPERTIES: RECURSIVE_TRIGGERS
|
||||
** xREQUIRED_PROPERTIES: TEMPSTORE_MEM TEMPSTORE_FILE
|
||||
** xREQUIRED_PROPERTIES: TEMPSTORE_FILE TEMPSTORE_MEM
|
||||
** xREQUIRED_PROPERTIES: AUTOVACUUM INCRVACUUM
|
||||
**
|
||||
*/
|
||||
--print starting up 😃
|
||||
|
Reference in New Issue
Block a user