build fix
[LibreOffice.git] / connectivity / source / drivers / evoab2 / NStatement.cxx
blob4cad191ccaa569d3e0d49eefd43b6ae0279dd19e
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 #include <osl/diagnose.h>
21 #include <osl/thread.h>
22 #include <rtl/ustring.hxx>
23 #include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
24 #include <com/sun/star/sdbc/ResultSetType.hpp>
25 #include <com/sun/star/sdbc/FetchDirection.hpp>
26 #include <com/sun/star/lang/DisposedException.hpp>
27 #include <cppuhelper/typeprovider.hxx>
28 #include "propertyids.hxx"
29 #include "NStatement.hxx"
30 #include "NConnection.hxx"
31 #include "NDatabaseMetaData.hxx"
32 #include "NResultSet.hxx"
33 #include "resource/evoab2_res.hrc"
34 #include "sqlbison.hxx"
35 #include <resource/common_res.hrc>
36 #include <connectivity/dbexception.hxx>
37 #include <tools/diagnose_ex.h>
39 namespace connectivity { namespace evoab {
42 using namespace com::sun::star::uno;
43 using namespace com::sun::star::lang;
44 using namespace com::sun::star::beans;
45 using namespace com::sun::star::sdbc;
46 using namespace com::sun::star::sdbcx;
47 using namespace com::sun::star::container;
48 using namespace com::sun::star::io;
49 using namespace com::sun::star::util;
51 namespace {
53 EBookQuery * createTrue()
54 { // Not the world's most efficient unconditional true but ...
55 return e_book_query_from_string("(exists \"full_name\")");
58 EBookQuery * createTest( const OUString &aColumnName,
59 EBookQueryTest eTest,
60 const OUString &aMatch )
62 OString sMatch = OUStringToOString( aMatch, RTL_TEXTENCODING_UTF8 );
63 OString sColumnName = OUStringToOString( aColumnName, RTL_TEXTENCODING_UTF8 );
65 return e_book_query_field_test( e_contact_field_id( sColumnName.getStr() ),
66 eTest, sMatch.getStr() );
71 OCommonStatement::OCommonStatement(OEvoabConnection* _pConnection)
72 : OCommonStatement_IBase(m_aMutex)
73 , ::comphelper::OPropertyContainer(OCommonStatement_IBase::rBHelper)
74 , OStatement_CBase( static_cast<cppu::OWeakObject*>(_pConnection), this )
75 , m_xResultSet(nullptr)
76 , m_pConnection(_pConnection)
77 , m_aParser(_pConnection->getDriver().getComponentContext())
78 , m_aSQLIterator( _pConnection, _pConnection->createCatalog()->getTables(), m_aParser )
79 , m_pParseTree(nullptr)
80 , m_nMaxFieldSize(0)
81 , m_nMaxRows(0)
82 , m_nQueryTimeOut(0)
83 , m_nFetchSize(0)
84 , m_nResultSetType(ResultSetType::FORWARD_ONLY)
85 , m_nFetchDirection(FetchDirection::FORWARD)
86 , m_nResultSetConcurrency(ResultSetConcurrency::UPDATABLE)
87 , m_bEscapeProcessing(true)
89 m_pConnection->acquire();
91 #define REGISTER_PROP( id, member ) \
92 registerProperty( \
93 OMetaConnection::getPropMap().getNameByIndex( id ), \
94 id, \
95 0, \
96 &member, \
97 cppu::UnoType<decltype(member)>::get() \
100 REGISTER_PROP( PROPERTY_ID_CURSORNAME, m_aCursorName );
101 REGISTER_PROP( PROPERTY_ID_MAXFIELDSIZE, m_nMaxFieldSize );
102 REGISTER_PROP( PROPERTY_ID_MAXROWS, m_nMaxRows );
103 REGISTER_PROP( PROPERTY_ID_QUERYTIMEOUT, m_nQueryTimeOut );
104 REGISTER_PROP( PROPERTY_ID_FETCHSIZE, m_nFetchSize );
105 REGISTER_PROP( PROPERTY_ID_RESULTSETTYPE, m_nResultSetType );
106 REGISTER_PROP( PROPERTY_ID_FETCHDIRECTION, m_nFetchDirection );
107 REGISTER_PROP( PROPERTY_ID_ESCAPEPROCESSING, m_bEscapeProcessing );
108 REGISTER_PROP( PROPERTY_ID_RESULTSETCONCURRENCY, m_nResultSetConcurrency );
111 OCommonStatement::~OCommonStatement()
115 void OCommonStatement::disposeResultSet()
117 // free the cursor if alive
118 Reference< XComponent > xComp(m_xResultSet.get(), UNO_QUERY);
119 if (xComp.is())
120 xComp->dispose();
121 m_xResultSet.clear();
124 void OCommonStatement::disposing()
126 ::osl::MutexGuard aGuard(m_aMutex);
128 disposeResultSet();
130 if (m_pConnection)
131 m_pConnection->release();
132 m_pConnection = nullptr;
134 dispose_ChildImpl();
135 OCommonStatement_IBase::disposing();
138 Any SAL_CALL OCommonStatement::queryInterface( const Type & rType ) throw(RuntimeException, std::exception)
140 Any aRet = OCommonStatement_IBase::queryInterface(rType);
141 if(!aRet.hasValue())
142 aRet = ::comphelper::OPropertyContainer::queryInterface(rType);
143 return aRet;
146 Sequence< Type > SAL_CALL OCommonStatement::getTypes( ) throw(RuntimeException, std::exception)
148 ::cppu::OTypeCollection aTypes( cppu::UnoType<XMultiPropertySet>::get(),
149 cppu::UnoType<XFastPropertySet>::get(),
150 cppu::UnoType<XPropertySet>::get());
152 return ::comphelper::concatSequences(aTypes.getTypes(),OCommonStatement_IBase::getTypes());
156 //void SAL_CALL OCommonStatement::cancel( ) throw(RuntimeException)
158 //::osl::MutexGuard aGuard( m_aMutex );
159 //checkDisposed(OCommonStatement_IBase::rBHelper.bDisposed);
160 //// cancel the current sql statement
164 void SAL_CALL OCommonStatement::close( ) throw(SQLException, RuntimeException, std::exception)
167 ::osl::MutexGuard aGuard( m_aMutex );
168 checkDisposed(OCommonStatement_IBase::rBHelper.bDisposed);
171 dispose();
174 OUString OCommonStatement::impl_getColumnRefColumnName_throw( const OSQLParseNode& _rColumnRef )
176 ENSURE_OR_THROW( SQL_ISRULE( &_rColumnRef, column_ref ), "internal error: only column_refs supported as LHS" );
178 OUString sColumnName;
179 switch ( _rColumnRef.count() )
181 case 3: // SQL_TOKEN_NAME '.' column_val
183 const OSQLParseNode* pPunct = _rColumnRef.getChild( 1 );
184 const OSQLParseNode* pColVal = _rColumnRef.getChild( 2 );
185 if ( SQL_ISPUNCTUATION( pPunct, "." )
186 && ( pColVal->count() == 1 )
189 sColumnName = pColVal->getChild( 0 )->getTokenValue();
192 break;
194 case 1: // column
196 sColumnName = _rColumnRef.getChild( 0 )->getTokenValue();
198 break;
201 if ( !sColumnName.getLength() )
202 m_pConnection->throwGenericSQLException( STR_QUERY_TOO_COMPLEX, *this );
204 return sColumnName;
208 void OCommonStatement::orderByAnalysis( const OSQLParseNode* _pOrderByClause, SortDescriptor& _out_rSort )
210 ENSURE_OR_THROW( _pOrderByClause, "NULL node" );
211 ENSURE_OR_THROW( SQL_ISRULE( _pOrderByClause, opt_order_by_clause ), "wrong node type" );
213 _out_rSort.clear();
215 const OSQLParseNode* pOrderList = _pOrderByClause->getByRule( OSQLParseNode::ordering_spec_commalist );
216 ENSURE_OR_THROW( pOrderList, "unexpected parse tree structure" );
218 for ( size_t i=0; i<pOrderList->count(); ++i )
220 const OSQLParseNode* pOrderBy = pOrderList->getChild(i);
221 if ( !pOrderBy || !SQL_ISRULE( pOrderBy, ordering_spec ) )
222 continue;
223 const OSQLParseNode* pColumnRef = pOrderBy->count() == 2 ? pOrderBy->getChild(0) : nullptr;
224 const OSQLParseNode* pAscDesc = pOrderBy->count() == 2 ? pOrderBy->getChild(1) : nullptr;
225 ENSURE_OR_THROW(
226 ( pColumnRef != nullptr )
227 && ( pAscDesc != nullptr )
228 && SQL_ISRULE( pAscDesc, opt_asc_desc )
229 && ( pAscDesc->count() < 2 ),
230 "ordering_spec structure error" );
232 // column name -> column field
233 if ( !SQL_ISRULE( pColumnRef, column_ref ) )
234 m_pConnection->throwGenericSQLException( STR_SORT_BY_COL_ONLY, *this );
235 const OUString sColumnName( impl_getColumnRefColumnName_throw( *pColumnRef ) );
236 guint nField = evoab::findEvoabField( sColumnName );
237 // ascending/descending?
238 bool bAscending = true;
239 if ( ( pAscDesc->count() == 1 )
240 && SQL_ISTOKEN( pAscDesc->getChild( 0 ), DESC )
242 bAscending = false;
244 _out_rSort.push_back( FieldSort( nField, bAscending ) );
249 EBookQuery *OCommonStatement::whereAnalysis( const OSQLParseNode* parseTree )
251 EBookQuery *pResult = nullptr;
253 ENSURE_OR_THROW( parseTree, "invalid parse tree" );
255 // Nested brackets
256 if( parseTree->count() == 3 &&
257 SQL_ISPUNCTUATION( parseTree->getChild( 0 ), "(" ) &&
258 SQL_ISPUNCTUATION( parseTree->getChild( 2 ), ")" ) )
260 pResult = whereAnalysis( parseTree->getChild( 1 ) );
263 // SQL AND, OR
264 else if( ( SQL_ISRULE( parseTree, search_condition ) ||
265 SQL_ISRULE( parseTree, boolean_term ) ) &&
266 parseTree->count() == 3 )
268 ENSURE_OR_THROW( SQL_ISTOKEN( parseTree->getChild( 1 ), OR )
269 || SQL_ISTOKEN( parseTree->getChild( 1 ), AND ),
270 "unexpected search_condition structure" );
272 EBookQuery *pArgs[2];
273 pArgs[0] = whereAnalysis( parseTree->getChild( 0 ) );
274 pArgs[1] = whereAnalysis( parseTree->getChild( 2 ) );
276 if( SQL_ISTOKEN( parseTree->getChild( 1 ), OR ) )
277 pResult = e_book_query_or( 2, pArgs, TRUE );
278 else
279 pResult = e_book_query_and( 2, pArgs, TRUE );
281 // SQL =, !=
282 else if( SQL_ISRULE( parseTree, comparison_predicate ) )
284 OSQLParseNode *pPrec = parseTree->getChild( 1 );
286 ENSURE_OR_THROW( parseTree->count() == 3, "unexpected comparison_predicate structure" );
288 OSQLParseNode* pLHS = parseTree->getChild( 0 );
289 OSQLParseNode* pRHS = parseTree->getChild( 2 );
291 if ( ( !( SQL_ISRULE( pLHS, column_ref ) ) // on the LHS, we accept a column or a constant int value
292 && ( pLHS->getNodeType() != SQLNodeType::IntNum )
294 || ( ( pRHS->getNodeType() != SQLNodeType::String ) // on the RHS, certain literals are acceptable
295 && ( pRHS->getNodeType() != SQLNodeType::IntNum )
296 && ( pRHS->getNodeType() != SQLNodeType::ApproxNum )
297 && !( SQL_ISTOKEN( pRHS, TRUE ) )
298 && !( SQL_ISTOKEN( pRHS, FALSE ) )
300 || ( ( pLHS->getNodeType() == SQLNodeType::IntNum ) // an int on LHS requires an int on RHS
301 && ( pRHS->getNodeType() != SQLNodeType::IntNum )
305 m_pConnection->throwGenericSQLException( STR_QUERY_TOO_COMPLEX, *this );
308 if ( ( pPrec->getNodeType() != SQLNodeType::Equal )
309 && ( pPrec->getNodeType() != SQLNodeType::NotEqual )
312 m_pConnection->throwGenericSQLException( STR_OPERATOR_TOO_COMPLEX, *this );
315 // recognize the special "0 = 1" condition
316 if ( ( pLHS->getNodeType() == SQLNodeType::IntNum )
317 && ( pRHS->getNodeType() == SQLNodeType::IntNum )
318 && ( pPrec->getNodeType() == SQLNodeType::Equal )
321 const sal_Int32 nLHS = pLHS->getTokenValue().toInt64();
322 const sal_Int32 nRHS = pRHS->getTokenValue().toInt64();
323 return ( nLHS == nRHS ) ? createTrue() : nullptr;
326 OUString aColumnName( impl_getColumnRefColumnName_throw( *pLHS ) );
328 OUString aMatchString;
329 if ( pRHS->isToken() )
330 aMatchString = pRHS->getTokenValue();
331 else
332 aMatchString = pRHS->getChild( 0 )->getTokenValue();
334 pResult = createTest( aColumnName, E_BOOK_QUERY_IS, aMatchString );
336 if ( pResult && ( pPrec->getNodeType() == SQLNodeType::NotEqual ) )
337 pResult = e_book_query_not( pResult, TRUE );
339 // SQL like
340 else if( SQL_ISRULE( parseTree, like_predicate ) )
342 ENSURE_OR_THROW( parseTree->count() == 2, "unexpected like_predicate structure" );
343 const OSQLParseNode* pPart2 = parseTree->getChild(1);
345 if( ! SQL_ISRULE( parseTree->getChild( 0 ), column_ref) )
346 m_pConnection->throwGenericSQLException(STR_QUERY_INVALID_LIKE_COLUMN,*this);
348 OUString aColumnName( impl_getColumnRefColumnName_throw( *parseTree->getChild( 0 ) ) );
350 OSQLParseNode *pAtom = pPart2->getChild( pPart2->count() - 2 ); // Match String
351 bool bNotLike = pPart2->getChild(0)->isToken();
353 if( !( pAtom->getNodeType() == SQLNodeType::String ||
354 pAtom->getNodeType() == SQLNodeType::Name ||
355 SQL_ISRULE( pAtom,parameter ) ||
356 ( pAtom->getChild( 0 ) && pAtom->getChild( 0 )->getNodeType() == SQLNodeType::Name ) ||
357 ( pAtom->getChild( 0 ) && pAtom->getChild( 0 )->getNodeType() == SQLNodeType::String ) ) )
359 SAL_INFO(
360 "connectivity.evoab2",
361 "analyseSQL : pAtom->count() = " << pAtom->count());
362 m_pConnection->throwGenericSQLException(STR_QUERY_INVALID_LIKE_STRING,*this);
365 const sal_Unicode WILDCARD = '%';
367 OUString aMatchString;
368 aMatchString = pAtom->getTokenValue();
370 // Determine where '%' character is...
371 if( aMatchString == OUStringLiteral1(WILDCARD) )
373 // String containing only a '%' and nothing else matches everything
374 pResult = createTest( aColumnName, E_BOOK_QUERY_CONTAINS,
375 "" );
377 else if( aMatchString.indexOf( WILDCARD ) == -1 )
378 { // Simple string , eg. "to match" "contains in evo"
379 SAL_INFO( "connectivity.evoab2", "Plain contains '" << aMatchString << "'" );
380 pResult = createTest( aColumnName, E_BOOK_QUERY_CONTAINS, aMatchString );
381 if( pResult && bNotLike )
382 pResult = e_book_query_not( pResult, TRUE );
384 else if( bNotLike )
386 // We currently can't handle a 'NOT LIKE' when there are '%'
387 m_pConnection->throwGenericSQLException(STR_QUERY_NOT_LIKE_TOO_COMPLEX,*this);
389 else if( (aMatchString.indexOf ( WILDCARD ) == aMatchString.lastIndexOf ( WILDCARD ) ) )
390 { // One occurrence of '%' matches...
391 if ( aMatchString.startsWith(OUStringLiteral1(WILDCARD)) )
392 pResult = createTest( aColumnName, E_BOOK_QUERY_ENDS_WITH, aMatchString.copy( 1 ) );
393 else if ( aMatchString.indexOf ( WILDCARD ) == aMatchString.getLength() - 1 )
394 pResult = createTest( aColumnName, E_BOOK_QUERY_BEGINS_WITH, aMatchString.copy( 0, aMatchString.getLength() - 1 ) );
395 else
396 m_pConnection->throwGenericSQLException(STR_QUERY_LIKE_WILDCARD,*this);
398 else if( aMatchString.getLength() >= 3 &&
399 aMatchString.startsWith(OUStringLiteral1(WILDCARD)) &&
400 aMatchString.indexOf ( WILDCARD, 1) == aMatchString.getLength() - 1 ) {
401 // one '%' at the start and another at the end
402 pResult = createTest( aColumnName, E_BOOK_QUERY_CONTAINS, aMatchString.copy (1, aMatchString.getLength() - 2) );
404 else
405 m_pConnection->throwGenericSQLException(STR_QUERY_LIKE_WILDCARD_MANY,*this);
408 return pResult;
411 OUString OCommonStatement::getTableName()
413 OUString aTableName;
415 if( m_pParseTree && m_aSQLIterator.getStatementType() == OSQLStatementType::Select )
417 Any aCatalog;
418 OUString aSchema;
419 const OSQLParseNode *pSelectStmnt = m_aSQLIterator.getParseTree();
420 const OSQLParseNode *pAllTableNames = pSelectStmnt->getChild( 3 )->getChild( 0 )->getChild( 1 );
422 if( OSQLParseTreeIterator::isTableNode( pAllTableNames->getChild( 0 ) ) )
423 OSQLParseNode::getTableComponents( pAllTableNames->getChild( 0 ),
424 aCatalog,aSchema, aTableName,nullptr );
426 else if( SQL_ISRULE( pAllTableNames->getChild( 0 ), table_ref ) )
428 OSQLParseNode *pNodeForTableName = pAllTableNames->getChild( 0 )->getChild( 0 );
429 if( OSQLParseTreeIterator::isTableNode( pNodeForTableName ) )
431 aTableName = OSQLParseNode::getTableRange(pAllTableNames->getChild( 0 ));
432 if( !aTableName.getLength() )
433 OSQLParseNode::getTableComponents( pNodeForTableName, aCatalog, aSchema, aTableName,nullptr);
435 else
436 OSL_FAIL( "odd table layout" );
438 else
439 OSL_FAIL( "unusual table layout" );
441 return aTableName;
444 void OCommonStatement::parseSql( const OUString& sql, QueryData& _out_rQueryData )
446 SAL_INFO( "connectivity.evoab2", "parsing " << sql );
448 _out_rQueryData.eFilterType = eFilterOther;
450 OUString aErr;
451 m_pParseTree = m_aParser.parseTree( aErr, sql );
452 m_aSQLIterator.setParseTree( m_pParseTree );
453 m_aSQLIterator.traverseAll();
455 _out_rQueryData.sTable = getTableName();
457 // to be sorted?
458 const OSQLParseNode* pOrderByClause = m_aSQLIterator.getOrderTree();
459 if ( pOrderByClause )
461 #if OSL_DEBUG_LEVEL > 1
462 OUString sTreeDebug;
463 pOrderByClause->showParseTree( sTreeDebug );
464 SAL_INFO( "connectivity.evoab2", "found order-by tree:\n" << sTreeDebug );
465 #endif
466 orderByAnalysis( pOrderByClause, _out_rQueryData.aSortOrder );
469 const OSQLParseNode* pWhereClause = m_aSQLIterator.getWhereTree();
470 if ( pWhereClause && SQL_ISRULE( pWhereClause, where_clause ) )
472 #if OSL_DEBUG_LEVEL > 1
473 OUString sTreeDebug;
474 pWhereClause->showParseTree( sTreeDebug );
475 SAL_INFO( "connectivity.evoab2", "found where tree:\n" << sTreeDebug );
476 #endif
477 EBookQuery* pQuery = whereAnalysis( pWhereClause->getChild( 1 ) );
478 if ( !pQuery )
480 _out_rQueryData.eFilterType = eFilterAlwaysFalse;
481 pQuery = createTrue();
483 _out_rQueryData.setQuery( pQuery );
485 else
487 _out_rQueryData.eFilterType = eFilterNone;
488 _out_rQueryData.setQuery( createTrue() );
493 Reference< XConnection > SAL_CALL OStatement::getConnection( ) throw(SQLException, RuntimeException, std::exception)
495 ::osl::MutexGuard aGuard( m_aMutex );
496 checkDisposed(OCommonStatement_IBase::rBHelper.bDisposed);
498 // just return our connection here
499 return impl_getConnection();
503 Any SAL_CALL OCommonStatement::getWarnings( ) throw(SQLException, RuntimeException, std::exception)
505 ::osl::MutexGuard aGuard( m_aMutex );
506 checkDisposed(OCommonStatement_IBase::rBHelper.bDisposed);
509 return makeAny(SQLWarning());
513 void SAL_CALL OCommonStatement::clearWarnings( ) throw(SQLException, RuntimeException, std::exception)
515 ::osl::MutexGuard aGuard( m_aMutex );
516 checkDisposed(OCommonStatement_IBase::rBHelper.bDisposed);
520 ::cppu::IPropertyArrayHelper* OCommonStatement::createArrayHelper( ) const
522 Sequence< Property > aProps;
523 describeProperties( aProps );
524 return new ::cppu::OPropertyArrayHelper( aProps );
527 ::cppu::IPropertyArrayHelper & OCommonStatement::getInfoHelper()
529 return *getArrayHelper();
533 void SAL_CALL OCommonStatement::acquire() throw()
535 OCommonStatement_IBase::acquire();
538 void SAL_CALL OCommonStatement::release() throw()
540 release_ChildImpl();
544 QueryData OCommonStatement::impl_getEBookQuery_throw( const OUString& _rSql )
546 QueryData aData;
547 parseSql( _rSql, aData );
549 #if OSL_DEBUG_LEVEL > 1
550 char *pSexpr = aData.getQuery() ? e_book_query_to_string( aData.getQuery() ) : g_strdup( "<map failed>" );
551 g_message( "Parsed SQL to sexpr '%s'\n", pSexpr );
552 g_free( pSexpr );
553 #endif
555 if ( !aData.getQuery() )
556 m_pConnection->throwGenericSQLException( STR_QUERY_TOO_COMPLEX, *this );
558 // a postcondition of this method is that we properly determined the SELECT columns
559 aData.xSelectColumns = m_aSQLIterator.getSelectColumns();
560 if ( !aData.xSelectColumns.is() )
561 m_pConnection->throwGenericSQLException( STR_QUERY_TOO_COMPLEX, *this );
563 return aData;
567 Reference< XResultSet > OCommonStatement::impl_executeQuery_throw( const QueryData& _rQueryData )
569 // create result set
570 OEvoabResultSet* pResult = new OEvoabResultSet( this, m_pConnection );
571 Reference< XResultSet > xRS = pResult;
572 pResult->construct( _rQueryData );
574 // done
575 m_xResultSet = xRS;
576 return xRS;
580 Reference< XResultSet > OCommonStatement::impl_executeQuery_throw( const OUString& _rSql )
582 SAL_INFO( "connectivity.evoab2", "OCommonStatement::impl_executeQuery_throw(" << _rSql << "%s)\n" );
584 #if OSL_DEBUG_LEVEL > 1
585 g_message( "Parse SQL '%s'\n",
586 OUStringToOString(_rSql, RTL_TEXTENCODING_UTF8).getStr() );
587 #endif
589 return impl_executeQuery_throw( impl_getEBookQuery_throw( _rSql ) );
593 Reference< XPropertySetInfo > SAL_CALL OCommonStatement::getPropertySetInfo( ) throw(RuntimeException, std::exception)
595 return ::cppu::OPropertySetHelper::createPropertySetInfo( getInfoHelper() );
599 // = OStatement
602 IMPLEMENT_SERVICE_INFO( OStatement, "com.sun.star.comp.sdbcx.evoab.OStatement", "com.sun.star.sdbc.Statement" );
605 IMPLEMENT_FORWARD_XINTERFACE2( OStatement, OCommonStatement, OStatement_IBase )
608 IMPLEMENT_FORWARD_XTYPEPROVIDER2( OStatement, OCommonStatement, OStatement_IBase )
611 sal_Bool SAL_CALL OStatement::execute( const OUString& _sql ) throw(SQLException, RuntimeException, std::exception)
613 ::osl::MutexGuard aGuard( m_aMutex );
614 checkDisposed(OCommonStatement_IBase::rBHelper.bDisposed);
616 Reference< XResultSet > xRS = impl_executeQuery_throw( _sql );
617 return xRS.is();
621 Reference< XResultSet > SAL_CALL OStatement::executeQuery( const OUString& _sql ) throw(SQLException, RuntimeException, std::exception)
623 ::osl::MutexGuard aGuard( m_aMutex );
624 checkDisposed(OCommonStatement_IBase::rBHelper.bDisposed);
626 return impl_executeQuery_throw( _sql );
630 sal_Int32 SAL_CALL OStatement::executeUpdate( const OUString& /*sql*/ ) throw(SQLException, RuntimeException, std::exception)
632 ::osl::MutexGuard aGuard( m_aMutex );
633 checkDisposed(OCommonStatement_IBase::rBHelper.bDisposed);
634 ::dbtools::throwFeatureNotImplementedSQLException( "XStatement::executeUpdate", *this );
635 return 0;
638 } } // namespace ::connectivity::evoab
640 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */