错误修正

This commit is contained in:
2024-02-05 16:47:36 +08:00
parent 5cda84797b
commit 719cd2d8e7
5 changed files with 29 additions and 23 deletions

View File

@@ -137,9 +137,11 @@ public partial class MySqlDestination : IDisposable, IAsyncDisposable
// 在这里处理特殊列
#region HandleFields
if (field.Length == 2 && field == @"\N") // MyDumper NULL
const string NULL = "NULL";
if (field.Length == 2 && field == @"\N") // MyDumper导出的NULL为'\N''\'不是转义字符)
{
recordSb.Append("NULL");
recordSb.Append(NULL);
goto Escape;
}
@@ -148,14 +150,18 @@ public partial class MySqlDestination : IDisposable, IAsyncDisposable
case ColumnType.Text:
if(string.IsNullOrEmpty(field))
recordSb.Append("''");
else if (field == NULL)
recordSb.Append(NULL);
else recordSb.Append($"_utf8mb4 0x{field}");
break;
case ColumnType.Blob:
if (string.IsNullOrEmpty(field))
recordSb.Append("''");
else if (field == NULL)
recordSb.Append(NULL);
else recordSb.Append($"0x{field}");
break;
case ColumnType.Json:
case ColumnType.Json:// 生产库没有JSON列仅用于测试库进行测试
if(string.IsNullOrEmpty(field))
recordSb.Append("'[]'"); // JObject or JArray?
else if (_options.Value.TreatJsonAsHex)