summaryrefslogtreecommitdiff
path: root/connectivity/source/drivers/file
diff options
context:
space:
mode:
Diffstat (limited to 'connectivity/source/drivers/file')
-rw-r--r--connectivity/source/drivers/file/FCatalog.cxx2
-rw-r--r--connectivity/source/drivers/file/FConnection.cxx4
-rw-r--r--connectivity/source/drivers/file/FPreparedStatement.cxx4
-rw-r--r--connectivity/source/drivers/file/FResultSet.cxx14
-rw-r--r--connectivity/source/drivers/file/FStatement.cxx49
-rw-r--r--connectivity/source/drivers/file/FStringFunctions.cxx13
-rw-r--r--connectivity/source/drivers/file/FTables.cxx2
-rw-r--r--connectivity/source/drivers/file/fanalyzer.cxx3
-rw-r--r--connectivity/source/drivers/file/fcode.cxx25
-rw-r--r--connectivity/source/drivers/file/fcomp.cxx9
-rw-r--r--connectivity/source/drivers/file/quotedstring.cxx4
11 files changed, 74 insertions, 55 deletions
diff --git a/connectivity/source/drivers/file/FCatalog.cxx b/connectivity/source/drivers/file/FCatalog.cxx
index 8f51eedc1cfe..79eb15aa6648 100644
--- a/connectivity/source/drivers/file/FCatalog.cxx
+++ b/connectivity/source/drivers/file/FCatalog.cxx
@@ -58,7 +58,7 @@ void SAL_CALL OFileCatalog::disposing()
::osl::MutexGuard aGuard(m_aMutex);
typedef connectivity::sdbcx::OCatalog OFileCatalog_BASE;
- m_xMetaData = NULL;
+m_xMetaData.clear();
OFileCatalog_BASE::disposing();
}
// -----------------------------------------------------------------------------
diff --git a/connectivity/source/drivers/file/FConnection.cxx b/connectivity/source/drivers/file/FConnection.cxx
index 4fb0583e281b..52d14e6498cb 100644
--- a/connectivity/source/drivers/file/FConnection.cxx
+++ b/connectivity/source/drivers/file/FConnection.cxx
@@ -383,8 +383,8 @@ void OConnection::disposing()
OConnection_BASE::disposing();
m_bClosed = sal_True;
- m_xDir = NULL;
- m_xContent = NULL;
+m_xDir.clear();
+m_xContent.clear();
m_xCatalog = WeakReference< XTablesSupplier>();
dispose_ChildImpl();
diff --git a/connectivity/source/drivers/file/FPreparedStatement.cxx b/connectivity/source/drivers/file/FPreparedStatement.cxx
index 722037ae6ea6..b55276c3b17d 100644
--- a/connectivity/source/drivers/file/FPreparedStatement.cxx
+++ b/connectivity/source/drivers/file/FPreparedStatement.cxx
@@ -98,9 +98,7 @@ void OPreparedStatement::disposing()
}
m_xParamColumns = NULL;
-
-
- m_xMetaData = NULL;
+ m_xMetaData.clear();
if(m_aParameterRow.isValid())
{
m_aParameterRow->get().clear();
diff --git a/connectivity/source/drivers/file/FResultSet.cxx b/connectivity/source/drivers/file/FResultSet.cxx
index ca86fb2a3d73..dbc2162f9d73 100644
--- a/connectivity/source/drivers/file/FResultSet.cxx
+++ b/connectivity/source/drivers/file/FResultSet.cxx
@@ -174,13 +174,13 @@ void OResultSet::disposing(void)
OPropertySetHelper::disposing();
::osl::MutexGuard aGuard(m_aMutex);
- m_xStatement = NULL;
- m_xMetaData = NULL;
+ m_xStatement.clear();
+ m_xMetaData.clear();
m_pParseTree = NULL;
- m_xColNames = NULL;
- m_xColumns = NULL;
+ m_xColNames.clear();
+ m_xColumns = NULL;
m_xParamColumns = NULL;
- m_xColsIdx = NULL;
+ m_xColsIdx.clear();
Reference<XComponent> xComp = m_pTable;
if ( xComp.is() )
@@ -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/FTables.cxx b/connectivity/source/drivers/file/FTables.cxx
index 0862c3803b31..5da29306e475 100644
--- a/connectivity/source/drivers/file/FTables.cxx
+++ b/connectivity/source/drivers/file/FTables.cxx
@@ -68,7 +68,7 @@ void OTables::impl_refresh( ) throw(RuntimeException)
// -------------------------------------------------------------------------
void OTables::disposing(void)
{
- m_xMetaData = NULL;
+m_xMetaData.clear();
OCollection::disposing();
}
//------------------------------------------------------------------
diff --git a/connectivity/source/drivers/file/fanalyzer.cxx b/connectivity/source/drivers/file/fanalyzer.cxx
index c866db55275e..eceb58e10611 100644
--- a/connectivity/source/drivers/file/fanalyzer.cxx
+++ b/connectivity/source/drivers/file/fanalyzer.cxx
@@ -90,6 +90,9 @@ void OSQLAnalyzer::start(OSQLParseNode* pSQLParseNode)
|| SQL_ISRULE(pColumnRef,position_exp)
|| SQL_ISRULE(pColumnRef,fold)
|| SQL_ISRULE(pColumnRef,length_exp)
+ || SQL_ISRULE(pColumnRef,num_value_exp)
+ || SQL_ISRULE(pColumnRef,term)
+ || SQL_ISRULE(pColumnRef,factor)
|| SQL_ISRULE(pColumnRef,set_fct_spec) )
{
::vos::ORef<OPredicateCompiler> pCompiler = new OPredicateCompiler(this);
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..04d38ddfc5ee 100644
--- a/connectivity/source/drivers/file/fcomp.cxx
+++ b/connectivity/source/drivers/file/fcomp.cxx
@@ -79,7 +79,7 @@ void OPredicateCompiler::dispose()
{
Clean();
m_orgColumns = NULL;
- m_xIndexes = NULL;
+m_xIndexes.clear();
}
//------------------------------------------------------------------
// inline OCursor& OPredicateCompiler::Cursor() const {return m_rCursor;}
@@ -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