LibreOffice Module connectivity (master) 1
NStatement.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#include <sal/config.h>
21
22#include <string_view>
23
24#include <osl/diagnose.h>
25#include <rtl/ref.hxx>
26#include <rtl/ustring.hxx>
27#include <sal/log.hxx>
28#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
29#include <com/sun/star/sdbc/ResultSetType.hpp>
30#include <com/sun/star/sdbc/FetchDirection.hpp>
31#include <com/sun/star/lang/DisposedException.hpp>
33#include <propertyids.hxx>
34#include "NStatement.hxx"
35#include "NConnection.hxx"
36#include "NDatabaseMetaData.hxx"
37#include "NResultSet.hxx"
38#include <sqlbison.hxx>
39#include <strings.hrc>
42
43namespace connectivity::evoab {
44
45
46using namespace com::sun::star::uno;
47using namespace com::sun::star::lang;
48using namespace com::sun::star::beans;
49using namespace com::sun::star::sdbc;
50using namespace com::sun::star::sdbcx;
51using namespace com::sun::star::container;
52using namespace com::sun::star::io;
53using namespace com::sun::star::util;
54
55namespace {
56
57EBookQuery * createTrue()
58{ // Not the world's most efficient unconditional true but ...
59 return e_book_query_from_string("(exists \"full_name\")");
60}
61
62EBookQuery * createTest( std::u16string_view aColumnName,
63 EBookQueryTest eTest,
64 std::u16string_view aMatch )
65{
66 OString sMatch = OUStringToOString( aMatch, RTL_TEXTENCODING_UTF8 );
67 OString sColumnName = OUStringToOString( aColumnName, RTL_TEXTENCODING_UTF8 );
68
69 return e_book_query_field_test( e_contact_field_id( sColumnName.getStr() ),
70 eTest, sMatch.getStr() );
71}
72
73}
74
78 , m_xResultSet(nullptr)
79 , m_xConnection(_pConnection)
80 , m_aParser(_pConnection->getDriver().getComponentContext())
81 , m_aSQLIterator( _pConnection, _pConnection->createCatalog()->getTables(), m_aParser )
82 , m_pParseTree(nullptr)
83 , m_nMaxFieldSize(0)
84 , m_nMaxRows(0)
85 , m_nQueryTimeOut(0)
86 , m_nFetchSize(0)
87 , m_nResultSetType(ResultSetType::FORWARD_ONLY)
88 , m_nFetchDirection(FetchDirection::FORWARD)
89 , m_nResultSetConcurrency(ResultSetConcurrency::UPDATABLE)
90 , m_bEscapeProcessing(true)
91{
95 0,
97 cppu::UnoType<decltype(m_aCursorName)>::get()
98 );
102 0,
104 cppu::UnoType<decltype(m_nMaxFieldSize)>::get()
105 );
109 0,
110 &m_nMaxRows,
111 cppu::UnoType<decltype(m_nMaxRows)>::get()
112 );
116 0,
118 cppu::UnoType<decltype(m_nQueryTimeOut)>::get()
119 );
123 0,
125 cppu::UnoType<decltype(m_nFetchSize)>::get()
126 );
130 0,
132 cppu::UnoType<decltype(m_nResultSetType)>::get()
133 );
137 0,
139 cppu::UnoType<decltype(m_nFetchDirection)>::get()
140 );
144 0,
146 cppu::UnoType<decltype(m_bEscapeProcessing)>::get()
147 );
151 0,
153 cppu::UnoType<decltype(m_nResultSetConcurrency)>::get()
154 );
155}
156
158{
159}
160
162{
163 // free the cursor if alive
164 Reference< XComponent > xComp(m_xResultSet.get(), UNO_QUERY);
165 if (xComp.is())
166 xComp->dispose();
167 m_xResultSet.clear();
168}
169
171{
172 ::osl::MutexGuard aGuard(m_aMutex);
173
175
176 m_xConnection.clear();
177
178 OCommonStatement_IBase::disposing();
179}
180
181Any SAL_CALL OCommonStatement::queryInterface( const Type & rType )
182{
183 Any aRet = OCommonStatement_IBase::queryInterface(rType);
184 if(!aRet.hasValue())
185 aRet = ::comphelper::OPropertyContainer::queryInterface(rType);
186 return aRet;
187}
188
190{
194
195 return ::comphelper::concatSequences(aTypes.getTypes(),OCommonStatement_IBase::getTypes());
196}
197
198
199//void SAL_CALL OCommonStatement::cancel( ) throw(RuntimeException)
200//{
201//::osl::MutexGuard aGuard( m_aMutex );
202//checkDisposed(OCommonStatement_IBase::rBHelper.bDisposed);
204//}
205
206
208{
209 {
210 ::osl::MutexGuard aGuard( m_aMutex );
211 checkDisposed(OCommonStatement_IBase::rBHelper.bDisposed);
212
213 }
214 dispose();
215}
216
218{
219 ENSURE_OR_THROW( SQL_ISRULE( &_rColumnRef, column_ref ), "internal error: only column_refs supported as LHS" );
220
221 OUString sColumnName;
222 switch ( _rColumnRef.count() )
223 {
224 case 3: // SQL_TOKEN_NAME '.' column_val
225 {
226 const OSQLParseNode* pPunct = _rColumnRef.getChild( 1 );
227 const OSQLParseNode* pColVal = _rColumnRef.getChild( 2 );
228 if ( SQL_ISPUNCTUATION( pPunct, "." )
229 && ( pColVal->count() == 1 )
230 )
231 {
232 sColumnName = pColVal->getChild( 0 )->getTokenValue();
233 }
234 }
235 break;
236
237 case 1: // column
238 {
239 sColumnName = _rColumnRef.getChild( 0 )->getTokenValue();
240 }
241 break;
242 }
243
244 if ( !sColumnName.getLength() )
245 m_xConnection->throwGenericSQLException( STR_QUERY_TOO_COMPLEX, *this );
246
247 return sColumnName;
248}
249
250
251void OCommonStatement::orderByAnalysis( const OSQLParseNode* _pOrderByClause, SortDescriptor& _out_rSort )
252{
253 ENSURE_OR_THROW( _pOrderByClause, "NULL node" );
254 ENSURE_OR_THROW( SQL_ISRULE( _pOrderByClause, opt_order_by_clause ), "wrong node type" );
255
256 _out_rSort.clear();
257
258 const OSQLParseNode* pOrderList = _pOrderByClause->getByRule( OSQLParseNode::ordering_spec_commalist );
259 ENSURE_OR_THROW( pOrderList, "unexpected parse tree structure" );
260
261 for ( size_t i=0; i<pOrderList->count(); ++i )
262 {
263 const OSQLParseNode* pOrderBy = pOrderList->getChild(i);
264 if ( !pOrderBy || !SQL_ISRULE( pOrderBy, ordering_spec ) )
265 continue;
266 const OSQLParseNode* pColumnRef = pOrderBy->count() == 2 ? pOrderBy->getChild(0) : nullptr;
267 const OSQLParseNode* pAscDesc = pOrderBy->count() == 2 ? pOrderBy->getChild(1) : nullptr;
269 ( pColumnRef != nullptr )
270 && ( pAscDesc != nullptr )
271 && ( pAscDesc->isLeaf() )
272 && ( SQL_ISRULE( pAscDesc, opt_asc_desc )
273 || SQL_ISTOKEN(pAscDesc, ASC)
274 || SQL_ISTOKEN(pAscDesc, DESC)
275 ),
276 "ordering_spec structure error" );
277
278 // column name -> column field
279 if ( !SQL_ISRULE( pColumnRef, column_ref ) )
280 m_xConnection->throwGenericSQLException( STR_SORT_BY_COL_ONLY, *this );
281 const OUString sColumnName( impl_getColumnRefColumnName_throw( *pColumnRef ) );
282 guint nField = evoab::findEvoabField( sColumnName );
283 // ascending/descending?
284 bool bAscending = !SQL_ISTOKEN(pAscDesc, DESC);
285
286 _out_rSort.push_back( FieldSort( nField, bAscending ) );
287 }
288}
289
290
292{
293 EBookQuery *pResult = nullptr;
294
295 ENSURE_OR_THROW( parseTree, "invalid parse tree" );
296
297 // Nested brackets
298 if( parseTree->count() == 3 &&
299 SQL_ISPUNCTUATION( parseTree->getChild( 0 ), "(" ) &&
300 SQL_ISPUNCTUATION( parseTree->getChild( 2 ), ")" ) )
301 {
302 pResult = whereAnalysis( parseTree->getChild( 1 ) );
303 }
304
305 // SQL AND, OR
306 else if( ( SQL_ISRULE( parseTree, search_condition ) ||
307 SQL_ISRULE( parseTree, boolean_term ) ) &&
308 parseTree->count() == 3 )
309 {
310 ENSURE_OR_THROW( SQL_ISTOKEN( parseTree->getChild( 1 ), OR )
311 || SQL_ISTOKEN( parseTree->getChild( 1 ), AND ),
312 "unexpected search_condition structure" );
313
314 EBookQuery *pArgs[2];
315 pArgs[0] = whereAnalysis( parseTree->getChild( 0 ) );
316 pArgs[1] = whereAnalysis( parseTree->getChild( 2 ) );
317
318 if( SQL_ISTOKEN( parseTree->getChild( 1 ), OR ) )
319 pResult = e_book_query_or( 2, pArgs, true );
320 else
321 pResult = e_book_query_and( 2, pArgs, true );
322 }
323 // SQL =, !=
324 else if( SQL_ISRULE( parseTree, comparison_predicate ) )
325 {
326 OSQLParseNode *pPrec = parseTree->getChild( 1 );
327
328 ENSURE_OR_THROW( parseTree->count() == 3, "unexpected comparison_predicate structure" );
329
330 OSQLParseNode* pLHS = parseTree->getChild( 0 );
331 OSQLParseNode* pRHS = parseTree->getChild( 2 );
332
333 if ( ( ! SQL_ISRULE( pLHS, column_ref ) // on the LHS, we accept a column or a constant int value
334 && ( pLHS->getNodeType() != SQLNodeType::IntNum )
335 )
336 || ( ( pRHS->getNodeType() != SQLNodeType::String ) // on the RHS, certain literals are acceptable
337 && ( pRHS->getNodeType() != SQLNodeType::IntNum )
338 && ( pRHS->getNodeType() != SQLNodeType::ApproxNum )
339 && ! SQL_ISTOKEN( pRHS, TRUE )
340 && ! SQL_ISTOKEN( pRHS, FALSE )
341 )
342 || ( ( pLHS->getNodeType() == SQLNodeType::IntNum ) // an int on LHS requires an int on RHS
343 && ( pRHS->getNodeType() != SQLNodeType::IntNum )
344 )
345 )
346 {
347 m_xConnection->throwGenericSQLException( STR_QUERY_TOO_COMPLEX, *this );
348 }
349
350 if ( ( pPrec->getNodeType() != SQLNodeType::Equal )
351 && ( pPrec->getNodeType() != SQLNodeType::NotEqual )
352 )
353 {
354 m_xConnection->throwGenericSQLException( STR_OPERATOR_TOO_COMPLEX, *this );
355 }
356
357 // recognize the special "0 = 1" condition
358 if ( ( pLHS->getNodeType() == SQLNodeType::IntNum )
359 && ( pRHS->getNodeType() == SQLNodeType::IntNum )
360 && ( pPrec->getNodeType() == SQLNodeType::Equal )
361 )
362 {
363 const sal_Int32 nLHS = pLHS->getTokenValue().toInt64();
364 const sal_Int32 nRHS = pRHS->getTokenValue().toInt64();
365 return ( nLHS == nRHS ) ? createTrue() : nullptr;
366 }
367
368 OUString aColumnName( impl_getColumnRefColumnName_throw( *pLHS ) );
369
370 OUString aMatchString;
371 if ( pRHS->isToken() )
372 aMatchString = pRHS->getTokenValue();
373 else
374 aMatchString = pRHS->getChild( 0 )->getTokenValue();
375
376 pResult = createTest( aColumnName, E_BOOK_QUERY_IS, aMatchString );
377
378 if ( pResult && ( pPrec->getNodeType() == SQLNodeType::NotEqual ) )
379 pResult = e_book_query_not( pResult, true );
380 }
381 // SQL like
382 else if( SQL_ISRULE( parseTree, like_predicate ) )
383 {
384 ENSURE_OR_THROW( parseTree->count() == 2, "unexpected like_predicate structure" );
385 const OSQLParseNode* pPart2 = parseTree->getChild(1);
386
387 if( ! SQL_ISRULE( parseTree->getChild( 0 ), column_ref) )
388 m_xConnection->throwGenericSQLException(STR_QUERY_INVALID_LIKE_COLUMN,*this);
389
390 OUString aColumnName( impl_getColumnRefColumnName_throw( *parseTree->getChild( 0 ) ) );
391
392 OSQLParseNode *pAtom = pPart2->getChild( pPart2->count() - 2 ); // Match String
393 bool bNotLike = pPart2->getChild(0)->isToken();
394
395 if( !( pAtom->getNodeType() == SQLNodeType::String ||
396 pAtom->getNodeType() == SQLNodeType::Name ||
397 SQL_ISRULE( pAtom,parameter ) ||
398 ( pAtom->getChild( 0 ) && pAtom->getChild( 0 )->getNodeType() == SQLNodeType::Name ) ||
399 ( pAtom->getChild( 0 ) && pAtom->getChild( 0 )->getNodeType() == SQLNodeType::String ) ) )
400 {
401 SAL_INFO(
402 "connectivity.evoab2",
403 "analyseSQL : pAtom->count() = " << pAtom->count());
404 m_xConnection->throwGenericSQLException(STR_QUERY_INVALID_LIKE_STRING,*this);
405 }
406
407 const sal_Unicode WILDCARD = '%';
408
409 OUString aMatchString = pAtom->getTokenValue();
410
411 // Determine where '%' character is...
412 if( aMatchString == OUStringChar(WILDCARD) )
413 {
414 // String containing only a '%' and nothing else matches everything
415 pResult = createTest( aColumnName, E_BOOK_QUERY_CONTAINS,
416 u"" );
417 }
418 else if( aMatchString.indexOf( WILDCARD ) == -1 )
419 { // Simple string , eg. "to match" "contains in evo"
420 SAL_INFO( "connectivity.evoab2", "Plain contains '" << aMatchString << "'" );
421 pResult = createTest( aColumnName, E_BOOK_QUERY_CONTAINS, aMatchString );
422 if( pResult && bNotLike )
423 pResult = e_book_query_not( pResult, true );
424 }
425 else if( bNotLike )
426 {
427 // We currently can't handle a 'NOT LIKE' when there are '%'
428 m_xConnection->throwGenericSQLException(STR_QUERY_NOT_LIKE_TOO_COMPLEX,*this);
429 }
430 else if( aMatchString.indexOf ( WILDCARD ) == aMatchString.lastIndexOf ( WILDCARD ) )
431 { // One occurrence of '%' matches...
432 if ( aMatchString.startsWith(OUStringChar(WILDCARD)) )
433 pResult = createTest(
434 aColumnName, E_BOOK_QUERY_ENDS_WITH, aMatchString.subView( 1 ) );
435 else if ( aMatchString.indexOf ( WILDCARD ) == aMatchString.getLength() - 1 )
436 pResult = createTest( aColumnName, E_BOOK_QUERY_BEGINS_WITH, aMatchString.subView( 0, aMatchString.getLength() - 1 ) );
437 else
438 m_xConnection->throwGenericSQLException(STR_QUERY_LIKE_WILDCARD,*this);
439 }
440 else if( aMatchString.getLength() >= 3 &&
441 aMatchString.startsWith(OUStringChar(WILDCARD)) &&
442 aMatchString.indexOf ( WILDCARD, 1) == aMatchString.getLength() - 1 ) {
443 // one '%' at the start and another at the end
444 pResult = createTest( aColumnName, E_BOOK_QUERY_CONTAINS, aMatchString.subView (1, aMatchString.getLength() - 2) );
445 }
446 else
447 m_xConnection->throwGenericSQLException(STR_QUERY_LIKE_WILDCARD_MANY,*this);
448 }
449
450 return pResult;
451}
452
454{
455 OUString aTableName;
456
458 {
459 Any aCatalog;
460 OUString aSchema;
461 const OSQLParseNode *pSelectStmnt = m_aSQLIterator.getParseTree();
462 const OSQLParseNode *pAllTableNames = pSelectStmnt->getChild( 3 )->getChild( 0 )->getChild( 1 );
463
464 if( OSQLParseTreeIterator::isTableNode( pAllTableNames->getChild( 0 ) ) )
465 OSQLParseNode::getTableComponents( pAllTableNames->getChild( 0 ),
466 aCatalog,aSchema, aTableName,nullptr );
467
468 else if( SQL_ISRULE( pAllTableNames->getChild( 0 ), table_ref ) )
469 {
470 OSQLParseNode *pNodeForTableName = pAllTableNames->getChild( 0 )->getChild( 0 );
471 if( OSQLParseTreeIterator::isTableNode( pNodeForTableName ) )
472 {
473 aTableName = OSQLParseNode::getTableRange(pAllTableNames->getChild( 0 ));
474 if( !aTableName.getLength() )
475 OSQLParseNode::getTableComponents( pNodeForTableName, aCatalog, aSchema, aTableName,nullptr);
476 }
477 else
478 OSL_FAIL( "odd table layout" );
479 }
480 else
481 OSL_FAIL( "unusual table layout" );
482 }
483 return aTableName;
484}
485
486void OCommonStatement::parseSql( const OUString& sql, QueryData& _out_rQueryData )
487{
488 SAL_INFO( "connectivity.evoab2", "parsing " << sql );
489
490 _out_rQueryData.eFilterType = eFilterOther;
491
492 OUString aErr;
493 m_pParseTree = m_aParser.parseTree( aErr, sql ).release();
496
497 _out_rQueryData.sTable = getTableName();
498
499 // to be sorted?
500 const OSQLParseNode* pOrderByClause = m_aSQLIterator.getOrderTree();
501 if ( pOrderByClause )
502 {
503 #if OSL_DEBUG_LEVEL > 1
504 OUString sTreeDebug;
505 pOrderByClause->showParseTree( sTreeDebug );
506 SAL_INFO( "connectivity.evoab2", "found order-by tree:\n" << sTreeDebug );
507 #endif
508
509 orderByAnalysis( pOrderByClause, _out_rQueryData.aSortOrder );
510 }
511
512 const OSQLParseNode* pWhereClause = m_aSQLIterator.getWhereTree();
513 if ( pWhereClause && SQL_ISRULE( pWhereClause, where_clause ) )
514 {
515 #if OSL_DEBUG_LEVEL > 1
516 OUString sTreeDebug;
517 pWhereClause->showParseTree( sTreeDebug );
518 SAL_INFO( "connectivity.evoab2", "found where tree:\n" << sTreeDebug );
519 #endif
520 EBookQuery* pQuery = whereAnalysis( pWhereClause->getChild( 1 ) );
521 if ( !pQuery )
522 {
523 _out_rQueryData.eFilterType = eFilterAlwaysFalse;
524 pQuery = createTrue();
525 }
526 _out_rQueryData.setQuery( pQuery );
527 }
528 else
529 {
530 _out_rQueryData.eFilterType = eFilterNone;
531 _out_rQueryData.setQuery( createTrue() );
532 }
533}
534
535
537{
538 ::osl::MutexGuard aGuard( m_aMutex );
539 checkDisposed(OCommonStatement_IBase::rBHelper.bDisposed);
540
541 // just return our connection here
542 return impl_getConnection();
543}
544
545
547{
548 ::osl::MutexGuard aGuard( m_aMutex );
549 checkDisposed(OCommonStatement_IBase::rBHelper.bDisposed);
550
551
552 return Any(SQLWarning());
553}
554
555
557{
558 ::osl::MutexGuard aGuard( m_aMutex );
559 checkDisposed(OCommonStatement_IBase::rBHelper.bDisposed);
560
561}
562
564{
566 describeProperties( aProps );
567 return new ::cppu::OPropertyArrayHelper( aProps );
568}
569
571{
572 return *getArrayHelper();
573}
574
575
576void SAL_CALL OCommonStatement::acquire() noexcept
577{
578 OCommonStatement_IBase::acquire();
579}
580
581void SAL_CALL OCommonStatement::release() noexcept
582{
583 OCommonStatement_IBase::release();
584}
585
586
588{
590 parseSql( _rSql, aData );
591
592#if OSL_DEBUG_LEVEL > 1
593 char *pSexpr = aData.getQuery() ? e_book_query_to_string( aData.getQuery() ) : g_strdup( "<map failed>" );
594 g_message( "Parsed SQL to sexpr '%s'\n", pSexpr );
595 g_free( pSexpr );
596#endif
597
598 if ( !aData.getQuery() )
599 m_xConnection->throwGenericSQLException( STR_QUERY_TOO_COMPLEX, *this );
600
601 // a postcondition of this method is that we properly determined the SELECT columns
602 aData.xSelectColumns = m_aSQLIterator.getSelectColumns();
603 if ( !aData.xSelectColumns.is() )
604 m_xConnection->throwGenericSQLException( STR_QUERY_TOO_COMPLEX, *this );
605
606 return aData;
607}
608
609
611{
612 // create result set
614 pResult->construct( _rQueryData );
615
616 // done
618 return pResult;
619}
620
621
623{
624 SAL_INFO( "connectivity.evoab2", "OCommonStatement::impl_executeQuery_throw " << _rSql );
625
626#if OSL_DEBUG_LEVEL > 1
627 g_message( "Parse SQL '%s'\n",
628 OUStringToOString(_rSql, RTL_TEXTENCODING_UTF8).getStr() );
629#endif
630
632}
633
634
636{
637 return ::cppu::OPropertySetHelper::createPropertySetInfo( getInfoHelper() );
638}
639
640
641// = OStatement
642
643
644IMPLEMENT_SERVICE_INFO( OStatement, "com.sun.star.comp.sdbcx.evoab.OStatement", "com.sun.star.sdbc.Statement" );
645
646
648
649
651
652
653sal_Bool SAL_CALL OStatement::execute( const OUString& _sql )
654{
655 ::osl::MutexGuard aGuard( m_aMutex );
656 checkDisposed(OCommonStatement_IBase::rBHelper.bDisposed);
657
658 Reference< XResultSet > xRS = impl_executeQuery_throw( _sql );
659 return xRS.is();
660}
661
662
663Reference< XResultSet > SAL_CALL OStatement::executeQuery( const OUString& _sql )
664{
665 ::osl::MutexGuard aGuard( m_aMutex );
666 checkDisposed(OCommonStatement_IBase::rBHelper.bDisposed);
667
668 return impl_executeQuery_throw( _sql );
669}
670
671
672sal_Int32 SAL_CALL OStatement::executeUpdate( const OUString& /*sql*/ )
673{
674 ::osl::MutexGuard aGuard( m_aMutex );
675 checkDisposed(OCommonStatement_IBase::rBHelper.bDisposed);
676 ::dbtools::throwFeatureNotImplementedSQLException( "XStatement::executeUpdate", *this );
677 return 0;
678}
679
680} // namespace ::connectivity::evoab
681
682/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
EAPI_EXTERN EBookQuery *(* e_book_query_not)(EBookQuery *q, gboolean unref)
Definition: EApi.h:114
EAPI_EXTERN EContactField(* e_contact_field_id)(const char *field_name)
Definition: EApi.h:60
EAPI_EXTERN EBookQuery *(* e_book_query_field_test)(EContactField field, EBookQueryTest test, const char *value)
Definition: EApi.h:109
EBookQueryTest
Definition: EApi.h:73
@ E_BOOK_QUERY_CONTAINS
Definition: EApi.h:75
@ E_BOOK_QUERY_BEGINS_WITH
Definition: EApi.h:76
@ E_BOOK_QUERY_ENDS_WITH
Definition: EApi.h:77
@ E_BOOK_QUERY_IS
Definition: EApi.h:74
EAPI_EXTERN EBookQuery *(* e_book_query_from_string)(const char *query_string)
Definition: EApi.h:118
EAPI_EXTERN EBookQuery *(* e_book_query_and)(int nqs, EBookQuery **qs, gboolean unref)
Definition: EApi.h:112
EAPI_EXTERN char *(* e_book_query_to_string)(EBookQuery *q)
Definition: EApi.h:117
void EBookQuery
Definition: EApi.h:81
EAPI_EXTERN EBookQuery *(* e_book_query_or)(int nqs, EBookQuery **qs, gboolean unref)
Definition: EApi.h:113
void describeProperties(css::uno::Sequence< css::beans::Property > &_rProps) const
void registerProperty(const OUString &_rName, sal_Int32 _nHandle, sal_Int32 _nAttributes, void *_pPointerToMember, const css::uno::Type &_rMemberType)
::dbtools::OPropertyMap & getPropMap()
Definition: TConnection.cxx:68
void showParseTree(OUString &rString) const
Definition: sqlnode.cxx:2246
static OUString getTableRange(const OSQLParseNode *_pTableRef)
return a table range when it exists.
Definition: sqlnode.cxx:2705
static bool getTableComponents(const OSQLParseNode *_pTableNode, css::uno::Any &_rCatalog, OUString &_rSchema, OUString &_rTable, const css::uno::Reference< css::sdbc::XDatabaseMetaData > &_xMetaData)
Definition: sqlnode.cxx:757
const OUString & getTokenValue() const
Definition: sqlnode.hxx:361
OSQLParseNode * getChild(sal_uInt32 nPos) const
Definition: sqlnode.hxx:433
OSQLParseNode * getByRule(OSQLParseNode::Rule eRule) const
Definition: sqlnode.cxx:1759
SQLNodeType getNodeType() const
Definition: sqlnode.hxx:339
const ::rtl::Reference< OSQLColumns > & getSelectColumns() const
void setParseTree(const OSQLParseNode *pNewParseTree)
const OSQLParseNode * getOrderTree() const
const OSQLParseNode * getParseTree() const
static bool isTableNode(const OSQLParseNode *_pTableNode)
OSQLStatementType getStatementType() const
void traverseAll()
traverses the complete statement tree, and fills all our data with the information obatined during tr...
const OSQLParseNode * getWhereTree() const
std::unique_ptr< OSQLParseNode > parseTree(OUString &rErrorMessage, const OUString &rStatement, bool bInternational=false)
void orderByAnalysis(const OSQLParseNode *_pOrderByClause, SortDescriptor &_out_rSort)
Definition: NStatement.cxx:251
connectivity::OSQLParseTreeIterator m_aSQLIterator
Definition: NStatement.hxx:155
QueryData impl_getEBookQuery_throw(const OUString &_rSql)
will return the EBookQuery representing the statement WHERE condition, or throw
Definition: NStatement.cxx:587
virtual void SAL_CALL acquire() noexcept override
Definition: NStatement.cxx:576
css::uno::Reference< css::sdbc::XConnection > impl_getConnection()
Definition: NStatement.hxx:232
virtual css::uno::Any SAL_CALL getWarnings() override
Definition: NStatement.cxx:546
OUString impl_getColumnRefColumnName_throw(const ::connectivity::OSQLParseNode &_rColumnRef)
Definition: NStatement.cxx:217
css::uno::WeakReference< css::sdbc::XResultSet > m_xResultSet
Definition: NStatement.hxx:152
virtual ::cppu::IPropertyArrayHelper &SAL_CALL getInfoHelper() override
Definition: NStatement.cxx:570
rtl::Reference< OEvoabConnection > m_xConnection
Definition: NStatement.hxx:153
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: NStatement.cxx:635
virtual void SAL_CALL disposing() override
Definition: NStatement.cxx:170
virtual ::cppu::IPropertyArrayHelper * createArrayHelper() const override
Definition: NStatement.cxx:563
virtual void SAL_CALL close() override
Definition: NStatement.cxx:207
void parseSql(const OUString &sql, QueryData &_out_rQueryData)
Definition: NStatement.cxx:486
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
Definition: NStatement.cxx:189
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
virtual void SAL_CALL release() noexcept override
Definition: NStatement.cxx:581
virtual void SAL_CALL clearWarnings() override
Definition: NStatement.cxx:556
EBookQuery * whereAnalysis(const OSQLParseNode *parseTree)
Definition: NStatement.cxx:291
OCommonStatement(OEvoabConnection *_pConnection)
Definition: NStatement.cxx:75
connectivity::OSQLParser m_aParser
Definition: NStatement.hxx:154
connectivity::OSQLParseNode * m_pParseTree
Definition: NStatement.hxx:156
css::uno::Reference< css::sdbc::XResultSet > impl_executeQuery_throw(const OUString &_rSql)
Definition: NStatement.cxx:622
virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL getConnection() override
Definition: NStatement.cxx:536
virtual sal_Int32 SAL_CALL executeUpdate(const OUString &sql) override
Definition: NStatement.cxx:672
virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL executeQuery(const OUString &sql) override
Definition: NStatement.cxx:663
mutable::osl::Mutex m_aMutex
#define ENSURE_OR_THROW(c, m)
float u
std::mutex m_aMutex
#define TRUE
#define FALSE
#define SAL_INFO(area, stream)
constexpr OUStringLiteral aData
Reference< XComponentContext > getComponentContext(Reference< XMultiServiceFactory > const &factory)
Type
::cppu::WeakComponentImplHelper< css::sdbc::XWarningsSupplier, css::sdbc::XCloseable > OCommonStatement_IBase
Definition: NStatement.hxx:49
IMPLEMENT_SERVICE_INFO(OStatement, "com.sun.star.comp.sdbcx.evoab.OStatement", "com.sun.star.sdbc.Statement")
std::vector< FieldSort > SortDescriptor
Definition: NStatement.hxx:58
guint findEvoabField(std::u16string_view aColName)
IMPLEMENT_FORWARD_XTYPEPROVIDER2(OHsqlConnection, OHsqlConnection_BASE, OConnectionWrapper)
void checkDisposed(bool _bThrow)
Definition: dbtools.cxx:1951
void throwFeatureNotImplementedSQLException(const OUString &_rFeatureName, const Reference< XInterface > &_rxContext, const Any &_rNextException)
int i
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
Definition: pq_tools.cxx:100
IMPLEMENT_FORWARD_XINTERFACE2(ChildWindowPane, ChildWindowPaneInterfaceBase, Pane)
void dispose()
Reference< XConnection > m_xConnection
#define PROPERTY_ID_RESULTSETTYPE
Definition: propertyids.hxx:44
#define PROPERTY_ID_QUERYTIMEOUT
Definition: propertyids.hxx:39
#define PROPERTY_ID_CURSORNAME
Definition: propertyids.hxx:42
#define PROPERTY_ID_RESULTSETCONCURRENCY
Definition: propertyids.hxx:43
#define PROPERTY_ID_MAXFIELDSIZE
Definition: propertyids.hxx:40
#define PROPERTY_ID_FETCHSIZE
Definition: propertyids.hxx:46
#define PROPERTY_ID_MAXROWS
Definition: propertyids.hxx:41
#define PROPERTY_ID_ESCAPEPROCESSING
Definition: propertyids.hxx:47
#define PROPERTY_ID_FETCHDIRECTION
Definition: propertyids.hxx:45
#define SQL_ISRULE(pParseNode, eRule)
Definition: sqlnode.hxx:439
#define SQL_ISPUNCTUATION(pParseNode, aString)
Definition: sqlnode.hxx:450
#define SQL_ISTOKEN(pParseNode, token)
Definition: sqlnode.hxx:447
void setQuery(EBookQuery *pQuery)
Definition: NStatement.hxx:140
AND
OR
unsigned char sal_Bool
sal_uInt16 sal_Unicode
const SvXMLTokenMapEntry aTypes[]