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