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 ***************************************************************************/
17 #include <Statement.h>
18 Statement
* StatementFactory::getStatement(ParsedData
*data
)
21 switch(data
->getStmtType())
24 stmt
= new InsStatement();
27 stmt
= new SelStatement();
30 stmt
= new UpdStatement();
33 stmt
= new DelStatement();
35 case CreateTableStatement
:
36 stmt
= new CreateTblStatement();
38 case DropTableStatement
:
39 stmt
= new DropTblStatement();
41 case CreateIndexStatement
:
42 stmt
= new CreateIdxStatement();
44 case DropIndexStatement
:
45 stmt
= new DropIdxStatement();
47 case CacheTableStatement
:
48 stmt
= new CacheTblStatement();
50 case CompactTableStatement
:
51 stmt
= new CompactTblStatement();
53 case CopyTableStatement
:
54 stmt
= new CopyTblStatement();
57 stmt
= new MetadataStatement();
60 stmt
= new UserTblStatement();
63 stmt
= new AlterTblStatement();
65 case TruncateStatement
:
66 stmt
= new TruncateTblStatement();
69 stmt
->setParsedData(data
);