Skip to content

Commit

Permalink
fixed code for use with Laravel 5.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephan Rennert committed Feb 21, 2017
1 parent caa5448 commit 029c930
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#Laravel SQLAnyWhere

Adds an Sybase driver to Laravel 5, usable with Fluent and Eloquent.
Adds an Sybase driver to Laravel 5.4, usable with Fluent and Eloquent.

## Attention
The latest version only works with Laravel 5.4 and higher. For lower
version use [version 1.4.1](https://github.com/pxlcore/laravel-sqlanywhere/tree/v1.4.1).

##Todo
- Migrate integration is not 100%
Expand Down Expand Up @@ -95,4 +99,4 @@ Just add a new array to the `connections` array in `config/database.php`.
]
```

**Don't forget to update your default database connection.**
Don't forget to update your default database connection.
13 changes: 8 additions & 5 deletions src/Pxlcore/SQLAnywhere/SQLAnywhereConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,21 @@ public function __construct(SQLAnywhereClient $pdo, $database = '', $tablePrefix
*/
public function select($query, $bindings = array())
{
return $this->run($query, $bindings, function($me, $query, $bindings)
// new version since Laravel 5.4
// /vendor/laravel/framework/src/Illuminate/Database/Connection.php
// --> function: select(...)
return $this->run($query, $bindings, function($query, $bindings)
{
if ($me->pretending()) return array();
if ($this->pretending()) return array();

// For select statements, we'll simply execute the query and return an array
// of the database result set. Each element in the array will be a single
// row from the database table, and will either be an array or objects.
$statement = $me->getReadPdo()->prepare($query);
$statement = $this->getReadPdo()->prepare($query);

$statement->execute($me->prepareBindings($bindings));
$statement->execute($this->prepareBindings($bindings));

return $statement->fetchAll($me->getFetchMode());
return $statement->fetchAll();
});
}

Expand Down

0 comments on commit 029c930

Please sign in to comment.