mirror of
https://github.com/ChestShop-authors/ChestShop-3.git
synced 2024-11-05 01:59:41 +01:00
Ready! :D
This commit is contained in:
parent
b1528ddc6f
commit
df0de0ab44
@ -33,8 +33,6 @@ public class Database {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Deprecated - Not ready yet
|
||||
*
|
||||
* Creates a table from a given class
|
||||
*
|
||||
* @param clazz Class with fields
|
||||
|
@ -47,17 +47,17 @@ public class EntityParser {
|
||||
* @return SQL type
|
||||
*/
|
||||
public static String convertToSQL(Field field) {
|
||||
String sqlType = "";
|
||||
String sqlType = field.getName();
|
||||
Class<?> type = field.getType();
|
||||
|
||||
if (type.isAssignableFrom(boolean.class)) {
|
||||
sqlType += "BOOLEAN";
|
||||
sqlType += " BOOLEAN";
|
||||
} else if (type.isAssignableFrom(int.class)) {
|
||||
sqlType += "INTEGER";
|
||||
sqlType += " INTEGER";
|
||||
} else if (type.isAssignableFrom(double.class) || type.isAssignableFrom(float.class)) {
|
||||
sqlType += "REAL";
|
||||
sqlType += " REAL";
|
||||
} else {
|
||||
sqlType += "TEXT";
|
||||
sqlType += " TEXT";
|
||||
}
|
||||
|
||||
if (field.isAnnotationPresent(Id.class)) {
|
||||
|
@ -25,6 +25,13 @@ public class Table {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes a select statement
|
||||
*
|
||||
* @param criteria Criteria to select
|
||||
* @return RowSet of results
|
||||
* @throws SQLException
|
||||
*/
|
||||
private RowSet select(String criteria) throws SQLException {
|
||||
Connection connection = database.getConnection();
|
||||
|
||||
@ -107,7 +114,7 @@ public class Table {
|
||||
* @throws SQLException exception
|
||||
*/
|
||||
public void insertRow(Row row, String condition) throws SQLException {
|
||||
String statement = "";
|
||||
String statement;
|
||||
|
||||
if (condition == null || condition.isEmpty()) {
|
||||
statement = String.format(INSERT_VALUES, row.stringOfValues());
|
||||
|
Loading…
Reference in New Issue
Block a user