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