Source for file PMO_MyParser.php
Documentation is available at PMO_MyParser.php
* This file contains the PMO_MyMapObject class which implements
* the generic PMO_Object that represents a tuple in database.
* This file is part of the PhpMyObject project.
* For questions, help, comments, discussion, etc., please join our
* forum at {@link http://www.developpez.net/forums/forumdisplay.php?f=770}
* or our mailing list at {@link http://groups.google.com/group/pmo-dev}.
* PhpMyObject is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* @author Nicolas Boiteux <nicolas_boiteux@yahoo.fr>
* @link http://pmo.developpez.com/
* @since PhpMyObject v0.1x
* @copyright Copyright (C) 2007-2008 Nicolas Boiteux
* @license GPLv3 {@link http://www.gnu.org/licenses/gpl}
/** requires the interface */
require_once(dirname(__FILE__ ). '/PMO_Parser.php');
* This class is used to parse SQL query and extract
* the tablename and the fields used
* extract the name of the tables and fields
* from an SQL query and put them
* into fields & tables variables
$str = str_replace(array(';', '\r', '\n'), array('', ' ', ' '), $str);
foreach($fields as $field){
if(preg_match('/[a-zA-Z_]+\([a-zA-Z_]+\)/', $field, $alias)){
foreach($tables as $table)
* stocked in tables array
throw new Exception("Fatal Error: Your SQL QUERY must only contains ',' between tables name. ");
* count the number of fields
* fetch fieldname stocked
* in the fields PMO_MyArray
* fetch sql function stocked
* in the functions PMO_MyArray
* fetch tablename stocked
* in the fields PMO_MyArray
|