diff options
Diffstat (limited to 'connectivity/source/drivers/file')
-rw-r--r-- | connectivity/source/drivers/file/FResultSet.cxx | 4 | ||||
-rw-r--r-- | connectivity/source/drivers/file/FStatement.cxx | 49 | ||||
-rw-r--r-- | connectivity/source/drivers/file/FStringFunctions.cxx | 13 | ||||
-rw-r--r-- | connectivity/source/drivers/file/fcode.cxx | 25 | ||||
-rw-r--r-- | connectivity/source/drivers/file/fcomp.cxx | 7 | ||||
-rw-r--r-- | connectivity/source/drivers/file/quotedstring.cxx | 4 |
6 files changed, 60 insertions, 42 deletions
diff --git a/connectivity/source/drivers/file/FResultSet.cxx b/connectivity/source/drivers/file/FResultSet.cxx index ca86fb2a3d73..d96245c06cda 100644 --- a/connectivity/source/drivers/file/FResultSet.cxx +++ b/connectivity/source/drivers/file/FResultSet.cxx @@ -1303,8 +1303,9 @@ void OResultSet::sortRows() OSL_ENSURE((sal_Int32)m_aRow->get().size() > *aOrderByIter,"Invalid Index"); switch ((*(m_aRow->get().begin()+*aOrderByIter))->getValue().getTypeKind()) { - case DataType::CHAR: + case DataType::CHAR: case DataType::VARCHAR: + case DataType::LONGVARCHAR: eKeyType[i] = SQL_ORDERBYKEY_STRING; break; @@ -1471,6 +1472,7 @@ BOOL OResultSet::OpenImpl() if(IsSorted()) { aOrderbyColumnNumberSave = m_aOrderbyColumnNumber;// .assign(m_aOrderbyColumnNumber.begin(), m_aOrderbyColumnNumber.end()); + m_aOrderbyColumnNumber.clear(); aOrderbyAscendingSave.assign(m_aOrderbyAscending.begin(), m_aOrderbyAscending.end()); bWasSorted = TRUE; } diff --git a/connectivity/source/drivers/file/FStatement.cxx b/connectivity/source/drivers/file/FStatement.cxx index 2692f02d7614..07cdf95d7b44 100644 --- a/connectivity/source/drivers/file/FStatement.cxx +++ b/connectivity/source/drivers/file/FStatement.cxx @@ -639,7 +639,7 @@ void OStatement_Base::GetAssignValues() aColumnNameList.push_back(pCol->getTokenValue()); } } - if(!aColumnNameList.size()) + if ( aColumnNameList.empty() ) throwFunctionSequenceException(*this); // Werte ... @@ -652,10 +652,10 @@ void OStatement_Base::GetAssignValues() if (! SQL_ISTOKEN(pValuesOrQuerySpec->getChild(0),VALUES)) throwFunctionSequenceException(*this); - OSL_ENSURE(pValuesOrQuerySpec->count() == 2,"OResultSet: pValuesOrQuerySpec->count() != 2"); + OSL_ENSURE(pValuesOrQuerySpec->count() == 4,"OResultSet: pValuesOrQuerySpec->count() != 4"); // Liste von Werten - OSQLParseNode * pInsertAtomCommalist = pValuesOrQuerySpec->getChild(1); + OSQLParseNode * pInsertAtomCommalist = pValuesOrQuerySpec->getChild(2); OSL_ENSURE(pInsertAtomCommalist != NULL,"OResultSet: pInsertAtomCommalist darf nicht NULL sein!"); OSL_ENSURE(pInsertAtomCommalist->count() > 0,"OResultSet: pInsertAtomCommalist <= 0"); @@ -665,40 +665,22 @@ void OStatement_Base::GetAssignValues() for (sal_uInt32 i = 0; i < pInsertAtomCommalist->count(); i++) { pRow_Value_Const = pInsertAtomCommalist->getChild(i); // row_value_constructor - if(pRow_Value_Const->count() == 3) // '(' row_value_const_list ')' + OSL_ENSURE(pRow_Value_Const != NULL,"OResultSet: pRow_Value_Const darf nicht NULL sein!"); + if(SQL_ISRULE(pRow_Value_Const,parameter)) { - pRow_Value_Const = pRow_Value_Const->getChild(1); // row_value_const_list - OSL_ENSURE(pRow_Value_Const != NULL,"OResultSet: pRow_Value_Const darf nicht NULL sein!"); - if(SQL_ISRULE(pRow_Value_Const,parameter)) - { - if(pRow_Value_Const->count() == aColumnNameList.size()) - ParseAssignValues(aColumnNameList,pRow_Value_Const,nIndex++); // kann nur ein Columnname vorhanden sein pro Schleife - else - { -// aStatus.Set(SQL_STAT_ERROR, -// String::CreateFromAscii("S1000"), -// aStatus.CreateErrorMessage(String(SdbResId(STR_STAT_SYNTAX_ERROR))), -// 0, String() ); - throwFunctionSequenceException(*this); - } - } - else if(pRow_Value_Const->isToken()) - ParseAssignValues(aColumnNameList,pRow_Value_Const,static_cast<xub_StrLen>(i)); - else - { - if(pRow_Value_Const->count() == aColumnNameList.size()) - { - for (sal_uInt32 j = 0; j < pRow_Value_Const->count(); ++j) - ParseAssignValues(aColumnNameList,pRow_Value_Const->getChild(j),nIndex++); - } - else - throwFunctionSequenceException(*this); - } + ParseAssignValues(aColumnNameList,pRow_Value_Const,nIndex++); // kann nur ein Columnname vorhanden sein pro Schleife } + else if(pRow_Value_Const->isToken()) + ParseAssignValues(aColumnNameList,pRow_Value_Const,static_cast<xub_StrLen>(i)); else { - // aStatus.SetStatementTooComplex(); - throwFunctionSequenceException(*this); + if(pRow_Value_Const->count() == aColumnNameList.size()) + { + for (sal_uInt32 j = 0; j < pRow_Value_Const->count(); ++j) + ParseAssignValues(aColumnNameList,pRow_Value_Const->getChild(j),nIndex++); + } + else + throwFunctionSequenceException(*this); } } } @@ -814,6 +796,7 @@ void OStatement_Base::SetAssignValue(const String& aColumnName, // Kriterium je nach Typ als String oder double in die Variable packen ... case DataType::CHAR: case DataType::VARCHAR: + case DataType::LONGVARCHAR: *(m_aAssignValues->get())[nId] = ORowSetValue(aValue); // Zeichensatz ist bereits konvertiert, da ja das gesamte Statement konvertiert wurde break; diff --git a/connectivity/source/drivers/file/FStringFunctions.cxx b/connectivity/source/drivers/file/FStringFunctions.cxx index e3eeb52f2d7d..07e620763b79 100644 --- a/connectivity/source/drivers/file/FStringFunctions.cxx +++ b/connectivity/source/drivers/file/FStringFunctions.cxx @@ -32,6 +32,7 @@ #include "precompiled_connectivity.hxx" #include "file/FStringFunctions.hxx" +#include <rtl/ustrbuf.hxx> #include <rtl/logfile.hxx> using namespace connectivity; @@ -102,7 +103,7 @@ ORowSetValue OOp_Concat::operate(const ::std::vector<ORowSetValue>& lhs) const if ( lhs.empty() ) return ORowSetValue(); - ::rtl::OUString sRet; + ::rtl::OUStringBuffer sRet; ::std::vector<ORowSetValue>::const_reverse_iterator aIter = lhs.rbegin(); ::std::vector<ORowSetValue>::const_reverse_iterator aEnd = lhs.rend(); for (; aIter != aEnd; ++aIter) @@ -110,10 +111,10 @@ ORowSetValue OOp_Concat::operate(const ::std::vector<ORowSetValue>& lhs) const if ( aIter->isNull() ) return ORowSetValue(); - sRet += *aIter; + sRet.append(aIter->operator ::rtl::OUString()); } - return sRet; + return sRet.makeStringAndClear(); } //------------------------------------------------------------------ ORowSetValue OOp_Locate::operate(const ::std::vector<ORowSetValue>& lhs) const @@ -183,13 +184,13 @@ ORowSetValue OOp_Space::operate(const ORowSetValue& lhs) const return lhs; const sal_Char c = ' '; - ::rtl::OUString sRet; + ::rtl::OUStringBuffer sRet; sal_Int32 nCount = lhs; for (sal_Int32 i=0; i < nCount; ++i) { - sRet += ::rtl::OUString(&c,1,RTL_TEXTENCODING_ASCII_US); + sRet.appendAscii(&c,1); } - return sRet; + return sRet.makeStringAndClear(); } //------------------------------------------------------------------ ORowSetValue OOp_Replace::operate(const ::std::vector<ORowSetValue>& lhs) const diff --git a/connectivity/source/drivers/file/fcode.cxx b/connectivity/source/drivers/file/fcode.cxx index 0bd0d354ba02..4b2865a67aa2 100644 --- a/connectivity/source/drivers/file/fcode.cxx +++ b/connectivity/source/drivers/file/fcode.cxx @@ -65,6 +65,7 @@ TYPEINIT1(OStopOperand, OOperandValue); TYPEINIT1(OOperator, OCode); TYPEINIT1(OBoolOperator,OOperator); +TYPEINIT1(OOp_NOT, OBoolOperator); TYPEINIT1(OOp_AND, OBoolOperator); TYPEINIT1(OOp_OR, OBoolOperator); TYPEINIT1(OOp_ISNULL, OBoolOperator); @@ -242,6 +243,29 @@ void OBoolOperator::Exec(OCodeStack& rCodeStack) if (IS_TYPE(OOperandResult,pRight)) delete pRight; } +//------------------------------------------------------------------ +sal_Bool OOp_NOT::operate(const OOperand* pLeft, const OOperand* ) const +{ + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_AND::operate" ); + return !pLeft->isValid(); +} +//------------------------------------------------------------------ +void OOp_NOT::Exec(OCodeStack& rCodeStack) +{ + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_ISNULL::Exec" ); + OOperand* pOperand = rCodeStack.top(); + rCodeStack.pop(); + + rCodeStack.push(new OOperandResultBOOL(operate(pOperand))); + if (IS_TYPE(OOperandResult,pOperand)) + delete pOperand; +} +//------------------------------------------------------------------ +sal_uInt16 OOp_NOT::getRequestedOperands() const +{ + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_NOT::getRequestedOperands" ); + return 1; +} //------------------------------------------------------------------ sal_Bool OOp_AND::operate(const OOperand* pLeft, const OOperand* pRight) const @@ -331,6 +355,7 @@ sal_Bool OOp_COMPARE::operate(const OOperand* pLeft, const OOperand* pRight) con { case DataType::CHAR: case DataType::VARCHAR: + case DataType::LONGVARCHAR: { rtl::OUString sLH = aLH, sRH = aRH; INT32 nRes = rtl_ustr_compareIgnoreAsciiCase_WithLength diff --git a/connectivity/source/drivers/file/fcomp.cxx b/connectivity/source/drivers/file/fcomp.cxx index de243f83c71c..9c801d6d9b98 100644 --- a/connectivity/source/drivers/file/fcomp.cxx +++ b/connectivity/source/drivers/file/fcomp.cxx @@ -166,7 +166,7 @@ OOperand* OPredicateCompiler::execute(OSQLParseNode* pPredicateNode) } else if ((SQL_ISRULE(pPredicateNode,search_condition) || (SQL_ISRULE(pPredicateNode,boolean_term))) && // AND/OR-Verknuepfung: - pPredicateNode->count() == 3) + pPredicateNode->count() == 3) { execute(pPredicateNode->getChild(0)); // Bearbeiten des linken Zweigs execute(pPredicateNode->getChild(2)); // Bearbeiten des rechten Zweigs @@ -183,6 +183,11 @@ OOperand* OPredicateCompiler::execute(OSQLParseNode* pPredicateNode) DBG_ERROR("OPredicateCompiler: Fehler im Parse Tree"); } } + else if (SQL_ISRULE(pPredicateNode,boolean_factor)) + { + execute(pPredicateNode->getChild(1)); + m_aCodeList.push_back(new OOp_NOT()); + } else if (SQL_ISRULE(pPredicateNode,comparison_predicate)) { execute_COMPARE(pPredicateNode); diff --git a/connectivity/source/drivers/file/quotedstring.cxx b/connectivity/source/drivers/file/quotedstring.cxx index 5cf56aec9375..abd2d3b51e44 100644 --- a/connectivity/source/drivers/file/quotedstring.cxx +++ b/connectivity/source/drivers/file/quotedstring.cxx @@ -113,7 +113,7 @@ namespace connectivity if ( nStartPos >= nLen ) return; - sal_Unicode* pData = _rStr.AllocBuffer(nLen - nStartPos); + sal_Unicode* pData = _rStr.AllocBuffer( nLen - nStartPos + 1 ); const sal_Unicode* pStart = pData; // Suche bis Stringende nach dem ersten nicht uebereinstimmenden Zeichen for( xub_StrLen i = nStartPos; i < nLen; ++i ) @@ -135,6 +135,7 @@ namespace connectivity { // String-Ende bInString = FALSE; + *pData = 0; } } else @@ -151,6 +152,7 @@ namespace connectivity // Vorzeitiger Abbruch der Schleife moeglich, denn // wir haben, was wir wollten. nStartPos = i+1; + *pData = 0; break; } else |