Qual: Simplify code

This commit is contained in:
Laurent Destailleur 2010-08-31 21:46:21 +00:00
parent 2ac615a352
commit 0cfe0514d3

View File

@ -133,21 +133,24 @@ function run_sql($sqlfile,$silent=1,$entity='',$usesavepoint=1)
} }
} }
// Ajout ligne si non commentaire // Add line buf to buffer if not a comment
if (! preg_match('/^--/',$buf)) $buffer .= $buf; if (! preg_match('/^--/',$buf))
{
$buffer .= trim($buf);
}
// print $buf.'<br>'; // print $buf.'<br>';
if (preg_match('/;/',$buffer)) if (preg_match('/;/',$buffer))
{ {
// Found new request // Found new request
$arraysql[$i]=trim($buffer); if ($buffer) $arraysql[$i]=$buffer;
$i++; $i++;
$buffer=''; $buffer='';
} }
} }
if ($buffer) $arraysql[$i]=trim($buffer); if ($buffer) $arraysql[$i]=$buffer;
fclose($fp); fclose($fp);
} }
else else
@ -158,8 +161,6 @@ function run_sql($sqlfile,$silent=1,$entity='',$usesavepoint=1)
// Loop on each request to see if there is a __+MAX_table__ key // Loop on each request to see if there is a __+MAX_table__ key
$listofmaxrowid=array(); // This is a cache table $listofmaxrowid=array(); // This is a cache table
foreach($arraysql as $i => $sql) foreach($arraysql as $i => $sql)
{
if ($sql)
{ {
$newsql=$sql; $newsql=$sql;
@ -196,7 +197,6 @@ function run_sql($sqlfile,$silent=1,$entity='',$usesavepoint=1)
$arraysql[$i]=$newsql; $arraysql[$i]=$newsql;
} }
} }
}
// Loop on each request to execute request // Loop on each request to execute request
$cursorinsert=0; $cursorinsert=0;