mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-01 06:27:03 +03:00
Complete shell transition to using {f,o,e}put{f,z}() emit functions. This fails test 13.1 in json501.test, but so does trunk in the same way.
FossilOrigin-Name: 923c6b8b3a508c715b816c6bcd2ae9ac519bc37a62afc4ef813085c00f1e7cb6
This commit is contained in:
@ -503,6 +503,34 @@ SQLITE_INTERNAL_LINKAGE int oPutsUtf8(const char *z){
|
||||
#endif
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* Next 3 functions could be optimized to avoid console mode futzing. */
|
||||
SQLITE_INTERNAL_LINKAGE int fPutcUtf8(int ch, FILE *pfO){
|
||||
if( (ch & ~0x7f) != 0 ) return 0;
|
||||
else{
|
||||
char ac[2] = "?";
|
||||
ac[0] = (char)ch;
|
||||
return (fPutsUtf8(ac, pfO) > 0);
|
||||
}
|
||||
}
|
||||
SQLITE_INTERNAL_LINKAGE int oPutcUtf8(int ch){
|
||||
if( (ch & ~0x7f) != 0 ) return 0;
|
||||
else{
|
||||
char ac[2] = "?";
|
||||
ac[0] = (char)ch;
|
||||
return (oPutsUtf8(ac) > 0);
|
||||
}
|
||||
}
|
||||
SQLITE_INTERNAL_LINKAGE int ePutcUtf8(int ch){
|
||||
if( (ch & ~0x7f) != 0 ) return 0;
|
||||
else{
|
||||
char ac[2] = "?";
|
||||
ac[0] = (char)ch;
|
||||
return (ePutsUtf8(ac) > 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if SHELL_CON_TRANSLATE==2
|
||||
static int mbcsToUtf8InPlaceIfValid(char *pc, int nci, int nco, UINT codePage){
|
||||
WCHAR wcOneCode[2];
|
||||
|
@ -136,6 +136,21 @@ SQLITE_INTERNAL_LINKAGE int oPutsUtf8(const char *z);
|
||||
/* Like fPutsUtf8 except stream is always the designated error. */
|
||||
SQLITE_INTERNAL_LINKAGE int ePutsUtf8(const char *z);
|
||||
|
||||
#if 0
|
||||
/*
|
||||
** Emit output like fputc(), with appropriate translation(s).
|
||||
** This is not strictly needed on fully UTF-8-aware platforms.
|
||||
** It exists for sake of orthogonality and output designation.
|
||||
**
|
||||
** The routine returns an error for non-ASCII character input.
|
||||
*/
|
||||
SQLITE_INTERNAL_LINKAGE int fPutcUtf8(int ch, FILE *pfO);
|
||||
/* Like fPutcUtf8 except stream is always the designated output. */
|
||||
SQLITE_INTERNAL_LINKAGE int oPutcUtf8(int ch);
|
||||
/* Like fPutcUtf8 except stream is always the designated error. */
|
||||
SQLITE_INTERNAL_LINKAGE int ePutcUtf8(int ch);
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Collect input like fgets(...) with special provisions for input
|
||||
** from the console on platforms that require same. Defers to the
|
||||
|
@ -69,7 +69,7 @@ import java.util.Arrays;
|
||||
NUL-terminated, and conversion to a Java byte array must sometimes
|
||||
be careful to add one. Functions which take a length do not require
|
||||
this so long as the length is provided. Search the CApi class
|
||||
for "\0" for many examples.
|
||||
for "\0" for examples.
|
||||
|
||||
</ul>
|
||||
|
||||
|
@ -937,21 +937,11 @@ public final class Sqlite implements AutoCloseable {
|
||||
public static final class Stmt implements AutoCloseable {
|
||||
private Sqlite _db = null;
|
||||
private sqlite3_stmt stmt = null;
|
||||
/**
|
||||
We save the result column count in order to prevent having to
|
||||
call into C to fetch that value every time we need to check
|
||||
that value for the columnXyz() methods.
|
||||
|
||||
Design note: if this is final then we cannot zero it in
|
||||
finalizeStmt().
|
||||
*/
|
||||
private int resultColCount;
|
||||
|
||||
/** Only called by the prepare() factory functions. */
|
||||
Stmt(Sqlite db, sqlite3_stmt stmt){
|
||||
this._db = db;
|
||||
this.stmt = stmt;
|
||||
this.resultColCount = CApi.sqlite3_column_count(stmt);
|
||||
synchronized(nativeToWrapper){
|
||||
nativeToWrapper.put(this.stmt, this);
|
||||
}
|
||||
@ -986,10 +976,10 @@ public final class Sqlite implements AutoCloseable {
|
||||
return stmt;
|
||||
}
|
||||
|
||||
/** Throws if n is out of range of this.resultColCount. Intended
|
||||
to be used by the columnXyz() methods. */
|
||||
/** Throws if n is out of range of this statement's result column
|
||||
count. Intended to be used by the columnXyz() methods. */
|
||||
private sqlite3_stmt checkColIndex(int n){
|
||||
if(n<0 || n>=this.resultColCount){
|
||||
if(n<0 || n>=columnCount()){
|
||||
throw new IllegalArgumentException("Column index "+n+" is out of range.");
|
||||
}
|
||||
return thisStmt();
|
||||
@ -1013,7 +1003,6 @@ public final class Sqlite implements AutoCloseable {
|
||||
CApi.sqlite3_finalize(stmt);
|
||||
stmt = null;
|
||||
_db = null;
|
||||
resultColCount = 0;
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
@ -1184,8 +1173,18 @@ public final class Sqlite implements AutoCloseable {
|
||||
public String columnDeclType(int ndx){
|
||||
return CApi.sqlite3_column_decltype( checkColIndex(ndx), ndx );
|
||||
}
|
||||
/**
|
||||
Analog to sqlite3_column_count() but throws if this statement
|
||||
has been finalized.
|
||||
*/
|
||||
public int columnCount(){
|
||||
return resultColCount;
|
||||
/* We cannot reliably cache the column count in a class
|
||||
member because an ALTER TABLE from a separate statement
|
||||
can invalidate that count and we have no way, short of
|
||||
installing a COMMIT handler or the like, of knowing when
|
||||
to re-read it. We cannot install such a handler without
|
||||
interfering with a client's ability to do so. */
|
||||
return CApi.sqlite3_column_count(thisStmt());
|
||||
}
|
||||
public int columnDataCount(){
|
||||
return CApi.sqlite3_data_count( thisStmt() );
|
||||
|
Reference in New Issue
Block a user