Modifier and Type | Field and Description |
---|---|
private int |
accountsPerBranch
The number of accounts per branch.
|
private int |
branches
The number of branches in the database.
|
private java.sql.Connection |
conn
The connection on which the operations are performed.
|
private java.util.Random |
random
Random number generator.
|
private java.sql.PreparedStatement |
retrieveAccountBalance
Statement that retrieves the current account balance.
|
private int |
tellersPerBranch
The number of tellers per branch.
|
private java.sql.PreparedStatement |
updateAccount
Statement that updates the balance of the account.
|
private java.sql.PreparedStatement |
updateBranch
Statement that updated the balance of the branch.
|
private java.sql.PreparedStatement |
updateHistory
Statement that updated the history table.
|
private java.sql.PreparedStatement |
updateTeller
Statement that updates the balance of the teller.
|
Constructor and Description |
---|
BankTransactionClient(int scale)
Create a client that works on a database with the default number of
tellers and accounts per branch.
|
BankTransactionClient(int branches,
int tellersPerBranch,
int accountsPerBranch)
Create a client that works on a database with the given number of
branches, tellers and accounts.
|
Modifier and Type | Method and Description |
---|---|
void |
doWork()
Perform a single transaction with a profile like the one specified in
Clause 1.2 of the TPC-B specification.
|
private int |
fetchAccountId(int branchId)
Generate a random account id based on the specified branch.
|
private int |
fetchBranchId(int tellerId)
Find the branch the specified teller belongs to.
|
private int |
fetchDelta()
Generate a random delta value between -99999 and +99999, both inclusive
(TPC-B specification, Clause 5.3.6).
|
private int |
fetchTellerId()
Generate a random teller id.
|
void |
init(java.sql.Connection c)
Initialize the connection and the statements used by the test.
|
void |
printReport(java.io.PrintStream out)
Print a report from the test run.
|
private final java.util.Random random
private final int branches
private final int tellersPerBranch
private final int accountsPerBranch
private java.sql.Connection conn
private java.sql.PreparedStatement updateAccount
private java.sql.PreparedStatement updateHistory
private java.sql.PreparedStatement updateTeller
private java.sql.PreparedStatement updateBranch
private java.sql.PreparedStatement retrieveAccountBalance
public BankTransactionClient(int branches, int tellersPerBranch, int accountsPerBranch)
branches
- the number of branches in the databasetellersPerBranch
- the number of tellers per branchaccountsPerBranch
- the number of accounts per branchpublic BankTransactionClient(int scale)
scale
- the scale factor for the database (equal to the number of
branches)BankAccountFiller(int)
public void init(java.sql.Connection c) throws java.sql.SQLException
public void doWork() throws java.sql.SQLException
public void printReport(java.io.PrintStream out)
Client
printReport
in interface Client
out
- stream to print the report toprivate int fetchTellerId()
private int fetchBranchId(int tellerId)
tellerId
- the id of the tellerprivate int fetchAccountId(int branchId)
branchId
- the id of the selected branchprivate int fetchDelta()
Apache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.