<?php
$sql = 'SELECT MAX(article) AS article FROM shop';
include_once("config.inc.php");
$sqlObject = new Sql_Parser($sql);
$parsedSQL = $sqlObject->parse();
$sqlObject2 = new Sql_Compiler();
pdbg($parsedSQL, "orange", __LINE__,__FILE__,100);
pdbg($sqlObject2->compile($parsedSQL), "orange", __LINE__,__FILE__,100);
// from the scratch
$object = new Sql();
$object ->setCommand("select")
->addTableNames("shop")
->setFunction(
Sql::functionHelper(
array(
"max",
array(
array("Value"=>"article","Type"=>"ident")
),
"article"
)
)
);
pdbg($object, "orange", __LINE__,__FILE__);
pdbg($object->compile(), "orange", __LINE__,__FILE__);
##########################################################
$sql = 'SELECT article, dealer, price FROM shop WHERE price=(SELECT MAX(price) FROM shop)';
$sqlObject = new Sql_Parser($sql);
$parsedSQL = $sqlObject->parse();
$sqlObject2 = new Sql_Compiler();
pdbg($parsedSQL, "lime", __LINE__,__FILE__,300);
pdbg($sqlObject2->compile($parsedSQL), "lime", __LINE__,__FILE__,100);
|