mirror of
https://github.com/e107inc/e107.git
synced 2025-03-14 17:39:46 +01:00
Resolves SQL parsing issue which arises when field-name == field-type
This commit is contained in:
parent
cb06e8c68a
commit
ec8c543751
@ -742,6 +742,20 @@ class db_verify
|
||||
|
||||
function getFields($data, $print = false)
|
||||
{
|
||||
|
||||
// Clean $data and add ` ` arond field-names - prevents issues when field == field-type.
|
||||
$tmp = explode("\n",$data);
|
||||
$newline = array();
|
||||
|
||||
foreach($tmp as $line)
|
||||
{
|
||||
$line = trim($line);
|
||||
$newline[] = preg_replace("/^([^`A-Z\s][a-z_]*)/","`$1`", $line);
|
||||
}
|
||||
|
||||
$data = implode("\n",$newline);
|
||||
// --------------------
|
||||
|
||||
$mes = e107::getMessage();
|
||||
|
||||
// $regex = "/`?([\w]*)`?\s*?(".implode("|",$this->fieldTypes)."|".implode("|",$this->fieldTypeNum).")\s?(?:\([\s]?([0-9,]*)[\s]?\))?[\s]?(unsigned)?[\s]?.*?(?:(NOT NULL|NULL))?[\s]*(auto_increment|default .*)?[\s]?(?:PRIMARY KEY)?[\s]*?,?\s*?\n/im";
|
||||
|
Loading…
x
Reference in New Issue
Block a user