dbTalk Databases Forums  

DBT data field and DB_DBT_USERMEM flag

comp.databases.berkeley-db comp.databases.berkeley-db


Discuss DBT data field and DB_DBT_USERMEM flag in the comp.databases.berkeley-db forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
oleksandr kalinin
 
Posts: n/a

Default DBT data field and DB_DBT_USERMEM flag - 01-08-2008 , 10:59 AM






Hello,

I am using free-threaded BerkeleyDB handles in conjunction with
DB_DBT_USERMEM flag. My application currently relies on DBT->data
remaining unchanged in the get() call, since own buffer is specified.
Is such assumption correct?

From documentation on DBT structure:

"By default, the flags structure element is expected to be set to 0.
In this default case, when the application is providing Berkeley DB a
key or data item to store into the database, Berkeley DB expects the
data structure element to point to a byte string of size bytes. When
returning a key/data item to the application, Berkeley DB will store
into the data structure element a pointer to a byte string of size
bytes, and the memory to which the pointer refers will be allocated
and managed by Berkeley DB."

Looking at BerkeleyDB code, I can see that no internal memory
allocation seems to be done in case DB_DBT_USERMEM is specified, and
thus I assume that DBT->data remains unchanged. But I just would like
to crosscheck if I am missing something. Reading documentation, it is
not really clear whether application may rely on DBT->data remaining
unchanged in get() call even when DB_DBT_USERMEM flag is specified,
rather not?

Thanks for your comments.

Regards,
Alex

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.