Class Table
java.lang.Object
me.lorenzo0111.pluginslib.database.objects.Table
SQL Table
-
Constructor Summary
ConstructorsConstructorDescriptionTable(IScheduler scheduler, Connection connection, String name, List<Column> columns) Deprecated.Table(IScheduler scheduler, IConnectionHandler connection, String name, List<Column> columns) -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(DatabaseSerializable serializable) Add aDatabaseSerializableto the tableall()Get all items from tablevoidclear()Clear the tableconvertResult(ResultSet set, DatabaseSerializable serializable) Convert a ResultSet to a Database Serializablevoidcreate()Create the table in the databaseFind something inside the tablegetName()removeWhere(String key, Object value) Remove something from the tableremoveWhere(String key, DatabaseSerializable serializable) Remove something from the tablevoidRun something async
-
Constructor Details
-
Table
@Deprecated public Table(IScheduler scheduler, Connection connection, String name, List<Column> columns) Deprecated.- Parameters:
scheduler- Schedulerconnection- SQL Connectionname- Name of the tablecolumns- List of columns- See Also:
-
Table
public Table(IScheduler scheduler, IConnectionHandler connection, String name, List<Column> columns)
-
-
Method Details
-
create
public void create()Create the table in the database -
convertResult
public CompletableFuture<List<DatabaseSerializable>> convertResult(ResultSet set, DatabaseSerializable serializable) Convert a ResultSet to a Database Serializable- Parameters:
set- ResultSet to convertserializable- an instance of a serializable that has theDatabaseSerializable.from(Map)method- Returns:
- A future with a list of serializable
-
all
Get all items from table- Returns:
- a result set with all the entries of the table
-
add
Add aDatabaseSerializableto the table- Parameters:
serializable- Item to add to the table
-
clear
public void clear()Clear the table -
removeWhere
Remove something from the table- Parameters:
key- key to findvalue- Value of the key- Returns:
- A completable future with the amount of the affected tables
-
removeWhere
Remove something from the table- Parameters:
key- key to findserializable- serializable that contains the key- Returns:
- A completable future with the amount of the affected tables
-
find
Find something inside the table- Parameters:
key- Key to findvalue- Value to find- Returns:
- A ResultSet
-
run
Run something async- Parameters:
runnable- Runnable to run
-
getName
- Returns:
- Name of the table
-
getConnection
- Returns:
- Connection
- Throws:
SQLException- if something goes wrong
-
getColumns
- Returns:
- Table columns
-
Table(IScheduler, IConnectionHandler, String, List)