Menu

Tree [r1] /
 History

HTTPS access


File Date Author Commit
 Types 2009-06-11 atrabulsi [r1] Initial Import
 cache 2009-06-11 atrabulsi [r1] Initial Import
 .project 2009-06-11 atrabulsi [r1] Initial Import
 Config.php 2009-06-11 atrabulsi [r1] Initial Import
 DatabaseConnection.php 2009-06-11 atrabulsi [r1] Initial Import
 Query.php 2009-06-11 atrabulsi [r1] Initial Import
 README 2009-06-11 atrabulsi [r1] Initial Import
 RandomField.php 2009-06-11 atrabulsi [r1] Initial Import
 RandomGenerator.php 2009-06-11 atrabulsi [r1] Initial Import
 copyright 2009-06-11 atrabulsi [r1] Initial Import
 schema.sql 2009-06-11 atrabulsi [r1] Initial Import
 test_unit.php 2009-06-11 atrabulsi [r1] Initial Import

Read Me

/*
Author: Anas Trabulsi
Website: atrabulsi.com
E-Mail: anas@atrabulsi.com
To get the most up to date copy of this software, go to
http://sourceforge.net/projects/randomgenerator/

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
    
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

To obtain more information about the GNU General Public License see
http://www.gnu.org/licenses/
*/

This program generate random values and insert them in the database.
It is great to test a new software or to generate meaningful dummy data.
It is Written in PHP and uses MySQL as a DBMS.

When developing a new website, the developer needs to test it on 
substantial number of records. Using this random generator, you can 
insert millions of records of meaningful data in a few minutes.

To insert random records in a table, simply define that table using the 
method setTable() and then define the fields of the table and their types. 
A field type can be one of the following:

1. Data file: A database of countries, states/provinces, cities, names,  
and last names has been included to generate meaningful data. New  
databases can be integrated by simply adding a new file with the values  
you want to generate from.
2. Enum: e.g: Enum(male,female)
3. Float: to generate float numbers
4. Integer: to generate integer numbers
5. SQL: It is good for generating foreign keys. For example, an employee 
has to belong to a department, so the department field in the employee 
table will be generated as: "SQL(select id from department)". It simply  
selects one of the IDs of a departments and assigns it to the department   
field in the employee table.
6. Text: to generate random text: good to generate passwords. It does not 
generate human friendly text.
7. Timestamp: to generate random timestamps.
8. You can write your own classes for other types

Each field can have modifiers. The modifiers are used based on the type 
of the field.
For example, one of the modifiers of the text type is to make the text upper 
case. You can define your own modifiers if necessary

To generate random records and insert them into your database, check the test 
unit integrated with this softwar.

To use the test unit:
1. Copy the project's folder into your documents root folder
2. Create a database called random
3. Modify the Config.php file and set the username, password, database url, 
and database name
4. Import the database schema from the file: schema.sql
5. Request the test_unit.php file from your browser
6. Optional: In Query.php, you can set the LOG_SQL and CACHE_SQL to true:
	LOG_SQL will log all the SQL statements executed by this software to a 
	file called statements.sql (Your web server should have the write 
	permissions over this file)
	CACHE_SQL will cache any SELECT SQL statement. There will be a noticeable 
	improvement in the performance when selecting from large data sets. All the 
	SQL results will be cached in a folder called "cache" (Again, your web server 
	should have the write permission over this folder)
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.