public class SingleRecordFiller extends java.lang.Object implements DBFiller
SingleRecordSelectClient
and SingleRecordUpdateClient
.
This tables contain rows with an int column (id) and a varchar(100) column
(text). The id column is declared as primary key.Modifier and Type | Field and Description |
---|---|
private int |
dataType
The data type of the text column (a constant from
java.sql.Types ). |
private java.lang.String |
dataTypeString
SQL name of the data type specified by
dataType . |
private int |
numberOfTables
The number of tables to distribute the load over.
|
private static byte[][] |
RANDOM_BYTES |
private static java.lang.String[] |
RANDOM_STRINGS |
private int |
tableSize
The number of rows in each table.
|
(package private) static int |
TEXT_SIZE |
private boolean |
withNonIndexedColumn
Whether or not the table includes an integer column with unique values
in random order not backed by an index.
|
private boolean |
withSecIndexColumn
Whether or not the table includes an integer column with unique values
in random order.
|
Constructor and Description |
---|
SingleRecordFiller(int records,
int tables)
Generate a filler that creates the specified number of tables, each of
which contains the specified number of records.
|
SingleRecordFiller(int records,
int tables,
int type,
boolean withSecIndex,
boolean withNonIndexed)
Generate a filler that creates the specified number of tables, each of
which contains the specified number of records.
|
Modifier and Type | Method and Description |
---|---|
void |
fill(java.sql.Connection c)
Populate the database with the data needed by a test.
|
(package private) static java.lang.String |
getTableName(int records,
int table,
int dataType,
boolean withSecIndex,
boolean withNonIndexed)
Get the name of a table generated by this class.
|
(package private) static byte[] |
randomBytes(int seed)
Pick a random byte string.
|
(package private) static java.lang.String |
randomString(int seed)
Pick a random string.
|
private final int numberOfTables
private final int tableSize
private final int dataType
java.sql.Types
).private final java.lang.String dataTypeString
dataType
.private final boolean withSecIndexColumn
private final boolean withNonIndexedColumn
static final int TEXT_SIZE
private static final java.lang.String[] RANDOM_STRINGS
private static final byte[][] RANDOM_BYTES
public SingleRecordFiller(int records, int tables)
records
- the number of records in each tabletables
- the number of tables to createpublic SingleRecordFiller(int records, int tables, int type, boolean withSecIndex, boolean withNonIndexed)
records
- the number of records in each tabletables
- the number of tables to createtype
- which SQL type to store the text as (one of
java.sql.Types.VARCHAR
, java.sql.Types.BLOB
and
java.sql.Types.CLOB
.public void fill(java.sql.Connection c) throws java.sql.SQLException
DBFiller
static java.lang.String randomString(int seed)
seed
- a seed used to decide which random string to pickstatic byte[] randomBytes(int seed)
seed
- a seed used to decide which random string to pickstatic java.lang.String getTableName(int records, int table, int dataType, boolean withSecIndex, boolean withNonIndexed)
records
- the number of records in the tabletable
- the number of the table, between 0 (inclusive) and the
total number of tables (exclusive)dataType
- the java.sql.Types
constant specifying the
data type of the text columnApache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.