All Projects → jrvansuita → SQLiteHelper

jrvansuita / SQLiteHelper

Licence: MIT license
🗄 This project comes in handy when you want to write a sql statement easily and smarter.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to SQLiteHelper

SimplePHP
A small query builder project designed to assist daily routines and speed up the process of communicating with the database.
Stars: ✭ 14 (-75.44%)
Mutual labels:  query, update, delete
Tuql
Automatically create a GraphQL server from a SQLite database or a SQL file
Stars: ✭ 526 (+822.81%)
Mutual labels:  sqlite-database, sqlite3
AndroidEasySQL-Library
An Easier & Lazier approach to SQL database for Android
Stars: ✭ 28 (-50.88%)
Mutual labels:  sqlite-database, cursor
Microservices With Lumen
A Lumen based microservice ready to deploy with guzzle for consumption of api and OAuth 2
Stars: ✭ 115 (+101.75%)
Mutual labels:  sqlite-database, sqlite3
nim-gatabase
Connection-Pooling Compile-Time ORM for Nim
Stars: ✭ 103 (+80.7%)
Mutual labels:  sqlite-database, sqlite3
mdb2sqlite
Conversion tool used to convert microsoft access database to sqlite.
Stars: ✭ 79 (+38.6%)
Mutual labels:  sqlite-database, sqlite3
Wxsqlite3
wxSQLite3 - SQLite3 database wrapper for wxWidgets (including SQLite3 encryption extension)
Stars: ✭ 373 (+554.39%)
Mutual labels:  sqlite-database, sqlite3
React Query
⚛️ Hooks for fetching, caching and updating asynchronous data in React
Stars: ✭ 24,427 (+42754.39%)
Mutual labels:  query, update
Graphql To Mongodb
Allows for generic run-time generation of filter types for existing graphql types and parsing client requests to mongodb find queries
Stars: ✭ 261 (+357.89%)
Mutual labels:  query, update
fastener
Functional Zipper for manipulating JSON
Stars: ✭ 54 (-5.26%)
Mutual labels:  query, cursor
watchdb
Keeping SQLite databases in sync
Stars: ✭ 72 (+26.32%)
Mutual labels:  sqlite-database, sqlite3
Dasel
Query, update and convert data structures from the command line. Comparable to jq/yq but supports JSON, TOML, YAML, XML and CSV with zero runtime dependencies.
Stars: ✭ 759 (+1231.58%)
Mutual labels:  query, update
food-sqlite-demo
This tutorial we will save text from EditText and Image from gallery into SQLite database
Stars: ✭ 58 (+1.75%)
Mutual labels:  sqlite-database, sqlite3
Squeal
A Swift wrapper for SQLite databases
Stars: ✭ 303 (+431.58%)
Mutual labels:  sqlite-database, sqlite3
Bank-Account-Simulation
A Bank Account Simulation with JavaFX and SQLite back-end. Material UX|UI.
Stars: ✭ 19 (-66.67%)
Mutual labels:  sqlite-database, sqlite3
mern-stack-crud
MERN stack (MongoDB, Express, React and Node.js) create read update and delete (CRUD) web application example
Stars: ✭ 142 (+149.12%)
Mutual labels:  update, delete
crud-app
❄️ A simple and beautiful CRUD application built with React.
Stars: ✭ 61 (+7.02%)
Mutual labels:  update, delete
json-sql-builder2
Level Up Your SQL-Queries
Stars: ✭ 59 (+3.51%)
Mutual labels:  query, sqlite3
Walkable
A Clojure(script) SQL library for building APIs: Datomic® (GraphQL-ish) pull syntax, data driven configuration, dynamic filtering with relations in mind
Stars: ✭ 384 (+573.68%)
Mutual labels:  query, sqlite3
Purescript Selda
A type-safe, high-level SQL library for PureScript
Stars: ✭ 72 (+26.32%)
Mutual labels:  query, sqlite3

Buy Me a Coffee at ko-fi.com

Release Android Arsenal

SQLiteHelper

