1 /***************************************************************************
2 * Copyright (C) 2007 by Prabakaran Thirumalai *
3 * praba_tuty@yahoo.com *
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. *
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. *
15 ***************************************************************************/
16 #include <SqlFactory.h>
17 #include <SqlStatement.h>
18 #include <SqlConnection.h>
19 #include <SqlLogConnection.h>
20 #include <SqlLogStatement.h>
21 #include <SqlOdbcConnection.h>
22 #include <SqlOdbcStatement.h>
23 #include <SqlGwStatement.h>
24 #include <SqlNwConnection.h>
25 #include <SqlNwStatement.h>
27 AbsSqlConnection
* SqlFactory::createConnection(SqlApiImplType implFlag
)
29 AbsSqlConnection
*conn
= NULL
;
33 conn
= new SqlConnection();
38 AbsSqlConnection
*sqlCon
= new SqlConnection();
39 conn
= new SqlLogConnection();
40 conn
->setInnerConnection(sqlCon
);
45 conn
= new SqlOdbcConnection();
46 conn
->setInnerConnection(NULL
);
51 AbsSqlConnection
*sqlCon
= new SqlConnection();
52 AbsSqlConnection
*sqllogconn
= new SqlLogConnection();
53 sqllogconn
->setInnerConnection(sqlCon
);
54 AbsSqlConnection
*adapterCon
= new SqlOdbcConnection();
55 SqlGwConnection
*gwconn
= new SqlGwConnection();
56 gwconn
->setInnerConnection(sqllogconn
);
57 gwconn
->setAdapter(adapterCon
);
63 SqlNwConnection
*sqlNwCon
= new SqlNwConnection(CSqlNetwork
);
64 sqlNwCon
->setInnerConnection(NULL
);
68 case CSqlNetworkAdapter
:
70 SqlNwConnection
*sqlNwCon
= new SqlNwConnection(CSqlNetworkAdapter
);
71 sqlNwCon
->setInnerConnection(NULL
);
75 case CSqlNetworkGateway
:
77 SqlNwConnection
*sqlNwCon
= new SqlNwConnection(CSqlNetworkGateway
);
78 sqlNwCon
->setInnerConnection(NULL
);
89 AbsSqlStatement
* SqlFactory::createStatement(SqlApiImplType implFlag
)
91 AbsSqlStatement
*stmt
= NULL
;
95 stmt
= new SqlStatement();
100 AbsSqlStatement
*sqlStmt
= new SqlStatement();
101 stmt
= new SqlLogStatement();
102 stmt
->setInnerStatement(sqlStmt
);
107 stmt
= new SqlOdbcStatement();
108 stmt
->setInnerStatement(NULL
);
113 AbsSqlStatement
*sqlstmt
= new SqlStatement();
114 AbsSqlStatement
*sqllogstmt
= new SqlLogStatement();
115 sqllogstmt
->setInnerStatement(sqlstmt
);
116 AbsSqlStatement
*adapterstmt
= new SqlOdbcStatement();
117 SqlGwStatement
*gwstmt
= new SqlGwStatement();
118 gwstmt
->setInnerStatement(sqllogstmt
);
119 gwstmt
->setAdapter(adapterstmt
);
125 SqlNwStatement
*sqlNwStmt
= new SqlNwStatement();
126 sqlNwStmt
->setInnerStatement(NULL
);
130 case CSqlNetworkAdapter
:
132 SqlNwStatement
*sqlNwStmt
= new SqlNwStatement();
133 sqlNwStmt
->setInnerStatement(NULL
);
137 case CSqlNetworkGateway
:
139 SqlNwStatement
*sqlNwStmt
= new SqlNwStatement();
140 sqlNwStmt
->setInnerStatement(NULL
);