Implementation of support db

Wrapper for requery's sqlite-android that implements SupportSQLite interfaces

Лицензия

Лицензия

Категории

Категории

SQLite Данные Базы данных requery
Группа

Группа

com.gabrielittner.sqlite
Идентификатор

Идентификатор

support-db-requery
Последняя версия

Последняя версия

0.2.0
Дата

Дата

Тип

Тип

aar
Описание

Описание

Implementation of support db
Wrapper for requery's sqlite-android that implements SupportSQLite interfaces
Ссылка на сайт

Ссылка на сайт

https://github.com/gabrielittner/support-db-requery/
Система контроля версий

Система контроля версий

https://github.com/gabrielittner/support-db-requery/

Скачать support-db-requery

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.gabrielittner.sqlite/support-db-requery/ -->
<dependency>
    <groupId>com.gabrielittner.sqlite</groupId>
    <artifactId>support-db-requery</artifactId>
    <version>0.2.0</version>
    <type>aar</type>
</dependency>
// https://jarcasting.com/artifacts/com.gabrielittner.sqlite/support-db-requery/
implementation 'com.gabrielittner.sqlite:support-db-requery:0.2.0'
// https://jarcasting.com/artifacts/com.gabrielittner.sqlite/support-db-requery/
implementation ("com.gabrielittner.sqlite:support-db-requery:0.2.0")
'com.gabrielittner.sqlite:support-db-requery:aar:0.2.0'
<dependency org="com.gabrielittner.sqlite" name="support-db-requery" rev="0.2.0">
  <artifact name="support-db-requery" type="aar" />
</dependency>
@Grapes(
@Grab(group='com.gabrielittner.sqlite', module='support-db-requery', version='0.2.0')
)
libraryDependencies += "com.gabrielittner.sqlite" % "support-db-requery" % "0.2.0"
[com.gabrielittner.sqlite/support-db-requery "0.2.0"]

Зависимости

compile (2)

Идентификатор библиотеки Тип Версия
android.arch.persistence » db jar 1.0.0
io.requery » sqlite-android jar 3.21.0

Модули Проекта

Данный проект не имеет модулей.

Deprecated

sqlite-android implements the support interfaces directly starting with version 3.21.0 which means this wrapper is no longer needed. You can migrate by removing this dependency and changing imports of com.gabrielittner.sqlite.RequerySQLiteOpenHelperFactory to io.requery.android.database.sqlite.RequerySQLiteOpenHelperFactory.

support-db-requery

A wrapper around Requery's sqlite-android library that implements SupportSQLite interfaces from the support library. This allows you to ship your own version of SQLite and use it with a shared platform independent API.

Usage

The only public class in this library is RequerySQLiteOpenHelperFactory which creates and returns an implementation of SupportSQLiteOpenHelper.

Regular usage

Instead of extending SQLiteOpenHelper you have to extend SupportSQLiteOpenHelper.Callback:

class DbCallback extends SupportSQLiteOpenHelper.Callback {

  public DbCallback(int version) {
    super(version);
  }

  @Override
  public void onCreate(SupportSQLiteDatabase db) {
    // create db
  }

  @Override
  public void onUpgrade(SupportSQLiteDatabase db, int oldVersion, int newVersion) {
    // upgrade db
  }
}

Use that to create an instance of SupportSQLiteOpenHelper.Configuration and pass it to the factory:

SupportSQLiteOpenHelper.Configuration config = SupportSQLiteOpenHelper.Configuration.builder(context)
    .name("database-name.db")
    .callback(new DbCallback())
    .build();
SupportSQLiteOpenHelper helper = new RequerySQLiteOpenHelperFactory().create(config);
// use helper as usual

Room

To use this with Room just pass an instance of RequerySQLiteOpenHelperFactory to it's database builder:

Room.databaseBuilder(context, YourDatabase.class, "database-name")
    .openHelperFactory(new RequerySQLiteOpenHelperFactory())
    .build();

SQL Brite

Using this library requires version 3.0.0 of SQL Brite. Create the SupportSQLiteOpenHelper as described in regular usage and pass it into wrapDatabaseHelper:

SupportSQLiteOpenHelper helper = ... // see above
BriteDatabase db = sqlBrite.wrapDatabaseHelper(helper, Schedulers.io());

SQLDelight

Currently not supported, keep an eye on: https://github.com/square/sqldelight/issues/566

Download

Add a Gradle dependency:

compile 'com.gabrielittner.sqlite:support-db-requery:0.2.0'

Snapshots of the development version are available in Sonatype's snapshots repository.

License

Copyright (C) 2016 The Android Open Source Project
Copyright 2017 Gabriel Ittner

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Версии библиотеки

Версия
0.2.0
0.1.0