From: dan Date: Thu, 14 Sep 2023 17:42:34 +0000 (+0000) Subject: Add a test for the java version of Fts5ExtensionApi.xRowid(). X-Git-Tag: version-3.44.0~199 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9ba2d13ed364f0574f0ea5ecb0d688de35bc7837;p=thirdparty%2Fsqlite.git Add a test for the java version of Fts5ExtensionApi.xRowid(). FossilOrigin-Name: 227facf879d2ade348cdb51f5b50ba2f95b8621acc0cf7a5fed4a310b4c76baa --- diff --git a/ext/jni/src/org/sqlite/jni/fts5/TesterFts5.java b/ext/jni/src/org/sqlite/jni/fts5/TesterFts5.java index 5c4742c72e..621492e2de 100644 --- a/ext/jni/src/org/sqlite/jni/fts5/TesterFts5.java +++ b/ext/jni/src/org/sqlite/jni/fts5/TesterFts5.java @@ -16,6 +16,8 @@ import static org.sqlite.jni.SQLite3Jni.*; import static org.sqlite.jni.Tester1.*; import org.sqlite.jni.*; +import java.util.*; + public class TesterFts5 { private static void test1(){ @@ -76,8 +78,99 @@ public class TesterFts5 { affirm( 1==outputs[1] ); } + /* + ** Argument sql is a string containing one or more SQL statements + ** separated by ";" characters. This function executes each of these + ** statements against the database passed as the first argument. If + ** no error occurs, the results of the SQL script are returned as + ** an array of strings. If an error does occur, a RuntimeException is + ** thrown. + */ + private static String[] sqlite3_exec(sqlite3 db, String sql) { + List aOut = new ArrayList(); + + /* Iterate through the list of SQL statements. For each, step through + ** it and add any results to the aOut[] array. */ + int rc = sqlite3_prepare_multi(db, sql, new PrepareMultiCallback() { + @Override public int call(sqlite3_stmt pStmt){ + while( SQLITE_ROW==sqlite3_step(pStmt) ){ + int ii; + for(ii=0; ii