当前位置: 首页>>代码示例>>PHP>>正文


PHP DibiConnection::query方法代码示例

本文整理汇总了PHP中DibiConnection::query方法的典型用法代码示例。如果您正苦于以下问题:PHP DibiConnection::query方法的具体用法?PHP DibiConnection::query怎么用?PHP DibiConnection::query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DibiConnection的用法示例。


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

示例1: setUp

 protected function setUp()
 {
     $this->db = dibi::getConnection("ormion");
     $this->db->delete("pages")->execute();
     // id, name, description, text, created, allowed
     $this->db->query("insert into [pages]", array("name" => "Clanek", "description" => "Popis", "text" => "Text", "allowed" => true), array("name" => "Article", "description" => "Description", "text" => "Text emericky.", "allowed" => false), array("name" => "Nepovolený článek", "description" => "Popis nepovoleného článku", "text" => "Dlouhý text. By byl delší než tento.", "allowed" => false), array("name" => "Jinačí článek", "description" => "Ryze alternativní popis", "text" => "Duchaplný text.", "allowed" => true));
     $this->object = new Page();
 }
开发者ID:janmarek,项目名称:Ormion,代码行数:8,代码来源:RecordTest.php

示例2: count

    /**
     * @return int
     */
    public function count()
    {
        if ($this->count === NULL) {
            $this->count = $this->connection->query('
				SELECT COUNT(*) FROM', $this->sql)->fetchSingle();
        }
        return $this->count;
    }
开发者ID:laiello,项目名称:webuntucms,代码行数:11,代码来源:DibiDataSource.php

示例3: setUp

 protected function setUp()
 {
     $this->db = dibi::getConnection("ormion");
     $this->db->delete("pages")->execute();
     $this->db->delete("connections")->execute();
     $this->db->delete("tags")->execute();
     $this->db->query("insert into [pages]", array("name" => "Clanek", "description" => "Popis", "text" => "Text", "visits" => 0, "allowed" => true), array("name" => "Article", "description" => "Description", "text" => "Text emericky.", "visits" => 5, "allowed" => false), array("name" => "Nepovolený článek", "description" => "Popis nepovoleného článku", "text" => "Dlouhý text. By byl delší než tento.", "visits" => 3, "allowed" => false), array("name" => "Jinačí článek", "description" => "Ryze alternativní popis", "text" => "Duchaplný text.", "visits" => 8, "allowed" => true));
     $this->db->query("insert into [tags]", array("name" => "Osobní", "url" => "osobni"), array("name" => "Technologie", "url" => "technologie"), array("name" => "Společnost", "url" => "spolecnost"));
 }
开发者ID:janmarek,项目名称:Ormion,代码行数:9,代码来源:ManyToManyTest.php

示例4: canUseGrantType

    /**
     * Can client use given grant type
     * @param string $clientId
     * @param string $grantType
     * @return bool
     */
    public function canUseGrantType($clientId, $grantType)
    {
        $result = $this->context->query('
			SELECT g.name
			FROM oauth_client_grant AS cg
			RIGHT JOIN oauth_grant AS g ON cg.grant_id = cg.grant_id AND g.name = %s
			WHERE cg.client_id = %i
		', $grantType, $clientId);
        return (bool) $result->fetch();
    }
开发者ID:drahak,项目名称:oauth2,代码行数:16,代码来源:ClientStorage.php

示例5: update

 public function update($values)
 {
     if (empty($this->table)) {
         throw new \Natsu\Model\Exception('Cannot update - missing table name in model class');
     }
     //die('update');
     $this->database->query("UPDATE `{$this->table}` SET ", $values, ' WHERE `id`= ?', $values->id);
     // $context = new Nette\Database\Context($this->database);
     // $context->table($this->table)->getPrimary($values->id)->update($values);
     //  $this->table()->wherePrimary($values->id)->update($values);
 }
开发者ID:bombush,项目名称:NatsuCon,代码行数:11,代码来源:EntityModel.php

示例6: setup

 protected function setup()
 {
     parent::setup();
     // Load from DB
     $rules = $this->db->query("SELECT * FROM %n", $this->tableName);
     foreach ($rules as $rule) {
         // If querying the compound name, ensure it exists
         if ($rule->type == 'allow') {
             $this->allow($rule->role, $rule->resource, $rule->privilege);
         } else {
             $this->deny($rule->role, $rule->resource, $rule->privilege);
         }
     }
 }
开发者ID:vbuilder,项目名称:framework,代码行数:14,代码来源:DatabaseAclAuthorizator.php

示例7: authenticate

 /**
  * @inheritDoc
  */
 public function authenticate($clientId, $clientSecret = NULL)
 {
     $clientData = $this->dbConnection->query("SELECT * FROM %n", $this->tableName, "WHERE [clientId] = %s", $clientId)->fetch();
     if ($clientData === FALSE) {
         return FALSE;
     }
     // Check client secret
     if ($clientData->secret !== NULL || $clientSecret !== NULL) {
         if (!$this->hasher->checkPassword($clientSecret, $clientData->secret)) {
             return FALSE;
         }
     }
     return new Client($clientData->clientId);
 }
开发者ID:vbuilder,项目名称:framework,代码行数:17,代码来源:DatabaseClientAuthenticator.php

示例8: fetch

 /**
  * Generates, executes SQL query and fetches the single row.
  * @return array|FALSE  array on success, FALSE if no next record
  * @throws DibiException
  */
 public function fetch()
 {
     if ($this->command === 'SELECT') {
         $this->clauses['LIMIT'] = array(1);
     }
     return $this->connection->query($this->_export())->fetch();
 }
开发者ID:laiello,项目名称:webuntucms,代码行数:12,代码来源:DibiFluent.php

示例9: fetch

 /**
  * Fetches single row.
  * @param  scalar|array  primary key value
  * @return array|object row
  */
 public function fetch($conditions)
 {
     if (is_array($conditions)) {
         return $this->complete($this->connection->query('SELECT * FROM %n', $this->name, 'WHERE %and', $conditions))->fetch();
     }
     return $this->complete($this->connection->query('SELECT * FROM %n', $this->name, 'WHERE %n=' . $this->primaryModifier, $this->primary, $conditions))->fetch();
 }
开发者ID:laiello,项目名称:webuntucms,代码行数:12,代码来源:DibiTable.php

示例10: finishSmokeTest

 /**
  * Run after smoke test
  *
  * Drop test database.
  *
  * @return NULL
  */
 private function finishSmokeTest()
 {
     if (!$this->smokeTest) {
         return;
     }
     $this->dibi->query('DROP DATABASE IF EXISTS %n;', $this->databaseName);
 }
开发者ID:pagewiser,项目名称:db-upgrade,代码行数:14,代码来源:DatabaseUpgradeCommand.php

示例11: query

 /**
  * @return DibiResult
  */
 private function query($args)
 {
     $res = $this->connection->query($args);
     foreach ($this->setups as $setup) {
         call_user_func_array(array($res, array_shift($setup)), $setup);
     }
     return $res;
 }
开发者ID:ludik1,项目名称:transport_company,代码行数:11,代码来源:DibiFluent.php

示例12: match

 public function match(\Nette\Http\IRequest $request)
 {
     /**
      * @var $appRequest \Nette\Application\Request
      */
     $appRequest = parent::match($request);
     if (!isset($appRequest->parameters['id'])) {
         return NULL;
     }
     if (!is_numeric($appRequest->parameters['id'])) {
         $page = $this->database->query("SELECT contentId FROM route WHERE url = ?", $appRequest->parameters['id'])->fetch();
         if ($page == NULL) {
             return NULL;
         }
         $appRequest->parameters['id'] = $page->contentId;
     }
     return $appRequest;
 }
开发者ID:bombush,项目名称:NatsuCon,代码行数:18,代码来源:PageRoute.php

示例13: addContact

 public function addContact($contact)
 {
     try {
         $this->database->query('INSERT INTO [' . self::TABLE_NAME_CONTACT . ']', [self::COLUMN_ID => $contact['id'], self::COLUMN_EMAIL => $contact['email']]);
         return $this->database->getInsertId();
     } catch (Nette\Database\DriverException $e) {
         throw new \Nette\Database\DriverException();
     }
 }
开发者ID:bombush,项目名称:NatsuCon,代码行数:9,代码来源:UserManager.php

示例14: __construct

 public function __construct(\DibiConnection $db)
 {
     //static roles
     $this->addRole('guest');
     $this->addRole('authenticated', 'guest');
     $this->addRole('manager', 'authenticated');
     $this->addRole('administrator', 'manager');
     $this->addRole('student', 'authenticated');
     $this->addRole('teacher', 'authenticated');
     //dynamic roles
     $groups = $db->query("SELECT * FROM `group`")->fetchAll();
     foreach ($groups as $group) {
         if (!$this->hasRole($group->role_name)) {
             $this->addRole($group->role_name, 'authenticated');
         }
     }
     // resources
     $this->addResource('Front:Homepage');
     $this->addResource('Front:Files');
     $this->addResource('Service:Sign');
     $this->addResource('Service:Error');
     $this->addResource('Dashboard:Homepage');
     $this->addResource('Dashboard:Users');
     $this->addResource('Dashboard:Groups');
     $this->addResource('Dashboard:My');
     $this->addResource('Dashboard:Files');
     $this->addResource('Works:Homepage');
     $this->addResource('Works:Sets');
     $this->addResource('Works:Ideas');
     $this->addResource('Works:Assignments');
     $this->addResource('School:Homepage');
     $this->addResource('School:Classes');
     $this->addResource('School:Students');
     $this->addResource('School:Teachers');
     $this->addResource('School:Subjects');
     $this->addResource('School:Groups');
     $this->addResource('School:Import');
     $this->addResource('Delivery:Homepage');
     $this->addResource('Practice:Homepage');
     $this->addResource('Activity:Homepage');
     // privileges
     $this->allow('guest', array('Front:Homepage', 'Service:Sign', "Service:Error"), Permission::ALL);
     $this->allow('authenticated', array('Dashboard:My'), Permission::ALL);
     $this->allow('authenticated', array('Dashboard:Groups'), Permission::ALL);
     $this->allow('authenticated', array('Dashboard:Files'), Permission::ALL);
     $this->allow('authenticated', array('Dashboard:Homepage'), array('default'));
     $this->allow('student', array('Works:Homepage'), array('default'));
     $this->allow('teacher', array('Works:Homepage'), Permission::ALL);
     $this->allow('student', array('Works:Ideas'), array('default', 'add', 'id', 'edit', 'delete', 'clone'));
     $this->allow('teacher', array('Works:Ideas'), Permission::ALL);
     $this->allow('student', array('Works:Assignments'), array('default', 'application'));
     $this->allow('teacher', array('Works:Assignments'), array('default', 'add', 'id', 'edit', 'delete', 'print'));
     $this->allow('teacher', array('School:Homepage', 'School:Teachers', 'School:Classes', 'School:Students', 'School:Subjects', 'School:Groups'), Permission::ALL);
     $this->allow('administrator', Permission::ALL, Permission::ALL);
 }
开发者ID:hajek-raven,项目名称:agenda,代码行数:55,代码来源:acl.php

示例15: createConnection

 public static function createConnection(DI\Container $container)
 {
     $dibiConnection = new \DibiConnection($container->params['database']);
     $dibiConnection->query('SET NAMES UTF8');
     $substitutions = array('core' => 'cms_', 'vd' => 'cms_vd_', 'c' => 'cgf_', 'media' => 'media_');
     foreach ($substitutions as $sub => $prefix) {
         $dibiConnection->getSubstitutes()->{$sub} = $prefix;
     }
     //        $profiler = new \DibiProfiler();
     //        $dibiConnection->setProfiler($profiler);
     //        $dibiConnection->setFile(APP_DIR.'/../log/dibi.log');
     return $dibiConnection;
 }
开发者ID:jurasm2,项目名称:bubo,代码行数:13,代码来源:DibiFactory.php


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