New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: simplify PgConnection.java #1047

Merged
merged 2 commits into from Jun 30, 2018

Conversation

Projects
None yet
5 participants
@AlexElin
Contributor

AlexElin commented Dec 27, 2017

simplify constructor in PgConnection

refactor: simplify PgConnection.java
PgConnection.java
@codecov-io

This comment has been minimized.

codecov-io commented Dec 27, 2017

Codecov Report

Merging #1047 into master will decrease coverage by <.01%.
The diff coverage is 97.14%.

@@             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>();

This comment has been minimized.

@bokken

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.

This comment has been minimized.

@AlexElin

AlexElin Jan 14, 2018

Contributor

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 {

This comment has been minimized.

@bokken

bokken Dec 28, 2017

Member

consider making this static

This comment has been minimized.

@AlexElin

AlexElin Feb 14, 2018

Contributor

made it

@@ -328,6 +292,39 @@ public TimeZone get() {
replicationConnection = PGProperty.REPLICATION.get(info) != null;
}

private Set<Integer> getBinaryOids(Properties info) throws PSQLException {

This comment has been minimized.

@bokken

bokken Dec 28, 2017

Member

if getOidSet is changed to static, consider changing this method to static.

This comment has been minimized.

@AlexElin

AlexElin Feb 14, 2018

Contributor

made it

@davecramer

This comment has been minimized.

Member

davecramer commented Jan 12, 2018

@AlexElin can you address @bokken issues please ?

refactor: migrate to Junit4
make some methods static; set initial capacity for oids' collection

#205

@vlsi vlsi force-pushed the pgjdbc:master branch from 4a6d1d1 to 5819f31 Jan 17, 2018

@bokken

bokken approved these changes Feb 14, 2018

@vlsi vlsi added this to the 42.2.3 milestone Jun 30, 2018

@vlsi vlsi merged commit ba360f7 into pgjdbc:master Jun 30, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

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