當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。