久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<tfoot id='wGfrU'></tfoot>
  • <legend id='wGfrU'><style id='wGfrU'><dir id='wGfrU'><q id='wGfrU'></q></dir></style></legend>

        • <bdo id='wGfrU'></bdo><ul id='wGfrU'></ul>

        <small id='wGfrU'></small><noframes id='wGfrU'>

      1. <i id='wGfrU'><tr id='wGfrU'><dt id='wGfrU'><q id='wGfrU'><span id='wGfrU'><b id='wGfrU'><form id='wGfrU'><ins id='wGfrU'></ins><ul id='wGfrU'></ul><sub id='wGfrU'></sub></form><legend id='wGfrU'></legend><bdo id='wGfrU'><pre id='wGfrU'><center id='wGfrU'></center></pre></bdo></b><th id='wGfrU'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='wGfrU'><tfoot id='wGfrU'></tfoot><dl id='wGfrU'><fieldset id='wGfrU'></fieldset></dl></div>
      2. 我可以在 Laravel 中集成自定義 PDO 包裝器嗎

        Can I integrate a custom PDO wrapper in Laravel(我可以在 Laravel 中集成自定義 PDO 包裝器嗎)

            • <legend id='69Wze'><style id='69Wze'><dir id='69Wze'><q id='69Wze'></q></dir></style></legend>
                <tbody id='69Wze'></tbody>

                <tfoot id='69Wze'></tfoot>

                <small id='69Wze'></small><noframes id='69Wze'>

                <i id='69Wze'><tr id='69Wze'><dt id='69Wze'><q id='69Wze'><span id='69Wze'><b id='69Wze'><form id='69Wze'><ins id='69Wze'></ins><ul id='69Wze'></ul><sub id='69Wze'></sub></form><legend id='69Wze'></legend><bdo id='69Wze'><pre id='69Wze'><center id='69Wze'></center></pre></bdo></b><th id='69Wze'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='69Wze'><tfoot id='69Wze'></tfoot><dl id='69Wze'><fieldset id='69Wze'></fieldset></dl></div>

                  <bdo id='69Wze'></bdo><ul id='69Wze'></ul>
                • 本文介紹了我可以在 Laravel 中集成自定義 PDO 包裝器嗎的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我和我的同事正在嘗試使用 Laravel 和 Vertica 數據庫開發 Web 應用程序.唯一的問題是,一旦您對這個特定數據庫使用 bindValue 或 bindParam,PHP 就會因分段錯誤而崩潰.所以我編寫了一個 PDO 包裝器類,它將調用重定向到 PHP_ODBC 模塊并且它確實有效.我現在想知道如果這樣的事情可能的話,如何將它集成到 Laravel 中.

                  My fellows at work and I are trying to develop a web application using Laravel with a Vertica database. The only problem is that as soon as you use bindValue or bindParam with this specific database, PHP crashes with a segmentation fault. So I've written a PDO wrapper class that redirects calls to the PHP_ODBC module and that actually works. I was now wondering how to integrate it in Laravel if such a thing is even possible.

                  推薦答案

                  好的,經過大量的反復試驗,我和我的同事設法使事情順利進行.結果證明,最耗時的部分是構建包裝器.假設你有這個,下面是你需要做的將它集成到 Laravel 中(順便說一下,這些步驟適用于 Laravel 5.1).此外,我的包裝器稱為 PDOVertica,因此每當您看到這個術語時,您都必須將其替換為您自己的包裝器的名稱.

                  Okay so after a lot of trial and error, my co-workers and I managed to get things up and running. The most time-consuming part turned out to build the wrapper. Assuming you have that, here's what you need to do to integrate it in Laravel (these steps are for Laravel 5.1 by the way). Also, my wrapper's called PDOVertica so whenever you see this term, you have to substitute it for the name of your own wrapper.

                  1) 將您的包裝文件復制到以下文件夾:

                  1) Copy your wrapper file to the following folder:

                  vendor/laravel/framework/src/Illuminate/Database/Connectors
                  

                  2) 接下來,您需要修改幾個文件:

                  2) Next, you need to modify a couple of files:

                  vendorlaravelframeworksrcIlluminateDatabaseConnection.php

                  vendorlaravelframeworksrcIlluminateDatabaseConnection.php

                  namespace IlluminateDatabase;
                  
                  use PDO;
                  use PDOVertica; //Add this line
                  use Closure;
                  use DateTime;
                  ...
                  //Change the type of the first parameter to PDOVertica as follow
                  
                  public function __construct(PDOVertica $pdo, $database = '', $tablePrefix = '', array $config = [])
                  

                  vendorlaravelframeworksrcIlluminateDatabaseConnectorsConnector.php

                  vendorlaravelframeworksrcIlluminateDatabaseConnectorsConnector.php

                  namespace IlluminateDatabaseConnectors;
                  include 'clsPDOVertica.php'; //Add this line
                  use PDO;
                  use PDOVertica; //Add this line
                  ...
                  
                  public function createConnection($dsn, array $config, array $options)
                  {
                      $username = array_get($config, 'username');
                      $password = array_get($config, 'password');
                  
                      //Modify the return value to return your wrapper
                      return new PDOVertica($dsn, $username, $password, $options);
                  }
                  

                  vendorlaravelframeworksrcIlluminateDatabaseConnectorsPostgresConnector.php

                  vendorlaravelframeworksrcIlluminateDatabaseConnectorsPostgresConnector.php

                  protected function getDsn(array $config)
                  {
                  
                      extract($config);
                  
                      $host = isset($host) ? "Server={$host};" : '';
                  
                      // Modify this line so that it creates the Vertica DSN. 
                      // It should look something like this.
                      $dsn = "Driver=/opt/vertica/lib64/libverticaodbc.so;{$host}Database={$database}";
                  
                      if (isset($config['port'])) {
                          $dsn .= ";port={$port}";
                      }
                  
                      if (isset($config['sslmode'])) {
                          $dsn .= ";sslmode={$sslmode}";
                      }
                  
                          return $dsn;
                  }
                  

                  vendorlaravelframeworksrcIlluminateDatabaseConnectorsConnectionFactory.php

                  vendorlaravelframeworksrcIlluminateDatabaseConnectorsConnectionFactory.php

                  namespace IlluminateDatabaseConnectors;
                  
                  use PDO;
                  use PDOVertica; //Add this line
                  use InvalidArgumentException;
                  ...
                  
                  // Modify the header of this function so that the $connection parameter
                  // is of type PDOVertica
                  protected function createConnection($driver, PDOVertica $connection, $database, $prefix = '', array $config = [])
                  {
                      if ($this->container->bound($key = "db.connection.{$driver}")) {
                          return $this->container->make($key, [$connection, $database, $prefix, $config]);
                      }
                  
                      switch ($driver) {
                          case 'mysql':
                              return new MySqlConnection($connection, $database, $prefix, $config);
                  
                          case 'pgsql':
                              return new PostgresConnection($connection, $database, $prefix, $config);
                  
                          case 'sqlite':
                              return new SQLiteConnection($connection, $database, $prefix, $config);
                  
                          case 'sqlsrv':
                              return new SqlServerConnection($connection, $database, $prefix, $config);
                      }
                  
                      throw new InvalidArgumentException("Unsupported driver [$driver]");
                  }
                  

                  3) 一旦文件被正確修改,您所要做的就是通過修改以下文件正確配置 Laravel 以使用您的自定義連接:

                  3) Once the files have been properly modified, all you have to do is properly configure Laravel to use your custom connection by modifying the following file:

                  config/database.php

                  config/database.php

                  /*   |--------------------------------------------------------------------------
                  | Default Database Connection Name
                  |--------------------------------------------------------------------------
                  |
                  | Here you may specify which of the database connections below you wish
                  | to use as your default connection for all database work. Of course
                  | you may use many connections at once using the Database library.
                  |
                  */
                  
                  'default' => 'vertica',
                  
                  ...
                  
                  'connections' => [
                  
                      'sqlite' => [
                          'driver'   => 'sqlite',
                          'database' => storage_path('database.sqlite'),
                          'prefix'   => '',
                      ],
                  
                      'mysql' => [
                          'driver'    => 'mysql',
                          'host'      => env('DB_HOST', ''),
                          'database'  => env('DB_DATABASE', ''),
                          'username'  => env('DB_USERNAME', ''),
                          'password'  => env('DB_PASSWORD', ''),
                          'port'      => '5433h',
                          'charset'   => 'utf8',
                          'collation' => 'utf8_unicode_ci',
                          'prefix'    => '',
                          'strict'    => false,
                      ],
                  
                      //This is our custom connection
                      'vertica' => [
                          'driver'    => 'pgsql',
                          'host'      => env('DB_HOST', '192.168.1.1'),
                          'database'  => env('DB_DATABASE', 'mydb'),
                          'username'  => env('DB_USERNAME', 'myuser'),
                          'password'  => env('DB_PASSWORD', 'mypassword'),
                          'port'      => '5433',
                          'charset'  => 'utf8',
                          'schema'  => 'myschema',
                      ],
                  
                      'pgsql' => [
                          'driver'   => 'pgsql',
                          'host'     => env('DB_HOST', 'localhost'),
                          'database' => env('DB_DATABASE', 'forge'),
                          'username' => env('DB_USERNAME', 'forge'),
                          'password' => env('DB_PASSWORD', ''),
                          'port'      => '5433',
                          'charset'  => 'utf8',
                          'prefix'   => '',
                          'schema'   => 'public',
                      ],
                  
                      'sqlsrv' => [
                          'driver'   => 'sqlsrv',
                          'host'     => env('DB_HOST', 'localhost'),
                          'database' => env('DB_DATABASE', 'forge'),
                          'username' => env('DB_USERNAME', 'forge'),
                          'password' => env('DB_PASSWORD', ''),
                          'prefix'   => '',
                      ],
                  
                  ],
                  

                  據我所知,這是讓 Laravel 連接到 Vertica 數據庫而不會崩潰所需的所有步驟.我希望這會有所幫助.

                  So far as I could tell, this was all the steps needed to get Laravel to connect to a Vertica database without crashing. I hope this helps.

                  這篇關于我可以在 Laravel 中集成自定義 PDO 包裝器嗎的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Deadlock exception code for PHP, MySQL PDOException?(PHP、MySQL PDOException 的死鎖異常代碼?)
                  PHP PDO MySQL scrollable cursor doesn#39;t work(PHP PDO MySQL 可滾動游標不起作用)
                  PHP PDO ODBC connection(PHP PDO ODBC 連接)
                  Using PDO::FETCH_CLASS with Magic Methods(使用 PDO::FETCH_CLASS 和魔術方法)
                  php pdo get only one value from mysql; value that equals to variable(php pdo 只從 mysql 獲取一個值;等于變量的值)
                  MSSQL PDO could not find driver(MSSQL PDO 找不到驅動程序)

                          <small id='umqss'></small><noframes id='umqss'>

                            <bdo id='umqss'></bdo><ul id='umqss'></ul>
                            <legend id='umqss'><style id='umqss'><dir id='umqss'><q id='umqss'></q></dir></style></legend><tfoot id='umqss'></tfoot>
                            <i id='umqss'><tr id='umqss'><dt id='umqss'><q id='umqss'><span id='umqss'><b id='umqss'><form id='umqss'><ins id='umqss'></ins><ul id='umqss'></ul><sub id='umqss'></sub></form><legend id='umqss'></legend><bdo id='umqss'><pre id='umqss'><center id='umqss'></center></pre></bdo></b><th id='umqss'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='umqss'><tfoot id='umqss'></tfoot><dl id='umqss'><fieldset id='umqss'></fieldset></dl></div>

                              <tbody id='umqss'></tbody>
                            主站蜘蛛池模板: 国产精品日韩高清伦字幕搜索 | 99这里只有精品视频 | 欧美精品在线免费观看 | 精品一区二区三区不卡 | 理论片87福利理论电影 | 国产精品精品3d动漫 | 欧美日韩成人影院 | 久久久一二三 | 色免费在线视频 | 国产成人免费视频网站高清观看视频 | 91视在线国内在线播放酒店 | 亚洲一级黄色 | 欧美日韩精品一区二区天天拍 | 国产a级黄色录像 | 亚洲精品综合一区二区 | 日本网站在线看 | 国产黄色大片在线免费观看 | 伊人久久综合 | 国产一区视频在线 | 久久久国产精品一区 | 亚洲成人一二三 | 91久久精品国产91久久 | 日韩福利一区 | 精品国产一区二区三区久久狼黑人 | 亚洲一区视频在线 | 另类亚洲视频 | 日韩在线中文字幕 | 久久久一| 久久专区| 精品无码久久久久国产 | 成人网视频 | 日韩欧美综合 | 污污免费网站 | 极品国产视频 | 亚洲成人一区二区三区 | 99久久日韩精品免费热麻豆美女 | 久久综合亚洲 | 国产国产精品久久久久 | 男人电影天堂 | 污视频免费在线观看 | 草草草草视频 |