Esempio n. 1
0
 protected void CommitTransaction()
 {
     using (var cmdUpdateVersion = new DbCommandRedundant($"UPDATE params SET value = \"{Version}\" WHERE SECTION=\"DATABASE\" AND `key`=\"VERSION\"", Connection))
         cmdUpdateVersion.ExecuteNonQuery();
     _transaction.Commit();
     _transaction = null;
 }
Esempio n. 2
0
 public int GetCurrentVersion()
 {
     using (var command = new DbCommandRedundant("select value from params where SECTION=\"DATABASE\" and `key`=\"VERSION\"", _connection))
     {
         var dbVersionNr = 0;
         try
         {
             string dbVersionStr;
             lock (_connection)
                 dbVersionStr = (string)command.ExecuteScalar();
             if (dbVersionStr != null)
             {
                 int.TryParse(dbVersionStr, out dbVersionNr);
             }
         }
         catch
         {
             // ignored
         }
         return(dbVersionNr);
     }
 }