• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java SqlDelightStatement类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中com.squareup.sqldelight.SqlDelightStatement的典型用法代码示例。如果您正苦于以下问题:Java SqlDelightStatement类的具体用法?Java SqlDelightStatement怎么用?Java SqlDelightStatement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

SqlDelightStatement类属于com.squareup.sqldelight包,在下文中一共展示了SqlDelightStatement类的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: all

点赞 2

import com.squareup.sqldelight.SqlDelightStatement; //导入依赖的package包/类
public Observable<List<Permission>> all(BriteDatabase db) {
  CursorToListMapper<Permission> cursorToList =
      new CursorToListMapper<>(Permission.FACTORY.selectAllMapper());
  SqlDelightStatement selectAll = Permission.FACTORY.selectAll();

  return db.createQuery(selectAll.tables, selectAll.statement)
      .map(SqlBrite.Query::run)
      .map(cursorToList);
}
 

开发者ID:philipphager,
项目名称:disclosure-android-app,
代码行数:10,
代码来源:PermissionRepository.java

示例2: byApp

点赞 2

import com.squareup.sqldelight.SqlDelightStatement; //导入依赖的package包/类
public Observable<List<Permission>> byApp(BriteDatabase db, long appId, boolean isGranted) {
  SqlDelightStatement selectByApp = Permission.FACTORY.selectByApp(appId, isGranted);
  CursorToListMapper<Permission> cursorToList =
      new CursorToListMapper<>(Permission.FACTORY.selectByAppMapper());

  return db.createQuery(selectByApp.tables, selectByApp.statement, selectByApp.args)
      .map(SqlBrite.Query::run)
      .map(cursorToList);
}
 

开发者ID:philipphager,
项目名称:disclosure-android-app,
代码行数:10,
代码来源:PermissionRepository.java

示例3: byAppAndLibrary

点赞 2

import com.squareup.sqldelight.SqlDelightStatement; //导入依赖的package包/类
public Observable<List<Permission>> byAppAndLibrary(BriteDatabase db, long appId,
    String libraryId) {
  SqlDelightStatement selectByAppAndLibrary =
      Permission.FACTORY.selectByAppAndLibrary(appId, libraryId);
  CursorToListMapper<Permission> cursorToList =
      new CursorToListMapper<>(Permission.FACTORY.selectByAppAndLibraryMapper());

  return db.createQuery(selectByAppAndLibrary.tables, selectByAppAndLibrary.statement,
      selectByAppAndLibrary.args)
      .map(SqlBrite.Query::run)
      .map(cursorToList);
}
 

开发者ID:philipphager,
项目名称:disclosure-android-app,
代码行数:13,
代码来源:PermissionRepository.java

示例4: all

点赞 2

import com.squareup.sqldelight.SqlDelightStatement; //导入依赖的package包/类
public Observable<List<PermissionGroup>> all(BriteDatabase db) {
  CursorToListMapper<PermissionGroup> cursorToList =
      new CursorToListMapper<>(PermissionGroup.FACTORY.selectAllMapper());
  SqlDelightStatement selectAll = PermissionGroup.FACTORY.selectAll();

  return db.createQuery(selectAll.tables, selectAll.statement)
      .map(SqlBrite.Query::run)
      .map(cursorToList);
}
 

开发者ID:philipphager,
项目名称:disclosure-android-app,
代码行数:10,
代码来源:PermissionGroupRepository.java

示例5: byId

点赞 2

import com.squareup.sqldelight.SqlDelightStatement; //导入依赖的package包/类
public Observable<List<PermissionGroup>> byId(BriteDatabase db, String id) {
  SqlDelightStatement selectById = PermissionGroup.FACTORY.selectById(id);
  CursorToListMapper<PermissionGroup> cursorToList =
      new CursorToListMapper<>(PermissionGroup.FACTORY.selectByIdMapper());

  return db.createQuery(selectById.tables, selectById.statement, selectById.args)
      .map(SqlBrite.Query::run)
      .map(cursorToList);
}
 

开发者ID:philipphager,
项目名称:disclosure-android-app,
代码行数:10,
代码来源:PermissionGroupRepository.java

示例6: all

点赞 2

