Version 5.2.6.1, tag libreoffice-5.2.6.1
[LibreOffice.git] / offapi / com / sun / star / sdbc / XDriver.idl
blobee45d105b5d688c1b6fb4a7a41c33029c5558ad7
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef __com_sun_star_sdbc_XDriver_idl__
20 #define __com_sun_star_sdbc_XDriver_idl__
22 #include <com/sun/star/uno/XInterface.idl>
24 #include <com/sun/star/beans/PropertyValue.idl>
26 #include <com/sun/star/sdbc/SQLException.idl>
28 #include <com/sun/star/sdbc/DriverPropertyInfo.idl>
30 module com { module sun { module star { module sdbc {
32 published interface XConnection;
33 published interface XDriverManager;
36 /** is the interface that every driver class must implement.
40 <p>
41 Each driver should supply a service that implements
42 the Driver interface.
44 </p>
45 <p>The DriverManager will try to load as many drivers as it can
46 find, and then for any given connection request, it will ask each
47 driver in turn to try to connect to the target URL.
49 </p>
50 <p>
51 It is strongly recommended that each Driver object should be
52 small and standalone so that the Driver object can be loaded and
53 queried without bringing in vast quantities of supporting code.
55 </p>
56 @see com::sun::star::sdbc::XDriverManager
57 @see com::sun::star::sdbc::XConnection
59 published interface XDriver: com::sun::star::uno::XInterface
62 /** attempts to make a database connection to the given URL.
63 The driver should return
64 `NULL`
65 if it realizes it is the wrong kind
66 of driver to connect to the given URL. This will be common, as when
67 the driver manager is asked to connect to a given URL it passes
68 the URL to each loaded driver in turn.
72 <p>
73 The driver should raise a
74 com::sun::star::sdbc::SQLException
75 if it is the right
76 driver to connect to the given URL, but has trouble connecting to
77 the database.
79 </p>
80 <p>
81 The info argument can be used to pass arbitrary
82 string tag/value pairs as connection arguments.
83 Normally at least "user" and "password" properties should be
84 included in the Properties. For a JDBC driver also the Java class must
85 be supplied in the property named JavaDriverClass, and a class path (a
86 space-separated list of URLs) needed to locate that class can optionally
87 be supplied in a property named JavaDriverClassPath.
88 Possible property value names are when supported by the driver:
89 @see com::sun::star::sdbc::ConnectionProperties
90 </p>
92 @param url
93 is the URL of the database to which to connect.
94 @param info
95 a list of arbitrary string tag/value pairs as connection arguments. Normally at least a "user" and "password" property should be included.
96 @see com::sun::star::sdbc::ConnectionProperties
97 @returns
98 a Connection object that represents a connection to the URL
99 @throws SQLException
100 if a database access error occurs
103 XConnection connect(
104 [in]string url,
105 [in]sequence<com::sun::star::beans::PropertyValue> info)
106 raises (SQLException);
108 /** returns `TRUE` if the driver thinks that it can open a connection
109 to the given URL. Typically drivers will return `TRUE` if they
110 understand the subprotocol specified in the URL and `FALSE` if
111 they do not.
113 @param url
114 is the URL of the database to which to connect.
115 @returns
116 `TRUE` if this driver can connect to the given URL.
117 @throws SQLException
118 if a database access error occurs.
120 boolean acceptsURL([in]string url) raises (SQLException);
122 /** gets information about the possible properties for this driver.
123 <p>The getPropertyInfo method is intended to allow a generic GUI tool to
124 discover what properties it should prompt a human for in order to get
125 enough information to connect to a database. Note that depending on
126 the values the human has supplied so far, additional values may become
127 necessary, so it may be necessary to iterate though several calls
128 to getPropertyInfo.
129 @param url
130 is the URL of the database to which to connect.
131 @param info
132 is a proposed list of tag/value pairs that will be sent on
133 connect open.
134 @returns
135 an array of DriverPropertyInfo objects describing possible
136 properties. This array may be an empty array if no properties
137 are required.
138 @throws SQLException
139 if a database access error occurs.
141 sequence<DriverPropertyInfo> getPropertyInfo([in]string url,
142 [in] sequence<com::sun::star::beans::PropertyValue> info)
143 raises (SQLException);
145 /** gets the driver's major version number. Initially this should be 1.
146 @returns
147 this driver's major version number
149 long getMajorVersion();
151 /** gets the driver's minor version number. Initially this should be 0.
152 @returns
153 this driver's minor version number.
155 long getMinorVersion();
159 }; }; }; };
161 #endif
163 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */