$writeInsertable method

  1. @protected
GenerationContext $writeInsertable(
  1. TableInfo<Table, dynamic> table,
  2. Insertable insertable, {
  3. int? startIndex,
})
inherited

Writes column names and VALUES for an insert statement.

Used by generated code.

Implementation

@protected
GenerationContext $writeInsertable(
  TableInfo table,
  Insertable insertable, {
  int? startIndex,
}) {
  final context = GenerationContext.fromDb(this)
    ..explicitVariableIndex = startIndex;

  table.validateIntegrity(insertable, isInserting: true);
  InsertStatement(
    this,
    table,
  ).writeInsertable(context, insertable.toColumns(true));

  return context;
}