本文整理汇总了Java中org.greenrobot.greendao.internal.SqlUtils类的典型用法代码示例。如果您正苦于以下问题:Java SqlUtils类的具体用法?Java SqlUtils怎么用?Java SqlUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SqlUtils类属于org.greenrobot.greendao.internal包,在下文中一共展示了SqlUtils类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: buildDelete
import org.greenrobot.greendao.internal.SqlUtils; //导入依赖的package包/类
/**
* Builds a reusable query object for deletion (Query objects can be executed more efficiently than creating a
* QueryBuilder for each execution.
*/
public DeleteQuery<T> buildDelete() {
if (!joins.isEmpty()) {
throw new DaoException("JOINs are not supported for DELETE queries");
}
String tablename = dao.getTablename();
String baseSql = SqlUtils.createSqlDelete(tablename, null);
StringBuilder builder = new StringBuilder(baseSql);
// tablePrefix gets replaced by table name below. Don't use tableName here because it causes trouble when
// table name ends with tablePrefix.
appendJoinsAndWheres(builder, tablePrefix);
String sql = builder.toString();
// Remove table aliases, not supported for DELETE queries.
// TODO(?): don't create table aliases in the first place.
sql = sql.replace(tablePrefix + ".\"", '"' + tablename + "\".\"");
checkLog(sql);
return DeleteQuery.create(dao, sql, values.toArray());
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:25,代码来源:QueryBuilder.java
示例2: testEqByteArray
import org.greenrobot.greendao.internal.SqlUtils; //导入依赖的package包/类
public void testEqByteArray() {
ArrayList<TestEntity> inserted = insert(3);
TestEntity testEntity = inserted.get(1);
byte[] byteArray = {96, 77, 37, -21};
testEntity.setSimpleByteArray(byteArray);
dao.update(testEntity);
// Unsupported: Query<TestEntity> query = dao.queryBuilder().where(Properties.SimpleByteArray.eq(byteArray)).build();
// Works, but probably voids any index on BLOBs (Note: there's no hex2blob function and X'?' is bad syntax):
// String conditionString = "HEX(" + Properties.SimpleByteArray.columnName + ")=?";
// WhereCondition condition = new WhereCondition.StringCondition(conditionString, SqlUtils.toHex(byteArray));
String conditionString = Properties.SimpleByteArray.columnName + '=' + SqlUtils.escapeBlobArgument(byteArray);
WhereCondition condition = new WhereCondition.StringCondition(conditionString);
Query<TestEntity> query = dao.queryBuilder().where(condition).build();
TestEntity testEntity2 = query.uniqueOrThrow();
assertEquals(testEntity.getId(), testEntity2.getId());
// Unsupported: query.setParameter(0, new byte[]{96, 77, 37, -21, 99});
// Unsupported: assertNull(query.unique());
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:24,代码来源:QueryBuilderSimpleTest.java
示例3: loadDeep
import org.greenrobot.greendao.internal.SqlUtils; //导入依赖的package包/类
public TreeEntity loadDeep(Long key) {
assertSinglePk();
if (key == null) {
return null;
}
StringBuilder builder = new StringBuilder(getSelectDeep());
builder.append("WHERE ");
SqlUtils.appendColumnsEqValue(builder, "T", getPkColumns());
String sql = builder.toString();
String[] keyArray = new String[] { key.toString() };
Cursor cursor = db.rawQuery(sql, keyArray);
try {
boolean available = cursor.moveToFirst();
if (!available) {
return null;
} else if (!cursor.isLast()) {
throw new IllegalStateException("Expected unique result, but count was " + cursor.getCount());
}
return loadCurrentDeep(cursor, true);
} finally {
cursor.close();
}
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:27,代码来源:TreeEntityDao.java
示例4: getSelectDeep
import org.greenrobot.greendao.internal.SqlUtils; //导入依赖的package包/类
protected String getSelectDeep() {
if (selectDeep == null) {
StringBuilder builder = new StringBuilder("SELECT ");
SqlUtils.appendColumns(builder, "T", getAllColumns());
builder.append(',');
SqlUtils.appendColumns(builder, "T0", daoSession.getRelationEntityDao().getAllColumns());
builder.append(',');
SqlUtils.appendColumns(builder, "T1", daoSession.getTestEntityDao().getAllColumns());
builder.append(',');
SqlUtils.appendColumns(builder, "T2", daoSession.getTestEntityDao().getAllColumns());
builder.append(',');
SqlUtils.appendColumns(builder, "T3", daoSession.getTestEntityDao().getAllColumns());
builder.append(" FROM RELATION_ENTITY T");
builder.append(" LEFT JOIN RELATION_ENTITY T0 ON T.\"PARENT_ID\"=T0.\"_id\"");
builder.append(" LEFT JOIN TEST_ENTITY T1 ON T.\"TEST_ID\"=T1.\"_id\"");
builder.append(" LEFT JOIN TEST_ENTITY T2 ON T.\"TEST_ID_NOT_NULL\"=T2.\"_id\"");
builder.append(" LEFT JOIN TEST_ENTITY T3 ON T.\"WITHOUT_PROPERTY_TEST_ID\"=T3.\"_id\"");
builder.append(' ');
selectDeep = builder.toString();
}
return selectDeep;
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:23,代码来源:RelationEntityDao.java
示例5: loadDeep
import org.greenrobot.greendao.internal.SqlUtils; //导入依赖的package包/类
public RelationEntity loadDeep(Long key) {
assertSinglePk();
if (key == null) {
return null;
}
StringBuilder builder = new StringBuilder(getSelectDeep());
builder.append("WHERE ");
SqlUtils.appendColumnsEqValue(builder, "T", getPkColumns());
String sql = builder.toString();
String[] keyArray = new String[] { key.toString() };
Cursor cursor = db.rawQuery(sql, keyArray);
try {
boolean available = cursor.moveToFirst();
if (!available) {
return null;
} else if (!cursor.isLast()) {
throw new IllegalStateException("Expected unique result, but count was " + cursor.getCount());
}
return loadCurrentDeep(cursor, true);
} finally {
cursor.close();
}
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:27,代码来源:RelationEntityDao.java
示例6: loadDeep
import org.greenrobot.greendao.internal.SqlUtils; //导入依赖的package包/类
public RelationSource2 loadDeep(Long key) {
assertSinglePk();
if (key == null) {
return null;
}
StringBuilder builder = new StringBuilder(getSelectDeep());
builder.append("WHERE ");
SqlUtils.appendColumnsEqValue(builder, "T", getPkColumns());
String sql = builder.toString();
String[] keyArray = new String[] { key.toString() };
Cursor cursor = db.rawQuery(sql, keyArray);
try {
boolean available = cursor.moveToFirst();
if (!available) {
return null;
} else if (!cursor.isLast()) {
throw new IllegalStateException("Expected unique result, but count was " + cursor.getCount());
}
return loadCurrentDeep(cursor, true);
} finally {
cursor.close();
}
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:27,代码来源:RelationSource2Dao.java
示例7: loadDeep
import org.greenrobot.greendao.internal.SqlUtils; //导入依赖的package包/类
public UsedProduct loadDeep(Long key) {
assertSinglePk();
if (key == null) {
return null;
}
StringBuilder builder = new StringBuilder(getSelectDeep());
builder.append("WHERE ");
SqlUtils.appendColumnsEqValue(builder, "T", getPkColumns());
String sql = builder.toString();
String[] keyArray = new String[] { key.toString() };
Cursor cursor = db.rawQuery(sql, keyArray);
try {
boolean available = cursor.moveToFirst();
if (!available) {
return null;
} else if (!cursor.isLast()) {
throw new IllegalStateException("Expected unique result, but count was " + cursor.getCount());
}
return loadCurrentDeep(cursor, true);
} finally {
cursor.close();
}
}
开发者ID:Lidchanin,项目名称:Shopping_List,代码行数:27,代码来源:UsedProductDao.java
示例8: loadDeep
import org.greenrobot.greendao.internal.SqlUtils; //导入依赖的package包/类
public DbWifiConnectionSensor loadDeep(Long key) {
assertSinglePk();
if (key == null) {
return null;
}
StringBuilder builder = new StringBuilder(getSelectDeep());
builder.append("WHERE ");
SqlUtils.appendColumnsEqValue(builder, "T", getPkColumns());
String sql = builder.toString();
String[] keyArray = new String[] { key.toString() };
Cursor cursor = db.rawQuery(sql, keyArray);
try {
boolean available = cursor.moveToFirst();
if (!available) {
return null;
} else if (!cursor.isLast()) {
throw new IllegalStateException("Expected unique result, but count was " + cursor.getCount());
}
return loadCurrentDeep(cursor, true);
} finally {
cursor.close();
}
}
开发者ID:Telecooperation,项目名称:assistance-platform-client-sdk-android,代码行数:27,代码来源:DbWifiConnectionSensorDao.java
示例9: loadDeep
import org.greenrobot.greendao.internal.SqlUtils; //导入依赖的package包/类
public DbTucanSensor loadDeep(Long key) {
assertSinglePk();
if (key == null) {
return null;
}
StringBuilder builder = new StringBuilder(getSelectDeep());
builder.append("WHERE ");
SqlUtils.appendColumnsEqValue(builder, "T", getPkColumns());
String sql = builder.toString();
String[] keyArray = new String[] { key.toString() };
Cursor cursor = db.rawQuery(sql, keyArray);
try {
boolean available = cursor.moveToFirst();
if (!available) {
return null;
} else if (!cursor.isLast()) {
throw new IllegalStateException("Expected unique result, but count was " + cursor.getCount());
}
return loadCurrentDeep(cursor, true);
} finally {
cursor.close();
}
}
开发者ID:Telecooperation,项目名称:assistance-platform-client-sdk-android,代码行数:27,代码来源:DbTucanSensorDao.java
示例10: loadDeep
import org.greenrobot.greendao.internal.SqlUtils; //导入依赖的package包/类
public DbCalendarSensor loadDeep(Long key) {
assertSinglePk();
if (key == null) {
return null;
}
StringBuilder builder = new StringBuilder(getSelectDeep());
builder.append("WHERE ");
SqlUtils.appendColumnsEqValue(builder, "T", getPkColumns());
String sql = builder.toString();
String[] keyArray = new String[] { key.toString() };
Cursor cursor = db.rawQuery(sql, keyArray);
try {
boolean available = cursor.moveToFirst();
if (!available) {
return null;
} else if (!cursor.isLast()) {
throw new IllegalStateException("Expected unique result, but count was " + cursor.getCount());
}
return loadCurrentDeep(cursor, true);
} finally {
cursor.close();
}
}
开发者ID:Telecooperation,项目名称:assistance-platform-client-sdk-android,代码行数:27,代码来源:DbCalendarSensorDao.java
示例11: getSelectDeep
import org.greenrobot.greendao.internal.SqlUtils; //导入依赖的package包/类
protected String getSelectDeep() {
if (selectDeep == null) {
StringBuilder builder = new StringBuilder("SELECT ");
SqlUtils.appendColumns(builder, "T", getAllColumns());
builder.append(',');
SqlUtils.appendColumns(builder, "T0", daoSession.getDbContactSensorDao().getAllColumns());
builder.append(',');
SqlUtils.appendColumns(builder, "T1", daoSession.getDbDeviceDao().getAllColumns());
builder.append(" FROM contact_email_sensor T");
builder.append(" LEFT JOIN contact_sensor T0 ON T.\"CONTACT_ID\"=T0.\"_id\"");
builder.append(" LEFT JOIN device T1 ON T.\"DEVICE_ID\"=T1.\"_id\"");
builder.append(' ');
selectDeep = builder.toString();
}
return selectDeep;
}
开发者ID:Telecooperation,项目名称:assistance-platform-client-sdk-android,代码行数:17,代码来源:DbContactEmailSensorDao.java
示例12: loadDeep
import org.greenrobot.greendao.internal.SqlUtils; //导入依赖的package包/类
public DbContactEmailSensor loadDeep(Long key) {
assertSinglePk();
if (key == null) {
return null;
}
StringBuilder builder = new StringBuilder(getSelectDeep());
builder.append("WHERE ");
SqlUtils.appendColumnsEqValue(builder, "T", getPkColumns());
String sql = builder.toString();
String[] keyArray = new String[] { key.toString() };
Cursor cursor = db.rawQuery(sql, keyArray);
try {
boolean available = cursor.moveToFirst();
if (!available) {
return null;
} else if (!cursor.isLast()) {
throw new IllegalStateException("Expected unique result, but count was " + cursor.getCount());
}
return loadCurrentDeep(cursor, true);
} finally {
cursor.close();
}
}
开发者ID:Telecooperation,项目名称:assistance-platform-client-sdk-android,代码行数:27,代码来源:DbContactEmailSensorDao.java
示例13: loadDeep
import org.greenrobot.greendao.internal.SqlUtils; //导入依赖的package包/类
public DbLoudnessSensor loadDeep(Long key) {
assertSinglePk();
if (key == null) {
return null;
}
StringBuilder builder = new StringBuilder(getSelectDeep());
builder.append("WHERE ");
SqlUtils.appendColumnsEqValue(builder, "T", getPkColumns());
String sql = builder.toString();
String[] keyArray = new String[] { key.toString() };
Cursor cursor = db.rawQuery(sql, keyArray);
try {
boolean available = cursor.moveToFirst();
if (!available) {
return null;
} else if (!cursor.isLast()) {
throw new IllegalStateException("Expected unique result, but count was " + cursor.getCount());
}
return loadCurrentDeep(cursor, true);
} finally {
cursor.close();
}
}
开发者ID:Telecooperation,项目名称:assistance-platform-client-sdk-android,代码行数:27,代码来源:DbLoudnessSensorDao.java
示例14: loadDeep
import org.greenrobot.greendao.internal.SqlUtils; //导入依赖的package包/类
public DbBrowserHistorySensor loadDeep(Long key) {
assertSinglePk();
if (key == null) {
return null;
}
StringBuilder builder = new StringBuilder(getSelectDeep());
builder.append("WHERE ");
SqlUtils.appendColumnsEqValue(builder, "T", getPkColumns());
String sql = builder.toString();
String[] keyArray = new String[] { key.toString() };
Cursor cursor = db.rawQuery(sql, keyArray);
try {
boolean available = cursor.moveToFirst();
if (!available) {
return null;
} else if (!cursor.isLast()) {
throw new IllegalStateException("Expected unique result, but count was " + cursor.getCount());
}
return loadCurrentDeep(cursor, true);
} finally {
cursor.close();
}
}
开发者ID:Telecooperation,项目名称:assistance-platform-client-sdk-android,代码行数:27,代码来源:DbBrowserHistorySensorDao.java
示例15: loadDeep
import org.greenrobot.greendao.internal.SqlUtils; //导入依赖的package包/类
public DbCallLogSensor loadDeep(Long key) {
assertSinglePk();
if (key == null) {
return null;
}
StringBuilder builder = new StringBuilder(getSelectDeep());
builder.append("WHERE ");
SqlUtils.appendColumnsEqValue(builder, "T", getPkColumns());
String sql = builder.toString();
String[] keyArray = new String[] { key.toString() };
Cursor cursor = db.rawQuery(sql, keyArray);
try {
boolean available = cursor.moveToFirst();
if (!available) {
return null;
} else if (!cursor.isLast()) {
throw new IllegalStateException("Expected unique result, but count was " + cursor.getCount());
}
return loadCurrentDeep(cursor, true);
} finally {
cursor.close();
}
}
开发者ID:Telecooperation,项目名称:assistance-platform-client-sdk-android,代码行数:27,代码来源:DbCallLogSensorDao.java
示例16: loadDeep
import org.greenrobot.greendao.internal.SqlUtils; //导入依赖的package包/类
public DbMobileConnectionSensor loadDeep(Long key) {
assertSinglePk();
if (key == null) {
return null;
}
StringBuilder builder = new StringBuilder(getSelectDeep());
builder.append("WHERE ");
SqlUtils.appendColumnsEqValue(builder, "T", getPkColumns());
String sql = builder.toString();
String[] keyArray = new String[] { key.toString() };
Cursor cursor = db.rawQuery(sql, keyArray);
try {
boolean available = cursor.moveToFirst();
if (!available) {
return null;
} else if (!cursor.isLast()) {
throw new IllegalStateException("Expected unique result, but count was " + cursor.getCount());
}
return loadCurrentDeep(cursor, true);
} finally {
cursor.close();
}
}
开发者ID:Telecooperation,项目名称:assistance-platform-client-sdk-android,代码行数:27,代码来源:DbMobileConnectionSensorDao.java
示例17: loadDeep
import org.greenrobot.greendao.internal.SqlUtils; //导入依赖的package包/类
public DbMagneticFieldSensor loadDeep(Long key) {
assertSinglePk();
if (key == null) {
return null;
}
StringBuilder builder = new StringBuilder(getSelectDeep());
builder.append("WHERE ");
SqlUtils.appendColumnsEqValue(builder, "T", getPkColumns());
String sql = builder.toString();
String[] keyArray = new String[] { key.toString() };
Cursor cursor = db.rawQuery(sql, keyArray);
try {
boolean available = cursor.moveToFirst();
if (!available) {
return null;
} else if (!cursor.isLast()) {
throw new IllegalStateException("Expected unique result, but count was " + cursor.getCount());
}
return loadCurrentDeep(cursor, true);
} finally {
cursor.close();
}
}
开发者ID:Telecooperation,项目名称:assistance-platform-client-sdk-android,代码行数:27,代码来源:DbMagneticFieldSensorDao.java
示例18: loadDeep
import org.greenrobot.greendao.internal.SqlUtils; //导入依赖的package包/类
public LogsSensorUpload loadDeep(Long key) {
assertSinglePk();
if (key == null) {
return null;
}
StringBuilder builder = new StringBuilder(getSelectDeep());
builder.append("WHERE ");
SqlUtils.appendColumnsEqValue(builder, "T", getPkColumns());
String sql = builder.toString();
String[] keyArray = new String[] { key.toString() };
Cursor cursor = db.rawQuery(sql, keyArray);
try {
boolean available = cursor.moveToFirst();
if (!available) {
return null;
} else if (!cursor.isLast()) {
throw new IllegalStateException("Expected unique result, but count was " + cursor.getCount());
}
return loadCurrentDeep(cursor, true);
} finally {
cursor.close();
}
}
开发者ID:Telecooperation,项目名称:assistance-platform-client-sdk-android,代码行数:27,代码来源:LogsSensorUploadDao.java
示例19: loadDeep
import org.greenrobot.greendao.internal.SqlUtils; //导入依赖的package包/类
public DbUserSocialProfile loadDeep(Long key) {
assertSinglePk();
if (key == null) {
return null;
}
StringBuilder builder = new StringBuilder(getSelectDeep());
builder.append("WHERE ");
SqlUtils.appendColumnsEqValue(builder, "T", getPkColumns());
String sql = builder.toString();
String[] keyArray = new String[] { key.toString() };
Cursor cursor = db.rawQuery(sql, keyArray);
try {
boolean available = cursor.moveToFirst();
if (!available) {
return null;
} else if (!cursor.isLast()) {
throw new IllegalStateException("Expected unique result, but count was " + cursor.getCount());
}
return loadCurrentDeep(cursor, true);
} finally {
cursor.close();
}
}
开发者ID:Telecooperation,项目名称:assistance-platform-client-sdk-android,代码行数:27,代码来源:DbUserSocialProfileDao.java
示例20: loadDeep
import org.greenrobot.greendao.internal.SqlUtils; //导入依赖的package包/类
public DbFacebookSensor loadDeep(Long key) {
assertSinglePk();
if (key == null) {
return null;
}
StringBuilder builder = new StringBuilder(getSelectDeep());
builder.append("WHERE ");
SqlUtils.appendColumnsEqValue(builder, "T", getPkColumns());
String sql = builder.toString();
String[] keyArray = new String[] { key.toString() };
Cursor cursor = db.rawQuery(sql, keyArray);
try {
boolean available = cursor.moveToFirst();
if (!available) {
return null;
} else if (!cursor.isLast()) {
throw new IllegalStateException("Expected unique result, but count was " + cursor.getCount());
}
return loadCurrentDeep(cursor, true);
} finally {
cursor.close();
}
}
开发者ID:Telecooperation,项目名称:assistance-platform-client-sdk-android,代码行数:27,代码来源:DbFacebookSensorDao.java
注:本文中的org.greenrobot.greendao.internal.SqlUtils类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论