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

PHP Grammars\Grammar类代码示例

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

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



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

示例1: rollBack

 /**
  * Rollback the active database transaction.
  *
  * @return void
  */
 public function rollBack()
 {
     if ($this->transactions == 1) {
         $this->getPdo()->rollBack();
     } elseif ($this->transactions > 1 && $this->queryGrammar->supportsSavepoints()) {
         $this->getPdo()->exec($this->queryGrammar->compileSavepointRollBack('trans' . $this->transactions));
     }
     $this->transactions = max(0, $this->transactions - 1);
     $this->fireConnectionEvent('rollingBack');
 }
开发者ID:timpressive,项目名称:art-auction,代码行数:15,代码来源:Connection.php


示例2: rollBack

 /**
  * Rollback the active database transaction.
  *
  * @param  int|null  $toLevel
  * @return void
  */
 public function rollBack($toLevel = null)
 {
     if (is_null($toLevel)) {
         $toLevel = $this->transactions - 1;
     }
     if ($toLevel < 0 || $toLevel >= $this->transactions) {
         return;
     }
     if ($toLevel == 0) {
         $this->getPdo()->rollBack();
     } elseif ($this->queryGrammar->supportsSavepoints()) {
         $this->getPdo()->exec($this->queryGrammar->compileSavepointRollBack('trans' . ($toLevel + 1)));
     }
     $this->transactions = $toLevel;
     $this->fireConnectionEvent('rollingBack');
 }
开发者ID:bryanashley,项目名称:framework,代码行数:22,代码来源:Connection.php


示例3: getMockConnection

 protected function getMockConnection()
 {
     $connection = m::mock('Illuminate\\Database\\Connection');
     $connection->shouldReceive('getQueryGrammar')->andReturn($grammar = new Grammar());
     $grammar->setTablePrefix('prefix_');
     $connection->shouldReceive('getPostProcessor')->andReturn(m::mock('Illuminate\\Database\\Query\\Processors\\Processor'));
     $connection->shouldReceive('getPdo')->andReturn($pdo = m::mock('stdClass'));
     return $connection;
 }
开发者ID:sohailaammarocs,项目名称:lfc,代码行数:9,代码来源:IlluminateWorkerTest.php


示例4: compileInsert

 /**
  * Compile an insert statement into SQL.
  *
  * @param  Illuminate\Database\Query\Builder  $query
  * @param  array  $values
  * @return string
  */
 public function compileInsert(Builder $query, array $values)
 {
     // Essentially we will force every insert to be treated as a batch insert which
     // simply makes creating the SQL easier for us since we can utilize the same
     // basic routine regardless of an amount of records given to us to insert.
     $table = $this->wrapTable($query->from);
     if (!is_array(reset($values))) {
         $values = array($values);
     }
     // If there is only one record being inserted, we will just use the usual query
     // grammar insert builder because no special syntax is needed for the single
     // row inserts in SQLite. However, if there are multiples, we'll continue.
     if (count($values) == 1) {
         return parent::compileInsert($query, $values[0]);
     }
     $names = $this->columnize(array_keys($values[0]));
     $columns = array();
     // SQLite requires us to build the multi-row insert as a listing of select with
     // unions joining them together. So we'll build out this list of columns and
     // then join them all together with select unions to complete the queries.
     foreach (array_keys($values[0]) as $column) {
         $columns[] = '? as ' . $this->wrap($column);
     }
     $columns = array_fill(9, count($values), implode(', ', $columns));
     return "insert into {$table} ({$names}) select " . implode(' union select ', $columns);
 }
开发者ID:defra91,项目名称:levecchiecredenze.it,代码行数:33,代码来源:SQLiteGrammar.php


示例5: compileSelect

 /**
  * Compile a select query into SQL.
  *
  * @param  \Illuminate\Database\Query\Builder  $query
  * @return string
  */
 public function compileSelect(Builder $query)
 {
     $sql = parent::compileSelect($query);
     if ($query->unions) {
         $sql = '(' . $sql . ') ' . $this->compileUnions($query);
     }
     return $sql;
 }
开发者ID:timpressive,项目名称:art-auction,代码行数:14,代码来源:MySqlGrammar.php


示例6: compileFrom

 /**
  * Compile the "from" portion of the query.
  *
  * @param  \Illuminate\Database\Query\Builder  $query
  * @param  string  $table
  * @return string
  */
 protected function compileFrom(Builder $query, $table)
 {
     $from = parent::compileFrom($query, $table);
     if (is_string($query->lock)) {
         return $from . ' ' . $query->lock;
     }
     if (!is_null($query->lock)) {
         return $from . ' with(rowlock,' . ($query->lock ? 'updlock,' : '') . 'holdlock)';
     }
     return $from;
 }
