https://github.com/efekos/simpleql
SQL Database management library for Java
https://github.com/efekos/simpleql
java java-lib java-library maven maven-library maven-repository sql sql-database sql-java sql-query sql-server-database sqlite sqlite-database sqlite3 sqlite3-database
Last synced: 3 months ago
JSON representation
SQL Database management library for Java
- Host: GitHub
- URL: https://github.com/efekos/simpleql
- Owner: efekos
- License: mit
- Created: 2024-08-15T16:55:40.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2025-01-01T00:42:44.000Z (10 months ago)
- Last Synced: 2025-02-25T22:45:59.992Z (8 months ago)
- Topics: java, java-lib, java-library, maven, maven-library, maven-repository, sql, sql-database, sql-java, sql-query, sql-server-database, sqlite, sqlite-database, sqlite3, sqlite3-database
- Language: Java
- Homepage:
- Size: 222 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# SimpleQL






[](https://efekos.dev/javadoc/simpleql/1.0/index.html)
This library lets you use an SQL database without knowing the SQL language at all! You can easily create tables, insert,
update and delete rows and manage database connections.
Here is a working example:
```java
package dev.efekos.simple_ql;
import dev.efekos.simple_ql.data.Database;
import dev.efekos.simple_ql.data.Table;
import java.util.Optional;
import java.util.UUID;
// Checkout test classes to learn more
public class SimpleQLExample {
public static void main(String[] args) throws Exception {
// Database connection. Database name, username and password is ignored since this is SQLite.
Database database = SimpleQL.createDatabase("jdbc:sqlite:my.db","simpleql","admin","12345678");
database.connect();
// Getting tables.
Table customers = database.registerTable("customers", Customer.class);
// Data insertion.
UUID id = UUID.randomUUID();
Customer customer = customers.insertRow(c -> {
c.setId(id);
c.setName("John Doe");
c.setMoney(new CustomerMoney(50,0));
c.setGender(CustomerGender.FEMALE);
});
// Getting data.
Optional row = customers.getRow(id);
// Querying data.
QueryResult result = customers.query(new QueryBuilder()
.filterWithCondition(Conditions.lessThan("age", 18))
.sortAscending("age")
.skip(5)
.limit(10)
.getQuery()
);
// Updating data.
customer.setName("John Boe");
CustomerMoney money = customer.getMoney();
money.setCents(10);
customer.setMoney(money);
customer.setGender(CustomerGender.MALE);
customer.clean(); // saves changes to database
// Deleting data.
customer.delete();
// Database disconnection.
database.disconnect();
}
}
```
> [!NOTE]
> You can look at the full example [here](https://github.com/efekos/SimpleQL/tree/v1.0/src/test/java/dev/efekos/simple_ql).
# Installation
## Maven
1. Add this repository if you don't have it in your repositories.
````xml
efekosdev
https://efekos.dev/maven
````
2. Add this dependency. Replace the version with the latest version, which is  (without `v`).
````xml
dev.efekos
SimpleQL
1.0.0
````
## Gradle
1. Add this repository if you don't have it in your repositories
````gradle
maven { url 'https://efekos.dev/maven' }
````
2. Add this dependency. Replace the version with the latest version. which is  (without `v`).
````gradle
implementation 'dev.efekos:SimpleQL:1.0.0'
````
# License
This project is licensed under the MIT License.