Skip to content

Commit

Permalink
perf: cache result of parsing server_version
Browse files Browse the repository at this point in the history
Save version number after parsing it from string.
No need to recalculate it again.

Backend does not always send server_version_num, thus the driver falls back to string parsing.
See discussion on hackers list: http://www.postgresql.org/message-id/CAMsr+YFt1NcjseExt_Ov+frk0Jzb0-DKqYKt8ALzVEXHBM0jKg@mail.gmail.com

This improves Statement.setObject(int, UUID) which ckecks for server version.

closes #464
  • Loading branch information
zapov authored and vlsi committed Dec 26, 2015
1 parent 4f5d57c commit 9c43d27
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public String getServerVersion() {
public int getServerVersionNum() {
if (serverVersionNum != 0)
return serverVersionNum;
return Utils.parseServerVersionStr(serverVersion);
return serverVersionNum = Utils.parseServerVersionStr(serverVersion);
}

public synchronized boolean getStandardConformingStrings()
Expand Down

0 comments on commit 9c43d27

Please sign in to comment.