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

Add a JNI-layer sqlite3.toString() for debugging.

FossilOrigin-Name: 456691649aa2a7672d5d110acdde92426a9d34552863db3e0c86b73d9c5d9aac
This commit is contained in:
stephan
2023-08-08 11:46:26 +00:00
parent c693bd59f7
commit ec9b37b33e
3 changed files with 19 additions and 7 deletions

View File

@ -22,4 +22,16 @@ package org.sqlite.jni;
public final class sqlite3 extends NativePointerHolder<sqlite3> {
// Only invoked from JNI
private sqlite3(){}
public String toString(){
long ptr = getNativePointer();
if( 0==ptr ){
return sqlite3.class.getSimpleName()+"@null";
}
String fn = SQLite3Jni.sqlite3_db_filename(this, "main");
return sqlite3.class.getSimpleName()
+"@"+String.format("0x%08x",ptr)
+"["+((null == fn) ? "<unnamed>" : fn)+"]"
;
}
}