@@ -65,9 +65,9 @@ public function transaction(Closure $callback, $attempts = 1)
6565 $ this ->pdo ->exec ('COMMIT TRAN ' );
6666 }
6767
68- // If we catch an exception, we will roll back so nothing gets messed
69- // up in the database. Then we'll re-throw the exception so it can
70- // be handled how the developer sees fit for their applications.
68+ // If we catch an exception, we will roll back so nothing gets messed
69+ // up in the database. Then we'll re-throw the exception so it can
70+ // be handled how the developer sees fit for their applications.
7171 catch (Exception $ e ) {
7272 $ this ->pdo ->exec ('ROLLBACK TRAN ' );
7373
@@ -150,7 +150,7 @@ private function compile(Builder $builder)
150150 $ cache_columns = env ('SYBASE_CACHE_COLUMNS ' );
151151
152152 foreach ($ arrTables as $ tables ) {
153- preg_match (
153+ preg_match (
154154 "/(?:(?'table'.*)(?: as )(?'alias'.*))|(?'tables'.*)/ " ,
155155 strtolower ($ tables ),
156156 $ alias
@@ -162,10 +162,11 @@ private function compile(Builder $builder)
162162 $ tables = $ alias ['table ' ];
163163 }
164164
165- if ($ cache_columns == true ) {
166- $ aux = Cache::remember ('sybase_columns/ ' .$ tables .'.columns_info ' , env ('SYBASE_CACHE_COLUMNS_TIME ' ) ?? 600 , function () use ($ tables ) {
165+ if ($ cache_columns == true ) {
166+ $ aux = Cache::remember ('sybase_columns/ ' .$ tables .'.columns_info ' , env ('SYBASE_CACHE_COLUMNS_TIME ' ) ?? 600 , function () use ($ tables ) {
167167 $ queryString = $ this ->queryString ($ tables );
168168 $ queryRes = $ this ->getPdo ()->query ($ queryString );
169+
169170 return $ queryRes ->fetchAll (PDO ::FETCH_NAMED );
170171 });
171172 } else {
@@ -188,8 +189,10 @@ private function compile(Builder $builder)
188189
189190 $ keys = [];
190191
191- $ convert = function ($ column , $ v ) use ($ types ) {
192- if (is_null ($ v )) return null ;
192+ $ convert = function ($ column , $ v ) use ($ types ) {
193+ if (is_null ($ v )) {
194+ return null ;
195+ }
193196
194197 $ variable_type = $ types [strtolower ($ column )];
195198
@@ -202,7 +205,7 @@ private function compile(Builder $builder)
202205
203206 if (isset ($ builder ->values )) {
204207 foreach ($ builder ->values as $ key => $ value ) {
205- if (gettype ($ value ) === 'array ' ) {
208+ if (gettype ($ value ) === 'array ' ) {
206209 foreach ($ value as $ k => $ v ) {
207210 $ keys [] = $ convert ($ k , $ v );
208211 }
@@ -230,7 +233,9 @@ private function compile(Builder $builder)
230233 }
231234 }
232235 } elseif ($ w ['type ' ] == 'between ' ) {
233- if (count ($ w ['values ' ]) != 2 ) { return []; }
236+ if (count ($ w ['values ' ]) != 2 ) {
237+ return [];
238+ }
234239 foreach ($ w ['values ' ] as $ v ) {
235240 if (gettype ($ v ) !== 'object ' ) {
236241 $ keys [] = $ convert ($ k , $ v );
@@ -312,7 +317,7 @@ private function queryString($tables)
312317 *
313318 * @param string $query
314319 * @param array $bindings
315- * @return mixed $newBinds
320+ * @return mixed $newBinds
316321 */
317322 private function compileBindings ($ query , $ bindings )
318323 {
@@ -350,16 +355,16 @@ private function compileNewQuery($query, $bindings)
350355 $ bindings = $ this ->compileBindings ($ query , $ bindings );
351356 $ partQuery = explode ('? ' , $ query );
352357
353- $ bindings = array_map (fn ($ v ) => gettype ($ v ) === 'string ' ? str_replace ('\'' , '\'\'' , $ v ) : $ v , $ bindings );
354- $ bindings = array_map (fn ($ v ) => gettype ($ v ) === 'string ' ? "' {$ v }' " : $ v , $ bindings );
358+ $ bindings = array_map (fn ($ v ) => gettype ($ v ) === 'string ' ? str_replace ('\'' , '\'\'' , $ v ) : $ v , $ bindings );
359+ $ bindings = array_map (fn ($ v ) => gettype ($ v ) === 'string ' ? "' {$ v }' " : $ v , $ bindings );
355360
356- $ newQuery = join (array_map (fn ($ k1 , $ k2 ) => $ k1 .$ k2 , $ partQuery , $ bindings ));
361+ $ newQuery = join (array_map (fn ($ k1 , $ k2 ) => $ k1 .$ k2 , $ partQuery , $ bindings ));
357362 $ newQuery = str_replace ('[] ' , '' , $ newQuery );
358363
359364 $ db_charset = env ('DB_CHARSET ' );
360365 $ app_charset = env ('APPLICATION_CHARSET ' );
361366
362- if ($ db_charset && $ app_charset ) {
367+ if ($ db_charset && $ app_charset ) {
363368 $ newQuery = mb_convert_encoding ($ newQuery , $ db_charset , $ app_charset );
364369 }
365370
@@ -389,15 +394,14 @@ public function select($query, $bindings = [], $useReadPdo = true)
389394 $ bindings
390395 ));
391396
392-
393397 $ result = $ statement ->fetchAll ($ this ->getFetchMode ());
394398
395399 $ db_charset = env ('DB_CHARSET ' );
396400 $ app_charset = env ('APPLICATION_CHARSET ' );
397401
398- if ($ db_charset && $ app_charset ) {
399- foreach ($ result as &$ r ) {
400- foreach ($ r as $ k => &$ v ) {
402+ if ($ db_charset && $ app_charset ) {
403+ foreach ($ result as &$ r ) {
404+ foreach ($ r as $ k => &$ v ) {
401405 $ v = gettype ($ v ) === 'string ' ? mb_convert_encoding ($ v , $ app_charset , $ db_charset ) : $ v ;
402406 }
403407 }
@@ -411,7 +415,7 @@ public function select($query, $bindings = [], $useReadPdo = true)
411415 * Get the statement.
412416 *
413417 * @param string $query
414- * @param mixed|array $bindings
418+ * @param mixed|array $bindings
415419 * @return bool
416420 */
417421 public function statement ($ query , $ bindings = [])
0 commit comments