Close() public méthode

Closes the Cursor
This method wraps the native ups_cursor_close function.
Closes this Cursor and frees allocated memory. All Cursors should be closed before closing the Database.
public Close ( ) : void
Résultat void
Exemple #1
0
 private void Create()
 {
     Cursor c = new Cursor(db);
     c.Close();
 }
Exemple #2
0
 private void AutoCleanupCursors3()
 {
     Upscaledb.Environment env = new Upscaledb.Environment();
     Database db = new Database();
     env.Create("ntest.db");
     db = env.CreateDatabase(1);
     Cursor cursor1 = new Cursor(db);
     Cursor cursor2 = new Cursor(db);
     Cursor cursor3 = new Cursor(db);
     Cursor cursor4 = new Cursor(db);
     Cursor cursor5 = new Cursor(db);
     cursor3.Close();
     cursor5.Close();
     // let gc do the cleanup
     env.Close();
 }
Exemple #3
0
        private void Cursor10000Test()
        {
            //create database
            Upscaledb.Environment env = new Upscaledb.Environment();
            env.Create("ntest.db");

            Parameter[] param = new Parameter[1];
            param[0] = new Parameter();
            param[0].name = UpsConst.UPS_PARAM_KEY_TYPE;
            param[0].value = UpsConst.UPS_TYPE_UINT64;
            Database db = env.CreateDatabase(1, 0, param);

            //insert records
            for (ulong i = 0; i < 10000; i++)
            {
                byte[] key = BitConverter.GetBytes(i);
                byte[] record = new byte[20];
                db.Insert(key, record);
            }

            //close database
            db.Close();

            //reopen again
            db = env.OpenDatabase(1);
            Cursor cursor = new Cursor(db);

            cursor.MoveFirst();
            ulong firstKey = BitConverter.ToUInt64(cursor.GetKey(), 0);
            Assert.AreEqual((ulong)0, firstKey);

            cursor.MoveLast();
            ulong lastKey = BitConverter.ToUInt64(cursor.GetKey(), 0);
            Assert.AreEqual((ulong)9999, lastKey);

            //close database
            cursor.Close();
            db.Close();
            env.Close();
        }
 private void CursorTest()
 {
     Transaction t = env.Begin();
     Cursor c = new Cursor(db, t);
     byte[] k = new byte[5];
     byte[] r = new byte[5];
     c.Insert(k, r);
     db.Find(t, k);
     c.Close();
     t.Commit();
     db.Find(k);
 }