This project is read-only.

DotNetSqlGenerator.Library.GenerateValues.cs

Generic random values to correspond to the columns in tables

GenerateValues

public GenerateValues(Random rand)

Properties

private Random Rand;

Usage

PgSqlGenerator pg = new PgSqlGenerator("127.0.0.1", 5432, "postgres", "sql", "testing");
Table T = pg.GetTable("test");

// use it standalone
GenerateValues generate = new GenerateValues();
string s = generate.String();
integer i = generate.Integer();

// use it in a PgSqlGenerator:
DateTime date = pg.Generate.Values.Date();

Methods

String
  • Creates a random string of length limit (default 255) or shorter
  • Generally strings contain a good amount of spaces
public string String([optional]int limit)

Integer
  • Creates a random integer that is at most/least size +/- max or Int16.MaxValue, whichever is less
  • Used an Int16 for compatibility with many data types in SQL
public int Integer([optional]int max)

String
  • Creates random a binary number of length (default 8)
  • It is returned in int form!
public int Binary([optional]int length)

Date
  • Creates a random DateTime
public DateTime Date()

Time
  • Creates a random time in string form (ie: "12:54:26")
public string Time()

Bit
  • Returns either 1 or 0 randomly
public int Bit()

ForColumn
  • Returns a random value of whichever data type is appropriate for the Column c
public string ForColumn(Column c)

Last edited Dec 3, 2010 at 7:02 PM by naspinski, version 3

Comments

No comments yet.