import com.squareup.sqldelight.SqlDelightStatement; //导入依赖的package包/类
public Observable<List<Version>> all(BriteDatabase db) {
  CursorToListMapper<Version> cursorToList =
      new CursorToListMapper<>(Version.FACTORY.selectAllMapper());
  SqlDelightStatement selectAll = Version.FACTORY.selectAll();

  return db.createQuery(selectAll.tables, selectAll.statement)
      .map(SqlBrite.Query::run)
      .map(cursorToList);
}
 

开发者ID:philipphager,
项目名称:disclosure-android-app,
代码行数:10,
代码来源:VersionRepository.java

示例7: byAppId

点赞 2

import com.squareup.sqldelight.SqlDelightStatement; //导入依赖的package包/类
public Observable<List<Version>> byAppId(BriteDatabase db, long appId) {
  SqlDelightStatement selectByApp = Version.FACTORY.selectByApp(appId);
  CursorToListMapper<Version> cursorToList =
      new CursorToListMapper<>(Version.FACTORY.selectByAppMapper());

  return db.createQuery(selectByApp.tables, selectByApp.statement, selectByApp.args)
      .map(SqlBrite.Query::run)
      .map(cursorToList);
}
 

开发者ID:philipphager,
项目名称:disclosure-android-app,
代码行数:10,
代码来源:VersionRepository.java

示例8: all

点赞 2

import com.squareup.sqldelight.SqlDelightStatement; //导入依赖的package包/类
public Observable<List<App>> all(BriteDatabase db) {
  CursorToListMapper<App> cursorToList = new CursorToListMapper<>(App.FACTORY.selectAllMapper());
  SqlDelightStatement selectAll = App.FACTORY.selectAll();

  return db.createQuery(selectAll.tables, selectAll.statement)
      .map(SqlBrite.Query::run)
      .map(cursorToList);
}
 

开发者ID:philipphager,
项目名称:disclosure-android-app,
代码行数:9,
代码来源:AppRepository.java

示例9: byPackageName

点赞 2

import com.squareup.sqldelight.SqlDelightStatement; //导入依赖的package包/类
public Observable<App> byPackageName(BriteDatabase db, String packageName) {
  SqlDelightStatement selectByPackage = App.FACTORY.selectByPackage(packageName);
  CursorToListMapper<App> cursorToList =
      new CursorToListMapper<>(App.FACTORY.selectByLibraryMapper());

  return db.createQuery(selectByPackage.tables, selectByPackage.statement, selectByPackage.args)
      .map(SqlBrite.Query::run)
      .map(cursorToList)
      .flatMap(apps -> Observable.from(apps).first());
}
 

开发者ID:philipphager,
项目名称:disclosure-android-app,
代码行数:11,
代码来源:AppRepository.java

示例10: byLibrary

点赞 2

import com.squareup.sqldelight.SqlDelightStatement; //导入依赖的package包/类
public Observable<List<App>> byLibrary(BriteDatabase db, String libraryId) {
  SqlDelightStatement selectByLibrary = App.FACTORY.selectByLibrary(libraryId);
  CursorToListMapper<App> cursorToList =
      new CursorToListMapper<>(App.FACTORY.selectByLibraryMapper());

  return db.createQuery(selectByLibrary.tables, selectByLibrary.statement, selectByLibrary.args)
      .map(SqlBrite.Query::run)
      .map(cursorToList);
}
 

开发者ID:philipphager,
项目名称:disclosure-android-app,
代码行数:10,
代码来源:AppRepository.java

示例11: allInfos

点赞 2

import com.squareup.sqldelight.SqlDelightStatement; //导入依赖的package包/类
public Observable<List<AppInfo>> allInfos(BriteDatabase db) {
  CursorToListMapper<AppInfo> cursorToList = new CursorToListMapper<>(AppInfo.MAPPER);
  SqlDelightStatement selectAllInfos = App.FACTORY.selectAllInfos();

  return db.createQuery(selectAllInfos.tables, selectAllInfos.statement)
      .map(SqlBrite.Query::run)
      .map(cursorToList);
}
 

开发者ID:philipphager,
项目名称:disclosure-android-app,
代码行数:9,
代码来源:AppRepository.java

示例12: byLibraryWithPermissionCount

点赞 2

import com.squareup.sqldelight.SqlDelightStatement; //导入依赖的package包/类
public Observable<List<AppWithPermissions>> byLibraryWithPermissionCount(BriteDatabase db,
    String libraryId) {
  SqlDelightStatement selectByLibrary = App.FACTORY.selectAllWithPermissionCount(libraryId);
  CursorToListMapper<AppWithPermissions> cursorToList =
      new CursorToListMapper<>(AppWithPermissions.MAPPER);

  return db.createQuery(selectByLibrary.tables, selectByLibrary.statement, selectByLibrary.args)
      .map(SqlBrite.Query::run)
      .map(cursorToList);
}
 

开发者ID:philipphager,
项目名称:disclosure-android-app,
代码行数:11,
代码来源:AppRepository.java

示例13: getAppId

点赞 2

import com.squareup.sqldelight.SqlDelightStatement; //导入依赖的package包/类
private long getAppId(BriteDatabase db, String packageName) {
  SqlDelightStatement selectAppId = App.FACTORY.selectAppId(packageName);
  Cursor cursor = db.query(selectAppId.statement, selectAppId.args);

  if (cursor.getCount() > 0) {
    cursor.moveToFirst();
    return cursor.getLong(0);
  }
  return SQL_ERROR;
}
 

开发者ID:philipphager,
项目名称:disclosure-android-app,
代码行数:11,
代码来源:AppRepository.java

示例14: all

点赞 2

import com.squareup.sqldelight.SqlDelightStatement; //导入依赖的package包/类
public Observable<List<ProtectedMethod>> all(BriteDatabase db) {
  CursorToListMapper<ProtectedMethod> cursorToList =
      new CursorToListMapper<>(ProtectedMethod.FACTORY.selectAllMapper());
  SqlDelightStatement selectAll = ProtectedMethod.FACTORY.selectAll();

  return db.createQuery(selectAll.tables, selectAll.statement)
      .map(SqlBrite.Query::run)
      .map(cursorToList);
}
 

开发者ID:philipphager,
项目名称:disclosure-android-app,
代码行数:10,
代码来源:MethodRepository.java

示例15: byPermission

点赞 2

import com.squareup.sqldelight.SqlDelightStatement; //导入依赖的package包/类
public Observable<List<Method>> byPermission(BriteDatabase db, String permissionId) {
  SqlDelightStatement selectByPermission =
      ProtectedMethod.FACTORY.selectByPermission(permissionId);
  CursorToListMapper<Method> cursorToList = new CursorToListMapper<Method>(MAPPER);

  return db.createQuery(selectByPermission.tables, selectByPermission.statement,
      selectByPermission.args)
      .map(SqlBrite.Query::run)
      .map(cursorToList);
}
 

开发者ID:philipphager,
项目名称:disclosure-android-app,
代码行数:11,
代码来源:MethodRepository.java

示例16: all

点赞 2

import com.squareup.sqldelight.SqlDelightStatement; //导入依赖的package包/类
public Observable<List<Library>> all(BriteDatabase db) {
  CursorToListMapper<Library> cursorToList =
      new CursorToListMapper<>(Library.FACTORY.selectAllMapper());
  SqlDelightStatement selectAll = Library.FACTORY.selectAll();

  return db.createQuery(selectAll.tables, selectAll.statement)
      .map(SqlBrite.Query::run)
      .map(cursorToList);
}
 

开发者ID:philipphager,
项目名称:disclosure-android-app,
代码行数:10,
代码来源:LibraryRepository.java

示例17: byId

点赞 2

import com.squareup.sqldelight.SqlDelightStatement; //导入依赖的package包/类
public Observable<Library> byId(BriteDatabase db, String id) {
  SqlDelightStatement selectById = Library.FACTORY.selectById(id);
  CursorToListMapper<Library> cursorToList =
      new CursorToListMapper<>(Library.FACTORY.selectByIdMapper());

  return db.createQuery(selectById.tables, selectById.statement, selectById.args)
      .map(SqlBrite.Query::run)
      .map(cursorToList)
      .flatMap(libraries -> Observable.from(libraries).first());
}
 

开发者ID:philipphager,
项目名称:disclosure-android-app,
代码行数:11,
代码来源:LibraryRepository.java

示例18: byApp

点赞 2

