Exemplo n.º 1
0
        public void QueryHintForUpdateSkipLockedTest([IncludeDataSources(true, TestProvName.AllPostgreSQL)] string context)
        {
            using var db = GetDataContext(context);

            var q =
                (
                    from p in db.Parent
                    join c in db.Child on p.ParentID equals c.ParentID
                    select p
                )
                .AsPostgreSQL()
                .ForUpdateSkipLockedHint();

            _ = q.ToList();

            var skipLocked = LastQuery.Contains(ProviderName.PostgreSQL95) ? " SKIP LOCKED" : "";

            Assert.That(LastQuery, Contains.Substring($"{PostgreSQLHints.ForUpdate}{skipLocked}"));
        }
Exemplo n.º 2
0
        public void QueryHintForKeyShareTest([IncludeDataSources(true, TestProvName.AllPostgreSQL)] string context)
        {
            using var db = GetDataContext(context);

            var q =
                (
                    from p in db.Parent
                    join c in db.Child on p.ParentID equals c.ParentID
                    select p
                )
                .AsPostgreSQL()
                .ForKeyShareHint();

            _ = q.ToList();

            if (LastQuery.Contains(ProviderName.PostgreSQL92))
            {
                return;
            }

            Assert.That(LastQuery, Contains.Substring($"{PostgreSQLHints.ForKeyShare}"));
        }
Exemplo n.º 3
0
        public void QueryHintForKeyShareNoWaitTest2([IncludeDataSources(true, TestProvName.AllPostgreSQL)] string context)
        {
            using var db = GetDataContext(context);

            var q =
                (
                    from p in db.Parent.TableID("Pr")
                    join c in db.Child.TableID("Ch") on p.ParentID equals c.ParentID
                    select p
                )
                .AsPostgreSQL()
                .ForKeyShareNoWaitHint(Sql.TableAlias("Pr"), Sql.TableAlias("Ch"));

            _ = q.ToList();

            if (LastQuery.Contains(ProviderName.PostgreSQL92))
            {
                return;
            }

            Assert.That(LastQuery, Contains.Substring($"{PostgreSQLHints.ForKeyShare} OF p, c_1 {PostgreSQLHints.NoWait}"));
        }
Exemplo n.º 4
0
        public void QueryHintForNoKeyUpdateSkipLockedTest2([IncludeDataSources(true, TestProvName.AllPostgreSQL)] string context)
        {
            using var db = GetDataContext(context);

            var q =
                (
                    from p in db.Parent.TableID("Pr")
                    join c in db.Child.TableID("Ch") on p.ParentID equals c.ParentID
                    select p
                )
                .AsPostgreSQL()
                .ForNoKeyUpdateSkipLockedHint(Sql.TableAlias("Pr"), Sql.TableAlias("Ch"));

            _ = q.ToList();

            if (LastQuery.Contains(ProviderName.PostgreSQL92))
            {
                return;
            }

            var skipLocked = LastQuery.Contains(ProviderName.PostgreSQL95) ? " SKIP LOCKED" : "";

            Assert.That(LastQuery, Contains.Substring($"{PostgreSQLHints.ForNoKeyUpdate} OF p, c_1{skipLocked}"));
        }