本文整理汇总了Java中android.database.DatabaseUtils.STATEMENT_SELECT属性的典型用法代码示例。如果您正苦于以下问题:Java DatabaseUtils.STATEMENT_SELECT属性的具体用法?Java DatabaseUtils.STATEMENT_SELECT怎么用?Java DatabaseUtils.STATEMENT_SELECT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.database.DatabaseUtils
的用法示例。
在下文中一共展示了DatabaseUtils.STATEMENT_SELECT属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: runSql
private void runSql(String sql) {
hideSoftwareInput(this, clearEditText);
response_content_layout.setVisibility(View.VISIBLE);
//查询语句跳转界面,其他直接显示结果
int sqlType = DatabaseUtils.getSqlStatementType(sql);
if (sqlType == DatabaseUtils.STATEMENT_SELECT) {
startTableDataActivity(sql);
} else {
try {
int result = SQLManager.getSQLHelper(SqlCommondActivity.this).execSQLStr(sql);
response_content.setText(result + "");
} catch (Exception e) {
e.printStackTrace();
response_content.setText(e.getMessage());
}
}
}
示例2: isCacheable
private static boolean isCacheable(int statementType) {
if (statementType == DatabaseUtils.STATEMENT_UPDATE
|| statementType == DatabaseUtils.STATEMENT_SELECT) {
return true;
}
return false;
}
示例3: SQLiteProgram
SQLiteProgram(SQLiteDatabase db, String sql, Object[] bindArgs,
CancellationSignal cancellationSignalForPrepare) {
mDatabase = db;
mSql = sql.trim();
int n = DatabaseUtils.getSqlStatementType(mSql);
switch (n) {
case DatabaseUtils.STATEMENT_BEGIN:
case DatabaseUtils.STATEMENT_COMMIT:
case DatabaseUtils.STATEMENT_ABORT:
mReadOnly = false;
mColumnNames = EMPTY_STRING_ARRAY;
mNumParameters = 0;
break;
default:
boolean assumeReadOnly = (n == DatabaseUtils.STATEMENT_SELECT);
SQLiteStatementInfo info = new SQLiteStatementInfo();
db.getThreadSession().prepare(mSql,
db.getThreadDefaultConnectionFlags(assumeReadOnly),
cancellationSignalForPrepare, info);
mReadOnly = info.readOnly;
mColumnNames = info.columnNames;
mNumParameters = info.numParameters;
break;
}
if (bindArgs != null && bindArgs.length > mNumParameters) {
throw new IllegalArgumentException("Too many bind arguments. "
+ bindArgs.length + " arguments were provided but the statement needs "
+ mNumParameters + " arguments.");
}
if (mNumParameters != 0) {
mBindArgs = new Object[mNumParameters];
if (bindArgs != null) {
System.arraycopy(bindArgs, 0, mBindArgs, 0, bindArgs.length);
}
} else {
mBindArgs = null;
}
}