|
From: <cw...@us...> - 2007-08-16 09:32:05
|
Revision: 533
http://rdfapi-php.svn.sourceforge.net/rdfapi-php/?rev=533&view=rev
Author: cweiske
Date: 2007-08-16 02:32:03 -0700 (Thu, 16 Aug 2007)
Log Message:
-----------
If getParsedNamespaces() does not return false if there are no namespaces,
we break a mass of tests
Modified Paths:
--------------
trunk/rdfapi-php/api/model/DbModel.php
trunk/rdfapi-php/test/unit/Model/dBModel_test.php
Modified: trunk/rdfapi-php/api/model/DbModel.php
===================================================================
--- trunk/rdfapi-php/api/model/DbModel.php 2007-08-16 09:19:56 UTC (rev 532)
+++ trunk/rdfapi-php/api/model/DbModel.php 2007-08-16 09:32:03 UTC (rev 533)
@@ -1151,15 +1151,18 @@
/**
* Returns the models namespaces.
*
- * @author Tobias Gau�<tob...@we...>
+ * @author Tobias Gauss <tob...@we...>
+ * @return mixed Array of key-value pairs. Namespace is the key,
+ * prefix the value. If no namespaces are found,
+ * boolean false is returned.
+ *
* @access public
- * @return Array
*/
function getParsedNamespaces(){
$sql = "SELECT * FROM namespaces
WHERE modelID = " .$this->modelID;
- $temp=array();
- $res = $this->dbConn->execute($sql);
+ $temp = false;
+ $res = $this->dbConn->execute($sql);
if($res){
while (!$res->EOF) {
$temp[$res->fields[1]]=$res->fields[2];
@@ -1176,9 +1179,10 @@
* the parser. !!!! addParsedNamespaces() not overwrites manual
* added namespaces in the model !!!!
*
- * @author Tobias Gau�<tob...@we...>
+ * @author Tobias Gauss <tob...@we...>
+ * @param array $newNs Array of namespace => prefix assignments
+ *
* @access public
- * @param Array $newNs
*/
function addParsedNamespaces($newNs){
if($newNs)
@@ -1191,9 +1195,11 @@
/**
* Adds a namespace and prefix to the model.
*
- * @author Tobias Gau�<tob...@we...>
+ * @author Tobias Gauss <tob...@we...>
+ * @param string $prefix Prefix
+ * @param string $nmsp Namespace URI
+ *
* @access public
- * @param String $prefix, String $nmsp
*/
function addNamespace($prefix,$nmsp){
@@ -1254,20 +1260,26 @@
}
/**
- * removes a single namespace from the model
+ * Removes a single namespace from the model
*
- * @author Tobias Gau�<tob...@we...>
+ * @author Tobias Gauss <tob...@we...>
+ * @param string $nmsp Namespace URI
+ *
+ * @return mixed True if all went well, error message otherwise
+ *
* @access public
- * @param String $nmsp
*/
function removeNamespace($nmsp){
- $sql = 'DELETE FROM namespaces
+ $sql = 'DELETE FROM namespaces
WHERE modelID=' .$this->modelID." AND namespace=". $this->dbConn->qstr($nmsp);
- $rs =& $this->dbConn->execute($sql);
- if (!$rs)
- return $this->dbConn->errorMsg();
+ $rs =& $this->dbConn->execute($sql);
+ if (!$rs)
+ return $this->dbConn->errorMsg();
+ else {
+ return true;
+ }
}
Modified: trunk/rdfapi-php/test/unit/Model/dBModel_test.php
===================================================================
--- trunk/rdfapi-php/test/unit/Model/dBModel_test.php 2007-08-16 09:19:56 UTC (rev 532)
+++ trunk/rdfapi-php/test/unit/Model/dBModel_test.php 2007-08-16 09:32:03 UTC (rev 533)
@@ -119,7 +119,7 @@
$dbmodel = $mysql_database->getModel(self::$strModelUri);
//no namespaces
- $this->assertIdentical(array(), $dbmodel->getParsedNamespaces());
+ $this->assertIdentical(false, $dbmodel->getParsedNamespaces());
//one namespace
$dbmodel->addNamespace('test', 'http://test.org');
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|