コード例 #1
0
        public void Blob()
        {
            var str1  = string.Join(",", Enumerable.Range(0, 10000).Select(a => "我是中国人"));
            var data1 = Encoding.UTF8.GetBytes(str1);

            var item1 = new TS_BLB01 {
                Data = data1
            };

            Assert.Equal(1, g.oracle.Insert(item1).ExecuteAffrows());

            var item2 = g.oracle.Select <TS_BLB01>().Where(a => a.Id == item1.Id).First();

            Assert.Equal(item1.Data.Length, item2.Data.Length);

            var str2 = Encoding.UTF8.GetString(item2.Data);

            Assert.Equal(str1, str2);

            //NoneParameter
            item1 = new TS_BLB01 {
                Data = data1
            };
            Assert.Throws <Exception>(() => g.oracle.Insert(item1).NoneParameter().ExecuteAffrows());
            //Oracle.ManagedDataAccess.Client.OracleException:“ORA-01704: 字符串文字太长”
        }
コード例 #2
0
        public void Blob()
        {
            var str1  = string.Join(",", Enumerable.Range(0, 10000).Select(a => "我是中国人"));
            var data1 = Encoding.UTF8.GetBytes(str1);

            var item1 = new TS_BLB01 {
                Data = data1
            };

            Assert.Equal(1, g.mysql.Insert(item1).ExecuteAffrows());

            var item2 = g.mysql.Select <TS_BLB01>().Where(a => a.Id == item1.Id).First();

            Assert.Equal(item1.Data.Length, item2.Data.Length);

            var str2 = Encoding.UTF8.GetString(item2.Data);

            Assert.Equal(str1, str2);

            //NoneParameter
            item1 = new TS_BLB01 {
                Data = data1
            };
            Assert.Equal(1, g.mysql.Insert <TS_BLB01>().NoneParameter().AppendData(item1).ExecuteAffrows());

            item2 = g.mysql.Select <TS_BLB01>().Where(a => a.Id == item1.Id).First();
            Assert.Equal(item1.Data.Length, item2.Data.Length);

            str2 = Encoding.UTF8.GetString(item2.Data);
            Assert.Equal(str1, str2);
        }
コード例 #3
0
        public void Blob()
        {
            var str1  = string.Join(",", Enumerable.Range(0, 10000).Select(a => "我是中国人"));
            var data1 = Encoding.UTF8.GetBytes(str1);

            var item1 = new TS_BLB01 {
                Data = data1
            };

            Assert.Equal(1, g.firebird.Insert(item1).ExecuteAffrows());

            var item2 = g.firebird.Select <TS_BLB01>().Where(a => a.Id == item1.Id).First();

            Assert.Equal(item1.Data.Length, item2.Data.Length);
            var str2 = Encoding.UTF8.GetString(item2.Data);

            Assert.Equal(str1, str2);

            //NoneParameter
            item1 = new TS_BLB01 {
                Data = data1
            };
            Assert.Equal(1, g.firebird.Insert(item1).NoneParameter().ExecuteAffrows());
            item2 = g.firebird.Select <TS_BLB01>().Where(a => a.Id == item1.Id).First();
            Assert.Equal(item1.Data.Length, item2.Data.Length);
            str2 = Encoding.UTF8.GetString(item2.Data);
            Assert.Equal(str1, str2);
            //Assert.Throws<Exception>(() => g.firebird.Insert(item1).NoneParameter().ExecuteAffrows());
            //Dynamic SQL Error
            //SQL error code = -104
            //String literal with 159999 bytes exceeds the maximum length of 65535 bytes
        }