Added select, update & insert to the sql table class for quicker access to the table

This commit is contained in:
mathias 2021-08-19 17:01:41 +02:00
parent 2e5f651afa
commit 7fe1fc9644
No known key found for this signature in database
GPG Key ID: 8950DF62139C852A

View File

@ -1,6 +1,9 @@
package de.gnmyt.SQLToolkit.storage; package de.gnmyt.SQLToolkit.storage;
import de.gnmyt.SQLToolkit.drivers.MySQLConnection; import de.gnmyt.SQLToolkit.drivers.MySQLConnection;
import de.gnmyt.SQLToolkit.manager.DataBaseSelection;
import de.gnmyt.SQLToolkit.manager.InsertManager;
import de.gnmyt.SQLToolkit.manager.UpdateManager;
import de.gnmyt.SQLToolkit.types.SQLType; import de.gnmyt.SQLToolkit.types.SQLType;
import de.gnmyt.SQLToolkit.types.TableField; import de.gnmyt.SQLToolkit.types.TableField;
@ -113,6 +116,30 @@ public abstract class SQLTable {
custom(new TableField(name, type, length, allowNull, defaultValue).setExtra(extras)); custom(new TableField(name, type, length, allowNull, defaultValue).setExtra(extras));
} }
/**
* Gets the database selection from the current the table
* @return the database selection
*/
public DataBaseSelection select() {
return connection.selectFrom(tableName());
}
/**
* Gets the update manager of the current table
* @return the update manager
*/
public UpdateManager update() {
return connection.updateTable(tableName());
}
/**
* Gets the insert manager of the current table
* @return the insert manager
*/
public InsertManager insert() {
return connection.insertTo(tableName());
}
/** /**
* Adds a table field to the table * Adds a table field to the table
* *