diff --git a/osrepodbmgr.Core/ChangeLog b/osrepodbmgr.Core/ChangeLog index 156fcd2..d768aff 100644 --- a/osrepodbmgr.Core/ChangeLog +++ b/osrepodbmgr.Core/ChangeLog @@ -1,3 +1,9 @@ +2017-05-19 Natalia Portillo + + * DBOps.cs: + * Schema.cs: + Change db field name + 2017-05-19 Natalia Portillo * Workers/Database.cs: diff --git a/osrepodbmgr.Core/DBOps.cs b/osrepodbmgr.Core/DBOps.cs index f80669b..c37c54d 100644 --- a/osrepodbmgr.Core/DBOps.cs +++ b/osrepodbmgr.Core/DBOps.cs @@ -274,7 +274,7 @@ namespace osrepodbmgr.Core param1.ParameterName = "@sha256"; param2.ParameterName = "@crack"; - param3.ParameterName = "@virscan"; + param3.ParameterName = "@hasvirus"; param4.ParameterName = "@clamtime"; param5.ParameterName = "@vtotaltime"; param6.ParameterName = "@virus"; @@ -318,7 +318,7 @@ namespace osrepodbmgr.Core IDbTransaction trans = dbCon.BeginTransaction(); dbcmd.Transaction = trans; - const string sql = "UPDATE files SET crack = @crack, virscan = @virscan, clamtime = @clamtime, vtotaltime = @vtotaltime, virus = @virus, length = @length " + + const string sql = "UPDATE files SET crack = @crack, hasvirus = @hasvirus, clamtime = @clamtime, vtotaltime = @vtotaltime, virus = @virus, length = @length " + "WHERE sha256 = @sha256"; dbcmd.CommandText = sql; @@ -336,8 +336,8 @@ namespace osrepodbmgr.Core IDbTransaction trans = dbCon.BeginTransaction(); dbcmd.Transaction = trans; - const string sql = "INSERT INTO `files` (`sha256`, `crack`, `virscan`, `clamtime`, `vtotaltime`, `virus`, `length`)" + - " VALUES (@sha256, @crack, @virscan, @clamtime, @vtotaltime, @virus, @length)"; + const string sql = "INSERT INTO `files` (`sha256`, `crack`, `hasvirus`, `clamtime`, `vtotaltime`, `virus`, `length`)" + + " VALUES (@sha256, @crack, @hasvirus, @clamtime, @vtotaltime, @virus, @length)"; dbcmd.CommandText = sql; @@ -404,10 +404,10 @@ namespace osrepodbmgr.Core fEntry.Id = ulong.Parse(dRow["id"].ToString()); fEntry.Sha256 = dRow["sha256"].ToString(); fEntry.Crack = bool.Parse(dRow["crack"].ToString()); - if(dRow["virscan"] == DBNull.Value) + if(dRow["hasvirus"] == DBNull.Value) fEntry.HasVirus = null; else - fEntry.HasVirus = bool.Parse(dRow["virscan"].ToString()); + fEntry.HasVirus = bool.Parse(dRow["hasvirus"].ToString()); if(dRow["clamtime"] == DBNull.Value) fEntry.ClamTime = null; else @@ -446,10 +446,10 @@ namespace osrepodbmgr.Core fEntry.Id = ulong.Parse(dRow["id"].ToString()); fEntry.Sha256 = dRow["sha256"].ToString(); fEntry.Crack = bool.Parse(dRow["crack"].ToString()); - if(dRow["virscan"] == DBNull.Value) + if(dRow["hasvirus"] == DBNull.Value) fEntry.HasVirus = null; else - fEntry.HasVirus = bool.Parse(dRow["virscan"].ToString()); + fEntry.HasVirus = bool.Parse(dRow["hasvirus"].ToString()); if(dRow["clamtime"] == DBNull.Value) fEntry.ClamTime = null; else @@ -471,7 +471,7 @@ namespace osrepodbmgr.Core { entries = new List(); - const string sql = "SELECT * FROM files WHERE virscan IS NULL ORDER BY sha256"; + const string sql = "SELECT * FROM files WHERE hasvirus IS NULL ORDER BY sha256"; IDbCommand dbcmd = dbCon.CreateCommand(); IDbDataAdapter dataAdapter = dbCore.GetNewDataAdapter(); @@ -488,10 +488,10 @@ namespace osrepodbmgr.Core fEntry.Id = ulong.Parse(dRow["id"].ToString()); fEntry.Sha256 = dRow["sha256"].ToString(); fEntry.Crack = bool.Parse(dRow["crack"].ToString()); - if(dRow["virscan"] == DBNull.Value) + if(dRow["hasvirus"] == DBNull.Value) fEntry.HasVirus = null; else - fEntry.HasVirus = bool.Parse(dRow["virscan"].ToString()); + fEntry.HasVirus = bool.Parse(dRow["hasvirus"].ToString()); if(dRow["clamtime"] == DBNull.Value) fEntry.ClamTime = null; else diff --git a/osrepodbmgr.Core/Schema.cs b/osrepodbmgr.Core/Schema.cs index 1c5947e..cf8e3ce 100644 --- a/osrepodbmgr.Core/Schema.cs +++ b/osrepodbmgr.Core/Schema.cs @@ -1,4 +1,4 @@ -// +// // Author: // Natalia Portillo claunia@claunia.com // @@ -37,14 +37,14 @@ namespace osrepodbmgr.Core " `id` INTEGER PRIMARY KEY AUTOINCREMENT,\n" + " `sha256` VARCHAR(64) NOT NULL,\n" + " `crack` BOOLEAN NOT NULL,\n" + - " `virscan` BOOLEAN NULL,\n" + + " `hasvirus` BOOLEAN NULL,\n" + " `clamtime` DATETIME NULL,\n" + " `vtotaltime` DATETIME NULL,\n" + " `virus` VARCHAR(128) NULL,\n" + " `length` BIGINT NOT NULL);\n\n" + "CREATE UNIQUE INDEX `files_id_UNIQUE` ON `files` (`id` ASC);\n\n" + "CREATE UNIQUE INDEX `files_sha256_UNIQUE` ON `files` (`sha256` ASC);\n\n" + - "CREATE INDEX `files_virscan_idx` ON `files` (`virscan` ASC);\n\n" + + "CREATE INDEX `files_hasvirus_idx` ON `files` (`hasvirus` ASC);\n\n" + "CREATE INDEX `files_virus_idx` ON `files` (`virus` ASC);\n\n" + "CREATE INDEX `files_length_idx` ON `files` (`length` ASC);";