Closed mlntn closed 8 years ago
Thanks for the contribution!
Hi, I think the patch won't use the SchemaGrammar specified in config. This:
protected function getDefaultSchemaGrammar()
{
$class = config('database.connections.odbc.grammar.schema') ?: '\TCK\Odbc\ODBCSchemaGrammar';
return $this->withTablePrefix( new ODBCSchemaGrammar );
}
Should be:
protected function getDefaultSchemaGrammar()
{
$class = config('database.connections.odbc.grammar.schema') ?: '\TCK\Odbc\ODBCSchemaGrammar';
return $this->withTablePrefix( new $class);
}
Also, it would be good to update the readme for newies like I, to know how to specify the grammar:
'odbc' => [
'driver' => 'odbc',
'grammar' => ['query' => '\Illuminate\Database\Query\Grammars\SqlServerGrammar',
'schema' => '\Illuminate\Database\Query\Schema\SqlServerGrammar'
],
'dsn' => 'odbc:YourDSN;',
'host' => '',
'database' => '',
'username' => '',
'password' => '',
],
Yep, I forgot that change. Do you want to create a new pull request and add to the readme?
SQL Server has issues with the default grammar classes. This change allows the grammar to be overwritten via config to use any other grammar classes - including the SQL Server grammar that comes with Laravel/Lumen.