KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > mockobjects > eziba > sql > Driver


1 /*
2  * Copyright (C) 2001 eZiba.com, Inc.
3  * All Rights Reserved
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  * Redistributions in binary form must reproduce the above
12  * copyright notice, this list of conditions and the following
13  * disclaimer in the documentation and/or other materials provided
14  * with the distribution. Neither the name of eZiba.com nor the
15  * names of its contributors may be used to endorse or promote
16  * products derived from this software without specific prior
17  * written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
22  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
23  * eZiba.com OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
24  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
28  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
30  * OF THE POSSIBILITY OF SUCH DAMAGE.
31  */

32
33 package com.mockobjects.eziba.sql;
34 import java.util.Properties JavaDoc;public class Driver
35     implements java.sql.Driver JavaDoc
36 {
37
38     public boolean acceptsURL(String JavaDoc p_url)
39     {
40         if (p_url.startsWith("jdbc:"))
41         {
42             return p_url.substring(6).startsWith("unittest:");
43         }
44         else
45         {
46             return false;
47         }
48     }
49
50     public java.sql.Connection JavaDoc connect(String JavaDoc p_url,
51                                        Properties JavaDoc p_props)
52     {
53         return createConnection();
54     }
55
56     public int getMajorVersion()
57     {
58         return 1;
59     }
60
61     public int getMinorVersion()
62     {
63         return 0;
64     }
65
66     public java.sql.DriverPropertyInfo JavaDoc [] getPropertyInfo(String JavaDoc p_url,
67                                                           Properties JavaDoc p_props)
68     {
69         return new java.sql.DriverPropertyInfo JavaDoc[0];
70     }
71
72     public boolean jdbcCompliant()
73     {
74         return false;
75     }
76
77     /*
78      * Convenience method for creating connections, since creating a
79      * connection requires no properties.
80      */

81
82     public static Connection createConnection()
83     {
84         return new Connection();
85     }
86 }
Popular Tags