Skip to content

Commit 024aeee

Browse files
andrehankeandrehanke
authored andcommitted
fix: verificação de chaves de config nulas
1 parent f155020 commit 024aeee

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/Database/Connection.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ private function compile(Builder $builder)
148148
}
149149

150150
$cache = $builder->connection->config['cache_tables'];
151-
152151
$types = [];
153152

154153
foreach ($arrTables as $tables) {
@@ -165,10 +164,10 @@ private function compile(Builder $builder)
165164
}
166165

167166
if ($cache) {
168-
$aux = Cache::remember('sybase_columns/'.$tables.'.columns_info', env('SYBASE_CACHE_TABLES_TIME') ?? 3600, function () use ($tables) {
167+
$cacheTime = key_exists('cache_time',$builder->connection->config) ? $builder->connection->config['cache_time'] : 3600;
168+
$aux = cache()->remember("sybase_columns.$tables.columns_info", $cacheTime, function () use ($tables) {
169169
$queryString = $this->queryString($tables);
170170
$queryRes = $this->getPdo()->query($queryString);
171-
172171
return $queryRes->fetchAll(PDO::FETCH_NAMED);
173172
});
174173
} else {
@@ -342,7 +341,7 @@ private function compileNewQuery($query, $bindings)
342341
$newQuery = join(array_map(fn ($k1, $k2) => $k1.$k2, $partQuery, $bindings));
343342
$newQuery = str_replace('[]', '', $newQuery);
344343
$app_encoding = config('database.sybase.app_encoding');
345-
if (! $app_encoding) {
344+
if (is_null($app_encoding)) {
346345
return $newQuery;
347346
}
348347
$db_charset = config('database.sybase.db_charset');
@@ -392,7 +391,7 @@ public function select($query, $bindings = [], $useReadPdo = true)
392391
$result = [...$result];
393392

394393
$app_encoding = config('database.sybase.app_encoding');
395-
if (! $app_encoding) {
394+
if (is_null($app_encoding)) {
396395
return $result;
397396
}
398397
$db_charset = config('database.sybase.db_charset');

0 commit comments

Comments
 (0)