import com.squareup.sqldelight.SqlDelightStatement; //导入依赖的package包/类
public Observable<List<Library>> byApp(BriteDatabase db, long appId) {
  SqlDelightStatement selectByApp = Library.FACTORY.selectByApp(appId);
  CursorToListMapper<Library> cursorToList =
      new CursorToListMapper<>(Library.FACTORY.selectByAppMapper());

  return db.createQuery(selectByApp.tables, selectByApp.statement, selectByApp.args)
      .map(SqlBrite.Query::run)
      .map(cursorToList);
}
 

开发者ID:philipphager,
项目名称:disclosure-android-app,
代码行数:10,
代码来源:LibraryRepository.java

示例19: byAppWithPermissionUpdate

点赞 2

import com.squareup.sqldelight.SqlDelightStatement; //导入依赖的package包/类
public Observable<List<Library>> byAppWithPermissionUpdate(BriteDatabase db, long appId) {
  SqlDelightStatement selectByApp = Library.FACTORY.selectByAppUpdateOnNewPermission(appId);
  CursorToListMapper<Library> cursorToList =
      new CursorToListMapper<>(Library.FACTORY.selectByAppMapper());

  return db.createQuery(selectByApp.tables, selectByApp.statement, selectByApp.args)
      .map(SqlBrite.Query::run)
      .map(cursorToList);
}
 

开发者ID:philipphager,
项目名称:disclosure-android-app,
代码行数:10,
代码来源:LibraryRepository.java

示例20: byType

点赞 2

import com.squareup.sqldelight.SqlDelightStatement; //导入依赖的package包/类
public Observable<List<Library>> byType(BriteDatabase db, Library.Type type) {
  SqlDelightStatement selectByType = Library.FACTORY.selectByType(type);
  CursorToListMapper<Library> cursorToList =
      new CursorToListMapper<>(Library.FACTORY.selectByTypeMapper());

  return db.createQuery(selectByType.tables, selectByType.statement, selectByType.args)
      .map(SqlBrite.Query::run)
      .map(cursorToList);
}
 

开发者ID:philipphager,
项目名称:disclosure-android-app,
代码行数:10,
代码来源:LibraryRepository.java

示例21: infoByType

点赞 2

import com.squareup.sqldelight.SqlDelightStatement; //导入依赖的package包/类
public Observable<List<LibraryInfo>> infoByType(BriteDatabase db, Library.Type type) {
  SqlDelightStatement selectByType = Library.FACTORY.selectByTypeWithAppCount(type);
  CursorToListMapper<LibraryInfo> cursorToList = new CursorToListMapper<>(LibraryInfo.MAPPER);

  return db.createQuery(selectByType.tables, selectByType.statement, selectByType.args)
      .map(SqlBrite.Query::run)
      .map(cursorToList);
}
 

开发者ID:philipphager,
项目名称:disclosure-android-app,
代码行数:9,
代码来源:LibraryRepository.java

示例22: lastUpdated

点赞 2

import com.squareup.sqldelight.SqlDelightStatement; //导入依赖的package包/类
public Observable<OffsetDateTime> lastUpdated(BriteDatabase db) {
  SqlDelightStatement selectLastUpdated = Library.FACTORY.selectLastUpdated();

  return db.createQuery(selectLastUpdated.tables, selectLastUpdated.statement)
      .map(SqlBrite.Query::run)
      .map(cursor -> {
        if (cursor != null && cursor.getCount() > 0) {
          cursor.moveToFirst();
          return Library.FACTORY.selectLastUpdatedMapper().map(cursor);
        }
        return Date.MIN;
      });
}
 

开发者ID:philipphager,
项目名称:disclosure-android-app,
代码行数:14,
代码来源:LibraryRepository.java

示例23: countUsedLibrariesByType

点赞 2

import com.squareup.sqldelight.SqlDelightStatement; //导入依赖的package包/类
public Observable<Long> countUsedLibrariesByType(BriteDatabase db, Library.Type type) {
  SqlDelightStatement countByType = Library.FACTORY.countUsedLibrariesByType(type);

  return db.createQuery(countByType.tables, countByType.statement, countByType.args)
      .map(SqlBrite.Query::run)
      .map(cursor -> {
        if (cursor != null && cursor.getCount() > 0) {
          cursor.moveToFirst();
          return Library.FACTORY.countUsedLibrariesByTypeMapper().map(cursor);
        }
        return 0L;
      });
}
 

