Random .Net SQL Generator (Open Source)

A random generator for all types of queries in SQL - extend-able to any SQL provider

I have often ran into the case where I need to insert a bunch of random records against a table or do a lot of queries to test for integrity - but those tools always seem to cost money. Some classmates and I did a project last semester that allowed for random SQL generation of all types. This is a generation tool for random queries in SQL in the Windows environment. It can produce random queries, tables, deletes, and updates as well as generate random data for a table. This was implemented with PostgresSQL, but we tried to structure it to allow easy adaptation for other SQL implementations as well.

The interface was meant to be very simple and requires no information about the tables themselves, just feed in basic information like the connectionstring and the table name to run the query against:

insert 100 random records

PgSqlGenerator pg = new PgSqlGenerator("", 5432, 
    "postgres", "sql", "my_database");
Table people = pg.GetTable("people");
QueryInformation report = 
    pg.ExecuteBulkInsert(people, 100);

//now check the results:
Console.WriteLine("Query: " + report.Query);
Console.WriteLine("Time Taken: " + report.Time);
Console.WriteLine("Rows Affected: " + report.Affected);

It is far from bug-free, but works very well - figured we would share what we did.

Comments (1) -

  • Hello there I reach your site by mistake when i was browsing Google for this wii concern, I have to say your internet site is really helpful I also love the design, its amazing!. I dont have that much time to go through all your post at the moment but I've bookmarked your site and also add your RSS feeds. I will likely be back in a day or two. thanks for a awesome web page.
Comments are closed