Skip to content

ThePepeYT/databasehelper

Repository files navigation

databaseimg

👋 Hello!

DatabaseHelper is lightweight library that makes using databases a lot faster

🔩 Installation

Get it on jitpack DatabaseHelper

📙Examples

Connect

Creates connection beetwen your code and database

SQLite3 db = DatabaseHelper.sqLite3Builder()
  .file(new File("database.db"))
  .build();
  
db.connect();

Disconnect

Disconnects code from the database

SQLite3 db = DatabaseHelper.sqLite3Builder()
  .file(new File("database.db"))
  .build();

db.disconnect();

Rows

insertData

Insert data to table

SQLite3 db = new SQLite3(new File("database.db"));

db.connect();

//Inserts into "mycolumn" value "myvalue" in table "mytable"
db.insertData().table("mytable").insert("mycolumn", "myvalue").executeAsync();

getData

Get data from table

SQLite3 db = new SQLite3(new File("database.db"));

db.connect();

//Gets data "PLAYERNAME" and "PLAYERMONEY" where "PLAYERID" is "SOMEID" and hashmap of it
var data = db.getData().table("TABLE")
  .columns("PLAYERNAME", "PLAYERMONEY")
  .where("PLAYERID", "SOMEID").completeAsync();

data.subscribe(System.out::println);

updateData

Update data from database

SQLite3 db = new SQLite3(new File("database.db"));

db.connect();

//Updates "MYCOLUMN" by value "myvalue" in table "TABLE"
db.updateData().table("TABLE").column("MYCOLUMN", "myvalue").executeAsync();

deleteData

Delete data from database

SQLite3 db = new SQLite3(new File("database.db"));

db.connect();
        
//Deletes every row from table "TABLE" where "ID" is 100
db.deleteData().table("TABLE").where("ID", 100).executeAsync();

Tables

createTable

Creates table as name says xD

SQLite3 db = new SQLite3(new File("database.db"));

db.connect();
        
//Creates table with column "1COLUMN" that can store TEXT and "2COLUMN" that can store INT
db.createTable().table("TABLE").columns("1COLUMN TEXT", "2COLUMN INT").executeAsync();

Columns

deleteColumn

Delets columns from table

SQLite3 db = new SQLite3(new File("database.db"));

db.connect();

//Deletes 2 columns from table "TABLE"
db.deleteColumn().table("TABLE").columns("1COLUMN", "2COLUMN").executeAsync();

addColumn

Add columns to table

SQLite3 db = new SQLite3(new File("database.db"));

db.connect();

//Add to table "TABLE" columns "3COLUMN" that can store text and add "4COLUMN" that can store 
db.addColumn().table("TABLE").columns("3COLUMN TEXT", "4COLUMN INT").executeAsync();

🚀 Others

If you have any problems join this discord Support or you can contact me on Discord: ThePepeYT#1139.

❤️Thanks to:

Xmonpl for all help with Rxjava
dan1st for all help with small fixes

About

A lightweight, fully reactive and async library for making databases build on Rxjava

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages