Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
public class DeleteQuery implements Query {
private final String table;
private final List<String> wheres = new ArrayList<>();

public DeleteQuery(String table) {
this.table = table;
this.table = '`' + table + '`';;
}

public DeleteQuery where(String expression) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@ public class InsertQuery implements Query {
private boolean onDuplicateKey = false;

public InsertQuery(String table) {
this.table = table;
this.table = '`' + table + '`';;
}


public InsertQuery value(String column, String value) {
values.put(column, value);
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@ public class SelectQuery implements Query {
private int limitRowCount = 0;

public SelectQuery(String table) {
this.table = table;
this.table = '`' + table + '`';;
}


public SelectQuery column(String column) {
columns.add(column);
return this;
Expand All @@ -34,12 +33,12 @@ public SelectQuery column(String... column) {
}

public SelectQuery where(String expression) {
wheres.add(expression + "=?");
wheres.add(expression + "= ?");
return this;
}
public SelectQuery where(String... expression) {
for (String s : expression) {
wheres.add(s + "=?");
wheres.add(s + "= ?");
}
return this;
}
Expand Down Expand Up @@ -83,7 +82,7 @@ public String build() {

else builder.append("SELECT ").append(separate(columns)).append(" FROM ").append(table);

if (wheres.size() > 0)
if (!wheres.isEmpty())
builder.append(" WHERE ").append(separate(wheres, " AND "));

if (orderBy != null)
Expand All @@ -92,7 +91,6 @@ public String build() {
if (limitRowCount > 0)
builder.append(" LIMIT ").append(limitOffset).append(",").append(limitRowCount);


return builder.toString();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class UpdateQuery implements Query {
private final List<String> wheres = new ArrayList<>();

public UpdateQuery(String table) {
this.table = table;
this.table = '`' + table + '`';
}

public UpdateQuery setMultiple(String... column) {
Expand Down Expand Up @@ -65,7 +65,6 @@ public String build() {

String seperator = "";
for (Map.Entry<String, String> entry : values.entrySet()) {

String column = entry.getKey();
String value = entry.getValue();
builder.append(seperator)
Expand Down