Methods Summary |
---|
public void | addBatch(java.lang.String sql)
if (batch == null) {
batch = new ArrayList<String>(1);
}
batch.add(sql);
|
public void | cancel()
if (conn == null || conn.db == null) {
throw new SQLException("stale connection");
}
conn.db.interrupt();
|
public void | clearBatch()
if (batch != null) {
batch.clear();
batch = null;
}
|
public void | clearWarnings()
|
public void | close()
clearBatch();
conn = null;
|
public boolean | execute(java.lang.String sql)
return executeQuery(sql) != null;
|
public boolean | execute(java.lang.String sql, int autokeys)
if (autokeys != Statement.NO_GENERATED_KEYS) {
throw new SQLException("not supported");
}
return execute(sql);
|
public boolean | execute(java.lang.String sql, int[] colIndexes)
throw new SQLException("not supported");
|
public boolean | execute(java.lang.String sql, java.lang.String[] colIndexes)
throw new SQLException("not supported");
|
public int[] | executeBatch()
if (batch == null) {
return new int[0];
}
int[] ret = new int[batch.size()];
for (int i = 0; i < ret.length; i++) {
ret[i] = EXECUTE_FAILED;
}
int errs = 0;
for (int i = 0; i < ret.length; i++) {
try {
execute((String) batch.get(i));
ret[i] = updcnt;
} catch (SQLException e) {
++errs;
}
}
if (errs > 0) {
throw new BatchUpdateException("batch failed", ret);
}
return ret;
|
java.sql.ResultSet | executeQuery(java.lang.String sql, java.lang.String[] args, boolean updonly)
SQLite.TableResult tr = null;
if (rs != null) {
rs.close();
rs = null;
}
updcnt = -1;
if (conn == null || conn.db == null) {
throw new SQLException("stale connection");
}
int busy = 0;
boolean starttrans = !conn.autocommit && !conn.intrans;
while (true) {
try {
if (starttrans) {
conn.db.exec("BEGIN TRANSACTION", null);
conn.intrans = true;
}
if (args == null) {
if (updonly) {
conn.db.exec(sql, null);
} else {
tr = conn.db.get_table(sql);
}
} else {
if (updonly) {
conn.db.exec(sql, null, args);
} else {
tr = conn.db.get_table(sql, args);
}
}
updcnt = (int) conn.db.changes();
} catch (SQLite.Exception e) {
if (conn.db.is3() &&
conn.db.last_error() == SQLite.Constants.SQLITE_BUSY &&
conn.busy3(conn.db, ++busy)) {
try {
if (starttrans && conn.intrans) {
conn.db.exec("ROLLBACK", null);
conn.intrans = false;
}
} catch (SQLite.Exception ee) {
}
try {
int ms = 20 + busy * 10;
if (ms > 1000) {
ms = 1000;
}
synchronized (this) {
this.wait(ms);
}
} catch (java.lang.Exception eee) {
}
continue;
}
throw new SQLException(e.toString());
}
break;
}
if (!updonly && tr == null) {
throw new SQLException("no result set produced");
}
if (!updonly && tr != null) {
rs = new JDBCResultSet(new TableResultX(tr), this);
}
return rs;
|
public java.sql.ResultSet | executeQuery(java.lang.String sql)
return executeQuery(sql, null, false);
|
public int | executeUpdate(java.lang.String sql)
executeQuery(sql, null, true);
return updcnt;
|
public int | executeUpdate(java.lang.String sql, int autokeys)
if (autokeys != Statement.NO_GENERATED_KEYS) {
throw new SQLException("not supported");
}
return executeUpdate(sql);
|
public int | executeUpdate(java.lang.String sql, int[] colIndexes)
throw new SQLException("not supported");
|
public int | executeUpdate(java.lang.String sql, java.lang.String[] colIndexes)
throw new SQLException("not supported");
|
public java.sql.Connection | getConnection()
return conn;
|
public int | getFetchDirection()
return ResultSet.FETCH_UNKNOWN;
|
public int | getFetchSize()
return 1;
|
public java.sql.ResultSet | getGeneratedKeys()
throw new SQLException("not supported");
|
public int | getMaxFieldSize()
return 0;
|
public int | getMaxRows()
return 0;
|
public boolean | getMoreResults()
if (rs != null) {
rs.close();
rs = null;
}
return false;
|
public boolean | getMoreResults(int x)
throw new SQLException("not supported");
|
public int | getQueryTimeout()
return conn.timeout;
|
public java.sql.ResultSet | getResultSet()
return rs;
|
public int | getResultSetConcurrency()
return ResultSet.CONCUR_READ_ONLY;
|
public int | getResultSetHoldability()
return ResultSet.HOLD_CURSORS_OVER_COMMIT;
|
public int | getResultSetType()
return ResultSet.TYPE_SCROLL_INSENSITIVE;
|
public int | getUpdateCount()
return updcnt;
|
public java.sql.SQLWarning | getWarnings()
return null;
|
public void | setCursorName(java.lang.String name)
throw new SQLException("not supported");
|
public void | setEscapeProcessing(boolean enable)
throw new SQLException("not supported");
|
public void | setFetchDirection(int fetchDirection)
throw new SQLException("not supported");
|
public void | setFetchSize(int fetchSize)
throw new SQLException("not supported");
|
public void | setMaxFieldSize(int max)
throw new SQLException("not supported");
|
public void | setMaxRows(int max)
throw new SQLException("not supported");
|
public void | setQueryTimeout(int seconds)
conn.timeout = seconds * 1000;
if (conn.timeout < 0) {
conn.timeout = 120000;
} else if (conn.timeout < 1000) {
conn.timeout = 5000;
}
|