clean code
This commit is contained in:
parent
e8f17c13a7
commit
ecba8b0b03
@ -45,7 +45,7 @@ Add the laravel-db2 Service Provider to your config in ``app/config/app.php``:
|
|||||||
|
|
||||||
There are two ways to configure laravel-db2. You can choose the most convenient way for you. You can put your DB2 credentials into ``app/config/database.php`` (option 1) file or use package config file which you can be generated through command line by artisan (option 2).
|
There are two ways to configure laravel-db2. You can choose the most convenient way for you. You can put your DB2 credentials into ``app/config/database.php`` (option 1) file or use package config file which you can be generated through command line by artisan (option 2).
|
||||||
|
|
||||||
#### Option 1: Configure DB2 using ``app/config/database.php`` file
|
#### Option 1: Configure DB2 using ``app/config/database.php`` file
|
||||||
|
|
||||||
Simply add this code at the end of your ``app/config/database.php`` file:
|
Simply add this code at the end of your ``app/config/database.php`` file:
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ class DB2ServiceProvider extends ServiceProvider {
|
|||||||
|
|
||||||
//Create a connector
|
//Create a connector
|
||||||
$this->app['db']->extend($conn, function($config)
|
$this->app['db']->extend($conn, function($config)
|
||||||
{
|
{
|
||||||
switch ($config['driver']) {
|
switch ($config['driver']) {
|
||||||
case 'odbc':
|
case 'odbc':
|
||||||
$connector = new ODBCConnector();
|
$connector = new ODBCConnector();
|
||||||
|
@ -6,7 +6,7 @@ use Illuminate\Database\Query\Builder;
|
|||||||
|
|
||||||
class DB2Grammar extends Grammar
|
class DB2Grammar extends Grammar
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wrap a single string in keyword identifiers.
|
* Wrap a single string in keyword identifiers.
|
||||||
*
|
*
|
||||||
|
@ -48,7 +48,7 @@ class DB2Processor extends Processor {
|
|||||||
$sequenceStr = $grammar->columnize($sequence);
|
$sequenceStr = $grammar->columnize($sequence);
|
||||||
}
|
}
|
||||||
$sql = 'select ' . $sequenceStr . ' from new table (' . $sql;
|
$sql = 'select ' . $sequenceStr . ' from new table (' . $sql;
|
||||||
$sql .= ')';
|
$sql .= ')';
|
||||||
$results = $query->getConnection()->select($sql, $values);
|
$results = $query->getConnection()->select($sql, $values);
|
||||||
if (is_array($sequence))
|
if (is_array($sequence))
|
||||||
{
|
{
|
||||||
@ -60,7 +60,6 @@ class DB2Processor extends Processor {
|
|||||||
$id = $result[$sequenceStr];
|
$id = $result[$sequenceStr];
|
||||||
return is_numeric($id) ? (int) $id : $id;
|
return is_numeric($id) ? (int) $id : $id;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,6 @@ class Blueprint extends \Illuminate\Database\Schema\Blueprint {
|
|||||||
$index = $this->createIndexName($type, $columns);
|
$index = $this->createIndexName($type, $columns);
|
||||||
return $this->addCommand($type, compact('index', 'indexSystem', 'columns'));
|
return $this->addCommand($type, compact('index', 'indexSystem', 'columns'));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ class Builder extends \Illuminate\Database\Schema\Builder {
|
|||||||
if (count($schemaTable) > 1)
|
if (count($schemaTable) > 1)
|
||||||
{
|
{
|
||||||
$schema = $schemaTable[0];
|
$schema = $schemaTable[0];
|
||||||
$table = $this->connection->getTablePrefix().$schemaTable[1];
|
$table = $this->connection->getTablePrefix().$schemaTable[1];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -92,7 +92,7 @@ class DB2Grammar extends Grammar {
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function compileLabel(Blueprint $blueprint, Fluent $command, Connection $connection)
|
public function compileLabel(Blueprint $blueprint, Fluent $command, Connection $connection)
|
||||||
{
|
{
|
||||||
return 'label on table '.$this->wrapTable($blueprint).' is \'' . $command->label . '\'';
|
return 'label on table '.$this->wrapTable($blueprint).' is \'' . $command->label . '\'';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ PDO::CASE_NATURAL
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|
||||||
'connections' => [
|
'connections' => [
|
||||||
|
|
||||||
'ibmi' => [
|
'ibmi' => [
|
||||||
|
Loading…
Reference in New Issue
Block a user