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