|
From: <cw...@us...> - 2007-06-19 17:04:47
|
Revision: 450
http://rdfapi-php.svn.sourceforge.net/rdfapi-php/?rev=450&view=rev
Author: cweiske
Date: 2007-06-19 10:04:46 -0700 (Tue, 19 Jun 2007)
Log Message:
-----------
Fix exception when no variables can be returned -> return empty array
Modified Paths:
--------------
trunk/rdfapi-php/api/sparql/SparqlEngineDb/SqlGenerator.php
trunk/rdfapi-php/test/config.php.dist
Modified: trunk/rdfapi-php/api/sparql/SparqlEngineDb/SqlGenerator.php
===================================================================
--- trunk/rdfapi-php/api/sparql/SparqlEngineDb/SqlGenerator.php 2007-06-19 16:13:07 UTC (rev 449)
+++ trunk/rdfapi-php/api/sparql/SparqlEngineDb/SqlGenerator.php 2007-06-19 17:04:46 UTC (rev 450)
@@ -241,10 +241,13 @@
}
foreach ($arSelect as $nUnionCount => $arSelectPart) {
$arSelectPart = self::removeNull($arSelectPart);
- if (count($arSelectPart) == 0) {
- throw new SparqlEngineDb_SqlGeneratorException('No variable that could be returned.');
+ if (count($arSelectPart) == 0
+ || (count($arSelectPart) == 1 && $arSelectPart[0] == '')) {
+ //test "test-1-07" suggests we return no rows in this case
+ //throw new SparqlEngineDb_SqlGeneratorException('No variable that could be returned.');
+ } else {
+ $arStrSelect[$nUnionCount] = strtoupper($strSelectType) . ' ' . implode(', ' , $arSelectPart);
}
- $arStrSelect[$nUnionCount] = strtoupper($strSelectType) . ' ' . implode(', ' , $arSelectPart);
}
break;
@@ -259,7 +262,7 @@
}
$arSqls = array();
- foreach ($arSelect as $nUnionCount => $arSelectPart) {
+ foreach ($arStrSelect as $nUnionCount => $arSelectPart) {
$arSqls[] = array(
'select' => $arStrSelect[$nUnionCount],
'from' => ' FROM ' . implode(' ' , self::removeNull($arFrom[$nUnionCount])),
Modified: trunk/rdfapi-php/test/config.php.dist
===================================================================
--- trunk/rdfapi-php/test/config.php.dist 2007-06-19 16:13:07 UTC (rev 449)
+++ trunk/rdfapi-php/test/config.php.dist 2007-06-19 17:04:46 UTC (rev 450)
@@ -18,5 +18,8 @@
'password' => ''
);
+//enable this to get more informatin about failing unit tests
+//$GLOBALS['debugTests'] = true;
+
define('LOG', false);
?>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|