|
From: <cw...@us...> - 2007-08-16 07:22:33
|
Revision: 526
http://rdfapi-php.svn.sourceforge.net/rdfapi-php/?rev=526&view=rev
Author: cweiske
Date: 2007-08-16 00:22:32 -0700 (Thu, 16 Aug 2007)
Log Message:
-----------
Bug: Namespace was quoted twice
WE NEED UNIT TESTS
Modified Paths:
--------------
trunk/rdfapi-php/api/model/DbModel.php
Modified: trunk/rdfapi-php/api/model/DbModel.php
===================================================================
--- trunk/rdfapi-php/api/model/DbModel.php 2007-08-14 16:46:23 UTC (rev 525)
+++ trunk/rdfapi-php/api/model/DbModel.php 2007-08-16 07:22:32 UTC (rev 526)
@@ -1124,21 +1124,20 @@
*/
function _containsRow ($row) {
- $quotedObject = $this->dbConn->qstr($row[2]);
$sql = "SELECT modelID FROM statements
WHERE modelID = " .$this->modelID ."
- AND subject ='" .$row[0] ."'
- AND predicate ='" .$row[1] ."'
- AND object =" .$quotedObject ."
- AND l_language='" .$row[3] ."'
- AND l_datatype='" .$row[4] ."'
- AND subject_is='" .$row[5] ."'
- AND object_is='" .$row[6] ."'";
+ AND subject =" .$this->dbConn->qstr($row[0]) ."
+ AND predicate =" .$this->dbConn->qstr($row[1]) ."
+ AND object =" .$this->dbConn->qstr($row[2]) ."
+ AND l_language=" .$this->dbConn->qstr($row[3]) ."
+ AND l_datatype=" .$this->dbConn->qstr($row[4]) ."
+ AND subject_is=" .$this->dbConn->qstr($row[5]) ."
+ AND object_is=" .$this->dbConn->qstr($row[6]);
$res =& $this->dbConn->getOne($sql);
if (!$res)
- return FALSE;
+ return FALSE;
return TRUE;
}
@@ -1197,15 +1196,15 @@
if($nmsp != '' && $prefix !=''){
if($this->_checkNamespace($nmsp)){
- $sql = "UPDATE namespaces SET prefix='".$prefix."' WHERE
- modelID=".$this->modelID." AND namespace='".$nmsp."'";
+ $sql = "UPDATE namespaces SET prefix=".$this->dbConn->qstr($prefix)." WHERE
+ modelID=".$this->modelID." AND namespace=".$this->dbConn->qstr($nmsp);
}else{
$sql = "INSERT INTO namespaces
(modelID, namespace, prefix)
VALUES
- (" .$this->modelID .","
- ."'" . $this->dbConn->qstr($nmsp) ."',"
- ."'" . $this->dbConn->qstr($prefix) ."')";
+ (" .$this->modelID .','
+ . $this->dbConn->qstr($nmsp) . ','
+ . $this->dbConn->qstr($prefix) . ')';
}
$rs =& $this->dbConn->execute($sql);
@@ -1225,7 +1224,7 @@
$res = true;
$sql = "SELECT * FROM namespaces
WHERE modelID = " .$this->modelID." AND
- namespace='".$nmsp."'" ;
+ namespace=" . $this->dbConn->qstr($nmsp);
$rs =& $this->dbConn->execute($sql);
if (!$rs){
$this->dbConn->errorMsg();
@@ -1261,7 +1260,7 @@
function removeNamespace($nmsp){
$sql = 'DELETE FROM namespaces
- WHERE modelID=' .$this->modelID." AND namespace='".$nmsp."'";
+ WHERE modelID=' .$this->modelID." AND namespace=". $this->dbConn->qstr($nmsp);
$rs =& $this->dbConn->execute($sql);
if (!$rs)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|