Class MySQL
java.lang.Object
id.luckynetwork.lyrams.lyralibs.core.database.mysql.MySQL
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidconnect()It connects to the databasevoidIf the connection is open, close it.voidexecuteQuery(String sql) "Execute the given SQL query, and call the given callback function with the results."booleanIf the connection is not null, and it's not closed, and it's valid, then it's connected"Execute the given SQL statement and return the results."
-
Constructor Details
-
MySQL
-
MySQL
-
-
Method Details
-
connect
It connects to the database- Throws:
SQLException
-
disconnect
If the connection is open, close it.- Throws:
SQLException
-
getConnection
- 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
"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
"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
-