int newLength = newData.length + c_data.length;
if (newLength > TPCCConstants.MAX_C_DATA) {
newLength = TPCCConstants.MAX_C_DATA;
}
ByteBuilder builder = new ByteBuilder(newLength);
int minLength = newLength;
if (newData.length < minLength) minLength = newData.length;
builder.append(newData, 0, minLength);
int remaining = newLength - minLength;
builder.append(c_data, 0, remaining);
c_data = builder.array();
voltQueueSQL(updateBCCustomer, c_balance, c_ytd_payment, c_payment_cnt, c_data, W_ID, D_ID, c_id);
}
else{
c_data = new byte[0];
voltQueueSQL(updateGCCustomer, c_balance, c_ytd_payment, c_payment_cnt, W_ID, D_ID, c_id);
}
// Concatenate w_name, four spaces, d_name
byte[] w_name = warehouse.fetchRow(0).getStringAsBytes(W_NAME_IDX);
final byte[] FOUR_SPACES = { ' ', ' ', ' ', ' ' };
byte[] d_name = district.fetchRow(0).getStringAsBytes(D_NAME_IDX);
ByteBuilder builder = new ByteBuilder(w_name.length + FOUR_SPACES.length + d_name.length);
builder.append(w_name);
builder.append(FOUR_SPACES);
builder.append(d_name);
byte[] h_data = builder.array();
// Create the history record
voltQueueSQL(insertHistory, c_id, D_ID, W_ID, D_ID, W_ID, timestamp, paymentAmount, h_data);
voltExecuteSQL();