public RawDbConnection(DbConnection connection, RawDb rawdb) { Connection = connection; Connection.Open(); var cmd = connection.CreateCommand(); cmd.CommandText = "SELECT id, randomnumber FROM world WHERE id = @Id"; var id = cmd.CreateParameter(); id.ParameterName = "@Id"; id.DbType = DbType.Int32; id.Value = 0; cmd.Parameters.Add(id); ReadCommand = cmd; cmd = connection.CreateCommand(); cmd.CommandText = "SELECT id, message FROM fortune"; FortuneCommand = cmd; DbHandler = rawdb; }
public void Init(HttpApiServer server, string path) { mPgsql = new RawDb(new ConcurrentRandom(), Npgsql.NpgsqlFactory.Instance); }