ClientPreparedQueryBindings setInt method convert int directly to byte array
Posted by: chen yi
Date: December 14, 2021 09:07PM

ClientPreparedQueryBindings
setInt method do following things

@Override
public void setInt(int parameterIndex, int x) {
setValue(parameterIndex, String.valueOf(x), MysqlType.INT);
}

public synchronized final void setValue(int paramIndex, String val, MysqlType type) {
byte[] parameterAsBytes = StringUtils.getBytes(val, this.charEncoding);
setValue(paramIndex, parameterAsBytes, type);
}

step1. convert int to String
step2. convert String to ascii byte array

My question is could we convert int directly to byte array?

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.