[Libreoffice-commits] core.git: 6 commits - connectivity/source
Andrzej J.R. Hunt
andrzej at ahunt.org
Fri Aug 2 06:42:54 PDT 2013
connectivity/source/drivers/firebird/Connection.cxx | 30 +-
connectivity/source/drivers/firebird/Connection.hxx | 1
connectivity/source/drivers/firebird/DatabaseMetaData.cxx | 199 ++++++++------
3 files changed, 135 insertions(+), 95 deletions(-)
New commits:
commit cc1e1e9509dd78d043c4b2f345df84635bc7492a
Author: Andrzej J.R. Hunt <andrzej at ahunt.org>
Date: Fri Aug 2 14:41:36 2013 +0200
Only write db to file if we are embedded. (firebird-sdbc)
Change-Id: If6126a8005d666c0c1355efc2a887519da37c891
diff --git a/connectivity/source/drivers/firebird/Connection.cxx b/connectivity/source/drivers/firebird/Connection.cxx
index 02beb6b..07b16eb 100644
--- a/connectivity/source/drivers/firebird/Connection.cxx
+++ b/connectivity/source/drivers/firebird/Connection.cxx
@@ -610,6 +610,11 @@ void SAL_CALL OConnection::clearWarnings( ) throw(SQLException, RuntimeExceptio
void SAL_CALL OConnection::documentEventOccured( const DocumentEvent& _Event )
throw(RuntimeException)
{
+ MutexGuard aGuard(m_aMutex);
+
+ if (!m_bIsEmbedded)
+ return;
+
if (_Event.EventName == "OnSave" || _Event.EventName == "OnSaveAs")
{
commit(); // Commit and close transaction
commit 03528afc5c21350b064d6a43fc57f1adc1c94c41
Author: Andrzej J.R. Hunt <andrzej at ahunt.org>
Date: Fri Aug 2 14:33:17 2013 +0200
Clear Statements as appropriate. (firebird-sdbc)
Change-Id: Ied90fe623dff284179c88ae77392d641ba0b004b
diff --git a/connectivity/source/drivers/firebird/Connection.cxx b/connectivity/source/drivers/firebird/Connection.cxx
index 96ed57c..02beb6b 100644
--- a/connectivity/source/drivers/firebird/Connection.cxx
+++ b/connectivity/source/drivers/firebird/Connection.cxx
@@ -421,6 +421,7 @@ void OConnection::setupTransaction()
// is lost...
if (m_transactionHandle)
{
+ clearStatements();
isc_rollback_transaction(status_vector, &m_transactionHandle);
}
@@ -454,9 +455,6 @@ void OConnection::setupTransaction()
isc_start_transaction(status_vector, &m_transactionHandle, 1, &m_DBHandler,
(unsigned short) sizeof(isc_tpb), isc_tpb);
-
- //TODO: transmit to open statements?
-
}
isc_tr_handle& OConnection::getTransaction()
@@ -478,6 +476,7 @@ void SAL_CALL OConnection::commit() throw(SQLException, RuntimeException)
if (!m_bAutoCommit && m_transactionHandle)
{
+ clearStatements();
isc_commit_transaction(status_vector, &m_transactionHandle);
}
}
@@ -613,6 +612,7 @@ void SAL_CALL OConnection::documentEventOccured( const DocumentEvent& _Event )
{
if (_Event.EventName == "OnSave" || _Event.EventName == "OnSaveAs")
{
+ commit(); // Commit and close transaction
if ( m_bIsEmbedded && m_xEmbeddedStorage.is() )
{
SAL_INFO("connectivity.firebird", "Writing .fdb into .odb" );
@@ -698,13 +698,7 @@ void OConnection::disposing()
MutexGuard aGuard(m_aMutex);
- for (OWeakRefArray::iterator i = m_aStatements.begin(); m_aStatements.end() != i; ++i)
- {
- Reference< XComponent > xComp(i->get(), UNO_QUERY);
- if (xComp.is())
- xComp->dispose();
- }
- m_aStatements.clear();
+ clearStatements();
m_bClosed = sal_True;
m_xMetaData = ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbc::XDatabaseMetaData>();
@@ -734,4 +728,15 @@ void OConnection::disposing()
cppu::WeakComponentImplHelperBase::disposing();
}
+void OConnection::clearStatements()
+{
+ MutexGuard aGuard(m_aMutex);
+ for (OWeakRefArray::iterator i = m_aStatements.begin(); m_aStatements.end() != i; ++i)
+ {
+ Reference< XComponent > xComp(i->get(), UNO_QUERY);
+ if (xComp.is())
+ xComp->dispose();
+ }
+ m_aStatements.clear();
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/firebird/Connection.hxx b/connectivity/source/drivers/firebird/Connection.hxx
index 559bba9..fcc59ef 100644
--- a/connectivity/source/drivers/firebird/Connection.hxx
+++ b/connectivity/source/drivers/firebird/Connection.hxx
@@ -112,6 +112,7 @@ namespace connectivity
void buildTypeInfo() throw( ::com::sun::star::sdbc::SQLException);
void setupTransaction();
+ void clearStatements();
public:
virtual void construct( const ::rtl::OUString& url,
const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info)
commit 935eab83a92426d9fd9e335d8f16c7c4658491c1
Author: Andrzej J.R. Hunt <andrzej at ahunt.org>
Date: Fri Aug 2 14:29:16 2013 +0200
Make getPrimaryKeys actually work. (firebird-sdbc)
Change-Id: Ia300e85675a24a2900cfeb8ee75bf58356b14b30
diff --git a/connectivity/source/drivers/firebird/DatabaseMetaData.cxx b/connectivity/source/drivers/firebird/DatabaseMetaData.cxx
index 43e4889..c30ba43 100644
--- a/connectivity/source/drivers/firebird/DatabaseMetaData.cxx
+++ b/connectivity/source/drivers/firebird/DatabaseMetaData.cxx
@@ -1501,9 +1501,9 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getPrimaryKeys(
OUStringBuffer aQueryBuf("SELECT "
"constr.RDB$RELATION_NAME, " // 1. Table Name
"inds.RDB$FIELD_NAME, " // 2. Column Name
- "inds.RDB$SORT_ORDER, " // 3. Sequence Number
- "constr.RDB$CONSTRAINT_NAME, " // 4 Constraint name
- "FROM RDB$RELATION_FIELDS constr "
+ "inds.RDB$FIELD_POSITION, " // 3. Sequence Number
+ "constr.RDB$CONSTRAINT_NAME " // 4 Constraint name
+ "FROM RDB$RELATION_CONSTRAINTS constr "
"JOIN RDB$INDEX_SEGMENTS inds "
"on (constr.RDB$INDEX_NAME = inds.RDB$INDEX_NAME) ");
commit 6f92b92458a35c3c88b732dabe4d6242fafe9584
Author: Andrzej J.R. Hunt <andrzej at ahunt.org>
Date: Fri Aug 2 10:57:25 2013 +0200
Tidy up Transaction info in DatabaseMetaData. (firebird-sdbc)
Change-Id: I77af538722e7e512db9bcd48d90f5c98ead379a2
diff --git a/connectivity/source/drivers/firebird/DatabaseMetaData.cxx b/connectivity/source/drivers/firebird/DatabaseMetaData.cxx
index b12c79b..43e4889 100644
--- a/connectivity/source/drivers/firebird/DatabaseMetaData.cxx
+++ b/connectivity/source/drivers/firebird/DatabaseMetaData.cxx
@@ -408,32 +408,59 @@ sal_Bool SAL_CALL ODatabaseMetaData::
{
return sal_True;
}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenStatementsAcrossRollback( ) throw(SQLException, RuntimeException)
+//----- Transaction Support --------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactions()
+ throw(SQLException, RuntimeException)
{
- return sal_False;
+ return sal_True;
}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenStatementsAcrossCommit( ) throw(SQLException, RuntimeException)
+
+sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenStatementsAcrossRollback()
+ throw(SQLException, RuntimeException)
{
return sal_False;
}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenCursorsAcrossCommit( ) throw(SQLException, RuntimeException)
+
+sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenStatementsAcrossCommit()
+ throw(SQLException, RuntimeException)
{
return sal_False;
}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenCursorsAcrossRollback( ) throw(SQLException, RuntimeException)
+
+sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenCursorsAcrossCommit()
+ throw(SQLException, RuntimeException)
{
return sal_False;
}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactionIsolationLevel( sal_Int32 level ) throw(SQLException, RuntimeException)
+
+sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenCursorsAcrossRollback()
+ throw(SQLException, RuntimeException)
{
- (void) level;
return sal_False;
}
+
+sal_Bool SAL_CALL ODatabaseMetaData::supportsMultipleTransactions()
+ throw(SQLException, RuntimeException)
+{
+ return sal_True;
+}
+
+sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactionIsolationLevel(
+ sal_Int32 aLevel)
+ throw(SQLException, RuntimeException)
+{
+ return aLevel == TransactionIsolation::READ_UNCOMMITTED
+ || aLevel == TransactionIsolation::READ_COMMITTED
+ || aLevel == TransactionIsolation::REPEATABLE_READ
+ || aLevel == TransactionIsolation::SERIALIZABLE;
+}
+
+sal_Int32 SAL_CALL ODatabaseMetaData::getDefaultTransactionIsolation()
+ throw(SQLException, RuntimeException)
+{
+ return TransactionIsolation::REPEATABLE_READ;
+}
+
// -------------------------------------------------------------------------
sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92FullSQL( ) throw(SQLException, RuntimeException)
{
@@ -461,11 +488,6 @@ sal_Int32 SAL_CALL ODatabaseMetaData::getMaxProcedureNameLength( ) throw(SQLExc
sal_Int32 nValue = 31; // TODO: confirm
return nValue;
}
-
-sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactions( ) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
// -------------------------------------------------------------------------
sal_Bool SAL_CALL ODatabaseMetaData::allProceduresAreCallable( ) throw(SQLException, RuntimeException)
{
@@ -519,10 +541,6 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupByUnrelated( ) throw(SQLExcep
return sal_False;
}
-sal_Bool SAL_CALL ODatabaseMetaData::supportsMultipleTransactions( ) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
// -------------------------------------------------------------------------
sal_Bool SAL_CALL ODatabaseMetaData::supportsMultipleResultSets( ) throw(SQLException, RuntimeException)
{
@@ -645,11 +663,6 @@ sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMajorVersion( ) throw(RuntimeExc
return 1;
}
// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getDefaultTransactionIsolation( ) throw(SQLException, RuntimeException)
-{
- return TransactionIsolation::NONE;
-}
-// -------------------------------------------------------------------------
sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMinorVersion( ) throw(RuntimeException)
{
return 0;
commit 5292d90f24b7d0f29445c4634dd9219d8d6ea3d7
Author: Andrzej J.R. Hunt <andrzej at ahunt.org>
Date: Fri Aug 2 10:48:21 2013 +0200
Implement supportsResultSetConcurrency. (firebird-sdbc)
Change-Id: Id830f703c40c3b16db5f6237325762619cbe54eb
diff --git a/connectivity/source/drivers/firebird/DatabaseMetaData.cxx b/connectivity/source/drivers/firebird/DatabaseMetaData.cxx
index 87b7ae6..b12c79b 100644
--- a/connectivity/source/drivers/firebird/DatabaseMetaData.cxx
+++ b/connectivity/source/drivers/firebird/DatabaseMetaData.cxx
@@ -746,12 +746,17 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetType(sal_Int32 setType)
return sal_False;
}
}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetConcurrency( sal_Int32 setType, sal_Int32 concurrency ) throw(SQLException, RuntimeException)
+
+sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetConcurrency(
+ sal_Int32 aResultSetType,
+ sal_Int32 aConcurrency)
+ throw(SQLException, RuntimeException)
{
- (void) setType;
- (void) concurrency;
- return sal_False;
+ if (aResultSetType == ResultSetType::FORWARD_ONLY
+ && aConcurrency == ResultSetConcurrency::READ_ONLY)
+ return sal_True;
+ else
+ return sal_False;
}
// -------------------------------------------------------------------------
sal_Bool SAL_CALL ODatabaseMetaData::ownUpdatesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException)
commit d74ca3bc9927f941cda810b655393ad18eea1a6e
Author: Andrzej J.R. Hunt <andrzej at ahunt.org>
Date: Fri Aug 2 10:41:43 2013 +0200
Some more DatabaseMetaData. (firebird-sdbc)
Change-Id: Ic8f1a2c1d67d163e6bd326d9b759b9f9cda67b35
diff --git a/connectivity/source/drivers/firebird/DatabaseMetaData.cxx b/connectivity/source/drivers/firebird/DatabaseMetaData.cxx
index 580fa23..87b7ae6 100644
--- a/connectivity/source/drivers/firebird/DatabaseMetaData.cxx
+++ b/connectivity/source/drivers/firebird/DatabaseMetaData.cxx
@@ -114,6 +114,55 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInPrivilegeDefinitions() th
return sal_False;
}
+//----- Schema Info -- UNSUPPORTED --------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInProcedureCalls()
+ throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+
+sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInPrivilegeDefinitions()
+ throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+
+sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInDataManipulation()
+ throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+
+sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInIndexDefinitions()
+ throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+
+sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInTableDefinitions()
+ throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+
+sal_Int32 SAL_CALL ODatabaseMetaData::getMaxSchemaNameLength()
+ throw(SQLException, RuntimeException)
+{
+ return -1;
+}
+
+OUString SAL_CALL ODatabaseMetaData::getSchemaTerm()
+ throw(SQLException, RuntimeException)
+{
+ return OUString();
+}
+
+uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getSchemas()
+ throw(SQLException, RuntimeException)
+{
+ return 0;
+}
+
//----- Max Sizes/Lengths -----------------------------------------------------
sal_Int32 SAL_CALL ODatabaseMetaData::getMaxBinaryLiteralLength() throw(SQLException, RuntimeException)
{
@@ -334,23 +383,28 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsDifferentTableCorrelationNames( )
{
return sal_False;
}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::dataDefinitionIgnoredInTransactions( ) throw(SQLException, RuntimeException)
+// ---- Data definition stuff -------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::dataDefinitionIgnoredInTransactions()
+ throw(SQLException, RuntimeException)
{
- return sal_True;
+ return sal_False;
}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::dataDefinitionCausesTransactionCommit( ) throw(SQLException, RuntimeException)
+
+sal_Bool SAL_CALL ODatabaseMetaData::dataDefinitionCausesTransactionCommit()
+ throw(SQLException, RuntimeException)
{
- return sal_True;
+ return sal_False;
}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsDataManipulationTransactionsOnly( ) throw(SQLException, RuntimeException)
+
+sal_Bool SAL_CALL ODatabaseMetaData::supportsDataManipulationTransactionsOnly()
+ throw(SQLException, RuntimeException)
{
- return sal_True;
+ return sal_False;
}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsDataDefinitionAndDataManipulationTransactions( ) throw(SQLException, RuntimeException)
+
+sal_Bool SAL_CALL ODatabaseMetaData::
+ supportsDataDefinitionAndDataManipulationTransactions()
+ throw(SQLException, RuntimeException)
{
return sal_True;
}
@@ -381,11 +435,6 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactionIsolationLevel( sal_Int3
return sal_False;
}
// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInDataManipulation( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92FullSQL( ) throw(SQLException, RuntimeException)
{
return sal_False;
@@ -401,16 +450,6 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsIntegrityEnhancementFacility( ) th
return sal_False;
}
// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInIndexDefinitions( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInTableDefinitions( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
sal_Int32 SAL_CALL ODatabaseMetaData::getMaxStatements( ) throw(SQLException, RuntimeException)
{
sal_Int32 nValue = 0; // 0 means no limit
@@ -422,12 +461,6 @@ sal_Int32 SAL_CALL ODatabaseMetaData::getMaxProcedureNameLength( ) throw(SQLExc
sal_Int32 nValue = 31; // TODO: confirm
return nValue;
}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxSchemaNameLength( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = -1; // 0 means no limit
- return nValue;
-}
sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactions( ) throw(SQLException, RuntimeException)
{
@@ -536,16 +569,6 @@ sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedLow( ) throw(SQLException, R
return sal_False;
}
// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInProcedureCalls( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInPrivilegeDefinitions( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
sal_Bool SAL_CALL ODatabaseMetaData::supportsCorrelatedSubqueries( ) throw(SQLException, RuntimeException)
{
return sal_False;
@@ -617,12 +640,6 @@ OUString SAL_CALL ODatabaseMetaData::getProcedureTerm( ) throw(SQLException, Ru
return aValue;
}
// -------------------------------------------------------------------------
-OUString SAL_CALL ODatabaseMetaData::getSchemaTerm( ) throw(SQLException, RuntimeException)
-{
- OUString aValue;
- return aValue;
-}
-// -------------------------------------------------------------------------
sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMajorVersion( ) throw(RuntimeException)
{
return 1;
@@ -992,12 +1009,6 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTypeInfo()
return xResultSet;
}
-uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getSchemas()
- throw(SQLException, RuntimeException)
-{
- return NULL;
-}
-
uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumnPrivileges(
const Any& aCatalog,
const OUString& sSchema,
More information about the Libreoffice-commits
mailing list