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

PHP Statement类代码示例

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

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



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

示例1: createStatement

 protected function createStatement(\Lrs $lrs, \Client $client, array $statement)
 {
     $model = new \Statement(['lrs_id' => new \MongoId($lrs->_id), 'client_id' => $client->_id, 'statement' => $statement, 'active' => true, 'voided' => false, 'refs' => []]);
     $model->timestamp = new \MongoDate(strtotime($model->statement['timestamp']));
     $model->save();
     return $model;
 }
开发者ID:scmc,项目名称:learninglocker,代码行数:7,代码来源:StatementsTestCase.php


示例2: assemble

 public function assemble(Statement $statement, $useTableNameAsAlias)
 {
     $table = $statement->getTable($this->tableAlias);
     list($referencedDatasetName, $referencedColumnName) = ReferencePathHelper::splitReference($this->columnName);
     $column = $table->findColumnByAlias($referencedColumnName);
     return ' = ' . ColumnNameHelper::combineColumnName($table->prepareColumnTableAlias($useTableNameAsAlias), isset($column) && $column instanceof ColumnSection ? $column->name : $referencedColumnName);
 }
开发者ID:ecs-hk,项目名称:Checkbook,代码行数:7,代码来源:WhereSection.php


示例3: dumpResult

 /**
  * Displays complete result set as HTML table for debug purposes.
  * @return void
  */
 public static function dumpResult(Statement $statement)
 {
     echo "\n<table class=\"dump\">\n<caption>" . htmlSpecialChars($statement->queryString) . "</caption>\n";
     if (!$statement->columnCount()) {
         echo "\t<tr>\n\t\t<th>Affected rows:</th>\n\t\t<td>", $statement->rowCount(), "</td>\n\t</tr>\n</table>\n";
         return;
     }
     $i = 0;
     foreach ($statement as $row) {
         if ($i === 0) {
             echo "<thead>\n\t<tr>\n\t\t<th>#row</th>\n";
             foreach ($row as $col => $foo) {
                 echo "\t\t<th>" . htmlSpecialChars($col) . "</th>\n";
             }
             echo "\t</tr>\n</thead>\n<tbody>\n";
         }
         echo "\t<tr>\n\t\t<th>", $i, "</th>\n";
         foreach ($row as $col) {
             //if (is_object($col)) $col = $col->__toString();
             echo "\t\t<td>", htmlSpecialChars($col), "</td>\n";
         }
         echo "\t</tr>\n";
         $i++;
     }
     if ($i === 0) {
         echo "\t<tr>\n\t\t<td><em>empty result set</em></td>\n\t</tr>\n</table>\n";
     } else {
         echo "</tbody>\n</table>\n";
     }
 }
开发者ID:riskatlas,项目名称:micka,代码行数:34,代码来源:Helpers.php


示例4: __construct

 /**
  * Constructs a conditional statement.
  *
  * @param string                                           $condition      The condition statement
  * @param \Helmich\TypoScriptParser\Parser\AST\Statement[] $ifStatements   The statements in the if-branch.
  * @param \Helmich\TypoScriptParser\Parser\AST\Statement[] $elseStatements The statements in the else-branch (may be empty).
  * @param int                                              $sourceLine     The original source line.
  */
 public function __construct($condition, array $ifStatements, array $elseStatements, $sourceLine)
 {
     parent::__construct($sourceLine);
     $this->condition = $condition;
     $this->ifStatements = $ifStatements;
     $this->elseStatements = $elseStatements;
 }
开发者ID:hexa2k9,项目名称:typo3-typoscript-parser,代码行数:15,代码来源:ConditionalStatement.php


示例5: courses

 public function courses()
 {
     $courses = array();
     $return_results = array();
     foreach ($this->data as $d) {
         if (isset($d['context']['contextActivities'])) {
             foreach ($d['context']['contextActivities']['grouping'] as $key => $value) {
                 if ($key === 'type' && $value == 'http://adlnet.gov/expapi/activities/course') {
                     $courses[] = $d['context']['contextActivities']['grouping']['id'];
                 }
             }
         }
     }
     $array = array_count_values($courses);
     arsort($array);
     $results = array_slice($array, 0, 4);
     foreach ($results as $key => $value) {
         $get_name = \Statement::where('context.contextActivities.grouping.id', $key)->first();
         if (isset($get_name['context']['contextActivities']['grouping']['definition']['name']['en-gb'])) {
             $return_results[] = array('name' => $get_name['context']['contextActivities']['grouping']['definition']['name']['en-gb'], 'count' => $value);
         } else {
             $return_results[] = array('name' => $get_name['context']['contextActivities']['grouping']['definition']['name']['en-GB'], 'count' => $value);
         }
     }
     $this->results = $return_results;
 }
