working on permissions

This commit is contained in:
2022-04-18 16:07:59 +02:00
parent a326004e82
commit 2b9a185bfc
12 changed files with 274 additions and 162 deletions

View File

@@ -36,6 +36,7 @@ public class Database {
}
public ResultSet exec() throws SQLException {
LOG.debug("Executing {}",this);
var args = new ArrayList<>();
if (!where.isEmpty()){
var clauses = new ArrayList<String>();
@@ -51,7 +52,6 @@ public class Database {
sql.append(String.join(" AND ",clauses));
}
LOG.debug("SQL: {}",sql);
try {
var stmt = Database.this.conn.prepareStatement(sql());
if (!args.isEmpty()) {
@@ -64,6 +64,7 @@ public class Database {
}
public void run() throws SQLException {
LOG.debug("Running {}",this);
var args = new ArrayList<>();
if (!setValues.isEmpty()){
@@ -106,7 +107,6 @@ public class Database {
sql.append(String.join(" AND ",clauses));
}
LOG.debug("SQL: {}",sql);
try {
var stmt = conn.prepareStatement(sql());
if (!args.isEmpty()) {
@@ -134,7 +134,7 @@ public class Database {
if (!setValues.isEmpty()){
var keys = new ArrayList<String>();
var expressions = new ArrayList<String>();
for (var entry : setValues.entrySet()) expressions.add(entry.getKey()+" = entry.getValue()");
for (var entry : setValues.entrySet()) expressions.add(entry.getKey()+" = "+entry.getValue());
sql.append(" SET ").append(String.join(", ",expressions));
}