DEV Community

Fayaz Bin Salam
Fayaz Bin Salam

Posted on

I built the laziest Android SQLite wrapper — here's what I learned

android sqlite is genuinely painful. subclassing SQLiteOpenHelper, writing raw CREATE TABLE strings, managing ContentValues maps, handling cursors manually — it compounds fast. for a simple local database, there's a lot to wrangle.

i built EasiestSqlLibrary to cut through all that. the goal: the laziest possible API for SQLite on Android. init once, define your tables, do CRUD — no SQL strings required.

the problem

standard Android SQLite insert workflow: subclass SQLiteOpenHelper, write a CREATE TABLE constant, build a ContentValues object, call db.insert() with the right table name, handle nulls. that's just one insert. multiply by every table in your app.

EasiestSqlLibrary collapses all of that to a few method calls.

how to use it

Add to your project via JitPack:

implementation 'com.github.p32929:EasiestSqlLibrary:1.0.0.2'
Enter fullscreen mode Exit fullscreen mode

Then init and go:

EasiestDB.init(context)
         .addTable("users")
         .addColumn("name", "TEXT")
         .addColumn("age", "INTEGER")
         .doneAddingTables();

// insert
EasiestDB.addDataInTable("users", new Datum("Alice"), new Datum(25));

// read all
List<List<Datum>> data = EasiestDB.getAllDataFrom("users");

// search by column value
List<List<Datum>> found = EasiestDB.searchInOneColumn("users", "name", "Alice");
Enter fullscreen mode Exit fullscreen mode

one non-obvious thing

primary keys are automatic — every table gets an ID column without you defining it. this matters more than it sounds because manual ID management is where most beginners introduce subtle bugs: duplicate IDs, wrong autoincrement config, mismatched column indices.

the library also handles simple schema changes quietly during development, so you're not writing migration SQL every time you add a column while prototyping.

get it

EasiestSqlLibrary on GitHub

https://github.com/p32929/EasiestSqlLibrary

if this saves you some boilerplate, a star helps me know which projects to keep maintaining. honest takes and feedback welcome.

open to building with sharp teams and solo founders — dms open.

Top comments (0)