in src/MySqlAsyncCollector.cs [299:330]
private static string GetColValuesForUpsert(T row, TableInformation table, IEnumerable<string> columnNamesFromItem)
{
//build a string of column data
string jsonRowDataInString = Utils.JsonSerializeObject(row, table.JsonSerializerSettings);
var jsonRowData = JObject.Parse(jsonRowDataInString);
//to store temproraly, the values of each property in each row
var colValues = new List<string>();
foreach (string colName in columnNamesFromItem)
{
//find the col value in jsonRowData, to the respecting column name
string colVal = jsonRowData[colName].ToString();
//If column values is empty
if (string.IsNullOrEmpty(colVal))
{
colVal = "null";
}
// If the value type is String
else if (jsonRowData[colName].Type == JTokenType.String)
{
// add single quote for string values
colVal = "'" + colVal + "'";
}
colValues.Add(colVal);
}
string joinedColValues = '(' + string.Join(", ", colValues) + ")";
return joinedColValues;
}