Package de.oliver.fancylib.databases
Class MySqlDatabase
java.lang.Object
de.oliver.fancylib.databases.MySqlDatabase
- All Implemented Interfaces:
Database
- Direct Known Subclasses:
SqliteDatabase
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanclose()Closes the database connectionbooleanconnect()Connects to the databasebooleanexecuteNonQuery(String sql) Executes a statement on the databaseexecuteQuery(String query) Executes a query on the databaseboolean
-
Field Details
-
host
-
port
-
database
-
username
-
password
-
connection
-
-
Constructor Details
-
MySqlDatabase
-
-
Method Details
-
connect
public boolean connect()Description copied from interface:DatabaseConnects to the database -
close
public boolean close()Description copied from interface:DatabaseCloses the database connection -
isConnected
public boolean isConnected()- Specified by:
isConnectedin interfaceDatabase- Returns:
- true if connected, false if not
-
getConnection
- Specified by:
getConnectionin interfaceDatabase- Returns:
- the connection object, null if not connected
-
executeNonQuery
Description copied from interface:DatabaseExecutes a statement on the database- Specified by:
executeNonQueryin interfaceDatabase- Returns:
- true if success, false if failed
-
executeQuery
Description copied from interface:DatabaseExecutes a query on the database- Specified by:
executeQueryin interfaceDatabase- Returns:
- the result or null if failed
-