• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP DB\dbQuery函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中CB\DB\dbQuery函数的典型用法代码示例。如果您正苦于以下问题:PHP dbQuery函数的具体用法?PHP dbQuery怎么用?PHP dbQuery使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了dbQuery函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: create

 /**
  * create an object with specified params
  * @param  array $p object properties
  * @return int   created id
  */
 public function create($p = false)
 {
     if ($p === false) {
         $p = $this->data;
     }
     // check input params
     if (!isset($p['target_id'])) {
         throw new \Exception("No target id specified for shortcut creation", 1);
     }
     //check if target is also shortuc and replace with its target
     if (Objects::getType($p['target_id']) == 'shortcut') {
         $res = DB\dbQuery('SELECT target_id
             FROM tree
             WHERE id = $1', $p['target_id']) or die(DB\dbQueryError());
         if ($r = $res->fetch_assoc()) {
             $p['target_id'] = $r['target_id'];
         }
         $res->close();
     }
     $p['name'] = 'link to #' . $p['target_id'];
     if (empty($p['template_id'])) {
         $p['template_id'] = \CB\Config::get('default_shortcut_template');
     }
     $this->data = $p;
     return parent::create($p);
 }
开发者ID:austinvernsonger,项目名称:casebox,代码行数:31,代码来源:Shortcut.php


示例2: onNodeDbCreate

 /**
  * create system folders specified in created objects template config as system_folders property
  * @param  object $o
  * @return void
  */
 public function onNodeDbCreate($o)
 {
     if (!is_object($o)) {
         return;
     }
     $template = $o->getTemplate();
     if (empty($template)) {
         return;
     }
     $templateData = $template->getData();
     if (empty($templateData['cfg']['system_folders'])) {
         return;
     }
     $folderIds = Util\toNumericArray($templateData['cfg']['system_folders']);
     if (empty($folderIds)) {
         return;
     }
     $p = array('sourceIds' => array(), 'targetId' => $o->getData()['id']);
     $browserActionsClass = new Browser\Actions();
     $res = DB\dbQuery('SELECT id
         FROM tree
         WHERE pid in (' . implode(',', $folderIds) . ')
             AND dstatus = 0');
     while ($r = $res->fetch_assoc()) {
         $p['sourceIds'][] = $r['id'];
     }
     $res->close();
     // $browserActionsClass->copy($p);
     $browserActionsClass->objectsClass = new \CB\Objects();
     $browserActionsClass->doRecursiveAction('copy', $p['sourceIds'], $p['targetId']);
 }
开发者ID:sebbie42,项目名称:casebox,代码行数:36,代码来源:Listeners.php


示例3: delete

 /**
  * delete a record by its id
  * @param  int     $id
  * @return boolean
  */
 public static function delete($id)
 {
     static::validateParamTypes(array('id' => $id));
     DB\dbQuery('DELETE from `' . static::$tableName . '` ' . 'WHERE id = $1', $id) or die(DB\dbQueryError());
     $rez = DB\dbAffectedRows() > 0;
     return $rez;
 }
开发者ID:austinvernsonger,项目名称:casebox,代码行数:12,代码来源:Base.php


示例4: getContentItems

 public function getContentItems()
 {
     $p =& $this->requestParams;
     $folderTemplates = \CB\Config::get('folder_templates');
     $p['fl'] = 'id,system,path,name,case,date,date_end,size,cid,oid,cdate,uid,udate,template_id,acl_count,cls,status,task_status,dstatus';
     if (@$p['from'] == 'tree') {
         $p['templates'] = $folderTemplates;
     }
     if (is_numeric($this->lastNode->id)) {
         $p['pid'] = $pid;
     }
     $p['dstatus'] = 1;
     $p['fq'] = $this->fq;
     $s = new \CB\Search();
     $rez = $s->query($p);
     if (!empty($rez['data'])) {
         for ($i = 0; $i < sizeof($rez['data']); $i++) {
             $d =& $rez['data'][$i];
             $res = DB\dbQuery('SELECT cfg
                   , (SELECT 1
                      FROM tree
                      WHERE pid = $1' . (@$p['from'] == 'tree' ? ' AND `template_id` IN (0' . implode(',', $folderTemplates) . ')' : '') . ' LIMIT 1) has_childs
                 FROM tree
                 WHERE id = $1', $d['id']) or die(DB\dbQueryError());
             if ($r = $res->fetch_assoc()) {
                 $d['cfg'] = Util\toJSONArray($r['cfg']);
                 $d['has_childs'] = !empty($r['has_childs']);
             }
             $res->close();
         }
     }
     return $rez;
 }
开发者ID:austinvernsonger,项目名称:casebox,代码行数:33,代码来源:RecycleBin.php


示例5: read

 /**
  * read objects data in bulk manner
  * @param  array $ids
  * @return array
  */
 public static function read($ids)
 {
     $rez = array();
     $ids = Util\toNumericArray($ids);
     if (!empty($ids)) {
         $sql = 'SELECT t.*
                 ,ti.pids
                 ,ti.path
                 ,ti.case_id
                 ,ti.acl_count
                 ,ti.security_set_id
                 ,o.data
                 ,o.sys_data
             FROM tree t
             JOIN tree_info ti
                 ON t.id = ti.id
             LEFT JOIN objects o
                 ON t.id = o.id
             WHERE t.id in (' . implode(',', $ids) . ')';
         $res = DB\dbQuery($sql) or die(DB\dbQueryError());
         while ($r = $res->fetch_assoc()) {
             $r['data'] = Util\jsonDecode($r['data']);
             $r['sys_data'] = Util\jsonDecode($r['sys_data']);
             $rez[] = $r;
         }
         $res->close();
     }
     return $rez;
 }
开发者ID:ameliefranco,项目名称:casebox,代码行数:34,代码来源:Objects.php


示例6: checkTableExistance

 public static function checkTableExistance()
 {
     return DB\dbQuery('CREATE TABLE IF NOT EXISTS `guids`(
             `id` bigint(20) unsigned NOT NULL  auto_increment ,
             `name` varchar(200) COLLATE utf8_general_ci NOT NULL  ,
             PRIMARY KEY (`id`) ,
             UNIQUE KEY `guids_name`(`name`)
         ) ENGINE=InnoDB DEFAULT CHARSET=\'utf8\' COLLATE=\'utf8_general_ci\'', array());
 }
开发者ID:sebbie42,项目名称:casebox,代码行数:9,代码来源:GUID.php


示例7: deleteByNodeId

 public static function deleteByNodeId($nodeId, $userId = false)
 {
     if ($userId == false) {
         $userId = \CB\User::getId();
     }
     DB\dbQuery('DELETE FROM ' . static::getTableName() . ' WHERE user_id = $1 AND node_id = $2', array($userId, $nodeId)) or die(DB\dbQueryError());
     $rez = DB\dbAffectedRows() > 0;
     return $rez;
 }
开发者ID:youprofit,项目名称:casebox,代码行数:9,代码来源:Favorites.php


示例8: delete

 /**
  * delete core record form __casebox.cores table
  * and drop database
  * @param  varchar $idOrName
  * @return boolean
  */
 public static function delete($idOrName)
 {
     $id = static::toId($idOrName);
     $data = static::read($id);
     $rez = parent::delete($id);
     if ($rez) {
         $dbName = Config::get('prefix') . '_' . $data['name'];
         DB\dbQuery("DROP DATABASE `{$dbName}`") or die(DB\dbQueryError());
     }
     return $rez;
 }
开发者ID:youprofit,项目名称:casebox,代码行数:17,代码来源:Core.php


示例9: getName

 public function getName($id = false)
 {
     if ($id == false) {
         $id = $this->id;
     }
     $rez = 'no name';
     $res = DB\dbQuery('SELECT name FROM tree WHERE id = $1', $id) or die(DB\dbQueryError());
     if ($r = $res->fetch_assoc()) {
         $rez = $r['name'];
     }
     $res->close();
     return $rez;
 }
开发者ID:youprofit,项目名称:casebox,代码行数:13,代码来源:Offices.php


示例10: getRecords

 /**
  * update a record
  * @param  array $p array with properties
  * @return array
  */
 public static function getRecords($ids)
 {
     $rez = array();
     $ids = Util\toNumericArray($ids);
     $res = DB\dbQuery('SELECT *
         FROM `' . static::getTableName() . '`
         WHERE id in (0' . implode(',', $ids) . ')');
     while ($r = $res->fetch_assoc()) {
         $rez[] = $r;
     }
     $res->close();
     return $rez;
 }
开发者ID:sebbie42,项目名称:casebox,代码行数:18,代码来源:Log.php


示例11: getVersionByMD5

 /**
  * get oldest version ids after a given skipCount
  * @param  int     $fileId
  * @param  varchar $md5
  * @return array   | false
  */
 public static function getVersionByMD5($fileId, $md5)
 {
     $rez = array();
     $res = DB\dbQuery('SELECT f.*
         FROM files_versions f
         JOIN files_content c ON f.content_id = c.id
             AND c.md5 = $2
         WHERE f.file_id = $1', array($fileId, $md5));
     if ($r = $res->fetch_assoc()) {
         $rez = $r;
     }
     return $rez;
 }
开发者ID:sebbie42,项目名称:casebox,代码行数:19,代码来源:FilesVersions.php


示例12: copy

 /**
  * copy a record
  * @param  int     $id
  * @return boolean
  */
 public static function copy($sourceId, $targetId)
 {
     DB\dbQuery('INSERT INTO `objects`
             (`id`
             ,`data`
             ,`sys_data`)
         SELECT
             $2
             ,`data`
             ,`sys_data`
         FROM `objects`
         WHERE id = $1', array($sourceId, $targetId)) or die(DB\dbQueryError());
     return DB\dbAffectedRows() > 0;
 }
开发者ID:youprofit,项目名称:casebox,代码行数:19,代码来源:Objects.php


示例13: getName

 public function getName($id = false)
 {
     if ($id == false) {
         $id = $this->id;
     }
     $rez = 'no name';
     $res = DB\dbQuery('SELECT name, iconCls FROM templates WHERE id = $1', $id);
     if ($r = $res->fetch_assoc()) {
         $rez = $r['name'];
         $this->iconCls = $r['iconCls'];
     }
     $res->close();
     return $rez;
 }
开发者ID:sebbie42,项目名称:casebox,代码行数:14,代码来源:TaskTypes.php


示例14: readNames

 /**
  * read recods in bulk for given names
  * @param  array       $names
  * @return associative array ('name' => id)
  */
 public static function readNames($names)
 {
     $rez = array();
     $params = array();
     for ($i = 1; $i <= sizeof($names); $i++) {
         $params[] = '$' . $i;
     }
     $sql = 'SELECT id, name
         FROM ' . static::getTableName() . '
         WHERE name in (' . implode(',', $params) . ')';
     $res = DB\dbQuery($sql, $names) or die(DB\dbQueryError());
     while ($r = $res->fetch_assoc()) {
         $rez[$r['name']] = $r['id'];
     }
     $res->close();
     return $rez;
 }
开发者ID:ameliefranco,项目名称:casebox,代码行数:22,代码来源:GUID.php


示例15: getContentPaths

 /**
  * get relative content paths for given file ids
  * path is relative to casebox files directory
  * @param  array $ids
  * @return array associative array (id => relative_content_path)
  */
 public static function getContentPaths($ids)
 {
     $rez = array();
     $ids = Util\toNumericArray($ids);
     if (!empty($ids)) {
         $sql = 'SELECT f.id, c.`path`, f.content_id
             FROM files f
             JOIN files_content c
                 ON f.content_id = c.id
             WHERE f.id in (' . implode(',', $ids) . ')';
         $res = DB\dbQuery($sql) or die(DB\dbQueryError());
         while ($r = $res->fetch_assoc()) {
             $rez[$r['id']] = $r['path'] . DIRECTORY_SEPARATOR . $r['content_id'];
         }
         $res->close();
     }
     return $rez;
 }
开发者ID:ameliefranco,项目名称:casebox,代码行数:24,代码来源:Files.php


示例16: readAll

 public static function readAll()
 {
     $rez = array();
     $sql = 'SELECT *
         FROM ' . static::getTableName() . '
         ORDER BY pid';
     $res = DB\dbQuery($sql . ', `order`');
     //order by 'order' field also
     //backward compatibility
     if (empty($res)) {
         $res = DB\dbQuery($sql);
     }
     while ($r = $res->fetch_assoc()) {
         $rez[] = $r;
     }
     $res->close();
     return $rez;
 }
开发者ID:sebbie42,项目名称:casebox,代码行数:18,代码来源:Config.php


示例17: create

 /**
  * add a record
  * @param  array $p associative array with table field values
  * @return int   created id
  */
 public static function create($p)
 {
     parent::create($p);
     //prepare params
     $params = array(empty($p['object_id']) ? null : $p['object_id'], empty($p['object_pid']) ? null : $p['object_pid'], empty($p['user_id']) ? null : $p['user_id'], empty($p['action_type']) ? null : $p['action_type'], empty($p['data']) ? null : $p['data'], empty($p['data']) ? null : $p['data'], empty($p['activity_data_db']) ? null : $p['activity_data_db'], empty($p['activity_data_solr']) ? null : $p['activity_data_solr']);
     //add database record
     $sql = 'INSERT INTO `' . static::$tableName . '` (
           `object_id`
           ,`object_pid`
           ,`user_id`
           ,`action_type`
           ,`data`
           ,`activity_data_db`
           ,`activity_data_solr`
         ) VALUES ($1, $2, $3, $4, $5, $6, $7)';
     DB\dbQuery($sql, $params) or die(DB\dbQueryError());
     $rez = DB\dbLastInsertId();
     return $rez;
 }
开发者ID:austinvernsonger,项目名称:casebox,代码行数:24,代码来源:Log.php


示例18: loadAll

 /**
  * load all plugins from database
  *
  * @return void
  */
 public function loadAll()
 {
     if (!empty($this->loaded)) {
         return $this->items;
     }
     $this->items = array();
     $res = DB\dbQuery('SELECT id
             ,name
             ,cfg
             ,`active`
             ,`order`
         FROM ' . \CB\PREFIX . '_casebox.plugins
         ORDER BY `order`') or die(DB\dbQueryError());
     while ($r = $res->fetch_assoc()) {
         $r['cfg'] = Util\toJSONArray($r['cfg']);
         $this->items[$r['name']] = $r;
     }
     $res->close();
     $this->loaded = true;
 }
开发者ID:austinvernsonger,项目名称:casebox,代码行数:25,代码来源:Collection.php


示例19: prepare

 /**
  * executing preimporting changes to target core
  * @return void
  */
 protected function prepare()
 {
     //update template types
     DB\dbQuery("ALTER TABLE `templates`\n              CHANGE `type` `type` ENUM('case','object','file','task','user','email','template','field','search','comment','shortcut','menu','config')\n              CHARSET utf8 COLLATE utf8_general_ci NULL") or die(DB\dbQueryError());
     // set templates template id in config
     $ids = DM\Templates::getIdsByType('template');
     $id = array_shift($ids);
     BBM::$cfg['templatesTemplateId'] = $id;
     // $this->cfg['templates']['Menu rule']['fields']['template_ids']['cfg']['templates'] = $id;
     // $this->cfg['templates']['Menu rule']['fields']['menu']['cfg']['templates'] = $id;
     // detect fields template id
     $ids = DM\Templates::getIdsByType('field');
     $id = array_shift($ids);
     BBM::$cfg['fieldTemplateId'] = $id;
     //detect folderTemplateId
     $ids = Config::get('folder_templates');
     if (!empty($ids)) {
         BBM::$cfg['folderTemplateId'] = array_shift($ids);
     }
     //create "Config" folder under templates to store our config templates there
     //and update BBM::$cfg['templatesFolderId'] to our folder id
     $o = new \CB\Objects\Object();
     $rootId = Browser::getRootFolderId();
     $this->systemFolderId = Objects::getChildId($rootId, 'System');
     $pid = Objects::getChildId($rootId, 'Templates');
     if (empty($pid)) {
         if (!empty($this->systemFolderId)) {
             $pid = Objects::getChildId($this->systemFolderId, 'Templates');
         }
     }
     $id = $o->create(array('id' => null, 'pid' => $pid, 'template_id' => BBM::$cfg['folderTemplateId'], 'name' => 'Config', 'data' => array('_title' => 'Config')));
     BBM::$cfg['templatesFolderId'] = $id;
     //create System/Config folder for transferring config options
     $pid = Objects::getChildId($rootId, 'System');
     if (empty($pid)) {
         $pid = $o->create(array('id' => null, 'pid' => $rootId, 'template_id' => BBM::$cfg['folderTemplateId'], 'name' => 'System', 'data' => array('_title' => 'System')));
     }
     $this->cfg['configFolderId'] = $o->create(array('id' => null, 'pid' => $pid, 'template_id' => BBM::$cfg['folderTemplateId'], 'name' => 'Config', 'data' => array('_title' => 'Config')));
 }
开发者ID:youprofit,项目名称:casebox,代码行数:43,代码来源:UpgradeConfigModel.php


示例20: doRecursiveAction

 /**
  * recursive objects moving or copying
  * @param  int|array $objectIds source object ids
  * @param  int       $targetId  target id
  * @return array     processed ids
  */
 public function doRecursiveAction($action, $objectIds, $targetId)
 {
     $rez = array();
     if (!is_array($objectIds)) {
         $objectIds = Util\toNumericArray($objectIds);
     }
     if (empty($objectIds)) {
         return false;
     }
     foreach ($objectIds as $objectId) {
         $newId = null;
         // check if object with same name exist in target
         $existentTargetId = $this->overwriteCheck($objectId, $targetId);
         if ($existentTargetId == false) {
             // copy by creating a new object in target or just move
             switch ($action) {
                 case 'copy':
                     $newId = $this->objectsClass->copy($objectId, $targetId);
                     break;
                 case 'move':
                     $newId = $this->objectsClass->move($objectId, $targetId);
                     break;
             }
         } else {
             switch ($action) {
                 case 'copy':
                     $newId = $this->objectsClass->copy($objectId, $targetId, $existentTargetId);
                     break;
                 case 'move':
                     $newId = $this->objectsClass->move($objectId, $targetId, $existentTargetId);
                     break;
             }
         }
         // skip childs copy if object not copied/moved
         if (empty($newId)) {
             continue;
         }
         $rez[] = $newId;
         // skip childs moving if moved object is itself
         if ($newId == $objectId) {
             continue;
         }
         // select direct childs of the objects and make a recursive call with them
         $res = DB\dbQuery('SELECT t.id
             FROM tree t
             JOIN tree_info ti ON
                 t.id = ti.id ' . $this->securitySetsFilter . '
             WHERE t.pid = $1 AND t.dstatus = 0', $objectId);
         $childIds = array();
         while ($r = $res->fetch_assoc()) {
             $childIds[] = $r['id'];
         }
         $res->close();
         $this->doRecursiveAction($action, $childIds, $newId);
     }
     return $rez;
 }
开发者ID:sebbie42,项目名称:casebox,代码行数:63,代码来源:Actions.php



注:本文中的CB\DB\dbQuery函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP DB\dbQueryError函数代码示例发布时间:2022-05-23
下一篇:
PHP Table\UserTable类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap