xref: /AOO41X/main/offapi/com/sun/star/sdb/ErrorCondition.idl (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir/*************************************************************************
2*cdf0e10cSrcweir *
3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir *
5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir *
7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir *
9*cdf0e10cSrcweir * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir *
11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir *
15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir *
21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir *
26*cdf0e10cSrcweir ************************************************************************/
27*cdf0e10cSrcweir
28*cdf0e10cSrcweir#ifndef __com_sun_star_sdb_ErrorCondition_idl__
29*cdf0e10cSrcweir#define __com_sun_star_sdb_ErrorCondition_idl__
30*cdf0e10cSrcweir
31*cdf0e10cSrcweir//=============================================================================
32*cdf0e10cSrcweir
33*cdf0e10cSrcweirmodule com { module sun { module star { module sdb {
34*cdf0e10cSrcweir
35*cdf0e10cSrcweir//=============================================================================
36*cdf0e10cSrcweir
37*cdf0e10cSrcweir/** defines error conditions for OpenOffice.org Base core components
38*cdf0e10cSrcweir
39*cdf0e10cSrcweir    <p>Core components of OpenOffice.org will use those error conditions
40*cdf0e10cSrcweir    as error codes (<member scope="com::sun::star::sdbc">SQLException::ErrorCode</member>)
41*cdf0e10cSrcweir    whereever possible.<br/>
42*cdf0e10cSrcweir    That is, if an <code>SQLException</code> is raised by
43*cdf0e10cSrcweir    such a component, caused by an error condition which is included in the
44*cdf0e10cSrcweir    <type>ErrorCondition</type> group, then the respective <em>negative</em> value
45*cdf0e10cSrcweir    will be used as <code>ErrorCode</code>.</p>
46*cdf0e10cSrcweir
47*cdf0e10cSrcweir    <p>This allows to determine specific error conditions in your client code, and
48*cdf0e10cSrcweir    to handle it appropriately.</p>
49*cdf0e10cSrcweir
50*cdf0e10cSrcweir    <p>Note that before you examine the <code>ErrorCode</code> member of a caught
51*cdf0e10cSrcweir    <code>SQLException</code>, you need to make sure that the exception
52*cdf0e10cSrcweir    is really thrown by an OpenOffice.org Base core component. To do so, check
53*cdf0e10cSrcweir    whether the error message (<code>Exception::Message</code>) starts with the
54*cdf0e10cSrcweir    vendor string <code>[OOoBase]</code>.</p>
55*cdf0e10cSrcweir
56*cdf0e10cSrcweir    <p>The list of defined error conditions, by nature, is expected to permanently grow,
57*cdf0e10cSrcweir    so never assume it being finalized.</p>
58*cdf0e10cSrcweir
59*cdf0e10cSrcweir    @example Java
60*cdf0e10cSrcweir    <listing>
61*cdf0e10cSrcweir    catch ( SQLException e )
62*cdf0e10cSrcweir    {
63*cdf0e10cSrcweir    &nbsp;&nbsp;if ( e.Message.startsWith( "[OOoBase]" ) )
64*cdf0e10cSrcweir    &nbsp;&nbsp;&nbsp;&nbsp;if ( e.ErrorCode + ErrorCondition.SOME_ERROR_CONDITION == 0 )
65*cdf0e10cSrcweir    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;handleSomeErrorCondition();
66*cdf0e10cSrcweir    }
67*cdf0e10cSrcweir    </listing>
68*cdf0e10cSrcweir */
69*cdf0e10cSrcweirconstants ErrorCondition
70*cdf0e10cSrcweir{
71*cdf0e10cSrcweir    // ========================================================================
72*cdf0e10cSrcweir    // = section ROW_SET - css.sdb.RowSet related error conditions
73*cdf0e10cSrcweir
74*cdf0e10cSrcweir    /** is used by and <type>RowSet</type> to indicate that an operation has been vetoed
75*cdf0e10cSrcweir        by one of its approval listeners
76*cdf0e10cSrcweir
77*cdf0e10cSrcweir        <p>This error condition results in raising a <type>RowSetVetoException</type>.</p>
78*cdf0e10cSrcweir        @see RowSet
79*cdf0e10cSrcweir        @see XRowSetApproveBroadcaster
80*cdf0e10cSrcweir        @see XRowSetApproveListener
81*cdf0e10cSrcweir    */
82*cdf0e10cSrcweir    const long ROW_SET_OPERATION_VETOED = 100;
83*cdf0e10cSrcweir
84*cdf0e10cSrcweir    // ========================================================================
85*cdf0e10cSrcweir    // = section PARSER - parsing related error conditions
86*cdf0e10cSrcweir
87*cdf0e10cSrcweir    /** indicates that while parsing an SQL statement, cyclic sub queries have been detected.
88*cdf0e10cSrcweir
89*cdf0e10cSrcweir        <p>Imagine you have a client-side query <code>SELECT * FROM table</code>, which is
90*cdf0e10cSrcweir        saved as &quot;query1&quot;. Additionally, there is a query &quot;query2&quot; defined
91*cdf0e10cSrcweir        as <code>SELECT * FROM query1</code>. Now if you try to change the statement of
92*cdf0e10cSrcweir        <type>query1</type> to <code>SELECT * FROM query2</code>, this is prohibited, because
93*cdf0e10cSrcweir        it would lead to a cyclic sub query.
94*cdf0e10cSrcweir    */
95*cdf0e10cSrcweir    const long PARSER_CYCLIC_SUB_QUERIES = 200;
96*cdf0e10cSrcweir
97*cdf0e10cSrcweir    // ========================================================================
98*cdf0e10cSrcweir    // = section DB - application-level error conditions
99*cdf0e10cSrcweir    // =
100*cdf0e10cSrcweir    // = next section should start with 500
101*cdf0e10cSrcweir
102*cdf0e10cSrcweir    /** indicates that the name of a client side database object - a query, a form,
103*cdf0e10cSrcweir        or a report - contains one or more slashes, which is forbidden.
104*cdf0e10cSrcweir    */
105*cdf0e10cSrcweir    const long DB_OBJECT_NAME_WITH_SLASHES = 300;
106*cdf0e10cSrcweir
107*cdf0e10cSrcweir    /** indicates that an identifier is not SQL conform.
108*cdf0e10cSrcweir    */
109*cdf0e10cSrcweir    const long DB_INVALID_SQL_NAME = 301;
110*cdf0e10cSrcweir
111*cdf0e10cSrcweir    /** indicates that the name of a query contains quote characters.
112*cdf0e10cSrcweir
113*cdf0e10cSrcweir        <p>This error condition is met when the user attempts to save a query
114*cdf0e10cSrcweir        with a name which contains one of the possible database quote characters.
115*cdf0e10cSrcweir        This is an error since query names can potentially be used in
116*cdf0e10cSrcweir        <code>SELECT</code> statements, where quote identifiers would render the statement invalid.</p>
117*cdf0e10cSrcweir
118*cdf0e10cSrcweir        @see com::sun::star::sdb::tools::XDataSourceMetaData::supportsQueriesInFrom
119*cdf0e10cSrcweir    */
120*cdf0e10cSrcweir    const long DB_QUERY_NAME_WITH_QUOTES = 302;
121*cdf0e10cSrcweir
122*cdf0e10cSrcweir    /** indicates that an attempt was made to save a database object under a name
123*cdf0e10cSrcweir        which is already used in the database.
124*cdf0e10cSrcweir
125*cdf0e10cSrcweir        <p>In databases which support query names to appear in <code>SELECT</code>
126*cdf0e10cSrcweir        statements, this could mean that a table was attempted to be saved with the
127*cdf0e10cSrcweir        name of an existing query, or vice versa.</p>
128*cdf0e10cSrcweir
129*cdf0e10cSrcweir        <p>Otherwise, it means an object was attempted to be saved with the
130*cdf0e10cSrcweir        name of an already existing object of the same type.</p>
131*cdf0e10cSrcweir
132*cdf0e10cSrcweir        @see com::sun::star::sdb::application::DatabaseObject
133*cdf0e10cSrcweir        @see com::sun::star::sdb::tools::XDataSourceMetaData::supportsQueriesInFrom
134*cdf0e10cSrcweir    */
135*cdf0e10cSrcweir    const long DB_OBJECT_NAME_IS_USED = 303;
136*cdf0e10cSrcweir
137*cdf0e10cSrcweir    /** indicates an operation was attempted which needs a connection to the
138*cdf0e10cSrcweir        database, which did not exist at that time.
139*cdf0e10cSrcweir    */
140*cdf0e10cSrcweir    const long DB_NOT_CONNECTED = 304;
141*cdf0e10cSrcweir
142*cdf0e10cSrcweir    // ========================================================================
143*cdf0e10cSrcweir    // = section AB - address book access related error conditions
144*cdf0e10cSrcweir    // =
145*cdf0e10cSrcweir    // = next section should start with 550
146*cdf0e10cSrcweir
147*cdf0e10cSrcweir    /** used by the component implementing address book access to indicate that a requested address book could
148*cdf0e10cSrcweir        not be accessed.
149*cdf0e10cSrcweir
150*cdf0e10cSrcweir        <p>For instance, this error code is used when you try to access the address book
151*cdf0e10cSrcweir        in a Thunderbird profile named <q>MyProfile</q>,  but there does not exist a profile
152*cdf0e10cSrcweir        with this name.</p>
153*cdf0e10cSrcweir    */
154*cdf0e10cSrcweir    const long AB_ADDRESSBOOK_NOT_FOUND = 500;
155*cdf0e10cSrcweir
156*cdf0e10cSrcweir    // ========================================================================
157*cdf0e10cSrcweir    // = section DATA - data retrieval related error conditions
158*cdf0e10cSrcweir    // =
159*cdf0e10cSrcweir    // = next section should start with 600
160*cdf0e10cSrcweir
161*cdf0e10cSrcweir    /** used to indicate that a <code>SELECT</code> operation on a table needs a filter.
162*cdf0e10cSrcweir
163*cdf0e10cSrcweir        <p>Some database drivers are not able to <code>SELECT</code> from a table if the
164*cdf0e10cSrcweir        statement does not contain a <code>WHERE</code> clause. In this case, a statement
165*cdf0e10cSrcweir        like <code>SELECT * FROM "table"</cdeo> with fail with the error code
166*cdf0e10cSrcweir        <code>DATA_CANNOT_SELECT_UNFILTERED</code>.</p>
167*cdf0e10cSrcweir
168*cdf0e10cSrcweir        <p>It is also legitimate for the driver to report this error condition as warning, and provide
169*cdf0e10cSrcweir        an empty result set, instead of ungracefull failing.</p>
170*cdf0e10cSrcweir    */
171*cdf0e10cSrcweir    const long DATA_CANNOT_SELECT_UNFILTERED = 550;
172*cdf0e10cSrcweir};
173*cdf0e10cSrcweir
174*cdf0e10cSrcweir//=============================================================================
175*cdf0e10cSrcweir
176*cdf0e10cSrcweir}; }; }; };
177*cdf0e10cSrcweir
178*cdf0e10cSrcweir//=============================================================================
179*cdf0e10cSrcweir
180*cdf0e10cSrcweir#endif
181