1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: XConnection.idl,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef __com_sun_star_sdbc_XConnection_idl__
31 #define __com_sun_star_sdbc_XConnection_idl__
33 #ifndef __com_sun_star_uno_XInterface_idl__
34 #include
<com
/sun
/star
/uno
/XInterface.idl
>
37 module com
{ module sun
{ module star
{ module container
{
38 published
interface XNameAccess
;
41 #ifndef __com_sun_star_sdbc_SQLException_idl__
42 #include
<com
/sun
/star
/sdbc
/SQLException.idl
>
45 #ifndef __com_sun_star_sdbc_XCloseable_idl__
46 #include
<com
/sun
/star
/sdbc
/XCloseable.idl
>
49 module com
{ module sun
{ module star
{ module sdbc
{
51 published
interface XStatement
;
52 published
interface XPreparedStatement
;
53 published
interface XDatabaseMetaData
;
56 /** represents a connection (session) with a specific
57 database. Within the context of a Connection, SQL statements are
58 executed and results are returned.
62 A Connection's database is able to provide information
63 describing its tables, its supported SQL grammar, its stored
64 procedures, and the capabilities of this connection. This
65 information is obtained with the
66 <member scope="com::sun::star::sdbc">XDatabaseMetaData::getMetaData()</member>
70 @see com::sun::star::sdbc::XDriverManager
71 @see com::sun::star::sdbc::XStatement
72 @see com::sun::star::sdbc::XDatabaseMetaData
74 published
interface XConnection
: com
::sun
::star
::sdbc
::XCloseable
78 <type scope="com::sun::star::sdbc">Statement</type>
79 object for sending SQL statements to the database.
83 SQL statements without parameters are normally
84 executed using Statement objects. If the same SQL statement
85 is executed many times, it is more efficient to use a
86 <type scope="com::sun::star::sdbc">PreparedStatement</type>
90 Result sets created using the returned Statement will have
91 forward-only type, and read-only concurrency, by default.
94 Escape processing for the SQL-Statement is enabled, by default.
98 a new Statement object
100 if a database access error occurs.
102 XStatement createStatement
() raises
(SQLException
);
103 //-------------------------------------------------------------------------
106 <type scope="com::sun::star::sdbc">PreparedStatement</type>
107 object for sending parameterized SQL statements to the database.
111 A SQL statement with or without IN parameters can be
112 pre-compiled and stored in a PreparedStatement object. This
113 object can then be used to efficiently execute this statement
121 This method is optimized for handling
122 parametric SQL statements that benefit from precompilation. If
123 the driver supports precompilation,
125 <code>prepareStatement</code>
127 the statement to the database for precompilation. Some drivers
128 may not support precompilation. In this case, the statement may
129 not be sent to the database until the
130 <type scope="com::sun::star::sdbc">PreparedStatement</type>
131 is executed. This has no direct effect on users; however, it does
132 affect which method throws certain SQLExceptions.
135 Result sets created using the returned PreparedStatement will have
136 forward-only type and read-only concurrency, by default.
139 Escape processing for the SQL-Statement is enabled, by default.
143 a SQL statement that may contain one or more '?' IN parameter placeholders
145 a new PreparedStatement object containing the pre-compiled statement
147 if a database access error occurs.
149 XPreparedStatement prepareStatement
([in]string sql
) raises
(SQLException
);
150 //-------------------------------------------------------------------------
153 <type scope="com::sun::star::sdbc">CallableStatement</type>
155 database stored procedures.
159 The CallableStatement provides methods for setting up its IN and OUT
160 parameters, and methods for executing the call to a stored procedure.
166 This method is optimized for handling stored
167 procedure call statements. Some drivers may send the call
168 statement to the database when the method
169 <code>prepareCall</code>
172 others may wait until the CallableStatement is executed. This has no
173 direct effect on users; however, it does affect which method
174 throws certain SQLExceptions.
175 Result sets created using the returned CallableStatement will have
176 forward-only type and read-only concurrency, by default.
180 a SQL statement that may contain one or more '?' IN parameter placeholders
182 a new PreparedStatement object containing the pre-compiled statement
184 if a database access error occurs.
186 XPreparedStatement prepareCall
([in]string sql
) raises
(SQLException
);
187 //-------------------------------------------------------------------------
189 /** converts the given SQL statement into the system's native SQL grammar.
190 A driver may convert the JDBC SQL grammar into its system's
191 native SQL grammar prior to sending it; this method returns the
192 native form of the statement that the driver would have sent.
195 a SQL statement that may contain one or more '?' parameter placeholders
197 the native form of this statement
199 if a database access error occurs.
201 string nativeSQL
([in]string sql
) raises
(SQLException
);
202 //-------------------------------------------------------------------------
204 /** sets this connection's auto-commit mode.
208 If a connection is in auto-commit mode, then all its SQL
209 statements will be executed and committed as individual
210 transactions. Otherwise, its SQL statements are grouped into
211 transactions that are terminated by a call to either
213 <member scope="com::sun::star::sdbc">XConnection::commit()</member>
215 <member scope="com::sun::star::sdbc">XConnection::rollback()</member>
217 By default, new connections are in auto-commit mode.
220 The commit occurs when the statement completes or the next
221 execute occurs, whichever comes first. In the case of
222 statements returning a ResultSet, the statement completes when
223 the last row of the ResultSet has been retrieved or the
224 ResultSet has been closed. In advanced cases, a single
225 statement may return multiple results as well as output
226 parameter values. In these cases the commit occurs when all results and
227 output parameter values have been retrieved.
231 <TRUE/> enables auto-commit; <FALSE/> disables auto-commit.
233 if a database access error occurs.
235 void setAutoCommit
([in] boolean autoCommit
) raises
(SQLException
);
236 //-------------------------------------------------------------------------
238 /** gets the current auto-commit state.
241 the current state of auto-commit mode.
243 if a database access error occurs.
247 boolean getAutoCommit
() raises
(SQLException
);
248 //-------------------------------------------------------------------------
250 /** makes all changes made since the previous commit/rollback
251 permanent and releases any database locks currently held
252 by the Connection. This method should be
253 used only when auto-commit mode has been disabled.
256 if a database access error occurs.
260 void commit
() raises
(SQLException
);
261 //-------------------------------------------------------------------------
263 /** drops all changes made since the previous
264 commit/rollback and releases any database locks currently held
265 by this Connection. This method should be used only when auto-commit has been disabled.
268 if a database access error occurs.
272 void rollback
() raises
(SQLException
);
273 //-------------------------------------------------------------------------
275 /** tests to see if a connection is closed.
282 A Connection is automatically closed if no one references it
283 anymore. Certain fatal errors also result in a closed Connection.
287 <TRUE/> if the connection is closed; <FALSE/> if it's still open.
289 if a database access error occurs.
291 boolean isClosed
() raises
(SQLException
);
292 //-------------------------------------------------------------------------
294 /** gets the metadata regarding this connection's database.
298 A Connection's database is able to provide information
299 describing its tables, its supported SQL grammar, its stored
300 procedures, the capabilities of this connection, and so on. This
301 information is made available through a DatabaseMetaData
306 a DatabaseMetaData object for this Connection.
308 if a database access error occurs.
310 XDatabaseMetaData getMetaData
() raises
(SQLException
);
311 //-------------------------------------------------------------------------
313 /** puts this connection in read-only mode as a hint to enable
314 database optimizations.
321 This method cannot be called while in the
322 middle of a transaction. Calling setReadOnly with
325 necessarily cause writes to be prohibited.
329 <TRUE/> enables read-only mode; <FALSE/> disables read-only mode.
331 if a database access error occurs.
333 void setReadOnly
([in]boolean readOnly) raises
(SQLException
);
334 //-------------------------------------------------------------------------
336 /** tests to see if the connection is in read-only mode.
338 <TRUE/> if connection is read-only and <FALSE/> otherwise.
340 if a database access error occurs.
342 boolean isReadOnly
() raises
(SQLException
);
343 //-------------------------------------------------------------------------
345 /** sets a catalog name in order to select
346 a subspace of this Connection's database in which to work.
347 If the driver does not support catalogs, it will
348 silently ignore this request.
350 the name of the catalog.
352 if a database access error occurs.
354 void setCatalog
([in]string catalog
) raises
(SQLException
);
355 //-------------------------------------------------------------------------
357 /** returns the Connection's current catalog name.
359 the current catalog name or an empty string.
361 if a database access error occurs.
363 string getCatalog
() raises
(SQLException
);
364 //-------------------------------------------------------------------------
366 /** attempts to change the transaction isolation level to the one given.
370 The constants defined in
371 <type scope="com::sun::star::sdbc">TransactionIsolation</type>
372 are the possible transaction isolation levels.
378 This method cannot be called while
379 in the middle of a transaction.
382 one of the TransactionIsolation values with the exception of NONE; some databases may not support other values.
384 if a database access error occurs.
386 @see com::sun::star::sdbc::XDatabaseMetaData::supportsTransactionIsolationLevel()
388 void setTransactionIsolation
([in]long level
) raises
(SQLException
);
389 //-------------------------------------------------------------------------
391 /** gets this Connection's current transaction isolation level.
393 the current TransactionIsolation mode value.
395 if a database access error occurs.
397 long getTransactionIsolation
() raises
(SQLException
);
398 //-------------------------------------------------------------------------
400 /** gets the type map object associated with this connection. Only drivers
401 which implement the custom type mapping facility will return an object otherwise
402 NULL could be returned.
405 Unless the application has added an entry to the type map, the map
406 returned will be empty.
409 the XNameAccess object associated with this Connection object.
412 if a database access error occurs.
414 com
::sun
::star
::container
::XNameAccess getTypeMap
() raises
(SQLException
);
415 //-------------------------------------------------------------------------
417 /** installs the given type map as the type map for this connection.
418 The type map will be used for the custom mapping of SQL structured types
423 Only if the driver supports custom type mapping is the setting of a map allowed.
427 set the XNameAccess object associated with this Connection object.
429 if a database access error occurs.
431 void setTypeMap
([in]com
::sun
::star
::container
::XNameAccess typeMap
)
432 raises
(SQLException
);
435 //=============================================================================
439 /*===========================================================================
440 ===========================================================================*/