in Education by
I have a multi-threaded program whereas each thread, at the start of execution, acquires a single connection from a MySql connection pool class. The thread then uses a number of database table wrapper classes to do its business logic by passing its database connection to the wrapper classes. The operations on these wrapper classes are not necessarily sequential and I want these wrapper classes to be able to commit or rollback changes on its database table independent of each other using the single database connection. I'm aware that MySql does not allow nested transactions and have not figure out a way to accomplish this. Any help is greatly appreciated. Thanks! JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
Sounds like you have to associate the transactions with the table wrappers better than just on a thread by thread basis. IOW, you need to create a transaction class. The transaction class acquires/releases connections from/to the connection pool as the transaction opens and closes. The transaction then become the factory for your table wrappers. Any table wrapper created by the transaction is inside the transaction since it has no access to any connection but the one the transaction is on. The annoying part of this is keeping all the objects from accessing dead objects. Some form of SmartPtr will be needed to handle what happens when the transaction commits but something tries to use the table wrapper again.

Related questions

0 votes
    I have a multi-threaded program whereas each thread, at the start of execution, acquires a single connection ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 7, 2022 in Education by JackTerrance
0 votes
    I have a multi-threaded program whereas each thread, at the start of execution, acquires a single connection ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 5, 2022 in Education by JackTerrance
0 votes
    I have a multi-threaded program whereas each thread, at the start of execution, acquires a single connection ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 5, 2022 in Education by JackTerrance
0 votes
    I have a multi-threaded program whereas each thread, at the start of execution, acquires a single connection ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 5, 2022 in Education by JackTerrance
0 votes
    I have a multi-threaded program whereas each thread, at the start of execution, acquires a single connection ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 5, 2022 in Education by JackTerrance
0 votes
    How would I iterate through these 5 array in a function call? Right now I am just manually iterating through each to form a ... gram address location unsigned char i; for( i= 0; i...
asked Apr 21, 2022 in Education by JackTerrance
0 votes
    I can not seem to be able to read from config file multitoken options like I can from command line ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 13, 2022 in Education by JackTerrance
0 votes
    Which of the following is used to plot multiple histograms? (a) multi.plot() (b) multi.hist (c) xyplot ... Regression of R Programming Select the correct answer from above options...
asked Feb 10, 2022 in Education by JackTerrance
0 votes
    I was working on a new project which has the requirement to use 7 databases, arguing that performance, ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 2, 2022 in Education by JackTerrance
0 votes
    During a long compilation with Visual Studio 2005 (version 8.0.50727.762), I sometimes get the following ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 17, 2022 in Education by JackTerrance
0 votes
    During a long compilation with Visual Studio 2005 (version 8.0.50727.762), I sometimes get the following ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 16, 2022 in Education by JackTerrance
0 votes
    What's the standard way of updating a QTableView when its database (MySQL) was changed (outside of the ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 26, 2022 in Education by JackTerrance
0 votes
    i am working on a MVC project in java. For my operation I use database many times. many times my ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 7, 2022 in Education by JackTerrance
0 votes
    The transactions that span across multiple services are handled by ___________. A. DML commands B. Pre-compiled queries C. Logging queries in DBs D. Event driven Architecture...
asked Jan 10, 2023 in Education by JackTerrance
0 votes
    The transactions that span across multiple services are handled by (a)logging queries in DBs (b)DML commands (c)Event driven Architecture (d)pre-compiled queries...
asked Oct 21, 2020 in Technology by Editorial Staff
...