1912116 remove getMaxTrans and getMaxThreads from Config
[csql.git] / include / AbsSqlConnection.h
blob5b90497046e8aac2721f37fa84b7676beb308b99
1 /***************************************************************************
2 * Copyright (C) 2007 by Prabakaran Thirumalai *
3 * praba_tuty@yahoo.com *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
20 #ifndef ABSSQLCONNECTION_H
21 #define ABSSQLCONNECTION_H
22 #include<CSql.h>
24 /**
25 * @class AbsSqlConnection
27 * \brief{ Represents a database connection to sql engine.}
29 * It represents the database connection to the sql engine.\n
30 * All database operations shall be done within the context of the connection.\n
31 * Application should first create object of this class to accessing the database\n
32 * through SQL Engine.
33 * Each connection has only one active transaction at any given point of time, all \n
34 * operations which happen using this connection object will be done as part of that \n
35 * transaction.\n
36 * \n
37 * Note: \n
38 * SERIALIZABLE isolation level is not supported. \n
40 class AbsSqlConnection
42 protected:
43 AbsSqlConnection *innerConn;
44 public:
45 void setInnerConnection(AbsSqlConnection *conn) { innerConn = conn; }
46 AbsSqlConnection* getInnerConnection() { return innerConn; }
47 virtual Connection& getConnObject() =0;
49 /** opens connection to the sql engine
50 * @param user username for authentication
51 * @param pass password for authentication
52 * @return DbRetVal
54 virtual DbRetVal connect (char *user, char * pass) =0;
56 /** closes connection to the sql engine and releases all the resources
57 * @return DbRetVal
59 virtual DbRetVal disconnect () = 0;
61 /** Commits active transaction. \n
62 * It makes all the changes made in the current transaction permanent and \n
63 * it also releases the locks held by the current transaction.\n
64 * After a transaction commits, application is required to start another \n
65 * transaction for further database operations.\n
66 * @return DbRetVal
68 virtual DbRetVal commit() = 0;
70 /** Aborts the active transaction.\n
71 * undo all the changes made in the current transaction and it also \n
72 * releases the locks held by the current transaction.\n
73 * After a transaction rollback, application is required to start another \n
74 * transaction for further database operations.\n
75 * @return DbRetVal
77 virtual DbRetVal rollback() = 0;
79 /** Starts a new transaction.\n
80 * The previous transaction should be either committed or rollback \n
81 * before beginTrans is called. \n
82 * Applications are required to start transaction before they attempt any \n
83 * database operation.\n
84 * @param isoLevel isolation level. Default is read committed.
85 * @return DbRetVal
87 virtual DbRetVal beginTrans (IsolationLevel isoLevel = READ_COMMITTED) = 0;
88 virtual ~AbsSqlConnection(){}
92 #endif