SquiDB is a SQLite database library for Android and iOS

Related tags

O/R Mapping squidb
Overview

Join the chat at https://gitter.im/yahoo/squidb Build Status Download

Most ongoing development is currently taking place on the dev_4.0 branch. Click here to see the latest changes and try out the 4.0 beta.

Introducing SquiDB

SquiDB is a cross-platform SQLite database layer for Android and iOS. It is designed to make it as easy as possible to work with SQLite databases while still enabling the power and flexibility of raw SQL. SquiDB combines typesafe objects that represent table rows with object-oriented SQL statement builders to make it easy to read and write your data without a bunch of messy SQL strings. It also includes built in tools and hooks to help you easily write database migrations as well as implement ContentProviders.

For support or to ask questions, join our chat channel on gitter.im.

Getting started

To add SquiDB as a dependency in your build.gradle file:

// This example is for a typical Android setup, j2objc/iOS setup may vary
buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        // android-apt plugin; https://bitbucket.org/hvisser/android-apt
        // Only needed if using the android gradle plugin version less than 2.2.0
        // classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
    }
}

repositories {
    jcenter()
}

// Only needed if using the android gradle plugin version less than 2.2.0
// apply plugin: 'com.neenbedankt.android-apt'
// If using Kotlin, you may need to use this plugin instead of the default annotationProcessor configuration
// apply plugin: 'kotlin-kapt'

dependencies {
    compile 'com.yahoo.squidb:squidb:3.2.3'
    compile 'com.yahoo.squidb:squidb-annotations:3.2.3'
    compile 'com.yahoo.squidb:squidb-android:3.2.3' // For Android projects only
    annotationProcessor 'com.yahoo.squidb:squidb-processor:3.2.3'
    // If using the android-apt plugin, this becomes
    // apt 'com.yahoo.squidb:squidb-processor:3.2.3'
    // If using kotlin language, this becomes
    // kapt 'com.yahoo.squidb:squidb-processor:3.2.3'
}

See this wiki page for more detailed instructions on adding SquiDB as a dependency.

A note on cross-platform support

As of SquiDB 3.0, cross-platform support is provided by compiling with Google's j2objc tool. In other words, SquiDB can be used as a SQLite data layer to develop cross-platform business logic that will run on both Android and iOS platforms. If you don't need this feature, you can ignore it -- SquiDB will continue to work on Android exactly as it always has, with only minor, easy to update API changes.

Upgrading between major versions

Model objects

SquiDB represents rows in your SQLite tables as objects (similar to how an ORM might). Instead of directly defining these objects though, SquiDB uses compile time code generation to let you define your models/table schemas as minimally as possible--the actual code you will work with is generated at compile time. A SquidDatabase object mediates reading and writing these objects from the database. Setting up all these components is quick and easy. For example:

// This is a table schema
@TableModelSpec(className = "Person", tableName = "people")
class PersonSpec {

    // A text column named "firstName"
    String firstName;

    // A text column named "lastName"
    String lastName;

    // A long column named "creationDate", but referred to as "birthday"
    // when working with the model
    @ColumnSpec(name = "creationDate")
    long birthday;
}

// This is how you'd set up a database instance
public class MyDatabase extends SquidDatabase {

    private static final int VERSION = 1;

    public MyDatabase() {
        super();
        // Any other initialization of the instance
    }

    @Override
    public String getName() {
        return "my-database.db";
    }

    @Override
    protected Table[] getTables() {
        return new Table[]{
            // List all tables here
            Person.TABLE,
        };
    }

    @Override
    protected int getVersion() {
        return VERSION;
    }

    // Other overridable methods exist for migrations and initialization;
    // omitted for brevity
}

MyDatabase db = new MyDatabase(); // Important: db instances should always be singletons

// This is how you'd work with the generated model
Person newPerson = new Person()
    .setFirstName("Sam")
    .setLastName("Bosley")
    .setBirthday(System.currentTimeMillis());
