Index: trunk/extensions/SemanticMediaWiki/includes/SMW_QueryProcessor.php |
— | — | @@ -408,7 +408,10 @@ |
409 | 409 | wfProfileOut( 'SMWQueryProcessor::getResultFromQuery (SMW)' ); |
410 | 410 | |
411 | 411 | return $result; |
412 | | - } else { // result for counting or debugging is just a string |
| 412 | + } else { // result for counting or debugging is just a string or number |
| 413 | + if ( is_numeric( $res ) ) { |
| 414 | + $res = strval( $res ); |
| 415 | + } |
413 | 416 | if ( is_string( $res ) ) { |
414 | 417 | if ( array_key_exists( 'intro', $params ) ) { |
415 | 418 | $res = str_replace( '_', ' ', $params['intro'] ) . $res; |
— | — | @@ -418,9 +421,7 @@ |
419 | 422 | } |
420 | 423 | |
421 | 424 | $result = $res . smwfEncodeMessages( $query->getErrors() ); |
422 | | - } |
423 | | - else { |
424 | | - // When no valid result was obtained, $res will be a SMWQueryResult. |
| 425 | + } else { // When no valid result was obtained, $res will be a SMWQueryResult. |
425 | 426 | $result = smwfEncodeMessages( $query->getErrors() ); |
426 | 427 | } |
427 | 428 | |
Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SparqlStoreQueryEngine.php |
— | — | @@ -296,6 +296,7 @@ |
297 | 297 | $options['DISTINCT'] = true; |
298 | 298 | $sparqlResultWrapper = smwfGetSparqlDatabase()->selectCount( '?' . self::RESULT_VARIABLE, |
299 | 299 | $condition, $options, $namespaces ); |
| 300 | + |
300 | 301 | if ( $sparqlResultWrapper->getErrorCode() == SMWSparqlResultWrapper::ERROR_NOERROR ) { |
301 | 302 | return (int)$sparqlResultWrapper->getNumericValue(); |
302 | 303 | } else { |