introduce dbservice, a service base class that has a database variable, table variable and getter/setter for table
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@400 b3834d28-1941-0410-a4f8-b48e95affb8f
This commit is contained in:
parent
60bb032d75
commit
00ba74e0c4
3 changed files with 70 additions and 9 deletions
67
src/SemanticScuttle/DbService.php
Normal file
67
src/SemanticScuttle/DbService.php
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* SemanticScuttle - your social bookmark manager.
|
||||||
|
*
|
||||||
|
* PHP version 5.
|
||||||
|
*
|
||||||
|
* @category Bookmarking
|
||||||
|
* @package SemanticScuttle
|
||||||
|
* @author Christian Weiske <cweiske@cweiske.de>
|
||||||
|
* @license GPL http://www.gnu.org/licenses/gpl.html
|
||||||
|
* @link http://sourceforge.net/projects/semanticscuttle
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base class for services utilizing the database.
|
||||||
|
*
|
||||||
|
* @category Bookmarking
|
||||||
|
* @package SemanticScuttle
|
||||||
|
* @author Christian Weiske <cweiske@cweiske.de>
|
||||||
|
* @license GPL http://www.gnu.org/licenses/gpl.html
|
||||||
|
* @link http://sourceforge.net/projects/semanticscuttle
|
||||||
|
*/
|
||||||
|
class SemanticScuttle_DbService extends SemanticScuttle_Service
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Database object
|
||||||
|
*
|
||||||
|
* @var sql_db
|
||||||
|
*/
|
||||||
|
protected $db;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Database table name
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $tablename;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns database table name
|
||||||
|
*
|
||||||
|
* @return string Table name
|
||||||
|
*/
|
||||||
|
public function getTableName()
|
||||||
|
{
|
||||||
|
return $this->tablename;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the database table name
|
||||||
|
*
|
||||||
|
* @param string $value New table name
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function setTableName($value)
|
||||||
|
{
|
||||||
|
$this->tablename = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,8 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
class SemanticScuttle_Service_Bookmark extends SemanticScuttle_Service
|
class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService
|
||||||
{
|
{
|
||||||
var $tablename;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the single service instance
|
* Returns the single service instance
|
||||||
*
|
*
|
||||||
|
@ -288,7 +286,7 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_Service
|
||||||
unset($uriparts);
|
unset($uriparts);
|
||||||
|
|
||||||
$b2tservice = SemanticScuttle_Service_Factory::get('Bookmark2Tag');
|
$b2tservice = SemanticScuttle_Service_Factory::get('Bookmark2Tag');
|
||||||
$aok = !$b2tservice->attachTags(
|
$aok = $b2tservice->attachTags(
|
||||||
$bId, $categories, $fromApi, $extension, false, $fromImport
|
$bId, $categories, $fromApi, $extension, false, $fromImport
|
||||||
);
|
);
|
||||||
if (!$aok) {
|
if (!$aok) {
|
||||||
|
@ -680,11 +678,6 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_Service
|
||||||
$this->db->sql_query($query);
|
$this->db->sql_query($query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Properties
|
|
||||||
function getTableName() { return $this->tablename; }
|
|
||||||
function setTableName($value) { $this->tablename = $value; }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -27,6 +27,7 @@ if(DEBUG_MODE) {
|
||||||
|
|
||||||
// 2 // Second requirements part which could display bugs (must come after debug management)
|
// 2 // Second requirements part which could display bugs (must come after debug management)
|
||||||
require_once 'SemanticScuttle/Service.php';
|
require_once 'SemanticScuttle/Service.php';
|
||||||
|
require_once 'SemanticScuttle/DbService.php';
|
||||||
require_once 'SemanticScuttle/Service/Factory.php';
|
require_once 'SemanticScuttle/Service/Factory.php';
|
||||||
require_once 'SemanticScuttle/functions.php';
|
require_once 'SemanticScuttle/functions.php';
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue