GetRecord() public méthode

Retrieves the Record of the current item
This method wraps the native ups_cursor_move function.
Returns the record of the current Database item. Throws UpsConst.UPS_CURSOR_IS_NIL if the Cursor does not point to any item.
/// /// /// if the Cursor does not point to any item /// ///
public GetRecord ( ) : byte[]
Résultat byte[]
Exemple #1
0
 private void Overwrite()
 {
     Cursor c = new Cursor(db);
     byte[] k = new byte[5];
     byte[] r1 = new byte[5]; r1[0] = 1;
     byte[] r2 = new byte[5]; r2[0] = 2;
     db.Insert(k, r1);
     c.MoveFirst();
     byte[] f = c.GetRecord();
     checkEqual(r1, f);
     c.Overwrite(r2);
     byte[] g = c.GetRecord();
     checkEqual(r2, g);
 }
Exemple #2
0
        private void InsertNegative()
        {
            Cursor c = new Cursor(db);
            byte[] q;
            byte[] k1 = new byte[5]; k1[0] = 5;
            byte[] r1 = new byte[5]; r1[0] = 1;
            byte[] r2 = new byte[5]; r2[0] = 2;
            c.Insert(k1, r1);
            q = c.GetRecord();
            checkEqual(r1, q);
            q = c.GetKey();
            checkEqual(k1, q);

            try {
                c.Insert(k1, r2);
            }
            catch (DatabaseException e) {
                Assert.AreEqual(UpsConst.UPS_DUPLICATE_KEY, e.ErrorCode);
            }
        }
Exemple #3
0
        private void InsertDuplicate()
        {
            Cursor c = new Cursor(db);
            byte[] q;
            byte[] k1 = new byte[5]; k1[0] = 5;
            byte[] r1 = new byte[5]; r1[0] = 1;
            byte[] r2 = new byte[5]; r2[0] = 2;
            c.Insert(k1, r1);
            q = c.GetRecord();
            checkEqual(r1, q);
            q = c.GetKey();
            checkEqual(k1, q);

            c.Insert(k1, r2, UpsConst.UPS_DUPLICATE);
            q = c.GetRecord();
            checkEqual(r2, q);
            q = c.GetKey();
            checkEqual(k1, q);
        }
Exemple #4
0
        private void Insert()
        {
            Cursor c = new Cursor(db);
            byte[] q;
            byte[] k1 = new byte[5]; k1[0] = 5;
            byte[] k2 = new byte[5]; k2[0] = 6;
            byte[] r1 = new byte[5]; r1[0] = 1;
            byte[] r2 = new byte[5]; r2[0] = 2;
            c.Insert(k1, r1);
            q = c.GetRecord();
            checkEqual(r1, q);
            q = c.GetKey();
            checkEqual(k1, q);

            c.Insert(k2, r2);
            q = c.GetRecord();
            checkEqual(r2, q);
            q = c.GetKey();
            checkEqual(k2, q);
        }
Exemple #5
0
 private void GetRecord()
 {
     Cursor c = new Cursor(db);
     byte[] k = new byte[5];
     byte[] r = new byte[5];
     db.Insert(k, r);
     c.MovePrevious();
     byte[] f = c.GetRecord();
     checkEqual(r, f);
 }
Exemple #6
0
 private void Find()
 {
     Cursor c = new Cursor(db);
     byte[] k1 = new byte[5]; k1[0] = 5;
     byte[] k2 = new byte[5]; k2[0] = 6;
     byte[] r1 = new byte[5]; r1[0] = 1;
     byte[] r2 = new byte[5]; r2[0] = 2;
     db.Insert(k1, r1);
     db.Insert(k2, r2);
     c.Find(k1);
     byte[] f = c.GetRecord();
     checkEqual(r1, f);
     c.Find(k2);
     byte[] g = c.GetRecord();
     checkEqual(r2, g);
 }