summaryrefslogtreecommitdiff
path: root/connectivity
diff options
context:
space:
mode:
authorAndrzej J.R. Hunt <andrzej@ahunt.org>2013-11-10 08:40:36 +0000
committerLionel Elie Mamane <lionel@mamane.lu>2013-11-14 11:50:29 +0000
commitacef4b26879f6f8d80c26f6d2ee80667cb6ed388 (patch)
treee47f5310a13953505b106cd700f43ddc31acb454 /connectivity
parent5c7ede91afaf334cd6faa099ae3f7c1d6cc929c8 (diff)
fdo#70144 Mark database document as modified when data inserted in firebird.
This only applies to embedded databases where any changes to the database only affect the temporary extracted db which still has to be stored into the .odb. This only fixes the status for modification/insertion/deletion of data in existing tables. Insertion of new tables still does not result in the modified state being set. Change-Id: I553f67127672f2cf49b98ddcdf7d25f22bef5074 Reviewed-on: https://gerrit.libreoffice.org/6621 Reviewed-by: Lionel Elie Mamane <lionel@mamane.lu> Tested-by: Lionel Elie Mamane <lionel@mamane.lu>
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/source/drivers/firebird/Connection.cxx6
-rw-r--r--connectivity/source/drivers/firebird/Connection.hxx10
-rw-r--r--connectivity/source/drivers/firebird/PreparedStatement.cxx3
-rw-r--r--connectivity/source/drivers/firebird/Statement.cxx7
4 files changed, 26 insertions, 0 deletions
diff --git a/connectivity/source/drivers/firebird/Connection.cxx b/connectivity/source/drivers/firebird/Connection.cxx
index d00478abdec5..3f49b1639027 100644
--- a/connectivity/source/drivers/firebird/Connection.cxx
+++ b/connectivity/source/drivers/firebird/Connection.cxx
@@ -302,6 +302,12 @@ void Connection::construct(const ::rtl::OUString& url, const Sequence< PropertyV
osl_atomic_decrement( &m_refCount );
}
+void Connection::notifyDatabaseModified()
+{
+ if (m_xParentDocument.is()) // Only true in embedded mode
+ m_xParentDocument->setModified(sal_True);
+}
+
//----- XServiceInfo ---------------------------------------------------------
IMPLEMENT_SERVICE_INFO(Connection, "com.sun.star.sdbc.drivers.firebird.Connection",
"com.sun.star.sdbc.Connection")
diff --git a/connectivity/source/drivers/firebird/Connection.hxx b/connectivity/source/drivers/firebird/Connection.hxx
index 40ebee7920c2..7850da7d80ad 100644
--- a/connectivity/source/drivers/firebird/Connection.hxx
+++ b/connectivity/source/drivers/firebird/Connection.hxx
@@ -189,6 +189,16 @@ namespace connectivity
throw(::com::sun::star::sdbc::SQLException);
/**
+ * Must be called anytime the underlying database is likely to have
+ * changed.
+ *
+ * This is used to notify the database document of any changes, so
+ * that the user is informed of any pending changes needing to be
+ * saved.
+ */
+ void notifyDatabaseModified();
+
+ /**
* Create a new Blob tied to this connection. Blobs are tied to a
* transaction and not to a statement, hence the connection should
* deal with their management.
diff --git a/connectivity/source/drivers/firebird/PreparedStatement.cxx b/connectivity/source/drivers/firebird/PreparedStatement.cxx
index d5784504731e..5e02616e5029 100644
--- a/connectivity/source/drivers/firebird/PreparedStatement.cxx
+++ b/connectivity/source/drivers/firebird/PreparedStatement.cxx
@@ -287,6 +287,9 @@ sal_Bool SAL_CALL OPreparedStatement::execute()
m_aStatementHandle,
m_pOutSqlda);
+ if (getStatementChangeCount() > 0)
+ m_pConnection->notifyDatabaseModified();
+
return m_xResultSet.is();
// TODO: implement handling of multiple ResultSets.
}
diff --git a/connectivity/source/drivers/firebird/Statement.cxx b/connectivity/source/drivers/firebird/Statement.cxx
index 1ed5bd2dded4..2364ed22a044 100644
--- a/connectivity/source/drivers/firebird/Statement.cxx
+++ b/connectivity/source/drivers/firebird/Statement.cxx
@@ -136,7 +136,14 @@ uno::Reference< XResultSet > SAL_CALL OStatement::executeQuery(const OUString& s
evaluateStatusVector(m_statusVector, sql, *this);
if (isDDLStatement())
+ {
m_pConnection->commit();
+ m_pConnection->notifyDatabaseModified();
+ }
+ else if (getStatementChangeCount() > 0)
+ {
+ m_pConnection->notifyDatabaseModified();
+ }
return m_xResultSet;
}