LibreOffice Module connectivity (master) 1
FStatement.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 <o3tl/safeint.hxx>
23#include <osl/diagnose.h>
24#include <file/FStatement.hxx>
25#include <file/FConnection.hxx>
26#include <sqlbison.hxx>
27#include <file/FDriver.hxx>
28#include <file/FResultSet.hxx>
29#include <sal/log.hxx>
30#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
31#include <com/sun/star/sdbc/ResultSetType.hpp>
32#include <com/sun/star/sdbc/FetchDirection.hpp>
33#include <com/sun/star/lang/DisposedException.hpp>
37#include <comphelper/types.hxx>
39#include <strings.hrc>
40#include <algorithm>
41#include <cstddef>
42
44{
45
46
47using namespace dbtools;
48using namespace com::sun::star::uno;
49using namespace com::sun::star::lang;
50using namespace com::sun::star::beans;
51using namespace com::sun::star::sdbc;
52using namespace com::sun::star::sdbcx;
53using namespace com::sun::star::container;
54
58 ,m_xDBMetaData(_pConnection->getMetaData())
59 ,m_aParser( _pConnection->getDriver()->getComponentContext() )
60 ,m_aSQLIterator( _pConnection, _pConnection->createCatalog()->getTables(), m_aParser )
61 ,m_pConnection(_pConnection)
62 ,m_pParseTree(nullptr)
63 ,m_nMaxFieldSize(0)
64 ,m_nMaxRows(0)
65 ,m_nQueryTimeOut(0)
66 ,m_nFetchSize(0)
67 ,m_nResultSetType(ResultSetType::FORWARD_ONLY)
68 ,m_nFetchDirection(FetchDirection::FORWARD)
69 ,m_nResultSetConcurrency(ResultSetConcurrency::UPDATABLE)
70 ,m_bEscapeProcessing(true)
71{
72 sal_Int32 nAttrib = 0;
73
82
84}
85
87{
88 osl_atomic_increment( &m_refCount );
89 disposing();
90}
91
93{
94 SAL_INFO( "connectivity.drivers", "file Ocke.Janssen@sun.com OStatement_Base::disposeResultSet" );
95 // free the cursor if alive
96 Reference< XComponent > xComp(m_xResultSet.get(), UNO_QUERY);
97 assert(xComp.is() || !m_xResultSet.get().is());
98 if (xComp.is())
99 xComp->dispose();
100 m_xResultSet.clear();
101}
102
104{
105 ::osl::MutexGuard aGuard(m_aMutex);
106
108
110 m_pSQLAnalyzer->dispose();
111
112 if(m_aRow.is())
113 {
114 m_aRow->clear();
115 m_aRow = nullptr;
116 }
117
119
120 m_pTable.clear();
121
122 m_pConnection.clear();
123
124 if ( m_pParseTree )
125 {
126 delete m_pParseTree;
127 m_pParseTree = nullptr;
128 }
129
131}
132
133void SAL_CALL OStatement_Base::acquire() noexcept
134{
135 OStatement_BASE::acquire();
136}
137
138void SAL_CALL OStatement_BASE2::release() noexcept
139{
140 OStatement_BASE::release();
141}
142
143Any SAL_CALL OStatement_Base::queryInterface( const Type & rType )
144{
145 const Any aRet = OStatement_BASE::queryInterface(rType);
146 return aRet.hasValue() ? aRet : OPropertySetHelper::queryInterface(rType);
147}
148
150{
154
155 return ::comphelper::concatSequences(aTypes.getTypes(),OStatement_BASE::getTypes());
156}
157
158
160{
161}
162
164{
165 {
166 ::osl::MutexGuard aGuard( m_aMutex );
167 checkDisposed(OStatement_BASE::rBHelper.bDisposed);
168 }
169 dispose();
170}
171
173{
174 SAL_INFO( "connectivity.drivers", "file Ocke.Janssen@sun.com OStatement_Base::clearMyResultSet " );
175 ::osl::MutexGuard aGuard( m_aMutex );
176 checkDisposed(OStatement_BASE::rBHelper.bDisposed);
177
178 Reference< XCloseable > xCloseable(m_xResultSet.get(), UNO_QUERY);
179 assert(xCloseable.is() || !m_xResultSet.get().is());
180 if (xCloseable.is())
181 {
182 try
183 {
184 xCloseable->close();
185 }
186 catch( const DisposedException& ) { }
187 }
188
189 m_xResultSet.clear();
190}
191
193{
194 ::osl::MutexGuard aGuard( m_aMutex );
195 checkDisposed(OStatement_BASE::rBHelper.bDisposed);
196
197 return Any(m_aLastWarning);
198}
199
201{
202 ::osl::MutexGuard aGuard( m_aMutex );
203 checkDisposed(OStatement_BASE::rBHelper.bDisposed);
204
205 m_aLastWarning = SQLWarning();
206}
207
209{
211 describeProperties(aProps);
212 return new ::cppu::OPropertyArrayHelper(aProps);
213}
214
215
217{
218 return *getArrayHelper();
219}
220
222{
223 return new OResultSet(this,m_aSQLIterator);
224}
225
226IMPLEMENT_SERVICE_INFO(OStatement,"com.sun.star.sdbc.driver.file.Statement","com.sun.star.sdbc.Statement");
227
228void SAL_CALL OStatement::acquire() noexcept
229{
231}
232
233void SAL_CALL OStatement::release() noexcept
234{
236}
237
238
239sal_Bool SAL_CALL OStatement::execute( const OUString& sql )
240{
241 ::osl::MutexGuard aGuard( m_aMutex );
242
244
246}
247
248
250{
251 ::osl::MutexGuard aGuard( m_aMutex );
252 checkDisposed(OStatement_BASE::rBHelper.bDisposed);
253
254 construct(sql);
257 xRS = pResult;
258 initializeResultSet(pResult.get());
259 m_xResultSet = xRS;
260
261 pResult->OpenImpl();
262
263 return xRS;
264}
265
267{
268 return m_pConnection;
269}
270
271sal_Int32 SAL_CALL OStatement::executeUpdate( const OUString& sql )
272{
273 ::osl::MutexGuard aGuard( m_aMutex );
274 checkDisposed(OStatement_BASE::rBHelper.bDisposed);
275
276
277 construct(sql);
279 initializeResultSet(pResult.get());
280 pResult->OpenImpl();
281
282 return pResult->getRowCountResult();
283}
284
285
287{
288 if(m_aEvaluateRow.is())
289 {
290 m_aEvaluateRow->clear();
291 m_aEvaluateRow = nullptr;
292 }
293 OStatement_BASE::disposing();
294}
295
297{
298 return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
299}
300
301Any SAL_CALL OStatement::queryInterface( const Type & rType )
302{
304 return aRet.hasValue() ? aRet : OStatement_BASE2::queryInterface( rType);
305}
306
308{
309 OSL_ENSURE(m_pSQLAnalyzer,"OResultSet::analyzeSQL: Analyzer isn't set!");
310 // start analysing the statement
311 m_pSQLAnalyzer->setOrigColumns(m_xColNames);
313
314 const OSQLParseNode* pOrderbyClause = m_aSQLIterator.getOrderTree();
315 if(!pOrderbyClause)
316 return;
317
318 OSQLParseNode * pOrderingSpecCommalist = pOrderbyClause->getChild(2);
319 OSL_ENSURE(SQL_ISRULE(pOrderingSpecCommalist,ordering_spec_commalist),"OResultSet: Error in Parse Tree");
320
321 for (size_t m = 0; m < pOrderingSpecCommalist->count(); m++)
322 {
323 OSQLParseNode * pOrderingSpec = pOrderingSpecCommalist->getChild(m);
324 OSL_ENSURE(SQL_ISRULE(pOrderingSpec,ordering_spec),"OResultSet: Error in Parse Tree");
325 OSL_ENSURE(pOrderingSpec->count() == 2,"OResultSet: Error in Parse Tree");
326
327 OSQLParseNode * pColumnRef = pOrderingSpec->getChild(0);
328 if(!SQL_ISRULE(pColumnRef,column_ref))
329 {
330 throw SQLException();
331 }
332 OSQLParseNode * pAscendingDescending = pOrderingSpec->getChild(1);
333 setOrderbyColumn(pColumnRef,pAscendingDescending);
334 }
335}
336
338 OSQLParseNode const * pAscendingDescending)
339{
340 OUString aColumnName;
341 if (pColumnRef->count() == 1)
342 aColumnName = pColumnRef->getChild(0)->getTokenValue();
343 else if (pColumnRef->count() == 3)
344 {
345 pColumnRef->getChild(2)->parseNodeToStr( aColumnName, getOwnConnection(), nullptr, false, false );
346 }
347 else
348 {
349 throw SQLException();
350 }
351
352 Reference<XColumnLocate> xColLocate(m_xColNames,UNO_QUERY);
353 if(!xColLocate.is())
354 return;
355 // Everything tested and we have the name of the Column.
356 // What number is the Column?
359 OSQLColumns::const_iterator aFind = ::connectivity::find(aSelectColumns->begin(),aSelectColumns->end(),aColumnName,aCase);
360 if ( aFind == aSelectColumns->end() )
361 throw SQLException();
362 m_aOrderbyColumnNumber.push_back((aFind - aSelectColumns->begin()) + 1);
363
364 // Ascending or Descending?
366}
367
368void OStatement_Base::construct(const OUString& sql)
369{
370 OUString aErr;
371 m_pParseTree = m_aParser.parseTree(aErr,sql).release();
372 if(!m_pParseTree)
373 throw SQLException(aErr,*this,OUString(),0,Any());
374
377 const OSQLTables& rTabs = m_aSQLIterator.getTables();
378
379 // sanity checks
380 if ( rTabs.empty() )
381 // no tables -> nothing to operate on -> error
382 m_pConnection->throwGenericSQLException(STR_QUERY_NO_TABLE,*this);
383
384 if ( rTabs.size() > 1 || m_aSQLIterator.hasErrors() )
385 // more than one table -> can't operate on them -> error
386 m_pConnection->throwGenericSQLException(STR_QUERY_MORE_TABLES,*this);
387
389 // SELECT statement without columns -> error
390 m_pConnection->throwGenericSQLException(STR_QUERY_NO_COLUMN,*this);
391
393 {
397 m_pConnection->throwGenericSQLException(STR_QUERY_TOO_COMPLEX,*this);
398 break;
400 if(SQL_ISRULE(m_aSQLIterator.getParseTree(), union_statement))
401 {
402 m_pConnection->throwGenericSQLException(STR_QUERY_TOO_COMPLEX, *this);
403 }
404 assert(SQL_ISRULE(m_aSQLIterator.getParseTree(), select_statement));
405 break;
406 default:
407 break;
408 }
409
410 // at this moment we support only one table per select statement
411 m_pTable = dynamic_cast<OFileTable*>(rTabs.begin()->second.get());
412 OSL_ENSURE(m_pTable.is(),"No table!");
413 if ( m_pTable.is() )
414 m_xColNames = m_pTable->getColumns();
415 Reference<XIndexAccess> xNames(m_xColNames,UNO_QUERY);
416 // set the binding of the resultrow
417 m_aRow = new OValueRefVector(xNames->getCount());
418 (*m_aRow)[0]->setBound(true);
419 std::for_each(m_aRow->begin()+1,m_aRow->end(),TSetRefBound(false));
420
421 // set the binding of the resultrow
422 m_aEvaluateRow = new OValueRefVector(xNames->getCount());
423
424 (*m_aEvaluateRow)[0]->setBound(true);
425 std::for_each(m_aEvaluateRow->begin()+1,m_aEvaluateRow->end(),TSetRefBound(false));
426
427 // set the select row
429 std::for_each(m_aSelectRow->begin(),m_aSelectRow->end(),TSetRefBound(true));
430
431 // create the column mapping
433
434 m_pSQLAnalyzer.reset( new OSQLAnalyzer(m_pConnection.get()) );
435
436 analyzeSQL();
437}
438
440{
441 // initialize the column index map (mapping select columns to table columns)
443 m_aColMapping.resize(xColumns->size() + 1);
444 for (std::size_t i=0; i<m_aColMapping.size(); ++i)
445 m_aColMapping[i] = i;
446
447 Reference<XIndexAccess> xNames(m_xColNames,UNO_QUERY);
448 // now check which columns are bound
450}
451
453{
455
456 _pResult->setSqlAnalyzer(m_pSQLAnalyzer.get());
457 _pResult->setOrderByColumns(std::vector(m_aOrderbyColumnNumber));
458 _pResult->setOrderByAscending(std::vector(m_aOrderbyAscending));
459 _pResult->setBindingRow(m_aRow);
460 _pResult->setColumnMapping(std::vector(m_aColMapping));
463 _pResult->setSelectRow(m_aSelectRow);
464
465 m_pSQLAnalyzer->bindSelectRow(m_aRow);
466 m_pSQLAnalyzer->bindEvaluationRow(m_aEvaluateRow); // Set values in the code of the Compiler
467}
468
470{
471 if (m_pParseTree == nullptr)
472 {
474 return;
475 }
476
477 if (SQL_ISRULE(m_pParseTree,select_statement))
478 // no values have to be set for SELECT
479 return;
480 else if (SQL_ISRULE(m_pParseTree,insert_statement))
481 {
482 // Create Row for the values to be set (Reference through new)
483 if(m_aAssignValues.is())
484 m_aAssignValues->clear();
485 sal_Int32 nCount = Reference<XIndexAccess>(m_xColNames,UNO_QUERY_THROW)->getCount();
487 // unbound all
488 std::for_each(m_aAssignValues->begin()+1,m_aAssignValues->end(),TSetRefBound(false));
489
491
492 // List of Column-Names, that exist in the column_commalist (separated by ;):
493 std::vector<OUString> aColumnNameList;
494
495 OSL_ENSURE(m_pParseTree->count() >= 4,"OResultSet: Error in Parse Tree");
496
497 OSQLParseNode * pOptColumnCommalist = m_pParseTree->getChild(3);
498 OSL_ENSURE(pOptColumnCommalist != nullptr,"OResultSet: Error in Parse Tree");
499 OSL_ENSURE(SQL_ISRULE(pOptColumnCommalist,opt_column_commalist),"OResultSet: Error in Parse Tree");
500 if (pOptColumnCommalist->count() == 0)
501 {
502 const Sequence< OUString>& aNames = m_xColNames->getElementNames();
503 aColumnNameList.insert(aColumnNameList.end(), aNames.begin(), aNames.end());
504 }
505 else
506 {
507 OSL_ENSURE(pOptColumnCommalist->count() == 3,"OResultSet: Error in Parse Tree");
508
509 OSQLParseNode * pColumnCommalist = pOptColumnCommalist->getChild(1);
510 OSL_ENSURE(pColumnCommalist != nullptr,"OResultSet: Error in Parse Tree");
511 OSL_ENSURE(SQL_ISRULE(pColumnCommalist,column_commalist),"OResultSet: Error in Parse Tree");
512 OSL_ENSURE(pColumnCommalist->count() > 0,"OResultSet: Error in Parse Tree");
513
514 // All Columns in the column_commalist ...
515 for (size_t i = 0; i < pColumnCommalist->count(); i++)
516 {
517 OSQLParseNode * pCol = pColumnCommalist->getChild(i);
518 OSL_ENSURE(pCol != nullptr,"OResultSet: Error in Parse Tree");
519 aColumnNameList.push_back(pCol->getTokenValue());
520 }
521 }
522 if ( aColumnNameList.empty() )
524
525 // Values ...
526 OSQLParseNode * pValuesOrQuerySpec = m_pParseTree->getChild(4);
527 OSL_ENSURE(pValuesOrQuerySpec != nullptr,"OResultSet: pValuesOrQuerySpec must not be NULL!");
528 OSL_ENSURE(SQL_ISRULE(pValuesOrQuerySpec,values_or_query_spec),"OResultSet: ! SQL_ISRULE(pValuesOrQuerySpec,values_or_query_spec)");
529 OSL_ENSURE(pValuesOrQuerySpec->count() > 0,"OResultSet: pValuesOrQuerySpec->count() <= 0");
530
531 // just "VALUES" is allowed ...
532 if (! SQL_ISTOKEN(pValuesOrQuerySpec->getChild(0),VALUES))
534
535 OSL_ENSURE(pValuesOrQuerySpec->count() == 4,"OResultSet: pValuesOrQuerySpec->count() != 4");
536
537 // List of values
538 OSQLParseNode * pInsertAtomCommalist = pValuesOrQuerySpec->getChild(2);
539 OSL_ENSURE(pInsertAtomCommalist != nullptr,"OResultSet: pInsertAtomCommalist must not be NULL!");
540 OSL_ENSURE(pInsertAtomCommalist->count() > 0,"OResultSet: pInsertAtomCommalist <= 0");
541
542 sal_Int32 nIndex=0;
543 for (size_t i = 0; i < pInsertAtomCommalist->count(); i++)
544 {
545 OSQLParseNode * pRow_Value_Const = pInsertAtomCommalist->getChild(i); // row_value_constructor
546 OSL_ENSURE(pRow_Value_Const != nullptr,"OResultSet: pRow_Value_Const must not be NULL!");
547 if(SQL_ISRULE(pRow_Value_Const,parameter))
548 {
549 ParseAssignValues(aColumnNameList,pRow_Value_Const,nIndex++); // only one Columnname allowed per loop
550 }
551 else if(pRow_Value_Const->isToken())
552 ParseAssignValues(aColumnNameList,pRow_Value_Const,i);
553 else
554 {
555 if(pRow_Value_Const->count() == aColumnNameList.size())
556 {
557 for (size_t j = 0; j < pRow_Value_Const->count(); ++j)
558 ParseAssignValues(aColumnNameList,pRow_Value_Const->getChild(j),nIndex++);
559 }
560 else
562 }
563 }
564 }
565 else if (SQL_ISRULE(m_pParseTree,update_statement_searched))
566 {
567 if(m_aAssignValues.is())
568 m_aAssignValues->clear();
569 sal_Int32 nCount = Reference<XIndexAccess>(m_xColNames,UNO_QUERY_THROW)->getCount();
571 // unbound all
572 std::for_each(m_aAssignValues->begin()+1,m_aAssignValues->end(),TSetRefBound(false));
573
575
576 OSL_ENSURE(m_pParseTree->count() >= 4,"OResultSet: Error in Parse Tree");
577
578 OSQLParseNode * pAssignmentCommalist = m_pParseTree->getChild(3);
579 OSL_ENSURE(pAssignmentCommalist != nullptr,"OResultSet: pAssignmentCommalist == NULL");
580 OSL_ENSURE(SQL_ISRULE(pAssignmentCommalist,assignment_commalist),"OResultSet: Error in Parse Tree");
581 OSL_ENSURE(pAssignmentCommalist->count() > 0,"OResultSet: pAssignmentCommalist->count() <= 0");
582
583 // work on all assignments (commalist) ...
584 std::vector< OUString> aList(1);
585 for (size_t i = 0; i < pAssignmentCommalist->count(); i++)
586 {
587 OSQLParseNode * pAssignment = pAssignmentCommalist->getChild(i);
588 OSL_ENSURE(pAssignment != nullptr,"OResultSet: pAssignment == NULL");
589 OSL_ENSURE(SQL_ISRULE(pAssignment,assignment),"OResultSet: Error in Parse Tree");
590 OSL_ENSURE(pAssignment->count() == 3,"OResultSet: pAssignment->count() != 3");
591
592 OSQLParseNode * pCol = pAssignment->getChild(0);
593 OSL_ENSURE(pCol != nullptr,"OResultSet: pCol == NULL");
594
595 OSQLParseNode * pComp = pAssignment->getChild(1);
596 OSL_ENSURE(pComp != nullptr,"OResultSet: pComp == NULL");
597 OSL_ENSURE(pComp->getNodeType() == SQLNodeType::Equal,"OResultSet: pComp->getNodeType() != SQLNodeType::Comparison");
598 if (pComp->getTokenValue().toChar() != '=')
599 {
601 }
602
603 OSQLParseNode * pVal = pAssignment->getChild(2);
604 OSL_ENSURE(pVal != nullptr,"OResultSet: pVal == NULL");
605 aList[0] = pCol->getTokenValue();
606 ParseAssignValues(aList,pVal,0);
607 }
608
609 }
610}
611
612void OStatement_Base::ParseAssignValues(const std::vector< OUString>& aColumnNameList,OSQLParseNode* pRow_Value_Constructor_Elem, sal_Int32 nIndex)
613{
614 OSL_ENSURE(o3tl::make_unsigned(nIndex) <= aColumnNameList.size(),"SdbFileCursor::ParseAssignValues: nIndex > aColumnNameList.GetTokenCount()");
615 OUString aColumnName(aColumnNameList[nIndex]);
616 OSL_ENSURE(aColumnName.getLength() > 0,"OResultSet: Column-Name not found");
617 OSL_ENSURE(pRow_Value_Constructor_Elem != nullptr,"OResultSet: pRow_Value_Constructor_Elem must not be NULL!");
618
619 if (pRow_Value_Constructor_Elem->getNodeType() == SQLNodeType::String ||
620 pRow_Value_Constructor_Elem->getNodeType() == SQLNodeType::IntNum ||
621 pRow_Value_Constructor_Elem->getNodeType() == SQLNodeType::ApproxNum)
622 {
623 // set value:
624 SetAssignValue(aColumnName, pRow_Value_Constructor_Elem->getTokenValue());
625 }
626 else if (SQL_ISTOKEN(pRow_Value_Constructor_Elem,NULL))
627 {
628 // set NULL
629 SetAssignValue(aColumnName, OUString(), true);
630 }
631 else if (SQL_ISRULE(pRow_Value_Constructor_Elem,parameter))
632 parseParamterElem(aColumnName,pRow_Value_Constructor_Elem);
633 else
634 {
636 }
637}
638
639void OStatement_Base::SetAssignValue(const OUString& aColumnName,
640 const OUString& aValue,
641 bool bSetNull,
642 sal_uInt32 nParameter)
643{
645 m_xColNames->getByName(aColumnName) >>= xCol;
646 sal_Int32 nId = Reference<XColumnLocate>(m_xColNames,UNO_QUERY_THROW)->findColumn(aColumnName);
647 // does this column actually exist in the file?
648
649 if (!xCol.is())
650 {
651 // This Column doesn't exist!
653 }
654
655
656 // Everything tested and we have the names of the Column.
657 // Now allocate one Value, set the value and tie the value to the Row.
658 if (bSetNull)
659 (*m_aAssignValues)[nId]->setNull();
660 else
661 {
662 switch (::comphelper::getINT32(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))))
663 {
664 // put criteria depending on the Type as String or double in the variable
665 case DataType::CHAR:
666 case DataType::VARCHAR:
667 case DataType::LONGVARCHAR:
668 *(*m_aAssignValues)[nId] = ORowSetValue(aValue);
669 //Characterset is already converted, since the entire statement was converted
670 break;
671
672 case DataType::BIT:
673 if (aValue.equalsIgnoreAsciiCase("TRUE") || aValue[0] == '1')
674 *(*m_aAssignValues)[nId] = true;
675 else if (aValue.equalsIgnoreAsciiCase("FALSE") || aValue[0] == '0')
676 *(*m_aAssignValues)[nId] = false;
677 else
679 break;
680 case DataType::TINYINT:
681 case DataType::SMALLINT:
682 case DataType::INTEGER:
683 case DataType::DECIMAL:
684 case DataType::NUMERIC:
685 case DataType::REAL:
686 case DataType::DOUBLE:
687 case DataType::DATE:
688 case DataType::TIME:
689 case DataType::TIMESTAMP:
690 *(*m_aAssignValues)[nId] = ORowSetValue(aValue);
691 break;
692 default:
694 }
695 }
696
697 // save Parameter-No. (as User Data)
698 // SQL_NO_PARAMETER = no Parameter.
699 m_aAssignValues->setParameterIndex(nId,nParameter);
700 if(nParameter != SQL_NO_PARAMETER)
701 m_aParameterIndexes[nParameter] = nId;
702}
703
704void OStatement_Base::parseParamterElem(const OUString& /*_sColumnName*/,OSQLParseNode* /*pRow_Value_Constructor_Elem*/)
705{
706 // do nothing here
707}
708
709}// namespace
710
711
712/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define SQL_NO_PARAMETER
Definition: FValue.hxx:470
::boost::spirit::classic::rule< ScannerT > assignment
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)
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
::dbtools::OPropertyMap & getPropMap()
Definition: TConnection.cxx:68
void parseNodeToStr(OUString &rString, const css::uno::Reference< css::sdbc::XConnection > &_rxConnection, const IParseContext *pContext=nullptr, bool _bIntl=false, bool _bQuote=true) const
const OUString & getTokenValue() const
Definition: sqlnode.hxx:361
OSQLParseNode * getChild(sal_uInt32 nPos) const
Definition: sqlnode.hxx:433
SQLNodeType getNodeType() const
Definition: sqlnode.hxx:339
const ::rtl::Reference< OSQLColumns > & getSelectColumns() const
const OSQLTables & getTables() const
void setParseTree(const OSQLParseNode *pNewParseTree)
const OSQLParseNode * getOrderTree() const
const OSQLParseNode * getParseTree() const
OSQLStatementType getStatementType() const
void traverseAll()
traverses the complete statement tree, and fills all our data with the information obatined during tr...
std::unique_ptr< OSQLParseNode > parseTree(OUString &rErrorMessage, const OUString &rStatement, bool bInternational=false)
void setBindingRow(const OValueRefRow &_aRow)
Definition: FResultSet.hxx:259
void setSelectRow(const OValueRefRow &_rRow)
Definition: FResultSet.hxx:260
void setAssignValues(const ORefAssignValues &_aAssignValues)
Definition: FResultSet.hxx:258
void setSqlAnalyzer(OSQLAnalyzer *_pSQLAnalyzer)
Definition: FResultSet.hxx:266
void setColumnMapping(std::vector< sal_Int32 > &&_aColumnMapping)
Definition: FResultSet.hxx:265
static void setBoundedColumns(const OValueRefRow &_rRow, const OValueRefRow &_rSelectRow, const ::rtl::Reference< connectivity::OSQLColumns > &_rxColumns, const css::uno::Reference< css::container::XIndexAccess > &_xNames, bool _bSetColumnMapping, const css::uno::Reference< css::sdbc::XDatabaseMetaData > &_xMetaData, std::vector< sal_Int32 > &_rColMapping)
void setEvaluationRow(const OValueRefRow &_aRow)
Definition: FResultSet.hxx:257
void setOrderByAscending(std::vector< TAscendingOrder > &&_aOrderbyAsc)
Definition: FResultSet.hxx:269
void setOrderByColumns(std::vector< sal_Int32 > &&_aColumnOrderBy)
Definition: FResultSet.hxx:268
virtual void SAL_CALL disposing() override
Definition: FStatement.cxx:103
virtual void SAL_CALL release() noexcept override
Definition: FStatement.cxx:138
std::unique_ptr< OSQLAnalyzer > m_pSQLAnalyzer
Definition: FStatement.hxx:75
virtual void SAL_CALL disposing() override
Definition: FStatement.cxx:286
void ParseAssignValues(const std::vector< OUString > &aColumnNameList, connectivity::OSQLParseNode *pRow_Value_Constructor_Elem, sal_Int32 nIndex)
Definition: FStatement.cxx:612
std::vector< sal_Int32 > m_aColMapping
Definition: FStatement.hxx:59
virtual void parseParamterElem(const OUString &_sColumnName, OSQLParseNode *pRow_Value_Constructor_Elem)
Definition: FStatement.cxx:704
connectivity::OSQLParseTreeIterator m_aSQLIterator
Definition: FStatement.hxx:71
css::uno::Reference< css::container::XNameAccess > m_xColNames
Definition: FStatement.hxx:67
css::sdbc::SQLWarning m_aLastWarning
Definition: FStatement.hxx:64
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: FStatement.cxx:296
virtual void SAL_CALL clearWarnings() override
Definition: FStatement.cxx:200
virtual void construct(const OUString &sql)
Definition: FStatement.cxx:368
OStatement_Base(OConnection *_pConnection)
Definition: FStatement.cxx:55
connectivity::OSQLParseNode * m_pParseTree
Definition: FStatement.hxx:74
virtual void initializeResultSet(OResultSet *_pResult)
Definition: FStatement.cxx:452
std::vector< sal_Int32 > m_aOrderbyColumnNumber
Definition: FStatement.hxx:61
void setOrderbyColumn(connectivity::OSQLParseNode const *pColumnRef, connectivity::OSQLParseNode const *pAscendingDescending)
Definition: FStatement.cxx:337
rtl::Reference< OConnection > m_pConnection
Definition: FStatement.hxx:73
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
virtual ::cppu::IPropertyArrayHelper * createArrayHelper() const override
Definition: FStatement.cxx:208
rtl::Reference< OFileTable > m_pTable
Definition: FStatement.hxx:77
connectivity::OSQLParser m_aParser
Definition: FStatement.hxx:70
css::uno::WeakReference< css::sdbc::XResultSet > m_xResultSet
Definition: FStatement.hxx:65
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
Definition: FStatement.cxx:149
virtual ::cppu::IPropertyArrayHelper &SAL_CALL getInfoHelper() override
Definition: FStatement.cxx:216
std::vector< TAscendingOrder > m_aOrderbyAscending
Definition: FStatement.hxx:62
std::vector< sal_Int32 > m_aParameterIndexes
Definition: FStatement.hxx:60
css::uno::Reference< css::sdbc::XDatabaseMetaData > m_xDBMetaData
Definition: FStatement.hxx:66
virtual ~OStatement_Base() override
Definition: FStatement.cxx:86
virtual css::uno::Any SAL_CALL getWarnings() override
Definition: FStatement.cxx:192
virtual void SAL_CALL cancel() override
Definition: FStatement.cxx:159
virtual void SAL_CALL close() override
Definition: FStatement.cxx:163
OConnection * getOwnConnection() const
Definition: FStatement.hxx:130
virtual void SAL_CALL acquire() noexcept override
Definition: FStatement.cxx:133
void SetAssignValue(const OUString &aColumnName, const OUString &aValue, bool bSetNull=false, sal_uInt32 nParameter=SQL_NO_PARAMETER)
Definition: FStatement.cxx:639
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL getConnection() override
Definition: FStatement.cxx:266
virtual void SAL_CALL release() noexcept override
Definition: FStatement.cxx:233
virtual sal_Int32 SAL_CALL executeUpdate(const OUString &sql) override
Definition: FStatement.cxx:271
virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL executeQuery(const OUString &sql) override
Definition: FStatement.cxx:249
virtual sal_Bool SAL_CALL execute(const OUString &sql) override
Definition: FStatement.cxx:239
virtual void SAL_CALL acquire() noexcept override
Definition: FStatement.cxx:228
virtual rtl::Reference< OResultSet > createResultSet() override
Definition: FStatement.cxx:221
mutable::osl::Mutex m_aMutex
virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const &rType) SAL_OVERRIDE
const OUString & getNameByIndex(sal_Int32 _nIndex) const
Definition: propertyids.cxx:95
int nCount
ULONG m_refCount
std::mutex m_aMutex
sal_Int32 nIndex
#define SAL_INFO(area, stream)
return NULL
Reference< XComponentContext > getComponentContext(Reference< XMultiServiceFactory > const &factory)
Type
IMPLEMENT_SERVICE_INFO(OStatement,"com.sun.star.sdbc.driver.file.Statement","com.sun.star.sdbc.Statement")
::cppu::WeakComponentImplHelper< css::sdbc::XWarningsSupplier, css::util::XCancellable, css::sdbc::XCloseable > OStatement_BASE
Definition: FStatement.hxx:43
std::map< OUString, OSQLTable, comphelper::UStringMixLess > OSQLTables
Definition: CommonTools.hxx:56
void checkDisposed(bool _bThrow)
Definition: dbtools.cxx:1951
void throwFunctionSequenceException(const Reference< XInterface > &Context, const Any &Next)
int i
m
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
void dispose()
sal_Int16 nId
#define PROPERTY_ID_RESULTSETTYPE
Definition: propertyids.hxx:44
#define PROPERTY_ID_TYPE
Definition: propertyids.hxx:51
#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_ISTOKEN(pParseNode, token)
Definition: sqlnode.hxx:447
TSetBound is a functor to set the bound value with e.q. for_each call.
Definition: FValue.hxx:436
unsigned char sal_Bool
const SvXMLTokenMapEntry aTypes[]