Esempio n. 1
0
        public void VerifyRecposCanBeSerialized()
        {
            var expected = new JET_RECPOS {
                centriesLT = 10, centriesTotal = 11
            };

            SerializeAndCompareContent(expected);
        }
Esempio n. 2
0
        public void JetRecposToString()
        {
            var recpos = new JET_RECPOS {
                centriesLT = 5, centriesTotal = 10
            };

            Assert.AreEqual("JET_RECPOS(5/10)", recpos.ToString());
        }
Esempio n. 3
0
        public void ConvertRecposToNativeWithNegativeCentriesTotal()
        {
            var recpos = new JET_RECPOS();

            recpos.centriesLT    = 1;
            recpos.centriesTotal = Int64.MinValue;

            NATIVE_RECPOS native = recpos.GetNativeRecpos();
        }
Esempio n. 4
0
        public void ConvertRecposToNativeWithNegativeCentriesLt()
        {
            var recpos = new JET_RECPOS();

            recpos.centriesLT    = -1;
            recpos.centriesTotal = 10;

            NATIVE_RECPOS native = recpos.GetNativeRecpos();
        }
Esempio n. 5
0
        public void VerifyJetRecposEquality()
        {
            var x = new JET_RECPOS {
                centriesLT = 1, centriesTotal = 2
            };
            var y = new JET_RECPOS {
                centriesLT = 1, centriesTotal = 2
            };

            TestContentEquals(x, y);
        }
Esempio n. 6
0
        public void GotoLastPosition()
        {
            var recpos = new JET_RECPOS()
            {
                centriesLT = 4, centriesTotal = 4
            };

            Api.JetGotoPosition(this.sesid, this.tableid, recpos);
            int actual = this.GetLongColumn();

            Assert.AreEqual(this.numRecords - 1, actual);
        }
Esempio n. 7
0
        public void GotoFirstPosition()
        {
            var recpos = new JET_RECPOS()
            {
                centriesLT = 0, centriesTotal = 10
            };

            Api.JetGotoPosition(this.sesid, this.tableid, recpos);
            int actual = this.GetLongColumn();

            Assert.AreEqual(0, actual);
        }
Esempio n. 8
0
        public void ConvertRecposToNative()
        {
            var recpos = new JET_RECPOS();

            recpos.centriesLT    = 5;
            recpos.centriesTotal = 10;

            NATIVE_RECPOS native = recpos.GetNativeRecpos();

            Assert.AreEqual(5U, native.centriesLT);
            Assert.AreEqual(10U, native.centriesTotal);
        }
Esempio n. 9
0
        public void ConvertRecposFromNative()
        {
            var native = new NATIVE_RECPOS();

            native.centriesLT    = 1;
            native.centriesTotal = 2;

            var recpos = new JET_RECPOS();

            recpos.SetFromNativeRecpos(native);

            Assert.AreEqual(1, recpos.centriesLT);
            Assert.AreEqual(2, recpos.centriesTotal);
        }
Esempio n. 10
0
        // http://blogs.msdn.com/laurionb/archive/2009/02/10/cheaply-estimating-the-number-of-records-in-a-table.aspx
        // http://webcache.googleusercontent.com/search?q=cache:budnenpY5RUJ:blogs.msdn.com/b/laurionb/archive/2009/02/10/cheaply-estimating-the-number-of-records-in-a-table.aspx+http://blogs.msdn.com/laurionb/archive/2009/02/10/cheaply-estimating-the-number-of-records-in-a-table.aspx&hl=en&strip=1
        int iRecordsetFilter.EstimateRecordsCount()
        {
            Api.JetSetCurrentIndex(cur.idSession, cur.idTable, indName);
            Api.ResetIndexRange(cur.idSession, cur.idTable);

            const int cSamples = 16;

            long       cRecordsTotal = 0;
            JET_RECPOS recpos        = new JET_RECPOS();

            for (int i = 0; i < cSamples; i++)
            {
                recpos.centriesTotal = cSamples + 1;
                recpos.centriesLT    = i + 1;

                Api.JetGotoPosition(cur.idSession, cur.idTable, recpos);
                Api.JetGetRecordPosition(cur.idSession, cur.idTable, out recpos);
                cRecordsTotal += recpos.centriesTotal;
            }

            return((int)(cRecordsTotal / cSamples));
        }