PHP code example of lajosbencz / stream-parse-sql

1. Go to this page and download the library: Download lajosbencz/stream-parse-sql library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

lajosbencz / stream-parse-sql example snippets


$parser = new LajosBencz\StreamParseSql\StreamParseSql("./my/large/file.sql");
$parser->onProgress(function($position, $size) {
    echo ($position / $size) * 100, PHP_EOL;
});
foreacH($parser->parse() as $sqlCommand) {
    /** @var stdClass $myDb some database adapter */
    $myDb->execute($sqlCommand);
}