From 5841514c3c1989f436418359e97400c2aa47c8ec Mon Sep 17 00:00:00 2001 From: AndreasMartin72 Date: Fri, 4 May 2018 11:52:16 +0200 Subject: [PATCH 1/6] Bugfix (shuebener/SQLiteCompare, Issue#1) IOException (temporary DB) when closing the program --- SQLiteTurbo/TableChanges.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/SQLiteTurbo/TableChanges.cs b/SQLiteTurbo/TableChanges.cs index cd70c81..7d55172 100644 --- a/SQLiteTurbo/TableChanges.cs +++ b/SQLiteTurbo/TableChanges.cs @@ -1047,10 +1047,10 @@ private void Dispose(bool disposing) { try { - SQLiteConnectionStringBuilder sb = new SQLiteConnectionStringBuilder(_main.ConnectionString); - string fpath = sb.DataSource; - _main.Close(); - _main.Dispose(); + //SQLiteConnectionStringBuilder sb = new SQLiteConnectionStringBuilder(_main.ConnectionString); + string fpath = _main.DataSource; + _main.Close(); + _main.Dispose(); _main = null; if (!_inmemory) File.Delete(fpath); From f1c926258addc94a5b86f2e8359f549d92db2c66 Mon Sep 17 00:00:00 2001 From: AndreasMartin72 Date: Fri, 4 May 2018 12:07:22 +0200 Subject: [PATCH 2/6] Bugfix: Invalid cast causes Program crash An invalid type cast occured, when comparing columns of datatype BLOB and additional when examining theses BLOBS. --- SQLiteTurbo/TableDiffControl.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/SQLiteTurbo/TableDiffControl.cs b/SQLiteTurbo/TableDiffControl.cs index f62e5f0..dc1f859 100644 --- a/SQLiteTurbo/TableDiffControl.cs +++ b/SQLiteTurbo/TableDiffControl.cs @@ -503,8 +503,9 @@ private void HandleCellEdit(bool right) // in order to avoid loading the BLOB field into main memory. if (Utils.GetDbType(column.ColumnType) == DbType.Binary) { - long v = (long)value; - if (v == 0) // means NULL + //long v = (long)value; + //if (v == 0) // means NULL + if (value.Equals("0")) value = DBNull.Value; } @@ -815,8 +816,9 @@ private void FillRow(FastGrid grid, long rowIndex, FastGridRow row) } else if (Utils.GetDbType(col.ColumnType) == DbType.Binary) { - long v = (long)fval; - if (v == 1) + //long v = (long)fval; + //if (v == 1) + if (fval.Equals("1")) row.Cells[i].Value = "BLOB"; else row.Cells[i].Value = "NULL"; From 0f6d7e986452268b078c9954979bb9182929f139 Mon Sep 17 00:00:00 2001 From: AndreasMartin72 Date: Fri, 4 May 2018 12:11:56 +0200 Subject: [PATCH 3/6] Bugfix: sqlite3_open_v2 not supported Added package "System.Data.SQLite.x86" which only supports sqlite3_open_v2(). Drawback: Only works for x86 compilation! Updated further: --- SQLiteTurbo/SQLiteTurbo.csproj | 18 +++++++++--------- SQLiteTurbo/packages.config | 9 +++++---- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/SQLiteTurbo/SQLiteTurbo.csproj b/SQLiteTurbo/SQLiteTurbo.csproj index c7a47dc..666efbe 100644 --- a/SQLiteTurbo/SQLiteTurbo.csproj +++ b/SQLiteTurbo/SQLiteTurbo.csproj @@ -90,16 +90,16 @@ - - ..\packages\System.Data.SQLite.Core.1.0.104.0\lib\net46\System.Data.SQLite.dll + + ..\packages\System.Data.SQLite.x86.1.0.108.0\lib\net46\System.Data.SQLite.dll True - - ..\packages\System.Data.SQLite.EF6.1.0.104.0\lib\net46\System.Data.SQLite.EF6.dll + + ..\packages\System.Data.SQLite.EF6.1.0.108.0\lib\net46\System.Data.SQLite.EF6.dll True - - ..\packages\System.Data.SQLite.Linq.1.0.104.0\lib\net46\System.Data.SQLite.Linq.dll + + ..\packages\System.Data.SQLite.Linq.1.0.108.0\lib\net46\System.Data.SQLite.Linq.dll True @@ -448,11 +448,11 @@ - + - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + Dieses Projekt verweist auf mindestens ein NuGet-Paket, das auf diesem Computer fehlt. Verwenden Sie die Wiederherstellung von NuGet-Paketen, um die fehlenden Dateien herunterzuladen. Weitere Informationen finden Sie unter "http://go.microsoft.com/fwlink/?LinkID=322105". Die fehlende Datei ist "{0}". - + \ No newline at end of file diff --git a/SQLiteTurbo/packages.config b/SQLiteTurbo/packages.config index 8e2145e..bfaa5c3 100644 --- a/SQLiteTurbo/packages.config +++ b/SQLiteTurbo/packages.config @@ -5,8 +5,9 @@ - - - - + + + + + \ No newline at end of file From 1e106fa7787e53be6cd2450d63a49c9b2e17ac5c Mon Sep 17 00:00:00 2001 From: AndreasMartin72 Date: Fri, 4 May 2018 12:41:24 +0200 Subject: [PATCH 4/6] Added platform "x86" to the solution --- SQLiteTurboDiff.sln | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/SQLiteTurboDiff.sln b/SQLiteTurboDiff.sln index 644cf46..30096b3 100644 --- a/SQLiteTurboDiff.sln +++ b/SQLiteTurboDiff.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.25928.0 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionItems", "SolutionItems", "{0C4D8682-3D2A-4367-AA71-020DFCEFA65E}" ProjectSection(SolutionItems) = preProject @@ -76,41 +76,75 @@ EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU + Debug|x86 = Debug|x86 Release|Any CPU = Release|Any CPU + Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {16ADD088-AE2A-4D2D-B66C-00ED4D94EC3D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {16ADD088-AE2A-4D2D-B66C-00ED4D94EC3D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {16ADD088-AE2A-4D2D-B66C-00ED4D94EC3D}.Debug|x86.ActiveCfg = Debug|x86 + {16ADD088-AE2A-4D2D-B66C-00ED4D94EC3D}.Debug|x86.Build.0 = Debug|x86 {16ADD088-AE2A-4D2D-B66C-00ED4D94EC3D}.Release|Any CPU.ActiveCfg = Release|Any CPU {16ADD088-AE2A-4D2D-B66C-00ED4D94EC3D}.Release|Any CPU.Build.0 = Release|Any CPU + {16ADD088-AE2A-4D2D-B66C-00ED4D94EC3D}.Release|x86.ActiveCfg = Release|x86 + {16ADD088-AE2A-4D2D-B66C-00ED4D94EC3D}.Release|x86.Build.0 = Release|x86 {31E951ED-11C2-46AA-BE8C-6D954698549E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {31E951ED-11C2-46AA-BE8C-6D954698549E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {31E951ED-11C2-46AA-BE8C-6D954698549E}.Debug|x86.ActiveCfg = Debug|x86 + {31E951ED-11C2-46AA-BE8C-6D954698549E}.Debug|x86.Build.0 = Debug|x86 {31E951ED-11C2-46AA-BE8C-6D954698549E}.Release|Any CPU.ActiveCfg = Release|Any CPU {31E951ED-11C2-46AA-BE8C-6D954698549E}.Release|Any CPU.Build.0 = Release|Any CPU + {31E951ED-11C2-46AA-BE8C-6D954698549E}.Release|x86.ActiveCfg = Release|x86 + {31E951ED-11C2-46AA-BE8C-6D954698549E}.Release|x86.Build.0 = Release|x86 {C21121C8-A6BA-4DA7-95C8-5AA57E165F6C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {C21121C8-A6BA-4DA7-95C8-5AA57E165F6C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C21121C8-A6BA-4DA7-95C8-5AA57E165F6C}.Debug|x86.ActiveCfg = Debug|x86 + {C21121C8-A6BA-4DA7-95C8-5AA57E165F6C}.Debug|x86.Build.0 = Debug|x86 {C21121C8-A6BA-4DA7-95C8-5AA57E165F6C}.Release|Any CPU.ActiveCfg = Release|Any CPU {C21121C8-A6BA-4DA7-95C8-5AA57E165F6C}.Release|Any CPU.Build.0 = Release|Any CPU + {C21121C8-A6BA-4DA7-95C8-5AA57E165F6C}.Release|x86.ActiveCfg = Release|x86 + {C21121C8-A6BA-4DA7-95C8-5AA57E165F6C}.Release|x86.Build.0 = Release|x86 {310E7EA3-7370-4A28-9EA6-450B35E84C7C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {310E7EA3-7370-4A28-9EA6-450B35E84C7C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {310E7EA3-7370-4A28-9EA6-450B35E84C7C}.Debug|x86.ActiveCfg = Debug|x86 + {310E7EA3-7370-4A28-9EA6-450B35E84C7C}.Debug|x86.Build.0 = Debug|x86 {310E7EA3-7370-4A28-9EA6-450B35E84C7C}.Release|Any CPU.ActiveCfg = Release|Any CPU {310E7EA3-7370-4A28-9EA6-450B35E84C7C}.Release|Any CPU.Build.0 = Release|Any CPU + {310E7EA3-7370-4A28-9EA6-450B35E84C7C}.Release|x86.ActiveCfg = Release|x86 + {310E7EA3-7370-4A28-9EA6-450B35E84C7C}.Release|x86.Build.0 = Release|x86 {F71FACA5-08C3-40BA-AF53-B61291A6570C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {F71FACA5-08C3-40BA-AF53-B61291A6570C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F71FACA5-08C3-40BA-AF53-B61291A6570C}.Debug|x86.ActiveCfg = Debug|x86 + {F71FACA5-08C3-40BA-AF53-B61291A6570C}.Debug|x86.Build.0 = Debug|x86 {F71FACA5-08C3-40BA-AF53-B61291A6570C}.Release|Any CPU.ActiveCfg = Release|Any CPU {F71FACA5-08C3-40BA-AF53-B61291A6570C}.Release|Any CPU.Build.0 = Release|Any CPU + {F71FACA5-08C3-40BA-AF53-B61291A6570C}.Release|x86.ActiveCfg = Release|x86 + {F71FACA5-08C3-40BA-AF53-B61291A6570C}.Release|x86.Build.0 = Release|x86 {B3501575-9F71-4574-99F5-6E6231AD8FD4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B3501575-9F71-4574-99F5-6E6231AD8FD4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B3501575-9F71-4574-99F5-6E6231AD8FD4}.Debug|x86.ActiveCfg = Debug|x86 + {B3501575-9F71-4574-99F5-6E6231AD8FD4}.Debug|x86.Build.0 = Debug|x86 {B3501575-9F71-4574-99F5-6E6231AD8FD4}.Release|Any CPU.ActiveCfg = Release|Any CPU {B3501575-9F71-4574-99F5-6E6231AD8FD4}.Release|Any CPU.Build.0 = Release|Any CPU + {B3501575-9F71-4574-99F5-6E6231AD8FD4}.Release|x86.ActiveCfg = Release|x86 + {B3501575-9F71-4574-99F5-6E6231AD8FD4}.Release|x86.Build.0 = Release|x86 {6CEE8102-55B6-42B8-AD74-2246AEB2D942}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {6CEE8102-55B6-42B8-AD74-2246AEB2D942}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6CEE8102-55B6-42B8-AD74-2246AEB2D942}.Debug|x86.ActiveCfg = Debug|x86 + {6CEE8102-55B6-42B8-AD74-2246AEB2D942}.Debug|x86.Build.0 = Debug|x86 {6CEE8102-55B6-42B8-AD74-2246AEB2D942}.Release|Any CPU.ActiveCfg = Release|Any CPU {6CEE8102-55B6-42B8-AD74-2246AEB2D942}.Release|Any CPU.Build.0 = Release|Any CPU + {6CEE8102-55B6-42B8-AD74-2246AEB2D942}.Release|x86.ActiveCfg = Release|x86 + {6CEE8102-55B6-42B8-AD74-2246AEB2D942}.Release|x86.Build.0 = Release|x86 {34DD929F-BA21-4A80-AA93-114AFCC15EE7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {34DD929F-BA21-4A80-AA93-114AFCC15EE7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {34DD929F-BA21-4A80-AA93-114AFCC15EE7}.Debug|x86.ActiveCfg = Debug|x86 + {34DD929F-BA21-4A80-AA93-114AFCC15EE7}.Debug|x86.Build.0 = Debug|x86 {34DD929F-BA21-4A80-AA93-114AFCC15EE7}.Release|Any CPU.ActiveCfg = Release|Any CPU {34DD929F-BA21-4A80-AA93-114AFCC15EE7}.Release|Any CPU.Build.0 = Release|Any CPU + {34DD929F-BA21-4A80-AA93-114AFCC15EE7}.Release|x86.ActiveCfg = Release|x86 + {34DD929F-BA21-4A80-AA93-114AFCC15EE7}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE From ef66301f22080c7c9ae2d4555c155c08906a2de7 Mon Sep 17 00:00:00 2001 From: AndreasMartin72 Date: Fri, 4 May 2018 12:49:20 +0200 Subject: [PATCH 5/6] Package consolidation From 791d7a7095ee359e49cb5faa92454a1028dd0087 Mon Sep 17 00:00:00 2001 From: AndreasMartin72 Date: Fri, 4 May 2018 16:08:35 +0200 Subject: [PATCH 6/6] Bugfix: BLOB was not written (program stop) Modified BLOB in TableDiffControl.cs was not written. --- SQLiteTurbo/TableDiffControl.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/SQLiteTurbo/TableDiffControl.cs b/SQLiteTurbo/TableDiffControl.cs index dc1f859..c799365 100644 --- a/SQLiteTurbo/TableDiffControl.cs +++ b/SQLiteTurbo/TableDiffControl.cs @@ -545,6 +545,7 @@ private void HandleCellEdit(bool right) { if (otherBlob != null && (citem.Result == ComparisonResult.Same || citem.Result == ComparisonResult.DifferentData)) { + /* if (otherBlob is long) { // Another adjustment for the other BLOB field value @@ -552,11 +553,19 @@ private void HandleCellEdit(bool right) if (ob == 0) // means NULL blob field otherBlob = DBNull.Value; } + */ + if (Utils.GetDbType(column.ColumnType) == DbType.Binary) + { + if (otherBlob.Equals("0")) + otherBlob = DBNull.Value; + } + } if (value != DBNull.Value) { - string fpath = null; + //string fpath = null; + string fpath = Configuration.TempBlobFilePath; long blobLength = 0; if (value is Be.Windows.Forms.DynamicFileByteProvider) { @@ -599,7 +608,8 @@ private void HandleCellEdit(bool right) // Update the table change item with an indication that the BLOB field that was just saved // is not null. - citem.SetField(column.ObjectName.ToString(), !right, (long)1); + //citem.SetField(column.ObjectName.ToString(), !right, (long)1); + citem.SetField(column.ObjectName.ToString(), !right, "1"); if (otherBlob != null && (citem.Result == ComparisonResult.DifferentData || citem.Result == ComparisonResult.Same)) {