protected override string GetSqlCreateTable(TableDef td) { StringBuilder strBuild = new StringBuilder(); strBuild = strBuild.Append("CREATE TABLE ") .Append(td.TableName).Append("("); foreach (FieldDef fd in td.KeyFields.Values) { strBuild.Append(fd.FieldName) .Append(AccessType(fd)).Append(","); } foreach (FieldDef fd in td.NonKeyFields.Values) { if (fd.GetDTLSA() == null) { strBuild.Append(fd.FieldName) .Append(AccessType(fd)).Append(","); } } if (td.KeyFields.Count > 0) { strBuild.Append("CONSTRAINT PK_").Append(td.TableName) .Append(" PRIMARY KEY ("); foreach (FieldDef fd in td.KeyFields.Values) { strBuild.Append(fd.FieldName).Append(","); } strBuild.Remove(strBuild.Length - 1, 1).Append("))"); } else { strBuild.Remove(strBuild.Length - 1, 1).Append(")"); } int Ctr = 0; foreach (string IndexField in td.IndexedFields) { int i = IndexField.IndexOf('|'); if (i == 6) { strBuild.Append("\0CREATE UNIQUE INDEX IX_"); } else { strBuild.Append("\0CREATE INDEX IX_"); } strBuild.Append(td.TableName).Append("_") .Append(Ctr.ToString()).Append(" ON ") .Append(td.TableName).Append("(").Append( IndexField.Substring(i + 1)).Append(")"); Ctr++; } return(strBuild.ToString()); }