public class SingleRecordSelectClient extends java.lang.Object implements Client
SingleRecordFiller
. Each time the client's doWork()
method
is called, it will pick one of the tables randomly, and select one random
record in that table.Modifier and Type | Field and Description |
---|---|
private java.sql.Connection |
conn |
private int |
dataType |
private boolean |
noIndex |
private java.sql.PreparedStatement[] |
pss |
private java.util.Random |
r |
private boolean |
secondaryIndex |
private int |
tableSize |
Constructor and Description |
---|
SingleRecordSelectClient(int records,
int tables)
Construct a new single-record select client which fetches VARCHAR data
by primary key.
|
SingleRecordSelectClient(int records,
int tables,
int type,
boolean secIndex,
boolean nonIndexed)
Construct a new single-record select client.
|
Modifier and Type | Method and Description |
---|---|
void |
doWork()
Perform the work for a single iteration of the test (typically a single
transaction).
|
private void |
fetchTextColumn(java.sql.ResultSet rs,
int column)
Make sure the text column is retrieved and read.
|
void |
init(java.sql.Connection c)
Initialize this client (typically prepare the statements needed in the
doWork() method). |
void |
printReport(java.io.PrintStream out)
Print a report from the test run.
|
private java.sql.Connection conn
private final java.sql.PreparedStatement[] pss
private final java.util.Random r
private final int tableSize
private final int dataType
private final boolean secondaryIndex
private final boolean noIndex
public SingleRecordSelectClient(int records, int tables)
records
- the number of records in each table in the testtables
- the number of tables in the testpublic SingleRecordSelectClient(int records, int tables, int type, boolean secIndex, boolean nonIndexed)
records
- the number of records in each table in the testtables
- the number of tables in the testtype
- the data type of the text column
(java.sql.Types.VARCHAR
, java.sql.Types.BLOB
or
java.sql.Types.CLOB
)secIndex
- if true
, select by secondary index column
instead of primary key columnnonIndexed
- if true
, select by non-indexed column
instead of primary key columnpublic void init(java.sql.Connection c) throws java.sql.SQLException
Client
doWork()
method).public void doWork() throws java.sql.SQLException
Client
public void printReport(java.io.PrintStream out)
Client
printReport
in interface Client
out
- stream to print the report toprivate void fetchTextColumn(java.sql.ResultSet rs, int column) throws java.sql.SQLException
java.sql.SQLException
Apache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.