- # mysql test generator
 - integer line_num=0
 - typeset line
 - typeset escaped_line
 - cat <<EOF
 - SELECT VERSION();
 - DROP DATABASE alphabet_test4;
 - CREATE DATABASE alphabet_test4;
 - USE alphabet_test4;
 - CREATE TABLE file_data (
 - line_number INT PRIMARY KEY,
 - line_text TEXT
 - ) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
 - EOF
 - while IFS= read -r line ; do
 - (( line_num++ ))
 - # Escape single quotes in the line to prevent SQL injection issues
 - # This is a basic escape, for more complex data, consider prepared statements
 - escaped_line="${line//\'/\'\'}"
 - # Insert the line number and text into the table
 - printf $'INSERT INTO file_data (line_number, line_text) VALUES (%d, \'%s\');\n' line_num "$escaped_line"
 - done
 - # force rebuild, including punching holes
 - printf 'OPTIMIZE TABLE file_data;'
 - print -u2 '#Done;\n#Verify with\nUSE alphabet_test4; SELECT * FROM file_data ORDER BY line_number;\n'
 - # EOF.
 
mysql test generator
Posted by Anonymous on Mon 21st Jul 2025 19:21
raw | new post
modification of post by Anonymous (view diff)
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.
 nrubsig.kpaste.net RSS