优化内存分配
This commit is contained in:
@@ -49,34 +49,6 @@ public class TransformService : ITransformService
|
||||
// var dbOptions = _options.Value.DatabaseFilter(record);
|
||||
if (!_producerQueue.TryDequeue(out var record)) continue;
|
||||
|
||||
for (var i = 0; i < record.Fields.Length; i++)
|
||||
{
|
||||
var field = record[i];
|
||||
|
||||
if (field == "\\N")
|
||||
{
|
||||
field = "NULL";
|
||||
goto Escape;
|
||||
}
|
||||
// else if(DumpDataHelper.CheckHexField(field))
|
||||
// field = $"0x{field}";
|
||||
|
||||
switch (_options.Value.GetColumnType(record.TableName, record.Headers[i]))
|
||||
{
|
||||
case ColumnType.Text:
|
||||
|
||||
field = string.IsNullOrEmpty(field) ? "''" : _options.Value.TransformBinary?.Invoke(field) ?? field; ;
|
||||
break;
|
||||
case ColumnType.Blob:
|
||||
//field = string.IsNullOrEmpty(field) ? "NULL" : $"0x{field}";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Escape:
|
||||
record[i] = field;
|
||||
}
|
||||
//过滤不要的record
|
||||
if ( await _options.Value.RecordFilter?.Invoke(record,_db) == false) continue;
|
||||
record.Database = _options.Value.DatabaseFilter?.Invoke(record);
|
||||
|
Reference in New Issue
Block a user