android.arch.persistence.room.Query类的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(5.4k)|赞(0)|评价(0)|浏览(172)

本文整理了Java中android.arch.persistence.room.Query类的一些代码示例,展示了Query类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query类的具体详情如下:
包路径:android.arch.persistence.room.Query
类名称:Query

Query介绍

暂无

代码示例

代码示例来源:origin: TeamNewPipe/NewPipe

@Query("DELETE FROM " + STREAM_TABLE + " WHERE " + STREAM_ID +
      " NOT IN " +
      "(SELECT DISTINCT " + STREAM_ID + " FROM " + STREAM_TABLE +

      " LEFT JOIN " + STREAM_HISTORY_TABLE +
      " ON " + STREAM_ID + " = " +
      StreamHistoryEntity.STREAM_HISTORY_TABLE + "." + StreamHistoryEntity.JOIN_STREAM_ID +

      " LEFT JOIN " + PLAYLIST_STREAM_JOIN_TABLE +
      " ON " + STREAM_ID + " = " +
      PlaylistStreamEntity.PLAYLIST_STREAM_JOIN_TABLE + "." + PlaylistStreamEntity.JOIN_STREAM_ID +
      ")")
  public abstract int deleteOrphans();
}

代码示例来源:origin: TeamNewPipe/NewPipe

@Query("SELECT * FROM " + STREAM_TABLE +

      // Select the latest entry and watch count for each stream id on history table
      " INNER JOIN " +
      "(SELECT " + JOIN_STREAM_ID + ", " +
      "  MAX(" + STREAM_ACCESS_DATE + ") AS " + STREAM_LATEST_DATE + ", " +
      "  SUM(" + STREAM_REPEAT_COUNT + ") AS " + STREAM_WATCH_COUNT +
      " FROM " + STREAM_HISTORY_TABLE + " GROUP BY " + JOIN_STREAM_ID + ")" +

      " ON " + STREAM_ID + " = " + JOIN_STREAM_ID)
  public abstract Flowable<List<StreamStatisticsEntry>> getStatistics();
}

代码示例来源:origin: TeamNewPipe/NewPipe

@Query("SELECT * FROM " + STREAM_TABLE +
    " INNER JOIN " + STREAM_HISTORY_TABLE +
    " ON " + STREAM_ID + " = " + JOIN_STREAM_ID +
    " ORDER BY " + STREAM_ACCESS_DATE + " DESC")
public abstract Flowable<List<StreamHistoryEntry>> getHistory();

代码示例来源:origin: TeamNewPipe/NewPipe

@Query("SELECT " + REMOTE_PLAYLIST_ID + " FROM " + REMOTE_PLAYLIST_TABLE +
    " WHERE " +
    REMOTE_PLAYLIST_URL + " = :url AND " + REMOTE_PLAYLIST_SERVICE_ID + " = :serviceId")
abstract Long getPlaylistIdInternal(long serviceId, String url);

代码示例来源:origin: TeamNewPipe/NewPipe

@Query("SELECT COALESCE(MAX(" + JOIN_INDEX + "), -1)" +
    " FROM " + PLAYLIST_STREAM_JOIN_TABLE +
    " WHERE " + JOIN_PLAYLIST_ID + " = :playlistId")
public abstract Flowable<Integer> getMaximumIndexOf(final long playlistId);

代码示例来源:origin: TeamNewPipe/NewPipe

@Query("DELETE FROM " + REMOTE_PLAYLIST_TABLE +
      " WHERE " + REMOTE_PLAYLIST_ID + " = :playlistId")
  public abstract int deletePlaylist(final long playlistId);
}

代码示例来源:origin: TeamNewPipe/NewPipe

@Query("SELECT * FROM " + SUBSCRIPTION_TABLE + " WHERE " +
    SUBSCRIPTION_URL + " LIKE :url AND " +
    SUBSCRIPTION_SERVICE_ID + " = :serviceId")
public abstract Flowable<List<SubscriptionEntity>> getSubscription(int serviceId, String url);

代码示例来源:origin: TeamNewPipe/NewPipe

@Override
@Query("SELECT * FROM " + REMOTE_PLAYLIST_TABLE +
    " WHERE " + REMOTE_PLAYLIST_SERVICE_ID + " = :serviceId")
public abstract Flowable<List<PlaylistRemoteEntity>> listByService(int serviceId);

代码示例来源:origin: TeamNewPipe/NewPipe

@Query("SELECT " + STREAM_ID + " FROM " + STREAM_TABLE + " WHERE " +
    STREAM_URL + " = :url AND " +
    STREAM_SERVICE_ID + " = :serviceId")
abstract Long getStreamIdInternal(long serviceId, String url);

代码示例来源:origin: TeamNewPipe/NewPipe

@Query("SELECT " + SUBSCRIPTION_UID + " FROM " + SUBSCRIPTION_TABLE + " WHERE " +
    SUBSCRIPTION_URL + " LIKE :url AND " +
    SUBSCRIPTION_SERVICE_ID + " = :serviceId")
abstract Long getSubscriptionIdInternal(int serviceId, String url);

代码示例来源:origin: TeamNewPipe/NewPipe

@Query("SELECT * FROM " + STREAM_TABLE + " WHERE " +
    STREAM_URL + " = :url AND " +
    STREAM_SERVICE_ID + " = :serviceId")
public abstract Flowable<List<StreamEntity>> getStream(long serviceId, String url);

代码示例来源:origin: TeamNewPipe/NewPipe

@Query("SELECT * FROM " + REMOTE_PLAYLIST_TABLE + " WHERE " +
    REMOTE_PLAYLIST_URL + " = :url AND " +
    REMOTE_PLAYLIST_SERVICE_ID + " = :serviceId")
public abstract Flowable<List<PlaylistRemoteEntity>> getPlaylist(long serviceId, String url);

代码示例来源:origin: TeamNewPipe/NewPipe

@Override
@Query("SELECT * FROM " + PLAYLIST_STREAM_JOIN_TABLE)
public abstract Flowable<List<PlaylistStreamEntity>> getAll();

代码示例来源:origin: TeamNewPipe/NewPipe

@Query("DELETE FROM " + PLAYLIST_STREAM_JOIN_TABLE +
    " WHERE " + JOIN_PLAYLIST_ID + " = :playlistId")
public abstract void deleteBatch(final long playlistId);

代码示例来源:origin: TeamNewPipe/NewPipe

@Override
@Query("DELETE FROM " + SUBSCRIPTION_TABLE)
public abstract int deleteAll();

代码示例来源:origin: TeamNewPipe/NewPipe

@Override
@Query("SELECT * FROM " + STREAM_TABLE + " WHERE " + STREAM_SERVICE_ID + " = :serviceId")
public abstract Flowable<List<StreamEntity>> listByService(int serviceId);

代码示例来源:origin: TeamNewPipe/NewPipe

@Override
@Query("SELECT * FROM " + STREAM_HISTORY_TABLE)
public abstract Flowable<List<StreamHistoryEntity>> getAll();

代码示例来源:origin: TeamNewPipe/NewPipe

@Override
@Query("SELECT * FROM " + PLAYLIST_TABLE)
public abstract Flowable<List<PlaylistEntity>> getAll();

代码示例来源:origin: TeamNewPipe/NewPipe

@Override
@Query("DELETE FROM " + PLAYLIST_TABLE)
public abstract int deleteAll();

代码示例来源:origin: TeamNewPipe/NewPipe

@Query("DELETE FROM " + PLAYLIST_TABLE + " WHERE " + PLAYLIST_ID + " = :playlistId")
  public abstract int deletePlaylist(final long playlistId);
}

相关文章