From 8a6295cbde3b9d02071f0ccd4ff5783cfcb7f945 Mon Sep 17 00:00:00 2001 From: Gabriel Tadra Mainginski <13179626@uepg.br> Date: Mon, 23 Jan 2017 11:08:14 -0200 Subject: [PATCH 1/3] Fix #28 --- Database/SybaseConnection.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Database/SybaseConnection.php b/Database/SybaseConnection.php index 854a774..7ddef75 100644 --- a/Database/SybaseConnection.php +++ b/Database/SybaseConnection.php @@ -133,7 +133,18 @@ private function compileForSelect(Builder $builder, $bindings) { $new_format[$tables] = []; } - $wheres = (array)$builder->wheres; + $wheres = []; + foreach($builder->wheres as $w){ + switch($w['type']){ + case "Basic": + array_push($wheres, $w); + break; + case "Nested": + $wheres += $w['query']->wheres; + break; + } + } + var_dump($wheres); $i = 0; for($ind = 0; $ind < count($wheres); $ind++ ){ if(isset($wheres[$ind]['value'])){ From e310bd1af874c89f2eb4867ec735dee66af38409 Mon Sep 17 00:00:00 2001 From: Gabriel Mainginski Date: Mon, 23 Jan 2017 13:17:35 -0200 Subject: [PATCH 2/3] Removing a var_dump that entered by mistake. --- Database/SybaseConnection.php | 1 - 1 file changed, 1 deletion(-) diff --git a/Database/SybaseConnection.php b/Database/SybaseConnection.php index 7ddef75..a0a1271 100644 --- a/Database/SybaseConnection.php +++ b/Database/SybaseConnection.php @@ -144,7 +144,6 @@ private function compileForSelect(Builder $builder, $bindings) { break; } } - var_dump($wheres); $i = 0; for($ind = 0; $ind < count($wheres); $ind++ ){ if(isset($wheres[$ind]['value'])){ From 73806459fdb9b3b00148144145cda20357e1e0ba Mon Sep 17 00:00:00 2001 From: Gabriel Tadra Mainginski <13179626@uepg.br> Date: Tue, 24 Jan 2017 08:52:20 -0200 Subject: [PATCH 3/3] Make compatible with Laravel < 5.3 --- Database/SybaseConnection.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Database/SybaseConnection.php b/Database/SybaseConnection.php index 7ddef75..73b5d05 100644 --- a/Database/SybaseConnection.php +++ b/Database/SybaseConnection.php @@ -136,7 +136,7 @@ private function compileForSelect(Builder $builder, $bindings) { $wheres = []; foreach($builder->wheres as $w){ switch($w['type']){ - case "Basic": + default: array_push($wheres, $w); break; case "Nested": @@ -144,7 +144,6 @@ private function compileForSelect(Builder $builder, $bindings) { break; } } - var_dump($wheres); $i = 0; for($ind = 0; $ind < count($wheres); $ind++ ){ if(isset($wheres[$ind]['value'])){ @@ -351,7 +350,6 @@ public function compileOffset($offset, $query, $bindings = array(), $me){ $res_primaries = $identity->column.'+0 AS '.$identity->column; $where_primaries = "#tmpPaginate.".$identity->column.' = #tmpTable.'.$identity->column; } - //Offset operation $this->getPdo()->query(str_replace(" from ", " into #tmpPaginate from ", $this->compileNewQuery($query, $bindings))); $this->getPdo()->query("SELECT ".$res_primaries.", idTmp=identity(18) INTO #tmpTable FROM #tmpPaginate"); @@ -373,13 +371,11 @@ public function select($query, $bindings = array(), $useReadPdo = true) return $this->run($query, $bindings, function($me, $query, $bindings) use ($useReadPdo) { if ($me->pretending()) return array(); - if($this->queryGrammar->getBuilder() != NULL){ $offset = $this->queryGrammar->getBuilder()->offset; }else{ $offset = 0; } - if($offset>0){ return $this->compileOffset($offset, $query, $bindings, $me); }else{ @@ -414,4 +410,4 @@ public function affectingStatement($query, $bindings = array()) return $this->getPdo()->query($this->compileNewQuery($query, $bindings))->rowCount(); }); } -} +} \ No newline at end of file