本文整理汇总了Java中android.database.sqlite.SQLiteQueryBuilder.setTables方法的典型用法代码示例。如果您正苦于以下问题:Java SQLiteQueryBuilder.setTables方法的具体用法?Java SQLiteQueryBuilder.setTables怎么用?Java SQLiteQueryBuilder.setTables使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.database.sqlite.SQLiteQueryBuilder
的用法示例。
在下文中一共展示了SQLiteQueryBuilder.setTables方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getObservations
import android.database.sqlite.SQLiteQueryBuilder; //导入方法依赖的package包/类
public Cursor getObservations() {
SQLiteDatabase db = getReadableDatabase();
SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
String [] sqlSelect = {
"_id",
ObsTable.Cols.DsoID,
ObsTable.Cols.ObsDate,
ObsTable.Cols.Location,
ObsTable.Cols.Seeing,
ObsTable.Cols.Transparency,
ObsTable.Cols.Telescope,
ObsTable.Cols.Eyepiece,
ObsTable.Cols.Power,
ObsTable.Cols.Filter,
ObsTable.Cols.Notes
};
qb.setTables(ObsTable.NAME);
Cursor c = qb.query(db, sqlSelect, null, null, null, null, null);
c.moveToFirst();
return c;
}
示例2: handleMovieFull
import android.database.sqlite.SQLiteQueryBuilder; //导入方法依赖的package包/类
private static void handleMovieFull(SQLiteQueryBuilder qb) {
if(DBG) Log.d(TAG, "File is a movie.");
qb.setTables(ScraperTables.MOVIE_TABLE_NAME +
" LEFT JOIN " + ScraperTables.FILMS_MOVIE_VIEW_NAME + " ON (" +
ScraperTables.MOVIE_TABLE_NAME + "." +
ScraperStore.Movie.ID + " = " +
ScraperTables.FILMS_MOVIE_VIEW_NAME + "." +
ScraperStore.Movie.Director.MOVIE + ") " +
"LEFT JOIN " + ScraperTables.PLAYS_MOVIE_VIEW_NAME + " ON (" +
ScraperTables.MOVIE_TABLE_NAME + "." +
ScraperStore.Movie.ID + " = " +
ScraperTables.PLAYS_MOVIE_VIEW_NAME + "." +
ScraperStore.Movie.Actor.MOVIE + ") " +
"LEFT JOIN " + ScraperTables.PRODUCES_MOVIE_VIEW_NAME + " ON (" +
ScraperTables.MOVIE_TABLE_NAME + "." +
ScraperStore.Movie.ID + " = " +
ScraperTables.PRODUCES_MOVIE_VIEW_NAME + "." +
ScraperStore.Movie.Studio.MOVIE + ") " +
"LEFT JOIN " + ScraperTables.BELONGS_MOVIE_VIEW_NAME + " ON (" +
ScraperTables.MOVIE_TABLE_NAME + "." +
ScraperStore.Movie.ID + " = " +
ScraperTables.BELONGS_MOVIE_VIEW_NAME + "." +
ScraperStore.Movie.Genre.MOVIE + ")");
}
示例3: query
import android.database.sqlite.SQLiteQueryBuilder; //导入方法依赖的package包/类
/**
* Query the database with current settings and add information
*
* @param uri The database uri
* @param projection The columns need to query
* @param selection The where clause
* @param selectionArgs The where value
* @param sortOrder The column to sort
*
* @return The query result cursor
*/
@Override
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs,
String sortOrder) {
SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
SQLiteDatabase db = mDbHelper.getReadableDatabase();
qb.setTables(TABLE_NAME);
int match = URI_MATCHER.match(uri);
if (STATION_FREQ_ID == match) {
qb.appendWhere("_id = " + uri.getPathSegments().get(1));
}
Cursor c = qb.query(db, projection, selection, selectionArgs, null, null, sortOrder);
if (null != c) {
c.setNotificationUri(getContext().getContentResolver(), uri);
}
return c;
}
示例4: query
import android.database.sqlite.SQLiteQueryBuilder; //导入方法依赖的package包/类
@Override
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
switch (URI_MATCHER.match(uri)) {
case DEBUG_CONFIG_CODE:
qb.setTables(DEBUG_CONFIG_TABLE);
qb.setProjectionMap(projectionMap);
break;
default:
throw new IllegalArgumentException("Unknown URI " + uri);
}
SQLiteDatabase db = dbHelper.getReadableDatabase();
Cursor c = qb.query(db, projection, selection, selectionArgs, null, null, sortOrder);
if (getContext() != null && getContext().getContentResolver() != null) {
c.setNotificationUri(getContext().getContentResolver(), uri);
}
return c;
}
示例5: query
import android.database.sqlite.SQLiteQueryBuilder; //导入方法依赖的package包/类
@Override
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
int matchCode = mUriMatcher.match(uri);
if (matchCode < 0) {
throw new IllegalArgumentException("Invalid query URI: " + uri);
}
SQLiteQueryBuilder queryBuilder = new SQLiteQueryBuilder();
if (isItemUri(matchCode)) {
queryBuilder.appendWhere(BaseColumns._ID + "=" + uri.getLastPathSegment());
}
queryBuilder.setTables(getTableName(matchCode));
SQLiteDatabase db = getDatabase(false);
Cursor cursor = queryBuilder.query(db, projection, selection, selectionArgs, null, null, sortOrder);
cursor.setNotificationUri(getContext().getContentResolver(), uri);
return cursor;
}
示例6: query
import android.database.sqlite.SQLiteQueryBuilder; //导入方法依赖的package包/类
@Override
public Cursor query(final Uri uri, final String[] projection, final String selection,
final String[] selectionArgs, final String sortOrder) {
final SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
qb.setTables(DATABASE_TABLE);
final List<String> pathSegments = uri.getPathSegments();
if (pathSegments.size() > 2)
throw new IllegalArgumentException(uri.toString());
if (pathSegments.size() == 2) {
final AbstractAddress address = getDepositAddress(uri);
qb.appendWhere(KEY_DEPOSIT_COIN_ID + "=");
qb.appendWhereEscapeString(address.getType().getId());
qb.appendWhere(" AND " + KEY_DEPOSIT_ADDRESS + "=");
qb.appendWhereEscapeString(address.toString());
}
final Cursor cursor = qb.query(helper.getReadableDatabase(), projection,
selection, selectionArgs, null, null, sortOrder);
cursor.setNotificationUri(getContext().getContentResolver(), uri);
return cursor;
}
示例7: queryById
import android.database.sqlite.SQLiteQueryBuilder; //导入方法依赖的package包/类
protected Cursor queryById(Uri uri, String tableName, String[] columns, String selection, String[] selectionArgs, String sortOrder) {
SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
qb.setTables(tableName);
StringBuilder w = new StringBuilder();
w.append("_id = ");
w.append(uri.getLastPathSegment());
if (selection != null) {
w.append(" AND (");
w.append(selection);
w.append(")");
}
mDb = mDbHelper.getWritableDatabase();
return qb.query(mDb,
columns,
w.toString(),
selectionArgs,
null,
null,
sortOrder
);
}
示例8: fetchAll
import android.database.sqlite.SQLiteQueryBuilder; //导入方法依赖的package包/类
/**
* Return a Cursor that contains all ExternalAttribute records which matches the parameters
*
* @param attributeName
* is the attribute name, or null to fetch any actionName
* @param appID
* is the application id, or null to fetch any appID
* @param dataTypeID
* is the dataType id, or null to fetch any dataTypeID
* @return a Cursor that contains all RegisteredAction records which matches the parameters.
*/
public Cursor fetchAll(String attributeName, Long appID, Long dataTypeID) {
SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
qb.setTables(DATABASE_TABLE);
qb.appendWhere("1=1");
if (attributeName != null) {
qb.appendWhere(" AND " + KEY_EXTERNALATTRIBUTENAME + " = ");
qb.appendWhereEscapeString(attributeName);
}
if (appID != null) {
qb.appendWhere(" AND " + KEY_APPID + " = " + appID);
}
if (dataTypeID != null) {
qb.appendWhere(" AND " + KEY_DATATYPEID + " = " + dataTypeID);
}
// Not using additional selections, selectionArgs, groupBy, having, orderBy, set them to null.
return qb.query(database, KEYS, null, null, null, null, null);
}
示例9: query
import android.database.sqlite.SQLiteQueryBuilder; //导入方法依赖的package包/类
@Override
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs,
String sortOrder) {
int key = uriMatcher.match(uri);
String table = "";
switch (key) {
case M_NOTE://0
table = tblNote.TBL_NAME;
break;
default:
break;
}
SQLiteDatabase sqlDB = mDbHelper.getWritableDatabase();
SQLiteQueryBuilder sqlBuilder = new SQLiteQueryBuilder();
sqlBuilder.setTables(table);
sqlBuilder.setDistinct(true);
Cursor c = sqlBuilder.query(sqlDB, projection, selection, selectionArgs, null, null,
sortOrder);
c.setNotificationUri(getContext().getContentResolver(), uri);
return c;
}
示例10: query
import android.database.sqlite.SQLiteQueryBuilder; //导入方法依赖的package包/类
@Override
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
SQLiteQueryBuilder queryBuilder = new SQLiteQueryBuilder();
queryBuilder.setTables(sqLiteOpenHelper.TABLE_NAME);
switch (uriMatcher.match(uri)){
case PLACES_ID:
queryBuilder.setProjectionMap(PlaceMap);
break;
default:
throw new IllegalArgumentException("Unknown URI " + uri);
}
if (sortOrder == null || sortOrder == ""){
sortOrder = sqLiteOpenHelper.ID;
}
Cursor cursor = queryBuilder.query(database, projection, selection,
selectionArgs, null, null, sortOrder);
cursor.setNotificationUri(getContext().getContentResolver(), uri);
return cursor;
}
示例11: query
import android.database.sqlite.SQLiteQueryBuilder; //导入方法依赖的package包/类
@Override
public Cursor query(Uri uri, String[] projection, String selection,
String[] selectionArgs, String sortOrder) {
createDbIfNotExists();
SqlArguments args = new SqlArguments(uri, selection, selectionArgs);
SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
qb.setTables(args.table);
SQLiteDatabase db = mOpenHelper.getWritableDatabase();
Cursor result = qb.query(db, projection, args.where, args.args, null, null, sortOrder);
result.setNotificationUri(getContext().getContentResolver(), uri);
return result;
}
示例12: handleEpisodeFull
import android.database.sqlite.SQLiteQueryBuilder; //导入方法依赖的package包/类
private static void handleEpisodeFull(SQLiteQueryBuilder qb) {
if(DBG) Log.d(TAG, "File is a TV show.");
qb.setTables(ScraperTables.EPISODE_TABLE_NAME +
" LEFT JOIN " + ScraperTables.FILMS_EPISODE_VIEW_NAME + " ON (" +
ScraperTables.EPISODE_TABLE_NAME + "." +
ScraperStore.Episode.ID + " = " +
ScraperTables.FILMS_EPISODE_VIEW_NAME + "." +
ScraperStore.Episode.Director.EPISODE + ") " +
"LEFT JOIN " + ScraperTables.GUESTS_VIEW_NAME + " ON (" +
ScraperTables.EPISODE_TABLE_NAME + "." +
ScraperStore.Episode.ID + " = " +
ScraperTables.GUESTS_VIEW_NAME + "." +
ScraperStore.Episode.Actor.EPISODE + ")");
}
示例13: query
import android.database.sqlite.SQLiteQueryBuilder; //导入方法依赖的package包/类
@Override
public Cursor query(final Uri uri, final String[] projection, final String selection,
final String[] selectionArgs, final String sortOrder) {
final SQLiteQueryBuilder builder = new SQLiteQueryBuilder();
final int match = sURIMatcher.match(uri);
switch (match) {
case SINGLE_PREFERENCE:
case INTERNAL_SINGLE_PREFERENCE:
builder.appendWhere(
TrayContract.Preferences.Columns.KEY + " = " +
DatabaseUtils.sqlEscapeString(uri.getPathSegments().get(2)));
// no break
case MODULE_PREFERENCE:
case INTERNAL_MODULE_PREFERENCE:
if (match == SINGLE_PREFERENCE
|| match == INTERNAL_SINGLE_PREFERENCE) {
builder.appendWhere(" AND ");
}
builder.appendWhere(
TrayContract.Preferences.Columns.MODULE + " = " +
DatabaseUtils.sqlEscapeString(uri.getPathSegments().get(1)));
// no break
case ALL_PREFERENCE:
case INTERNAL_ALL_PREFERENCE:
builder.setTables(getTable(uri));
break;
default:
throw new IllegalArgumentException("Query is not supported for Uri: " + uri);
}
// Query
Cursor cursor = builder.query(getReadableDatabase(), projection, selection,
selectionArgs, null, null, sortOrder);
if (cursor != null) {
cursor.setNotificationUri(getContext().getContentResolver(), uri);
}
return cursor;
}
示例14: getWifiServer
import android.database.sqlite.SQLiteQueryBuilder; //导入方法依赖的package包/类
public WifiServer getWifiServer(long id){
SQLiteDatabase db = this.getReadableDatabase();
WifiServer wifiServer = new WifiServer();
wifiServer.setId(id);
SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
qb.setTables(TABLE_SERVERS +
" JOIN " + TABLE_WIFI_SERVERS +
" USING(" + COLUMN_ID + ")");
Cursor c = qb.query(db,
new String[]{COLUMN_IS_ENABLED,
COLUMN_CERTIFICATE_ID,
COLUMN_IP_OR_HOSTNAME,
COLUMN_PORT_NUMBER,
COLUMN_SSID_WHITELIST},
COLUMN_ID + "=?", new String[]{String.valueOf(id)},
null, null, null);
if (c.moveToFirst()){
wifiServer.setIsEnabled(intToBool(c.getInt(0)));
wifiServer.setCertificateId(c.getLong(1));
wifiServer.setIpOrHostname(c.getString(2));
wifiServer.setPortNumber(c.getInt(3));
wifiServer.setSsidWhitelist(c.getString(4));
}
c.close();
db.close();
return wifiServer;
}
示例15: getMobileServer
import android.database.sqlite.SQLiteQueryBuilder; //导入方法依赖的package包/类
public MobileServer getMobileServer(long id){
SQLiteDatabase db = this.getReadableDatabase();
MobileServer mobileServer = new MobileServer();
mobileServer.setId(id);
SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
qb.setTables(TABLE_SERVERS +
" JOIN " + TABLE_MOBILE_SERVERS +
" USING(" + COLUMN_ID + ")");
Cursor c = qb.query(db,
new String[]{COLUMN_IS_ENABLED,
COLUMN_CERTIFICATE_ID,
COLUMN_IP_OR_HOSTNAME,
COLUMN_PORT_NUMBER,
COLUMN_ROAMING_ALLOWED},
COLUMN_ID + "=?", new String[]{String.valueOf(id)},
null, null, null);
if (c.moveToFirst()){
mobileServer.setIsEnabled(intToBool(c.getInt(0)));
mobileServer.setCertificateId(c.getLong(1));
mobileServer.setIpOrHostname(c.getString(2));
mobileServer.setPortNumber(c.getInt(3));
mobileServer.setRoamingAllowed(intToBool(c.getInt(4)));
}
c.close();
db.close();
return mobileServer;
}