use of android.database.sqlite.SQLiteQueryBuilder in project aware-client by denzilferreira.
the class Battery_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 BATTERY:
qb.setTables(DATABASE_TABLES[0]);
qb.setProjectionMap(batteryProjectionMap);
break;
case BATTERY_DISCHARGE:
qb.setTables(DATABASE_TABLES[1]);
qb.setProjectionMap(batteryDischargesMap);
break;
case BATTERY_CHARGE:
qb.setTables(DATABASE_TABLES[2]);
qb.setProjectionMap(batteryChargesMap);
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 Bluetooth_Provider method query.
/**
* Query bluetooth 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 BT_DEV:
qb.setTables(DATABASE_TABLES[0]);
qb.setProjectionMap(bluetoothDeviceMap);
break;
case BT_DATA:
qb.setTables(DATABASE_TABLES[1]);
qb.setProjectionMap(bluetoothDataMap);
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 Communication_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 CALLS:
qb.setTables(DATABASE_TABLES[0]);
qb.setProjectionMap(callsProjectionMap);
break;
case MESSAGES:
qb.setTables(DATABASE_TABLES[1]);
qb.setProjectionMap(messageProjectionMap);
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 Light_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;
}
}
use of android.database.sqlite.SQLiteQueryBuilder in project aware-client by denzilferreira.
the class Linear_Accelerometer_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 ACCEL_DEV:
qb.setTables(DATABASE_TABLES[0]);
qb.setProjectionMap(accelDeviceMap);
break;
case ACCEL_DATA:
qb.setTables(DATABASE_TABLES[1]);
qb.setProjectionMap(accelDataMap);
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