db.persist(newPerson);

...

String firstName = newPerson.getFirstName();
String lastName = newPerson.getLastName();
long birthday = newPerson.getBirthday();

Building queries

In addition to defining getters and setters for all the columns, the generated model class also defines constant fields you can reference for constructing queries:

long ageCutoff = System.currentTimeMillis() - (DateUtil.YEAR_IN_MILLIS * 18);
Query peopleWhoCanVote = Query.select().where(Person.BIRTHDAY.lt(ageCutoff));

// This becomes select * from people where people.birthday < ?
// where ? is the age cutoff arg
SquidCursor<Person> voters = db.query(Person.class, peopleWhoCanVote);

The example is simple, but SquiDB's query object supports almost the entire SQL grammar. It is much cleaner and easier to maintain, particularly for complex queries:

String sql = "select " + PersonColumns.AGE + ", " + ProfileImageColumns.URL + " from "
    + PERSON_TABLE + " left join " + PROFILE_IMAGE_TABLE + " on " + PersonColumns._ID
    + " = " + ProfileImageColumns.PERSON_ID + " where " + PersonColumns.NAME + " = ?"
    + " AND " + PersonColumns.AGE + " >= ?" + " ORDER BY " + PersonColumns.AGE + " ASC"
String[] sqlArgs = new String[]{"Sam", Integer.toString(18)};

// Becomes...
Query query = Query.select(Person.AGE, ProfileImage.URL).from(Person.TABLE)
    .leftJoin(ProfileImage.TABLE, Person.ID.eq(ProfileImage.PERSON_ID))
    .where(Person.NAME.eq("Sam").and(Person.AGE.gte(18)));

The above example with strings uses the '?' character as placeholders for arguments to the statement. Users of Android's SQLiteDatabase will recognize this as the pattern used by many of its methods, including query methods. This is good practice, but it makes the code harder to read and necessitates that extra string array for the arguments. SquiDB inserts those placeholders for you when compiling the Query object and binds the arguments automatically at query time. The raw SQL version is also prone to errors when updating the SQL adds, removes, or changes the contents of sqlArgs. You must always count the number of '?'s to find the appropriate argument in the array. For large and complex queries, this can be difficult; SquiDB's Query object makes it a non-issue. Using SquiDB's Query also prevents several classes of typos (you won't ever mistype a keyword or forget a space character somewhere).

Furthermore, it becomes easier to build/compose queries or SQL clauses as objects:

public Query queryForPeopleWithName(String name, boolean includeLastName) {
    Query baseQuery = Query.select().from(Person.TABLE);
    Criterion nameCriterion = Person.FIRST_NAME.eq(name);
    if (includeLastName) {
        nameCriterion = nameCriterion.or(Person.LAST_NAME.eq(name));
    }
    baseQuery.where(nameCriterion);
    return baseQuery;
}

Working with query results

SquidDatabase can return either single rows of data represented by model objects, or a SquidCursor parametrized by a model type:

// Fetch the person with _id = 1
Person person1 = db.fetch(Person.class, 1);

// Cursor containing all rows in the people table
SquidCursor<Person> personCursor = db.query(Person.class, Query.select());

Model objects are designed to be reusable, so iterating through the cursor and inflating model objects to work with is cheap if you don't need the row data to live outside of the loop:

SquidCursor<Person> personCursor = db.query(Person.class, Query.select());
try {
    Person person = new Person();
    while (personCursor.moveToNext()) {
        person.readPropertiesFromCursor(personCursor);
        doSomethingWithCurrentRow(person);
    }
} finally {
    personCursor.close();
}

SquidCursor also provides users a typesafe get() method that can work directly with table columns if you don’t want or need to inflate a full model object:

String firstName = personCursor.get(Person.FIRST_NAME);
Long birthday = personCursor.get(Person.BIRTHDAY);

These are simple examples that only use a single table, but it's still easy to work with model objects even if you need to join across multiple tables.

