Exemple #1
0
        private static void Test_apis_669()
        {
            String sql = "select s_name from code where f_name = 'Woman';select * from code;";

            CUBRIDCommand cmd = new CUBRIDCommand(sql, conn);

            CUBRIDDataReader reader = (CUBRIDDataReader)cmd.ExecuteReader();

            while (reader.Read())
            {
                Console.WriteLine(reader.GetString(0));
            }
            ;

            while (reader.NextResult())
            {
                Console.WriteLine("=============================");

                while (reader.Read())
                {
                    Console.WriteLine(reader.GetString(0));
                    //    Console.WriteLine(reader.GetString(1));
                }
                ;
            }
        }
Exemple #2
0
        public void DataReader_MultiQuery_Test2()
        {
            string           conn_string = "server=test-db-server;database=demodb;port=33000;user=dba;password="******"select s_name from code where s_name='X'; select name from nation where name='Algeria';";
            CUBRIDCommand cmd = new CUBRIDCommand(sql, conn);

            CUBRIDDataReader reader = (CUBRIDDataReader)cmd.ExecuteReader();

            while (reader.Read())
            {
                Console.WriteLine(reader.GetString(0));
            }
            ;

            while (reader.NextResult())
            {
                Console.WriteLine("=============================");

                while (reader.Read())
                {
                    Console.WriteLine(reader.GetString(0));
                }
                ;
            }

            conn.Close();
        }
Exemple #3
0
        public void DataReader_NextResult_Test()
        {
            string           conn_string = "server=test-db-server;database=demodb;port=33000;user=dba;password="******"select * from nation;";
            CUBRIDCommand cmd = new CUBRIDCommand(sql, conn);

            CUBRIDDataReader reader = (CUBRIDDataReader)cmd.ExecuteReader();

            reader.Read();
            Console.WriteLine(reader.GetString(0));

            if (reader.NextResult())
            {
                reader.Read();
                Console.WriteLine(reader.GetString(0));
            }

            conn.Close();
        }
        public void DataReader_NextResult_Test()
        {
            using (CUBRIDConnection conn = new CUBRIDConnection())
            {
                conn.ConnectionString = DBHelper.connString;
                conn.Open();

                String sql = "select count(*) from nation; select count(*) from athlete";
                using (CUBRIDCommand cmd = new CUBRIDCommand(sql, conn))
                {
                    using (CUBRIDDataReader reader = (CUBRIDDataReader)cmd.ExecuteReader())
                    {
                        reader.Read();
                        Assert.AreEqual(215, reader.GetInt32(0));

                        if (reader.NextResult())
                        {
                            reader.Read();
                            Assert.AreEqual(6677, reader.GetInt32(0));
                        }
                    }
                }

                sql = "select * from nation order by code asc; select * from athlete order by name asc";
                using (CUBRIDCommand cmd = new CUBRIDCommand(sql, conn))
                {
                    using (CUBRIDDataReader reader = (CUBRIDDataReader)cmd.ExecuteReader())
                    {
                        //verify the first two results
                        reader.Read();
                        Assert.AreEqual(4, reader.FieldCount);
                        Assert.AreEqual("AFG", reader.GetString(0));
                        Assert.AreEqual("Afghanistan", reader.GetString(1));
                        Assert.AreEqual("Asia", reader.GetString(2));
                        Assert.AreEqual("Kabul", reader.GetString(3));

                        reader.Read();
                        Assert.AreEqual(4, reader.FieldCount);
                        Assert.AreEqual("AHO", reader.GetString(0));
                        Assert.AreEqual("Netherlands Antilles", reader.GetString(1));
                        Assert.AreEqual("Americas", reader.GetString(2));
                        Assert.AreEqual("Willemstad", reader.GetString(3));

                        if (reader.NextResult())
                        {
                            //verify the first two results
                            reader.Read();
                            Assert.AreEqual(5, reader.FieldCount);
                            Assert.AreEqual(15718, reader.GetInt32(0));
                            Assert.AreEqual("Aardenburg Willemien", reader.GetString(1));
                            Assert.AreEqual("W", reader.GetString(2));
                            Assert.AreEqual("NED", reader.GetString(3));
                            Assert.AreEqual("Hockey", reader.GetString(4));

                            reader.Read();
                            Assert.AreEqual(5, reader.FieldCount);
                            Assert.AreEqual(10000, reader.GetInt32(0));
                            Assert.AreEqual("Aardewijn Pepijn", reader.GetString(1));
                            Assert.AreEqual("M", reader.GetString(2));
                            Assert.AreEqual("NED", reader.GetString(3));
                            Assert.AreEqual("Rowing", reader.GetString(4));
                        }
                    }
                }
            }
        }