新增非法字段检查
This commit is contained in:
parent
d58c9d5177
commit
20cc78c667
@ -4,5 +4,5 @@ public static class ConstVar
|
|||||||
{
|
{
|
||||||
public const string Producer = "Producer";
|
public const string Producer = "Producer";
|
||||||
public const string Null = "NULL";
|
public const string Null = "NULL";
|
||||||
public const string MyDumperNull = "NULL";
|
public const string MyDumperNull = @"\N";
|
||||||
}
|
}
|
@ -334,6 +334,8 @@ async Task RunProgram()
|
|||||||
|
|
||||||
static void ReplaceIfMyDumperNull(DataRecord record, string fieldName, string replaceValue)
|
static void ReplaceIfMyDumperNull(DataRecord record, string fieldName, string replaceValue)
|
||||||
{
|
{
|
||||||
|
Log.Logger.Warning("发现不可空的字段为空({TableName}.{FieldName}),填充默认值: {DefaultValue}",
|
||||||
|
record.TableName, fieldName, replaceValue);
|
||||||
if (record[fieldName] is ConstVar.MyDumperNull)
|
if (record[fieldName] is ConstVar.MyDumperNull)
|
||||||
record[fieldName] = replaceValue;
|
record[fieldName] = replaceValue;
|
||||||
}
|
}
|
||||||
@ -359,7 +361,9 @@ async Task RunProgram()
|
|||||||
break;
|
break;
|
||||||
// OrderBlockPlan处理text->json列
|
// OrderBlockPlan处理text->json列
|
||||||
case TableNames.OrderBlockPlan:
|
case TableNames.OrderBlockPlan:
|
||||||
JsonDocument.Parse(record["OrderNos"]);
|
// 将所有值为'[]'(即字符串长度小等于2(16进制长度小于4))的置空 [] = 0x5b5d
|
||||||
|
if (record["OrderNos"].Length <= 4)
|
||||||
|
record["OrderNos"] = "NULL";
|
||||||
break;
|
break;
|
||||||
// OrderBlockPlanResult,添加CompanyID
|
// OrderBlockPlanResult,添加CompanyID
|
||||||
case TableNames.OrderBlockPlanResult:
|
case TableNames.OrderBlockPlanResult:
|
||||||
|
@ -139,7 +139,7 @@ public partial class MySqlDestination : IDisposable, IAsyncDisposable
|
|||||||
// 在这里处理特殊列
|
// 在这里处理特殊列
|
||||||
#region HandleFields
|
#region HandleFields
|
||||||
|
|
||||||
if (field.Length == 2 && field == @"\N") // MyDumper导出的NULL为'\N'('\'不是转义字符)
|
if (field.Length == 2 && field == ConstVar.MyDumperNull) // MyDumper导出的NULL为'\N'('\'不是转义字符)
|
||||||
{
|
{
|
||||||
recordSb.Append(ConstVar.Null);
|
recordSb.Append(ConstVar.Null);
|
||||||
goto Escape;
|
goto Escape;
|
||||||
|
Loading…
Reference in New Issue
Block a user