@@ -42,7 +42,7 @@ class Connection extends IlluminateConnection
4242 /**
4343 * Execute a Closure within a transaction.
4444 *
45- * @param \Closure $callback
45+ * @param \Closure $callback
4646 * @return mixed
4747 *
4848 * @throws \Exception
@@ -64,9 +64,9 @@ public function transaction(Closure $callback, $attempts = 1)
6464 $ this ->pdo ->exec ('COMMIT TRAN ' );
6565 }
6666
67- // If we catch an exception, we will roll back so nothing gets messed
68- // up in the database. Then we'll re-throw the exception so it can
69- // be handled how the developer sees fit for their applications.
67+ // If we catch an exception, we will roll back so nothing gets messed
68+ // up in the database. Then we'll re-throw the exception so it can
69+ // be handled how the developer sees fit for their applications.
7070 catch (Exception $ e ) {
7171 $ this ->pdo ->exec ('ROLLBACK TRAN ' );
7272
@@ -83,7 +83,7 @@ public function transaction(Closure $callback, $attempts = 1)
8383 */
8484 protected function getDefaultQueryGrammar ()
8585 {
86- return $ this -> withTablePrefix ( new QueryGrammar );
86+ return new QueryGrammar ( $ this );
8787 }
8888
8989 /**
@@ -93,7 +93,7 @@ protected function getDefaultQueryGrammar()
9393 */
9494 protected function getDefaultSchemaGrammar ()
9595 {
96- return $ this -> withTablePrefix ( new SchemaGrammar );
96+ return new SchemaGrammar ( $ this );
9797 }
9898
9999 /**
@@ -119,15 +119,15 @@ protected function getDoctrineDriver()
119119 /**
120120 * Compile the bindings for select/insert/update/delete.
121121 *
122- * @param \Illuminate\Database\Query\Builder $builder
122+ * @param \Illuminate\Database\Query\Builder $builder
123123 * @return array
124124 */
125125 private function compile (Builder $ builder )
126126 {
127127 $ arrTables = [];
128128
129129 array_push ($ arrTables , $ builder ->from );
130- if (! empty ($ builder ->joins )) {
130+ if (!empty ($ builder ->joins )) {
131131 foreach ($ builder ->joins as $ join ) {
132132 array_push ($ arrTables , $ join ->table );
133133 }
@@ -178,12 +178,10 @@ private function compile(Builder $builder)
178178
179179 foreach ($ aux as &$ row ) {
180180 $ types [strtolower ($ row ['name ' ])] = $ row ['type ' ];
181- $ types [strtolower ($ tables. '. ' . $ row ['name ' ])] = $ row ['type ' ];
181+ $ types [strtolower ($ tables . '. ' . $ row ['name ' ])] = $ row ['type ' ];
182182
183- if (! empty ($ alias ['alias ' ])) {
184- $ types [
185- strtolower ($ alias ['alias ' ].'. ' .$ row ['name ' ])
186- ] = $ row ['type ' ];
183+ if (!empty ($ alias ['alias ' ])) {
184+ $ types [strtolower ($ alias ['alias ' ] . '. ' . $ row ['name ' ])] = $ row ['type ' ];
187185 }
188186 }
189187 }
@@ -200,7 +198,7 @@ private function compile(Builder $builder)
200198 if (in_array ($ variable_type , $ this ->numeric )) {
201199 return $ v / 1 ;
202200 } else {
203- return (string ) $ v ;
201+ return (string )$ v ;
204202 }
205203 };
206204
@@ -251,7 +249,7 @@ private function compile(Builder $builder)
251249 /**
252250 * Query string.
253251 *
254- * @param string $tables
252+ * @param string $tables
255253 * @return string
256254 */
257255 private function queryString ($ tables )
@@ -289,8 +287,8 @@ private function queryString($tables)
289287 /**
290288 * Set new bindings with specified column types to Sybase.
291289 *
292- * @param string $query
293- * @param array $bindings
290+ * @param string $query
291+ * @param array $bindings
294292 * @return mixed $newBinds
295293 */
296294 private function compileBindings ($ query , $ bindings )
@@ -318,8 +316,8 @@ private function compileBindings($query, $bindings)
318316 *
319317 * @link http://stackoverflow.com/questions/2718628/pdoparam-for-type-decimal
320318 *
321- * @param string $query
322- * @param array $bindings
319+ * @param string $query
320+ * @param array $bindings
323321 * @return string $query
324322 */
325323 private function compileNewQuery ($ query , $ bindings )
@@ -329,13 +327,14 @@ private function compileNewQuery($query, $bindings)
329327 $ bindings = $ this ->compileBindings ($ query , $ bindings );
330328 $ partQuery = explode ('? ' , $ query );
331329
332- $ bindings = array_map (fn ($ v ) => gettype ($ v ) === 'string ' ? str_replace ('\'' , '\'\'' , $ v ) : $ v , $ bindings );
333- $ bindings = array_map (fn ($ v ) => gettype ($ v ) === 'string ' ? "' {$ v }' " : $ v , $ bindings );
334- $ bindings = array_map (fn ($ v ) => gettype ($ v ) === 'NULL ' ? 'NULL ' : $ v , $ bindings );
330+ $ bindings = array_map (fn ($ v ) => gettype ($ v ) === 'string ' ? str_replace ('\'' , '\'\'' , $ v ) : $ v , $ bindings );
331+ $ bindings = array_map (fn ($ v ) => gettype ($ v ) === 'string ' ? "' {$ v }' " : $ v , $ bindings );
332+ $ bindings = array_map (fn ($ v ) => gettype ($ v ) === 'NULL ' ? 'NULL ' : $ v , $ bindings );
335333
336- $ newQuery = join (array_map (fn ($ k1 , $ k2 ) => $ k1. $ k2 , $ partQuery , $ bindings ));
334+ $ newQuery = join (array_map (fn ($ k1 , $ k2 ) => $ k1 . $ k2 , $ partQuery , $ bindings ));
337335 $ newQuery = str_replace ('[] ' , '' , $ newQuery );
338336 $ application_encoding = config ('database.sybase.application_encoding ' );
337+
339338 if (is_null ($ application_encoding ) || $ application_encoding == false ) {
340339 return $ newQuery ;
341340 }
@@ -352,9 +351,9 @@ private function compileNewQuery($query, $bindings)
352351 /**
353352 * Run a select statement against the database.
354353 *
355- * @param string $query
356- * @param array $bindings
357- * @param bool $useReadPdo
354+ * @param string $query
355+ * @param array $bindings
356+ * @param bool $useReadPdo
358357 * @return array
359358 */
360359 public function select ($ query , $ bindings = [], $ useReadPdo = true )
@@ -407,8 +406,8 @@ public function select($query, $bindings = [], $useReadPdo = true)
407406 /**
408407 * Get the statement.
409408 *
410- * @param string $query
411- * @param mixed|array $bindings
409+ * @param string $query
410+ * @param mixed|array $bindings
412411 * @return bool
413412 */
414413 public function statement ($ query , $ bindings = [])
@@ -428,8 +427,8 @@ public function statement($query, $bindings = [])
428427 /**
429428 * Affecting statement.
430429 *
431- * @param string $query
432- * @param array $bindings
430+ * @param string $query
431+ * @param array $bindings
433432 * @return int
434433 */
435434 public function affectingStatement ($ query , $ bindings = [])
0 commit comments