开发者ID:scmc,项目名称:learninglocker,代码行数:26,代码来源:Filter.php


示例6: fire

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $lrs_collection = (new Lrs())->get();
     // Remove all inactive statements.
     Statement::where('active', '=', false)->delete();
     // Migrates the statements for each LRS.
     foreach ($lrs_collection as $lrs) {
         Statement::where('lrs._id', $lrs->_id)->chunk(500, function ($statements) use($lrs) {
             $statements_array = [];
             // Sets `active` and `voided` properties.
             // Ensures that statement is an associative array.
             $statements = $statements->each(function ($statement) {
                 $statement->voided = isset($statement->voided) ? $statement->voided : false;
                 $statement->active = isset($statement->active) ? $statement->active : true;
                 $statement->save();
                 $statements_array[] = (array) json_decode($statement->toJSON());
             });
             // Uses the repository to migrate the statements.
             $repo = App::make('Locker\\Repository\\Statement\\EloquentVoider');
             $repo->updateReferences($statements_array, $lrs);
             $repo->voidStatements($statements_array, $lrs);
             // Outputs status.
             $statement_count = $statements->count();
             $this->info("Migrated {$statement_count} statements in `{$lrs->title}`.");
         });
     }
     $this->info('All statements migrated.');
 }
开发者ID:scmc,项目名称:learninglocker,代码行数:33,代码来源:StatementMigrateCommand.php


示例7: actorCount

 /**
  * Count the number of distinct actors within Learning Locker statements.
  *
  * @return count.
  *
  **/
 public function actorCount()
 {
     $mbox = intval(\Statement::distinct('statement.actor.mbox')->remember(5)->get()->count());
     $openid = intval(\Statement::distinct('statement.actor.openid')->remember(5)->get()->count());
     $mbox_sha1sum = intval(\Statement::distinct('statement.actor.mbox_sha1sum')->remember(5)->get()->count());
     $account = intval(\Statement::distinct('statement.actor.account.name')->remember(5)->get()->count());
     return $mbox + $openid + $mbox_sha1sum + $account;
 }
开发者ID:ervinMagic,项目名称:learninglocker,代码行数:14,代码来源:AdminDashboard.php


示例8: testExecute2

 /**
  * @covers Phossa\Db\Pdo\Statement::prepare()
  * @covers Phossa\Db\Pdo\Statement::execute()
  */
 public function testExecute2()
 {
     // must emulate
     $this->driver->setAttribute('PDO::ATTR_EMULATE_PREPARES', true);
     $this->statement->prepare("SELECT :idx, :color");
     $res = $this->statement->execute(['idx' => 1, 'color' => 'red']);
     $this->assertEquals([[1 => "1", "red" => "red"]], $res->fetchRow());
 }
开发者ID:phossa,项目名称:phossa-db,代码行数:12,代码来源:StatementTest.php


示例9: __construct

 function __construct($surname, $name, $patronymic, $email, $tel, $form)
 {
     $this->surname = Statement::checkData($surname);
     $this->name = Statement::checkData($name);
     $this->patronymic = Statement::checkData($patronymic);
     $this->email = Statement::checkData($email);
     $this->tel = Statement::checkData($tel);
     $this->form = Statement::checkData($form);
 }
开发者ID:Klym,项目名称:sp-dnr,代码行数:9,代码来源:Agent.php


示例10: setStatement

 public function setStatement(Statement $st)
 {
     $this->_statement = $st;
     $this->_original_data['id'] = $st->getId();
     $this->_original_data['answer'] = $st->getAnswer();
     $this->_original_data['text'] = $this->getParse()->decodeBBCodes($st->getText(), false);
     $this->_original_data['title'] = $st->getTitle();
     $this->_original_data['type'] = $st->getType();
     $this->_original_data['category'] = $st->getCategory();
     $this->_original_data['status'] = $st->getStatus();
 }