This Parser comes in handy when you want to write a sql statement easily and smarter.

#Porpouse

Make things easy when you need to write a sql statment for Android SQLite.

Usage

Step 1. Add the JitPack repository to your build file:

allprojects {
	repositories {
		...
		maven { url "https://jitpack.io" }
	}
}

Step 2. Add the dependency

dependencies {
        compile 'com.github.jrvansuita:SQLiteHelper:v1.0.0'
}

Samples

You can take a look at the sample app located on this project.

Implementation

Select

Working with columns.
SqlParser.query()
   .col("A")
   .col("B")
   .col("C", "NICK")
   .col("ALIAS","D", "NICK")
   .cols("E", "F", "G")
   .sum("H").count()
   .max("I")
   .table("YOUR_TABLE", "T")
   .build();

Output: SELECT A, B, C AS NICK, ALIAS.D AS NICK, E, F, G, SUM(H), COUNT(*), MAX(I) FROM YOUR_TABLE T

More than one table.
 SqlParser.query()
    .col("P", "NAME", "PRODUCT_NAME")
    .col("C", "NAME", "COLOR_NAME")
    .table("PRODUCT", "P")
    .table("COLOR", "C")
    .equal("P", "IDCOLOR", "C","ID")
    .build();

Output: SELECT P.NAME AS PRODUCT_NAME, C.NAME AS COLOR_NAME FROM PRODUCT P, COLOR C WHERE P.IDCOLOR = C.ID

Exists or not exists.
    SqlParser.query()
       .table("TABLE", "T")
       .exists(Sql.query().table("XTABLE", "XT").equal("XT", "FIELD", "T","FIELD").build())
       .notExists(Sql.query().table("YTABLE", "YT").equal("YT", "FIELD", "T","FIELD").build())
       .build();

Output: SELECT * FROM TABLE T WHERE EXISTS (SELECT * FROM XTABLE XT WHERE XT.FIELD = T.FIELD) NOT EXISTS (SELECT * FROM YTABLE YT WHERE YT.FIELD = T.FIELD)

Greater, smaller, equal, trim.
  SqlParser.query()
     .table("TABLE")
     .greater("THE_COLUMN" , 9)
     .and()
     .smallerEqual("THE_COLUMN", 40)
     .or()
     .equalTrim("TEST", " RAW ")
     .like("TEST2", "%fox%")
     .build();

Output: SELECT * FROM TABLE WHERE THE_COLUMN > 9 AND THE_COLUMN <= 40 OR TRIM(TEST) = 'RAW'

Delete.

 SqlParser.delete("TABLE").smallerEqual("COL", 0).build();     

Output: DELETE FROM TABLE WHERE COL <= 0

Insert.

  SqlParser.insert("TABLE")
     .col("A", 1)
     .col("B", "TEST")
     .build();

Output: INSERT INTO TABLE(A,B) VALUES(1,'TEST');

Create.

 SqlParser.create("TABLE")
            .pk("ID")
            .num("CODE")
            .num("TYPE")
            .flo("PRICE")
            .flo("QUANTITY")
            .build();

Output: CREATE TABLE TABLE (ID INTEGER PRIMARY KEY,CODE INTEGER,TYPE INTEGER,PRICE FLOAT,QUANTITY FLOAT);

Cursor.

 Cursor cp = SqlParser.cursor(yourCursor);

    if (cp.binded()) 
        Product product = new Product(cp.num("ID")
                                    , cp.num("CODE")
                                    , cp.flo("STOCK")
                                    , cp.flo("")
                                    , cp.str("NAME"));

ContentValues.

 SqlParser.content().add("NAME", "John")
	          .add("CITY", "New York")
    		  .add("STATE", "New Jersey");

Update

    ContentValues cv =  SqlParser.content().add("NAME", "John")
	          .add("CITY", "New York")
    		  .add("STATE", "New Jersey").get();

     yourDb.update(tableName, cv, rowId + " = ?", new String[]{String.valueOf(yourId)});
Instagram Github Google Play Store E-mail
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].