private void CreateDeleteMetadataCommandText() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine($"DELETE FROM {trackingName.QuotedString} "); stringBuilder.Append($"WHERE "); stringBuilder.AppendLine(SQLiteManagementUtils.WhereColumnAndParameters(this.TableDescription.PrimaryKey.Columns, "")); stringBuilder.Append(";"); this.AddName(DbCommandType.DeleteMetadata, stringBuilder.ToString()); }
private void CreateUpdateCommandText() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine($"UPDATE {tableName.QuotedString}"); stringBuilder.Append($"SET {SQLiteManagementUtils.CommaSeparatedUpdateFromParameters(this.TableDescription)}"); stringBuilder.Append($"WHERE {SQLiteManagementUtils.WhereColumnAndParameters(this.TableDescription.PrimaryKey.Columns, "")}"); stringBuilder.AppendLine($" AND ((SELECT [timestamp] FROM {trackingName.QuotedObjectName} "); stringBuilder.AppendLine($" WHERE {SQLiteManagementUtils.JoinTwoTablesOnClause(this.TableDescription.PrimaryKey.Columns, tableName.QuotedObjectName, trackingName.QuotedObjectName)}"); stringBuilder.AppendLine(" ) <= @sync_min_timestamp OR @sync_force_write = 1"); stringBuilder.AppendLine(");"); this.AddName(DbCommandType.UpdateRow, stringBuilder.ToString()); }
private void CreateUpdatedMetadataCommandText() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine($"UPDATE {trackingName.QuotedString}"); stringBuilder.AppendLine($"SET [update_scope_id] = @update_scope_id, "); stringBuilder.AppendLine($"\t [update_timestamp] = @update_timestamp, "); stringBuilder.AppendLine($"\t [sync_row_is_tombstone] = @sync_row_is_tombstone, "); stringBuilder.AppendLine($"\t [timestamp] = {SQLiteObjectNames.TimestampValue}, "); stringBuilder.AppendLine($"\t [last_change_datetime] = datetime('now') "); stringBuilder.Append($"WHERE {SQLiteManagementUtils.WhereColumnAndParameters(this.TableDescription.PrimaryKey.Columns, "")}"); this.AddName(DbCommandType.UpdateMetadata, stringBuilder.ToString()); }