Skip to content

Commit 5cd6d05

Browse files
committed
polish
1 parent c5ec839 commit 5cd6d05

File tree

52 files changed

+1014
-780
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+1014
-780
lines changed
Lines changed: 33 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
118
package org.apache.shardingsphere.database.protocol.postgresql.packet.command.query.extended.bind.protocol;
219

320
import org.apache.shardingsphere.database.protocol.postgresql.payload.PostgreSQLPacketPayload;
@@ -10,14 +27,14 @@
1027
import java.util.Map;
1128

1229
public class PostgreSQLArrayBinaryProtocolValue implements PostgreSQLBinaryProtocolValue {
13-
30+
1431
private static final Map<Integer, String> oidTypeName = new HashMap<>();
15-
32+
1633
static {
1734
oidTypeName.put(Oid.BOOL, "bool[]");
1835
oidTypeName.put(Oid.BYTEA, "bytea[]");
19-
// oidTypeName.put(Oid.CHAR_ARRAY, "char[]");
20-
// oidTypeName.put(Oid.NAME_ARRAY, "name[]");
36+
// oidTypeName.put(Oid.CHAR_ARRAY, "char[]");
37+
// oidTypeName.put(Oid.NAME_ARRAY, "name[]");
2138
oidTypeName.put(Oid.INT2, "int2[]");
2239
oidTypeName.put(Oid.INT4, "int4[]");
2340
oidTypeName.put(Oid.INT8, "int8[]");
@@ -27,23 +44,23 @@ public class PostgreSQLArrayBinaryProtocolValue implements PostgreSQLBinaryProto
2744
oidTypeName.put(Oid.VARCHAR, "varchar[]");
2845
oidTypeName.put(Oid.DATE, "date[]");
2946
oidTypeName.put(Oid.TIMESTAMP, "timestamp[]");
30-
// oidTypeName.put(Oid.TIMESTAMPTZ_ARRAY, "timestamptz[]");
47+
// oidTypeName.put(Oid.TIMESTAMPTZ_ARRAY, "timestamptz[]");
3148
oidTypeName.put(Oid.TIME, "time[]");
32-
// oidTypeName.put(Oid.TIMETZ_ARRAY, "timetz[]");
49+
// oidTypeName.put(Oid.TIMETZ_ARRAY, "timetz[]");
3350
oidTypeName.put(Oid.NUMERIC, "numeric[]");
34-
// oidTypeName.put(Oid.UUID_ARRAY, "uuid[]");
51+
// oidTypeName.put(Oid.UUID_ARRAY, "uuid[]");
3552
}
36-
37-
private PostgreSQLArrayBinaryProtocolValue(){
38-
53+
54+
private PostgreSQLArrayBinaryProtocolValue() {
55+
3956
}
4057
public static final PostgreSQLArrayBinaryProtocolValue instance = new PostgreSQLArrayBinaryProtocolValue();
41-
58+
4259
@Override
4360
public int getColumnLength(PostgreSQLPacketPayload payload, Object value) {
4461
return -1;
4562
}
46-
63+
4764
@Override
4865
public Object read(PostgreSQLPacketPayload payload, int parameterValueLength) {
4966
byte[] bytes = new byte[parameterValueLength];
@@ -55,16 +72,11 @@ public Object read(PostgreSQLPacketPayload payload, int parameterValueLength) {
5572
pgBinaryObj.setType(typeName);
5673
return pgBinaryObj;
5774
}
58-
75+
5976
@Override
6077
public void write(PostgreSQLPacketPayload payload, Object value) {
61-
try {
62-
byte[] result = ShardingSpherePgArrayUtils.getBinaryBytes(value,payload.getCharset());
63-
payload.writeInt4(result.length);
64-
payload.writeBytes(result);
65-
}catch (Exception e) {
66-
e.printStackTrace();
67-
}
68-
78+
byte[] result = ShardingSpherePgArrayUtils.getBinaryBytes(value, payload.getCharset());
79+
payload.writeInt4(result.length);
80+
payload.writeBytes(result);
6981
}
7082
}

0 commit comments

Comments
 (0)