Skip to content

Commit 24b5665

Browse files
author
Gabriel Tadra Mainginski
committed
Probably fixed #11 and possible other problems with querys builded without query builder (but all binds will be considered strings by default)
1 parent e1677b6 commit 24b5665

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

Database/SybaseConnection.php

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,12 @@ private function compileBindings($query, $bindings)
150150

151151
switch(explode(' ', $query)[0]){
152152
case "select":
153-
return $this->compileForSelect($this->queryGrammar->getBuilder(), $bindings);
153+
$builder = $this->queryGrammar->getBuilder();
154+
if($builder != NULL && $builder->wheres != NULL){
155+
return $this->compileForSelect($builder, $bindings);
156+
}else{
157+
return $bindings;
158+
}
154159
case "insert":
155160
preg_match("/(?'tables'.*) \((?'attributes'.*)\) values/i" ,$query, $matches);
156161
break;
@@ -264,9 +269,15 @@ public function select($query, $bindings = array(), $useReadPdo = true)
264269
return $this->run($query, $bindings, function($me, $query, $bindings) use ($useReadPdo)
265270
{
266271
if ($me->pretending()) return array();
267-
$offset = $this->queryGrammar->getBuilder()->offset;
268-
$limit = $this->queryGrammar->getBuilder()->limit;
269-
$from = explode(" ", $this->queryGrammar->getBuilder()->from)[0];
272+
273+
if($this->queryGrammar->getBuilder() != NULL){
274+
275+
$offset = $this->queryGrammar->getBuilder()->offset;
276+
$limit = $this->queryGrammar->getBuilder()->limit;
277+
$from = explode(" ", $this->queryGrammar->getBuilder()->from)[0];
278+
}else{
279+
$offset = 0;
280+
}
270281
if($offset>0){
271282
if(!isset($limit)){
272283
$limit = 999999999999999999999999999;

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Sybase ASE based Eloquent module extension for Laravel 5.x.
33
- Enables use of multiple kinds of fields.
44
- Use default eloquent: works with odbc and dblib!
5-
- Migrations!
5+
- Migrations! (alpha)
66

77
### Install
88
- Require in your **composer.json** this package: ``"uepg/laravel-sybase": "1.*"``

0 commit comments

Comments
 (0)