Updated DB classes for supporting prepared statements - SQL string can now be returned with '?' instead of argument values.

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0-DB@8458 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
ucorina 2011-06-07 19:01:58 +00:00
parent 313bfca8e8
commit b6a1088995
14 changed files with 107 additions and 52 deletions

View file

@ -12,11 +12,11 @@
return _XE_PATH_ . $type ."/".$name."/queries/" . $query_name . ".xml";
}
function getNewParserOutput($xml_file, $escape_char = '"'){
$newXmlQueryParser = new XmlQueryParser();
function getNewParserOutput($xml_file, $escape_char = '"', $db_type = NULL){
$newXmlQueryParser = new XmlQueryParser($db_type);
$xml_obj = $newXmlQueryParser->getXmlFileContent($xml_file);
$dbParser = new DBParser($escape_char);
$dbParser = $newXmlQueryParser->getDBParser();
$parser = new QueryParser($xml_obj->query, $dbParser);
return $parser->toString();
}
@ -59,9 +59,9 @@
.'</pre>';
}
function getNewParserOutputString($xml_file, $escape_char, $argsString){
function getNewParserOutputString($xml_file, $escape_char, $argsString, $db_type = NULL){
$outputString = '';
$outputString = $this->getNewParserOutput($xml_file, $escape_char);
$outputString = $this->getNewParserOutput($xml_file, $escape_char, $db_type);
$outputString = $this->cleanOutputAndAddArgs($outputString, $argsString);
return $outputString;
}

View file

@ -6,6 +6,7 @@
function _test($xml_file, $argsString, $expected){
$tester = new QueryTester();
$outputString = $tester->getNewParserOutputString($xml_file, '"', $argsString);
//echo $outputString;
$output = eval($outputString);
if(!is_a($output, 'Query')){

View file

@ -18,6 +18,7 @@
require_once(_XE_PATH_.'classes/db/DB.class.php');
require_once(_XE_PATH_.'classes/db/DBCubrid.class.php');
require_once(_XE_PATH_.'classes/db/DBMssql.class.php');
require_once(_XE_PATH_.'classes/xml/xmlquery/DBParser.class.php');
require_once(_XE_PATH_.'classes/xml/xmlquery/argument/Argument.class.php');