Esempio n. 1
0
        public void BlobWithoutLength()
        {
            if (Dialect is MySQLDialect)
            {
                Assert.Ignore("Not fixed for MySQLDialect, still generating a varchar(255) column for StringClob without length");
            }
            int id;
            // buildup a string the exceed the mapping
            string str = GetFixedLengthString12000();

            using (ISession sess = OpenSession())
                using (ITransaction tx = sess.BeginTransaction())
                {
                    // create and save the entity
                    StringLengthEntity entity = new StringLengthEntity();
                    entity.Blob = str;
                    sess.Save(entity);
                    tx.Commit();
                    id = entity.ID;
                }

            using (ISession sess = OpenSession())
                using (ITransaction tx = sess.BeginTransaction())
                {
                    StringLengthEntity loaded = sess.Get <StringLengthEntity>(id);
                    Assert.IsNotNull(loaded);
                    Assert.AreEqual(12000, loaded.Blob.Length);
                    Assert.AreEqual(str, loaded.Blob);
                    tx.Commit();
                }
        }
Esempio n. 2
0
        public void StringSqlType()
        {
            int id;
            // buildup a string the exceed the mapping
            string str = GetFixedLengthString12000();

            using (ISession sess = OpenSession())
                using (ITransaction tx = sess.BeginTransaction())
                {
                    // create and save the entity
                    StringLengthEntity entity = new StringLengthEntity();
                    entity.StringSqlType = str;
                    sess.Save(entity);
                    tx.Commit();
                    id = entity.ID;
                }

            using (ISession sess = OpenSession())
                using (ITransaction tx = sess.BeginTransaction())
                {
                    StringLengthEntity loaded = sess.Get <StringLengthEntity>(id);
                    Assert.IsNotNull(loaded);
                    Assert.AreEqual(12000, loaded.StringSqlType.Length);
                    Assert.AreEqual(str, loaded.StringSqlType);
                    tx.Commit();
                }
        }
Esempio n. 3
0
        public void BlobSqlType()
        {
            int id;
            // buildup a string the exceed the mapping
            string str = GetFixedLengthString12000();

            using (ISession sess = OpenSession())
            using (ITransaction tx = sess.BeginTransaction())
            {
                // create and save the entity
                StringLengthEntity entity = new StringLengthEntity();
                entity.BlobSqlType = str;
                sess.Save(entity);
                tx.Commit();
                id = entity.ID;
            }

            using (ISession sess = OpenSession())
            using (ITransaction tx = sess.BeginTransaction())
            {
                StringLengthEntity loaded = sess.Get<StringLengthEntity>(id);
                Assert.IsNotNull(loaded);
                Assert.AreEqual(12000, loaded.BlobSqlType.Length);
                Assert.AreEqual(str, loaded.BlobSqlType);
                tx.Commit();
            }
        }
Esempio n. 4
0
        public async Task BlobSqlTypeAsync()
        {
            int id;
            // buildup a string the exceed the mapping
            string str = GetFixedLengthString12000();

            using (ISession sess = OpenSession())
                using (ITransaction tx = sess.BeginTransaction())
                {
                    // create and save the entity
                    StringLengthEntity entity = new StringLengthEntity();
                    entity.BlobSqlType = str;
                    await(sess.SaveAsync(entity));
                    await(tx.CommitAsync());
                    id = entity.ID;
                }

            using (ISession sess = OpenSession())
                using (ITransaction tx = sess.BeginTransaction())
                {
                    StringLengthEntity loaded = await(sess.GetAsync <StringLengthEntity>(id));
                    Assert.IsNotNull(loaded);
                    Assert.AreEqual(12000, loaded.BlobSqlType.Length);
                    Assert.AreEqual(str, loaded.BlobSqlType);
                    await(tx.CommitAsync());
                }
        }
Esempio n. 5
0
        public async Task StringHugeLengthAsync()
        {
            if (Sfi.ConnectionProvider.Driver is OdbcDriver || Dialect is MsSqlCeDialect)
            {
                Assert.Ignore("NH-4065, not fixed for Odbc and MsSqlCe");
            }

            int id;
            // buildup a string the exceed the mapping
            string str = GetFixedLengthString12000();

            using (ISession sess = OpenSession())
                using (ITransaction tx = sess.BeginTransaction())
                {
                    // create and save the entity
                    StringLengthEntity entity = new StringLengthEntity();
                    entity.StringHugeLength = str;
                    await(sess.SaveAsync(entity));
                    await(tx.CommitAsync());
                    id = entity.ID;
                }

            using (ISession sess = OpenSession())
                using (ITransaction tx = sess.BeginTransaction())
                {
                    StringLengthEntity loaded = await(sess.GetAsync <StringLengthEntity>(id));
                    Assert.IsNotNull(loaded);
                    Assert.AreEqual(12000, loaded.StringHugeLength.Length);
                    Assert.AreEqual(str, loaded.StringHugeLength);
                    await(tx.CommitAsync());
                }
        }
Esempio n. 6
0
        public void StringHugeLength()
        {
            if (Sfi.ConnectionProvider.Driver is OdbcDriver)
            {
                Assert.Ignore("NH-4065, not fixed for Odbc");
            }

            int id;
            // buildup a string the exceed the mapping
            string str = GetFixedLengthString12000();

            using (ISession sess = OpenSession())
                using (ITransaction tx = sess.BeginTransaction())
                {
                    // create and save the entity
                    StringLengthEntity entity = new StringLengthEntity();
                    entity.StringHugeLength = str;
                    sess.Save(entity);
                    tx.Commit();
                    id = entity.ID;
                }

            using (ISession sess = OpenSession())
                using (ITransaction tx = sess.BeginTransaction())
                {
                    StringLengthEntity loaded = sess.Get <StringLengthEntity>(id);
                    Assert.IsNotNull(loaded);
                    Assert.AreEqual(12000, loaded.StringHugeLength.Length);
                    Assert.AreEqual(str, loaded.StringHugeLength);
                    tx.Commit();
                }
        }
Esempio n. 7
0
        public void StringHugeLength()
        {
            if (Sfi.ConnectionProvider.Driver is OdbcDriver || Dialect is MsSqlCeDialect)
            {
                Assert.Ignore("NH-4065, not fixed for Odbc and MsSqlCe");
            }

            if (Dialect.GetTypeName(SqlTypeFactory.GetString(10000)) != Dialect.GetLongestTypeName(DbType.String))
            {
                Assert.Ignore("Current dialect does support limited strings of 10 000 characters");
            }

            int id;
            // buildup a string the exceed the mapping
            string str = GetFixedLengthString12000();

            using (ISession sess = OpenSession())
                using (ITransaction tx = sess.BeginTransaction())
                {
                    // create and save the entity
                    StringLengthEntity entity = new StringLengthEntity();
                    entity.StringHugeLength = str;
                    sess.Save(entity);
                    tx.Commit();
                    id = entity.ID;
                }

            using (ISession sess = OpenSession())
                using (ITransaction tx = sess.BeginTransaction())
                {
                    StringLengthEntity loaded = sess.Get <StringLengthEntity>(id);
                    Assert.IsNotNull(loaded);
                    Assert.AreEqual(12000, loaded.StringHugeLength.Length);
                    Assert.AreEqual(str, loaded.StringHugeLength);
                    tx.Commit();
                }
        }