public SqliteObjectNames(DmTable tableDescription) { this.TableDescription = tableDescription; (tableName, trackingName) = SqliteBuilder.GetParsers(this.TableDescription); SetDefaultNames(); }
public SqliteBuilderTrigger(DmTable tableDescription, DbConnection connection, DbTransaction transaction = null) { this.connection = connection as SqliteConnection; this.transaction = transaction as SqliteTransaction; this.tableDescription = tableDescription; (this.tableName, this.trackingName) = SqliteBuilder.GetParsers(this.tableDescription); this.sqliteObjectNames = new SqliteObjectNames(this.tableDescription); }
public string ScriptAddFilterColumn(DmColumn filterColumn) { var quotedColumnName = new ObjectNameParser(filterColumn.ColumnName, "[", "]"); string str = string.Concat("Add new filter column, ", quotedColumnName.UnquotedString, ", to Tracking Table ", trackingName.QuotedString); return(SqliteBuilder.WrapScriptTextWithComments(this.AddFilterColumnCommandText(filterColumn), str)); }
public SqliteBuilderTrackingTable(DmTable tableDescription, DbConnection connection, DbTransaction transaction = null) { this.connection = connection as SqliteConnection; this.transaction = transaction as SqliteTransaction; this.tableDescription = tableDescription; (this.tableName, this.trackingName) = SqliteBuilder.GetParsers(this.tableDescription); this.sqliteDbMetadata = new SqliteDbMetadata(); }
public string ScriptAddFilterColumn(DmColumn filterColumn) { var quotedColumnName = ParserName.Parse(filterColumn.ColumnName).Quoted().ToString(); string str = string.Concat("Add new filter column, ", quotedColumnName, ", to Tracking Table ", trackingName.Quoted().ToString()); return(SqliteBuilder.WrapScriptTextWithComments(this.AddFilterColumnCommandText(filterColumn), str)); }
public string CreateDropTriggerScriptText(DbCommandType triggerType) { var triggerName = string.Format(this.sqliteObjectNames.GetCommandName(triggerType), tableName.UnquotedStringWithUnderScore); string dropTrigger = $"DROP TRIGGER IF EXISTS {triggerName}"; string str = $"Drop Trigger {triggerName} for table {tableName.QuotedString}"; return(SqliteBuilder.WrapScriptTextWithComments(dropTrigger, str)); }
public string DropTableScriptText() { StringBuilder stringBuilder = new StringBuilder(); var tableNameScript = $"Drop Table {tableName.QuotedString}"; var tableScript = $"DROP TABLE IF EXISTS {tableName.QuotedString}"; stringBuilder.Append(SqliteBuilder.WrapScriptTextWithComments(tableScript, tableNameScript)); stringBuilder.AppendLine(); return(stringBuilder.ToString()); }
public string CreateTableScriptText() { StringBuilder stringBuilder = new StringBuilder(); var tableNameScript = $"Create Table {tableName.FullQuotedString}"; var tableScript = BuildTableCommand().CommandText; stringBuilder.Append(SqliteBuilder.WrapScriptTextWithComments(tableScript, tableNameScript)); stringBuilder.AppendLine(); return(stringBuilder.ToString()); }
public string CreateUpdateTriggerScriptText() { var updTriggerName = string.Format(this.sqliteObjectNames.GetCommandName(DbCommandType.UpdateTrigger), tableName.UnquotedStringWithUnderScore); StringBuilder createTrigger = new StringBuilder($"CREATE TRIGGER IF NOT EXISTS {updTriggerName} AFTER UPDATE ON {tableName.QuotedString} "); createTrigger.AppendLine(); createTrigger.AppendLine(this.UpdateTriggerBodyText()); string str = $"Update Trigger for table {tableName.QuotedString}"; return(SqliteBuilder.WrapScriptTextWithComments(createTrigger.ToString(), str)); }
public string CreateInsertTriggerScriptText() { var insTriggerName = string.Format(this.sqliteObjectNames.GetCommandName(DbCommandType.InsertTrigger), tableName.ObjectNameNormalized); StringBuilder createTrigger = new StringBuilder($"CREATE TRIGGER IF NOT EXISTS {insTriggerName} AFTER INSERT ON {tableName.FullQuotedString} "); createTrigger.AppendLine(); createTrigger.AppendLine(this.InsertTriggerBodyText()); string str = $"Insert Trigger for table {tableName.FullQuotedString}"; return(SqliteBuilder.WrapScriptTextWithComments(createTrigger.ToString(), str)); }
public string CreateDeleteTriggerScriptText() { var delTriggerName = string.Format(this.sqliteObjectNames.GetCommandName(DbCommandType.DeleteTrigger), tableName.Unquoted().ToString()); StringBuilder createTrigger = new StringBuilder($"CREATE TRIGGER IF NOT EXISTS {delTriggerName} AFTER DELETE ON {tableName.Quoted().ToString()} "); createTrigger.AppendLine(); createTrigger.AppendLine(this.DeleteTriggerBodyText()); string str = $"Delete Trigger for table {tableName.Quoted().ToString()}"; return(SqliteBuilder.WrapScriptTextWithComments(createTrigger.ToString(), str)); }
public string CreatePopulateFromBaseTableScriptText() { string str = string.Concat("Populate tracking table ", trackingName.QuotedString, " for existing data in table ", tableName.QuotedString); return(SqliteBuilder.WrapScriptTextWithComments(this.CreatePopulateFromBaseTableCommandText(), str)); }
public string CreateTableScriptText() { string str = string.Concat("Create Tracking Table ", trackingName.QuotedString); return(SqliteBuilder.WrapScriptTextWithComments(this.CreateTableCommandText(), str)); }