當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Statement類代碼示例

本文整理匯總了PHP中Statement的典型用法代碼示例。如果您正苦於以下問題:PHP Statement類的具體用法?PHP Statement怎麽用?PHP Statement使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Statement類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: getID

 public function getID()
 {
     if ($this->id_col === null) {
         $this->id_col = $this->_statement->getCriteria()->getTable()->getIdColumn();
     }
     return $this->get($this->id_col);
 }
開發者ID:thebuggenie,項目名稱:b2db,代碼行數:7,代碼來源:Row.php

示例15: array

 function __construct($name, $value, $operator = null, \Kinesis\Task $parent = null)
 {
     if (is_null($operator)) {
         $operator = '=';
     }
     $params = array('Name' => $name, 'Value' => $value, 'Operator' => $operator);
     parent::__construct($params, $parent);
 }
開發者ID:Kinetical,項目名稱:Kinesis,代碼行數:8,代碼來源:Where.php


注:本文中的Statement類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。