java.lang.Object
id.luckynetwork.lyrams.lyralibs.core.database.mysql.MySQL

public class MySQL extends Object
  • Constructor Details

  • Method Details

    • connect

      public void connect() throws SQLException
      It connects to the database
      Throws:
      SQLException
    • disconnect

      public void disconnect() throws SQLException
      If the connection is open, close it.
      Throws:
      SQLException
    • getConnection

      public Connection getConnection() throws SQLException
      Throws:
      SQLException
    • isConnected

      public boolean isConnected()
      If the connection is not null, and it's not closed, and it's valid, then it's connected
      Returns:
      A boolean value.
    • executeQuery

      public void executeQuery(String sql) throws SQLException
      "Execute the given SQL query, and call the given callback function with the results."

      The first line of the function creates a new Query object, passing in the SQL query and the callback function. The second line calls to execute() function on the Query object

      Parameters:
      sql - The SQL query to execute.
      Throws:
      SQLException
    • results

      public Results results(String sql) throws SQLException
      "Execute the given SQL statement and return the results."

      The first thing we do is create a new Query object. We pass in the SQL statement and the database connection

      Parameters:
      sql - The SQL query to execute.
      Returns:
      A new Query object is being returned.
      Throws:
      SQLException