|
From: <cw...@us...> - 2007-08-12 11:59:55
|
Revision: 486
http://rdfapi-php.svn.sourceforge.net/rdfapi-php/?rev=486&view=rev
Author: cweiske
Date: 2007-08-12 04:59:54 -0700 (Sun, 12 Aug 2007)
Log Message:
-----------
Try to fix bug #1745358: Apostrophes in URI Resources
Modified Paths:
--------------
trunk/rdfapi-php/api/dataset/DatasetDb.php
trunk/rdfapi-php/api/model/DbModel.php
trunk/rdfapi-php/api/model/DbStore.php
Modified: trunk/rdfapi-php/api/dataset/DatasetDb.php
===================================================================
--- trunk/rdfapi-php/api/dataset/DatasetDb.php 2007-08-12 11:33:30 UTC (rev 485)
+++ trunk/rdfapi-php/api/dataset/DatasetDb.php 2007-08-12 11:59:54 UTC (rev 486)
@@ -124,7 +124,10 @@
{
$graphNameURI=$graph->getGraphName();
$this->removeNamedGraph($graphNameURI);
- $this->dbConnection->execute('INSERT INTO dataset_model VALUES("'.$this->setName.'",'.$graph->modelID.',"'.$graphNameURI.'")');
+ $this->dbConnection->execute('INSERT INTO dataset_model VALUES('
+ . $this->dbConnection->qstr($this->setName) . ','
+ . $this->dbConnection->qstr($graph->modelID) . ','
+ . $this->dbConnection->qstr($graphNameURI) .')');
}
@@ -135,7 +138,9 @@
*/
function setDefaultGraph(&$graph)
{
- $this->dbConnection->execute('UPDATE datasets SET defaultModelUri ="'.$graph->modelURI.'" WHERE datasetName ="'.$this->setName.'"');
+ $this->dbConnection->execute('UPDATE datasets SET defaultModelUri ='
+ . $this->dbConnection->qstr($graph->modelURI) . ' WHERE datasetName ='
+ . $this->dbConnection->qstr($this->setName));
}
/**
@@ -167,7 +172,9 @@
*/
function removeNamedGraph($graphName)
{
- $this->dbConnection->execute('DELETE FROM dataset_model WHERE datasetName="'.$this->setName.'" AND graphURI ="'.$graphName.'"');
+ $this->dbConnection->execute('DELETE FROM dataset_model WHERE datasetName="'
+ . $this->dbConnection->qstr($this->setName) . '" AND graphURI ="'
+ . $this->dbConnection->qstr($graphName) . '"');
}
/**
Modified: trunk/rdfapi-php/api/model/DbModel.php
===================================================================
--- trunk/rdfapi-php/api/model/DbModel.php 2007-08-12 11:33:30 UTC (rev 485)
+++ trunk/rdfapi-php/api/model/DbModel.php 2007-08-12 11:59:54 UTC (rev 486)
@@ -144,8 +144,8 @@
(modelID, subject, predicate, object, l_language, l_datatype, subject_is, object_is)
VALUES
(" .$this->modelID .","
- ."'" .$statement->getLabelSubject() ."',"
- ."'" .$statement->getLabelPredicate() ."',";
+ . $this->dbConn->qstr($statement->getLabelSubject()) .","
+ . $this->dbConn->qstr($statement->getLabelPredicate()) .",";
if (is_a($statement->object(), 'Literal')) {
$quotedLiteral = $this->dbConn->qstr($statement->obj->getLabel());
@@ -156,7 +156,7 @@
."'l')";
}else{
$object_is = $this->_getNodeFlag($statement->object());
- $sql .= "'" .$statement->obj->getLabel() ."',"
+ $sql .= $this->dbConn->qstr($statement->obj->getLabel()) .","
."'',"
."'',"
."'" .$subject_is ."',"
@@ -1204,8 +1204,8 @@
(modelID, namespace, prefix)
VALUES
(" .$this->modelID .","
- ."'" .$nmsp ."',"
- ."'" .$prefix."')";
+ ."'" . $this->dbConn->qstr($nmsp) ."',"
+ ."'" . $this->dbConn->qstr($prefix) ."')";
}
$rs =& $this->dbConn->execute($sql);
Modified: trunk/rdfapi-php/api/model/DbStore.php
===================================================================
--- trunk/rdfapi-php/api/model/DbStore.php 2007-08-12 11:33:30 UTC (rev 485)
+++ trunk/rdfapi-php/api/model/DbStore.php 2007-08-12 11:59:54 UTC (rev 486)
@@ -218,11 +218,12 @@
$rs =& $this->dbConn->execute("INSERT INTO models
(modelID, modelURI, baseURI)
- VALUES ('" .$modelID ."',
- '" .$modelURI ."',
- '" .$baseURI ."')");
+ VALUES (" .$modelID .",
+ " .$this->dbConn->qstr($modelURI) .",
+ " .$this->dbConn->qstr($baseURI) .")");
+
if (!$rs)
- $this->dbConn->errorMsg();
+ return $this->dbConn->errorMsg();
else
return new DbModel($this->dbConn, $modelURI, $modelID, $baseURI);
}
@@ -588,8 +589,8 @@
$defaultModel=$this->getNewModel($defaultModelUri);
$rs =& $this->dbConn->execute("INSERT INTO datasets
- VALUES ('" .$datasetName ."',
- '" .$defaultModelUri."')");
+ VALUES ('" .$this->dbConn->qstr($datasetName) ."',
+ '" .$this->dbConn->qstr($defaultModelUri)."')");
if (!$rs)
$this->dbConn->errorMsg();
@@ -689,9 +690,9 @@
$rs =& $this->dbConn->execute("INSERT INTO models
(modelID, modelURI, baseURI)
- VALUES ('" .$modelID ."',
- '" .$modelURI ."',
- '" .$baseURI ."')");
+ VALUES (" .$modelID ."',
+ " .$this->dbConn->qstr($modelURI) ."',
+ " .$this->dbConn->qstr($baseURI) .")");
if (!$rs)
$this->dbConn->errorMsg();
else
@@ -723,8 +724,8 @@
return true;
}
-
+
/**
* Performs a SPARQL query against a model. The model is converted to
* an RDF Dataset. The result can be retrived in SPARQL Query Results XML Format or
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|