using System; using System.Collections.Generic; using System.Data; using System.Data.Common; using System.Text; using Activizr.Basic.Types; using Activizr.Basic.Enums; namespace Activizr.Database { public partial class PirateDb { public string GetKeyValue (string key) { using (DbConnection connection = GetMySqlDbConnection()) { connection.Open(); DbCommand command = GetDbCommand("SELECT DataValue FROM FlatData WHERE DataKey='" + key.Replace("'", "''") + "'", connection); using (DbDataReader reader = command.ExecuteReader()) { if (reader.Read()) { return reader.GetString(0); } return string.Empty; } } } public void SetKeyValue (string key, string value) { using (DbConnection connection = GetMySqlDbConnection()) { connection.Open(); DbCommand command = GetDbCommand("SetKeyValue", connection); command.CommandType = CommandType.StoredProcedure; AddParameterWithName(command, "dataKey", key); AddParameterWithName(command, "dataValue", value); command.ExecuteNonQuery(); } } public Dictionary GetOldKeyValues() { /* Dictionary result = new Dictionary(); using (DbConnection connection = GetSqlServerDbConnection()) { connection.Open(); DbCommand command = GetDbCommand("SELECT [Key],[Value] FROM FlatData", connection); using (DbDataReader reader = command.ExecuteReader()) { while (reader.Read()) { result [reader.GetString(0)] = reader.GetString(1); } return result; } }*/ return new Dictionary(); } } }