windows changes
[csql.git] / src / sql / StatementFactory.cxx
bloba9f11dfe9cb977433f52b4c035d908418440e08c
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 ***************************************************************************/
16 #include <os.h>
17 #include <Statement.h>
18 Statement* StatementFactory::getStatement(ParsedData *data)
20 Statement *stmt;
21 switch(data->getStmtType())
23 case InsertStatement:
24 stmt = new InsStatement();
25 break;
26 case SelectStatement:
27 stmt = new SelStatement();
28 break;
29 case UpdateStatement:
30 stmt = new UpdStatement();
31 break;
32 case DeleteStatement:
33 stmt = new DelStatement();
34 break;
35 case CreateTableStatement:
36 stmt = new CreateTblStatement();
37 break;
38 case DropTableStatement:
39 stmt = new DropTblStatement();
40 break;
41 case CreateIndexStatement:
42 stmt = new CreateIdxStatement();
43 break;
44 case DropIndexStatement:
45 stmt = new DropIdxStatement();
46 break;
47 case CacheTableStatement:
48 stmt = new CacheTblStatement();
49 break;
50 case CompactTableStatement:
51 stmt = new CompactTblStatement();
52 break;
53 case CopyTableStatement:
54 stmt = new CopyTblStatement();
55 break;
56 case MetaStatement:
57 stmt = new MetadataStatement();
58 break;
59 case UserStatement:
60 stmt = new UserTblStatement();
61 break;
62 case AlterStatement:
63 stmt = new AlterTblStatement();
64 break;
65 case TruncateStatement:
66 stmt = new TruncateTblStatement();
67 break;
69 stmt->setParsedData(data);
70 return stmt;