Commit 6c84c9ad authored by Giant's avatar Giant
Browse files

Properly fix "SELECT *" bug.

parent da2553ce
......@@ -176,10 +176,13 @@ public class H2SelectQuery implements SelectQuery {
++i;
}
sB.append(field.getKey().replace("#__", this.db.getPrefix()));
sB.append(" AS ");
sB.append(field.getValue().replace("#__", this.db.getPrefix()));
if(!field.getKey().equals("*")) {
sB.append(field.getKey().replace("#__", this.db.getPrefix()));
sB.append(" AS ");
sB.append(field.getValue().replace("#__", this.db.getPrefix()));
}else{
sB.append(field.getKey());
}
}
}else{
......
......@@ -193,19 +193,19 @@ public class MySQLSelectQuery implements SelectQuery {
sB.append("SELECT ");
if(this.s.size() > 0) {
int i = 0;
for(Map.Entry<String, String> entry : this.s.entrySet()) {
for(Map.Entry<String, String> field : this.s.entrySet()) {
if(i > 0) {
sB.append(", ");
}else{
++i;
}
if(!entry.getKey().equals("*")) {
sB.append(entry.getKey().replace("#__", this.db.getPrefix()));
if(!field.getKey().equals("*")) {
sB.append(field.getKey().replace("#__", this.db.getPrefix()));
sB.append(" AS ");
sB.append(entry.getValue().replace("#__", this.db.getPrefix()));
sB.append(field.getValue().replace("#__", this.db.getPrefix()));
}else{
sB.append(entry.getKey());
sB.append(field.getKey());
}
}
......
......@@ -176,10 +176,13 @@ public class SQLiteSelectQuery implements SelectQuery {
++i;
}
sB.append(field.getKey().replace("#__", this.db.getPrefix()));
sB.append(" AS ");
sB.append(field.getValue().replace("#__", this.db.getPrefix()));
if(!field.getKey().equals("*")) {
sB.append(field.getKey().replace("#__", this.db.getPrefix()));
sB.append(" AS ");
sB.append(field.getValue().replace("#__", this.db.getPrefix()));
}else{
sB.append(field.getKey());
}
}
}else{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment