public virtual string SerializeCreateIndexModifier(SQLCreateIndex createIndex) { if (createIndex.IsUnique) return "UNIQUE"; else return String.Empty; }
public virtual string SerializeCreateIndex(SQLCreateIndex createIndex) { //Although the index name is optional with SQL Server it is not optional with MySQL or Pervasive if (String.IsNullOrEmpty(createIndex.Name)) throw new Exceptions.DatabaseObjectsException("IndexName has not been set."); else if (String.IsNullOrEmpty(createIndex.TableName)) throw new Exceptions.DatabaseObjectsException("TableName has not been set."); var tokens = new TokenSerializer(); tokens.Add("CREATE"); tokens.Add(SerializeCreateIndexModifier(createIndex)); tokens.Add("INDEX"); tokens.Add(SerializeIdentifier(createIndex.Name)); tokens.Add("ON"); tokens.Add(SerializeIdentifier(createIndex.TableName)); tokens.Add("(" + SerializeIndexFields(createIndex.Fields) + ")"); return tokens.ToString(); }