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 AbsSqlConnection
* SqlFactory::createConnection(SqlApiImplType implFlag
)
26 AbsSqlConnection
*conn
= NULL
;
30 conn
= new SqlConnection();
35 AbsSqlConnection
*sqlCon
= new SqlConnection();
36 conn
= new SqlLogConnection();
37 conn
->setInnerConnection(sqlCon
);
42 conn
= new SqlOdbcConnection();
43 conn
->setInnerConnection(NULL
);
48 AbsSqlConnection
*sqlCon
= new SqlConnection();
49 AbsSqlConnection
*sqllogconn
= new SqlLogConnection();
50 sqllogconn
->setInnerConnection(sqlCon
);
51 AbsSqlConnection
*adapterCon
= new SqlOdbcConnection();
52 SqlGwConnection
*gwconn
= new SqlGwConnection();
53 gwconn
->setInnerConnection(sqllogconn
);
54 gwconn
->setAdapter(adapterCon
);
64 AbsSqlStatement
* SqlFactory::createStatement(SqlApiImplType implFlag
)
66 AbsSqlStatement
*stmt
= NULL
;
70 stmt
= new SqlStatement();
75 AbsSqlStatement
*sqlStmt
= new SqlStatement();
76 stmt
= new SqlLogStatement();
77 stmt
->setInnerStatement(sqlStmt
);
82 stmt
= new SqlOdbcStatement();
83 stmt
->setInnerStatement(NULL
);
88 AbsSqlStatement
*sqlstmt
= new SqlStatement();
89 AbsSqlStatement
*sqllogstmt
= new SqlLogStatement();
90 sqllogstmt
->setInnerStatement(sqlstmt
);
91 AbsSqlStatement
*adapterstmt
= new SqlOdbcStatement();
92 SqlGwStatement
*gwstmt
= new SqlGwStatement();
93 gwstmt
->setInnerStatement(sqllogstmt
);
94 gwstmt
->setAdapter(adapterstmt
);