public string getScript() { return(string.Format( "ALTER TABLE {0} ADD CONSTRAINT {1} FOREIGN KEY ({2}) REFERENCES {3} ({4})", new string[] { TableName.ToUpper(), ConstraintName.ToUpper(), ColumnName.ToUpper(), TableReference.ToUpper(), ColumnReference.ToUpper() })); }
internal override string generateCreateSql() { /* * Oracle> ALTER TABLE aact ADD CONSTRAINT FK_AACT_ACID FOREIGN KEY (ACID) REFERENCES ACC (ACID) */ StringBuilder sb = new StringBuilder(); sb.Append("ALTER TABLE ") .Append(FullTableName.ToUpper()) .Append(@" ADD CONSTRAINT ") .Append(ConstraintName.ToUpper()) // oracle doesn't like the schema name put here, so we use the constraint name only .Append(@" FOREIGN KEY ("); foreach (FieldInfo fi in this.SourceFields) { sb.Append(fi.Name).Append(@", "); } sb.Remove(sb.Length - 2, 2); sb.Append(@") REFERENCES ") .Append(this.ReferencesFullTableName.ToUpper()) .Append(@" ("); foreach (FieldInfo fi2 in this.ReferencesFields) { sb.Append(fi2.Name).Append(", "); } sb.Remove(sb.Length - 2, 2); sb.Append(")"); // ON DELETE RESTRICT ON UPDATE RESTRICT)"); string ret = sb.ToString(); return(ret); }