diff options
author | Ocke Janssen <oj@openoffice.org> | 2001-08-29 11:21:08 +0000 |
---|---|---|
committer | Ocke Janssen <oj@openoffice.org> | 2001-08-29 11:21:08 +0000 |
commit | b3b894be722f9aad6d8a05bc2455ba9af490f9e2 (patch) | |
tree | 14ef9ab83c4f8af4f45fff5493d569a20f4ba15d | |
parent | 8cf6106c855901bd2ec6a959ad6e93f3686ec143 (diff) |
#84578# fixes for resultset
21 files changed, 344 insertions, 711 deletions
diff --git a/connectivity/source/commontools/FDatabaseMetaDataResultSet.cxx b/connectivity/source/commontools/FDatabaseMetaDataResultSet.cxx index 6f6d249b871d..70952f75ed1c 100644 --- a/connectivity/source/commontools/FDatabaseMetaDataResultSet.cxx +++ b/connectivity/source/commontools/FDatabaseMetaDataResultSet.cxx @@ -2,9 +2,9 @@ * * $RCSfile: FDatabaseMetaDataResultSet.cxx,v $ * - * $Revision: 1.12 $ + * $Revision: 1.13 $ * - * last change: $Author: oj $ $Date: 2001-08-24 06:02:18 $ + * last change: $Author: oj $ $Date: 2001-08-29 12:16:07 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -644,7 +644,7 @@ Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL ODatabaseMetaDat return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper()); } // ----------------------------------------------------------------------------- -ODatabaseMetaDataResultSet::ORowSetValueDecorator& ODatabaseMetaDataResultSet::ORowSetValueDecorator::operator=(const ORowSetValue& _aValue) +ORowSetValueDecorator& ORowSetValueDecorator::operator=(const ORowSetValue& _aValue) { m_aValue = _aValue; return *this; @@ -666,82 +666,82 @@ const ORowSetValue& ODatabaseMetaDataResultSet::getValue(sal_Int32 columnIndex) } // ----------------------------------------------------------------------------- /// return an empty ORowSetValueDecorator -ODatabaseMetaDataResultSet::ORowSetValueDecoratorRef ODatabaseMetaDataResultSet::getEmptyValue() +ORowSetValueDecoratorRef ODatabaseMetaDataResultSet::getEmptyValue() { static ORowSetValueDecoratorRef aEmptyValueRef = new ORowSetValueDecorator(); return aEmptyValueRef; } // ----------------------------------------------------------------------------- /// return an ORowSetValueDecorator with 0 as value -ODatabaseMetaDataResultSet::ORowSetValueDecoratorRef ODatabaseMetaDataResultSet::get0Value() +ORowSetValueDecoratorRef ODatabaseMetaDataResultSet::get0Value() { static ORowSetValueDecoratorRef a0ValueRef = new ORowSetValueDecorator((sal_Int32)0); return a0ValueRef; } // ----------------------------------------------------------------------------- /// return an ORowSetValueDecorator with 1 as value -ODatabaseMetaDataResultSet::ORowSetValueDecoratorRef ODatabaseMetaDataResultSet::get1Value() +ORowSetValueDecoratorRef ODatabaseMetaDataResultSet::get1Value() { static ORowSetValueDecoratorRef a1ValueRef = new ORowSetValueDecorator((sal_Int32)1); return a1ValueRef; } // ----------------------------------------------------------------------------- /// return an ORowSetValueDecorator with ColumnSearch::BASIC as value -ODatabaseMetaDataResultSet::ORowSetValueDecoratorRef ODatabaseMetaDataResultSet::getBasicValue() +ORowSetValueDecoratorRef ODatabaseMetaDataResultSet::getBasicValue() { static ORowSetValueDecoratorRef aValueRef = new ORowSetValueDecorator(ColumnSearch::BASIC); return aValueRef; } // ----------------------------------------------------------------------------- -ODatabaseMetaDataResultSet::ORowSetValueDecoratorRef ODatabaseMetaDataResultSet::getSelectValue() +ORowSetValueDecoratorRef ODatabaseMetaDataResultSet::getSelectValue() { static ORowSetValueDecoratorRef aValueRef = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("SELECT")); return aValueRef; } // ----------------------------------------------------------------------------- -ODatabaseMetaDataResultSet::ORowSetValueDecoratorRef ODatabaseMetaDataResultSet::getInsertValue() +ORowSetValueDecoratorRef ODatabaseMetaDataResultSet::getInsertValue() { static ORowSetValueDecoratorRef aValueRef = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("INSERT")); return aValueRef; } // ----------------------------------------------------------------------------- -ODatabaseMetaDataResultSet::ORowSetValueDecoratorRef ODatabaseMetaDataResultSet::getDeleteValue() +ORowSetValueDecoratorRef ODatabaseMetaDataResultSet::getDeleteValue() { static ORowSetValueDecoratorRef aValueRef = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("DELETE")); return aValueRef; } // ----------------------------------------------------------------------------- -ODatabaseMetaDataResultSet::ORowSetValueDecoratorRef ODatabaseMetaDataResultSet::getUpdateValue() +ORowSetValueDecoratorRef ODatabaseMetaDataResultSet::getUpdateValue() { static ORowSetValueDecoratorRef aValueRef = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("UPDATE")); return aValueRef; } // ----------------------------------------------------------------------------- -ODatabaseMetaDataResultSet::ORowSetValueDecoratorRef ODatabaseMetaDataResultSet::getCreateValue() +ORowSetValueDecoratorRef ODatabaseMetaDataResultSet::getCreateValue() { static ORowSetValueDecoratorRef aValueRef = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("CREATE")); return aValueRef; } // ----------------------------------------------------------------------------- -ODatabaseMetaDataResultSet::ORowSetValueDecoratorRef ODatabaseMetaDataResultSet::getReadValue() +ORowSetValueDecoratorRef ODatabaseMetaDataResultSet::getReadValue() { static ORowSetValueDecoratorRef aValueRef = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("READ")); return aValueRef; } // ----------------------------------------------------------------------------- -ODatabaseMetaDataResultSet::ORowSetValueDecoratorRef ODatabaseMetaDataResultSet::getAlterValue() +ORowSetValueDecoratorRef ODatabaseMetaDataResultSet::getAlterValue() { static ORowSetValueDecoratorRef aValueRef = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("ALTER")); return aValueRef; } // ----------------------------------------------------------------------------- -ODatabaseMetaDataResultSet::ORowSetValueDecoratorRef ODatabaseMetaDataResultSet::getDropValue() +ORowSetValueDecoratorRef ODatabaseMetaDataResultSet::getDropValue() { static ORowSetValueDecoratorRef aValueRef = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("DROP")); return aValueRef; } // ----------------------------------------------------------------------------- -ODatabaseMetaDataResultSet::ORowSetValueDecoratorRef ODatabaseMetaDataResultSet::getQuoteValue() +ORowSetValueDecoratorRef ODatabaseMetaDataResultSet::getQuoteValue() { static ORowSetValueDecoratorRef aValueRef = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("'")); return aValueRef; diff --git a/connectivity/source/commontools/makefile.mk b/connectivity/source/commontools/makefile.mk index bcaecfc56acd..a72c80629ec2 100644 --- a/connectivity/source/commontools/makefile.mk +++ b/connectivity/source/commontools/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.16 $ +# $Revision: 1.17 $ # -# last change: $Author: hr $ $Date: 2001-05-29 10:07:41 $ +# last change: $Author: oj $ $Date: 2001-08-29 12:16:07 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -74,6 +74,7 @@ ENVCFLAGS+=/FR$(SLO)$/ # --- Files -------------------------------------------------------- SLOFILES=\ + $(SLO)$/TSortIndex.obj \ $(SLO)$/TConnection.obj \ $(SLO)$/conncleanup.obj \ $(SLO)$/emptymetadata.obj \ diff --git a/connectivity/source/drivers/adabas/BConnection.cxx b/connectivity/source/drivers/adabas/BConnection.cxx index 3ae9e5631183..7d4309aee6f2 100644 --- a/connectivity/source/drivers/adabas/BConnection.cxx +++ b/connectivity/source/drivers/adabas/BConnection.cxx @@ -2,9 +2,9 @@ * * $RCSfile: BConnection.cxx,v $ * - * $Revision: 1.9 $ + * $Revision: 1.10 $ * - * last change: $Author: oj $ $Date: 2001-08-24 06:12:05 $ + * last change: $Author: oj $ $Date: 2001-08-29 12:21:07 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -120,6 +120,8 @@ SQLRETURN OAdabasConnection::Construct( const ::rtl::OUString& url,const Sequenc osl_incrementInterlockedCount( &m_refCount ); m_aConnectionHandle = SQL_NULL_HANDLE; + m_aURL = url; + m_aInfo = info; // Connection allozieren N3SQLAllocHandle(SQL_HANDLE_DBC,m_pDriverHandleCopy,&m_aConnectionHandle); @@ -306,6 +308,11 @@ Sequence< sal_Int8 > OAdabasConnection::getUnoTunnelImplementationId() return pId->getImplementationId(); } // ----------------------------------------------------------------------------- +::connectivity::odbc::OConnection* OAdabasConnection::cloneConnection() +{ + return new OAdabasConnection(m_pDriverHandleCopy,m_pDriver); +} +// ----------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/adabas/BDatabaseMetaData.cxx b/connectivity/source/drivers/adabas/BDatabaseMetaData.cxx index 2dbae006897e..f372fe0d3f41 100644 --- a/connectivity/source/drivers/adabas/BDatabaseMetaData.cxx +++ b/connectivity/source/drivers/adabas/BDatabaseMetaData.cxx @@ -2,9 +2,9 @@ * * $RCSfile: BDatabaseMetaData.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: oj $ $Date: 2001-08-24 06:12:05 $ + * last change: $Author: oj $ $Date: 2001-08-29 12:21:07 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -106,58 +106,58 @@ Reference< XResultSet > SAL_CALL OAdabasDatabaseMetaData::getTypeInfo( ) throw( while(xRes->next()) { sal_Int32 nPos = 1; - aRow[nPos++] = new ::connectivity::ODatabaseMetaDataResultSet::ORowSetValueDecorator(xRow->getString (1)); + aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getString (1)); if(xRow->wasNull()) aRow[nPos-1]->setNull(); - aRow[nPos++] = new ::connectivity::ODatabaseMetaDataResultSet::ORowSetValueDecorator(xRow->getInt (2)); + aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getInt (2)); if(xRow->wasNull()) aRow[nPos-1]->setNull(); - aRow[nPos++] = new ::connectivity::ODatabaseMetaDataResultSet::ORowSetValueDecorator(xRow->getInt (3)); + aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getInt (3)); if(xRow->wasNull()) aRow[nPos-1]->setNull(); - aRow[nPos++] = new ::connectivity::ODatabaseMetaDataResultSet::ORowSetValueDecorator(xRow->getString (4)); + aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getString (4)); if(xRow->wasNull()) aRow[nPos-1]->setNull(); - aRow[nPos++] = new ::connectivity::ODatabaseMetaDataResultSet::ORowSetValueDecorator(xRow->getString (5)); + aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getString (5)); if(xRow->wasNull()) aRow[nPos-1]->setNull(); - aRow[nPos++] = new ::connectivity::ODatabaseMetaDataResultSet::ORowSetValueDecorator(xRow->getString (6)); + aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getString (6)); if(xRow->wasNull()) aRow[nPos-1]->setNull(); - aRow[nPos++] = new ::connectivity::ODatabaseMetaDataResultSet::ORowSetValueDecorator(xRow->getInt (7)); + aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getInt (7)); if(xRow->wasNull()) aRow[nPos-1]->setNull(); - aRow[nPos++] = new ::connectivity::ODatabaseMetaDataResultSet::ORowSetValueDecorator(xRow->getBoolean (8)); + aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getBoolean (8)); if(xRow->wasNull()) aRow[nPos-1]->setNull(); - aRow[nPos++] = new ::connectivity::ODatabaseMetaDataResultSet::ORowSetValueDecorator(xRow->getShort (9)); + aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getShort (9)); if(xRow->wasNull()) aRow[nPos-1]->setNull(); - aRow[nPos++] = new ::connectivity::ODatabaseMetaDataResultSet::ORowSetValueDecorator(xRow->getBoolean (10)); + aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getBoolean (10)); if(xRow->wasNull()) aRow[nPos-1]->setNull(); - aRow[nPos++] = new ::connectivity::ODatabaseMetaDataResultSet::ORowSetValueDecorator(xRow->getInt (11)); + aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getInt (11)); if(xRow->wasNull()) aRow[nPos-1]->setNull(); - aRow[nPos++] = new ::connectivity::ODatabaseMetaDataResultSet::ORowSetValueDecorator(xRow->getBoolean (12)); + aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getBoolean (12)); if(xRow->wasNull()) aRow[nPos-1]->setNull(); - aRow[nPos++] = new ::connectivity::ODatabaseMetaDataResultSet::ORowSetValueDecorator(xRow->getString (13)); + aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getString (13)); if(xRow->wasNull()) aRow[nPos-1]->setNull(); - aRow[nPos++] = new ::connectivity::ODatabaseMetaDataResultSet::ORowSetValueDecorator(xRow->getShort (14)); + aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getShort (14)); if(xRow->wasNull()) aRow[nPos-1]->setNull(); - aRow[nPos++] = new ::connectivity::ODatabaseMetaDataResultSet::ORowSetValueDecorator(xRow->getShort (15)); + aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getShort (15)); if(xRow->wasNull()) aRow[nPos-1]->setNull(); - aRow[nPos++] = new ::connectivity::ODatabaseMetaDataResultSet::ORowSetValueDecorator(xRow->getInt (16)); + aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getInt (16)); if(xRow->wasNull()) aRow[nPos-1]->setNull(); - aRow[nPos++] = new ::connectivity::ODatabaseMetaDataResultSet::ORowSetValueDecorator(xRow->getInt (17)); + aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getInt (17)); if(xRow->wasNull()) aRow[nPos-1]->setNull(); - aRow[nPos++] = new ::connectivity::ODatabaseMetaDataResultSet::ORowSetValueDecorator((sal_Int16)xRow->getInt(18)); + aRow[nPos++] = new ::connectivity::ORowSetValueDecorator((sal_Int16)xRow->getInt(18)); if(xRow->wasNull()) aRow[nPos-1]->setNull(); diff --git a/connectivity/source/drivers/ado/ADatabaseMetaData.cxx b/connectivity/source/drivers/ado/ADatabaseMetaData.cxx index 66bef0cc5990..f8e0341a9623 100644 --- a/connectivity/source/drivers/ado/ADatabaseMetaData.cxx +++ b/connectivity/source/drivers/ado/ADatabaseMetaData.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ADatabaseMetaData.cxx,v $ * - * $Revision: 1.10 $ + * $Revision: 1.11 $ * - * last change: $Author: oj $ $Date: 2001-08-24 06:13:55 $ + * last change: $Author: oj $ $Date: 2001-08-29 12:21:07 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -441,12 +441,12 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges( aRow[0] = ::connectivity::ODatabaseMetaDataResultSet::getEmptyValue(); aRow[1] = ::connectivity::ODatabaseMetaDataResultSet::getEmptyValue(); - aRow[2] = new ::connectivity::ODatabaseMetaDataResultSet::ORowSetValueDecorator(tableNamePattern); + aRow[2] = new ::connectivity::ORowSetValueDecorator(tableNamePattern); aRow[3] = ::connectivity::ODatabaseMetaDataResultSet::getEmptyValue(); aRow[4] = ::connectivity::ODatabaseMetaDataResultSet::getEmptyValue(); - aRow[5] = new ::connectivity::ODatabaseMetaDataResultSet::ORowSetValueDecorator(getUserName()); + aRow[5] = new ::connectivity::ORowSetValueDecorator(getUserName()); aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getSelectValue(); - aRow[7] = new ::connectivity::ODatabaseMetaDataResultSet::ORowSetValueDecorator(::rtl::OUString::createFromAscii("NO")); + aRow[7] = new ::connectivity::ORowSetValueDecorator(::rtl::OUString::createFromAscii("NO")); aRows.push_back(aRow); aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getInsertValue(); diff --git a/connectivity/source/drivers/calc/CDatabaseMetaData.cxx b/connectivity/source/drivers/calc/CDatabaseMetaData.cxx index 4828de53d6a0..df2c426134ee 100644 --- a/connectivity/source/drivers/calc/CDatabaseMetaData.cxx +++ b/connectivity/source/drivers/calc/CDatabaseMetaData.cxx @@ -2,9 +2,9 @@ * * $RCSfile: CDatabaseMetaData.cxx,v $ * - * $Revision: 1.10 $ + * $Revision: 1.11 $ * - * last change: $Author: oj $ $Date: 2001-08-24 06:18:05 $ + * last change: $Author: oj $ $Date: 2001-08-29 12:21:07 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -159,15 +159,15 @@ Reference< XResultSet > SAL_CALL OCalcDatabaseMetaData::getTypeInfo( ) throw(SQ aRow.reserve(18); aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue()); - aRow.push_back(new ODatabaseMetaDataResultSet::ORowSetValueDecorator(::rtl::OUString::createFromAscii("VARCHAR"))); - aRow.push_back(new ODatabaseMetaDataResultSet::ORowSetValueDecorator(DataType::VARCHAR)); - aRow.push_back(new ODatabaseMetaDataResultSet::ORowSetValueDecorator((sal_Int32)65535)); + aRow.push_back(new ORowSetValueDecorator(::rtl::OUString::createFromAscii("VARCHAR"))); + aRow.push_back(new ORowSetValueDecorator(DataType::VARCHAR)); + aRow.push_back(new ORowSetValueDecorator((sal_Int32)65535)); aRow.push_back(ODatabaseMetaDataResultSet::getQuoteValue()); aRow.push_back(ODatabaseMetaDataResultSet::getQuoteValue()); aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue()); aRow.push_back(ODatabaseMetaDataResultSet::get1Value()); // ORowSetValue((sal_Int32)ColumnValue::NULLABLE) aRow.push_back(ODatabaseMetaDataResultSet::get1Value()); - aRow.push_back(new ODatabaseMetaDataResultSet::ORowSetValueDecorator((sal_Int32)ColumnSearch::CHAR)); + aRow.push_back(new ORowSetValueDecorator((sal_Int32)ColumnSearch::CHAR)); aRow.push_back(ODatabaseMetaDataResultSet::get1Value()); aRow.push_back(ODatabaseMetaDataResultSet::get0Value()); aRow.push_back(ODatabaseMetaDataResultSet::get0Value()); @@ -176,41 +176,41 @@ Reference< XResultSet > SAL_CALL OCalcDatabaseMetaData::getTypeInfo( ) throw(SQ aRow.push_back(ODatabaseMetaDataResultSet::get0Value()); aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue()); aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue()); - aRow.push_back(new ODatabaseMetaDataResultSet::ORowSetValueDecorator((sal_Int32)10)); + aRow.push_back(new ORowSetValueDecorator((sal_Int32)10)); aRows.push_back(aRow); - aRow[1] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(::rtl::OUString::createFromAscii("DECIMAL")); - aRow[2] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(DataType::DECIMAL); + aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("DECIMAL")); + aRow[2] = new ORowSetValueDecorator(DataType::DECIMAL); aRow[3] = ODatabaseMetaDataResultSet::get0Value(); aRow[9] = ODatabaseMetaDataResultSet::getBasicValue(); aRow[15] = ODatabaseMetaDataResultSet::get0Value(); aRows.push_back(aRow); - aRow[1] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(::rtl::OUString::createFromAscii("BOOL")); - aRow[2] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(DataType::BIT); - aRow[3] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator((sal_Int32)20); + aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("BOOL")); + aRow[2] = new ORowSetValueDecorator(DataType::BIT); + aRow[3] = new ORowSetValueDecorator((sal_Int32)20); aRow[9] = ODatabaseMetaDataResultSet::getBasicValue(); - aRow[15] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator((sal_Int32)15); + aRow[15] = new ORowSetValueDecorator((sal_Int32)15); aRows.push_back(aRow); - aRow[1] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(::rtl::OUString::createFromAscii("DATE")); - aRow[2] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(DataType::DATE); + aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("DATE")); + aRow[2] = new ORowSetValueDecorator(DataType::DATE); aRow[3] = ODatabaseMetaDataResultSet::get0Value(); aRow[9] = ODatabaseMetaDataResultSet::getBasicValue(); aRow[15] = ODatabaseMetaDataResultSet::get0Value(); aRows.push_back(aRow); - aRow[1] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(::rtl::OUString::createFromAscii("TIME")); - aRow[2] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(DataType::TIME); + aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("TIME")); + aRow[2] = new ORowSetValueDecorator(DataType::TIME); aRow[3] = ODatabaseMetaDataResultSet::get0Value(); aRow[9] = ODatabaseMetaDataResultSet::getBasicValue(); aRow[15] = ODatabaseMetaDataResultSet::get0Value(); aRows.push_back(aRow); - aRow[1] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(::rtl::OUString::createFromAscii("TIMESTAMP")); - aRow[2] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(DataType::TIMESTAMP); + aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("TIMESTAMP")); + aRow[2] = new ORowSetValueDecorator(DataType::TIMESTAMP); aRow[3] = ODatabaseMetaDataResultSet::get0Value(); aRow[9] = ODatabaseMetaDataResultSet::getBasicValue(); aRow[15] = ODatabaseMetaDataResultSet::get0Value(); @@ -255,7 +255,7 @@ Reference< XResultSet > SAL_CALL OCalcDatabaseMetaData::getColumns( ODatabaseMetaDataResultSet::ORows aRows; ODatabaseMetaDataResultSet::ORow aRow(19); - aRow[10] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator((sal_Int32)10); + aRow[10] = new ORowSetValueDecorator((sal_Int32)10); Sequence< ::rtl::OUString> aTabNames(xNames->getElementNames()); const ::rtl::OUString* pTabBegin = aTabNames.getConstArray(); @@ -267,7 +267,7 @@ Reference< XResultSet > SAL_CALL OCalcDatabaseMetaData::getColumns( Reference< XColumnsSupplier> xTable; xNames->getByName(*pTabBegin) >>= xTable; OSL_ENSURE(xTable.is(),"Table not found! Normallya exception had to be thrown here!"); - aRow[3] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(*pTabBegin); + aRow[3] = new ORowSetValueDecorator(*pTabBegin); Reference< XNameAccess> xColumns = xTable->getColumns(); if(!xColumns.is()) @@ -282,43 +282,43 @@ Reference< XResultSet > SAL_CALL OCalcDatabaseMetaData::getColumns( { if(match(columnNamePattern,*pBegin,'\0')) { - aRow[4] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator( *pBegin); + aRow[4] = new ORowSetValueDecorator( *pBegin); xColumns->getByName(*pBegin) >>= xColumn; OSL_ENSURE(xColumn.is(),"Columns contains a column who isn't a fastpropertyset!"); - aRow[5] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(::comphelper::getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)))); - aRow[6] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(::comphelper::getString(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME)))); - aRow[7] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(::comphelper::getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION)))); + aRow[5] = new ORowSetValueDecorator(::comphelper::getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)))); + aRow[6] = new ORowSetValueDecorator(::comphelper::getString(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME)))); + aRow[7] = new ORowSetValueDecorator(::comphelper::getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION)))); // aRow[8] = xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME)); - aRow[9] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(::comphelper::getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE)))); - aRow[11] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(::comphelper::getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE)))); + aRow[9] = new ORowSetValueDecorator(::comphelper::getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE)))); + aRow[11] = new ORowSetValueDecorator(::comphelper::getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE)))); // aRow[12] = xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME)); - aRow[13] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(::comphelper::getString(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DEFAULTVALUE)))); + aRow[13] = new ORowSetValueDecorator(::comphelper::getString(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DEFAULTVALUE)))); // aRow[14] = xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME)); // aRow[15] = xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME)); switch(sal_Int32(aRow[5]->getValue())) { case DataType::CHAR: case DataType::VARCHAR: - aRow[16] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator((sal_Int32)254); + aRow[16] = new ORowSetValueDecorator((sal_Int32)254); break; case DataType::LONGVARCHAR: - aRow[16] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator((sal_Int32)65535); + aRow[16] = new ORowSetValueDecorator((sal_Int32)65535); break; default: - aRow[16] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator((sal_Int32)0); + aRow[16] = new ORowSetValueDecorator((sal_Int32)0); } - aRow[17] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(i); + aRow[17] = new ORowSetValueDecorator(i); switch(sal_Int32(aRow[11]->getValue())) { case ColumnValue::NO_NULLS: - aRow[18] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(::rtl::OUString::createFromAscii("NO")); + aRow[18] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("NO")); break; case ColumnValue::NULLABLE: - aRow[18] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(::rtl::OUString::createFromAscii("YES")); + aRow[18] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("YES")); break; default: - aRow[18] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(::rtl::OUString()); + aRow[18] = new ORowSetValueDecorator(::rtl::OUString()); } aRows.push_back(aRow); } @@ -636,8 +636,8 @@ Reference< XResultSet > SAL_CALL OCalcDatabaseMetaData::getTables( { ODatabaseMetaDataResultSet::ORow aRow(3); aRow.reserve(6); - aRow.push_back(new ODatabaseMetaDataResultSet::ORowSetValueDecorator(aName)); - aRow.push_back(new ODatabaseMetaDataResultSet::ORowSetValueDecorator(aTable)); + aRow.push_back(new ORowSetValueDecorator(aName)); + aRow.push_back(new ORowSetValueDecorator(aTable)); aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue()); aRows.push_back(aRow); } @@ -661,8 +661,8 @@ Reference< XResultSet > SAL_CALL OCalcDatabaseMetaData::getTables( { ODatabaseMetaDataResultSet::ORow aRow(3); aRow.reserve(6); - aRow.push_back(new ODatabaseMetaDataResultSet::ORowSetValueDecorator(aName)); - aRow.push_back(new ODatabaseMetaDataResultSet::ORowSetValueDecorator(aTable)); + aRow.push_back(new ORowSetValueDecorator(aName)); + aRow.push_back(new ORowSetValueDecorator(aTable)); aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue()); aRows.push_back(aRow); } diff --git a/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx b/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx index 173b66f650ca..4872edf9f6c2 100644 --- a/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx +++ b/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx @@ -2,9 +2,9 @@ * * $RCSfile: DDatabaseMetaData.cxx,v $ * - * $Revision: 1.24 $ + * $Revision: 1.25 $ * - * last change: $Author: fs $ $Date: 2001-08-28 08:58:36 $ + * last change: $Author: oj $ $Date: 2001-08-29 12:19:31 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -137,15 +137,15 @@ Reference< XResultSet > SAL_CALL ODbaseDatabaseMetaData::getTypeInfo( ) throw(S aRow.reserve(18); aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue()); - aRow.push_back(new ODatabaseMetaDataResultSet::ORowSetValueDecorator(::rtl::OUString::createFromAscii("CHAR"))); - aRow.push_back(new ODatabaseMetaDataResultSet::ORowSetValueDecorator(DataType::CHAR)); - aRow.push_back(new ODatabaseMetaDataResultSet::ORowSetValueDecorator((sal_Int32)254)); + aRow.push_back(new ORowSetValueDecorator(::rtl::OUString::createFromAscii("CHAR"))); + aRow.push_back(new ORowSetValueDecorator(DataType::CHAR)); + aRow.push_back(new ORowSetValueDecorator((sal_Int32)254)); aRow.push_back(ODatabaseMetaDataResultSet::getQuoteValue()); aRow.push_back(ODatabaseMetaDataResultSet::getQuoteValue()); - aRow.push_back(new ODatabaseMetaDataResultSet::ORowSetValueDecorator(::rtl::OUString::createFromAscii("length"))); - aRow.push_back(new ODatabaseMetaDataResultSet::ORowSetValueDecorator((sal_Int32)ColumnValue::NULLABLE)); + aRow.push_back(new ORowSetValueDecorator(::rtl::OUString::createFromAscii("length"))); + aRow.push_back(new ORowSetValueDecorator((sal_Int32)ColumnValue::NULLABLE)); aRow.push_back(ODatabaseMetaDataResultSet::get1Value()); - aRow.push_back(new ODatabaseMetaDataResultSet::ORowSetValueDecorator((sal_Int32)ColumnSearch::FULL)); + aRow.push_back(new ORowSetValueDecorator((sal_Int32)ColumnSearch::FULL)); aRow.push_back(ODatabaseMetaDataResultSet::get1Value()); aRow.push_back(ODatabaseMetaDataResultSet::get0Value()); aRow.push_back(ODatabaseMetaDataResultSet::get0Value()); @@ -154,42 +154,42 @@ Reference< XResultSet > SAL_CALL ODbaseDatabaseMetaData::getTypeInfo( ) throw(S aRow.push_back(ODatabaseMetaDataResultSet::get0Value()); aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue()); aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue()); - aRow.push_back(new ODatabaseMetaDataResultSet::ORowSetValueDecorator((sal_Int32)10)); + aRow.push_back(new ORowSetValueDecorator((sal_Int32)10)); aRows.push_back(aRow); - aRow[1] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(::rtl::OUString::createFromAscii("VARCHAR")); - aRow[2] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(DataType::VARCHAR); + aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("VARCHAR")); + aRow[2] = new ORowSetValueDecorator(DataType::VARCHAR); aRow[4] = ODatabaseMetaDataResultSet::getQuoteValue(); aRow[5] = ODatabaseMetaDataResultSet::getQuoteValue(); - aRow[6] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(::rtl::OUString::createFromAscii("length")); + aRow[6] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("length")); aRows.push_back(aRow); - aRow[1] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(::rtl::OUString::createFromAscii("LONGVARCHAR")); - aRow[2] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(DataType::LONGVARCHAR); - aRow[3] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator((sal_Int32)65535); + aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("LONGVARCHAR")); + aRow[2] = new ORowSetValueDecorator(DataType::LONGVARCHAR); + aRow[3] = new ORowSetValueDecorator((sal_Int32)65535); aRows.push_back(aRow); - aRow[1] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(::rtl::OUString::createFromAscii("DATE")); - aRow[2] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(DataType::DATE); - aRow[3] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator((sal_Int32)10); + aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("DATE")); + aRow[2] = new ORowSetValueDecorator(DataType::DATE); + aRow[3] = new ORowSetValueDecorator((sal_Int32)10); aRows.push_back(aRow); - aRow[1] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(::rtl::OUString::createFromAscii("BOOL")); - aRow[2] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(DataType::BIT); + aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("BOOL")); + aRow[2] = new ORowSetValueDecorator(DataType::BIT); aRow[3] = ODatabaseMetaDataResultSet::get1Value(); aRow[4] = ODatabaseMetaDataResultSet::getEmptyValue(); aRow[5] = ODatabaseMetaDataResultSet::getEmptyValue(); - aRow[6] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(::rtl::OUString()); + aRow[6] = new ORowSetValueDecorator(::rtl::OUString()); aRow[9] = ODatabaseMetaDataResultSet::getBasicValue(); aRows.push_back(aRow); - aRow[1] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(::rtl::OUString::createFromAscii("DECIMAL")); - aRow[2] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(DataType::DECIMAL); - aRow[3] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator((sal_Int32)20); - aRow[6] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(::rtl::OUString::createFromAscii("length,scale")); - aRow[15] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator((sal_Int32)15); + aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("DECIMAL")); + aRow[2] = new ORowSetValueDecorator(DataType::DECIMAL); + aRow[3] = new ORowSetValueDecorator((sal_Int32)20); + aRow[6] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("length,scale")); + aRow[15] = new ORowSetValueDecorator((sal_Int32)20); aRows.push_back(aRow); } @@ -228,7 +228,7 @@ Reference< XResultSet > SAL_CALL ODbaseDatabaseMetaData::getColumns( ODatabaseMetaDataResultSet::ORows aRows; ODatabaseMetaDataResultSet::ORow aRow(19); - aRow[10] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator((sal_Int32)10); + aRow[10] = new ORowSetValueDecorator((sal_Int32)10); Sequence< ::rtl::OUString> aTabNames(xNames->getElementNames()); const ::rtl::OUString* pTabBegin = aTabNames.getConstArray(); const ::rtl::OUString* pTabEnd = pTabBegin + aTabNames.getLength(); @@ -239,7 +239,7 @@ Reference< XResultSet > SAL_CALL ODbaseDatabaseMetaData::getColumns( Reference< XColumnsSupplier> xTable; ::cppu::extractInterface(xTable,xNames->getByName(*pTabBegin)); OSL_ENSURE(xTable.is(),"Table not found! Normallya exception had to be thrown here!"); - aRow[3] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(*pTabBegin); + aRow[3] = new ORowSetValueDecorator(*pTabBegin); Reference< XNameAccess> xColumns = xTable->getColumns(); if(!xColumns.is()) @@ -254,39 +254,39 @@ Reference< XResultSet > SAL_CALL ODbaseDatabaseMetaData::getColumns( { if(match(columnNamePattern,*pBegin,'\0')) { - aRow[4] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(*pBegin); + aRow[4] = new ORowSetValueDecorator(*pBegin); ::cppu::extractInterface(xColumn,xColumns->getByName(*pBegin)); OSL_ENSURE(xColumn.is(),"Columns contains a column who isn't a fastpropertyset!"); - aRow[5] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)))); - aRow[6] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(getString(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME)))); - aRow[7] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION)))); - aRow[9] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE)))); - aRow[11] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE)))); - aRow[13] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(getString(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DEFAULTVALUE)))); + aRow[5] = new ORowSetValueDecorator(getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)))); + aRow[6] = new ORowSetValueDecorator(getString(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME)))); + aRow[7] = new ORowSetValueDecorator(getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION)))); + aRow[9] = new ORowSetValueDecorator(getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE)))); + aRow[11] = new ORowSetValueDecorator(getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE)))); + aRow[13] = new ORowSetValueDecorator(getString(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DEFAULTVALUE)))); switch((sal_Int32)aRow[5]->getValue()) { case DataType::CHAR: case DataType::VARCHAR: - aRow[16] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator((sal_Int32)254); + aRow[16] = new ORowSetValueDecorator((sal_Int32)254); break; case DataType::LONGVARCHAR: - aRow[16] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator((sal_Int32)65535); + aRow[16] = new ORowSetValueDecorator((sal_Int32)65535); break; default: - aRow[16] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator((sal_Int32)0); + aRow[16] = new ORowSetValueDecorator((sal_Int32)0); } - aRow[17] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(i); + aRow[17] = new ORowSetValueDecorator(i); switch(sal_Int32(aRow[11]->getValue())) { case ColumnValue::NO_NULLS: - aRow[18] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(::rtl::OUString::createFromAscii("NO")); + aRow[18] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("NO")); break; case ColumnValue::NULLABLE: - aRow[18] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(::rtl::OUString::createFromAscii("YES")); + aRow[18] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("YES")); break; default: - aRow[18] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(::rtl::OUString()); + aRow[18] = new ORowSetValueDecorator(::rtl::OUString()); } aRows.push_back(aRow); } @@ -363,13 +363,13 @@ Reference< XResultSet > SAL_CALL ODbaseDatabaseMetaData::getIndexInfo( ODatabaseMetaDataResultSet::ORows aRows; ODatabaseMetaDataResultSet::ORow aRow(14); - aRow[5] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(::rtl::OUString()); - aRow[10] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(::rtl::OUString::createFromAscii("A")); + aRow[5] = new ORowSetValueDecorator(::rtl::OUString()); + aRow[10] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("A")); Reference< XIndexesSupplier> xTable; ::cppu::extractInterface(xTable,xNames->getByName(table)); - aRow[3] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(table); - aRow[7] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator((sal_Int32)3); + aRow[3] = new ORowSetValueDecorator(table); + aRow[7] = new ORowSetValueDecorator((sal_Int32)3); Reference< XNameAccess> xIndexes = xTable->getIndexes(); if(!xIndexes.is()) @@ -387,8 +387,8 @@ Reference< XResultSet > SAL_CALL ODbaseDatabaseMetaData::getIndexInfo( if(unique && !getBOOL(xIndex->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISUNIQUE)))) continue; - aRow[4] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(getBOOL(xIndex->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISUNIQUE)))); - aRow[6] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(*pBegin); + aRow[4] = new ORowSetValueDecorator(getBOOL(xIndex->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISUNIQUE)))); + aRow[6] = new ORowSetValueDecorator(*pBegin); Reference< ::com::sun::star::lang::XUnoTunnel> xTunnel(xIndex,UNO_QUERY); if(xTunnel.is()) @@ -396,8 +396,8 @@ Reference< XResultSet > SAL_CALL ODbaseDatabaseMetaData::getIndexInfo( ODbaseIndex* pIndex = (ODbaseIndex*)xTunnel->getSomething(ODbaseIndex::getUnoTunnelImplementationId()); if(pIndex) { - aRow[11] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator((sal_Int32)pIndex->getHeader().db_maxkeys); - aRow[12] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator((sal_Int32)pIndex->getHeader().db_pagecount); + aRow[11] = new ORowSetValueDecorator((sal_Int32)pIndex->getHeader().db_maxkeys); + aRow[12] = new ORowSetValueDecorator((sal_Int32)pIndex->getHeader().db_pagecount); } } @@ -411,8 +411,8 @@ Reference< XResultSet > SAL_CALL ODbaseDatabaseMetaData::getIndexInfo( for(sal_Int32 j=1;pColBegin != pColEnd;++pColBegin,++j) { // xColumns->getByName(*pColBegin) >>= xColumn; - aRow[8] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(j); - aRow[9] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(*pColBegin); + aRow[8] = new ORowSetValueDecorator(j); + aRow[9] = new ORowSetValueDecorator(*pColBegin); aRows.push_back(aRow); } } diff --git a/connectivity/source/drivers/file/FDatabaseMetaData.cxx b/connectivity/source/drivers/file/FDatabaseMetaData.cxx index 598a9180e87a..959bbe0221ae 100644 --- a/connectivity/source/drivers/file/FDatabaseMetaData.cxx +++ b/connectivity/source/drivers/file/FDatabaseMetaData.cxx @@ -2,9 +2,9 @@ * * $RCSfile: FDatabaseMetaData.cxx,v $ * - * $Revision: 1.20 $ + * $Revision: 1.21 $ * - * last change: $Author: oj $ $Date: 2001-08-24 06:08:38 $ + * last change: $Author: oj $ $Date: 2001-08-29 12:15:31 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -245,7 +245,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables( sal_Unicode nChar = aName.toChar(); if(match(tableNamePattern,aName.getStr(),'\0') && (nChar < '0' || nChar > '9')) { - aRow.push_back(new ODatabaseMetaDataResultSet::ORowSetValueDecorator(aName)); + aRow.push_back(new ORowSetValueDecorator(aName)); bNewRow = sal_True; } } @@ -260,7 +260,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables( sal_Unicode nChar = aURL.getBase().GetChar(0); if(match(tableNamePattern,aURL.getBase().GetBuffer(),'\0') && (nChar < '0' || nChar > '9')) { - aRow.push_back(new ODatabaseMetaDataResultSet::ORowSetValueDecorator(::rtl::OUString(aURL.getBase()))); + aRow.push_back(new ORowSetValueDecorator(::rtl::OUString(aURL.getBase()))); bNewRow = sal_True; } break; @@ -274,7 +274,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables( } if(bNewRow) { - aRow.push_back(new ODatabaseMetaDataResultSet::ORowSetValueDecorator(aTable)); + aRow.push_back(new ORowSetValueDecorator(aTable)); aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue()); aRows.push_back(aRow); @@ -446,9 +446,9 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges( { static ODatabaseMetaDataResultSet::ORow aRow(8); - aRow[2] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(*pBegin); + aRow[2] = new ORowSetValueDecorator(*pBegin); aRow[6] = ODatabaseMetaDataResultSet::getSelectValue(); - aRow[7] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(::rtl::OUString::createFromAscii("NO")); + aRow[7] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("NO")); aRows.push_back(aRow); Reference< XPropertySet> xTable; @@ -701,7 +701,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTableTypes( ) throw(SQLE { ODatabaseMetaDataResultSet::ORow aRow; aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue()); - aRow.push_back(new ODatabaseMetaDataResultSet::ORowSetValueDecorator(::rtl::OUString::createFromAscii("TABLE"))); + aRow.push_back(new ORowSetValueDecorator(::rtl::OUString::createFromAscii("TABLE"))); aRows.push_back(aRow); } pResult->setRows(aRows); diff --git a/connectivity/source/drivers/file/FNoException.cxx b/connectivity/source/drivers/file/FNoException.cxx index 0117eb0c238b..843ce25f54c1 100644 --- a/connectivity/source/drivers/file/FNoException.cxx +++ b/connectivity/source/drivers/file/FNoException.cxx @@ -2,9 +2,9 @@ * * $RCSfile: FNoException.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: oj $ $Date: 2001-08-24 06:08:38 $ + * last change: $Author: oj $ $Date: 2001-08-29 12:15:31 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -79,6 +79,9 @@ #ifndef _TOOLS_DEBUG_HXX #include <tools/debug.hxx> #endif +#ifndef CONNECTIVITY_TKEYVALUE_HXX +#include "TKeyValue.hxx" +#endif using namespace connectivity; using namespace connectivity::file; @@ -157,265 +160,16 @@ void OPreparedStatement::scanParameter(OSQLParseNode* pParseNode,::std::vector< scanParameter(pParseNode->getChild(i),_rParaNodes); } // ----------------------------------------------------------------------------- -//------------------------------------------------------------------ -int -#if defined(WIN) || defined(WNT) -__cdecl -#endif -#if defined(ICC) && defined(OS2) -_Optlink -#endif -connectivity::file::OFILEKeyCompare(const void * elem1, const void * elem2) -{ - const OFILESortIndex * pIndex = OFILESortIndex::pCurrentIndex; - const OFILEKeyValue * pKeyValue1 = (OFILEKeyValue *) * (OFILEKeyValue **) elem1; - const OFILEKeyValue * pKeyValue2 = (OFILEKeyValue *) * (OFILEKeyValue **) elem2; - - // Ueber die (max.) drei ORDER BY-Columns iterieren. Abbruch des Vergleiches, wenn Ungleichheit erkannt - // oder alle Columns gleich. - for (UINT16 i = 0; i < SQL_ORDERBYKEYS && pIndex->eKeyType[i] != SQL_ORDERBYKEY_NONE; i++) - { - const int nGreater = (pIndex->m_aAscending[i]) ? 1 : -1; - const int nLess = - nGreater; - - // Vergleich (je nach Datentyp): - switch (pIndex->eKeyType[i]) - { - case SQL_ORDERBYKEY_STRING: - { - INT32 nRes = pKeyValue1->GetKeyString(i)->compareTo(*pKeyValue2->GetKeyString(i)); - if (nRes < 0) - return nLess; - else if (nRes > 0) - return nGreater; - } - break; - case SQL_ORDERBYKEY_DOUBLE: - { - double d1 = pKeyValue1->GetKeyDouble(i); - double d2 = pKeyValue2->GetKeyDouble(i); - - if (d1 < d2) - return nLess; - else if (d1 > d2) - return nGreater; - } - break; - } - } - - // Wenn wir bis hierher gekommen sind, waren alle Werte gleich: - return 0; -} -// ----------------------------------------------------------------------------- -//------------------------------------------------------------------ -OKeySet* OFILESortIndex::CreateKeySet() -{ - - OSL_ENSURE(! bFrozen,"OFILESortIndex::Freeze: already frozen!"); - - // Kritischer Bereich: Hinterlegung von this in statischer Variable. - // Zugriff auf diese Variable von der OFILECompare-Funktion aus. - // Da dies NUR waehrend der Ausfuehrung der qsort-Funktion stattfindet, - // ist dies aber unkritisch: unter Windows 3.x ist diese Ausfuehrung - // UNUNTERBRECHBAR; unter NT, OS/2, Unix, ... hat jede DLL ihr - // eigenes Datensegment. - pCurrentIndex = this; - eCurrentCharSet = eCharSet; - - // Sortierung: - if (eKeyType[0] != SQL_ORDERBYKEY_NONE) - // Sortierung, wenn mindestens nach dem ersten Key sortiert werden soll: - qsort(ppKeyValueArray,nCount,sizeof(void *),&OFILEKeyCompare); - - - // Ende des kritischen Bereiches - pCurrentIndex = NULL; - - - OKeySet* pKeySet = new OKeySet(nCount); - OKeySet::iterator aIter = pKeySet->begin(); - for (INT32 i = 0; i < nCount; i++,++aIter) - { - OFILEKeyValuePtr pKeyValue = ppKeyValueArray[i]; - - OSL_ENSURE(pKeyValue != NULL,"OFILESortIndex::Freeze: pKeyValue == NULL"); - (*aIter) = pKeyValue->GetValue(); // Wert holen ... - - // Strings in KeyValue freigeben! - for (int j = 0; j < SQL_ORDERBYKEYS; j++) - { - if (eKeyType[j] == SQL_ORDERBYKEY_STRING) - delete pKeyValue->GetKeyString(j); - } - delete pKeyValue; - } - bFrozen = TRUE; - pKeySet->setFrozen(); - return pKeySet; -} -// ----------------------------------------------------------------------------- -OFILESortIndex * OFILESortIndex::pCurrentIndex; -CharSet OFILESortIndex::eCurrentCharSet; -//------------------------------------------------------------------ -OFILESortIndex::OFILESortIndex(const OKeyType eKeyType2[], // Genau 3 Eintraege! - const ::std::vector<sal_Int16>& _aAscending, // Genau 3 Eintraege! - INT32 nMaxNumberOfRows, rtl_TextEncoding eSet) // Obere Schranke fuer die Anzahl indizierbarer Zeilen - : nMaxCount(nMaxNumberOfRows), - nCount(0), - bFrozen(FALSE), - eCharSet(eSet), - m_aAscending(_aAscending) -{ - for (int j = 0; j < SQL_ORDERBYKEYS; j++) - { - eKeyType[j] = eKeyType2[j]; - } - -#if defined MAX_KEYSET_SIZE - // Zur Sicherheit Maximalgroesse nochmal pruefen: - if (nMaxCount > MAX_KEYSET_SIZE) - { - DBG_WARNING("OFILESortIndex::OFILESortIndex: nMaxNumberOfRows zur Zeit auf <16K beschraenkt!"); - nMaxCount = MAX_KEYSET_SIZE; - } -#endif - if (nMaxCount <= 0) - nMaxCount = USHORT(-1); - - ppKeyValueArray = new OFILEKeyValuePtr[nMaxCount]; - - for (INT32 i = 0; i < nMaxCount; i++) - ppKeyValueArray[i] = NULL; -} - -//------------------------------------------------------------------ -OFILESortIndex::~OFILESortIndex() -{ - __DELETE(nMaxCount) ppKeyValueArray; -} - - -//------------------------------------------------------------------ -BOOL OFILESortIndex::AddKeyValue(OFILEKeyValue * pKeyValue) -{ - if (nCount < nMaxCount) - { - if (bFrozen) // wenn der Index schon eingefroren - // dann wird der Key einfach ans Ende gehaengt - { - OSL_ENSURE(pKeyValue != NULL,"OFILESortIndex::Freeze: pKeyValue == NULL"); - INT32 nValue = pKeyValue->GetValue(); // Wert holen ... - - // Strings in KeyValue freigeben! - for (int j = 0; j < SQL_ORDERBYKEYS; j++) - { - if (eKeyType[j] == SQL_ORDERBYKEY_STRING) - delete pKeyValue->GetKeyString(j); - } - delete pKeyValue; - ppKeyValueArray[nCount++] = (OFILEKeyValuePtr) nValue; - } - else - ppKeyValueArray[nCount++] = pKeyValue; - return TRUE; - } - else - return FALSE; -} - - -//------------------------------------------------------------------ -void OFILESortIndex::Freeze() -{ - OSL_ENSURE(! bFrozen,"OFILESortIndex::Freeze: already frozen!"); - - // Kritischer Bereich: Hinterlegung von this in statischer Variable. - // Zugriff auf diese Variable von der OFILECompare-Funktion aus. - // Da dies NUR waehrend der Ausfuehrung der qsort-Funktion stattfindet, - // ist dies aber unkritisch: unter Windows 3.x ist diese Ausfuehrung - // UNUNTERBRECHBAR; unter NT, OS/2, Unix, ... hat jede DLL ihr - // eigenes Datensegment. - pCurrentIndex = this; - eCurrentCharSet = eCharSet; - - // Sortierung: - if (eKeyType[0] != SQL_ORDERBYKEY_NONE) - // Sortierung, wenn mindestens nach dem ersten Key sortiert werden soll: - qsort(ppKeyValueArray,nCount,sizeof(void *),&OFILEKeyCompare); - - - // Ende des kritischen Bereiches - pCurrentIndex = NULL; - - // Wert auslesen, KeyValue loeschen und in den void * den Value - // reinschreiben (uebler Trick mit Typecast!) - for (INT32 i = 0; i < nCount; i++) - { - OFILEKeyValuePtr pKeyValue = ppKeyValueArray[i]; - - OSL_ENSURE(pKeyValue != NULL,"OFILESortIndex::Freeze: pKeyValue == NULL"); - INT32 nValue = pKeyValue->GetValue(); // Wert holen ... - - // Strings in KeyValue freigeben! - for (int j = 0; j < SQL_ORDERBYKEYS; j++) - { - if (eKeyType[j] == SQL_ORDERBYKEY_STRING) - delete pKeyValue->GetKeyString(j); - } - delete pKeyValue; - ppKeyValueArray[i] = (OFILEKeyValuePtr) nValue; - } - - bFrozen = TRUE; -} - -//------------------------------------------------------------------ -INT32 OFILESortIndex::GetValue(INT32 nPos) const -{ - OSL_ENSURE(nPos > 0,"OFILESortIndex::GetValue: nPos == 0"); - OSL_ENSURE(nPos <= nCount,"OFILESortIndex::GetValue: Zugriff ausserhalb der Array-Grenzen"); - -// OSL_ENSURE(ppKeyValueArray[nPos-1] != NULL,"OFILESortIndex::GetValue: interner Fehler: kein KeyValue an dieser Stelle"); -// return ppKeyValueArray[nPos-1]->GetValue(); - - if (!bFrozen) - { - if (eKeyType[0] == SQL_ORDERBYKEY_NONE) // wenn keine Sortierung vorliegt - // darf auf die Values schon vorher zugegriffen werden - return ppKeyValueArray[nPos-1]->GetValue(); - else - { - OSL_ASSERT("OFILESortIndex::GetValue: Invalid use of index!"); - return 0; - } - } - else - return (INT32) ppKeyValueArray[nPos-1]; // Trick: nach Freeze sind hier nur noch Values, keine KeyValue-Strukturen mehr! - -} -// ----------------------------------------------------------------------------- -OFILEKeyValue* OResultSet::GetOrderbyKeyValue(OValueRow _rRow) +OKeyValue* OResultSet::GetOrderbyKeyValue(OValueRow _rRow) { UINT32 nBookmarkValue = Abs((sal_Int32)(*_rRow)[0]); - OFILEKeyValue* pKeyValue = new OFILEKeyValue((UINT32)nBookmarkValue); - for (int i = 0; i < m_aOrderbyColumnNumber.size(); ++i) - { - if (m_aOrderbyColumnNumber[i] == SQL_COLUMN_NOTFOUND) break; + OKeyValue* pKeyValue = new OKeyValue((UINT32)nBookmarkValue); + + ::std::vector<sal_Int32>::iterator aIter = m_aOrderbyColumnNumber.begin(); + for (;aIter != m_aOrderbyColumnNumber.end(); ++aIter) + pKeyValue->pushKey(new ORowSetValueDecorator((*_rRow)[*aIter])); - ORowSetValue xKey = (*_rRow)[m_aOrderbyColumnNumber[i]]; - switch (xKey.getTypeKind()) - { - case ::com::sun::star::sdbc::DataType::VARCHAR: - case ::com::sun::star::sdbc::DataType::CHAR: - pKeyValue->SetKey(i,(rtl::OUString)xKey); - break; - default: - pKeyValue->SetKey(i,(double)xKey); - break; - } - } return pKeyValue; } // ----------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/file/FResultSet.cxx b/connectivity/source/drivers/file/FResultSet.cxx index 2f97ec17c29d..f403d8b55267 100644 --- a/connectivity/source/drivers/file/FResultSet.cxx +++ b/connectivity/source/drivers/file/FResultSet.cxx @@ -2,9 +2,9 @@ * * $RCSfile: FResultSet.cxx,v $ * - * $Revision: 1.72 $ + * $Revision: 1.73 $ * - * last change: $Author: oj $ $Date: 2001-08-27 09:13:35 $ + * last change: $Author: oj $ $Date: 2001-08-29 12:15:31 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -238,7 +238,7 @@ void OResultSet::disposing(void) // ----------------------------------------------------------------------------- void OResultSet::clear() { - DELETEZ(m_pFileSet); + m_pFileSet = NULL; DELETEZ(m_pSortIndex); if(m_aInsertRow.isValid()) @@ -662,7 +662,7 @@ void SAL_CALL OResultSet::insertRow( ) throw(SQLException, RuntimeException) // so we have to know where the end is SkipDeleted(OFileTable::FILE_LAST,1,sal_False); m_bRowInserted = m_pTable->InsertRow(m_aInsertRow.getBody(), TRUE,Reference<XIndexAccess>(m_xColNames,UNO_QUERY)); - if(m_bRowInserted && m_pFileSet) + if(m_bRowInserted && m_pFileSet.isValid()) { sal_Int32 nPos = (*m_aInsertRow)[0]; m_pFileSet->push_back(nPos); @@ -701,7 +701,7 @@ void SAL_CALL OResultSet::deleteRow() throw(SQLException, RuntimeException) sal_Int32 nPos = (sal_Int32)(*m_aRow)[0]; m_bRowDeleted = m_pTable->DeleteRow(m_xColumns.getBody()); - if(m_bRowDeleted && m_pFileSet) + if(m_bRowDeleted && m_pFileSet.isValid()) { m_aRow->setDeleted(sal_True); // don't touch the m_pFileSet member here @@ -957,7 +957,7 @@ again: return sal_False; } } - else if (m_pFileSet) + else if (m_pFileSet.isValid()) { OSL_ENSURE(//!m_pFileSet->IsFrozen() && eCursorPosition == OFileTable::FILE_NEXT, "Falsche CursorPosition!"); @@ -993,17 +993,17 @@ again: // Evaluate darf nur gesetzt sein, // wenn der Keyset weiter aufgebaut werden soll if (m_aSQLIterator.getStatementType() == SQL_STATEMENT_SELECT && !isCount() && - (m_pFileSet || m_pSortIndex) && bEvaluate) + (m_pFileSet.isValid() || m_pSortIndex) && bEvaluate) { if (m_pSortIndex) { - OFILEKeyValue* pKeyValue = GetOrderbyKeyValue(m_aEvaluateRow); + OKeyValue* pKeyValue = GetOrderbyKeyValue(m_aEvaluateRow); if (!m_pSortIndex->AddKeyValue(pKeyValue)) { // Ueberwachung auf Ueberschreitung der Index-Kapazitaet: } } - else if (m_pFileSet) + else if (m_pFileSet.isValid()) { // OSL_ENSURE(!m_pFileSet->IsFrozen() , "Falsche CursorPosition!"); sal_uInt32 nBookmarkValue = Abs((sal_Int32)(*m_aEvaluateRow)[0]); @@ -1055,7 +1055,7 @@ BOOL OResultSet::Move(OFileTable::FilePosition eCursorPosition, INT32 nOffset, B if (m_aSQLIterator.getStatementType() == SQL_STATEMENT_SELECT && !isCount()) { - if (m_pFileSet == NULL) // kein Index verfuegbar + if (!m_pFileSet.isValid()) // kein Index verfuegbar { // Normales FETCH ExecuteRow(eCursorPosition,nOffset,TRUE,FALSE,bRetrieveData); @@ -1232,7 +1232,7 @@ Error: case OFileTable::FILE_ABSOLUTE: case OFileTable::FILE_RELATIVE: if (nOffset > 0) - m_nRowPos = (m_pFileSet) ? m_pFileSet->size() : -1; + m_nRowPos = (m_pFileSet.isValid()) ? m_pFileSet->size() : -1; else if (nOffset < 0) m_nRowPos = -1; break; @@ -1481,7 +1481,7 @@ BOOL OResultSet::OpenImpl() // } // Neuen Index aufbauen: - DELETEZ(m_pFileSet); + m_pFileSet = NULL; // DELETEZ(m_pEvaluationKeySet); // Row zur Auswertung binden, wenn Preprocessing erfolg, dann bereits ein Keyset @@ -1552,64 +1552,56 @@ BOOL OResultSet::OpenImpl() { if(!IsSorted()) { - m_aOrderbyColumnNumber[0] = m_aColMapping[1]; - m_aOrderbyAscending[0] = 0; + m_aOrderbyColumnNumber.push_back(m_aColMapping[1]); + m_aOrderbyAscending.push_back(SQL_DESC); } else bWasSorted = TRUE; bDistinct = TRUE; } - // Ohne Restriction und Sortierung RowCount bekannt. - // if (!HasRestriction() && !IsSorted() && bShowDeleted) - // SetRowCount(MaxRowCount()); - OSL_ENSURE(m_aOrderbyColumnNumber.size() == SQL_ORDERBYKEYS,"Maximale Anzahl der ORDER BY Columns muss derzeit genau 3 sein!"); - OKeyType eKeyType[SQL_ORDERBYKEYS]; + OSortIndex::TKeyTypeVector eKeyType(m_aOrderbyColumnNumber.size()); OValueVector::iterator aRowIter = m_aRow->begin()+1; - for (int i = 0; i < SQL_ORDERBYKEYS; i++) + ::std::vector<sal_Int32>::iterator aOrderByIter = m_aOrderbyColumnNumber.begin(); + for (::std::vector<sal_Int16>::size_type i=0;aOrderByIter != m_aOrderbyColumnNumber.end(); ++aOrderByIter,++i) { - if (m_aOrderbyColumnNumber[i] == SQL_COLUMN_NOTFOUND) - eKeyType[i] = SQL_ORDERBYKEY_NONE; - else + OSL_ENSURE((sal_Int32)m_aRow->size() > *aOrderByIter,"Invalid Index"); + switch ((m_aRow->begin()+*aOrderByIter)->getTypeKind()) { - OSL_ENSURE((sal_Int32)m_aRow->size() > m_aOrderbyColumnNumber[i],"Invalid Index"); - switch ((m_aRow->begin()+m_aOrderbyColumnNumber[i])->getTypeKind()) - { - case DataType::CHAR: - case DataType::VARCHAR: - eKeyType[i] = SQL_ORDERBYKEY_STRING; - break; - - case DataType::OTHER: - case DataType::TINYINT: - case DataType::SMALLINT: - case DataType::INTEGER: - case DataType::DECIMAL: - case DataType::NUMERIC: - case DataType::REAL: - case DataType::DOUBLE: - case DataType::DATE: - case DataType::TIME: - case DataType::TIMESTAMP: - case DataType::BIT: - eKeyType[i] = SQL_ORDERBYKEY_DOUBLE; - break; - - // Andere Typen sind nicht implementiert (und damit immer FALSE) - default: - eKeyType[i] = SQL_ORDERBYKEY_NONE; - OSL_ASSERT("OFILECursor::Execute: Datentyp nicht implementiert"); - break; - } - (*m_aEvaluateRow)[m_aOrderbyColumnNumber[i]].setBound(sal_True); + case DataType::CHAR: + case DataType::VARCHAR: + eKeyType[i] = SQL_ORDERBYKEY_STRING; + break; + + case DataType::OTHER: + case DataType::TINYINT: + case DataType::SMALLINT: + case DataType::INTEGER: + case DataType::DECIMAL: + case DataType::NUMERIC: + case DataType::REAL: + case DataType::DOUBLE: + case DataType::DATE: + case DataType::TIME: + case DataType::TIMESTAMP: + case DataType::BIT: + eKeyType[i] = SQL_ORDERBYKEY_DOUBLE; + break; + + // Andere Typen sind nicht implementiert (und damit immer FALSE) + default: + eKeyType[i] = SQL_ORDERBYKEY_NONE; + OSL_ASSERT("OFILECursor::Execute: Datentyp nicht implementiert"); + break; } + (*m_aEvaluateRow)[*aOrderByIter].setBound(sal_True); } // Nur wenn Sortierung gewuenscht, ueber alle Datensaetze iterieren und // dabei den "Key", nach dem sortiert werden soll, in den Index eintragen: if (IsSorted()) { - if (!m_pSQLAnalyzer->hasRestriction() && m_aOrderbyColumnNumber[1] == SQL_COLUMN_NOTFOUND) + if (!m_pSQLAnalyzer->hasRestriction() && m_aOrderbyColumnNumber.size() == 1) { // Ist nur ein Feld fuer die Sortierung angegeben // Und diese Feld ist indiziert, dann den Index ausnutzen @@ -1642,9 +1634,7 @@ BOOL OResultSet::OpenImpl() } } - m_pSortIndex = new OFILESortIndex(eKeyType, - m_aOrderbyAscending, - nMaxRowCount,m_nTextEncoding); + m_pSortIndex = new OSortIndex(eKeyType,m_aOrderbyAscending); sal_Bool bOK = sal_True; if (m_pEvaluationKeySet) @@ -1668,8 +1658,7 @@ BOOL OResultSet::OpenImpl() // Sortiertes Keyset erzeugen // DELETEZ(m_pEvaluationKeySet); m_pEvaluationKeySet = NULL; - if(m_pFileSet) - delete m_pFileSet; + m_pFileSet = NULL; m_pFileSet = m_pSortIndex->CreateKeySet(); // if(!bDistinct) // SetRowCount(pFileSet->count()); @@ -1677,7 +1666,7 @@ BOOL OResultSet::OpenImpl() // Nun kann ueber den Index sortiert zugegriffen werden. } - if (!m_pFileSet) + if (!m_pFileSet.isValid()) { m_pFileSet = new OKeySet(); @@ -1692,8 +1681,8 @@ BOOL OResultSet::OpenImpl() m_pFileSet->push_back(i + 1); } } - OSL_ENSURE(m_pFileSet,"Kein KeySet vorhanden! :-("); - DISTINCT: if(bDistinct && m_pFileSet) // sicher ist sicher + OSL_ENSURE(m_pFileSet.isValid(),"Kein KeySet vorhanden! :-("); + DISTINCT: if(bDistinct && m_pFileSet.isValid()) // sicher ist sicher { OValueRow aSearchRow = new OValueVector(m_aRow->size()); OValueVector::iterator aRowIter = m_aRow->begin(); @@ -1762,7 +1751,8 @@ BOOL OResultSet::OpenImpl() if (!bWasSorted) { - m_aOrderbyColumnNumber[0] = SQL_COLUMN_NOTFOUND; + m_aOrderbyColumnNumber.clear(); + m_aOrderbyAscending.clear(); sort(m_pFileSet->begin(),m_pFileSet->end()); } } diff --git a/connectivity/source/drivers/file/FStatement.cxx b/connectivity/source/drivers/file/FStatement.cxx index 4b9e536c53b9..1c9bd36db25b 100644 --- a/connectivity/source/drivers/file/FStatement.cxx +++ b/connectivity/source/drivers/file/FStatement.cxx @@ -2,9 +2,9 @@ * * $RCSfile: FStatement.cxx,v $ * - * $Revision: 1.20 $ + * $Revision: 1.21 $ * - * last change: $Author: oj $ $Date: 2001-08-24 06:08:38 $ + * last change: $Author: oj $ $Date: 2001-08-29 12:15:31 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -134,8 +134,6 @@ OStatement_Base::OStatement_Base(OConnection* _pConnection ) : OStatement_BASE( ,m_nFetchDirection(FetchDirection::FORWARD) ,m_nResultSetConcurrency(ResultSetConcurrency::UPDATABLE) ,m_pSQLAnalyzer(NULL) - ,m_aOrderbyColumnNumber(SQL_ORDERBYKEYS,SQL_COLUMN_NOTFOUND) - ,m_aOrderbyAscending(SQL_ORDERBYKEYS,1) ,m_xDBMetaData(_pConnection->getMetaData()) ,m_pTable(NULL) { @@ -144,13 +142,13 @@ OStatement_Base::OStatement_Base(OConnection* _pConnection ) : OStatement_BASE( sal_Int32 nAttrib = 0; registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_CURSORNAME), PROPERTY_ID_CURSORNAME, nAttrib,&m_aCursorName, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); - registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_MAXFIELDSIZE), PROPERTY_ID_MAXFIELDSIZE, nAttrib,&m_nMaxFieldSize, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_MAXFIELDSIZE), PROPERTY_ID_MAXFIELDSIZE, nAttrib,&m_nMaxFieldSize, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_MAXROWS), PROPERTY_ID_MAXROWS, nAttrib,&m_nMaxRows, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); - registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_QUERYTIMEOUT), PROPERTY_ID_QUERYTIMEOUT, nAttrib,&m_nQueryTimeOut, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_QUERYTIMEOUT), PROPERTY_ID_QUERYTIMEOUT, nAttrib,&m_nQueryTimeOut, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHSIZE), PROPERTY_ID_FETCHSIZE, nAttrib,&m_nFetchSize, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETTYPE), PROPERTY_ID_RESULTSETTYPE, nAttrib,&m_nResultSetType, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHDIRECTION), PROPERTY_ID_FETCHDIRECTION, nAttrib,&m_nFetchDirection, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); - registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ESCAPEPROCESSING), PROPERTY_ID_ESCAPEPROCESSING, nAttrib,&m_bEscapeProcessing,::getCppuBooleanType()); + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ESCAPEPROCESSING),PROPERTY_ID_ESCAPEPROCESSING, nAttrib,&m_bEscapeProcessing,::getCppuBooleanType()); registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETCONCURRENCY), PROPERTY_ID_RESULTSETCONCURRENCY, nAttrib,&m_nResultSetConcurrency, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); } @@ -423,20 +421,14 @@ void OStatement_Base::anylizeSQL() throw SQLException(); } OSQLParseNode * pAscendingDescending = pOrderingSpec->getChild(1); - setOrderbyColumn((UINT16)m,pColumnRef,pAscendingDescending); + setOrderbyColumn(pColumnRef,pAscendingDescending); } } } //------------------------------------------------------------------ -void OStatement_Base::setOrderbyColumn(UINT16 nOrderbyColumnNo, - OSQLParseNode* pColumnRef, - OSQLParseNode* pAscendingDescending) +void OStatement_Base::setOrderbyColumn( OSQLParseNode* pColumnRef, + OSQLParseNode* pAscendingDescending) { - if (nOrderbyColumnNo >= m_aOrderbyColumnNumber.size()) - { - throw SQLException(); - } - ::rtl::OUString aColumnName; if (pColumnRef->count() == 1) aColumnName = pColumnRef->getChild(0)->getTokenValue(); @@ -464,11 +456,10 @@ void OStatement_Base::setOrderbyColumn(UINT16 nOrderbyColumnNo, return; // Alles geprueft und wir haben den Namen der Column. // Die wievielte Column ist das? - m_aOrderbyColumnNumber[nOrderbyColumnNo] = xColLocate->findColumn(aColumnName); + m_aOrderbyColumnNumber.push_back(xColLocate->findColumn(aColumnName)); // Ascending or Descending? - m_aOrderbyAscending[nOrderbyColumnNo] = (SQL_ISTOKEN(pAscendingDescending,DESC)) ? - FALSE : TRUE; + m_aOrderbyAscending.push_back((SQL_ISTOKEN(pAscendingDescending,DESC)) ? SQL_DESC : SQL_ASC); } // ----------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/flat/EDatabaseMetaData.cxx b/connectivity/source/drivers/flat/EDatabaseMetaData.cxx index b46d3b8c6cba..f1ae23fe088b 100644 --- a/connectivity/source/drivers/flat/EDatabaseMetaData.cxx +++ b/connectivity/source/drivers/flat/EDatabaseMetaData.cxx @@ -2,9 +2,9 @@ * * $RCSfile: EDatabaseMetaData.cxx,v $ * - * $Revision: 1.13 $ + * $Revision: 1.14 $ * - * last change: $Author: oj $ $Date: 2001-08-24 06:01:55 $ + * last change: $Author: oj $ $Date: 2001-08-29 12:21:07 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -134,15 +134,15 @@ Reference< XResultSet > SAL_CALL OFlatDatabaseMetaData::getTypeInfo( ) throw(SQ ODatabaseMetaDataResultSet::ORow aRow; aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue()); - aRow.push_back(new ODatabaseMetaDataResultSet::ORowSetValueDecorator(::rtl::OUString::createFromAscii("CHAR"))); - aRow.push_back(new ODatabaseMetaDataResultSet::ORowSetValueDecorator(DataType::CHAR)); - aRow.push_back(new ODatabaseMetaDataResultSet::ORowSetValueDecorator((sal_Int32)254)); + aRow.push_back(new ORowSetValueDecorator(::rtl::OUString::createFromAscii("CHAR"))); + aRow.push_back(new ORowSetValueDecorator(DataType::CHAR)); + aRow.push_back(new ORowSetValueDecorator((sal_Int32)254)); aRow.push_back(ODatabaseMetaDataResultSet::getQuoteValue()); aRow.push_back(ODatabaseMetaDataResultSet::getQuoteValue()); aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue()); - aRow.push_back(new ODatabaseMetaDataResultSet::ORowSetValueDecorator((sal_Int32)ColumnValue::NULLABLE)); + aRow.push_back(new ORowSetValueDecorator((sal_Int32)ColumnValue::NULLABLE)); aRow.push_back(ODatabaseMetaDataResultSet::get1Value()); - aRow.push_back(new ODatabaseMetaDataResultSet::ORowSetValueDecorator((sal_Int32)ColumnSearch::CHAR)); + aRow.push_back(new ORowSetValueDecorator((sal_Int32)ColumnSearch::CHAR)); aRow.push_back(ODatabaseMetaDataResultSet::get1Value()); aRow.push_back(ODatabaseMetaDataResultSet::get0Value()); aRow.push_back(ODatabaseMetaDataResultSet::get0Value()); @@ -151,67 +151,67 @@ Reference< XResultSet > SAL_CALL OFlatDatabaseMetaData::getTypeInfo( ) throw(SQ aRow.push_back(ODatabaseMetaDataResultSet::get0Value()); aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue()); aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue()); - aRow.push_back(new ODatabaseMetaDataResultSet::ORowSetValueDecorator((sal_Int32)10)); + aRow.push_back(new ORowSetValueDecorator((sal_Int32)10)); aRows.push_back(aRow); - aRow[1] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(::rtl::OUString::createFromAscii("VARCHAR")); - aRow[2] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(DataType::VARCHAR); + aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("VARCHAR")); + aRow[2] = new ORowSetValueDecorator(DataType::VARCHAR); aRow[4] = ODatabaseMetaDataResultSet::getQuoteValue(); aRow[5] = ODatabaseMetaDataResultSet::getQuoteValue(); aRows.push_back(aRow); - aRow[1] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(::rtl::OUString::createFromAscii("LONGVARCHAR")); - aRow[2] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(DataType::LONGVARCHAR); - aRow[3] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator((sal_Int32)65535); + aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("LONGVARCHAR")); + aRow[2] = new ORowSetValueDecorator(DataType::LONGVARCHAR); + aRow[3] = new ORowSetValueDecorator((sal_Int32)65535); aRow[4] = ODatabaseMetaDataResultSet::getQuoteValue(); aRow[5] = ODatabaseMetaDataResultSet::getQuoteValue(); aRows.push_back(aRow); - aRow[1] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(::rtl::OUString::createFromAscii("DATE")); - aRow[2] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(DataType::DATE); - aRow[3] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator((sal_Int32)10); + aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("DATE")); + aRow[2] = new ORowSetValueDecorator(DataType::DATE); + aRow[3] = new ORowSetValueDecorator((sal_Int32)10); aRow[4] = ODatabaseMetaDataResultSet::getQuoteValue(); aRow[5] = ODatabaseMetaDataResultSet::getQuoteValue(); aRows.push_back(aRow); - aRow[1] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(::rtl::OUString::createFromAscii("TIME")); - aRow[2] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(DataType::TIME); - aRow[3] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator((sal_Int32)8); + aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("TIME")); + aRow[2] = new ORowSetValueDecorator(DataType::TIME); + aRow[3] = new ORowSetValueDecorator((sal_Int32)8); aRow[4] = ODatabaseMetaDataResultSet::getQuoteValue(); aRow[5] = ODatabaseMetaDataResultSet::getQuoteValue(); aRows.push_back(aRow); - aRow[1] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(::rtl::OUString::createFromAscii("TIMESTAMP")); - aRow[2] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(DataType::TIMESTAMP); - aRow[3] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator((sal_Int32)19); + aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("TIMESTAMP")); + aRow[2] = new ORowSetValueDecorator(DataType::TIMESTAMP); + aRow[3] = new ORowSetValueDecorator((sal_Int32)19); aRow[4] = ODatabaseMetaDataResultSet::getQuoteValue(); aRow[5] = ODatabaseMetaDataResultSet::getQuoteValue(); aRows.push_back(aRow); - aRow[1] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(::rtl::OUString::createFromAscii("BOOL")); - aRow[2] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(DataType::BIT); + aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("BOOL")); + aRow[2] = new ORowSetValueDecorator(DataType::BIT); aRow[3] = ODatabaseMetaDataResultSet::get1Value(); aRow[9] = ODatabaseMetaDataResultSet::getBasicValue(); aRows.push_back(aRow); - aRow[1] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(::rtl::OUString::createFromAscii("DECIMAL")); - aRow[2] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(DataType::DECIMAL); - aRow[3] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator((sal_Int32)20); - aRow[15] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator((sal_Int32)15); + aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("DECIMAL")); + aRow[2] = new ORowSetValueDecorator(DataType::DECIMAL); + aRow[3] = new ORowSetValueDecorator((sal_Int32)20); + aRow[15] = new ORowSetValueDecorator((sal_Int32)15); aRows.push_back(aRow); - aRow[1] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(::rtl::OUString::createFromAscii("DOUBLE")); - aRow[2] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(DataType::DOUBLE); - aRow[3] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator((sal_Int32)20); + aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("DOUBLE")); + aRow[2] = new ORowSetValueDecorator(DataType::DOUBLE); + aRow[3] = new ORowSetValueDecorator((sal_Int32)20); aRow[15] = ODatabaseMetaDataResultSet::get0Value(); aRows.push_back(aRow); - aRow[1] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(::rtl::OUString::createFromAscii("NUMERIC")); - aRow[2] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(DataType::NUMERIC); - aRow[3] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator((sal_Int32)20); - aRow[15] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator((sal_Int32)20); + aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("NUMERIC")); + aRow[2] = new ORowSetValueDecorator(DataType::NUMERIC); + aRow[3] = new ORowSetValueDecorator((sal_Int32)20); + aRow[15] = new ORowSetValueDecorator((sal_Int32)20); aRows.push_back(aRow); } @@ -249,7 +249,7 @@ Reference< XResultSet > SAL_CALL OFlatDatabaseMetaData::getColumns( ODatabaseMetaDataResultSet::ORows aRows; ODatabaseMetaDataResultSet::ORow aRow(19); - aRow[10] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator((sal_Int32)10); + aRow[10] = new ORowSetValueDecorator((sal_Int32)10); Sequence< ::rtl::OUString> aTabNames(xNames->getElementNames()); const ::rtl::OUString* pTabBegin = aTabNames.getConstArray(); const ::rtl::OUString* pTabEnd = pTabBegin + aTabNames.getLength(); @@ -259,7 +259,7 @@ Reference< XResultSet > SAL_CALL OFlatDatabaseMetaData::getColumns( { Reference< XColumnsSupplier> xTable; ::cppu::extractInterface(xTable,xNames->getByName(*pTabBegin)); - aRow[3] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(*pTabBegin); + aRow[3] = new ORowSetValueDecorator(*pTabBegin); Reference< XNameAccess> xColumns = xTable->getColumns(); if(!xColumns.is()) @@ -274,40 +274,40 @@ Reference< XResultSet > SAL_CALL OFlatDatabaseMetaData::getColumns( { if(match(columnNamePattern,*pBegin,'\0')) { - aRow[4] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(*pBegin); + aRow[4] = new ORowSetValueDecorator(*pBegin); ::cppu::extractInterface(xColumn,xColumns->getByName(*pBegin)); OSL_ENSURE(xColumn.is(),"Columns contains a column who isn't a fastpropertyset!"); - aRow[5] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)))); - aRow[6] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(getString(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME)))); - aRow[7] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION)))); - aRow[9] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE)))); - aRow[11] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE)))); - aRow[13] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(getString(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DEFAULTVALUE)))); + aRow[5] = new ORowSetValueDecorator(getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)))); + aRow[6] = new ORowSetValueDecorator(getString(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME)))); + aRow[7] = new ORowSetValueDecorator(getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION)))); + aRow[9] = new ORowSetValueDecorator(getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE)))); + aRow[11] = new ORowSetValueDecorator(getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE)))); + aRow[13] = new ORowSetValueDecorator(getString(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DEFAULTVALUE)))); switch((sal_Int32)aRow[5]->getValue()) { case DataType::CHAR: case DataType::VARCHAR: - aRow[16] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator((sal_Int32)254); + aRow[16] = new ORowSetValueDecorator((sal_Int32)254); break; case DataType::LONGVARCHAR: - aRow[16] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator((sal_Int32)65535); + aRow[16] = new ORowSetValueDecorator((sal_Int32)65535); break; default: - aRow[16] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator((sal_Int32)0); + aRow[16] = new ORowSetValueDecorator((sal_Int32)0); } - aRow[17] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(i); + aRow[17] = new ORowSetValueDecorator(i); switch(sal_Int32(aRow[11]->getValue())) { case ColumnValue::NO_NULLS: - aRow[18] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(::rtl::OUString::createFromAscii("NO")); + aRow[18] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("NO")); break; case ColumnValue::NULLABLE: - aRow[18] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(::rtl::OUString::createFromAscii("YES")); + aRow[18] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("YES")); break; default: - aRow[18] = new ODatabaseMetaDataResultSet::ORowSetValueDecorator(::rtl::OUString()); + aRow[18] = new ORowSetValueDecorator(::rtl::OUString()); } aRows.push_back(aRow); } diff --git a/connectivity/source/drivers/jdbc/JDriver.cxx b/connectivity/source/drivers/jdbc/JDriver.cxx index 6f161c29c63c..2d0b1512888d 100644 --- a/connectivity/source/drivers/jdbc/JDriver.cxx +++ b/connectivity/source/drivers/jdbc/JDriver.cxx @@ -2,9 +2,9 @@ * * $RCSfile: JDriver.cxx,v $ * - * $Revision: 1.18 $ + * $Revision: 1.19 $ * - * last change: $Author: oj $ $Date: 2001-08-14 07:21:03 $ + * last change: $Author: oj $ $Date: 2001-08-29 12:21:08 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -175,6 +175,8 @@ Reference< XConnection > SAL_CALL java_sql_Driver::connect( const ::rtl::OUStrin Sequence< PropertyValue >& info ) throw(SQLException, RuntimeException) { SDBThreadAttach t(getORB()); OSL_ENSURE(t.pEnv,"Java Enviroment gelscht worden!"); + if(!t.pEnv) + throw SQLException(::rtl::OUString::createFromAscii("No Java installed!"),*this,::rtl::OUString::createFromAscii("S1000"),1000 ,Any()); Reference< XConnection > xRet; // first try if the jdbc driver is alraedy registered at the driver manager try diff --git a/connectivity/source/inc/FDatabaseMetaDataResultSet.hxx b/connectivity/source/inc/FDatabaseMetaDataResultSet.hxx index c46e340b2187..ae3af2311321 100644 --- a/connectivity/source/inc/FDatabaseMetaDataResultSet.hxx +++ b/connectivity/source/inc/FDatabaseMetaDataResultSet.hxx @@ -2,9 +2,9 @@ * * $RCSfile: FDatabaseMetaDataResultSet.hxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: oj $ $Date: 2001-08-24 06:00:36 $ + * last change: $Author: oj $ $Date: 2001-08-29 12:14:42 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -133,24 +133,6 @@ namespace connectivity { public: - /// ORowSetValueDecorator decorates a ORowSetValue so the value is "refcounted" - class ORowSetValueDecorator : public ::vos::OReference - { - ORowSetValue m_aValue; // my own value - public: - ORowSetValueDecorator(){m_aValue.setBound(sal_True);} - ORowSetValueDecorator(const ORowSetValue& _aValue) : m_aValue(_aValue){m_aValue.setBound(sal_True);} - ORowSetValueDecorator& operator=(const ORowSetValue& _aValue); - - operator const ORowSetValue&() const { return m_aValue; } - const ORowSetValue& getValue() const { return m_aValue; } - void setValue(const ORowSetValue& _aValue) { m_aValue = _aValue; } - void setNull() { m_aValue.setNull(); } - - }; - - typedef ::vos::ORef<ORowSetValueDecorator> ORowSetValueDecoratorRef; - DECLARE_STL_VECTOR(ORowSetValueDecoratorRef,ORow); DECLARE_STL_VECTOR(ORow, ORows); diff --git a/connectivity/source/inc/adabas/BConnection.hxx b/connectivity/source/inc/adabas/BConnection.hxx index 37a93e594bc8..d9cdaff56f73 100644 --- a/connectivity/source/inc/adabas/BConnection.hxx +++ b/connectivity/source/inc/adabas/BConnection.hxx @@ -2,9 +2,9 @@ * * $RCSfile: BConnection.hxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: oj $ $Date: 2001-08-24 06:00:37 $ + * last change: $Author: oj $ $Date: 2001-08-29 12:14:42 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -93,7 +93,8 @@ namespace connectivity sal_Bool isStarted(); protected: - virtual SQLRETURN OpenConnection(const ::rtl::OUString& aConnectStr,sal_Int32 nTimeOut, const ::rtl::OUString& _uid,const ::rtl::OUString& _pwd); + virtual SQLRETURN OpenConnection(const ::rtl::OUString& aConnectStr,sal_Int32 nTimeOut, const ::rtl::OUString& _uid,const ::rtl::OUString& _pwd); + virtual connectivity::odbc::OConnection* cloneConnection(); // creates a new connection public: virtual SQLRETURN Construct( const ::rtl::OUString& url,const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info) throw(::com::sun::star::sdbc::SQLException); diff --git a/connectivity/source/inc/ado/ADatabaseMetaDataResultSet.hxx b/connectivity/source/inc/ado/ADatabaseMetaDataResultSet.hxx index 635f82ab153d..f100f117a8a1 100644 --- a/connectivity/source/inc/ado/ADatabaseMetaDataResultSet.hxx +++ b/connectivity/source/inc/ado/ADatabaseMetaDataResultSet.hxx @@ -2,9 +2,9 @@ * * $RCSfile: ADatabaseMetaDataResultSet.hxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: oj $ $Date: 2001-07-30 08:52:09 $ + * last change: $Author: oj $ $Date: 2001-08-29 12:14:43 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -274,7 +274,7 @@ namespace connectivity { sal_Int32 map = column; - if (m_aColMapping.size()) + if (!m_aColMapping.empty()) { // Validate column number map = m_aColMapping[column]; diff --git a/connectivity/source/inc/file/FResultSet.hxx b/connectivity/source/inc/file/FResultSet.hxx index 54193927a223..38732f35e380 100644 --- a/connectivity/source/inc/file/FResultSet.hxx +++ b/connectivity/source/inc/file/FResultSet.hxx @@ -2,9 +2,9 @@ * * $RCSfile: FResultSet.hxx,v $ * - * $Revision: 1.24 $ + * $Revision: 1.25 $ * - * last change: $Author: oj $ $Date: 2001-08-24 06:00:38 $ + * last change: $Author: oj $ $Date: 2001-08-29 12:14:43 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -116,117 +116,14 @@ #ifndef CONNECTIVITY_STDTYPEDEFS_HXX #include "connectivity/StdTypeDefs.hxx" #endif +#ifndef CONNECTIVITY_TSORTINDEX_HXX +#include "TSortIndex.hxx" +#endif namespace connectivity { namespace file { - class OKeySet : public ::std::vector<sal_Int32> - { - sal_Bool m_bFrozen; - public: - OKeySet(): ::std::vector<sal_Int32>(),m_bFrozen(sal_False){} - OKeySet(size_type _nSize) : ::std::vector<sal_Int32>(_nSize),m_bFrozen(sal_False){} - - sal_Bool isFrozen() const { return m_bFrozen; } - void setFrozen(sal_Bool _bFrozen=sal_True) { m_bFrozen = _bFrozen; } - }; - - typedef union - { - double aDouble; - rtl::OUString* pString; - } OFILEKey; - - class OFILEKeyValue - { - private: - INT32 nValue; - OFILEKey pKey[SQL_ORDERBYKEYS]; - - public: - OFILEKeyValue() { } - OFILEKeyValue(INT32 nVal) : nValue(nVal) {} - ~OFILEKeyValue(){} - - void SetKey(UINT16 i, double d) { pKey[i].aDouble = d; } - void SetKey(UINT16 i, const rtl::OUString& rString) { pKey[i].pString = new rtl::OUString(rString); } - void SetValue(INT32 nVal) { nValue = nVal; } - - rtl::OUString* GetKeyString(UINT16 i) const { return pKey[i].pString; } - double GetKeyDouble(UINT16 i) const { return pKey[i].aDouble; } - - inline INT32 GetValue() const {return nValue;} - }; - - typedef OFILEKeyValue * OFILEKeyValuePtr; - - typedef enum - { - SQL_ORDERBYKEY_NONE, // Nicht sortieren - SQL_ORDERBYKEY_DOUBLE, // Numerischer Key - SQL_ORDERBYKEY_STRING // String Key - } OKeyType; - - class OFILESortIndex - { - private: - INT32 nMaxCount; // Maximal moegliche Anzahl Key/Value-Paare im Index (und damit Array-Groesse) - INT32 nCount; // Anzahl Key/Value-Paare im Index (und damit naechste freie Position) - - OFILEKeyValuePtr * ppKeyValueArray; - // Zeiger auf Array der Groesse [nMaxCount] - - BOOL bFrozen; - rtl_TextEncoding eCharSet; - - public: // nur fuer OFILECompare: - static OFILESortIndex *pCurrentIndex; // Waehrend der Ausfuehrung von qsort ist hier der Zeiger - static rtl_TextEncoding eCurrentCharSet; - // auf den gerade zur Sortierung verwendeten Index hinterlegt - // (wird von der Vergleichsfunktion OFILEKeyCompare verwendet). - OKeyType eKeyType[SQL_ORDERBYKEYS]; - ::std::vector<sal_Int16> m_aAscending; - - - public: - - OFILESortIndex(const OKeyType eKeyType[], // Art des Schluessels: numerisch/String/nicht sortieren (Genau 3 Eintraege!) - const ::std::vector<sal_Int16>& _aAscending, // TRUE = Aufsteigend sortieren (Genau 3 Eintraege!) - INT32 nMaxNumberOfRows, - rtl_TextEncoding eSet); - - ~OFILESortIndex(); - - - BOOL AddKeyValue(OFILEKeyValue * pKeyValue); - // TRUE, wenn erfolgreich hinzugefuegt, FALSE bei Ueberschreitung - // der Index-Kapazitaet. - // pKeyValue wird beim Zerstoeren des Index automatisch freigegeben. - - void Freeze(); // "Einfrieren" des Index: - // Vor "Freeze" duerfen Count() und Get() nicht gerufen werden, - // nach "Freeze" darf dafuer Add() nicht mehr gerufen werden. - - OKeySet* CreateKeySet(); - - - - BOOL IsFrozen() { return bFrozen; } // TRUE nach Aufruf von Freeze() - - INT32 Count() const { return nCount; } // Anzahl Key/Value-Paare im Index - INT32 GetValue(INT32 nPos) const; // Value an Position nPos (1..n) [sortierter Zugriff]. - }; - - static int -#if defined(WIN) || defined(WNT) -__cdecl -#endif -#if defined(ICC) && defined(OS2) -_Optlink -#endif -OFILEKeyCompare(const void * elem1, const void * elem2); - /* ** java_sql_ResultSet */ @@ -243,9 +140,9 @@ OFILEKeyCompare(const void * elem1, const void * elem2); ::com::sun::star::lang::XUnoTunnel> OResultSet_BASE; class OResultSet : public comphelper::OBaseMutex, - public OResultSet_BASE, - public ::comphelper::OPropertyContainer, - public ::comphelper::OPropertyArrayUsageHelper<OResultSet> + public OResultSet_BASE, + public ::comphelper::OPropertyContainer, + public ::comphelper::OPropertyArrayUsageHelper<OResultSet> { protected: @@ -268,12 +165,12 @@ OFILEKeyCompare(const void * elem1, const void * elem2); TInt2IntMap m_aBookmarks; // map from bookmarks to logical position ::std::vector<TInt2IntMap::iterator> m_aBookmarksPositions;// vector of iterators to bookmark map, the order is the logical position - OKeySet* m_pFileSet; + ::vos::ORef<OKeySet> m_pFileSet; OKeySet::iterator m_aFileSetIter; - OFILESortIndex* m_pSortIndex; + OSortIndex* m_pSortIndex; ::vos::ORef<connectivity::OSQLColumns> m_xColumns; // this are the select columns ::vos::ORef<connectivity::OSQLColumns> m_xParamColumns; OFileTable* m_pTable; @@ -322,8 +219,8 @@ OFILEKeyCompare(const void * elem1, const void * elem2); BOOL bEvaluate = TRUE, BOOL bRetrieveData = TRUE); - OFILEKeyValue* GetOrderbyKeyValue(OValueRow _rRow); - BOOL IsSorted() const { return m_aOrderbyColumnNumber[0] != SQL_COLUMN_NOTFOUND;} + OKeyValue* GetOrderbyKeyValue(OValueRow _rRow); + BOOL IsSorted() const { return !m_aOrderbyColumnNumber.empty() && m_aOrderbyColumnNumber[0] != SQL_COLUMN_NOTFOUND;} sal_Bool moveAbsolute(sal_Int32 _nOffset,sal_Bool _bRetrieveData); // return true when the select statement is "select count(*) from table" diff --git a/connectivity/source/inc/file/FStatement.hxx b/connectivity/source/inc/file/FStatement.hxx index 0297181f025a..2e670fa1ba4e 100644 --- a/connectivity/source/inc/file/FStatement.hxx +++ b/connectivity/source/inc/file/FStatement.hxx @@ -2,9 +2,9 @@ * * $RCSfile: FStatement.hxx,v $ * - * $Revision: 1.12 $ + * $Revision: 1.13 $ * - * last change: $Author: oj $ $Date: 2001-08-24 06:00:38 $ + * last change: $Author: oj $ $Date: 2001-08-29 12:14:43 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -114,7 +114,6 @@ #include <comphelper/broadcasthelper.hxx> #endif -#define SQL_ORDERBYKEYS 10 #define SQL_COLUMN_NOTFOUND STRING_NOTFOUND namespace connectivity @@ -174,8 +173,7 @@ namespace connectivity void createColumnMapping(); // searches the statement for sort criteria void anylizeSQL(); - void setOrderbyColumn(UINT16 nOrderbyColumnNo, - connectivity::OSQLParseNode* pColumnRef, + void setOrderbyColumn( connectivity::OSQLParseNode* pColumnRef, connectivity::OSQLParseNode* pAscendingDescending); virtual void initializeResultSet(OResultSet* _pResult); diff --git a/connectivity/source/inc/odbc/OConnection.hxx b/connectivity/source/inc/odbc/OConnection.hxx index 61a98dda6327..6dd00b0de802 100644 --- a/connectivity/source/inc/odbc/OConnection.hxx +++ b/connectivity/source/inc/odbc/OConnection.hxx @@ -2,9 +2,9 @@ * * $RCSfile: OConnection.hxx,v $ * - * $Revision: 1.11 $ + * $Revision: 1.12 $ * - * last change: $Author: oj $ $Date: 2001-07-17 07:23:55 $ + * last change: $Author: oj $ $Date: 2001-08-29 12:14:43 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -110,32 +110,37 @@ namespace connectivity //==================================================================== // Data attributes //==================================================================== - TTypeInfoVector m_aTypeInfo; // vector containing an entry + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > m_aInfo; + ::std::map< SQLHANDLE,OConnection*> m_aConnections; // holds all connectionas which are need for serveral statements + TTypeInfoVector m_aTypeInfo; // vector containing an entry // for each row returned by // DatabaseMetaData.getTypeInfo. ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData; - connectivity::OWeakRefArray m_aStatements; // vector containing a list + connectivity::OWeakRefArray m_aStatements; // vector containing a list // of all the Statement objects // for this Connection - ::com::sun::star::sdbc::SQLWarning m_aLastWarning; // Last SQLWarning generated by + ::com::sun::star::sdbc::SQLWarning m_aLastWarning; // Last SQLWarning generated by // an operation - ::rtl::OUString m_aURL; // URL of connection - ::rtl::OUString m_sUser; // the user name - ODBCDriver* m_pDriver; // Pointer to the owning - // driver object + ::rtl::OUString m_aURL; // URL of connection + ::rtl::OUString m_sUser; // the user name + ODBCDriver* m_pDriver; // Pointer to the owning + // driver object - SQLHANDLE m_aConnectionHandle; - SQLHANDLE m_pDriverHandleCopy; // performance reason - sal_Bool m_bClosed; - sal_Bool m_bUseCatalog; // should we use the catalog on filebased databases - sal_Bool m_bUseOldDateFormat; + SQLHANDLE m_aConnectionHandle; + SQLHANDLE m_pDriverHandleCopy; // performance reason + sal_Int32 m_nStatementCount; + sal_Bool m_bClosed; + sal_Bool m_bUseCatalog; // should we use the catalog on filebased databases + sal_Bool m_bUseOldDateFormat; SQLRETURN OpenConnection(const ::rtl::OUString& aConnectStr,sal_Int32 nTimeOut, sal_Bool bSilent); - void buildTypeInfo() throw( ::com::sun::star::sdbc::SQLException); + void buildTypeInfo() throw( ::com::sun::star::sdbc::SQLException); + + virtual OConnection* cloneConnection(); // creates a new connection public: void* getOdbcFunction(sal_Int32 _nIndex) const; @@ -179,15 +184,19 @@ namespace connectivity virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); virtual void SAL_CALL clearWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); // - SQLHANDLE getConnection() { return m_aConnectionHandle; } + SQLHANDLE getConnection() { return m_aConnectionHandle; } // should we use the catalog on filebased databases - sal_Bool isCatalogUsed() const { return m_bUseCatalog; } + sal_Bool isCatalogUsed() const { return m_bUseCatalog; } + sal_Bool useOldDateFormat() const { return m_bUseOldDateFormat; } + SQLHANDLE getDriverHandle() const { return m_pDriverHandleCopy;} + ODBCDriver* getDriver() const { return m_pDriver;} ::rtl::OUString getUserName() const { return m_sUser; } - sal_Bool useOldDateFormat() const { return m_bUseOldDateFormat; } + ::rtl::OUString getURL() const { return m_aURL; } - SQLHANDLE getDriverHandle() const { return m_pDriverHandleCopy;} - ODBCDriver* getDriver() const { return m_pDriver;} + SQLHANDLE createStatementHandle(); + // close and free the handle and set it to SQL_NULLHANDLE + void freeStatementHandle(SQLHANDLE& _pHandle); }; } } diff --git a/connectivity/source/inc/odbc/ODatabaseMetaDataResultSet.hxx b/connectivity/source/inc/odbc/ODatabaseMetaDataResultSet.hxx index 5794458b25ff..8056837b6b07 100644 --- a/connectivity/source/inc/odbc/ODatabaseMetaDataResultSet.hxx +++ b/connectivity/source/inc/odbc/ODatabaseMetaDataResultSet.hxx @@ -2,9 +2,9 @@ * * $RCSfile: ODatabaseMetaDataResultSet.hxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: oj $ $Date: 2001-07-12 12:10:35 $ + * last change: $Author: oj $ $Date: 2001-08-29 12:14:43 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -197,7 +197,7 @@ namespace connectivity ~ODatabaseMetaDataResultSet(); public: // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: - ODatabaseMetaDataResultSet(OConnection* _pConnection,SQLHANDLE _pStatementHandle,rtl_TextEncoding _nTextEncoding); + ODatabaseMetaDataResultSet(OConnection* _pConnection); inline void* getOdbcFunction(sal_Int32 _nIndex) const diff --git a/connectivity/source/inc/odbc/OStatement.hxx b/connectivity/source/inc/odbc/OStatement.hxx index aa022d081621..669bd3966ada 100644 --- a/connectivity/source/inc/odbc/OStatement.hxx +++ b/connectivity/source/inc/odbc/OStatement.hxx @@ -2,9 +2,9 @@ * * $RCSfile: OStatement.hxx,v $ * - * $Revision: 1.15 $ + * $Revision: 1.16 $ * - * last change: $Author: oj $ $Date: 2001-08-02 10:41:51 $ + * last change: $Author: oj $ $Date: 2001-08-29 12:14:43 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -137,11 +137,12 @@ namespace connectivity ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbc::XResultSet> m_xResultSet; // The last ResultSet created // for this Statement - ::std::list< ::rtl::OUString> m_aBatchList; + ::std::list< ::rtl::OUString> m_aBatchList; - OConnection* m_pConnection;// The owning Connection object - SQLHANDLE m_aStatementHandle; - SQLUSMALLINT* m_pRowStatusArray; + OConnection* m_pConnection;// The owning Connection object + SQLHANDLE m_aStatementHandle; + SQLUSMALLINT* m_pRowStatusArray; + OConnection* m_pConnectionTemp; // this connection is set when the databsse doesn't support more statements per connection //using OStatement_BASE::rBHelper; protected: |