compileInsertGetId method

CompiledQuery compileInsertGetId(
  1. String table,
  2. Map<String, Object?> row,
  3. String idColumn
)

Insert returning the generated id (RETURNING when supported).

Implementation

CompiledQuery compileInsertGetId(
  String table,
  Map<String, Object?> row,
  String idColumn,
) {
  final base = compileInsert(table, [row]);
  if (!supportsReturning) {
    return base;
  }
  return CompiledQuery(
    '${base.sql} RETURNING ${wrap(idColumn)}',
    base.bindings,
  );
}