Skip to content

Commit b732674

Browse files
committed
Make column detection more robust
Prevent a field name containing the string "FROM" from borking the query parsing. Not perfect, as a field named "SEND FROM" would still cause a problem - but better than right now.
1 parent 06d854c commit b732674

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

Model/Datasource/Database/Sqlite3.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -485,9 +485,9 @@ public function resultSet(&$results) {
485485
// so try to figure it out based on the querystring
486486
$querystring = $results->queryString;
487487
if (stripos($querystring, 'SELECT') === 0) {
488-
$last = stripos($querystring, 'FROM');
488+
$last = stripos($querystring, ' FROM');
489489
if ($last !== false) {
490-
$selectpart = substr($querystring, 7, $last - 8);
490+
$selectpart = substr($querystring, 7, $last - 7);
491491
$selects = explode(',', $selectpart);
492492
}
493493
} elseif (strpos($querystring, 'PRAGMA table_info') === 0) {

0 commit comments

Comments
 (0)