mirror of
https://github.com/PredatH0r/ChanSort.git
synced 2026-01-13 02:42:03 +01:00
Repair damanged SQLite databases by re-indexing
This commit is contained in:
@@ -24,7 +24,7 @@ namespace ChanSort.Loader.Panasonic
|
||||
private CypherMode cypherMode;
|
||||
private byte[] fileHeader = new byte[0];
|
||||
private int dbSizeOffset;
|
||||
private bool littleEndianByteOrder = false;
|
||||
private bool littleEndianByteOrder;
|
||||
private string charEncoding;
|
||||
|
||||
enum CypherMode
|
||||
@@ -331,9 +331,10 @@ namespace ChanSort.Loader.Panasonic
|
||||
using (var conn = new SQLiteConnection(channelConnString))
|
||||
{
|
||||
conn.Open();
|
||||
InitCharacterEncoding(conn);
|
||||
using (var cmd = conn.CreateCommand())
|
||||
{
|
||||
RepairCorruptedDatabaseImage(cmd);
|
||||
InitCharacterEncoding(cmd);
|
||||
this.ReadChannels(cmd);
|
||||
}
|
||||
}
|
||||
@@ -481,13 +482,18 @@ namespace ChanSort.Loader.Panasonic
|
||||
#endregion
|
||||
|
||||
#region InitCharacterEncoding()
|
||||
private void InitCharacterEncoding(SQLiteConnection conn)
|
||||
private void InitCharacterEncoding(SQLiteCommand cmd)
|
||||
{
|
||||
using (var cmd = conn.CreateCommand())
|
||||
{
|
||||
cmd.CommandText = "PRAGMA encoding";
|
||||
this.charEncoding = cmd.ExecuteScalar() as string;
|
||||
}
|
||||
cmd.CommandText = "PRAGMA encoding";
|
||||
this.charEncoding = cmd.ExecuteScalar() as string;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region RepairCorruptedDatabaseImage()
|
||||
private void RepairCorruptedDatabaseImage(SQLiteCommand cmd)
|
||||
{
|
||||
cmd.CommandText = "REINDEX";
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -572,6 +578,7 @@ order by s.ntype,major_channel
|
||||
this.WriteChannels(cmd, this.freesatChannels);
|
||||
trans.Commit();
|
||||
}
|
||||
this.RepairCorruptedDatabaseImage(cmd);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -55,6 +55,7 @@ namespace ChanSort.Loader.Toshiba
|
||||
conn.Open();
|
||||
using (var cmd = conn.CreateCommand())
|
||||
{
|
||||
this.RepairCorruptedDatabaseImage(cmd);
|
||||
this.ReadSatellites(cmd);
|
||||
this.ReadTransponders(cmd);
|
||||
}
|
||||
@@ -131,6 +132,14 @@ namespace ChanSort.Loader.Toshiba
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region RepairCorruptedDatabaseImage()
|
||||
private void RepairCorruptedDatabaseImage(SQLiteCommand cmd)
|
||||
{
|
||||
cmd.CommandText = "REINDEX";
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ReadSatellites()
|
||||
private void ReadSatellites(SQLiteCommand cmd)
|
||||
{
|
||||
@@ -302,6 +311,7 @@ namespace ChanSort.Loader.Toshiba
|
||||
this.WriteChannels(cmd, "EuroSATChanList", this.satRadioChannels);
|
||||
trans.Commit();
|
||||
}
|
||||
this.RepairCorruptedDatabaseImage(cmd);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace ChanSort.Ui
|
||||
{
|
||||
public partial class MainForm : XtraForm
|
||||
{
|
||||
public const string AppVersion = "v2013-11-23";
|
||||
public const string AppVersion = "v2013-11-24";
|
||||
|
||||
private const int MaxMruEntries = 10;
|
||||
|
||||
|
||||
10
readme.txt
10
readme.txt
@@ -1,10 +1,7 @@
|
||||
Version v2013-11-23 =======================================================
|
||||
Version v2013-11-24 =======================================================
|
||||
|
||||
Changes:
|
||||
- Channel lists can now be printed
|
||||
- Fix: Error when saving Toshiba and Panasonic channel list which contained
|
||||
red proxy entries for missing channels after applying a reference list
|
||||
- Fix: Modified Panasonic channel names were not written to the file
|
||||
- Load and repair corrupted Panasonic and Toshiba SQLite channel lists
|
||||
|
||||
The complete change log can be found at the end of this document
|
||||
|
||||
@@ -113,6 +110,9 @@ OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Change log ================================================================
|
||||
|
||||
2013-11-24
|
||||
- Load and repair corrupted Panasonic and Toshiba SQLite channel lists
|
||||
|
||||
2013-11-23
|
||||
- Channel lists can now be printed
|
||||
- Fix: Error when saving Toshiba and Panasonic channel list which contained
|
||||
|
||||
Reference in New Issue
Block a user