|
| 1 | +# AdvancedSQL |
| 2 | +The best Java query builder/SQL connector. |
| 3 | + |
| 4 | +## What's AdvancedSQL? |
| 5 | +AdvancedSQL is a SQL query builder and/or connector that helps you to generate/modify information on the database without even have to write any line of SQL code, which sometimes is kindof boring and tiring. AdvancedSQL is the best exit for that developers who wants to continue coding without having to write out-of-syntax code (SQL queries) on Java code. |
| 6 | + |
| 7 | +## Documentation: |
| 8 | +**Connect to the Database:** |
| 9 | +There is no need to create the database manually, AdvancedSQL does it for you. |
| 10 | +```java |
| 11 | +import advancedsql.*; |
| 12 | + |
| 13 | +try { |
| 14 | + MySQL mySQL = new MySQL("127.0.0.1", 3306, "root", "password", "database"); |
| 15 | + |
| 16 | + if (mySQL.isConnected()) { |
| 17 | + System.out.println("Connected!"); |
| 18 | + } |
| 19 | +} catch (SQLException e) { |
| 20 | + e.printStackTrace(); |
| 21 | +} |
| 22 | +``` |
| 23 | + |
| 24 | +**Create table:** |
| 25 | +```java |
| 26 | +import advancedsql.*; |
| 27 | +import advancedsql.query.*; |
| 28 | +import advancedsql.table.ITable; |
| 29 | + |
| 30 | +try { |
| 31 | + MySQL mySQL = connect(); |
| 32 | + |
| 33 | + // Table |
| 34 | + ITable table = mySQL.table("users"); |
| 35 | + |
| 36 | + // Create table |
| 37 | + Create create = table.create(); |
| 38 | + |
| 39 | + // Table columns |
| 40 | + create.id(); |
| 41 | + create.string("first_name"); |
| 42 | + create.string("last_name"); |
| 43 | + create.string("test"); |
| 44 | + |
| 45 | + Boolean result = create.execute(); |
| 46 | + |
| 47 | + // Print query string and result. |
| 48 | + System.out.println(create); |
| 49 | + System.out.println(result); |
| 50 | +} catch (SQLException e) { |
| 51 | + e.printStackTrace(); |
| 52 | +} |
| 53 | +``` |
| 54 | + |
| 55 | +**Alter table:** |
| 56 | +```java |
| 57 | +import advancedsql.*; |
| 58 | +import advancedsql.query.*; |
| 59 | +import advancedsql.query.action.Add; |
| 60 | +import advancedsql.query.action.Modify; |
| 61 | + |
| 62 | +try { |
| 63 | + MySQL mySQL = connect(); |
| 64 | + |
| 65 | + // Alter columns |
| 66 | + Alter alter = mySQL.table("users").alter(); |
| 67 | + |
| 68 | + // Add columns |
| 69 | + Add add = alter.add(); |
| 70 | + add.string("token").nullable(); |
| 71 | + add.string("connection_id").nullable(); |
| 72 | + |
| 73 | + // Drop columns |
| 74 | + advancedsql.query.action.Drop drop = alter.drop(); |
| 75 | + drop.column("test"); |
| 76 | + |
| 77 | + // Modify columns |
| 78 | + Modify modify = alter.modify(); |
| 79 | + modify.integer("connection_id").nullable(); |
| 80 | + |
| 81 | + // Execute query |
| 82 | + Boolean result = alter.execute(); |
| 83 | + |
| 84 | + // Print query string and result. |
| 85 | + System.out.println(alter); |
| 86 | + System.out.println(result); |
| 87 | +} catch (SQLException e) { |
| 88 | + e.printStackTrace(); |
| 89 | +} |
| 90 | +``` |
| 91 | + |
| 92 | +## Licensing information |
| 93 | +This project is licensed under LGPL-3.0. Please see the [LICENSE](/LICENSE) file for details. |
| 94 | + |
| 95 | +## Donations |
| 96 | +* [PayPal](https://paypal.me/DenzelGiraldo) |
0 commit comments