SquidCursor vs Android Cursor

SquidCursor implements a re-declaration of the Android Cursor interface, so you can use it in the same way you would use an Android cursor -- methods like moveToFirst(), moveToNext(), isAfterLast() etc. all work in exactly the same way as a standard Android cursor. If in an Android app you need an actual instance of android.database.Cursor, you can cast the result of SquidCursor.getCursor() like so:

SquidCursor<Person> myCursor = ...;
Cursor androidCursor = (Cursor) myCursor.getCursor();

Data change notifications

SquiDB supports listening for database changes and sending notifications or callbacks after write operations. The notification mechanism is extremely flexible and is customizable via user-defined objects subclassing DataChangedNotifier. DataChangedNotifier objects accumulate notifications based on metadata from the writes occurring during write operations or transactions (e.g. which tables have changed or which single row was updated). These notifications will then be sent if and only if the operation or transaction completes successfully.

Implementations of notifier objects that cover some of the most common use cases are provided:

  • UriNotifier supports sending notifications to Uris for use with Android's ContentObserver mechanism. This can be useful when using SquiDB to implement a ContentProvider.
  • SimpleDataChangedNotifier supports running an arbitrary callback after a successful write to the table or tables being listened to.
  • For those who prefer Reactive architecture, the squidb-reactive module provides ReactiveSquidDatabase. ReactiveSquidDatabase is an extension of a standard SquidDatabase that supports creating RxJava Observables that will be notified when the given table(s) are written to.

See the Listening for data changes wiki page for examples of DataChangedNotifier, or the Observing with RxJava for examples of how to use the squidb-reactive module.

And more!

We've shown several simple examples here, but there's a lot that SquiDB can do to make more complicated use cases easy too--it can help you work with SQL views using model objects, write database migrations, implement flexible ContentProviders backed by your SQLite database, and more. For an in-depth look at all you can do with SquiDB, check out the wiki at https://github.com/yahoo/squidb/wiki.

Code licensed under the Apache 2.0 license. See LICENSE file for terms.

Comments
  • Cannot use library via gradle on large project ?

    Cannot use library via gradle on large project ?

    I have a large project, with a lot of dependencies and modules.

    For some reason, on a POC it works fine, but when using the large project, all it gets is the annotation library ("squidb-annotations-2.0.0").

    I've performed the same exact steps as on the POC.

    How could it be?

    opened by AndroidDeveloperLB 45
  • Build failures with Jack compiler

    Build failures with Jack compiler

    Has anybody got this working yet? It seems to build until I start to use a generated Model class in my code.

    DeliverySpec.java

    package com.me.testapp.squidb;
    
    import com.yahoo.squidb.annotations.PrimaryKey;
    import com.yahoo.squidb.annotations.TableModelSpec;
    
    @TableModelSpec(className="Delivery", tableName="delivery")
    public class DeliverySpec {
        @PrimaryKey
        public long delivery_id;
    }
    

    Usage of the generated model:

    package com.me.testapp.wire;
    
    import com.me.testapp.squidb.Delivery;
    
    public class DeliveryWire {
        public long delivery_id;
    
        public static Delivery toModel(DeliveryWire dw)  {
            Delivery d = new Delivery();
            d.setDeliveryId(dw.delivery_id);
            return d;
        }
    
        public static DeliveryWire fromModel(Delivery d) {
            DeliveryWire dw = new DeliveryWire();
            dw.delivery_id = d.getDeliveryId();
            return dw;
        }
    }
    

    Project level build.gradle

    buildscript {
        repositories {
            jcenter()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:2.2.0-beta1'
        }
    }
    
    allprojects {
        repositories {
            jcenter()
        }
    }
    
    task clean(type: Delete) {
        delete rootProject.buildDir
    }
    

    Module level build.gradle

    apply plugin: 'com.android.application'
    
    android {
        compileSdkVersion 24
        buildToolsVersion "24.0.1"
    
        defaultConfig {
            applicationId "com.me.testapp"
            minSdkVersion 21
            targetSdkVersion 24
            versionCode 1
            versionName "1.0"
            jackOptions {
                enabled true
            }
        }
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_8
            targetCompatibility JavaVersion.VERSION_1_8
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    }
    
    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        testCompile 'junit:junit:4.12'
        compile 'com.android.support:appcompat-v7:24.2.0'
        compile 'com.android.support:support-v4:24.2.0'
        compile 'com.google.android.gms:play-services-appindexing:9.4.0'
    
        compile 'com.yahoo.squidb:squidb:3.1.2'
        compile 'com.yahoo.squidb:squidb-annotations:3.1.2'
        compile 'com.yahoo.squidb:squidb-android:3.1.2'
        annotationProcessor 'com.yahoo.squidb:squidb-processor:3.1.2'
    }
    

    Initial build error:

    * What went wrong:
    Execution failed for task ':app:transformJackWithJackForDebug'.
    > com.android.jack.ir.JNodeInternalError: Error building Jack IR: com.android.jack.eclipse.jdt.internal.compiler.ast.TypeDeclaration at "/Users/aranda/code/SignatureCapture/app/src/main/java/com/adapptor/signaturecapture/wire/DeliveryWire.java:9.14-9.25"
    

    Stack trace that appears if you try to build again:

    :app:transformJackWithJackForDebug
    Switch enum optimization is disabled due to incremental compilation
    
    ERROR: Library reading phase: file '/Users/aranda/code/SignatureCapture/app/build/intermediates/packaged/debug/classes.zip' is an invalid library
    
    com.android.jack.api.v01.CompilationException: Library reading phase: file '/Users/aranda/code/SignatureCapture/app/build/intermediates/packaged/debug/classes.zip' is an invalid library
        at com.android.jack.api.v01.impl.Api01ConfigImpl$Api01CompilationTaskImpl.run(Api01ConfigImpl.java:113)
        at com.android.builder.core.AndroidBuilder.convertByteCodeUsingJackApis(AndroidBuilder.java:1821)
        at com.android.builder.core.AndroidBuilder.convertByteCodeUsingJack(AndroidBuilder.java:1648)
        at com.android.build.gradle.internal.transforms.JackTransform.runJack(JackTransform.java:220)
        at com.android.build.gradle.internal.transforms.JackTransform.transform(JackTransform.java:194)
        at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:177)
        at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:173)
        at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:156)
        at com.android.build.gradle.internal.pipeline.TransformTask.transform(TransformTask.java:172)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
        at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.doExecute(AnnotationProcessingTaskFactory.java:245)
    
    opened by Aranda 21
  • Getting

    Getting "null not found in model" when using a SquiDB generated class in unit tests

    Hello,

    I'm writing a unit test for a mapper class, which maps a SquiDB generated class (let's call it DataFoo) to a presentation entity (Foo) and vice versa.

    Problem is, the getters of the generated class don't seem to work in unit tests. My mapper calls DataFoo.setName(someValue), and when testing said value in the unit test by calling DataFoo.getName() in the unit test, I get this exception:

    java.lang.UnsupportedOperationException: null not found in model. Make sure the value was set explicitly, read from a cursor, or that the model has a default value for this property.
        at com.yahoo.squidb.data.AbstractModel.get(AbstractModel.java:275)
        at com.example.foobar.data.entity.DataFoo.getName(DataFoo.java:86)
    

    The interesting part is: "null not found in model", where null should be the name of the property I'm trying to read, i.e. the NAME property. Digging deeper, the name of generated property really is null:

    assertThat(DataFoo.NAME.getName(), is(not(nullValue()))); // fails
    

    If I have any other generated properties, they also fail, except for ID, which comes from the base classes. That works.

    Source for DataFoo, really nothing special:

    // DataFooSpec.class
    
    package com.example.foobar.data.entity;
    
    import com.yahoo.squidb.annotations.TableModelSpec;
    
    @TableModelSpec(className="DataFoo", tableName="foo")
    public class DataFooSpec {
        String name;
        // remainder omitted
    }
    

    Running the app on the device works fine, I'm having this problem in unit tests only. Any idea what causes this?

    Thanks!

    opened by zsoltk 18
  • Bug on 3.1.1 : causes spaces in a constant, where it shouldn't

    Bug on 3.1.1 : causes spaces in a constant, where it shouldn't

    This is what the generated file had:

    public static final LongProperty ID = new LongProperty(TABLE_MODEL_NAME, "_id", PRIMARY KEY AUTOINCREMENT);

    As you can see, "PRIMARY KEY AUTOINCREMENT" doesn't have "_" , and instead it has spaces. This causes this error: Error:(31, 92) error: ')' expected Error:(31, 110) error: expected

    Here's the spec file:

    @TableModelSpec(className = "ExperimentEntity", tableName = "experiments", tableConstraint = "UNIQUE(experimentId)")
    public class ExperimentSpec {
        public String experimentId, experimentJson;
        public int experimentVersion, experimentLevel;
    }
    

    Reverting back to version 3.1.0 fixed the issue.

    opened by AndroidDeveloperLB 17
  • Disable generation of Id property

    Disable generation of Id property

    I am trying to migrate to squidb but my old database uses String ids. And as squidb supports only INTEGER as primary key, the generated class has now two methods returning 'ids': the rowid and the server id. This situation is error prone because all my code is base on the server id.

    Any idea how to disable the generation of the Id property ?

    opened by aminelaadhari 14
  •  Make fields getter/setter private

    Make fields getter/setter private

    I'm always using the same naming and technique, like following (see the comment to get what I want):

    @TableModelSpec(className="GroupedFolder", tableName="groupedFolder")
    @Implements(interfaceClasses = {Serializable.class})
    public class GroupedFolderEntrySpec
    {
        // make the generated function "setInternalType" private, because from outside, only the ModelMethod below should be used
        private int internalDataSource;
    
        enum Type
        {
            New,
            Default,
            Custom
        }
    
        @ModelMethod
        public static void setType(GroupedFolder item, Type type) {
            item.setInternalType(type.ordinal());
        }
    }
    

    Can I somehow let squidb make a getter/setter private? It does not respect the private definition of my variable...

    opened by MFlisar 13
  • database records not being saved

    database records not being saved

    Hi,

    I'm not being able to save records to db. even when i issue countAll(Model.class) after calling persist on the model instance I get 0 as as number of records (persist is called twice and i'm running the countAll after the first persist). whats wrong?

    package .com.mh.model;
    
    import android.content.Context;
    
    import com.yahoo.squidb.android.AndroidOpenHelper;
    import com.yahoo.squidb.data.ISQLiteDatabase;
    import com.yahoo.squidb.data.ISQLiteOpenHelper;
    import com.yahoo.squidb.data.SquidDatabase;
    import com.yahoo.squidb.sql.Table;
    
    public class ModelController extends SquidDatabase {
        Context mContext;
        public ModelController(Context context)
        {
            super();
            mContext = context;
        }
    
        @Override
        public String getName() {
            return "enduser_pets.db";
        }
    
        @Override
        protected int getVersion() {
            return 9;
        }
    
        @Override
        protected Table[] getTables() {
            return new Table[]{
                   Model.TABLE
            };
        }
    
        @Override
        protected boolean onUpgrade(ISQLiteDatabase db, int oldVersion, int newVersion) {
            mContext.deleteDatabase(getName());
            return false;
        }
    
        @Override
        protected ISQLiteOpenHelper createOpenHelper(String databaseName, OpenHelperDelegate delegate, int version) {
            return new AndroidOpenHelper(mContext, getName(), delegate, getVersion());
        }
    }
    
    

    ModelControler mController = new ModelController(getApplicationContext()); ModelClass mclass = new ModelClass(); mclass.setTitle("Hi"); mController.persist(mclass);

    opened by mhadad 12
  • ViewModel - left join on same table multiple times

    ViewModel - left join on same table multiple times

    I have a model that has multiple references in another model (1:1 relations). My ModelView attempt looks like following:

    @ViewModelSpec(className="MediaView", viewName="mediaView")
    public class MediaViewModelSpec
    {
        @ViewQuery
        public static final Query QUERY = Query.select()
                .from(Media.TABLE)
    
                // Following two queries belong together, so FolderSorting must have this folders id as reference!
                .leftJoin(Folder.TABLE, Media.FK_FOLDER.eq(Folder.ID))
                .leftJoin(FolderSorting.TABLE, Folder.FK_SORTING.eq(FolderSorting.ID))
    
                // Following two queries belong together again
                .leftJoin(Folder.TABLE, Media.FK_FOLDER_DATE.eq(Folder.ID))
                .leftJoin(FolderSorting.TABLE, Folder.FK_SORTING.eq(FolderSorting.ID))
    
                // Following two queries belong together again
                .leftJoin(Folder.TABLE, Media.FK_FOLDER_LOCATION.eq(Folder.ID))
                .leftJoin(FolderSorting.TABLE, Folder.FK_SORTING.eq(FolderSorting.ID))
    
                // Following two queries belong together again
                .leftJoin(Folder.TABLE, Media.FK_FOLDER_TAG.eq(Folder.ID))
                .leftJoin(FolderSorting.TABLE, Folder.FK_SORTING.eq(FolderSorting.ID));
    }
    

    Explanation is, that each Media belongs to 4 types of folders and each of this folder can have it's own sorting. I want to use the ModelView for this ombined query to query all data at once.

    Do I have to use my own aliases so that this type of view works? Or is there some build in solution for this?

    Additionally, merging on one and the same table multiple times seems to make problems when I want to use mapToModel. Can I still somehow use it?

    opened by MFlisar 12
  • [help] How to integrate it with Android Studio

    [help] How to integrate it with Android Studio

    I am unable to find any guide to add the library to AndroidStudio.

    Is there a jar or aar file that can be directly added? Also, please let us know how to integrate Jackson and squidb. I want to use Retrofit for REST and want to bind all three together.

    opened by rinav 11
  • Make squidb use a prepopulated database

    Make squidb use a prepopulated database

    This is not really an issue. I want to provide a prepopulated database with my app and want squidb to use it. What would be the best way to achieve that? Anyway I can override the db creation part of squidb and provide a copying method instead?

    opened by iambibhas 10
  • How to enable implementing ParcelableModel for generated model classes?

    How to enable implementing ParcelableModel for generated model classes?

    Today I decided to remove the "apt" stuff from the gradle files, to use the new way to import this repo.

    Sadly, this caused an issue that I can't pass models via intents, because now the generated model classes do not implement Parcelable anymore.

    How come? How can I re-enable this?

    opened by AndroidDeveloperLB 9
  • Export database with WAL mode (lock, checkpoint, export, unlock)

    Export database with WAL mode (lock, checkpoint, export, unlock)

    Is this somehow possible? I need access to the internal database and do following:

    • lock it
    • call "PRAGMA wal_checkpoint" on it
    • export the database file
    • unlock it

    Any hints on how I can do this?

    opened by MFlisar 0
  • j2objc - ios integration issue

    j2objc - ios integration issue

    We have an existing j2objc project, which generates podspec out of java files. Now we have been trying to setup squidb into j2objc, it worked on Android. But native files in squidb-ios is not available to iOS app code. CursorWindowNative.h file not found is what the error says. Please suggest how to make the native packages accessible to cocoapods.

    opened by prasadsn 1
  • How to create tables dynamically?

    How to create tables dynamically?

    I have such a need.I want to create a chat information table for each friend when I receive a chat message from the Internet.For example when I receive chat message from my friend Tom,I will check if there are tom_chat_table locally.If it exists,I will insert this chat message to tom_chat_table.If it not exists,I will create tom_chat_table and insert this chat message to tom_chat_table. Thanks

    opened by zxg110 1
  • How to return ISQLiteOpenHelper in standard Java project?

    How to return ISQLiteOpenHelper in standard Java project?

    I'm trying to use Squidb in a standard Java project (i.e. not running on an Android device) but I can't seem to implement the createOpenHelper method of SquidDatabase:

    	@Override
    	protected ISQLiteOpenHelper createOpenHelper(final String databaseName, final OpenHelperDelegate delegate, final int version) {
    
                    // Cannot resolve symbol AndroidOpenHelper
    		return new AndroidOpenHelper(getName(), delegate, getVersion());;
    	}
    

    In the JavaDoc I found that I can simply return a new AndroidOpenHelper, but where can I find that class in a non-android project?

    Is it possible to use Squidb for non-android projects? If so, how to do it?

    opened by rolfw 0
  • Can't build v3.2.3 from source with android studio 3.2

    Can't build v3.2.3 from source with android studio 3.2

    Before the update I only needed to comment out the libraryVariants.all { ... } from the squidb-android module:

    //    libraryVariants.all { variant ->
    //        variant.outputs.each { output ->
    //            def outputFile = output.outputFile
    //            if (outputFile != null && outputFile.name.endsWith('.aar')) {
    //                def fileName = "${archivesBaseName}-${version}.aar"
    //                output.outputFile = new File(outputFile.parent, fileName)
    //            }
    //        }
    //    }
    

    Afterwards I also needed to remove the java docs creation of the android module. Looks like a api vs implementation error, but this is not the case here. Compiler complains that he can't find the classes (you get a lot of can't find class errors) the java docs refer to, even functions of the class itself can't be found - no idea why though. But following solves this:

    //task javadoc(type: Javadoc) {
    //    source = android.sourceSets.main.java.srcDirs
    //    classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
    //}
    
    //task javadocJar(type: Jar, dependsOn: javadoc) {
    //    classifier = 'javadoc'
    //    from javadoc.destinationDir
    //}
    
    artifacts {
    	//archives javadocJar
    	archives sourcesJar
    }
    

    Any ideas why this happens? If not, this information may at least be useful for others... What I see as well is that suddenly compiling in debug also generates release versions... Maybe it's something with my project but it's weird, because everything was working with android studio 3.1... And other projects without squidb sources (even with squidb includes) work well...

    opened by MFlisar 1