开发者ID:philipphager,
项目名称:disclosure-android-app,
代码行数:14,
代码来源:LibraryRepository.java

示例24: isMovieFavorite

点赞 2

import com.squareup.sqldelight.SqlDelightStatement; //导入依赖的package包/类
@Override
public Observable<Boolean> isMovieFavorite(Long movieId) {
    SqlDelightStatement statement = MovieDB.FACTORY.is_movie_favorite(movieId);
    return db.createQuery(MovieModel.TABLE_NAME, statement.statement, statement.args)
            .map(query -> {
                Cursor cursor = query.run();
                return cursor.moveToNext();
            });
}
 

开发者ID:Rashwan,
项目名称:Reactive-Popular-Movies,
代码行数:10,
代码来源:MoviesLocalDataSource.java

示例25: isMovieInWatchlist

点赞 2

import com.squareup.sqldelight.SqlDelightStatement; //导入依赖的package包/类
@Override
public Observable<Boolean> isMovieInWatchlist(Long movieId) {
    SqlDelightStatement statement = MovieDB.FACTORY.is_movie_in_watchlist(movieId);
    return db.createQuery(MovieModel.TABLE_NAME, statement.statement, statement.args)
            .map(query -> {
                Cursor cursor = query.run();
                return cursor.moveToNext();
            });
}
 

开发者ID:Rashwan,
项目名称:Reactive-Popular-Movies,
代码行数:10,
代码来源:MoviesLocalDataSource.java

示例26: makeReadQuery

点赞 2

import com.squareup.sqldelight.SqlDelightStatement; //导入依赖的package包/类
@NonNull
public static RawQuery makeReadQuery(@NonNull SqlDelightStatement statement) {
    return RawQuery.builder()
            .query(statement.statement)
            .args(statement.args)
            .observesTables(statement.tables)
            .build();
}
 

开发者ID:pushtorefresh,
项目名称:storio,
代码行数:9,
代码来源:SQLUtils.java

示例27: makeWriteQuery

点赞 2

import com.squareup.sqldelight.SqlDelightStatement; //导入依赖的package包/类
@NonNull
public static RawQuery makeWriteQuery(@NonNull SqlDelightStatement statement) {
    return RawQuery.builder()
            .query(statement.statement)
            .args(statement.args)
            .affectsTables(statement.tables)
            .build();
}
 

开发者ID:pushtorefresh,
项目名称:storio,
代码行数:9,
代码来源:SQLUtils.java

示例28: indexedStringEntityQueriesRun

点赞 2

import com.squareup.sqldelight.SqlDelightStatement; //导入依赖的package包/类
private void indexedStringEntityQueriesRun(SQLiteDatabase database, int count) {
    // create strings
    String[] fixedRandomStrings = StringGenerator.createFixedRandomStrings(count);
    InsertRow insert = new InsertRow(database);
    log("Built entities.");

    // insert entities
    database.beginTransaction();
    try {
        for (int i = 0; i < count; i++) {
            insert.bind((long) i, fixedRandomStrings[i]);
            insert.program.executeInsert();
        }
        database.setTransactionSuccessful();
    } finally {
        database.endTransaction();
    }
    log("Inserted entities.");

    // query for entities by indexed string at random
    int[] randomIndices = StringGenerator.getFixedRandomIndices(getQueryCount(), count - 1);

    startClock();
    for (int i = 0; i < getQueryCount(); i++) {
        int nextIndex = randomIndices[i];

        SqlDelightStatement query = IndexedStringEntity.FACTORY
                .with_string(fixedRandomStrings[nextIndex]);
        Cursor cursor = database.rawQuery(query.statement, query.args);
        // do NO null checks and count checks, should throw to indicate something is incorrect
        cursor.moveToFirst();

        // reconstruct entity
        //noinspection unused
        IndexedStringEntity entity = IndexedStringEntity.MAPPER.map(cursor);

        cursor.close();
    }
    stopClock(Benchmark.Type.QUERY_INDEXED);

    // delete all entities
    database.delete(IndexedStringEntity.TABLE_NAME, null, null);
    log("Deleted all entities.");
}
 

开发者ID:greenrobot,
项目名称:android-database-performance,
代码行数:45,
代码来源:PerfTestSqlDelight.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)