示例#1
0
        public void EnsureSettingsTableExists()
        {
            string cmd = null;

            try
            {
                if (!_dynaSql.DbTableExists(TABLE_NAME))
                {
                    cmd = $"create table if not exists {TABLE_NAME} (key text PRIMARY KEY, value text);";
                    _dynaSql.SqlExecuteNonQuery(cmd);
                }
            }
            catch (Exception e)
            {
                Log.To.Main.AddException($"Failed ensuring monitor table. {cmd} on path {_dynaSql.ConnString}", e);
                throw;
            }
        }
        public void EnsureMonitorTableExists(string tableName)
        {
            string cmd = null;

            try
            {
                if (!_dynaSql.DbTableExists(tableName))
                {
                    cmd = $"create table if not exists {tableName} (id text PRIMARY KEY, created text not null, exportedDate text, data text);";
                    _dynaSql.SqlExecuteNonQuery(cmd);
                }
            }
            catch (Exception e)
            {
                Log.To.Main.AddException($"Failed ensuring monitor table. {cmd} on path {_dynaSql.ConnString}", e);
                throw;
            }
        }