Object oriented database interface encapsulation that allows for chronologically overlapping transactions in a multi-threaded environment
First Claim
1. A method, comprising:
- encapsulating one or more interactions between a database application and a database to allow for one or more chronologically overlapping transactions using a single database connection in a threaded environment, further comprising;
launching the database application;
creating and initializing one or more entities for communicating information between the database application and the database;
opening one or more logical connections to the database;
the database application requesting database access;
using the one or more created and initialized entities for creating, sending and receiving one or more database queries between the database application and the database;
a specialized entity of the one or more created and initialized entities employing a mapping of one or more database application threads to one or more literal connections to the database, wherein the number M of the one or more literal connections to the database can be less than the number N of the one or more threads in the database application; and
using the one or more created and initialized entities concurrently so that one or more database transactions may be transmitted in a chronologically overlapping fashion between the database application and the database.
3 Assignments
0 Petitions
Accused Products
Abstract
A method for allowing chronologically overlapping database transactions in a multi-threaded environment without the need for explicit thread synchronization for database access. Literal database connections are managed on a per thread basis, thus allowing different chronologically overlapping transactions in different threads. Four basic objects are used to accomplish the chronologically overlapping transactions in a multi-threaded environment. The environment object is a static object that creates and maintains a pointer to the database application environment handle in addition to performing basic error recovery and initialization functionality. The database object encapsulates a logical database connection. The database connection object contains the functions that can be performed on a database connection, such as transaction management and query creation. The database statement object encapsulates a query that can be made to the database. This database statement object allows parameters to be attached to the query, and result objects to be returned.
-
Citations
21 Claims
-
1. A method, comprising:
-
encapsulating one or more interactions between a database application and a database to allow for one or more chronologically overlapping transactions using a single database connection in a threaded environment, further comprising;
launching the database application;
creating and initializing one or more entities for communicating information between the database application and the database;
opening one or more logical connections to the database;
the database application requesting database access;
using the one or more created and initialized entities for creating, sending and receiving one or more database queries between the database application and the database;
a specialized entity of the one or more created and initialized entities employing a mapping of one or more database application threads to one or more literal connections to the database, wherein the number M of the one or more literal connections to the database can be less than the number N of the one or more threads in the database application; and
using the one or more created and initialized entities concurrently so that one or more database transactions may be transmitted in a chronologically overlapping fashion between the database application and the database. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17)
one or more environment objects;
one or more database objects;
one or more database connection objects; and
one or more database query objects.
-
-
4. The method of claim 3, wherein each of the one or more literal connections to the database are established using the one or more database connection objects.
-
5. The method of claim 3, wherein the one or more database connection objects are be used as proxies to the one or more literal connections to the database, said one or more database connection objects coupled to said one or more literal connections to the database in a one-to-one correspondence.
-
6. The method of claim 5, wherein one of the one or more database objects is responsible for the selection and establishment of one database connection object of the one or more database connection objects to couple to a literal connection of the one or more literal connections to the database, said database object assigning a task contained in a thread to the database connection object.
-
7. The method of claim 3, wherein for a multiple-threaded application, each new database access creates a new database connection object.
-
8. The method of claim 3, wherein each of the one or more environment objects further comprises:
-
opening a database;
committing all transactions;
rolling back all transactions;
exiting a callback; and
creating an instance of a database object of the one or more database objects.
-
-
9. The method of claim 3, wherein each database object of the one or more database objects further comprises:
-
opening a connection to the database;
beginning a transaction;
rolling back a transaction;
committing a transaction; and
creating one database query object of the one or more database query objects.
-
-
10. The method of claim 3, wherein each created and initialized database connection object of the one or more created and initialized database connection objects further comprises:
-
accessing an environment object;
accessing a database object;
accessing a database connection object;
beginning a transaction using a current connection;
rolling back a transaction using the current connection; and
committing a transaction using the current connection.
-
-
11. The method of claim 3, wherein each database query object of the one or more database query objects further comprises:
-
accessing one environment object of the one or more environment objects;
accessing one database query object of the one or more database query objects;
binding a database query statement; and
binding one or more parameters in a database query statement.
-
-
12. The method of claim 3, wherein the database application is a single-threaded database application and the method further comprises:
-
the one or more database connection objects consisting of a single default database connection object;
creating and initializing one of the one or more database query objects;
using the one database query object to exchange information with the database; and
using the default database connection object for further database queries.
-
-
13. The method of claim 3, wherein the database application is a multi-threaded database application with no transactions and the method further comprises:
-
initializing a counter for the connection to the database;
creating and initializing one of the one or more of the database query objects;
incrementing the counter for the database connection;
using the one database query object to exchange information with the database;
deleting the one database query object when the exchange of information with the database is complete;
deleting the one database connection object when the exchange of information with the database is complete; and
using a new database connection object of the one or more database connection objects for further database queries.
-
-
14. The method of claim 3, wherein the database application is a multi-threaded database application with transactions and the method further comprises:
-
initializing a counter for the connection to the database;
beginning a transaction with the database;
incrementing the counter for the database connection;
creating and initializing one of the one or more database query objects;
using the one created and initialized database query object to exchange information with the database;
deleting the one database query object when the exchange of information with the database is complete;
ending the transaction with the database;
deleting the one database connection object when the exchange of information with the database is complete; and
using a new database connection object of the one or more database connection objects for one or more additional database queries.
-
-
15. The method of claim 3, wherein the method of operation for a single-threaded application further comprises:
-
the application sending a request to open the database;
an environment object of the one or more environment objects receiving the request and creating a new database object of the one or more database objects;
the created database object creating a database connection object of the one or more database connection objects;
the application sending a request for a database query;
the created database object receiving this request and sending a create query object request to the database connection object;
the database connection object creating a new database query object of the one or more database query objects;
the database query object receiving the database query statement and parameters and assembling the database query statement;
the database query object executing the database query statement after receiving a message from the database application;
upon receiving a release message from the database application, the database query object sending a release statement to the database connection object;
the database application sending a message to the database object, the database object sending a message to the database connection object; and
upon receipt of this second release message, the database connection object releasing resources associated with the current database query.
-
-
16. The method of claim 3, wherein the method of operation for a multi-threaded application having no transactions comprises:
-
a. the application sending a request to open the database;
b. the application sending a request to create a new database query statement of one or more database query statements;
c. a database object of the one or more database objects receiving this request and creating a new database connection object of the one or more database connection objects;
d. the database object then sending a message to the database connection object to create the new database query statement of one or more database query statements;
e. the database connection object sending a message to the database query object of the one or more database query objects to create the database query statement;
f. the application then sending a message, receivable by the database query object, binding and executing the database query statement;
g. the application sending a release message;
h. upon receiving a release message from the database application, the database query object sending a release message to the database connection object;
i. the database connection object, upon receiving the release message from the database query object, sending a release message to the database object;
j. the application then sending a release message to the database object, which enables the release of resources associated with the current database query; and
k. the application performing steps b through h for each of the one or more database query statements.
-
-
17. The method of claim 3, wherein the method of operation for a multi-threaded application using transactions comprises:
-
a. the application sending a request to open the database;
b. the application sending a begin transaction message to a database object of the one or more database objects;
c. the database object receiving this request and creating a new database connection object of the one or more database connection objects;
d. the application sending a request to create a new database query statement of one or more database query statements;
e. the database object receiving this message and then sending a message to the database connection object, creating the new database query statement of the one or more database query statements;
f. the database connection object sending a message to the database query object to create the database query statement;
g. the application then sending a message, receivable by the database query object, binding and executing the database query statement;
h. the application sending a release message;
i. upon receiving a release message from the database application, the database query object sending a release statement to the database connection object;
j. the application sending an end transaction message, which is received by the database object;
k. the database object, upon receiving the end transaction message, sending a release message to the database connection object;
l. the application then sending a release message to the database object, enabling the release of resources associated with the current database query;
m. the application performing steps b through i one or more times for each of one or more application tasks; and
n. the application performing steps d through h one or more times for each transaction of one or more transactions.
-
-
18. A structure, comprising:
-
one or more interactions encapsulated between a database application and a database to allow for chronologically overlapping transactions using a single database connection in a threaded environment, further comprising;
a connection management layer residing below an application layer and above a database interface layer, said database interface layer coupled to the database;
one or more threads K connecting the application layer to the connection management layer;
one or more tasks N contained in the one or more threads K;
one or more connections M between the connection management layer and the database interface layer; and
one or more literal connections K between the database interface layer and the database so that one or more database transactions may be transmitted in a chronologically overlapping fashion between the database application and the database. - View Dependent Claims (19, 20, 21)
one or more environment entities;
one or more database entities;
one or more database connection entities; and
one or more database query entities.
-
-
20. The structure of claim 18, wherein the number of one or more tasks N is greater than or equal to the number of one or more connections M between the connection management layer and the database interface layer.
-
21. The structure of claim 18, wherein the number of one or more connections M between the connection management layer and the database interface layer is the same as the number of one or more connections between the database interface layer and the database.
Specification