本文整理汇总了PHP中Illuminate\Database\MySqlConnection类的典型用法代码示例。如果您正苦于以下问题:PHP MySqlConnection类的具体用法?PHP MySqlConnection怎么用?PHP MySqlConnection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MySqlConnection类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: withTablePrefix
/**
* Set the table prefix and return the grammar.
*
* @param \Illuminate\Database\Grammar $grammar
* @return \Illuminate\Database\Grammar
* @static
*/
public static function withTablePrefix($grammar)
{
//Method inherited from \Illuminate\Database\Connection
return \Illuminate\Database\MySqlConnection::withTablePrefix($grammar);
}
示例2: PDO
<?php
use BapCat\Persist\Drivers\Local\LocalDriver;
use BapCat\Phi\Phi;
use BapCat\Remodel\Registry;
use BapCat\Remodel\EntityDefinition;
use BapCat\Session\DatabaseSessionServiceProvider;
use BapCat\Session\SessionManager;
use Illuminate\Database\ConnectionInterface;
use Illuminate\Database\MySqlConnection;
require __DIR__ . '/../vendor/autoload.php';
require __DIR__ . '/DoItUserAuthorizer.php';
$pdo = new PDO('mysql:host=localhost;dbname=test', 'root', '');
$connection = new MySqlConnection($pdo, 'test');
$connection->setFetchMode(PDO::FETCH_ASSOC);
$ioc = Phi::instance();
$ioc->bind(ConnectionInterface::class, $connection);
// Grab filesystem directories
$persist = new LocalDriver(__DIR__ . '/..');
$cache = $persist->getDirectory('/cache');
$registry = new Registry($ioc, $cache);
$sp = new DatabaseSessionServiceProvider($ioc, $registry);
$sp->register();
$sp->boot();
$session = $ioc->make(SessionManager::class);
$session->open();
$auth = new DoItUserAuthorizer($session);
示例3: getSchemaBuilder
public function getSchemaBuilder()
{
$schemaBuilder = parent::getSchemaBuilder();
$schemaBuilder->blueprintResolver(function ($table, $callback) {
return new Blueprint($table, $callback);
});
return $schemaBuilder;
}
示例4: getSchemaBuilder
/**
* Get a schema builder instance for the connection.
*
* @return \Illuminate\Database\Schema\MySqlBuilder
*/
public function getSchemaBuilder()
{
$parentBuilder = parent::getSchemaBuilder();
// add a blueprint resolver closure that returns the custom blueprint
$parentBuilder->blueprintResolver(function ($table, $callback) {
return new Blueprint($table, $callback);
});
return $parentBuilder;
}
示例5: selectFromWriteConnection
public function selectFromWriteConnection($query, $bindings = [])
{
return parent::select($query, $bindings, false);
}