/** * Specify a conflict algorithm for this statement * * @param conflictAlgorithm the {@link TableStatement.ConflictAlgorithm} to use * @return this Insert object, to allow chaining method calls */ public Insert onConflict(ConflictAlgorithm conflictAlgorithm) { this.conflictAlgorithm = conflictAlgorithm; invalidateCompileCache(); return this; }
/** * Insert the results of the specified query into the table * * @param select the Query to execute * @return this Insert object, to allow chaining method calls */ public Insert select(Query select) { this.query = select; valuesToInsert.clear(); defaultValues = false; invalidateCompileCache(); return this; }
/** * Insert default values for the columns into the table * * @return this Insert object, to allow chaining method calls */ public Insert defaultValues() { defaultValues = true; columns.clear(); valuesToInsert.clear(); query = null; invalidateCompileCache(); return this; }
/** * Specify a set of values to insert. The number of values must equal the number of columns specified and the order * must match the order of the columns. * <p> * If you are using a SQLite version %lt; 3.7.11 (Android API %lt; 16 for stock SQLite), you should not call this * method more than once, as inserting multiple rows with a single statement is only supported for SQLite version * 3.7.11 and higher. Calling this method more than once may cause an exception to be thrown when trying to execute * the statement. * * @param values the values to insert * @return this Insert object, to allow chaining method calls */ public Insert values(Object... values) { valuesToInsert.add(Arrays.asList(values)); query = null; defaultValues = false; invalidateCompileCache(); return this; }
public Insert columns(String... columnNames) { SquidUtilities.addAll(this.columns, columnNames); defaultValues = false; invalidateCompileCache(); return this; }
/** * Specify columns to insert into * * @param columns the columns to insert into * @return this Insert object, to allow chaining method calls */ public Insert columns(Property<?>... columns) { for (Property<?> column : columns) { this.columns.add(column.getExpression()); } defaultValues = false; invalidateCompileCache(); return this; }
/** * Sets columns and values to insert based on the contents of the {@link ValuesStorage} * * @param values a ValuesStorage where keys are column names and values are values to insert * @return this Insert object, to allow chaining method calls */ public Insert fromValues(ValuesStorage values) { List<Object> valuesToInsert = new ArrayList<>(); for (Map.Entry<String, Object> entry : values.valueSet()) { this.columns.add(entry.getKey()); valuesToInsert.add(entry.getValue()); } this.valuesToInsert.add(valuesToInsert); invalidateCompileCache(); return this; }
/** * Specify a conflict algorithm for this statement * * @param conflictAlgorithm the {@link TableStatement.ConflictAlgorithm} to use * @return this Insert object, to allow chaining method calls */ public Insert onConflict(ConflictAlgorithm conflictAlgorithm) { this.conflictAlgorithm = conflictAlgorithm; invalidateCompileCache(); return this; }
/** * Insert the results of the specified query into the table * * @param select the Query to execute * @return this Insert object, to allow chaining method calls */ public Insert select(Query select) { this.query = select; valuesToInsert.clear(); defaultValues = false; invalidateCompileCache(); return this; }
/** * Insert default values for the columns into the table * * @return this Insert object, to allow chaining method calls */ public Insert defaultValues() { defaultValues = true; columns.clear(); valuesToInsert.clear(); query = null; invalidateCompileCache(); return this; }
/** * Specify a set of values to insert. The number of values must equal the number of columns specified and the order * must match the order of the columns. * <p> * If you are using a SQLite version %lt; 3.7.11 (Android API %lt; 16 for stock SQLite), you should not call this * method more than once, as inserting multiple rows with a single statement is only supported for SQLite version * 3.7.11 and higher. Calling this method more than once may cause an exception to be thrown when trying to execute * the statement. * * @param values the values to insert * @return this Insert object, to allow chaining method calls */ public Insert values(Object... values) { valuesToInsert.add(Arrays.asList(values)); query = null; defaultValues = false; invalidateCompileCache(); return this; }
public Insert columns(String... columnNames) { SquidUtilities.addAll(this.columns, columnNames); defaultValues = false; invalidateCompileCache(); return this; }
/** * Specify columns to insert into * * @param columns the columns to insert into * @return this Insert object, to allow chaining method calls */ public Insert columns(Property<?>... columns) { for (Property<?> column : columns) { this.columns.add(column.getExpression()); } defaultValues = false; invalidateCompileCache(); return this; }
/** * Sets columns and values to insert based on the contents of the {@link ValuesStorage} * * @param values a ValuesStorage where keys are column names and values are values to insert * @return this Insert object, to allow chaining method calls */ public Insert fromValues(ValuesStorage values) { List<Object> valuesToInsert = new ArrayList<>(); for (Map.Entry<String, Object> entry : values.valueSet()) { this.columns.add(entry.getKey()); valuesToInsert.add(entry.getValue()); } this.valuesToInsert.add(valuesToInsert); invalidateCompileCache(); return this; }