connection = $connection; switch ($driver) { case 'pdo_mysql':{ $this->setSQLParser(new tao_install_utils_MysqlProceduresParser()); break; } case 'pdo_pgsql' : { $this->setSQLParser(new tao_install_utils_PostgresProceduresParser()); break; } case 'pdo_oci' : { $this->setSQLParser(new tao_install_utils_CustomProceduresParser()); break; } case 'pdo_sqlsrv' : { $this->setSQLParser(new tao_install_utils_CustomProceduresParser()); break; } default: { throw new tao_install_utils_SQLParsingException('Could not find Parser for driver ' . $driver); } } } /** * * @author Lionel Lecaque, lionel@taotesting.com * @return tao_install_utils_SimpleSQLParser */ private function getSQLParser() { return $this->sqlParser; } /** * * @author Lionel Lecaque, lionel@taotesting.com * @param tao_install_utils_SimpleSQLParser $sqlParser */ private function setSQLParser($sqlParser) { $this->sqlParser = $sqlParser; } /** * * @author Lionel Lecaque, lionel@taotesting.com * @param string $file */ public function load($file) { $parser = $this->getSQLParser(); $parser->setFile($file); $parser->parse(); foreach ($parser->getStatements() as $statement) { $this->connection->executeUpdate($statement); } } }