Iterate DB using DBcursor- get with DB_DBT_USERMEM flag set for DBT

Have BDB running in TDS mode. Want to iterate over a complete database using a DBcursor from start to end. Set the DB_DBT_USERMEM flag on the DBT structure with data pointing to a fixed sized user allocated memory block to hold the contents of a single record read. Currently cursor-get fails with DB_BUFFER_SMALL. I assume that this is because cursor->get retrieves more than one record.
Is it possible to iterate over the DB using the said cursor while allocating user-memory for only one (1) database record? Each call to cursor->get with DB_NEXT / DB_PREV / DB_FIRST /DB_LAST etc would update the single record entry.

Hi Kedar,
No, DBcursor->get() retrieves multiple key/data items if you're using the DB_MULTIPLE or DB_MULTIPLE_KEY flags. See "Bulk Retrieval":
[http://www.oracle.com/technology/documentation/berkeley-db/db/programmer_reference/am_misc_bulk.html#am_misc_bulk_get]
You only want to retrieve a single record per call, hence are not using the aforementioned flags. In this case the DB_BUFFER_SMALL error indicates that the length of the requested/retrieved item is larger than that specified for the DBT via its "ulen" field.
[http://www.oracle.com/technology/documentation/berkeley-db/db/api_reference/C/dbt.html#dbt_DB_DBT_USERMEM]
If you want to iterate over all the records in the database (including duplicates, if the database is configured to support them) you should use the DB_NEXT flag.
Note than when the DB_BUFFER_SMALL error is returned the "size" field of the DBT is set to the the length needed for the requested item; you can inspect that value to decide how to size your supplied buffer (or you may know in advance the size of the data items in the database).
Here is an excerpt from the example code in "Retrieving records with a cursor" with the necessary adjustments for the data DBT:
[http://www.oracle.com/technology/documentation/berkeley-db/db/programmer_reference/am_cursor.html#am_curget]
     DB *dbp;
     DBC *dbcp;
     DBT key, data;
     int close_db, close_dbc, ret;
     /* Acquire a cursor for the database. */
     if ((ret = dbp->cursor(dbp, NULL, &dbcp, 0)) != 0) {
          dbp->err(dbp, ret, "DB->cursor");
          goto err;
     close_dbc = 1;
     /* Initialize the key/data return pair. */
     memset(&key, 0, sizeof(key));
     memset(&data, 0, sizeof(data));
     /* Retrieve data item in user suplied buffer. */
#define BUFFER_LENGTH 1024
     if ((data.data = malloc(BUFFER_LENGTH)) == NULL)
          return (errno);
     data.ulen = BUFFER_LENGTH;
     data.flags = DB_DBT_USERMEM;
     /* You can supply your own buffer for the key as well. */
     /* Iterate through the database. */
     while ((ret = dbcp->c_get(dbcp, &key, &data, DB_NEXT)) == 0)
          /* Operate on the retrieved items. */
     if (ret != DB_NOTFOUND) {
          dbp->err(dbp, ret, "DBcursor->get");
          goto err;
err:
     // ...Regards,
Andrei

Similar Messages

  • How do I activate a used iPhone 3 with no SIM card for use as an ipod touch?

    How do I activate a used iPhone 3G with no SIM card for use like an iPod Touch? It was apparently on AT&T previously and I have another iPhone 3 that is active on AT&T if that is helpful. Thanks!

    Copied from the link provided.
    Follow these steps to use your iPhone without a wireless service plan:
    Insert the SIM card from your new, activated iPhone or one that was previously used to activate the original iPhone.
    Connect the iPhone to iTunes on a computer connected to the Internet.
    Once iTunes activates the device, you're free to use the iPhone as if it were an iPod touch.

  • HT1343 how to use the options with F10, F11, F11 for turning the sound up or down or mute?

    Hi, I'm Hannah. I'm using a Mac. Can you show me how to use the options with F10, F11, F12 for turning the sound up, or down or mute? Thank you very much

    Normally simply pressing them should do what you want, F10 to mute; F11 to decrease volume; F12 to increase volume. However, it's possible that you have a box ticked in Keyboard preferences which modifies the behaviour of the keys, requiring you to also hold down the Fn key (bottom left key on the keyboard) to enable the function.
    Check System Preferences>Keyboard to makes sure the box indicated in the image isn't ticked.

  • I am using two models with diffrent diffrent jcos for that. Is there any pr

    Hi,
    I am using two models with diffrent diffrent jcos for that. Is there any problem in that ?
    Regards,
    Gurprit Bhatia

    Hi,
    JCOs are made per system (R3).
    If your two models are calling two different R3 system then it is fine. But if both of your models are pointing to the same R3 system then you should have only one JCO.
    This will improve the performance as JCO connections are pooled in the application server and re-used.

  • Dirty flag set for readonly file page

    We are using BDB 4.8.26 transactional data store on Windows 2008 R2.
    DB is logging the message "dirty flag set for readonly file page" to the error log ... this entry was logged 17 times in a 24 hr period. The system processes about 3-5 requests a second.
    We also are having an incorrect "SECONDARY inconsistent with primary" error reported - this used to be very rare but has increased with increased concurrency. But the dirty flag error is recent - after we dropped a secondary and added a new one - there was no error during the secondary drop and rebuild process.
    Appreciate any help on this.
    Thanks
    Kimman Balakrishnan

    Hi Kimman,
    I assume you are not opening your databases with the DB_RDONLY flag. This could be cause by not running recovery after a system or application failure. Make sure you run recovery correctly, single threaded, after each system or application failure; review the Architecting Transactional Data Store applications documentation section.
    Regards,
    Andrei

  • Is there a way to automatically change tabs with different times set for each tab?

    I found a few add-ons that will automatically change tabs based on a configurable time. But all the tabs use the same time setting. What I need is the ability to have tabs displayed for different amounts of time. Ex, Tab 1 for 30 seconds, Tab 2 for 10 seconds, Tab 3 and 4 for 5 seconds. Ideally, I will have the ability to modify these settings as the amount of tabs and the content will change a couple times a week.
    Currently I'm using Tab Slideshow with each tab displayed for 15 seconds. But it sounds like Tab Rotate and Auto Toggle Tabs essentially do the same. If there is already a solution that would be great but if not is there someone available for hire to help modify one of the existing add-ons? Thank you in advance for your time.
    John

    Currently Firefox don't have any options like that.
    You can ask the Addon developers
    *http://addons.mozilla.org/

  • Using alternate rows with Spry Data Set

    Can anyone provide more information on how to implement alternate row colors with a Spry Data Set?  What I have done is:
    Create spry data set using HTML page as the data set
    The html page that displays the data set is:  <div spry:region="equipment">
    In the default.css page that is linked, I added the info in note #1 below
    When the page displays, no colors appear. Tried changing the colors and still no luck.  Is there another step to do?
    Note #1:
    within the default.css, the following are declared:
    #equipment odd {
    background-color: #CCC;
    #equipment even {
    background-color: “#F2F2F2;
    Note #2:
    Here is a link to see the actual pages referenced above.
    Any ideas? Getting frustrated!!  Thanks in advance for any advice.

    You are going to kick yourself, but, you haven't assigned any page element the ID #equipment. The region is called that but the table or the DIV does not have an idea and your selector matches nothing...

  • How to use a macro with AAA Authorization set?

    So!
    We have ACS version 4.1, and one goal is to start working on authorization sets for groups. I am able to get basic commands to work, but was curious about making a macro work without having to allow all of the commands that are actually contained wihtin the macro itself.
    I'm looking into this to promote standardization and minimize confiugration issues/inconsistencies on ports accross swtiches in our environment.
    The macro I created is used for configuring a port on a swtich to change its VLAN.  Basically as follows:
    macro name T2
    Description $DESC
    switchport mode access
    no cdp enable
    switchport access vlan $STATIC
    switchport port-security
    switchport port-security aging time 2
    switchport port-security violation restrict
    switchport port-security aging type inactivity
    storm-control broadcast level 25.00
    storm-control action trap
    switchport nonegotiate
    no lldp transmit
    no lldp receive
    #macro keywords $DESC $STATIC
    In ACS I've created a shell command authorization set, and allowed 'macro' with 'permit apply T2' and 'permit trace T2'.  This works fine and allows me to use those macro commands.  The problem I'm having is that every command in the macro is not allowed in the authorization set, so when I run the macro it fails for each command.
    I don't want to allow each individual command in the authorization set as it would then allow jr. admins the ability to make config changes on ports that would be outside of our standard.  For example they could get into a port and forget to disable CDP and LLDP, casuing inconsistencies accross the envrionment.  Is there a way to run these macros without putting all of the commands in the authorization set?

    Hello Eric,
    Please see the below link for configuring Macro and how you can use them with AAA
    http://www.cisco.com/en/US/docs/switches/lan/auto_smartports/12.2_55_se/configuration/guide/configure.html

  • Performance problems using WLS6.1 with the thin driver for Ora9i from OTN

    Hello everyone,
    Has anyone been experimenting with the thin driver for Oracle 9i under WLS6.1. I got it running, but
    I get extremely bad performance when having multiple concurrent accesses. It works more or less in
    single user mode. Also it seems not to support XA transactions?
    When could we expect the driver from BEA to be out?
    Thanks in advance!
    Samuel Kounev
    TU-Darmstadt, Germany

    I had done this from the very beginning, but I was still getting very bad performance under
    concurrent accesses. I even followed Sree's instructions and removed the old thin driver from
    weblogic.jar, but this didn't help. I am now trying to get the OCI driver for 9i running and hope
    this will solve the problem.
    Samuel
    Tamilselvan Ramasamy wrote:
    You have to use Oracle's Oracle 9i thin driver .
    put this driver infront of the classpath i.e before weblogic_sp.jar and
    weblogic.jar
    /selvan
    "Sree Bodapati" <[email protected]> wrote in message
    news:[email protected]..
    The BEA driver is available in WLS6.1SP2 which is GA.
    hth
    sree
    "Samuel Kounev" <[email protected]> wrote in message
    news:[email protected]..
    Hello everyone,
    Has anyone been experimenting with the thin driver for Oracle 9i under
    WLS6.1. I got it running, but
    I get extremely bad performance when having multiple concurrent accesses.
    It
    works more or less in
    single user mode. Also it seems not to support XA transactions?
    When could we expect the driver from BEA to be out?
    Thanks in advance!
    Samuel Kounev
    TU-Darmstadt, Germany

  • Using MobileMe calendar with MS Outlook Calendar for Mac

    For some reason my calendar items in MS Outlook 2011 for Mac aren't syncing with my MobileMe account.  When I use iCal, all calendar items are there.  But, when I just loaded MS Office Mac 2011 with Outlook, i set up my MobileMe account and it synced my email, notes, and contacts, but not my calendar items.
    What am I doing wrong?

    You also might get some suggestions posting in the Office for Mac Product Forums.

  • Getting Multiple Shipping Document sets for multiple deliveies

    Hi,
    I have a trip with multiple deliveries. After ship confirming the trip from a Trips tab, the reports in shipping document set printing multiple times one each for a delivery.
    How can I get the shipping document set to be submitted once per trip?
    Thank you,
    Prashanth

    Hi,
    For your requirement, here is a solution like this:
    1.Create 3 custom Document content types inherit the built-in Document content type;
    2.Create 3 custom Document Set content types inherit the built-in Document Set content type;
    3.In the “Document Set settings” page of each custom Document Set content type, remove the “Document” content type from the “Allowed Content Types”;
    4.Now we can create a Document Library and add the 3 custom Document Set content types into it.
    5.Remove the Document content from the “Content Types” in the “Document Library Settings” page.
    Here is how it works like in my environment:
    In "Document Library Settings" page:
    Best regards
    Patrick Liang
    TechNet Community Support

  • Getting message : The result set for this selection was empty on sm20

    Hi,
       I assigned below parameters in rz10 :
    rsau/user_selection                                 1
    rsau/max_diskspace/per_day                  1950M
    rsau/max_diskspace/per_file                 650M
    rsau/enable                                               1
       I activated security audit profile in sm19 also.But when iam going to sm20 for analysis of security audit log iam not getting report iam getting this message  :     The result set for this selection was empty.
    Gudie me for the same.
    Thanku

    Hi,
    The result set for this selection was empty.
    I think your configuration is OK except one thing...
    Check in SM19, if you have selected "Filter Active" check box in "Filter 1 and Filter 2" screen and Also "Audit Classess".
    Even though security audit is enabled in SM19, without selecting filter it will not log the events and give you the above message.
    Regards.
    Rajesh Narkhede

  • All my accounts with Apple are set for the US. However when I order an I book it charges me in £. How do I change this to US currency?

    All my accounts with Apple are set fot the US. However, when I attempt to order an iPhoto book it charges me in £ and charges VAT. The book is being sent to an address in the US and I am US citizen. How do I change the account to a US account?

    iPhoto Preferences -> Advanced -> Bottom of the panel: What Print Store is selected?

  • I am trying to use my shuffle with a logitech meant for an ipod.  It wont charge

    I need an adapter to use a ipod shuffle on a logitech speaker system which was designed for an original ipod.  Does anyone know where I CAN FIND ONE?.  what is the model of the adapter?

    We are starting from the beginning like its a new ipod starts out asking language, country,location services,choose a network,and when we get to "setup ipod touch  " there are 3 options 1..setup as new ipod, 2.restore from ipod backup 3 restore from itunes backup and when we hit setup as new ipod and click next it comes up with sign in with apple id or create a free apple id  we clicked create a free apple id....then comes up with bday,1st name last name, use your current email address, get a free icloud email address or change email address and THIS is where we have problems....if we hit change email address it means that sis's stuff goes under his name and moves all her stuff to this older ipod which the brother does not want. sorry this is so long but its the only way I knew to do it.

  • Can I use Apple TV with unlimited data plan for my IPad without any other internet connection?

    I Live in a weird area with no hardwired internet connection.
    My only internet connection is my iPad Air's UNLIMITED DATA plan from AT&T... It's LTE and it works great for my usual work.
    i Want to cancel stupid Direct TV acct and use Apple TV instead...
    IS it possible to subscribe a TV account online by using my ipad air's unlimited data plan and watch in on my TV via Apple TV without  using any other type of home network account?

    If you intend to use your iPads data plan then that will require use of the tethering/hot spot feature. As I said, you will not be able to use airplay, that needs a wifi LAN (home  network). This may change with IOS 8, but won't know for sure until the release.

Maybe you are looking for

  • MM Classification View

    Hi all, I want the good explanation about the MM Claasification view. I am new to the sap. I have to update the classification view. But In bapi_material_savedata, there is no provision for that. First i need to understand the classification and tabl

  • Use of C/C++ Codes in LabVIEW

    How to use C/C++ compiled program in LAbVIEW?

  • Adobe Acrobat 7.1.4 Pro Update - can't install

    How does one install this Acrobat Pro update to version 7.1.4 in WIndows.  It's an .msp file.  What the hell is that? http://www.adobe.com/support/downloads/detail.jsp?ftpID=4543

  • JTextPane/JEditPane  ‘opaque=true’ is NOT really works.

    Hi everyone! I’ve created a JTextPane editable area. Unfortunately, some border appears from top to bottom of the editable area which moves from the left to right when I enter some text. What is it? This border appears as separator between two colors

  • Pdf won't print in correct size

    I saved a PDF from an email attachment onto my computer.  It opens in Adobe in the correct size, but when I print, it is too long for the page.  I cannot seem to size it differently