rickywu-posh / php-sql-parser

Automatically exported from code.google.com/p/php-sql-parser
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Fatal Error, undefined method #154

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
    $parser = new PHPSQLParser();
    $creator = new PHPSQLCreator();

    $query = "DELETE FROM table_name WHERE column_name = 'column_value'";
    $tree = $parser->parse($query);
    echo $creator->create($tree);

What is the expected output? What do you see instead?
Expected output: "DELETE FROM table_name WHERE column_name = 'column_value'"
error output: "
Fatal error: Call to undefined method DeleteStatementBuilder::build() in 
D:\xampp\htdocs\parser\src\PHPSQLCreator.php on line 83"

What version of the product are you using? On what operating system?
i am using the latest version, bug tested on windows 7 with XAMPP, and ubuntu 7 
with apache & php

Please provide any additional information below.

Original issue reported on code.google.com by jossanto...@gmail.com on 12 Dec 2014 at 12:29

GoogleCodeExporter commented 8 years ago
in PHPSQLCreator.php, it should be processDeleteStatement not build

in DeleteStatementBuilder.php two function names need to be updated:

    public function processDeleteStatement($parsed) {
        $sql = $this->buildDELETE($parsed['DELETE']) . " " . $this->buildFROM($parsed['FROM']);
        if (isset($parsed['WHERE'])) {
            $sql .= " " . $this->buildWHERE($parsed['WHERE']);
        }
        return $sql;
    }

in DeleteBuilder.php, comment the foreach loop, and return $sql;

Original comment by glun...@solutionsmetrix.com on 8 May 2015 at 4:49