开发者ID:swaz999,项目名称:appointmentsystem,代码行数:18,代码来源:SqlServerGrammar.php


示例7: compileUpdate

 /**
  * Compile an update statement into SQL.
  *
  * @param  \Illuminate\Database\Query\Builder  $query
  * @param  array  $values
  * @return string
  */
 public function compileUpdate(Builder $query, $values)
 {
     $sql = parent::compileUpdate($query, $values);
     if (isset($query->orders)) {
         $sql .= ' ' . $this->compileOrders($query, $query->orders);
     }
     if (isset($query->limit)) {
         $sql .= ' ' . $this->compileLimit($query, $query->limit);
     }
     return rtrim($sql);
 }
开发者ID:GeorgeBroadley,项目名称:caffeine-vendor,代码行数:18,代码来源:MySqlGrammar.php


示例8: delete

 /**
  * Delete a record from the database.
  *
  * @param  array  $values
  * @return int
  */
 public function delete($id = null)
 {
     // If an ID is passed to the method, we will set the where clause to check
     // the ID to allow developers to simply and quickly remove a single row
     // from their database without manually specifying the where clauses.
     if (!is_null($id)) {
         $this->where('id', '=', $id);
     }
     $sql = $this->grammar->compileDelete($this);
     return $this->connection->delete($sql, $this->bindings);
 }
开发者ID:hochanh,项目名称:Bootsoft-Bowling,代码行数:17,代码来源:Builder.php


示例9: compileSelect

 /**
  * Compile a select query into SQL.
  *
  * @param  \Illuminate\Database\Query\Builder
  * @return string
  */
 public function compileSelect(Builder $query)
 {
     $sql = parent::compileSelect($query);
     if ($query->unions) {
         $sql = '(' . $sql . ') ' . $this->compileUnions($query);
     }
     if (isset($query->limit) || isset($query->offset)) {
         $limit = isset($query->limit) ? ' first ' . (int) $query->limit : '';
         $offset = isset($query->offset) ? ' skip ' . (int) $query->offset : '';
         $sql = str_replace("select", "select" . $limit . $offset, $sql);
     }
     return $sql;
 }
开发者ID:sagetarian,项目名称:laravel-database-extensions,代码行数:19,代码来源:FirebirdGrammar.php


示例10: truncate

 /**
  * Run a truncate statement on the table.
  *
  * @return void
  */
 public function truncate()
 {
     foreach ($this->grammar->compileTruncate($this) as $sql => $bindings) {
         $this->connection->statement($sql, $bindings);
     }
 }
开发者ID:denise92,项目名称:cms,代码行数:11,代码来源:Builder.php


示例11: wrapTable

 /**
  * Wrap a table in keyword identifiers.
  *
  * @param  \Illuminate\Database\Query\Expression|string  $table
  * @return string
  */
 public function wrapTable($table)
 {
     return $this->wrapTableValuedFunction(parent::wrapTable($table));
 }
开发者ID:sonfordson,项目名称:Laravel-Fundamentals,代码行数:10,代码来源:SqlServerGrammar.php


示例12: wrapValue

 /**
  * Wrap a single string in keyword identifiers.
  *
  * @param  string  $value
  * @return string
  */
 protected function wrapValue($value)
 {
     if (Config::get('oracledb::database.quoting') === true) {
         return parent::wrapValue($value);
     }
     return $value;
 }
开发者ID:mickael83,项目名称:Laravel-OracleDB,代码行数:13,代码来源:OracleGrammar.php


示例13: prepareBindingsForUpdate

 /**
  * Prepare the bindings for an update statement.
  *
  * @param  array  $bindings
  * @param  array  $values
  * @return array
  */
 public function prepareBindingsForUpdate(array $bindings, array $values)
 {
     foreach ($values as $column => $value) {
         if ($this->isJsonSelector($column) && in_array(gettype($value), ['boolean', 'integer', 'double'])) {
             unset($values[$column]);
         }
     }
     return parent::prepareBindingsForUpdate($bindings, $values);
 }
开发者ID:bryanashley,项目名称:framework,代码行数:16,代码来源:MySqlGrammar.php


示例14: wrapValue

 /**
  * Wrap a single string in keyword identifiers.
  *
  * @param  string $value
  * @return string
  */
 protected function wrapValue($value)
 {
     if ($this->isReserved($value)) {
         return parent::wrapValue($value);
     }
     return $value !== '*' ? sprintf($this->wrapper, $value) : $value;
 }
开发者ID:rafael-renan-pacheco,项目名称:laravel-oci8,代码行数:13,代码来源:OracleGrammar.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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