Skip to content

Instantly share code, notes, and snippets.

@dapepe
Created March 24, 2016 07:16
Show Gist options
  • Save dapepe/eabaa6d7f460e73cdfb4 to your computer and use it in GitHub Desktop.
Save dapepe/eabaa6d7f460e73cdfb4 to your computer and use it in GitHub Desktop.
Use TortiseMerge to display the difference between two SQLite files
#!/usr/bin/env php
<?php
function dumpSqlite($database) {
$path = @tempnam(@sys_get_temp_dir(), 'sqlt');
if ( !$path )
return false;
$dump = @shell_exec('php '.escapeshellarg(dirname(__FILE__).DIRECTORY_SEPARATOR.'sqlitedump.php').' '.escapeshellarg($database));
if ( !empty($dump) and @file_put_contents($path, $dump) )
return $path;
@unlink($path);
return false;
}
$file1 = dumpSqlite($argv[1]);
$file2 = dumpSqlite($argv[2]);
exec(escapeshellarg('C:/Program Files/TortoiseSVN/bin/TortoiseMerge.exe').' '.escapeshellarg($file1).' '.escapeshellarg($file2));
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment