#190 when import breaks

closed-out-of-date
nobody
Utilities (11)
5
2005-06-27
2004-03-10
flobee
No

i alway have the problem the get a correct data dump
form my ISP
mysqlfront has bugs to copy data to my localhost or
anywhere else...
but: first i get the stucture and the data seperated
then using this piece of code to get the data in my DB.
phpmyadmin always break at any point... :-(

<?php
//
==========================================
======================== //
// === flobee for universal-artists.de
=== //
//
==========================================
======================== //

$sql_data_file = 'dump/data_file.sql';
$db = 'databasename';

// === mysql insert data dump to mysql

=========
function insert_db_data_dump() {
global $db, $sql_data_file;
ignore_user_abort(false);
ini_set("max_execution_time",0);

$dbc = mysql_connect('localhost','root','password')
or die ( mysql_error() );
mysql_select_db($db, $dbc );

$lines = file( $sql_data_file );
$a = count($lines);

echo '<p>entrys ~ '.$a.' PLEASE WAIT!!!</p>';
flush();

for($i=0; $i < $a; $i++) {
$pin = substr($lines[$i],0,1);

if($pin != '' && $pin != '#' && !empty($pin) && $pin
> ' ' && !empty($lines[$i])) {

mysql_query( $lines[$i], $dbc);
if( $err = mysql_error() && mysql_errno() !=
1062 ) {
echo "line: $i ,test: $test, error: $err ,
query: ". $lines[$i];
exit('EXIT');
}

if( is_int($i/1000) ) {
echo $i .', ';
flush();
}
}
}

if($i >= $a) {
echo '<p>DONE! exit... </p>';
exit('OK');
}
}
insert_db_data_dump();

?>

Discussion

  • Marc Delisle

    Marc Delisle - 2004-03-26

    Logged In: YES
    user_id=210714

    Note: you cannot change the max execution time if the server
    is running in safe mode.

     
  • Michal Čihař

    Michal Čihař - 2005-06-27
    • status: open --> closed-out-of-date
     
  • Michal Čihař

    Michal Čihař - 2005-06-27

    Logged In: YES
    user_id=192186

    This just sets limit, you can do this by changing
    $cfg['ExecTimeLimit'], so already implemented.