Owner
Yahoo
Yahoo is a Verizon Media brand. This organization is the home to many of the active open source projects published by engineers at Yahoo and Verizon Media.
Yahoo
An Android library that makes developers use SQLite database extremely easy.

LitePal for Android 中文文档 LitePal is an open source Android library that allows developers to use SQLite database extremely easy. You can finish most o

Lin Guo 7.9k Jan 4, 2023
Compile time processed, annotation driven, no reflection SQLite database layer for Android

SqliteMagic Simple yet powerful SQLite database layer for Android that makes database handling feel like magic. Overview: Simple, intuitive & typesafe

Siim Kinks 118 Dec 22, 2022
android 数据库框架,sqlite database

DBExecutor 主要的功能 1.使用了读写锁,支持多线程操作数据。 2.支持事务 3.支持ORM 4.缓存Sql,缓存表结构 这个类库主要用于android 数据库操作。 始终围绕着一个类对应一个表的概念。 只要创建一个实体类,就不用当心它怎么存储在数据库中,不用重新写增删改查的代码。基本的功

null 77 May 31, 2021
LiteOrm is a fast, small, powerful ORM framework for Android. LiteOrm makes you do CRUD operarions on SQLite database with a sigle line of code efficiently.

#LiteOrm:Android高性能数据库框架 A fast, small, powerful ORM framework for Android. LiteOrm makes you do CRUD operarions on SQLite database with a sigle line

