|Last Updated|| ||Ratings|| ||Unique User Downloads|| ||Download Rankings|
|2017-12-13 (1 month ago) ||Not enough user ratings||Total: 326 ||All time: 6,926 This week: 512|
This class can fill records of MySQL tables with test data.
It takes the SQL dump file of a MySQL database and parses it to extract the list of database tables.
The class executes SQL statements to insert records on the MySQL database tables.
The new record field values can be generated randomly or set to a constant value.
The number of records to insert, the range of characters to use in random data and the character set encoding are configurable parameters.
Fill a multi-table MySQL database with test data by parsing the SQL schema file.
I needed to test the population of a database with 14 complex tables. Tools such as Spawner are useful for small tables - but specifying the datatypes for so many fields (300+) before initiating Spawner would be too time-consuming.
Instead, why not parse the SQL schema?
- Assist in the testing, editing, and data population of complex database schema, before moving the database to a production environment.
- Test database connection encoding and character encoding, and data insertion speeds on different character encodings.
- Check table field population with specified datatype, data truncation, visual cues etc.
- The script expects the database schema to exist in MySQL (
mysql -u root -p < test.sql).
- All table names and column names in the MySQL schema require back-ticks.
- Unique keys must be removed from tables when using the option 'random_data' => FALSE
- Any foreign keys are disabled on data population.
- The majority of MySQL datatypes are supported.
- Random character generation is slow in PHP, and further depends on field length, number of fields, and the number of rows being generated.
- The multiple INSERTs are added in a single query, which is quite fast. Number of INSERTs per second will depend on MySQL configuration settings (default is not optimised), datatype/length inserted, operating system, hardware, etc.
(Or execute on the command-line with:
php -f databasefiller_example.php)
Database Filler is released under the GPL v.3.
||Applications that use this package
No pages of applications that use this class were specified.
If you know an application of this package, send a message to the author to add a link here.