00001 /*************************************************************************** 00002 * Copyright (C) 2007 by Prabakaran Thirumalai * 00003 * praba_tuty@yahoo.com * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 * * 00010 * This program is distributed in the hope that it will be useful, * 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00013 * GNU General Public License for more details. * 00014 * * 00015 ***************************************************************************/ 00016 #include "Statement.h" 00017 Statement* StatementFactory::getStatement(ParsedData *data) 00018 { 00019 Statement *stmt; 00020 switch(data->getStmtType()) 00021 { 00022 case InsertStatement: 00023 stmt = new InsStatement(); 00024 break; 00025 case SelectStatement: 00026 stmt = new SelStatement(); 00027 break; 00028 case UpdateStatement: 00029 stmt = new UpdStatement(); 00030 break; 00031 case DeleteStatement: 00032 stmt = new DelStatement(); 00033 break; 00034 case CreateTableStatement: 00035 stmt = new CreateTblStatement(); 00036 break; 00037 case DropTableStatement: 00038 stmt = new DropTblStatement(); 00039 break; 00040 case CreateIndexStatement: 00041 stmt = new CreateIdxStatement(); 00042 break; 00043 case DropIndexStatement: 00044 stmt = new DropIdxStatement(); 00045 break; 00046 } 00047 stmt->setParsedData(data); 00048 return stmt; 00049 }