public function create($parsed) { $k = key($parsed); switch ($k) { case "USE": # this statement is not an Oracle statement $this->created = ""; break; default: $this->created = parent::create($parsed); break; } return $this->created; }
<?php require_once dirname(__FILE__) . '/../../../src/PHPSQLParser.php'; require_once dirname(__FILE__) . '/../../../src/PHPSQLCreator.php'; require_once dirname(__FILE__) . '/../../test-more.php'; $query = "UPDATE t1 SET c1 = -c2"; $parser = new PHPSQLParser(); $p = $parser->parse($query); $creator = new PHPSQLCreator(); $created = $creator->create($p); $expected = getExpectedValue(dirname(__FILE__), 'issue127.sql', false); ok($created === $expected, 'unary operator');
<?php require_once dirname(__FILE__) . '/../../../src/PHPSQLParser.php'; require_once dirname(__FILE__) . '/../../../src/PHPSQLCreator.php'; require_once dirname(__FILE__) . '/../../test-more.php'; $sql = "SELECT\n u.`id` AS userid,\nu.`user` AS username,\n u.`firstname`,\nu.`lastname`,\n u.`email`,\nCONCAT(19, lastname, 2013) AS test\n FROM\n`user` u\n ORDER BY\n u.`user` DESC"; $parser = new PHPSQLParser(); $parsed = $parser->parse($sql); $creator = new PHPSQLCreator(); $created = $creator->create($parsed); $expected = getExpectedValue(dirname(__FILE__), 'magnus.sql', false); ok($created === $expected, 'Aliases for functions.');