马天宇 1.5k Nov 19, 2022
Realm is a mobile database: a replacement for SQLite & ORMs

Realm is a mobile database that runs directly inside phones, tablets or wearables. This repository holds the source code for the Java version of Realm

Realm 11.4k Jan 2, 2023
A blazing fast, powerful, and very simple ORM android database library that writes database code for you.

README DBFlow is fast, efficient, and feature-rich Kotlin database library built on SQLite for Android. DBFlow utilizes annotation processing to gener

Andrew Grosner 4.9k Dec 30, 2022
A blazing fast, powerful, and very simple ORM android database library that writes database code for you.

README DBFlow is fast, efficient, and feature-rich Kotlin database library built on SQLite for Android. DBFlow utilizes annotation processing to gener

Andrew Grosner 4.9k Dec 30, 2022
AndroidQuery is an Android ORM for SQLite and ContentProvider which focuses on easy of use and performances thanks to annotation processing and code generation

WARNING: now that Room is out, I no longer maintain that library. If you need a library to easy access to default android ContentProvider, I would may

Frédéric Julian 19 Dec 11, 2021
A Java/Kotlin library for Android platform, to manage bean's persistence in SQLite, SharedPreferences, JSON, XML, Properties, Yaml, CBOR.

Thanks to JetBrains for support Kripton Persistence Library project! Kripton Persistence Library Kripton is a java library, for Android platform, that

