Skip to content

Commit 552e5be

Browse files
committed
feature: Optimize MySql objects lists to use Contains functions as O(1)
- Remove unused imports - Optmize Lists in MySqlObjects to use Dictionary instead of Lists to optimize Contains function - Replaces empty strings to use string.Empty to allocate less memory - Fix the event GetTotalRowsProgressChanged to be called asynchronous using Timer - Fix ReportEndProcess call to be called when some exception occurs
1 parent 0155b04 commit 552e5be

File tree

106 files changed

+1162
-1715
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+1162
-1715
lines changed

source code/MySqlBackup(Devart-Express)/EventArgs/ExportProgressArgs.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
using System;
2-
using System.Collections.Generic;
3-
using System.Text;
42

53
namespace Devart.Data.MySql
64
{
75
public class ExportProgressArgs : EventArgs
86
{
9-
string _currentTableName = "";
7+
string _currentTableName = string.Empty;
108
long _totalRowsInCurrentTable = 0;
119
long _totalRowsInAllTables = 0;
1210
long _currentRowIndexInCurrentTable = 0;
Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
using System;
2-
using System.Collections.Generic;
3-
using System.Text;
42

53
namespace Devart.Data.MySql
64
{
75
public class GetTotalRowsArgs : EventArgs
86
{
9-
int _totalTables = 0;
10-
int _curTable = 0;
11-
127
public GetTotalRowsArgs(int totalTables, int curTable)
138
{
14-
_totalTables = totalTables;
15-
_curTable = curTable;
9+
TotalTables = totalTables;
10+
CurrTable = curTable;
1611
}
12+
13+
public int TotalTables { get; private set; }
14+
public int CurrTable { get; private set; }
1715
}
1816
}

source code/MySqlBackup(Devart-Express)/InfoObjects/ImportInformations.cs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Text;
4-
5-
namespace Devart.Data.MySql
1+
namespace Devart.Data.MySql
62
{
73
public class ImportInformations
84
{
95
int _interval = 100;
10-
//string _targetDatabase = "";
11-
//string _databaseDefaultCharSet = "";
6+
//string _targetDatabase = string.Empty;
7+
//string _databaseDefaultCharSet = string.Empty;
128

139
/// <summary>
1410
/// Gets or Sets a value indicates whether the Imported Dump File is encrypted.
@@ -20,7 +16,7 @@ public class ImportInformations
2016
/// Sets the password used to decrypt the exported dump file.
2117
/// </summary>
2218
//[System.Obsolete("This implementation will slow down the whole process which is not recommended. Encrypt the content externally after the export process completed. For more information, please read documentation.")]
23-
//public string EncryptionPassword = "";
19+
//public string EncryptionPassword = string.Empty;
2420

2521
/// <summary>
2622
/// Gets or Sets a value indicates the interval of time (in miliseconds) to raise the event of ExportProgressChanged.
@@ -45,7 +41,7 @@ public class ImportInformations
4541
/// <summary>
4642
/// Gets or Sets the file path used to log error messages.
4743
/// </summary>
48-
public string ErrorLogFile = "";
44+
public string ErrorLogFile = string.Empty;
4945

5046
public ImportInformations()
5147
{ }

source code/MySqlBackup(Devart-Express)/Methods/QueryExpress.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
using System;
2-
using System.Collections.Generic;
3-
using System.Text;
42
using System.Data;
53
using System.Globalization;
64
using System.Security.Cryptography;
5+
using System.Text;
76

87
namespace Devart.Data.MySql
98
{
@@ -403,4 +402,4 @@ public static string ConvertToSqlFormat(object ob, bool wrapStringWithSingleQuot
403402
}
404403

405404
}
406-
}
405+
}

0 commit comments

Comments
 (0)