|
|
@ -1326,19 +1326,32 @@ class rcube_db
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$sql = $this->fix_table_names($sql);
|
|
|
|
$sql = $this->fix_table_names($sql);
|
|
|
|
$buff = '';
|
|
|
|
$buff = '';
|
|
|
|
|
|
|
|
$exec = '';
|
|
|
|
|
|
|
|
|
|
|
|
foreach (explode("\n", $sql) as $line) {
|
|
|
|
foreach (explode("\n", $sql) as $line) {
|
|
|
|
if (preg_match('/^--/', $line) || trim($line) == '')
|
|
|
|
$trimmed = trim($line);
|
|
|
|
|
|
|
|
if ($trimmed == '' || preg_match('/^--/', $trimmed)) {
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$buff .= $line . "\n";
|
|
|
|
if ($trimmed == 'GO') {
|
|
|
|
if (preg_match('/(;|^GO)$/', trim($line))) {
|
|
|
|
$exec = $buff;
|
|
|
|
$this->query($buff);
|
|
|
|
}
|
|
|
|
|
|
|
|
else if ($trimmed[strlen($trimmed)-1] == ';') {
|
|
|
|
|
|
|
|
$exec = $buff . substr(rtrim($line), 0, -1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($exec) {
|
|
|
|
|
|
|
|
$this->query($exec);
|
|
|
|
$buff = '';
|
|
|
|
$buff = '';
|
|
|
|
|
|
|
|
$exec = '';
|
|
|
|
if ($this->db_error) {
|
|
|
|
if ($this->db_error) {
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
$buff .= $line . "\n";
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return !$this->db_error;
|
|
|
|
return !$this->db_error;
|
|
|
|