Mercurial > dive4elements > river
comparison flys-aft/src/main/java/de/intevation/db/ConnectionBuilder.java @ 4074:100c4e0a45e1
Improved infrastructure for prepared statements.
flys-aft/trunk@3407 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Tue, 13 Dec 2011 14:32:55 +0000 |
parents | 2c70fae83d0c |
children | ee0c60757a94 |
comparison
equal
deleted
inserted
replaced
4073:2c70fae83d0c | 4074:100c4e0a45e1 |
---|---|
27 protected String driver; | 27 protected String driver; |
28 protected String user; | 28 protected String user; |
29 protected String password; | 29 protected String password; |
30 protected String url; | 30 protected String url; |
31 | 31 |
32 protected Statements statements; | |
33 | |
34 public ConnectionBuilder(String type, Document document) { | 32 public ConnectionBuilder(String type, Document document) { |
35 this.type = type; | 33 this.type = type; |
36 extractCredentials(document); | 34 extractCredentials(document); |
37 statements = new Statements(type, driver != null ? driver : ""); | |
38 } | 35 } |
39 | 36 |
40 protected void extractCredentials(Document document) { | 37 protected void extractCredentials(Document document) { |
41 HashMap<String, String> map = new HashMap<String, String>(); | 38 HashMap<String, String> map = new HashMap<String, String>(); |
42 map.put("type", type); | 39 map.put("type", type); |
70 } | 67 } |
71 | 68 |
72 return DriverManager.getConnection(url, user, password); | 69 return DriverManager.getConnection(url, user, password); |
73 } | 70 } |
74 | 71 |
75 public SymbolicStatement getStatement(String key) { | 72 public ConnectedStatements getConnectedStatements() throws SQLException { |
76 return statements.getStatement(key); | 73 return new ConnectedStatements( |
74 getConnection(), | |
75 new Statements(type, driver != null ? driver : "") | |
76 .getStatements()); | |
77 } | 77 } |
78 } | 78 } |
79 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : | 79 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |