EasySQL

Lightweight wrapper around SQLiteDatabase to interact with local databases without SQL boilerplate, using a colon-separated payload structure.

Methods

void createTable(String dbName, String tableName, String[] columns)

Creates a new table using structured array definitions if it does not already exist.

boolean doesTableExist(String dbName, String tableName)

Returns true if the specified table exists in the database file, verified by executing an internal raw query test.

void insertToTable(String dbName, String tableName, String[] values)

Inserts a single row of values. Each value element is formatted as "column:value". Allows values that contain nested colons.

void deleteFromTable(String dbName, String tableName, String columnValuePair)

Deletes matching records using a single key pair string (e.g. "id:5"). Automatically detects and formats type syntax differences for text values.

List<String> getTableValues(String dbName, String tableName)

Retrieves all table records as a flat collection of "column:value" strings. Automatically formats text fields with enclosing single quotes.

List<String[]> getTableValuesAsArray(String dbName, String tableName)

Reads rows individually, returning them as mapped string array elements representing each database column.

Usage Example

Instead of manual queries, columns are expressed as "name:TYPE" strings. Input records follow a similar "column:value" pattern.

JAVA
EasySQL db = new EasySQL(context);
String[] columns = {"id:INTEGER PRIMARY KEY", "name:TEXT", "score:REAL"};
db.createTable("game_db", "scores", columns);