public static string BuildSqlDropIndexString(Dialect.Dialect dialect, Table table, string name, string defaultCatalog, string defaultSchema) { var catalog = table.GetQuotedCatalog(dialect, defaultCatalog); var schema = table.GetQuotedSchema(dialect, defaultSchema); var tableName = table.GetQuotedName(dialect); return(new StringBuilder() .AppendLine(dialect.GetIfExistsDropConstraint(catalog, schema, tableName, name)) .Append("drop index ") .AppendLine(StringHelper.Qualify(table.GetQualifiedName(dialect, defaultCatalog, defaultSchema), name)) .Append(dialect.GetIfExistsDropConstraintEnd(catalog, schema, tableName, name)) .ToString()); }
/// <summary> /// Get the SQL string to drop this Constraint in the database. /// </summary> /// <param name="dialect">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param> /// <param name="defaultCatalog"></param> /// <param name="defaultSchema"></param> /// <returns> /// A string that contains the SQL to drop this Constraint. /// </returns> public override string SqlDropString(Dialect.Dialect dialect, string defaultCatalog, string defaultSchema) { var catalog = Table.GetQuotedCatalog(dialect, defaultCatalog); var schema = Table.GetQuotedSchema(dialect, defaultSchema); var tableName = Table.GetQuotedName(dialect); return(new StringBuilder() .AppendLine(dialect.GetIfExistsDropConstraint(catalog, schema, tableName, Name)) .Append("alter table ") .Append(Table.GetQualifiedName(dialect, defaultCatalog, defaultSchema)) .AppendLine(dialect.GetDropPrimaryKeyConstraintString(Name)) .Append(dialect.GetIfExistsDropConstraintEnd(catalog, schema, tableName, Name)) .ToString()); }
public string GetLogicalTableName(Table table) { return GetLogicalTableName(table.GetQuotedSchema(), table.Catalog, table.GetQuotedName()); }