SqlFactory Class Reference

Factory class to create appropriate implementation of SQL API. More...

#include <SqlFactory.h>


Static Public Member Functions

static AbsSqlConnectioncreateConnection (SqlApiImplType implFlag)
 creates appropriate implementation of AbsSqlConnection based on implFlag passed
static AbsSqlStatementcreateStatement (SqlApiImplType implFlag)
 creates appropriate implementation of AbsSqlStatement based on implFlag passed


Detailed Description

Factory class to create appropriate implementation of SQL API.

Author:
Prabakaran Thirumalai

Definition at line 40 of file SqlFactory.h.


Member Function Documentation

AbsSqlConnection * SqlFactory::createConnection ( SqlApiImplType  implFlag  )  [static]

creates appropriate implementation of AbsSqlConnection based on implFlag passed

Parameters:
implFlag 1->SqlConnection, 2->?
Returns:
AbsSqlConnection

Definition at line 24 of file SqlFactory.cxx.

References conn, CSql, CSqlAdapter, CSqlGateway, CSqlLog, SqlGwConnection::setAdapter(), and AbsSqlConnection::setInnerConnection().

Referenced by Java_csql_jdbc_JSqlConnection_alloc(), main(), CSqlOdbcDbc::SQLConnect(), verifyCount(), and verifyPrimKeyFldVal().

00025 {
00026     AbsSqlConnection *conn = NULL ;
00027     switch(implFlag)
00028     {
00029         case CSql:
00030             conn = new SqlConnection();
00031             break;
00032         case CSqlLog:
00033             {
00034             //generates sql logs
00035             AbsSqlConnection *sqlCon = new SqlConnection();
00036             conn = new SqlLogConnection();
00037             conn->setInnerConnection(sqlCon);
00038             break;
00039             }
00040         case CSqlAdapter:
00041             {
00042             conn = new SqlOdbcConnection();
00043             conn->setInnerConnection(NULL);
00044             break;
00045             }
00046         case CSqlGateway:
00047             {
00048             AbsSqlConnection *sqlCon = new SqlConnection();
00049             AbsSqlConnection *sqllogconn = new SqlLogConnection();
00050             sqllogconn->setInnerConnection(sqlCon);
00051             AbsSqlConnection *adapterCon = new SqlOdbcConnection();
00052             SqlGwConnection *gwconn = new SqlGwConnection();
00053             gwconn->setInnerConnection(sqllogconn);
00054             gwconn->setAdapter(adapterCon);
00055             conn = gwconn;
00056             break;
00057             }
00058         default:
00059             printf("Todo");
00060             break;
00061     }
00062     return conn;
00063 }

Here is the call graph for this function:

Here is the caller graph for this function:

AbsSqlStatement * SqlFactory::createStatement ( SqlApiImplType  implFlag  )  [static]

creates appropriate implementation of AbsSqlStatement based on implFlag passed

Parameters:
implFlag 1->SqlConnection, 2->?
Returns:
AbsSqlStatement

Definition at line 64 of file SqlFactory.cxx.

References CSql, CSqlAdapter, CSqlGateway, CSqlLog, SqlGwStatement::setAdapter(), AbsSqlStatement::setInnerStatement(), and stmt.

Referenced by getRecordsFromTargetDb(), insert(), Java_csql_jdbc_JSqlStatement_alloc(), main(), SqlNetworkHandler::processPrepare(), remove(), CSqlOdbcStmt::SQLPrepare(), verifyCount(), and verifyPrimKeyFldVal().

00065 {
00066     AbsSqlStatement *stmt = NULL;
00067     switch(implFlag)
00068     {
00069         case CSql:
00070             stmt = new SqlStatement();
00071             break;
00072         case CSqlLog:
00073             {
00074             //generates sql logs
00075             AbsSqlStatement *sqlStmt = new SqlStatement();
00076             stmt = new SqlLogStatement();
00077             stmt->setInnerStatement(sqlStmt);
00078             break;
00079             }
00080         case CSqlAdapter:
00081             {
00082             stmt = new SqlOdbcStatement();
00083             stmt->setInnerStatement(NULL);
00084             break;
00085             }
00086         case CSqlGateway:
00087             {
00088             AbsSqlStatement *sqlstmt = new SqlStatement();
00089             AbsSqlStatement *sqllogstmt = new SqlLogStatement();
00090             sqllogstmt->setInnerStatement(sqlstmt);
00091             AbsSqlStatement *adapterstmt = new SqlOdbcStatement();
00092             SqlGwStatement *gwstmt = new SqlGwStatement();
00093             gwstmt->setInnerStatement(sqllogstmt);
00094             gwstmt->setAdapter(adapterstmt);
00095             stmt = gwstmt;
00096             break;
00097             }
00098         default:
00099             printf("Todo");
00100             break;
00101     }
00102     return stmt;
00103 }

Here is the call graph for this function:

Here is the caller graph for this function:


The documentation for this class was generated from the following files:
Generated on Mon Jun 9 22:51:17 2008 for csql by  doxygen 1.4.7