This repository has been archived on 2025-03-19. You can view files and clone it, but cannot push or open issues or pull requests.
2021-09-02 15:09:20 +02:00
2021-11-21 02:51:23 +01:00
2021-08-20 14:57:57 +02:00
2021-01-04 12:23:42 +01:00
2021-11-21 02:53:18 +01:00
2021-08-30 19:17:57 +02:00

Contributors Forks Stargazers Issues MIT License


Logo

MySQL Toolkit

About The Project

This is a small project for quickly managing a MySQL database in Java. It makes your everyday life with a database much easier.

Installation

  1. Add the jitpack repository to your pom.xml
    <repositories>
       <repository>
          <id>jitpack.io</id>
          <url>https://jitpack.io</url>
       </repository>
    </repositories>
    
  2. Add the dependency to your pom.xml
    <dependency>
         <groupId>com.github.gnmyt</groupId>
         <artifactId>sqltoolkit</artifactId>
         <version>master-SNAPSHOT</version>
    </dependency>
    

Usage Examples

  1. Create a connection
    • Example of creating a connection
    MySQLConnection connection = new MySQLConnection(hostname, username, password, database).connect();
    
  2. Perform a default SQL query
    • Get a ResultSet
      connection.getResultSet("SELECT * FROM example WHERE test = ?", "test1");
      
    • Perform an update
      connection.update("UPDATE example SET test = ? WHERE abc = ?", "test1", "test2");
      
  3. Get something from a table with managers
    1. Getting a string from the table
      String value = connection.getResult("query", "parameters")
                               .getString("column");
      
    2. Getting a list from the table
      ArrayList<String> list = connection.getResult("query", "parameters")
                                         .getList("column");
      
      or
      ArrayList<HashMap<String, Object>> list = connection.getResult("query", "parameters")
                                         .getList();
      
    3. Choosing Results
      connection
            .selectFrom("table")
            .where("column", "value")
            .limit(10)
            .getResult();
      
  4. Perform an update using managers
    1. Update a Table
      connection
            .updateTo("table")
            .where("column", "value")
            .set("column", "newValue")
            .execute();
      
    2. Generate a Table
      connection
            .generateTable("table")
            .addField(SQLType.STRING, "column")
            .addField(SQLType.INTEGER, "column2", 2)
            .create();
      
    3. Delete something from a table
      connection
            .deleteFrom("table")
            .where("column", "value")
            .execute();
      
    4. Insert something into a table
      connection
               .insertTo("table")
               .value("username", "GNM")
               .value("email", "germannewsmaker@gmail.com")
               .execute();
      

You can find other examples in the examples directory.

License

Distributed under the MIT License. See LICENSE for more information.

End

Currently, there are not many features, so feel free to write me some suggestions!

Description
This is a small wrapper for quickly managing a MySQL database in Java. It makes everyday life with a database much easier.
Readme MIT 285 KiB
2021-11-21 01:53:18 +00:00
Languages
Java 100%