NYCPHP Meetup

NYPHP.org

[nycphp-talk] Script or method to "junk" a table(s)?

Rick Olson rolson at aeso.org
Mon Jul 31 14:35:43 EDT 2006


I have the same issue, there are many occasions where I need to test my 
scripts with valid but random data from a database.  I haven't run 
across any scripts that can offer "random" data to be inserted into a 
table on a whim.

I've actually considered writing a script to do this for me, but a few 
of the issues that would have to be overcome include intelligently 
inserting the information so that it accurately reflects data in related 
tables (e.g. order_items table would have to relate back to a valid 
order_id in an orders table, etc.)...

I was thinking about writing a script that would do a quick google 
search, follow the site links and grab chunks of data based on a set of 
rules...  still, a bit of a pain.

Has anyone run across something that already does this?

Daniel Convissor wrote:
> On Wed, Jul 26, 2006 at 10:10:11PM -0400, Jon Baer wrote:
>   
>> Does anyone know of any easy script/way to junk a table?
>>
>> Im trying to think of a simple solution that while you are developing  
>> a schema/app to easily fill it with test data, not really something  
>> like fixtures in rails but something that can figure if you have  
>> varchar(x), char(x), int(x), blob, etc and fill it with -n rows.
>>     
>
> I know you must have thought of the following, but what's the problem with 
> it?
>
> <?php
> $rows = 55;
> for ($i = 0, $i < $rows, $i++) {
>     query('insert into foo values (...)');
> }
>
> Or just have test rows in your table creation script.
>
> --Dan
>
>   




More information about the talk mailing list