mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-30 19:03:16 +03:00
JNI: part 2 of typos and Java style tweaks suggested in [forum:99ac7961d82f57f3|forum post 99ac7961d82f57f3].
FossilOrigin-Name: 5e6e9aee5b43e6ae98e78293a0da30e82ad18c3c9c03fc6298240233ddadb2a2
This commit is contained in:
@ -1342,7 +1342,7 @@ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1data_1count
|
||||
* Method: sqlite3_db_config
|
||||
* Signature: (Lorg/sqlite/jni/capi/sqlite3;IILorg/sqlite/jni/capi/OutputPointer/Int32;)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1db_1config__Lorg_sqlite_jni_capi_sqlite3_2IILorg_sqlite_jni_capi_OutputPointer_00024Int32_2
|
||||
JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1db_1config__Lorg_sqlite_jni_capi_sqlite3_2IILorg_sqlite_jni_capi_OutputPointer_Int32_2
|
||||
(JNIEnv *, jclass, jobject, jint, jint, jobject);
|
||||
|
||||
/*
|
||||
|
@ -18,11 +18,11 @@ package org.sqlite.jni.capi;
|
||||
They are populated only via that interface.
|
||||
*/
|
||||
public final class TableColumnMetadata {
|
||||
OutputPointer.Bool pNotNull = new OutputPointer.Bool();
|
||||
OutputPointer.Bool pPrimaryKey = new OutputPointer.Bool();
|
||||
OutputPointer.Bool pAutoinc = new OutputPointer.Bool();
|
||||
OutputPointer.String pzCollSeq = new OutputPointer.String();
|
||||
OutputPointer.String pzDataType = new OutputPointer.String();
|
||||
final OutputPointer.Bool pNotNull = new OutputPointer.Bool();
|
||||
final OutputPointer.Bool pPrimaryKey = new OutputPointer.Bool();
|
||||
final OutputPointer.Bool pAutoinc = new OutputPointer.Bool();
|
||||
final OutputPointer.String pzCollSeq = new OutputPointer.String();
|
||||
final OutputPointer.String pzDataType = new OutputPointer.String();
|
||||
|
||||
public TableColumnMetadata(){
|
||||
}
|
||||
|
@ -19,7 +19,6 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
/**
|
||||
An annotation for Tester1 tests which we do not want to run in
|
||||
@ -62,13 +61,13 @@ public class Tester1 implements Runnable {
|
||||
//! List of test*() methods to run.
|
||||
private static List<java.lang.reflect.Method> testMethods = null;
|
||||
//! List of exceptions collected by run()
|
||||
private static List<Exception> listErrors = new ArrayList<>();
|
||||
private static final List<Exception> listErrors = new ArrayList<>();
|
||||
private static final class Metrics {
|
||||
//! Number of times createNewDb() (or equivalent) is invoked.
|
||||
volatile int dbOpen = 0;
|
||||
}
|
||||
|
||||
private Integer tId;
|
||||
private final Integer tId;
|
||||
|
||||
Tester1(Integer id){
|
||||
tId = id;
|
||||
@ -78,7 +77,7 @@ public class Tester1 implements Runnable {
|
||||
|
||||
public static synchronized void outln(){
|
||||
if( !quietMode ){
|
||||
System.out.println("");
|
||||
System.out.println();
|
||||
}
|
||||
}
|
||||
|
||||
@ -523,7 +522,7 @@ public class Tester1 implements Runnable {
|
||||
}
|
||||
sqlite3_finalize(stmt);
|
||||
affirm(3 == n);
|
||||
affirm("w😃rldhell🤩!🤩".equals(sbuf.toString()));
|
||||
affirm("w😃rldhell🤩!🤩".contentEquals(sbuf));
|
||||
|
||||
try( sqlite3_stmt stmt2 = prepare(db, "SELECT ?, ?") ){
|
||||
rc = sqlite3_bind_text(stmt2, 1, "");
|
||||
@ -668,7 +667,7 @@ public class Tester1 implements Runnable {
|
||||
execSql(db, "CREATE TABLE t(a); INSERT INTO t(a) VALUES('a'),('b'),('c')");
|
||||
final ValueHolder<Integer> xDestroyCalled = new ValueHolder<>(0);
|
||||
final CollationCallback myCollation = new CollationCallback() {
|
||||
private String myState =
|
||||
private final String myState =
|
||||
"this is local state. There is much like it, but this is mine.";
|
||||
@Override
|
||||
// Reverse-sorts its inputs...
|
||||
@ -847,7 +846,7 @@ public class Tester1 implements Runnable {
|
||||
SQLFunction funcAgg = new AggregateFunction<Integer>(){
|
||||
@Override public void xStep(sqlite3_context cx, sqlite3_value[] args){
|
||||
/** Throwing from here should emit loud noise on stdout or stderr
|
||||
but the exception is supressed because we have no way to inform
|
||||
but the exception is suppressed because we have no way to inform
|
||||
sqlite about it from these callbacks. */
|
||||
//throw new RuntimeException("Throwing from an xStep");
|
||||
}
|
||||
@ -1850,7 +1849,7 @@ public class Tester1 implements Runnable {
|
||||
"; insert into t(a) values(1),(2),(3);",
|
||||
"select a from t;"
|
||||
};
|
||||
final List<sqlite3_stmt> liStmt = new ArrayList<sqlite3_stmt>();
|
||||
final List<sqlite3_stmt> liStmt = new ArrayList<>();
|
||||
final PrepareMultiCallback proxy = new PrepareMultiCallback.StepAll();
|
||||
final ValueHolder<String> toss = new ValueHolder<>(null);
|
||||
PrepareMultiCallback m = new PrepareMultiCallback() {
|
||||
@ -1984,9 +1983,9 @@ public class Tester1 implements Runnable {
|
||||
-v: emit some developer-mode info at the end.
|
||||
*/
|
||||
public static void main(String[] args) throws Exception {
|
||||
Integer nThread = 1;
|
||||
int nThread = 1;
|
||||
boolean doSomethingForDev = false;
|
||||
Integer nRepeat = 1;
|
||||
int nRepeat = 1;
|
||||
boolean forceFail = false;
|
||||
boolean sqlLog = false;
|
||||
boolean configLog = false;
|
||||
@ -2048,7 +2047,7 @@ public class Tester1 implements Runnable {
|
||||
final ConfigLogCallback log = new ConfigLogCallback() {
|
||||
@Override public void call(int code, String msg){
|
||||
outln("ConfigLogCallback: ",ResultCode.getEntryForInt(code),": ", msg);
|
||||
};
|
||||
}
|
||||
};
|
||||
int rc = sqlite3_config( log );
|
||||
affirm( 0==rc );
|
||||
|
@ -33,5 +33,5 @@ public interface XDestroyCallback {
|
||||
each individual reference, leading to memory corruption or a
|
||||
crash via duplicate free().
|
||||
*/
|
||||
public void xDestroy();
|
||||
void xDestroy();
|
||||
}
|
||||
|
@ -12,7 +12,6 @@
|
||||
** This file is part of the JNI bindings for the sqlite3 C API.
|
||||
*/
|
||||
package org.sqlite.jni.fts5;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import org.sqlite.jni.capi.*;
|
||||
import org.sqlite.jni.annotation.*;
|
||||
|
||||
@ -24,7 +23,7 @@ public final class Fts5ExtensionApi extends NativePointerHolder<Fts5ExtensionApi
|
||||
private final int iVersion = 2;
|
||||
|
||||
/* Callback type for used by xQueryPhrase(). */
|
||||
public static interface XQueryPhraseCallback {
|
||||
public interface XQueryPhraseCallback {
|
||||
int call(Fts5ExtensionApi fapi, Fts5Context cx);
|
||||
}
|
||||
|
||||
|
@ -12,12 +12,11 @@
|
||||
** This file contains a set of tests for the sqlite3 JNI bindings.
|
||||
*/
|
||||
package org.sqlite.jni.fts5;
|
||||
import java.util.*;
|
||||
import static org.sqlite.jni.capi.CApi.*;
|
||||
import static org.sqlite.jni.capi.Tester1.*;
|
||||
import org.sqlite.jni.capi.*;
|
||||
import org.sqlite.jni.fts5.*;
|
||||
|
||||
import java.util.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
public class TesterFts5 {
|
||||
|
||||
@ -88,7 +87,7 @@ public class TesterFts5 {
|
||||
** thrown.
|
||||
*/
|
||||
private static String[] sqlite3_exec(sqlite3 db, String sql) {
|
||||
List<String> aOut = new ArrayList<String>();
|
||||
List<String> aOut = new ArrayList<>();
|
||||
|
||||
/* Iterate through the list of SQL statements. For each, step through
|
||||
** it and add any results to the aOut[] array. */
|
||||
@ -137,14 +136,14 @@ public class TesterFts5 {
|
||||
** fts5_columncount()
|
||||
*/
|
||||
private static void create_test_functions(sqlite3 db){
|
||||
/*
|
||||
/*
|
||||
** A user-defined-function fts5_rowid() that uses xRowid()
|
||||
*/
|
||||
fts5_extension_function fts5_rowid = new fts5_extension_function(){
|
||||
@Override public void call(
|
||||
Fts5ExtensionApi ext,
|
||||
Fts5ExtensionApi ext,
|
||||
Fts5Context fCx,
|
||||
sqlite3_context pCx,
|
||||
sqlite3_context pCx,
|
||||
sqlite3_value argv[]
|
||||
){
|
||||
long rowid = ext.xRowid(fCx);
|
||||
@ -153,14 +152,14 @@ public class TesterFts5 {
|
||||
public void xDestroy(){ }
|
||||
};
|
||||
|
||||
/*
|
||||
** fts5_columncount() - xColumnCount()
|
||||
/*
|
||||
** fts5_columncount() - xColumnCount()
|
||||
*/
|
||||
fts5_extension_function fts5_columncount = new fts5_extension_function(){
|
||||
@Override public void call(
|
||||
Fts5ExtensionApi ext,
|
||||
Fts5ExtensionApi ext,
|
||||
Fts5Context fCx,
|
||||
sqlite3_context pCx,
|
||||
sqlite3_context pCx,
|
||||
sqlite3_value argv[]
|
||||
){
|
||||
int nCol = ext.xColumnCount(fCx);
|
||||
@ -169,14 +168,14 @@ public class TesterFts5 {
|
||||
public void xDestroy(){ }
|
||||
};
|
||||
|
||||
/*
|
||||
** fts5_columnsize() - xColumnSize()
|
||||
/*
|
||||
** fts5_columnsize() - xColumnSize()
|
||||
*/
|
||||
fts5_extension_function fts5_columnsize = new fts5_extension_function(){
|
||||
@Override public void call(
|
||||
Fts5ExtensionApi ext,
|
||||
Fts5ExtensionApi ext,
|
||||
Fts5Context fCx,
|
||||
sqlite3_context pCx,
|
||||
sqlite3_context pCx,
|
||||
sqlite3_value argv[]
|
||||
){
|
||||
if( argv.length!=1 ){
|
||||
@ -194,14 +193,14 @@ public class TesterFts5 {
|
||||
public void xDestroy(){ }
|
||||
};
|
||||
|
||||
/*
|
||||
** fts5_columntext() - xColumnText()
|
||||
/*
|
||||
** fts5_columntext() - xColumnText()
|
||||
*/
|
||||
fts5_extension_function fts5_columntext = new fts5_extension_function(){
|
||||
@Override public void call(
|
||||
Fts5ExtensionApi ext,
|
||||
Fts5ExtensionApi ext,
|
||||
Fts5Context fCx,
|
||||
sqlite3_context pCx,
|
||||
sqlite3_context pCx,
|
||||
sqlite3_value argv[]
|
||||
){
|
||||
if( argv.length!=1 ){
|
||||
@ -219,14 +218,14 @@ public class TesterFts5 {
|
||||
public void xDestroy(){ }
|
||||
};
|
||||
|
||||
/*
|
||||
** fts5_columntotalsize() - xColumnTotalSize()
|
||||
/*
|
||||
** fts5_columntotalsize() - xColumnTotalSize()
|
||||
*/
|
||||
fts5_extension_function fts5_columntsize = new fts5_extension_function(){
|
||||
@Override public void call(
|
||||
Fts5ExtensionApi ext,
|
||||
Fts5ExtensionApi ext,
|
||||
Fts5Context fCx,
|
||||
sqlite3_context pCx,
|
||||
sqlite3_context pCx,
|
||||
sqlite3_value argv[]
|
||||
){
|
||||
if( argv.length!=1 ){
|
||||
@ -251,9 +250,9 @@ public class TesterFts5 {
|
||||
*/
|
||||
class fts5_aux implements fts5_extension_function {
|
||||
@Override public void call(
|
||||
Fts5ExtensionApi ext,
|
||||
Fts5ExtensionApi ext,
|
||||
Fts5Context fCx,
|
||||
sqlite3_context pCx,
|
||||
sqlite3_context pCx,
|
||||
sqlite3_value argv[]
|
||||
){
|
||||
if( argv.length>1 ){
|
||||
@ -268,13 +267,13 @@ public class TesterFts5 {
|
||||
|
||||
if( argv.length==1 ){
|
||||
String val = sqlite3_value_text16(argv[0]);
|
||||
if( !val.equals("") ){
|
||||
if( !val.isEmpty() ){
|
||||
ext.xSetAuxdata(fCx, val);
|
||||
}
|
||||
}
|
||||
}
|
||||
public void xDestroy(){ }
|
||||
};
|
||||
}
|
||||
|
||||
/*
|
||||
** fts5_inst(<fts>);
|
||||
@ -286,9 +285,9 @@ public class TesterFts5 {
|
||||
*/
|
||||
fts5_extension_function fts5_inst = new fts5_extension_function(){
|
||||
@Override public void call(
|
||||
Fts5ExtensionApi ext,
|
||||
Fts5ExtensionApi ext,
|
||||
Fts5Context fCx,
|
||||
sqlite3_context pCx,
|
||||
sqlite3_context pCx,
|
||||
sqlite3_value argv[]
|
||||
){
|
||||
if( argv.length!=0 ){
|
||||
@ -299,7 +298,7 @@ public class TesterFts5 {
|
||||
OutputPointer.Int32 piPhrase = new OutputPointer.Int32();
|
||||
OutputPointer.Int32 piCol = new OutputPointer.Int32();
|
||||
OutputPointer.Int32 piOff = new OutputPointer.Int32();
|
||||
String ret = new String();
|
||||
String ret = "";
|
||||
|
||||
int rc = ext.xInstCount(fCx, pnInst);
|
||||
int nInst = pnInst.get();
|
||||
@ -327,9 +326,9 @@ public class TesterFts5 {
|
||||
*/
|
||||
fts5_extension_function fts5_pinst = new fts5_extension_function(){
|
||||
@Override public void call(
|
||||
Fts5ExtensionApi ext,
|
||||
Fts5ExtensionApi ext,
|
||||
Fts5Context fCx,
|
||||
sqlite3_context pCx,
|
||||
sqlite3_context pCx,
|
||||
sqlite3_value argv[]
|
||||
){
|
||||
if( argv.length!=0 ){
|
||||
@ -338,7 +337,7 @@ public class TesterFts5 {
|
||||
|
||||
OutputPointer.Int32 piCol = new OutputPointer.Int32();
|
||||
OutputPointer.Int32 piOff = new OutputPointer.Int32();
|
||||
String ret = new String();
|
||||
String ret = "";
|
||||
int rc = SQLITE_OK;
|
||||
|
||||
int nPhrase = ext.xPhraseCount(fCx);
|
||||
@ -350,7 +349,7 @@ public class TesterFts5 {
|
||||
rc==SQLITE_OK && piCol.get()>=0;
|
||||
ext.xPhraseNext(fCx, pIter, piCol, piOff)
|
||||
){
|
||||
if( !ret.equals("") ) ret += " ";
|
||||
if( !ret.isEmpty() ) ret += " ";
|
||||
ret += "{"+ii+" "+piCol.get()+" "+piOff.get()+"}";
|
||||
}
|
||||
}
|
||||
@ -374,9 +373,9 @@ public class TesterFts5 {
|
||||
*/
|
||||
fts5_extension_function fts5_pcolinst = new fts5_extension_function(){
|
||||
@Override public void call(
|
||||
Fts5ExtensionApi ext,
|
||||
Fts5ExtensionApi ext,
|
||||
Fts5Context fCx,
|
||||
sqlite3_context pCx,
|
||||
sqlite3_context pCx,
|
||||
sqlite3_value argv[]
|
||||
){
|
||||
if( argv.length!=0 ){
|
||||
@ -384,7 +383,7 @@ public class TesterFts5 {
|
||||
}
|
||||
|
||||
OutputPointer.Int32 piCol = new OutputPointer.Int32();
|
||||
String ret = new String();
|
||||
String ret = "";
|
||||
int rc = SQLITE_OK;
|
||||
|
||||
int nPhrase = ext.xPhraseCount(fCx);
|
||||
@ -396,7 +395,7 @@ public class TesterFts5 {
|
||||
rc==SQLITE_OK && piCol.get()>=0;
|
||||
ext.xPhraseNextColumn(fCx, pIter, piCol)
|
||||
){
|
||||
if( !ret.equals("") ) ret += " ";
|
||||
if( !ret.isEmpty() ) ret += " ";
|
||||
ret += "{"+ii+" "+piCol.get()+"}";
|
||||
}
|
||||
}
|
||||
@ -415,9 +414,9 @@ public class TesterFts5 {
|
||||
*/
|
||||
fts5_extension_function fts5_rowcount = new fts5_extension_function(){
|
||||
@Override public void call(
|
||||
Fts5ExtensionApi ext,
|
||||
Fts5ExtensionApi ext,
|
||||
Fts5Context fCx,
|
||||
sqlite3_context pCx,
|
||||
sqlite3_context pCx,
|
||||
sqlite3_value argv[]
|
||||
){
|
||||
if( argv.length!=0 ){
|
||||
@ -440,9 +439,9 @@ public class TesterFts5 {
|
||||
*/
|
||||
fts5_extension_function fts5_phrasesize = new fts5_extension_function(){
|
||||
@Override public void call(
|
||||
Fts5ExtensionApi ext,
|
||||
Fts5ExtensionApi ext,
|
||||
Fts5Context fCx,
|
||||
sqlite3_context pCx,
|
||||
sqlite3_context pCx,
|
||||
sqlite3_value argv[]
|
||||
){
|
||||
if( argv.length!=1 ){
|
||||
@ -464,9 +463,9 @@ public class TesterFts5 {
|
||||
*/
|
||||
fts5_extension_function fts5_phrasehits = new fts5_extension_function(){
|
||||
@Override public void call(
|
||||
Fts5ExtensionApi ext,
|
||||
Fts5ExtensionApi ext,
|
||||
Fts5Context fCx,
|
||||
sqlite3_context pCx,
|
||||
sqlite3_context pCx,
|
||||
sqlite3_value argv[]
|
||||
){
|
||||
if( argv.length!=1 ){
|
||||
@ -503,9 +502,9 @@ public class TesterFts5 {
|
||||
*/
|
||||
fts5_extension_function fts5_tokenize = new fts5_extension_function(){
|
||||
@Override public void call(
|
||||
Fts5ExtensionApi ext,
|
||||
Fts5ExtensionApi ext,
|
||||
Fts5Context fCx,
|
||||
sqlite3_context pCx,
|
||||
sqlite3_context pCx,
|
||||
sqlite3_value argv[]
|
||||
){
|
||||
if( argv.length!=1 ){
|
||||
@ -515,7 +514,7 @@ public class TesterFts5 {
|
||||
int rc = SQLITE_OK;
|
||||
|
||||
class MyCallback implements XTokenizeCallback {
|
||||
private List<String> myList = new ArrayList<String>();
|
||||
private List<String> myList = new ArrayList<>();
|
||||
|
||||
public String getval() {
|
||||
return String.join("+", myList);
|
||||
@ -524,7 +523,7 @@ public class TesterFts5 {
|
||||
@Override
|
||||
public int call(int tFlags, byte[] txt, int iStart, int iEnd){
|
||||
try {
|
||||
String str = new String(txt, "UTF-8");
|
||||
String str = new String(txt, StandardCharsets.UTF_8);
|
||||
myList.add(str);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
|
@ -39,7 +39,11 @@ public interface fts5_extension_function {
|
||||
*/
|
||||
void xDestroy();
|
||||
|
||||
public static abstract class Abstract implements fts5_extension_function {
|
||||
/**
|
||||
A base implementation of fts5_extension_function() which has a
|
||||
no-op xDestroy() method.
|
||||
*/
|
||||
abstract class Abstract implements fts5_extension_function {
|
||||
@Override public abstract void call(Fts5ExtensionApi ext, Fts5Context fCx,
|
||||
sqlite3_context pCx, sqlite3_value argv[]);
|
||||
@Override public void xDestroy(){}
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
The purpose of the Test Script Interpreter is to read and interpret
|
||||
script files that contain SQL commands and desired results. The
|
||||
interpreter will check results and report any discrepencies found.
|
||||
interpreter will check results and report any discrepancies found.
|
||||
|
||||
The test script files are ASCII text files. The filename always ends with
|
||||
".test". Each script is evaluated independently; context does not carry
|
||||
@ -160,7 +160,7 @@ the result buffer. This distinction does not matter for the --result
|
||||
command itself, but it is important for related commands like --glob
|
||||
and --notglob. Sometimes test cases will contains a bunch of SQL
|
||||
followed by multiple --glob and/or --notglob statements. All of the
|
||||
globs should be evaluated agains the result buffer, but the SQL should
|
||||
globs should be evaluated against the result buffer, but the SQL should
|
||||
only be run once. This is accomplished by resetting the input buffer
|
||||
but not the result buffer.
|
||||
|
||||
|
@ -12,10 +12,6 @@
|
||||
** This file is part of the wrapper1 interface for sqlite3.
|
||||
*/
|
||||
package org.sqlite.jni.wrapper1;
|
||||
import org.sqlite.jni.capi.CApi;
|
||||
import org.sqlite.jni.annotation.*;
|
||||
import org.sqlite.jni.capi.sqlite3_context;
|
||||
import org.sqlite.jni.capi.sqlite3_value;
|
||||
|
||||
/**
|
||||
The SqlFunction type for scalar SQL functions.
|
||||
|
@ -22,13 +22,13 @@ import org.sqlite.jni.capi.sqlite3_value;
|
||||
*/
|
||||
public interface SqlFunction {
|
||||
|
||||
public static final int DETERMINISTIC = CApi.SQLITE_DETERMINISTIC;
|
||||
public static final int INNOCUOUS = CApi.SQLITE_INNOCUOUS;
|
||||
public static final int DIRECTONLY = CApi.SQLITE_DIRECTONLY;
|
||||
public static final int SUBTYPE = CApi.SQLITE_SUBTYPE;
|
||||
public static final int RESULT_SUBTYPE = CApi.SQLITE_RESULT_SUBTYPE;
|
||||
public static final int UTF8 = CApi.SQLITE_UTF8;
|
||||
public static final int UTF16 = CApi.SQLITE_UTF16;
|
||||
int DETERMINISTIC = CApi.SQLITE_DETERMINISTIC;
|
||||
int INNOCUOUS = CApi.SQLITE_INNOCUOUS;
|
||||
int DIRECTONLY = CApi.SQLITE_DIRECTONLY;
|
||||
int SUBTYPE = CApi.SQLITE_SUBTYPE;
|
||||
int RESULT_SUBTYPE = CApi.SQLITE_RESULT_SUBTYPE;
|
||||
int UTF8 = CApi.SQLITE_UTF8;
|
||||
int UTF16 = CApi.SQLITE_UTF16;
|
||||
|
||||
/**
|
||||
The Arguments type is an abstraction on top of the lower-level
|
||||
@ -36,7 +36,7 @@ public interface SqlFunction {
|
||||
of the lower-level interface, insofar as possible without "leaking"
|
||||
those types into this API.
|
||||
*/
|
||||
public final static class Arguments implements Iterable<SqlFunction.Arguments.Arg>{
|
||||
final class Arguments implements Iterable<SqlFunction.Arguments.Arg>{
|
||||
private final sqlite3_context cx;
|
||||
private final sqlite3_value args[];
|
||||
public final int length;
|
||||
@ -207,7 +207,7 @@ public interface SqlFunction {
|
||||
Internal-use adapter for wrapping this package's ScalarFunction
|
||||
for use with the org.sqlite.jni.capi.ScalarFunction interface.
|
||||
*/
|
||||
static final class ScalarAdapter extends org.sqlite.jni.capi.ScalarFunction {
|
||||
final class ScalarAdapter extends org.sqlite.jni.capi.ScalarFunction {
|
||||
private final ScalarFunction impl;
|
||||
ScalarAdapter(ScalarFunction impl){
|
||||
this.impl = impl;
|
||||
@ -234,8 +234,8 @@ public interface SqlFunction {
|
||||
Internal-use adapter for wrapping this package's AggregateFunction
|
||||
for use with the org.sqlite.jni.capi.AggregateFunction interface.
|
||||
*/
|
||||
static /*cannot be final without duplicating the whole body in WindowAdapter*/
|
||||
class AggregateAdapter extends org.sqlite.jni.capi.AggregateFunction {
|
||||
/*cannot be final without duplicating the whole body in WindowAdapter*/
|
||||
private final AggregateFunction impl;
|
||||
AggregateAdapter(AggregateFunction impl){
|
||||
this.impl = impl;
|
||||
@ -277,7 +277,7 @@ public interface SqlFunction {
|
||||
Internal-use adapter for wrapping this package's WindowFunction
|
||||
for use with the org.sqlite.jni.capi.WindowFunction interface.
|
||||
*/
|
||||
static final class WindowAdapter extends AggregateAdapter {
|
||||
final class WindowAdapter extends AggregateAdapter {
|
||||
private final WindowFunction impl;
|
||||
WindowAdapter(WindowFunction impl){
|
||||
super(impl);
|
||||
|
@ -19,7 +19,6 @@ import org.sqlite.jni.capi.sqlite3_stmt;
|
||||
import org.sqlite.jni.capi.sqlite3_backup;
|
||||
import org.sqlite.jni.capi.sqlite3_blob;
|
||||
import org.sqlite.jni.capi.OutputPointer;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
/**
|
||||
This class represents a database connection, analog to the C-side
|
||||
@ -388,10 +387,10 @@ public final class Sqlite implements AutoCloseable {
|
||||
return CApi.sqlite3_compileoption_used(optName);
|
||||
}
|
||||
|
||||
private static boolean hasNormalizeSql =
|
||||
private static final boolean hasNormalizeSql =
|
||||
compileOptionUsed("ENABLE_NORMALIZE");
|
||||
|
||||
private static boolean hasSqlLog =
|
||||
private static final boolean hasSqlLog =
|
||||
compileOptionUsed("ENABLE_SQLLOG");
|
||||
|
||||
/**
|
||||
@ -450,7 +449,7 @@ public final class Sqlite implements AutoCloseable {
|
||||
long current;
|
||||
/** The peak value for the requested status() or libStatus() metric. */
|
||||
long peak;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
As per sqlite3_status64(), but returns its current and high-water
|
||||
@ -696,7 +695,7 @@ public final class Sqlite implements AutoCloseable {
|
||||
final org.sqlite.jni.capi.OutputPointer.Int32 oTail =
|
||||
new org.sqlite.jni.capi.OutputPointer.Int32();
|
||||
while( pos < sqlChunk.length ){
|
||||
sqlite3_stmt stmt = null;
|
||||
sqlite3_stmt stmt;
|
||||
if( pos>0 ){
|
||||
sqlChunk = java.util.Arrays.copyOfRange(sqlChunk, pos, sqlChunk.length);
|
||||
}
|
||||
@ -988,15 +987,15 @@ public final class Sqlite implements AutoCloseable {
|
||||
}
|
||||
};
|
||||
checkRc( CApi.sqlite3_trace_v2(thisDb(), traceMask, tc) );
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
Corresponds to the sqlite3_stmt class. Use Sqlite.prepare() to
|
||||
create new instances.
|
||||
*/
|
||||
public static final class Stmt implements AutoCloseable {
|
||||
private Sqlite _db = null;
|
||||
private sqlite3_stmt stmt = null;
|
||||
private Sqlite _db;
|
||||
private sqlite3_stmt stmt;
|
||||
|
||||
/** Only called by the prepare() factory functions. */
|
||||
Stmt(Sqlite db, sqlite3_stmt stmt){
|
||||
@ -1379,9 +1378,9 @@ public final class Sqlite implements AutoCloseable {
|
||||
Sqlite.initBackup() to create new instances.
|
||||
*/
|
||||
public static final class Backup implements AutoCloseable {
|
||||
private sqlite3_backup b = null;
|
||||
private Sqlite dbTo = null;
|
||||
private Sqlite dbFrom = null;
|
||||
private sqlite3_backup b;
|
||||
private Sqlite dbTo;
|
||||
private Sqlite dbFrom;
|
||||
|
||||
Backup(Sqlite dbDest, String schemaDest,Sqlite dbSrc, String schemaSrc){
|
||||
this.dbTo = dbDest;
|
||||
@ -1491,7 +1490,7 @@ public final class Sqlite implements AutoCloseable {
|
||||
Warning: the SQLite core has no mechanism for reporting errors
|
||||
from custom collations and its workflow does not accommodate
|
||||
propagation of exceptions from callbacks. Any exceptions thrown
|
||||
from collations will be silently supressed and sorting results
|
||||
from collations will be silently suppressed and sorting results
|
||||
will be unpredictable.
|
||||
*/
|
||||
int call(byte[] lhs, byte[] rhs);
|
||||
@ -1506,7 +1505,7 @@ public final class Sqlite implements AutoCloseable {
|
||||
*/
|
||||
public void createCollation(String name, int encoding, Collation c){
|
||||
thisDb();
|
||||
if( null==name || 0==name.length()){
|
||||
if( null==name || name.isEmpty()){
|
||||
throw new IllegalArgumentException("Collation name may not be null or empty.");
|
||||
}
|
||||
if( null==c ){
|
||||
@ -1599,11 +1598,12 @@ public final class Sqlite implements AutoCloseable {
|
||||
public void setBusyHandler( BusyHandler b ){
|
||||
org.sqlite.jni.capi.BusyHandlerCallback bhc = null;
|
||||
if( null!=b ){
|
||||
bhc = new org.sqlite.jni.capi.BusyHandlerCallback(){
|
||||
/*bhc = new org.sqlite.jni.capi.BusyHandlerCallback(){
|
||||
@Override public int call(int n){
|
||||
return b.call(n);
|
||||
}
|
||||
};
|
||||
};*/
|
||||
bhc = b::call;
|
||||
}
|
||||
checkRc( CApi.sqlite3_busy_handler(thisDb(), bhc) );
|
||||
}
|
||||
@ -1781,9 +1781,10 @@ public final class Sqlite implements AutoCloseable {
|
||||
public void setProgressHandler( int n, ProgressHandler p ){
|
||||
org.sqlite.jni.capi.ProgressHandlerCallback phc = null;
|
||||
if( null!=p ){
|
||||
phc = new org.sqlite.jni.capi.ProgressHandlerCallback(){
|
||||
/*phc = new org.sqlite.jni.capi.ProgressHandlerCallback(){
|
||||
@Override public int call(){ return p.call(); }
|
||||
};
|
||||
};*/
|
||||
phc = p::call;
|
||||
}
|
||||
CApi.sqlite3_progress_handler( thisDb(), n, phc );
|
||||
}
|
||||
@ -1808,11 +1809,12 @@ public final class Sqlite implements AutoCloseable {
|
||||
public void setAuthorizer( Authorizer a ) {
|
||||
org.sqlite.jni.capi.AuthorizerCallback ac = null;
|
||||
if( null!=a ){
|
||||
ac = new org.sqlite.jni.capi.AuthorizerCallback(){
|
||||
/*ac = new org.sqlite.jni.capi.AuthorizerCallback(){
|
||||
@Override public int call(int opId, String s1, String s2, String s3, String s4){
|
||||
return a.call(opId, s1, s2, s3, s4);
|
||||
}
|
||||
};
|
||||
};*/
|
||||
ac = a::call;
|
||||
}
|
||||
checkRc( CApi.sqlite3_set_authorizer( thisDb(), ac ) );
|
||||
}
|
||||
@ -1932,11 +1934,12 @@ public final class Sqlite implements AutoCloseable {
|
||||
final org.sqlite.jni.capi.ConfigLogCallback l =
|
||||
null==log
|
||||
? null
|
||||
: new org.sqlite.jni.capi.ConfigLogCallback() {
|
||||
/*: new org.sqlite.jni.capi.ConfigLogCallback() {
|
||||
@Override public void call(int errCode, String msg){
|
||||
log.call(errCode, msg);
|
||||
}
|
||||
};
|
||||
};*/
|
||||
: log::call;
|
||||
checkRcStatic(CApi.sqlite3_config(l));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user