Making MySQLdumps more friendly
Some time ago I had to work with some MySQL database dumps generated by mysqldump(1), lacking a version control software (which fortunately hasn't been needed) more specific, the one used was git(7). Now, git allows to make diff across versions, but this (at least by default) is made line by line so mysqldumps get a lot of data changes even if only a row is the one changed to solve this issue this program was written sqlsplit.c.
The program isn't too polished, it has a main function that only opens the file and another which (with the help of two macro *_*) simulates something like a state automata (actually with a stack), the compilation is simple
1 |
|
So, for example, if the input is
1 2 3 4 5 |
|
Doing this...
1 |
|
We'd get something more legible
1 2 3 4 5 6 7 8 |
|
And thats all, of course if we'd want to take or show data on the terminal (for example to take or return compressed files) the files to use would be /dev/stdin for the input and/or /dev/stdout for the output.