1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
27 #ifndef __com_sun_star_sdbc_XConnection_idl__
28 #define __com_sun_star_sdbc_XConnection_idl__
30 #ifndef __com_sun_star_uno_XInterface_idl__
31 #include
<com
/sun
/star
/uno
/XInterface.idl
>
34 module com
{ module sun
{ module star
{ module container
{
35 published
interface XNameAccess
;
38 #ifndef __com_sun_star_sdbc_SQLException_idl__
39 #include
<com
/sun
/star
/sdbc
/SQLException.idl
>
42 #ifndef __com_sun_star_sdbc_XCloseable_idl__
43 #include
<com
/sun
/star
/sdbc
/XCloseable.idl
>
46 module com
{ module sun
{ module star
{ module sdbc
{
48 published
interface XStatement
;
49 published
interface XPreparedStatement
;
50 published
interface XDatabaseMetaData
;
53 /** represents a connection (session) with a specific
54 database. Within the context of a Connection, SQL statements are
55 executed and results are returned.
59 A Connection's database is able to provide information
60 describing its tables, its supported SQL grammar, its stored
61 procedures, and the capabilities of this connection. This
62 information is obtained with the
63 <member scope="com::sun::star::sdbc">XDatabaseMetaData::getMetaData()</member>
67 @see com::sun::star::sdbc::XDriverManager
68 @see com::sun::star::sdbc::XStatement
69 @see com::sun::star::sdbc::XDatabaseMetaData
71 published
interface XConnection
: com
::sun
::star
::sdbc
::XCloseable
75 <type scope="com::sun::star::sdbc">Statement</type>
76 object for sending SQL statements to the database.
80 SQL statements without parameters are normally
81 executed using Statement objects. If the same SQL statement
82 is executed many times, it is more efficient to use a
83 <type scope="com::sun::star::sdbc">PreparedStatement</type>
87 Result sets created using the returned Statement will have
88 forward-only type, and read-only concurrency, by default.
91 Escape processing for the SQL-Statement is enabled, by default.
95 a new Statement object
97 if a database access error occurs.
99 XStatement createStatement
() raises
(SQLException
);
100 //-------------------------------------------------------------------------
103 <type scope="com::sun::star::sdbc">PreparedStatement</type>
104 object for sending parameterized SQL statements to the database.
108 A SQL statement with or without IN parameters can be
109 pre-compiled and stored in a PreparedStatement object. This
110 object can then be used to efficiently execute this statement
118 This method is optimized for handling
119 parametric SQL statements that benefit from precompilation. If
120 the driver supports precompilation,
122 <code>prepareStatement</code>
124 the statement to the database for precompilation. Some drivers
125 may not support precompilation. In this case, the statement may
126 not be sent to the database until the
127 <type scope="com::sun::star::sdbc">PreparedStatement</type>
128 is executed. This has no direct effect on users; however, it does
129 affect which method throws certain SQLExceptions.
132 Result sets created using the returned PreparedStatement will have
133 forward-only type and read-only concurrency, by default.
136 Escape processing for the SQL-Statement is enabled, by default.
140 a SQL statement that may contain one or more '?' IN parameter placeholders
142 a new PreparedStatement object containing the pre-compiled statement
144 if a database access error occurs.
146 XPreparedStatement prepareStatement
([in]string sql
) raises
(SQLException
);
147 //-------------------------------------------------------------------------
150 <type scope="com::sun::star::sdbc">CallableStatement</type>
152 database stored procedures.
156 The CallableStatement provides methods for setting up its IN and OUT
157 parameters, and methods for executing the call to a stored procedure.
163 This method is optimized for handling stored
164 procedure call statements. Some drivers may send the call
165 statement to the database when the method
166 <code>prepareCall</code>
169 others may wait until the CallableStatement is executed. This has no
170 direct effect on users; however, it does affect which method
171 throws certain SQLExceptions.
172 Result sets created using the returned CallableStatement will have
173 forward-only type and read-only concurrency, by default.
177 a SQL statement that may contain one or more '?' IN parameter placeholders
179 a new PreparedStatement object containing the pre-compiled statement
181 if a database access error occurs.
183 XPreparedStatement prepareCall
([in]string sql
) raises
(SQLException
);
184 //-------------------------------------------------------------------------
186 /** converts the given SQL statement into the system's native SQL grammar.
187 A driver may convert the JDBC SQL grammar into its system's
188 native SQL grammar prior to sending it; this method returns the
189 native form of the statement that the driver would have sent.
192 a SQL statement that may contain one or more '?' parameter placeholders
194 the native form of this statement
196 if a database access error occurs.
198 string nativeSQL
([in]string sql
) raises
(SQLException
);
199 //-------------------------------------------------------------------------
201 /** sets this connection's auto-commit mode.
205 If a connection is in auto-commit mode, then all its SQL
206 statements will be executed and committed as individual
207 transactions. Otherwise, its SQL statements are grouped into
208 transactions that are terminated by a call to either
210 <member scope="com::sun::star::sdbc">XConnection::commit()</member>
212 <member scope="com::sun::star::sdbc">XConnection::rollback()</member>
214 By default, new connections are in auto-commit mode.
217 The commit occurs when the statement completes or the next
218 execute occurs, whichever comes first. In the case of
219 statements returning a ResultSet, the statement completes when
220 the last row of the ResultSet has been retrieved or the
221 ResultSet has been closed. In advanced cases, a single
222 statement may return multiple results as well as output
223 parameter values. In these cases the commit occurs when all results and
224 output parameter values have been retrieved.
228 <TRUE/> enables auto-commit; <FALSE/> disables auto-commit.
230 if a database access error occurs.
232 void setAutoCommit
([in] boolean autoCommit
) raises
(SQLException
);
233 //-------------------------------------------------------------------------
235 /** gets the current auto-commit state.
238 the current state of auto-commit mode.
240 if a database access error occurs.
244 boolean getAutoCommit
() raises
(SQLException
);
245 //-------------------------------------------------------------------------
247 /** makes all changes made since the previous commit/rollback
248 permanent and releases any database locks currently held
249 by the Connection. This method should be
250 used only when auto-commit mode has been disabled.
253 if a database access error occurs.
257 void commit
() raises
(SQLException
);
258 //-------------------------------------------------------------------------
260 /** drops all changes made since the previous
261 commit/rollback and releases any database locks currently held
262 by this Connection. This method should be used only when auto-commit has been disabled.
265 if a database access error occurs.
269 void rollback
() raises
(SQLException
);
270 //-------------------------------------------------------------------------
272 /** tests to see if a connection is closed.
279 A Connection is automatically closed if no one references it
280 anymore. Certain fatal errors also result in a closed Connection.
284 <TRUE/> if the connection is closed; <FALSE/> if it's still open.
286 if a database access error occurs.
288 boolean isClosed
() raises
(SQLException
);
289 //-------------------------------------------------------------------------
291 /** gets the metadata regarding this connection's database.
295 A Connection's database is able to provide information
296 describing its tables, its supported SQL grammar, its stored
297 procedures, the capabilities of this connection, and so on. This
298 information is made available through a DatabaseMetaData
303 a DatabaseMetaData object for this Connection.
305 if a database access error occurs.
307 XDatabaseMetaData getMetaData
() raises
(SQLException
);
308 //-------------------------------------------------------------------------
310 /** puts this connection in read-only mode as a hint to enable
311 database optimizations.
318 This method cannot be called while in the
319 middle of a transaction. Calling setReadOnly with
322 necessarily cause writes to be prohibited.
326 <TRUE/> enables read-only mode; <FALSE/> disables read-only mode.
328 if a database access error occurs.
330 void setReadOnly
([in]boolean readOnly) raises
(SQLException
);
331 //-------------------------------------------------------------------------
333 /** tests to see if the connection is in read-only mode.
335 <TRUE/> if connection is read-only and <FALSE/> otherwise.
337 if a database access error occurs.
339 boolean isReadOnly
() raises
(SQLException
);
340 //-------------------------------------------------------------------------
342 /** sets a catalog name in order to select
343 a subspace of this Connection's database in which to work.
344 If the driver does not support catalogs, it will
345 silently ignore this request.
347 the name of the catalog.
349 if a database access error occurs.
351 void setCatalog
([in]string catalog
) raises
(SQLException
);
352 //-------------------------------------------------------------------------
354 /** returns the Connection's current catalog name.
356 the current catalog name or an empty string.
358 if a database access error occurs.
360 string getCatalog
() raises
(SQLException
);
361 //-------------------------------------------------------------------------
363 /** attempts to change the transaction isolation level to the one given.
367 The constants defined in
368 <type scope="com::sun::star::sdbc">TransactionIsolation</type>
369 are the possible transaction isolation levels.
375 This method cannot be called while
376 in the middle of a transaction.
379 one of the TransactionIsolation values with the exception of NONE; some databases may not support other values.
381 if a database access error occurs.
383 @see com::sun::star::sdbc::XDatabaseMetaData::supportsTransactionIsolationLevel()
385 void setTransactionIsolation
([in]long level
) raises
(SQLException
);
386 //-------------------------------------------------------------------------
388 /** gets this Connection's current transaction isolation level.
390 the current TransactionIsolation mode value.
392 if a database access error occurs.
394 long getTransactionIsolation
() raises
(SQLException
);
395 //-------------------------------------------------------------------------
397 /** gets the type map object associated with this connection. Only drivers
398 which implement the custom type mapping facility will return an object otherwise
399 NULL could be returned.
402 Unless the application has added an entry to the type map, the map
403 returned will be empty.
406 the XNameAccess object associated with this Connection object.
409 if a database access error occurs.
411 com
::sun
::star
::container
::XNameAccess getTypeMap
() raises
(SQLException
);
412 //-------------------------------------------------------------------------
414 /** installs the given type map as the type map for this connection.
415 The type map will be used for the custom mapping of SQL structured types
420 Only if the driver supports custom type mapping is the setting of a map allowed.
424 set the XNameAccess object associated with this Connection object.
426 if a database access error occurs.
428 void setTypeMap
([in]com
::sun
::star
::container
::XNameAccess typeMap
)
429 raises
(SQLException
);
432 //=============================================================================
436 /*===========================================================================
437 ===========================================================================*/