Bookmarks or similar with cursors

12 views
Skip to first unread message

Miguel Ángel Díez Bielsa

unread,
Jun 17, 2014, 3:59:47 AM6/17/14
to hamster...@googlegroups.com
Hi, Christoph,

We have got integrated your libraries in our product. It "smell" very good. 

In our application, when we navigate through the records, we need, sometimes, get a bookmark and, after, going to this bookmark.

Is there something similiar in hamsterdb API?.

Regards.


Christoph Rupp

unread,
Jun 17, 2014, 4:38:31 AM6/17/14
to hamster...@googlegroups.com
Hi Miguel,

glad that everything is working!

You can just create a cursor as a "bookmark". See ham_cursor_create, ham_cursor_find. The cursor will exist till it is closed (ham_cursor_close), and it will remain valid unless you delete the key under the cursor (in this case the cursor will point to 'nil').

If you need to access the cursor's key/record then use ham_cursor_move and set key and record pointers to NULL. This is described here: https://github.com/cruppstahl/hamsterdb/wiki/Working-with-Database-Cursors

Best regards
Christoph



--
You received this message because you are subscribed to the Google Groups "hamsterdb User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hamsterdb-use...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Miguel Ángel Díez Bielsa

unread,
Jun 17, 2014, 6:18:23 AM6/17/14
to hamster...@googlegroups.com
Hi, Christoph, 

ok. Now, we, in order to records navigation, use cursors. In the middle of navigation (with "next" command), we need jump to other necord of same cursor and ,after, come back.

At this moment, with our file system, we can take a bookmark or similar and save it. After, with it, come back.

I am thinking do it with hamster with key of record but, if key is duplicate,  I can´t to know what record is it.

Regards

Christoph Rupp

unread,
Jun 17, 2014, 6:36:43 AM6/17/14
to hamster...@googlegroups.com
Hi Miguel,

OK, i understand.

Suggestion for a workaround: you could store key AND record in the file system. When restoring the cursor, use ham_cursor_move() till you have reached exactly the stored key/record pair. This will only work if the key/record pairs are unique.

I can also add a new API for the next version (ham_cursor_get_duplicate_position()). You can then use ham_cursor_move in a loop to move the cursor to this position.

I hope i can release the next version in 4-6 weeks.

Does that sound ok?

Best regards
Christoph

Miguel Ángel Díez Bielsa

unread,
Jun 17, 2014, 6:58:43 AM6/17/14
to hamster...@googlegroups.com
Christoph, it sounds very, very, very good. 

I am impressed for your attention. You are great!

At this moment I am going to do bookmark thinking in no duplicate keys only. At next release  I will implement new API.

I´ll tell to you as it goes.

Thanks again.

Christoph Rupp

unread,
Jun 17, 2014, 7:00:13 AM6/17/14
to hamster...@googlegroups.com
OK, great :) I'll keep you posted about the next release.
Reply all
Reply to author
Forward
0 new messages