1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
20 module com
{ module sun
{ module star
{ module container
{
21 published
interface XNameAccess
;
24 module com
{ module sun
{ module star
{ module sdbc
{
26 published
interface XStatement
;
27 published
interface XPreparedStatement
;
28 published
interface XDatabaseMetaData
;
31 /** represents a connection (session) with a specific
32 database. Within the context of a Connection, SQL statements are
33 executed and results are returned.
37 A Connection's database is able to provide information
38 describing its tables, its supported SQL grammar, its stored
39 procedures, and the capabilities of this connection. This
40 information is obtained with the
41 com::sun::star::sdbc::XDatabaseMetaData::getMetaData()
45 @see com::sun::star::sdbc::XDriverManager
46 @see com::sun::star::sdbc::XStatement
47 @see com::sun::star::sdbc::XDatabaseMetaData
49 published
interface XConnection
: com
::sun
::star
::sdbc
::XCloseable
53 com::sun::star::sdbc::Statement
54 object for sending SQL statements to the database.
58 SQL statements without parameters are normally
59 executed using Statement objects. If the same SQL statement
60 is executed many times, it is more efficient to use a
61 com::sun::star::sdbc::PreparedStatement.
64 Result sets created using the returned Statement will have
65 forward-only type, and read-only concurrency, by default.
68 Escape processing for the SQL-Statement is enabled, by default.
72 a new Statement object
74 if a database access error occurs.
76 XStatement createStatement
() raises
(SQLException
);
79 com::sun::star::sdbc::PreparedStatement
80 object for sending parameterized SQL statements to the database.
84 A SQL statement with or without IN parameters can be
85 pre-compiled and stored in a PreparedStatement object. This
86 object can then be used to efficiently execute this statement
94 This method is optimized for handling
95 parametric SQL statements that benefit from precompilation. If
96 the driver supports precompilation,
98 <code>prepareStatement</code>
100 the statement to the database for precompilation. Some drivers
101 may not support precompilation. In this case, the statement may
102 not be sent to the database until the
103 com::sun::star::sdbc::PreparedStatement
104 is executed. This has no direct effect on users; however, it does
105 affect which method throws certain SQLExceptions.
108 Result sets created using the returned PreparedStatement will have
109 forward-only type and read-only concurrency, by default.
112 Escape processing for the SQL-Statement is enabled, by default.
116 a SQL statement that may contain one or more "?" IN parameter placeholders
118 a new PreparedStatement object containing the pre-compiled statement
120 if a database access error occurs.
122 XPreparedStatement prepareStatement
([in]string sql
) raises
(SQLException
);
125 com::sun::star::sdbc::CallableStatement
127 database stored procedures.
131 The CallableStatement provides methods for setting up its IN and OUT
132 parameters, and methods for executing the call to a stored procedure.
138 This method is optimized for handling stored
139 procedure call statements. Some drivers may send the call
140 statement to the database when the method
141 <code>prepareCall</code>
144 others may wait until the CallableStatement is executed. This has no
145 direct effect on users; however, it does affect which method
146 throws certain SQLExceptions.
147 Result sets created using the returned CallableStatement will have
148 forward-only type and read-only concurrency, by default.
152 a SQL statement that may contain one or more "?" IN parameter placeholders
154 a new PreparedStatement object containing the pre-compiled statement
156 if a database access error occurs.
158 XPreparedStatement prepareCall
([in]string sql
) raises
(SQLException
);
160 /** converts the given SQL statement into the system's native SQL grammar.
161 A driver may convert the JDBC SQL grammar into its system's
162 native SQL grammar prior to sending it; this method returns the
163 native form of the statement that the driver would have sent.
166 a SQL statement that may contain one or more "?" parameter placeholders
168 the native form of this statement
170 if a database access error occurs.
172 string nativeSQL
([in]string sql
) raises
(SQLException
);
174 /** sets this connection's auto-commit mode.
178 If a connection is in auto-commit mode, then all its SQL
179 statements will be executed and committed as individual
180 transactions. Otherwise, its SQL statements are grouped into
181 transactions that are terminated by a call to either
183 com::sun::star::sdbc::XConnection::commit()
185 com::sun::star::sdbc::XConnection::rollback().
186 By default, new connections are in auto-commit mode.
189 The commit occurs when the statement completes or the next
190 execute occurs, whichever comes first. In the case of
191 statements returning a ResultSet, the statement completes when
192 the last row of the ResultSet has been retrieved or the
193 ResultSet has been closed. In advanced cases, a single
194 statement may return multiple results as well as output
195 parameter values. In these cases the commit occurs when all results and
196 output parameter values have been retrieved.
200 `TRUE` enables auto-commit; `FALSE` disables auto-commit.
202 if a database access error occurs.
204 void setAutoCommit
([in] boolean autoCommit
) raises
(SQLException
);
206 /** gets the current auto-commit state.
209 the current state of auto-commit mode.
211 if a database access error occurs.
215 boolean getAutoCommit
() raises
(SQLException
);
217 /** makes all changes made since the previous commit/rollback
218 permanent and releases any database locks currently held
219 by the Connection. This method should be
220 used only when auto-commit mode has been disabled.
223 if a database access error occurs.
227 void commit
() raises
(SQLException
);
229 /** drops all changes made since the previous
230 commit/rollback and releases any database locks currently held
231 by this Connection. This method should be used only when auto-commit has been disabled.
234 if a database access error occurs.
238 void rollback
() raises
(SQLException
);
240 /** tests to see if a connection is closed.
247 A Connection is automatically closed if no one references it
248 anymore. Certain fatal errors also result in a closed Connection.
252 `TRUE` if the connection is closed; `FALSE` if it's still open.
254 if a database access error occurs.
256 boolean isClosed
() raises
(SQLException
);
258 /** gets the metadata regarding this connection's database.
262 A Connection's database is able to provide information
263 describing its tables, its supported SQL grammar, its stored
264 procedures, the capabilities of this connection, and so on. This
265 information is made available through a DatabaseMetaData
270 a DatabaseMetaData object for this Connection.
272 if a database access error occurs.
274 XDatabaseMetaData getMetaData
() raises
(SQLException
);
276 /** puts this connection in read-only mode as a hint to enable
277 database optimizations.
284 This method cannot be called while in the
285 middle of a transaction. Calling setReadOnly with
288 necessarily cause writes to be prohibited.
292 `TRUE` enables read-only mode; `FALSE` disables read-only mode.
294 if a database access error occurs.
296 void setReadOnly
([in]boolean readOnly) raises
(SQLException
);
298 /** tests to see if the connection is in read-only mode.
300 `TRUE` if connection is read-only and `FALSE` otherwise.
302 if a database access error occurs.
304 boolean isReadOnly
() raises
(SQLException
);
306 /** sets a catalog name in order to select
307 a subspace of this Connection's database in which to work.
308 If the driver does not support catalogs, it will
309 silently ignore this request.
311 the name of the catalog.
313 if a database access error occurs.
315 void setCatalog
([in]string catalog
) raises
(SQLException
);
317 /** returns the Connection's current catalog name.
319 the current catalog name or an empty string.
321 if a database access error occurs.
323 string getCatalog
() raises
(SQLException
);
325 /** attempts to change the transaction isolation level to the one given.
329 The constants defined in
330 com::sun::star::sdbc::TransactionIsolation
331 are the possible transaction isolation levels.
337 This method cannot be called while
338 in the middle of a transaction.
341 one of the TransactionIsolation values with the exception of NONE; some databases may not support other values.
343 if a database access error occurs.
345 @see com::sun::star::sdbc::XDatabaseMetaData::supportsTransactionIsolationLevel()
347 void setTransactionIsolation
([in]long level
) raises
(SQLException
);
349 /** gets this Connection's current transaction isolation level.
351 the current TransactionIsolation mode value.
353 if a database access error occurs.
355 long getTransactionIsolation
() raises
(SQLException
);
357 /** gets the type map object associated with this connection. Only drivers
358 which implement the custom type mapping facility will return an object otherwise
359 NULL could be returned.
362 Unless the application has added an entry to the type map, the map
363 returned will be empty.
366 the XNameAccess object associated with this Connection object.
369 if a database access error occurs.
371 com
::sun
::star
::container
::XNameAccess getTypeMap
() raises
(SQLException
);
373 /** installs the given type map as the type map for this connection.
374 The type map will be used for the custom mapping of SQL structured types
379 Only if the driver supports custom type mapping is the setting of a map allowed.
383 set the XNameAccess object associated with this Connection object.
385 if a database access error occurs.
387 void setTypeMap
([in]com
::sun
::star
::container
::XNameAccess typeMap
)
388 raises
(SQLException
);
394 /*===========================================================================
395 ===========================================================================*/
397 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */