fixed wrong sqlite statement
This commit is contained in:
parent
918fbce199
commit
a25a39a07c
|
@ -18,7 +18,7 @@ public class RawItemArray implements Selectable {
|
|||
|
||||
@Override
|
||||
public String getSQL() {
|
||||
return Utils.toString(array, ',', false);
|
||||
return Utils.toString(array, ',', true);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/**
|
||||
* This is free and unencumbered software released into the public domain.
|
||||
*
|
||||
* <p/>
|
||||
* Anyone is free to copy, modify, publish, use, compile, sell, or
|
||||
* distribute this software, either in source code form or as a compiled
|
||||
* binary, for any purpose, commercial or non-commercial, and by any
|
||||
* means.
|
||||
*
|
||||
* <p/>
|
||||
* In jurisdictions that recognize copyright laws, the author or authors
|
||||
* of this software dedicate any and all copyright interest in the
|
||||
* software to the public domain. We make this dedication for the benefit
|
||||
|
@ -13,7 +13,7 @@
|
|||
* successors. We intend this dedication to be an overt act of
|
||||
* relinquishment in perpetuity of all present and future rights to this
|
||||
* software under copyright law.
|
||||
|
||||
* <p/>
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
|
@ -21,7 +21,7 @@
|
|||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* <p/>
|
||||
* For more information, please refer to <http://unlicense.org/>
|
||||
*/
|
||||
|
||||
|
@ -38,7 +38,7 @@ public class Tables extends Table {
|
|||
|
||||
@Override
|
||||
public String getSQL() {
|
||||
return Utils.toString(tables, ',', false);
|
||||
return Utils.toString(tables, ',', true);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -28,10 +28,7 @@ public class SQLInsertQuery implements SQLQuery {
|
|||
sb.append("INTO ");
|
||||
sb.append(table);
|
||||
sb.append(" (");
|
||||
sb.append(Utils.toString(columns, ',', false));
|
||||
sb.append(") ");
|
||||
sb.append("VALUES (");
|
||||
sb.append(values);
|
||||
sb.append(Utils.toString(columns, ',', true));
|
||||
sb.append(") ");
|
||||
return sb.toString();
|
||||
}
|
||||
|
@ -49,7 +46,7 @@ public class SQLInsertQuery implements SQLQuery {
|
|||
}
|
||||
|
||||
void setValues(final String... values) {
|
||||
this.values = Utils.toString(values, ',', false);
|
||||
this.values = "VALUES (" + Utils.toString(values, ',', true) + ")";
|
||||
}
|
||||
|
||||
void setTable(final String table) {
|
||||
|
|
|
@ -7,8 +7,6 @@ import org.mariotaku.querybuilder.SetValue;
|
|||
import org.mariotaku.querybuilder.Table;
|
||||
import org.mariotaku.querybuilder.Utils;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public class SQLUpdateQuery implements SQLQuery {
|
||||
|
||||
private OnConflict onConflict;
|
||||
|
@ -26,12 +24,16 @@ public class SQLUpdateQuery implements SQLQuery {
|
|||
final StringBuilder sb = new StringBuilder();
|
||||
sb.append("UPDATE ");
|
||||
if (onConflict != null) {
|
||||
sb.append(String.format(Locale.ROOT, "OR %s ", onConflict.getAction()));
|
||||
sb.append("OR ");
|
||||
sb.append(onConflict.getAction());
|
||||
sb.append(" ");
|
||||
}
|
||||
sb.append(String.format(Locale.ROOT, "%s ", table.getSQL()));
|
||||
sb.append(String.format(Locale.ROOT, "SET %s ", Utils.toString(values, ',', false)));
|
||||
sb.append(table.getSQL());
|
||||
sb.append(" SET ");
|
||||
sb.append(Utils.toString(values, ',', true));
|
||||
if (where != null) {
|
||||
sb.append(String.format(Locale.ROOT, "WHERE %s ", where.getSQL()));
|
||||
sb.append(" WHERE ");
|
||||
sb.append(where.getSQL());
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue