Skip to content

Commit cffbd49

Browse files
committed
Derive the string delimiter from the parsed data.
1 parent 6c7f45e commit cffbd49

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

src/PHPSQLParser/builders/ValuesBuilder.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,13 @@ public function build(array $parsed) {
6767
throw new UnableToCreateSQLException('VALUES', $k, $v, 'expr_type');
6868
}
6969

70-
$sql .= ", ";
70+
$sql .= $this->getRecordDelimiter($v);
7171
}
72-
$sql = substr($sql, 0, -2);
73-
return "VALUES " . $sql;
72+
return "VALUES " . trim($sql);
73+
}
74+
75+
protected function getRecordDelimiter($parsed) {
76+
return empty($parsed['delim']) ? ' ' : $parsed['delim'] . ' ';
7477
}
7578
}
7679
?>

0 commit comments

Comments
 (0)