开发者ID:dautushenka,项目名称:DLE-Statement,代码行数:11,代码来源:editStatement.php


示例11: testValid

 /**
  * @covers Gacela\Collection\Statement::valid
  */
 public function testValid()
 {
     foreach ($this->collection as $obj) {
         if ($this->collection->key() < 7) {
             $this->assertTrue($this->collection->valid());
         } else {
             $this->assertFalse($this->collection->valid());
         }
     }
 }
开发者ID:energylab,项目名称:gacela,代码行数:13,代码来源:StatementTest.php


示例12: deleteAndSave

 /**
  * Delete the reference and push the change to the database
  *
  * @param string $summary summary for the change
  * @throws Exception
  */
 public function deleteAndSave($summary = '')
 {
     $id = $this->statement->getId();
     if ($id === null) {
         throw new Exception('Statement has no Id. Please save the statement first.');
     }
     if ($this->hash !== null) {
         $this->statement->getEntity()->getApi()->removeReferences($id, array($this->hash), $this->statement->getEntity()->getLastRevisionId(), $summary);
     }
     $this->statement->removeReference($this);
 }
开发者ID:tpt,项目名称:wikibase-api-php,代码行数:17,代码来源:Reference.php


示例13: fire

 /**
  * Execute the console command.
  *
  * Loop through all statements and create a new key in the document route.
  * This key 'convertedTimestamp' is the same as the statement timestamp but in a 
  * data format the MongoDB aggregation function needs.
  * 
  * @return string
  */
 public function fire()
 {
     Statement::chunk(1000, function ($statements) {
         foreach ($statements as $s) {
             $s->timestamp = new \MongoDate(strtotime($s->statement['timestamp']));
             $s->save();
         }
         $this->info(count($statements) . ' converted.');
     });
     $this->info('All finished, hopefully!');
 }
开发者ID:scmc,项目名称:learninglocker,代码行数:20,代码来源:ConvertTimestamp.php


示例14: __construct

 /**
  * Constructor
  *
  * @param resource $pdooci    PDOOCI connection
  * @param string   $statement sql statement
  *
  * @return Statement $statement created
  */
 public function __construct($pdooci, $statement)
 {
     try {
         $this->_pdooci = $pdooci;
         $this->_con = $pdooci->getConnection();
         $this->_statement = Statement::insertMarks($statement);
         $this->_stmt = \oci_parse($this->_con, $this->_statement);
         $this->_fetch_sty = \PDO::FETCH_BOTH;
     } catch (\Exception $e) {
         throw new \PDOException($e->getMessage());
     }
 }
开发者ID:grzchr15,项目名称:pdooci,代码行数:20,代码来源:Statement.php


示例15: logQuery

 public function logQuery(Statement $result, array $params = NULL)
 {
     if ($this->disabled) {
         return;
     }
     $source = NULL;
     foreach (PHP_VERSION_ID < 50205 ? debug_backtrace() : debug_backtrace(FALSE) as $row) {
         if (isset($row['file']) && is_file($row['file']) && strpos($row['file'], NETTE_DIR . DIRECTORY_SEPARATOR) !== 0) {
             if (isset($row['function']) && strpos($row['function'], 'call_user_func') === 0) {
                 continue;
             }
             if (isset($row['class']) && is_subclass_of($row['class'], '\\Nette\\Database\\Connection')) {
                 continue;
             }
             $source = array($row['file'], (int) $row['line']);
             break;
         }
     }
     $this->totalTime += $result->getTime();
     $this->queries[] = array($result->queryString, $params, $result->getTime(), $result->rowCount(), $result->getConnection(), $source);
 }
开发者ID:riskatlas,项目名称:micka,代码行数:21,代码来源:ConnectionPanel.php


示例16: equals

 public function equals(Statement $toTest)
 {
     if ($toTest instanceof Statement && $this->getSubject()->equals($toTest->getSubject()) && $this->getPredicate()->equals($toTest->getPredicate()) && $this->getObject()->equals($toTest->getObject())) {
         if ($this->isQuad() && $toTest->isQuad() && $this->getGraph()->equals($toTest->getGraph())) {
             return true;
         } elseif ($this->isTriple() && $toTest->isTriple()) {
             return true;
         }
     }
     return false;
 }
开发者ID:guitarmarx,项目名称:Saft,代码行数:11,代码来源:AbstractStatement.php


示例17: up

 public function up()
 {
     Statement::chunk(1000, function ($statements) {
         foreach ($statements as $statement) {
             if (is_object($statement->refs) || is_array($statement->refs) && isset($statement->refs['id'])) {
                 $statement->refs = [$statement->refs];
                 $statement->save();
             }
         }
         echo count($statements) . ' converted.';
     });
     echo 'All finished, hopefully!';
 }
开发者ID:scmc,项目名称:learninglocker,代码行数:13,代码来源:2015_03_26_164005_statement_ref_array.php


示例18: __construct

 public function __construct(Statement $statement)
 {
     try {
         $this->crit = $statement->getCriteria();
         if ($this->crit instanceof Criteria) {
             if ($this->crit->action == 'insert') {
                 $this->insert_id = $statement->getInsertID();
             } elseif ($this->crit->action == 'select') {
                 while ($row = $statement->fetch()) {
                     $this->rows[] = new Row($row, $statement);
                 }
                 $this->max_ptr = count($this->rows);
                 $this->int_ptr = 0;
             } elseif ($this->crit->action = 'count') {
                 $value = $statement->fetch();
                 $this->max_ptr = $value['num_col'];
             }
         }
     } catch (\Exception $e) {
         throw $e;
     }
 }
开发者ID:thebuggenie,项目名称:b2db,代码行数:22,代码来源:Resultset.php


示例19: find

 public function find()
 {
     $f = [];
     /* get all fields and build a sentence to AQL find with params */
     if (!empty($this->post)) {
         foreach ($this->post as $k => $v) {
             $f[] = "u.{$k} == @{$k}";
         }
     }
     $filter = !empty($f) ? ' filter ' . implode($f, ' && ') : '';
     $query = "FOR u IN " . COLLECTION_NAME . $filter . $this->limit . $this->sort . " RETURN u";
     $statement = new Statement($this->connection, ["query" => $query, "count" => true, "bindVars" => $this->post]);
     $cursor = $statement->execute();
     $total = $this->collectionHandler->count(COLLECTION_NAME);
     $result = ['count' => $cursor->getCount(), 'total' => $total, 'pages' => $total > 0 ? $total / PER_PAGE : $total];
     /* transform in array  */
     foreach ($cursor->getAll() as $key => $value) {
         if (is_object($cursor->getAll()[$key])) {
             $result["result"][$key] = get_object_vars($cursor->getAll()[$key]);
         }
     }
     echo json_encode($result);
 }
开发者ID:vinigomescunha,项目名称:ArangoDB-Ajax-PHP-Example,代码行数:23,代码来源:ArangoDB.class.php


示例20: generateResultStatementsFromVarResult

function generateResultStatementsFromVarResult(&$result, $parsedq, &$outm, $closure, &$model)
{
    foreach ($parsedq['patterns'] as $n => $pattern) {
        if (substr($pattern['subject']['value'], 0, 1) == '?') {
            $subj = $result[$pattern['subject']['value']];
        } else {
            $subj = new Resource($pattern['subject']['value']);
        }
        if (substr($pattern['predicate']['value'], 0, 1) == '?') {
            $pred = $result[$pattern['predicate']['value']];
        } else {
            $pred = new Resource($pattern['predicate']['value']);
        }
        if (substr($pattern['object']['value'], 0, 1) == '?') {
            $obj = $result[$pattern['object']['value']];
        } else {
            if ($pattern['object']['is_literal']) {
                $obj = new Literal($pattern['object']['value']);
                $obj->setDatatype($pattern['object']['l_dtype']);
                $obj->setLanguage($pattern['object']['l_lang']);
            } else {
                $obj = new Resource($pattern['object']['value']);
            }
        }
        $stmt = new Statement($subj, $pred, $obj);
        // bNode closure
        if (is_a($stmt->object(), 'BlankNode') && $closure == True) {
            getBNodeClosure($stmt->object(), $model, $outm);
        }
        if (is_a($stmt->subject(), 'BlankNode') && $closure == True) {
            getBNodeClosure($stmt->subject(), $model, $outm);
        }
        // Add statement to model
        $outm->add($stmt);
    }
}
开发者ID:komagata,项目名称:plnet,代码行数:36,代码来源:rdql.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP StatementBuilder类代码示例发布时间:2022-05-23
下一篇:
PHP State类代码示例发布时间: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