use of android.database.sqlite.SQLiteQueryBuilder in project aware-client by denzilferreira.
the class TimeZone_Provider method query.
/**
* Query entries from the database
*/
@Override
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
initialiseDatabase();
SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
switch(sUriMatcher.match(uri)) {
case TIMEZONE:
qb.setTables(DATABASE_TABLES[0]);
qb.setProjectionMap(timeZoneMap);
break;
default:
throw new IllegalArgumentException("Unknown URI " + uri);
}
try {
Cursor c = qb.query(database, projection, selection, selectionArgs, null, null, sortOrder);
c.setNotificationUri(getContext().getContentResolver(), uri);
return c;
} catch (IllegalStateException e) {
if (Aware.DEBUG)
Log.e(Aware.TAG, e.getMessage());
return null;
}
}
use of android.database.sqlite.SQLiteQueryBuilder in project aware-client by denzilferreira.
the class Traffic_Provider method query.
/**
* Query entries from the database
*/
@Override
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
initialiseDatabase();
SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
switch(sUriMatcher.match(uri)) {
case TRAFFIC:
qb.setTables(DATABASE_TABLES[0]);
qb.setProjectionMap(trafficProjectionMap);
break;
default:
throw new IllegalArgumentException("Unknown URI " + uri);
}
try {
Cursor c = qb.query(database, projection, selection, selectionArgs, null, null, sortOrder);
c.setNotificationUri(getContext().getContentResolver(), uri);
return c;
} catch (IllegalStateException e) {
if (Aware.DEBUG)
Log.e(Aware.TAG, e.getMessage());
return null;
}
}
use of android.database.sqlite.SQLiteQueryBuilder in project aware-client by denzilferreira.
the class WiFi_Provider method query.
/**
* Query entries from the database
*/
@Override
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
initialiseDatabase();
SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
switch(sUriMatcher.match(uri)) {
case WIFI_DATA:
qb.setTables(DATABASE_TABLES[0]);
qb.setProjectionMap(wifiDataMap);
break;
case WIFI_DEV:
qb.setTables(DATABASE_TABLES[1]);
qb.setProjectionMap(wifiDeviceMap);
break;
default:
throw new IllegalArgumentException("Unknown URI " + uri);
}
try {
Cursor c = qb.query(database, projection, selection, selectionArgs, null, null, sortOrder);
c.setNotificationUri(getContext().getContentResolver(), uri);
return c;
} catch (IllegalStateException e) {
if (Aware.DEBUG)
Log.e(Aware.TAG, e.getMessage());
return null;
}
}
use of android.database.sqlite.SQLiteQueryBuilder in project aware-client by denzilferreira.
the class Applications_Provider method query.
/**
* Query entries from the database
*/
@Override
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
initialiseDatabase();
SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
switch(sUriMatcher.match(uri)) {
case FOREGROUND:
qb.setTables(DATABASE_TABLES[0]);
qb.setProjectionMap(foregroundMap);
break;
case APPLICATIONS:
qb.setTables(DATABASE_TABLES[1]);
qb.setProjectionMap(applicationsMap);
break;
case NOTIFICATIONS:
qb.setTables(DATABASE_TABLES[2]);
qb.setProjectionMap(notificationMap);
break;
case ERROR:
qb.setTables(DATABASE_TABLES[3]);
qb.setProjectionMap(crashesMap);
break;
default:
throw new IllegalArgumentException("Unknown URI " + uri);
}
try {
Cursor c = qb.query(database, projection, selection, selectionArgs, null, null, sortOrder);
c.setNotificationUri(getContext().getContentResolver(), uri);
return c;
} catch (IllegalStateException e) {
if (Aware.DEBUG)
Log.e(Aware.TAG, e.getMessage());
return null;
}
}
use of android.database.sqlite.SQLiteQueryBuilder in project aware-client by denzilferreira.
the class Barometer_Provider method query.
/**
* Query entries from the database
*/
@Override
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
initialiseDatabase();
SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
switch(sUriMatcher.match(uri)) {
case SENSOR_DEV:
qb.setTables(DATABASE_TABLES[0]);
qb.setProjectionMap(sensorMap);
break;
case SENSOR_DATA:
qb.setTables(DATABASE_TABLES[1]);
qb.setProjectionMap(sensorDataMap);
break;
default:
throw new IllegalArgumentException("Unknown URI " + uri);
}
try {
Cursor c = qb.query(database, projection, selection, selectionArgs, null, null, sortOrder);
c.setNotificationUri(getContext().getContentResolver(), uri);
return c;
} catch (IllegalStateException e) {
if (Aware.DEBUG)
Log.e(Aware.TAG, e.getMessage());
return null;
}
}
Aggregations