本文整理汇总了Java中org.voltdb.utils.Encoder.hexDecode方法的典型用法代码示例。如果您正苦于以下问题:Java Encoder.hexDecode方法的具体用法?Java Encoder.hexDecode怎么用?Java Encoder.hexDecode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.voltdb.utils.Encoder
的用法示例。
在下文中一共展示了Encoder.hexDecode方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initSQLStmt
import org.voltdb.utils.Encoder; //导入方法依赖的package包/类
public void initSQLStmt(SQLStmt stmt, Statement catStmt) {
int fragCount = catStmt.getFragments().size();
for (PlanFragment frag : catStmt.getFragments()) {
byte[] planHash = Encoder.hexDecode(frag.getPlanhash());
byte[] plan = Encoder.decodeBase64AndDecompressToBytes(frag.getPlannodetree());
long id = ActivePlanRepository.loadOrAddRefPlanFragment(planHash, plan, catStmt.getSqltext());
boolean transactional = frag.getNontransactional() == false;
SQLStmt.Frag stmtFrag = new SQLStmt.Frag(id, planHash, transactional);
if (fragCount == 1 || frag.getHasdependencies()) {
stmt.aggregator = stmtFrag;
}
else {
stmt.collector = stmtFrag;
}
}
stmt.isReadOnly = catStmt.getReadonly();
stmt.isReplicatedTableDML = catStmt.getReplicatedtabledml();
stmt.site = m_site;
int numStatementParamJavaTypes = catStmt.getParameters().size();
stmt.statementParamJavaTypes = new byte[numStatementParamJavaTypes];
for (StmtParameter param : catStmt.getParameters()) {
stmt.statementParamJavaTypes[param.getIndex()] = (byte)param.getJavatype();
// ??? How does the SQLStmt successfully handle IN LIST queries without
// caching the value of param.getIsarray() here?
// Is the array-ness also reflected in the javatype? --paul
}
}
示例2: dispatchUpdateApplicationCatalog
import org.voltdb.utils.Encoder; //导入方法依赖的package包/类
ClientResponseImpl dispatchUpdateApplicationCatalog(StoredProcedureInvocation task,
ClientInputHandler handler, Connection ccxn, AuthSystem.AuthUser user)
{
ParameterSet params = task.getParams();
// default catalogBytes to null, when passed along, will tell the
// catalog change planner that we want to use the current catalog.
byte[] catalogBytes = null;
Object catalogObj = params.toArray()[0];
if (catalogObj != null) {
if (catalogObj instanceof String) {
// treat an empty string as no catalog provided
String catalogString = (String) catalogObj;
if (!catalogString.isEmpty()) {
catalogBytes = Encoder.hexDecode(catalogString);
}
} else if (catalogObj instanceof byte[]) {
// treat an empty array as no catalog provided
byte[] catalogArr = (byte[]) catalogObj;
if (catalogArr.length != 0) {
catalogBytes = catalogArr;
}
}
}
String deploymentString = (String) params.toArray()[1];
LocalObjectMessage work = new LocalObjectMessage(
new CatalogChangeWork(
m_siteId,
task.clientHandle, handler.connectionId(), ccxn.getHostnameAndIPAndPort(),
handler.isAdmin(), ccxn, catalogBytes, deploymentString,
task.procName, task.type, task.originalTxnId, task.originalUniqueId,
VoltDB.instance().getReplicationRole() == ReplicationRole.REPLICA,
VoltDB.instance().getCatalogContext().cluster.getUseddlschema(),
m_adhocCompletionHandler, user));
m_mailbox.send(m_plannerSiteId, work);
return null;
}
示例3: getParameterObjects
import org.voltdb.utils.Encoder; //导入方法依赖的package包/类
public Object[] getParameterObjects() throws SQLParser.Exception
{
Object[] objectParams = new Object[this.params.size()];
int i = 0;
try {
for (; i < this.params.size(); i++) {
String paramType = this.paramTypes.get(i);
String param = this.params.get(i);
Object objParam = null;
// For simplicity, handle first the types that don't allow null as a special value.
if (paramType.equals("bit")) {
//TODO: upper/mixed case Yes and True should be treated as "1"?
//TODO: non-0 integers besides 1 should be treated as "1"?
//TODO: garbage values and null should be rejected, not accepted as "0":
// (case-insensitive) "no"/"false"/"0" should be required for "0"?
if (param.equals("yes") || param.equals("true") || param.equals("1")) {
objParam = (byte)1;
} else {
objParam = (byte)0;
}
}
else if (paramType.equals("statisticscomponent") ||
paramType.equals("sysinfoselector") ||
paramType.equals("metadataselector")) {
objParam = preprocessParam(param);
}
else if ( ! "null".equalsIgnoreCase(param)) {
if (paramType.equals("tinyint")) {
objParam = Byte.parseByte(param);
}
else if (paramType.equals("smallint")) {
objParam = Short.parseShort(param);
}
else if (paramType.equals("int") || paramType.equals("integer")) {
objParam = Integer.parseInt(param);
}
else if (paramType.equals("bigint")) {
objParam = Long.parseLong(param);
}
else if (paramType.equals("float")) {
objParam = Double.parseDouble(param);
}
else if (paramType.equals("varchar")) {
objParam = Unquote.matcher(param).replaceAll("").replace("''","'");
}
else if (paramType.equals("decimal")) {
objParam = new BigDecimal(param);
}
else if (paramType.equals("timestamp")) {
objParam = parseDate(param);
}
else if (paramType.equals("varbinary") || paramType.equals("tinyint_array")) {
String val = Unquote.matcher(param).replaceAll("");
objParam = Encoder.hexDecode(val);
// Make sure we have an even number of characters, otherwise it is an invalid byte string
if (param.length() % 2 == 1) {
throw new SQLParser.Exception(
"Invalid varbinary value (%s) (param %d) : "
+ "must have an even number of hex characters to be valid.",
param, i+1);
}
}
else {
throw new SQLParser.Exception("Unsupported Data Type: %s", paramType);
}
} // else param is keyword "null", so leave objParam as null.
objectParams[i] = objParam;
}
} catch (NumberFormatException nfe) {
throw new SQLParser.Exception(nfe,
"Invalid parameter: Expected a %s value, got '%s' (param %d).",
friendlyTypeDescription(this.paramTypes.get(i)), this.params.get(i), i+1);
}
return objectParams;
}
示例4: ClientImpl
import org.voltdb.utils.Encoder; //导入方法依赖的package包/类
/**
* Create a new client without any initial connections.
* Also provide a hint indicating the expected serialized size of
* most outgoing procedure invocations. This helps size initial allocations
* for serializing network writes
* @param expectedOutgoingMessageSize Expected size of procedure invocations in bytes
* @param maxArenaSizes Maximum size arenas in the memory pool should grow to
* @param heavyweight Whether to use multiple or a single thread
*/
ClientImpl(ClientConfig config) {
m_distributer = new Distributer(
config.m_heavyweight,
config.m_procedureCallTimeoutNanos,
config.m_connectionResponseTimeoutMS,
config.m_useClientAffinity,
config.m_subject);
m_distributer.addClientStatusListener(m_listener);
String username = config.m_username;
if (config.m_subject != null) {
username = config.m_subject.getPrincipals().iterator().next().getName();
}
m_username = username;
if (config.m_reconnectOnConnectionLoss) {
m_reconnectStatusListener = new ReconnectStatusListener(this,
config.m_initialConnectionRetryIntervalMS, config.m_maxConnectionRetryIntervalMS);
m_distributer.addClientStatusListener(m_reconnectStatusListener);
} else {
m_reconnectStatusListener = null;
}
if (config.m_cleartext) {
m_passwordHash = ConnectionUtil.getHashedPassword(config.m_password);
} else {
m_passwordHash = Encoder.hexDecode(config.m_password);
}
if (config.m_listener != null) {
m_distributer.addClientStatusListener(config.m_listener);
}
assert(config.m_maxOutstandingTxns > 0);
m_blessedThreadIds.addAll(m_distributer.getThreadIds());
if (config.m_autoTune) {
m_distributer.m_rateLimiter.enableAutoTuning(
config.m_autoTuneTargetInternalLatency);
}
else {
m_distributer.m_rateLimiter.setLimits(
config.m_maxTransactionsPerSecond, config.m_maxOutstandingTxns);
}
}