xcesco 117 Nov 11, 2022
lightweight and minimalist ORM for Java/Android. works with SQLite & MySQL. (not actively maintained)

Description ORMAN is an minimalistic and lightweight ORM framework for Java which can handle your common database usage without writing SQL and strugg

Ahmet Alp Balkan 246 Nov 20, 2022
lightweight and minimalist ORM for Java/Android. works with SQLite & MySQL. (not actively maintained)

Description ORMAN is an minimalistic and lightweight ORM framework for Java which can handle your common database usage without writing SQL and strugg

Ahmet Alp Balkan 246 Nov 20, 2022
Active record style SQLite persistence for Android

ActiveAndroid ActiveAndroid is an active record style ORM (object relational mapper). What does that mean exactly? Well, ActiveAndroid allows you to s

Michael Pardo 4.7k Dec 29, 2022
greenDAO is a light & fast ORM solution for Android that maps objects to SQLite databases.

Check out ObjectBox Check out our new mobile database ObjectBox (GitHub repo). ObjectBox is a superfast object-oriented database with strong relation

Markus Junginger 12.6k Jan 3, 2023
Active record style SQLite persistence for Android

ActiveAndroid ActiveAndroid is an active record style ORM (object relational mapper). What does that mean exactly? Well, ActiveAndroid allows you to s

Michael Pardo 4.7k Dec 29, 2022
Android SQLite API based on SQLCipher

Download Source and Binaries The latest AAR binary package information can be here, the source can be found here. Compatibility SQLCipher for Android

SQLCipher 2.6k Dec 31, 2022
Extended SQLite functionality for Android

sqlite-provider A simplification of database access for Android. Description sqlite-provider implements a ContentProvider for you that allows database

Novoda 308 Nov 20, 2022
Extended SQLite functionality for Android

sqlite-provider A simplification of database access for Android. Description sqlite-provider implements a ContentProvider for you that allows database

Novoda 308 Nov 20, 2022
Exercicio praticando o SQLite, Room e Flow

Bus Scheduler App This folder contains the source code for the Bus Scheduler app codelab. Introduction The Bus Scheduler app displays a list of bus st

Lucas Caetano 0 Nov 26, 2021
An Android helper class to manage database creation and version management using an application's raw asset files

THIS PROJECT IS NO LONGER MAINTAINED Android SQLiteAssetHelper An Android helper class to manage database creation and version management using an app

Jeff Gilfelt 2.2k Dec 23, 2022