Skip to content

Commit

Permalink
Make SQLiteProcessor cope with '/' in column names
Browse files Browse the repository at this point in the history
  • Loading branch information
vroomfondle committed Aug 14, 2024
1 parent cc31ca2 commit 82c53b6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Illuminate/Database/Query/Processors/SQLiteProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,18 @@ public function processColumns($results, $sql = '')

$type = strtolower($result->type);

$safeName - preg_quote($result->name, '/');

$collation = preg_match(
'/\b'.preg_quote($result->name).'\b[^,(]+(?:\([^()]+\)[^,]*)?(?:(?:default|check|as)\s*(?:\(.*?\))?[^,]*)*collate\s+["\'`]?(\w+)/i',
'/\b'.$safeName.'\b[^,(]+(?:\([^()]+\)[^,]*)?(?:(?:default|check|as)\s*(?:\(.*?\))?[^,]*)*collate\s+["\'`]?(\w+)/i',
$sql,
$matches
) === 1 ? strtolower($matches[1]) : null;

$isGenerated = in_array($result->extra, [2, 3]);

$expression = $isGenerated && preg_match(
'/\b'.preg_quote($result->name).'\b[^,]+\s+as\s+\(((?:[^()]+|\((?:[^()]+|\([^()]*\))*\))*)\)/i',
'/\b'.$safeName.'\b[^,]+\s+as\s+\(((?:[^()]+|\((?:[^()]+|\([^()]*\))*\))*)\)/i',
$sql,
$matches
) === 1 ? $matches[1] : null;
Expand Down

0 comments on commit 82c53b6

Please sign in to comment.