c++ - How to use transactions in Informix CSDK and OIC++ -


i'd need advice how handle transactions informix csdk , oic++.

conn open connection object. select works find. database here setup logging — found out while update stmt on own nothing.

here's tried:

        conn.settransaction( itconnection::begin );         qtext = "update transit_kunde_s set erledigt='y' transitkunde='"+ts+"'";         cout << qtext << endl;          code = query_up.execforstatus(qtext.c_str());         cout << "code " << code << endl;         conn.settransaction( itconnection::commit ); 

okay once again answer myself...

from informix c++ docnotes

operations can performed on large objects within fetched row though connection still checked out (locked). connection checked out after itquery::execforiteration() method returns multiple rows in result set. remains checked out until either last row in result set has been fetched itquery::nextrow() or query processing has been terminated calling itquery::finish(). while connection checked out, no other query can executed on connection.

so in while loop of 1 query result iteration need update query new connection

// have 2 connection objects: conn, conn2  itquery query(conn); itquery query_up(conn2);  string qtext; qtext = "select * transit_kunde_s erledigt='n' order transitkunde"; okay = query.execforiteration(qtext.c_str());  while (row = query.nextrow()) {   // stuff    // want query? --> need connection!!   ok_ta = conn2.settransaction( itconnection::begin);   qtext = "update transit_kunde_s set erledigt='y' transitkunde='"+ts+"'";   code = query_up.execforstatus(qtext.c_str());   ok_ta = conn2.settransaction( itconnection::commit );   }  // see later 1st query finished here query.finish(); 

Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -