本文整理汇总了PHP中Pluf::db方法的典型用法代码示例。如果您正苦于以下问题:PHP Pluf::db方法的具体用法?PHP Pluf::db怎么用?PHP Pluf::db使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pluf
的用法示例。
在下文中一共展示了Pluf::db方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Construct the constructor with a default condition.
*/
function __construct($base = '', $args = array())
{
$this->db = Pluf::db();
if (strlen($base) > 0) {
$this->Q($base, $args);
}
}
示例2: getItem
/**
* Get an item to process.
*
* @return mixed False if no item to proceed.
*/
public static function getItem()
{
$item = false;
$db = Pluf::db();
$db->begin();
// In a transaction to not process the same item at
// the same time from to processes.
$gqueue = new Pluf_Queue();
$items = $gqueue->getList(array('filter' => $db->qn('lock') . '=0', 'order' => 'creation_dtime ASC'));
if ($items->count() > 0) {
$item = $items[0];
$item->lock = 1;
$item->update();
}
$db->commit();
if ($item === false) {
return false;
}
// try to get the corresponding object
$obj = Pluf::factory($item->model_class, $item->model_id);
if ($obj->id != $item->model_id) {
$obj = null;
}
return array('queue' => $item, 'item' => $obj);
}
示例3: tearDown
protected function tearDown()
{
$db = Pluf::db();
$schema = Pluf::factory('Pluf_DB_Schema', $db);
$m1 = new TestFormModel();
$schema->model = $m1;
$schema->dropTables();
}
示例4: setUp
protected function setUp()
{
Pluf::start(dirname(__FILE__) . '/../conf/pluf.config.php');
$this->db = Pluf::db();
if ($this->db->engine != 'SQLite') {
$this->markTestSkipped('Only to be run with the SQLite DB engine');
}
}
示例5: tearDown
function tearDown()
{
$db = Pluf::db();
$schema = Pluf::factory('Pluf_DB_Schema', $db);
$m = new Pluf_Permission();
$schema->model = $m;
$schema->dropTables();
}
示例6: IDF_Migrations_4Timeline_down
function IDF_Migrations_4Timeline_down($params = null)
{
$models = array('IDF_Timeline', 'IDF_Commit');
$db = Pluf::db();
$schema = new Pluf_DB_Schema($db);
foreach ($models as $model) {
$schema->model = new $model();
$schema->dropTables();
}
}
示例7: IDF_Migrations_7Wiki_down
function IDF_Migrations_7Wiki_down($params = null)
{
$models = array('IDF_WikiRevision', 'IDF_WikiPage');
$db = Pluf::db();
$schema = new Pluf_DB_Schema($db);
foreach ($models as $model) {
$schema->model = new $model();
$schema->dropTables();
}
}
示例8: IDF_Migrations_8CodeReview_down
function IDF_Migrations_8CodeReview_down($params = null)
{
$models = array('IDF_Review_FileComment', 'IDF_Review_Patch', 'IDF_Review');
$db = Pluf::db();
$schema = new Pluf_DB_Schema($db);
foreach ($models as $model) {
$schema->model = new $model();
$schema->dropTables();
}
}
示例9: Pluf_Migrations_Install_teardown
function Pluf_Migrations_Install_teardown($params = null)
{
$models = array('Pluf_Queue', 'Pluf_Search_Stats', 'Pluf_Search_Occ', 'Pluf_Search_Word', 'Pluf_RowPermission', 'Pluf_Permission', 'Pluf_Message', Pluf::f('pluf_custom_group', 'Pluf_Group'), Pluf::f('pluf_custom_user', 'Pluf_User'), 'Pluf_Session', 'Pluf_DB_SchemaInfo');
$db = Pluf::db();
$schema = new Pluf_DB_Schema($db);
foreach ($models as $model) {
$schema->model = new $model();
$schema->dropTables();
}
}
示例10: IDF_Migrations_1Download_down
function IDF_Migrations_1Download_down($params = null)
{
$models = array('IDF_Upload');
$db = Pluf::db();
$schema = new Pluf_DB_Schema($db);
foreach ($models as $model) {
$schema->model = new $model();
$schema->dropTables();
}
}
示例11: IDF_Migrations_3Attachments_down
function IDF_Migrations_3Attachments_down($params = null)
{
$models = array('IDF_IssueFile');
$db = Pluf::db();
$schema = new Pluf_DB_Schema($db);
foreach ($models as $model) {
$schema->model = new $model();
$schema->dropTables();
}
}
示例12: IDF_Migrations_9ShortDescription_down
function IDF_Migrations_9ShortDescription_down($params = null)
{
$table = Pluf::factory('IDF_Project')->getSqlTable();
$sql = array();
$sql['PostgreSQL'] = 'ALTER TABLE ' . $table . ' DROP COLUMN "shortdesc"';
$sql['MySQL'] = 'ALTER TABLE ' . $table . ' DROP COLUMN `shortdesc`';
$db = Pluf::db();
$engine = Pluf::f('db_engine');
if (!isset($sql[$engine])) {
throw new Exception('SQLite complex migration not supported.');
}
$db->execute($sql[$engine]);
}
示例13: IDF_Migrations_12DownloadDesc_down
function IDF_Migrations_12DownloadDesc_down($params = null)
{
$table = Pluf::factory('IDF_Upload')->getSqlTable();
$sql = array();
$sql['PostgreSQL'] = 'ALTER TABLE ' . $table . ' DROP COLUMN "changelog"';
$sql['MySQL'] = 'ALTER TABLE ' . $table . ' DROP COLUMN `changelog`';
$db = Pluf::db();
$engine = Pluf::f('db_engine');
if (!isset($sql[$engine])) {
throw new Exception('SQLite complex migration not supported.');
}
$db->execute($sql[$engine]);
}
示例14: testCreate
function testCreate()
{
$db = Pluf::db();
$schema = new Pluf_DB_Schema($db);
$m = new Pluf_Tests_Model_CompressedField_Model();
$schema->model = $m;
$schema->createTables();
$m->compressed = 'Youplaboum';
$m->create();
$this->assertEqual(1, $m->id);
$m = new Pluf_Tests_Model_CompressedField_Model(1);
$this->assertEqual('Youplaboum', $m->compressed);
$schema->dropTables();
}
示例15: IDF_Migrations_5DescToText_up
/**
* Add the download of files.
*/
function IDF_Migrations_5DescToText_up($params = null)
{
$table = Pluf::factory('IDF_Conf')->getSqlTable();
$sql = array();
$sql['PostgreSQL'] = 'ALTER TABLE ' . $table . ' ALTER vdesc TYPE text';
$sql['MySQL'] = 'ALTER TABLE ' . $table . ' CHANGE vdesc TYPE text';
$db = Pluf::db();
$engine = Pluf::f('db_engine');
if (!isset($sql[$engine])) {
echo 'Skip SQLite upgrade as not needed.' . "\n";
return;
}
$db->execute($sql[$engine]);
}