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


PHP Connection::statement方法代码示例

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


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

示例1: drop

 /**
  * function to safely drop trigger db object
  *
  * @param  string $name
  * @return boolean
  */
 public function drop($name)
 {
     if (!$name) {
         return false;
     }
     return $this->connection->statement("\n            declare\n                e exception;\n                pragma exception_init(e,-4080);\n            begin\n                execute immediate 'drop trigger {$name}';\n            exception\n            when e then\n                null;\n            end;");
 }
开发者ID:bryan-mwas,项目名称:Clearance101,代码行数:13,代码来源:Trigger.php

示例2: drop

 /**
  * function to safely drop sequence db object
  *
  * @param  string $name
  * @return boolean
  */
 public function drop($name)
 {
     // check if a valid name and sequence exists
     if (!$name or !$this->exists($name)) {
         return false;
     }
     return $this->connection->statement("\n            declare\n                e exception;\n                pragma exception_init(e,-02289);\n            begin\n                execute immediate 'drop sequence {$name}';\n            exception\n            when e then\n                null;\n            end;");
 }
开发者ID:djob,项目名称:laravel-oci8,代码行数:14,代码来源:Sequence.php

示例3: 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

示例4: disableForeignKeyConstraints

 /**
  * Disable foreign key constraints.
  *
  * @return bool
  */
 public function disableForeignKeyConstraints()
 {
     return $this->connection->statement($this->grammar->compileDisableForeignKeyConstraints());
 }
开发者ID:davidhemphill,项目名称:framework,代码行数:9,代码来源:Builder.php

示例5: build

 /**
  * Execute the statements against the database.
  *
  * @param  array $statements
  * @return void
  */
 protected function build($statements)
 {
     foreach ($statements as $statement) {
         $this->connection->statement($statement);
     }
 }
开发者ID:proai,项目名称:laravel-datamapper,代码行数:12,代码来源:Builder.php

示例6: commentColumn

 /**
  * Run the comment on column statement
  *
  * @param  string $table
  * @param  string $column
  * @param  string $comment
  */
 private function commentColumn($table, $column, $comment)
 {
     $table = $this->wrapValue($table);
     $column = $this->wrapValue($column);
     $this->connection->statement("comment on column {$table}.{$column} is '{$comment}'");
 }
开发者ID:bryan-mwas,项目名称:Clearance101,代码行数:13,代码来源:Comment.php

示例7: revokePrivileges

 /**
  * @param Connection $db
  * @param array      $creds
  * @param string     $fromServer
  *
  * @return bool
  */
 protected function revokePrivileges($db, $creds, $fromServer)
 {
     return $db->transaction(function () use($db, $creds, $fromServer) {
         //  Create users
         $_users = $this->getDatabaseUsers($creds, $fromServer);
         try {
             foreach ($_users as $_user) {
                 //	Grants for instance database
                 if (!($_result = $db->statement('REVOKE ALL PRIVILEGES ON ' . $creds['database'] . '.* FROM ' . $_user))) {
                     $this->error('[provisioning:database] error revoking privileges from "' . $_user . '"');
                     continue;
                 }
                 $this->debug('[provisioning:database] grants revoked - complete');
                 if (!($_result = $db->statement('DROP USER ' . $_user))) {
                     $this->error('[provisioning:database] error dropping user "' . $_user . '"');
                 }
                 $_result && $this->debug('[provisioning:database] users dropped > ', $_users);
             }
             return true;
         } catch (\Exception $_ex) {
             $this->error('[provisioning:database] revoke grants - failure: ' . $_ex->getMessage());
             return false;
         }
     });
 }
开发者ID:rajeshpillai,项目名称:dfe-dreamfactory-provisioner,代码行数:32,代码来源:DatabaseProvisioner.php

示例8: configurePragma

 /**
  * @param \Illuminate\Database\Connection $db
  */
 protected function configurePragma(Connection $db)
 {
     if ($this->configuration['driver'] !== 'sqlite') {
         return;
     }
     // Enable foreign keys for the current connection/file
     $db->statement('PRAGMA foreign_keys = ON;');
     // Create sqlite-journal in memory only (instead of creating disk files)
     $db->statement('PRAGMA journal_mode = MEMORY;');
     // Do not wait for OS after sending write commands
     $db->statement('PRAGMA synchronous = OFF;');
 }
开发者ID:tomzx,项目名称:irc-stats,代码行数:15,代码来源:DatabaseProxy.php

示例9: build

 /**
  * Execute the blueprint against the database.
  *
  * @param  Illuminate\Database\Connection  $connection
  * @param  Illuminate\Database\Schema\Grammars\Grammar $grammar
  * @return void
  */
 public function build(Connection $connection, Grammar $grammar)
 {
     foreach ($this->toSql($grammar) as $statement) {
         $connection->statement($statement);
     }
 }
开发者ID:defra91,项目名称:levecchiecredenze.it,代码行数:13,代码来源:Blueprint.php


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