Skip to content

Commit

Permalink
[misc] code cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
rusher committed Jan 14, 2020
1 parent ab27ba9 commit 71ea050
Show file tree
Hide file tree
Showing 24 changed files with 24 additions and 25 deletions.
Expand Up @@ -155,7 +155,7 @@ public static int sendRewriteCmd(
int parameterLength = 0;
boolean knownParameterSize = true;
for (ParameterHolder parameter : parameters) {
long paramSize = parameter.getApproximateTextProtocolLength();
int paramSize = parameter.getApproximateTextProtocolLength();
if (paramSize == -1) {
knownParameterSize = false;
break;
Expand Down Expand Up @@ -214,7 +214,7 @@ public static int sendRewriteCmd(
int parameterLength = 0;
boolean knownParameterSize = true;
for (ParameterHolder parameter : parameters) {
long paramSize = parameter.getApproximateTextProtocolLength();
int paramSize = parameter.getApproximateTextProtocolLength();
if (paramSize == -1) {
knownParameterSize = false;
break;
Expand Down
Expand Up @@ -70,7 +70,7 @@ public void writeTo(PacketOutputStream pos) throws IOException {
pos.write(bigDecimal.toPlainString().getBytes());
}

public long getApproximateTextProtocolLength() {
public int getApproximateTextProtocolLength() {
return bigDecimal.toPlainString().getBytes().length;
}

Expand Down
Expand Up @@ -39,7 +39,7 @@ public void writeTo(final PacketOutputStream os) throws IOException {
os.write(value ? '1' : '0');
}

public long getApproximateTextProtocolLength() {
public int getApproximateTextProtocolLength() {
return 1;
}

Expand Down
Expand Up @@ -80,7 +80,7 @@ public void writeTo(final PacketOutputStream pos) throws IOException {
pos.write(QUOTE);
}

public long getApproximateTextProtocolLength() {
public int getApproximateTextProtocolLength() {
return bytes.length * 2;
}

Expand Down
Expand Up @@ -76,7 +76,7 @@ public void writeTo(final PacketOutputStream os) throws IOException {
os.write(String.valueOf(value).getBytes());
}

public long getApproximateTextProtocolLength() {
public int getApproximateTextProtocolLength() {
return String.valueOf(value).length();
}

Expand Down
Expand Up @@ -103,7 +103,7 @@ private byte[] dateByteFormat() {
return sdf.format(date).getBytes();
}

public long getApproximateTextProtocolLength() {
public int getApproximateTextProtocolLength() {
return 16;
}

Expand Down
Expand Up @@ -70,7 +70,7 @@ public void writeTo(final PacketOutputStream pos) throws IOException {
pos.write(defaultBytes);
}

public long getApproximateTextProtocolLength() {
public int getApproximateTextProtocolLength() {
return 7;
}

Expand Down
Expand Up @@ -69,7 +69,7 @@ public void writeTo(final PacketOutputStream pos) throws IOException {
pos.write(String.valueOf(value).getBytes());
}

public long getApproximateTextProtocolLength() {
public int getApproximateTextProtocolLength() {
return String.valueOf(value).getBytes().length;
}

Expand Down
Expand Up @@ -69,7 +69,7 @@ public void writeTo(final PacketOutputStream os) throws IOException {
os.write(String.valueOf(value).getBytes());
}

public long getApproximateTextProtocolLength() {
public int getApproximateTextProtocolLength() {
return String.valueOf(value).getBytes().length;
}

Expand Down
Expand Up @@ -69,7 +69,7 @@ public void writeTo(final PacketOutputStream pos) throws IOException {
pos.write(String.valueOf(value).getBytes());
}

public long getApproximateTextProtocolLength() {
public int getApproximateTextProtocolLength() {
return String.valueOf(value).getBytes().length;
}

Expand Down
Expand Up @@ -74,7 +74,7 @@ public void writeTo(final PacketOutputStream pos) throws IOException {
pos.write(QUOTE);
}

public long getApproximateTextProtocolLength() {
public int getApproximateTextProtocolLength() {
return 15;
}

Expand Down
Expand Up @@ -69,7 +69,7 @@ public void writeTo(final PacketOutputStream os) throws IOException {
os.write(String.valueOf(value).getBytes());
}

public long getApproximateTextProtocolLength() {
public int getApproximateTextProtocolLength() {
return String.valueOf(value).getBytes().length;
}

Expand Down
Expand Up @@ -74,7 +74,7 @@ public void writeTo(final PacketOutputStream os) throws IOException {
os.write(NULL);
}

public long getApproximateTextProtocolLength() {
public int getApproximateTextProtocolLength() {
return 4;
}

Expand Down
Expand Up @@ -106,7 +106,7 @@ public void writeTo(final PacketOutputStream pos) throws IOException {
pos.write(QUOTE);
}

public long getApproximateTextProtocolLength() {
public int getApproximateTextProtocolLength() {
return 15;
}

Expand Down
Expand Up @@ -72,7 +72,7 @@ public interface ParameterHolder {

void writeBinary(PacketOutputStream pos) throws IOException;

long getApproximateTextProtocolLength() throws IOException;
int getApproximateTextProtocolLength() throws IOException;

String toString();

Expand Down
Expand Up @@ -102,7 +102,7 @@ public void writeTo(PacketOutputStream pos) throws IOException {
*
* @return approximated data length.
*/
public long getApproximateTextProtocolLength() {
public int getApproximateTextProtocolLength() {
return -1;
}

Expand Down
Expand Up @@ -99,7 +99,7 @@ private void writeObjectToBytes() throws IOException {
* @return approximated data length.
* @throws IOException if error reading stream
*/
public long getApproximateTextProtocolLength() throws IOException {
public int getApproximateTextProtocolLength() throws IOException {
writeObjectToBytes();
return loadedStream.length;
}
Expand Down
Expand Up @@ -69,7 +69,7 @@ public void writeTo(final PacketOutputStream pos) throws IOException {
pos.write(String.valueOf(value).getBytes());
}

public long getApproximateTextProtocolLength() {
public int getApproximateTextProtocolLength() {
return String.valueOf(value).getBytes().length;
}

Expand Down
Expand Up @@ -102,7 +102,7 @@ public void writeTo(final PacketOutputStream pos) throws IOException {
*
* @return approximated data length.
*/
public long getApproximateTextProtocolLength() {
public int getApproximateTextProtocolLength() {
return -1;
}

Expand Down
Expand Up @@ -77,7 +77,7 @@ public void writeTo(final PacketOutputStream pos) throws IOException {
pos.write(stringValue, true, noBackslashEscapes);
}

public long getApproximateTextProtocolLength() {
public int getApproximateTextProtocolLength() {
return stringValue.length() * 3;
}

Expand Down
Expand Up @@ -106,7 +106,7 @@ public void writeTo(final PacketOutputStream pos) throws IOException {
pos.write(QUOTE);
}

public long getApproximateTextProtocolLength() {
public int getApproximateTextProtocolLength() {
return 15;
}

Expand Down
Expand Up @@ -106,7 +106,7 @@ public void writeTo(final PacketOutputStream pos) throws IOException {
pos.write(QUOTE);
}

public long getApproximateTextProtocolLength() {
public int getApproximateTextProtocolLength() {
return 27;
}

Expand Down
Expand Up @@ -102,7 +102,7 @@ public void writeTo(final PacketOutputStream pos) throws IOException {
pos.write(QUOTE);
}

public long getApproximateTextProtocolLength() {
public int getApproximateTextProtocolLength() {
return 27;
}

Expand Down
Expand Up @@ -893,7 +893,6 @@ private void executeBatchRewrite(

cmdPrologue();

ParameterHolder[] parameters;
int currentIndex = 0;
int totalParameterList = parameterList.size();

Expand Down

0 comments on commit 71ea050

Please sign in to comment.