refactor: simplify PgConnection.java #1047
Merged
Conversation
PgConnection.java
Codecov Report
@@ Coverage Diff @@
## master #1047 +/- ##
============================================
- Coverage 66.83% 66.82% -0.01%
Complexity 3637 3637
============================================
Files 169 169
Lines 15593 15589 -4
Branches 2529 2528 -1
============================================
- Hits 10422 10418 -4
Misses 3977 3977
Partials 1194 1194 |
private Set<Integer> getBinaryOids(Properties info) throws PSQLException { | ||
boolean binaryTransfer = PGProperty.BINARY_TRANSFER.getBoolean(info); | ||
// Formats that currently have binary protocol support | ||
Set<Integer> binaryOids = new HashSet<Integer>(); |
bokken
Dec 28, 2017
Member
consider initializing this to a reasonable size to limit (or eliminate) the need to reallocate the backing array. the default starting size of 16 currently guarantees (at least) 1 reallocation each time this method is called.
consider initializing this to a reasonable size to limit (or eliminate) the need to reallocate the backing array. the default starting size of 16 currently guarantees (at least) 1 reallocation each time this method is called.
AlexElin
Jan 14, 2018
Author
Contributor
made changes. Set initial capacity to 32 (20 values if binaryTransfer
enabled + some values from BINARY_TRANSFER_ENABLE)
made changes. Set initial capacity to 32 (20 values if binaryTransfer
enabled + some values from BINARY_TRANSFER_ENABLE)
binaryOids.removeAll(getOidSet(PGProperty.BINARY_TRANSFER_DISABLE.get(info))); | ||
return binaryOids; | ||
} | ||
|
||
private Set<Integer> getOidSet(String oidList) throws PSQLException { |
bokken
Dec 28, 2017
Member
consider making this static
consider making this static
AlexElin
Feb 14, 2018
Author
Contributor
made it
made it
@@ -328,6 +292,39 @@ public TimeZone get() { | |||
replicationConnection = PGProperty.REPLICATION.get(info) != null; | |||
} | |||
|
|||
private Set<Integer> getBinaryOids(Properties info) throws PSQLException { |
bokken
Dec 28, 2017
Member
if getOidSet is changed to static, consider changing this method to static.
if getOidSet is changed to static, consider changing this method to static.
AlexElin
Feb 14, 2018
Author
Contributor
made it
made it
make some methods static; set initial capacity for oids' collection #205
rhavermans
added a commit
to bolcom/pgjdbc
that referenced
this pull request
Jul 13, 2018
rhavermans
added a commit
to bolcom/pgjdbc
that referenced
this pull request
Jul 13, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
simplify constructor in PgConnection