Dbc::get() has no need to commit ?

m_pEvironment->txn_begin (NULL,&m_pTransaction,0);
     nRes=m_pDb->cursor (m_pTransaction,&m_pCursor,0);
     try
          Dbt dbKey;     
          Dbt dbData;               
          int nRes;
          dbKey.set_flags (DB_DBT_MALLOC);
          dbData.set_flags (DB_DBT_MALLOC);
          nRes=m_pCursor->get (&dbKey,&dbData,DB_NEXT);
          m_pTransaction->commit (0); // <---------exception catched ,jump to catch() block.
          // Dbc::get() is one of a access operation ,in theory it need a commitment.
     catch (DbException &dbe)
sorry to disturb you as I really have no information to refer to.

First, you need to close the cursor before commiting or aborting the transaction. Here is a sample used in the Berkeley DB Transaction Guide:
#include <stdio.h>
#include <stdlib.h>
#include "db.h"
int
main(void)
DBT key, data;
DBC *cursorp;
DB_TXN *txn = NULL;
int ret, c_ret;
char *replacementString = "new string";
/* environment and db handle creation omitted */
/* Get the txn handle */
txn = NULL;
ret = envp->txn_begin(envp, NULL, &txn, 0);
if (ret != 0) {
envp->err(envp, ret, "Transaction begin failed.");
goto err;
/* Get the cursor, supply the txn handle at that time */
ret = dbp->cursor(dbp, txn, &cursorp, 0);
if (ret != 0) {
envp->err(envp, ret, "Cursor open failed.");
txn->abort(txn);
goto err;
* Now use the cursor. Note that we do not supply any txn handles to these
* methods.
/* Prepare the DBTs */
memset(&key, 0, sizeof(DBT));
memset(&data, 0, sizeof(DBT));
while (cursor->c_get(&key, &data, DB_NEXT) == 0) {
data->data = (void *)replacementString;
data->size = (strlen(replacementString) + 1) * sizeof(char);
c_ret = cursor->c_put(cursor, &key, &data, DB_CURRENT);
if (c_ret != 0) {
/* abort the transaction and goto error */
envp->err(envp, ret, "Cursor put failed.");
cursorp->c_close(cursorp);
cursorp = NULL;
txn->abort(txn);
goto err;
* Commit the transaction. Note that the transaction handle
* can no longer be used.
ret = cursorp->c_close(cursorp);
if (ret != 0) {
envp->err(envp, ret, "Cursor close failed.");
txn->abort(txn);
goto err;
ret = txn->commit(txn, 0);
if (ret != 0) {
envp->err(envp, ret, "Transaction commit failed.");
goto err;
err:
/* Close the cursor (if the handle is not NULL)
* and perform whatever other cleanup is required */
/* Close the database */
/* Close the environment */
if (c_ret != 0)
ret = c_ret;
return (ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
Ron

Similar Messages

  • Can I exchange for a new laptop? Since December it has been having hardware issues and it has already needed to get parts changed twice already. My laptop is not working properly again. I feel like I have unfortunately gotten a lemon laptop.

    Can I exchange for a new laptop? Since December it has been having hardware issues and it has already needed to get parts changed twice already. My laptop is not working properly again. I feel like I have unfortunately gotten a lemon laptop.

    Apple will repair or replace at its discretions, parts found to be defective in materials or workmanship.
    You will have to discuss whether your history warrants a complete replacement with the folks at the Genius Bar.
    I do not speak for Apple, but it sounds to me like you have been unlucky, but not unlucky enough (or have spent so much time with your MacBook in the shop) to warrant a complete replacement.
    You have not provided any details of what the faults were or what was replaced. If they replaced the motherboard, you already got a new computer -- because everything except the drive and the display is on that board.

  • I put parental controls on my sons computer and now he is unable to get onto many needed sites.  I would like to change the restrictions but unfortunately I can not remember my passwords.  How can I find my passwords?

    I put parental controls on my sons mac book air and now he is unable to get onto many needed sites.  I would like to change the restrictions but unfortunately I can not remember my passwords.  How can I find my passwords?

    That is stealing. Your friend has no right/licence to give the songs to you. It violates copyright law.

  • Help needed ( serial comm on ipaq)

    hi all ,
    i am working on a project to do serail communication between ipaq and our elctronic module.
    ipaq is running pocket pc 2002, jeode vm
    ive got codewarrior pda edition ide ,
    my question is that in order to do serial comm what else do i need ( javax.comm etc or any other package )
    any suggestions on JNI etc,
    any help /direction is much appreciated.
    many thanks
    yahya

    suns javax.comm ist not for pdas, just for linux and win32.
    but you can try the javax.comm package from www.teilo.net.
    they say it runs on most pda-cpu's including pocket pc.
    they have docu too, but i didn't get it to run, since I use IBM Webshpere Device Developer. It don't seem to run with that.
    Tell me more if you get it woring...........
    thx,daniel

  • Can Dbc::get() with DB_NEXT for DB_RECNO db as fast as DB_BTREE db?

    My application stores all the user information in the data field and keeps an id for the record in the key field. In one scenario, the database is created as DB_BTREE, and in another, DB_RECNO is used. In both scenarios, the ids are 1-based and continuous, but in the DB_RECNO database, the rids can be changed.
    Now, I am implementing an operation. That is, given a set of ids, find relevant records in the database. The id set is provided in ascending order and is so large that scanning the whole database and checking the key is faster than retrieving the records directly by the key.
    The problem is like this. When using DB_BTREE, if I use Dbc::get() with DB_NEXT flag and check the key, the speed is two times faster than using Dbc::get() with DB_SET. I think this is because when searching with keys, BDB has to visit the internal nodes, which is not necessary if DB_NEXT is used. However, when using DB_RECNO, the speeds are almost the same for the two methods. Does this mean that for DB_RECNO databases, internal nodes have to be visited even to get the next record? Is there any method that can scan a DB_RECNO database as fast as scan a DB_BTREE database?

    Hello,
    I'm looking into this now.
    Thanks,
    Sandra

  • Most of App free for my Mac air appear to my in topic free but i have to paid to get it i need help ?

    most of App free for my Mac air appear to my in topic free but i have to paid to get it i need help ?

    The Apple apps that appear in the Free app section are not normally free and they are free only to people who qualify. To qualify you must have bought a new Mac since 1 OCT 2013. Or you must have the older version of these apps on your Mac when you upgrade to OS X Mavericks 10.9, after which you get the Mavericks versions for free.
    If you qualify for free apps the Buy button sats free. If the Buy button has a price, you do not qualify for these apps for free.

  • Need to Commit Execute Immediate???

    Hi,
    I'm just wondering if I need to commit execute immediate (oracle 10g and 9i)?
    I have an insert statement that I run exeute immediate in, does it commit automatically?
    Thanks for your help.

    the problem is, that in read committed isolation level (which is the default for Oracle) a query has to see data in the state that it was in, when the query startet (committed by other sessions plus eventually local changes by the own session up to the start system change number of the query, so DML is possible but no commits).
    If you try to fetch accross commits, that is: your query is still running but meanwhile you would change and commit data i.e by calling a function inside a query, you would be changing the system commit number. The query would have to keep track of which new SCNs where caused by the query and which SCNs possibly in between were not, further then the Delta would have to be calculated to see only the own changes (committed or not). That is not implemented in standard SQL databases.
    Nevertheless there are workarounds:
    either you are starting a transaction that is treated as if another session would do that (pragma autonomous transaction) or you access records using rowids you selected beforehand.

  • I saved a spreadsheet to iCloud now I can not access it.  The message I get say I need a newer version of Numbers but I already have it.  How do I get access to my document on iCloud?

    I saved a spreadsheet to iCloud now I can not access it.  The message I get says I need a newer version of Numbers but I already have it.  How do I get access to my document on iCloud?

    Please see this user tip:
    Need newer version of Numbers to open file

  • Down loaded new version of Pages. Now can't open a document and get message I need a newer version of Pages to open.  How can I get it to open

    I download the new Update for Pages (5.2.2)on September 8th. Now I can't open a document I created in 2012. I get message "You need a newer version of Pages to open this document"  What can I do to get this doc to  open

    First, open Finder, go to Applications folder and delete iWork '06. Then, open Pages and it will use the most recent version

  • How can I get rid of need to enter password to activate iPhone?

    How can I get rid of need to enter password to activate iPhone?

    Settings>General>Passcode Lock>Turn Passcode Off (you have to know what your passcode/password is to get into this setting, I'm assuming you do).

  • When I try to down load the software i get "this link needs to be opened with an application"

    help please
    when I try to down load the software i get "this link needs to be opened with an application"
    What kind of application do I need to choose?

    Lynda in woodstock this error occurs if the AAM Detect Plug-in is not loaded.  Please try using a different web browser or installing through the Creative Cloud Desktop application.  You can find more details at Install and update apps - https://helpx.adobe.com/creative-cloud/help/install-apps.html.

  • Read all the hype, but is Lion really worth getting unless you need to link up several devices???

    Read all the hype, but is Lion really worth getting unless you need to link up several devices??  e.g. is it worthwhile for a standalone iMac??

    There's a million places on the 'net where you can find opinons on that (have a look here, for example http://applehelpwriter.com/2011/08/01/os-x-lion-10-7-%E2%80%94-the-jurys-verdict / ) and at least several long running threads on this forum too dealing with various opinions.
    As for me, I've reverted to Snow Leopard.

  • When I click Sign, Adobe Reader XI v 11.0.4, my only option is Sign with Certificate, how do I also get the "I need to Sign" option that allow me to place a signature?

    When I click Sign, Adobe Reader XI v 11.0.4, my only option is Sign with Certificate, how do I also get the “I need to Sign” option that allow me to place a signature? I need screen shots to develop a customized training pamphlet.

    Hi,
    Please update the Reader to 11.0.07 and then check the options.
    Go to Help -> Check for updates.
    Regards,
    Anoop

  • This is frustrating - I have to re install my Creative suite 5 and the message I get says I need to validate eligibility etc because I purchased this edition while in school. This is a student teacher edition. I know longer have a school address since I g

    This is frustrating - I have to re install my Creative suite 5 and the message I get says I need to validate eligibility etc because I purchased this edition while in school. This is a student teacher edition. I know longer have a school address since I graduated 4 years ago. Can anyone help???
    Creative Cloud Download & Install

    I'm not clear what you are saying here. Since for S&T versions registration is mandatory, you have a permanent serial on your account and those function just liek any normal serial number of a comemrcial package.
    Mylenium

  • I am getting that I need Java SE 6 runtime to run a program.  Can't find that.

    I am getting that I need Java SE 6 runtime to run a program. Can't find that.

    Java for Mac OS X 10.6 Update 17

Maybe you are looking for