Пример #1
0
        private void WriteBatch(StringBuilder sb, string insertString, string includeFieldNamesString, List <DataField> fields, int numBatch)
        {
            sb.Append(insertString);
            sb.Append(includeFieldNamesString);
            sb.Append(" VALUES ");

            for (int batch = 0; batch < numBatch; batch++)
            {
                var fieldData = new List <string>();
                foreach (var field in fields)
                {
                    object randomValue = field.Generate();
                    string value       = field.FieldOptions.ValueAsString ? StringUtils.AddSQLQuotes(randomValue) : StringUtils.MakeSafeSQL(randomValue);

                    fieldData.Add(value);
                }

                sb.Append($"({string.Join(", ", fieldData)})");
                sb.Append(batch < numBatch - 1 ? ", " : ";");
            }

            sb.AppendLine();
        }