xref: /AOO41X/main/offapi/com/sun/star/sdbc/XDriver.idl (revision d1766043198e81d0bcfc626e12893e7b4d7e31ca)
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements.  See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership.  The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License.  You may obtain a copy of the License at
10 *
11 *   http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied.  See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23#ifndef __com_sun_star_sdbc_XDriver_idl__
24#define __com_sun_star_sdbc_XDriver_idl__
25
26#ifndef __com_sun_star_uno_XInterface_idl__
27#include <com/sun/star/uno/XInterface.idl>
28#endif
29
30#ifndef __com_sun_star_beans_PropertyValue_idl__
31#include <com/sun/star/beans/PropertyValue.idl>
32#endif
33
34#ifndef __com_sun_star_sdbc_SQLException_idl__
35#include <com/sun/star/sdbc/SQLException.idl>
36#endif
37
38#ifndef __com_sun_star_sdbc_DriverPropertyInfo_idl__
39#include <com/sun/star/sdbc/DriverPropertyInfo.idl>
40#endif
41
42 module com {  module sun {  module star {  module sdbc {
43
44 published interface XConnection;
45 published interface XDriverManager;
46
47
48/** is the interface that every driver class must implement.
49
50
51
52    <p>
53    Each driver should supply a service that implements
54    the Driver interface.
55
56    </p>
57    <p>The DriverManager will try to load as many drivers as it can
58    find, and then for any given connection request, it will ask each
59    driver in turn to try to connect to the target URL.
60
61    </p>
62    <p>
63    It is strongly recommended that each Driver object should be
64    small and standalone so that the Driver object can be loaded and
65    queried without bringing in vast quantities of supporting code.
66
67    </p>
68    @see com::sun::star::sdbc::XDriverManager
69     @see com::sun::star::sdbc::XConnection
70 */
71published interface XDriver: com::sun::star::uno::XInterface
72{
73
74    /** attempts to make a database connection to the given URL.
75        The driver should return
76        <NULL/>
77        if it realizes it is the wrong kind
78        of driver to connect to the given URL.  This will be common, as when
79        the driver manager is asked to connect to a given URL it passes
80        the URL to each loaded driver in turn.
81
82
83
84        <p>
85        The driver should raise a
86        <type scope="com::sun::star::sdbc">SQLException</type>
87        if it is the right
88        driver to connect to the given URL, but has trouble connecting to
89        the database.
90
91        </p>
92        <p>
93        The info argument can be used to pass arbitrary
94        string tag/value pairs as connection arguments.
95        Normally at least "user" and "password" properties should be
96        included in the Properties. For a JDBC driver also the Java class must
97        be supplied in the property named JavaDriverClass, and a class path (a
98        space-separated list of URLs) needed to locate that class can optionally
99        be supplied in a property named JavaDriverClassPath.
100        Possible property value names are when supported by the driver:
101        @see com::sun::star::sdbc::ConnectionProperties
102        </p>
103
104        @param url
105            is the URL of the database to which to connect.
106        @param info
107            a list of arbitrary string tag/value pairs as connection arguments. Normally at least a "user" and "password" property should be included.
108            @see com::sun::star::sdbc::ConnectionProperties
109        @returns
110            a Connection object that represents a connection to the URL
111        @throws SQLException
112            if a database access error occurs
113
114     */
115    XConnection connect(
116                [in]string url,
117                [in]sequence<com::sun::star::beans::PropertyValue> info)
118        raises (SQLException);
119    //-------------------------------------------------------------------------
120
121    /** returns <TRUE/> if the driver thinks that it can open a connection
122        to the given URL.  Typically drivers will return <TRUE/> if they
123        understand the subprotocol specified in the URL and <FALSE/> if
124        they do not.
125
126        @param url
127            is the URL of the database to which to connect.
128        @returns
129            <TRUE/> if this driver can connect to the given URL.
130        @throws SQLException
131            if a database access error occurs.
132     */
133    boolean acceptsURL([in]string url) raises (SQLException);
134    //-------------------------------------------------------------------------
135
136    /** gets information about the possible properties for this driver.
137             <p>The getPropertyInfo method is intended to allow a generic GUI tool to
138             discover what properties it should prompt a human for in order to get
139             enough information to connect to a database.  Note that depending on
140             the values the human has supplied so far, additional values may become
141             necessary, so it may be necessary to iterate though several calls
142             to getPropertyInfo.
143             @param url
144                is the URL of the database to which to connect.
145             @param info
146                is a proposed list of tag/value pairs that will be sent on
147                connect open.
148             @returns
149                an array of DriverPropertyInfo objects describing possible
150                properties. This array may be an empty array if no properties
151                are required.
152             @throws SQLException
153                if a database access error occurs.
154     */
155    sequence<DriverPropertyInfo> getPropertyInfo([in]string url,
156                    [in] sequence<com::sun::star::beans::PropertyValue> info)
157        raises (SQLException);
158    //-------------------------------------------------------------------------
159
160    /** gets the driver's major version number. Initially this should be 1.
161        @returns
162            this driver's major version number
163     */
164    long getMajorVersion();
165    //-------------------------------------------------------------------------
166
167    /** gets the driver's minor version number. Initially this should be 0.
168        @returns
169            this driver's minor version number.
170     */
171    long getMinorVersion();
172};
173
174//=============================================================================
175
176}; }; }; };
177
178#endif
179