예제 #1
0
            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;
            }
예제 #2
0
 public void Init(HttpApiServer server, string path)
 {
     mPgsql = new RawDb(new ConcurrentRandom(), Npgsql.NpgsqlFactory.Instance);
 }