summaryrefslogtreecommitdiff
path: root/dbaccess/source/core/api/RowSetCache.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'dbaccess/source/core/api/RowSetCache.cxx')
-rw-r--r--dbaccess/source/core/api/RowSetCache.cxx38
1 files changed, 24 insertions, 14 deletions
diff --git a/dbaccess/source/core/api/RowSetCache.cxx b/dbaccess/source/core/api/RowSetCache.cxx
index a96de4b9fbe1..4156c32635a2 100644
--- a/dbaccess/source/core/api/RowSetCache.cxx
+++ b/dbaccess/source/core/api/RowSetCache.cxx
@@ -168,6 +168,16 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs,
Reference< XIndexAccess> xUpdateTableKeys;
::rtl::OUString aUpdateTableName = _rUpdateTableName;
Reference< XConnection> xConnection;
+ // first we need a connection
+ Reference< XStatement> xStmt(_xRs->getStatement(),UNO_QUERY);
+ if(xStmt.is())
+ xConnection = xStmt->getConnection();
+ else
+ {
+ Reference< XPreparedStatement> xPrepStmt(_xRs->getStatement(),UNO_QUERY);
+ xConnection = xPrepStmt->getConnection();
+ }
+ OSL_ENSURE(xConnection.is(),"No connection!");
if(_xAnalyzer.is())
{
try
@@ -215,16 +225,7 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs,
if(xColumnsSupplier.is())
{
- // first we need a connection
- Reference< XStatement> xStmt(_xRs->getStatement(),UNO_QUERY);
- if(xStmt.is())
- xConnection = xStmt->getConnection();
- else
- {
- Reference< XPreparedStatement> xPrepStmt(_xRs->getStatement(),UNO_QUERY);
- xConnection = xPrepStmt->getConnection();
- }
- OSL_ENSURE(xConnection.is(),"No connection!");
+
Reference<XNameAccess> xColumns = xColumnsSupplier->getColumns();
Reference<XColumnsSupplier> xColSup(_xAnalyzer,UNO_QUERY);
@@ -233,7 +234,7 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs,
Reference<XNameAccess> xSelColumns = xColSup->getColumns();
Reference<XDatabaseMetaData> xMeta = xConnection->getMetaData();
SelectColumnsMetaData aColumnNames(xMeta.is() && xMeta->supportsMixedCaseQuotedIdentifiers() ? true : false);
- ::dbaccess::getColumnPositions(xSelColumns,xColumns,aUpdateTableName,aColumnNames);
+ ::dbaccess::getColumnPositions(xSelColumns,xColumns->getElementNames(),aUpdateTableName,aColumnNames);
bAllKeysFound = !aColumnNames.empty() && sal_Int32(aColumnNames.size()) == xColumns->getElementNames().getLength();
}
}
@@ -303,7 +304,7 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs,
Reference<XColumnsSupplier> xColSup(_xAnalyzer,UNO_QUERY);
Reference<XNameAccess> xSelColumns = xColSup->getColumns();
Reference<XNameAccess> xColumns = m_aUpdateTable->getColumns();
- ::dbaccess::getColumnPositions(xSelColumns,xColumns,aUpdateTableName,aColumnNames);
+ ::dbaccess::getColumnPositions(xSelColumns,xColumns->getElementNames(),aUpdateTableName,aColumnNames);
// check privileges
m_nPrivileges = Privilege::SELECT;
@@ -560,10 +561,18 @@ sal_Int32 ORowSetCache::hashBookmark( const Any& bookmark )
// -------------------------------------------------------------------------
// XRowUpdate
// -----------------------------------------------------------------------------
-void ORowSetCache::updateValue(sal_Int32 columnIndex,const ORowSetValue& x)
+void ORowSetCache::updateNull(sal_Int32 columnIndex)
{
checkUpdateConditions(columnIndex);
+ ((*m_aInsertRow)->get())[columnIndex].setBound(sal_True);
+ ((*m_aInsertRow)->get())[columnIndex].setNull();
+ ((*m_aInsertRow)->get())[columnIndex].setModified();
+}
+// -----------------------------------------------------------------------------
+void ORowSetCache::updateValue(sal_Int32 columnIndex,const ORowSetValue& x)
+{
+ checkUpdateConditions(columnIndex);
((*m_aInsertRow)->get())[columnIndex].setBound(sal_True);
((*m_aInsertRow)->get())[columnIndex] = x;
@@ -1342,11 +1351,12 @@ void ORowSetCache::moveToInsertRow( )
// we don't unbound the bookmark column
ORowSetValueVector::Vector::iterator aIter = (*m_aInsertRow)->get().begin()+1;
ORowSetValueVector::Vector::iterator aEnd = (*m_aInsertRow)->get().end();
- for(;aIter != aEnd;++aIter)
+ for(sal_Int32 i = 1;aIter != aEnd;++aIter,++i)
{
aIter->setBound(sal_False);
aIter->setModified(sal_False);
aIter->setNull();
+ aIter->setTypeKind(m_xMetaData->getColumnType(i));
}
}
// -------------------------------------------------------------------------