propose method

  1. @protected
  2. @override
void propose()

Called by initialize; should contain the object initialization code.

The method is allowed to throw in the case of an error. The default Actor implementation will call dispose afterward to clean up even a partially initialized object; the thrown object is passed to dispose.

Implementation

@protected
@override
void propose() {
  super.propose();
  var table = sqlIdentifier(index.name);
  var columns = columnsSql();
  var parameters = parametersSql();
  _insert = sqlite.statement(
    "INSERT OR IGNORE INTO $table "
    "($columnRowId, $columnKeyId, $columns) VALUES "
    "(:$columnRowId, :$columnKeyId, $parameters)",
  );
  _update = sqlite.statement(
    "UPDATE OR IGNORE $table SET "
    "($columns) = ($parameters) WHERE $columnRowId == :$columnRowId",
  );
  _delete = sqlite.statement(
    "DELETE FROM $table WHERE $columnRowId == :$columnRowId",
  );
}