#343 (ok 2.11) handling DELIMITER cmd on input

closed-accepted
1
2007-08-21
2007-01-30
fb1
No

PMA (2.9.2 and 2.10.0) couldn't import exported database
with procedures. (see 1612870)

I made a small modification of libraries\import\sql.php to
handling the DELIMITER instruction. This way you don't
need separate file for procedures, the whole export file
can be import (as with CLI).

The modified libraries\import\sql.php file is attached to download.

Changes:

1. make DELIMITER command as "interesting character"

$p8 = strpos($buffer, 'DELIMITER', $i);
if ($p8 === FALSE || $p8 >= ($len - 11) || $buffer[$p8 +
9] > ' ') {$p8 = 2147483647;}
$i = min ($p1, $p2, $p3, $p4, $p5, $p6, $p7, $p8);
unset($p1, $p2, $p3, $p4, $p5, $p6, $p7, $p8);

2. change the $sql_delimiter variable accordingly
(before // End Of SQL)

// Change delimiter, if redefined, and skip it (don't send
to server!)
if ((substr($buffer, $i, 9) == "DELIMITER") &&
($buffer[$i + 9] <= ' ') &&
($i<$len-11) &&
(!(strpos($buffer,"\n",$i+11)===FALSE) )) {
$new_line_pos=strpos($buffer,"\n",$i+10);
$sql_delimiter=substr($buffer, $i+10,$new_line_pos-$i-10);
$i=$new_line_pos+1;
// Next query part will start here
$start_pos = $i;
continue;
}

Maybe this is not the optimal solution, but works.

Discussion

  • fb1

    fb1 - 2007-01-30
     
  • Marc Delisle

    Marc Delisle - 2007-03-09
    • assigned_to: nobody --> lem9
     
  • Marc Delisle

    Marc Delisle - 2007-03-09

    Logged In: YES
    user_id=210714
    Originator: NO

    Merged in subversion, thanks.

     
  • Marc Delisle

    Marc Delisle - 2007-03-09
    • priority: 5 --> 1
    • summary: handling DELIMITER cmd on input --> (ok 2.11) handling DELIMITER cmd on input
    • status: open --> open-accepted
     
  • Marc Delisle

    Marc Delisle - 2007-08-21
    • status: open-accepted --> closed-accepted
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks