Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
DynamicDriver |
|
| 0.0;0 |
1 | package us.daveread.basicquery; | |
2 | ||
3 | import java.sql.Connection; | |
4 | import java.sql.Driver; | |
5 | import java.sql.DriverPropertyInfo; | |
6 | import java.sql.SQLException; | |
7 | import java.util.Properties; | |
8 | ||
9 | /** | |
10 | * <p>Title: Dynamic driver</p> | |
11 | * <p>Description: Support for loading a DB driver at runtime. Implements the | |
12 | * java.sql.Driver interface. See the interface documentation for | |
13 | * descriptions of the methods.</p> | |
14 | * <p>Copyright: Copyright (c) 2004-2014, David Read</p> | |
15 | * <p>This program is free software; you can redistribute it and/or modify | |
16 | * it under the terms of the GNU General Public License as published by | |
17 | * the Free Software Foundation; either version 2 of the License, or | |
18 | * (at your option) any later version.</p> | |
19 | * <p>This program is distributed in the hope that it will be useful, | |
20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
22 | * GNU General Public License for more details.</p> | |
23 | * <p>You should have received a copy of the GNU General Public License | |
24 | * along with this program; if not, write to the Free Software | |
25 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</p> | |
26 | * <p></p> | |
27 | * @author David Read | |
28 | */ | |
29 | ||
30 | public class DynamicDriver implements Driver { | |
31 | /** | |
32 | * The driver for accessing the database | |
33 | */ | |
34 | private Driver driver; | |
35 | ||
36 | /** | |
37 | * Creates a DynamicDriver instance from a Driver | |
38 | * @param d The driver to be created | |
39 | */ | |
40 | 6 | public DynamicDriver(Driver d) { |
41 | 6 | driver = d; |
42 | 6 | } |
43 | ||
44 | @Override | |
45 | public boolean acceptsURL(String url) throws SQLException { | |
46 | 1 | return driver.acceptsURL(url); |
47 | } | |
48 | ||
49 | @Override | |
50 | public Connection connect(String url, Properties prop) throws SQLException { | |
51 | 1 | return driver.connect(url, prop); |
52 | } | |
53 | ||
54 | @Override | |
55 | public DriverPropertyInfo[] getPropertyInfo(String url, Properties prop) throws | |
56 | SQLException { | |
57 | 1 | return driver.getPropertyInfo(url, prop); |
58 | } | |
59 | ||
60 | @Override | |
61 | public int getMajorVersion() { | |
62 | 1 | return driver.getMajorVersion(); |
63 | } | |
64 | ||
65 | @Override | |
66 | public int getMinorVersion() { | |
67 | 1 | return driver.getMinorVersion(); |
68 | } | |
69 | ||
70 | @Override | |
71 | public boolean jdbcCompliant() { | |
72 | 1 | return driver.jdbcCompliant(); |
73 | } | |
74 | } |