propose method

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

Called by initialize; should contain the actual object initialization code.

The method is allowed to throw in the case of an error. If it throws an Exception, the default Actor implementation will call dispose afterward to clean up even a partially initialized object.

Implementation

@protected
@override
void propose() {
  super.propose();
  var table = sqlIdentifier(index.name);
  var columns = index.columnsStr;
  var parameters = index.parameters;
  _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",
  );
}