use of android.database.sqlite.SQLiteQueryBuilder in project aware-client by denzilferreira.
the class Aware_Provider method query.
/**
* Query entries from the database
*/
@Override
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
initialiseDatabase();
if (database == null)
return null;
SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
switch(sUriMatcher.match(uri)) {
case DEVICE_INFO:
qb.setTables(DATABASE_TABLES[0]);
qb.setProjectionMap(deviceMap);
break;
case SETTING:
qb.setTables(DATABASE_TABLES[1]);
qb.setProjectionMap(settingsMap);
break;
case PLUGIN:
qb.setTables(DATABASE_TABLES[2]);
qb.setProjectionMap(pluginsMap);
break;
case STUDY:
qb.setTables(DATABASE_TABLES[3]);
qb.setProjectionMap(studiesMap);
break;
case LOG:
qb.setTables(DATABASE_TABLES[4]);
qb.setProjectionMap(logMap);
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 ESM_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 ESMS_QUEUE:
qb.setTables(DATABASE_TABLES[0]);
qb.setProjectionMap(questionsMap);
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 Gravity_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(sensorDeviceMap);
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 Gyroscope_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 GYRO_DEV:
qb.setTables(DATABASE_TABLES[0]);
qb.setProjectionMap(gyroDeviceMap);
break;
case GYRO_DATA:
qb.setTables(DATABASE_TABLES[1]);
qb.setProjectionMap(gyroDataMap);
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 Installations_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 INSTALLATIONS:
qb.setTables(DATABASE_TABLES[0]);
qb.setProjectionMap(installationsMap);
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