コード例 #1
0
        private string GetIndexConstraint(FbSchemaIndexes idx)
        {
            var fields = "";

            foreach (FbSchemaIndexesColumns item in IndexesColumns.Items.Where(x => x.GetName() == idx.Name).OrderBy(y => IntfToIdxColumn(y).Position))
            {
                fields += (!string.IsNullOrEmpty(fields) ? ", " : "") + item.ColumnName;
            }
            return($"create {(idx.IndexType == "1" ? "descending " : "")}index {idx.Name} on {idx.TableName}({fields});");
        }
コード例 #2
0
        private string GetUniqueConstraint(FbSchemaIndexes idx)
        {
            var fields = "";

            foreach (FbSchemaIndexesColumns item in IndexesColumns.Items.Where(x => x.GetName() == idx.Name).OrderBy(y => IntfToIdxColumn(y).Position))
            {
                fields += (!string.IsNullOrEmpty(fields) ? ", " : "") + item.ColumnName;
            }

            return($"alter table {idx.TableName} add constraint {idx.Name} unique ({fields});");
        }