本文整理匯總了PHP中SemanticScuttle_Service_Factory::getDb方法的典型用法代碼示例。如果您正苦於以下問題:PHP SemanticScuttle_Service_Factory::getDb方法的具體用法?PHP SemanticScuttle_Service_Factory::getDb怎麽用?PHP SemanticScuttle_Service_Factory::getDb使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類SemanticScuttle_Service_Factory
的用法示例。
在下文中一共展示了SemanticScuttle_Service_Factory::getDb方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: dirname
<?php
/**
* SemanticScuttle from approximately 0.94 up to 0.98.2, system:unfiled
* tags were not created when adding new bookmarks with the web interface.
*
* This script adds system:unfiled tags for all bookmarks that have no
* tags.
*/
require_once dirname(__FILE__) . '/../src/SemanticScuttle/header-standalone.php';
//needed to load the database object
$bt = SemanticScuttle_Service_Factory::get('Bookmark2Tag');
$db = SemanticScuttle_Service_Factory::getDb();
$query = <<<SQL
SELECT b.bId
FROM sc_bookmarks AS b
LEFT JOIN sc_bookmarks2tags AS bt ON b.bId = bt.bId
WHERE bt.bId IS NULL
SQL;
if (!($dbresult = $db->sql_query($query))) {
die('Strange SQL error');
}
while ($row = $db->sql_fetchrow($dbresult)) {
$db->sql_query('INSERT INTO ' . $bt->getTableName() . ' ' . $db->sql_build_array('INSERT', array('bId' => $row['bId'], 'tag' => 'system:unfiled')));
}
$db->sql_freeresult($dbresult);
示例2: testGetDb
public function testGetDb()
{
$this->assertInstanceOf('sql_db', SemanticScuttle_Service_Factory::getDb());
}