Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
66a716a5
Kaydet (Commit)
66a716a5
authored
Tem 12, 2013
tarafından
Andrzej J.R. Hunt
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Add auto-commit support to firebird-sdbc, enabled by default.
Change-Id: I0303cc8df281c70973ee10dd67d23757cc7bd97a
üst
a3818b52
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
82 additions
and
30 deletions
+82
-30
FConnection.cxx
connectivity/source/drivers/firebird/FConnection.cxx
+79
-30
FConnection.hxx
connectivity/source/drivers/firebird/FConnection.hxx
+3
-0
No files found.
connectivity/source/drivers/firebird/FConnection.cxx
Dosyayı görüntüle @
66a716a5
...
...
@@ -92,7 +92,9 @@ OConnection::OConnection(FirebirdDriver* _pDriver)
m_bClosed
(
sal_False
),
m_bUseCatalog
(
sal_False
),
m_bUseOldDateFormat
(
sal_False
),
m_DBHandler
(
0
)
m_bAutoCommit
(
sal_True
),
m_DBHandler
(
0
),
m_transactionHandle
(
0
)
{
SAL_INFO
(
"connectivity.firebird"
,
"=> OConnection::OConnection()."
);
...
...
@@ -234,7 +236,7 @@ void OConnection::construct(const ::rtl::OUString& url, const Sequence< Property
return
;
}
if
(
m_bIsEmbedded
)
if
(
m_bIsEmbedded
)
// Add DocumentEventListener to save the .fdb as needed
{
uno
::
Reference
<
frame
::
XDesktop2
>
xFramesSupplier
=
frame
::
Desktop
::
create
(
::
comphelper
::
getProcessComponentContext
());
...
...
@@ -270,12 +272,14 @@ void OConnection::construct(const ::rtl::OUString& url, const Sequence< Property
osl_atomic_decrement
(
&
m_refCount
);
}
// XServiceInfo
// --------------------------------------------------------------------------------
IMPLEMENT_SERVICE_INFO
(
OConnection
,
"com.sun.star.sdbc.drivers.firebird.OConnection"
,
"com.sun.star.sdbc.Connection"
)
// --------------------------------------------------------------------------------
Reference
<
XStatement
>
SAL_CALL
OConnection
::
createStatement
(
)
throw
(
SQLException
,
RuntimeException
)
//----- XServiceInfo ---------------------------------------------------------
IMPLEMENT_SERVICE_INFO
(
OConnection
,
"com.sun.star.sdbc.drivers.firebird.OConnection"
,
"com.sun.star.sdbc.Connection"
)
//----- XConnection ----------------------------------------------------------
Reference
<
XStatement
>
SAL_CALL
OConnection
::
createStatement
(
)
throw
(
SQLException
,
RuntimeException
)
{
SAL_INFO
(
"connectivity.firebird"
,
"=> OConnection::createStatement()."
);
...
...
@@ -295,8 +299,9 @@ Reference< XStatement > SAL_CALL OConnection::createStatement( ) throw(SQLExcep
m_aStatements
.
push_back
(
WeakReferenceHelper
(
xReturn
));
return
xReturn
;
}
// --------------------------------------------------------------------------------
Reference
<
XPreparedStatement
>
SAL_CALL
OConnection
::
prepareStatement
(
const
::
rtl
::
OUString
&
_sSql
)
throw
(
SQLException
,
RuntimeException
)
Reference
<
XPreparedStatement
>
SAL_CALL
OConnection
::
prepareStatement
(
const
::
rtl
::
OUString
&
_sSql
)
throw
(
SQLException
,
RuntimeException
)
{
SAL_INFO
(
"connectivity.firebird"
,
"=> OConnection::prepareStatement(). "
"Got called with sql: "
<<
_sSql
);
...
...
@@ -321,8 +326,9 @@ Reference< XPreparedStatement > SAL_CALL OConnection::prepareStatement( const ::
return
xReturn
;
}
// --------------------------------------------------------------------------------
Reference
<
XPreparedStatement
>
SAL_CALL
OConnection
::
prepareCall
(
const
::
rtl
::
OUString
&
_sSql
)
throw
(
SQLException
,
RuntimeException
)
Reference
<
XPreparedStatement
>
SAL_CALL
OConnection
::
prepareCall
(
const
OUString
&
_sSql
)
throw
(
SQLException
,
RuntimeException
)
{
SAL_INFO
(
"connectivity.firebird"
,
"=> OConnection::prepareCall(). "
"_sSql: "
<<
_sSql
);
...
...
@@ -333,49 +339,90 @@ Reference< XPreparedStatement > SAL_CALL OConnection::prepareCall( const ::rtl::
// not implemented yet :-) a task to do
return
NULL
;
}
// --------------------------------------------------------------------------------
::
rtl
::
OUString
SAL_CALL
OConnection
::
nativeSQL
(
const
::
rtl
::
OUString
&
_sSql
)
throw
(
SQLException
,
RuntimeException
)
OUString
SAL_CALL
OConnection
::
nativeSQL
(
const
OUString
&
_sSql
)
throw
(
SQLException
,
RuntimeException
)
{
::
osl
::
MutexGuard
aGuard
(
m_aMutex
);
// when you need to transform SQL92 to you driver specific you can do it here
// We do not need to adapt the SQL for Firebird atm.
return
_sSql
;
}
// --------------------------------------------------------------------------------
void
SAL_CALL
OConnection
::
setAutoCommit
(
sal_Bool
autoCommit
)
throw
(
SQLException
,
RuntimeException
)
void
SAL_CALL
OConnection
::
setAutoCommit
(
sal_Bool
autoCommit
)
throw
(
SQLException
,
RuntimeException
)
{
::
osl
::
MutexGuard
aGuard
(
m_aMutex
);
checkDisposed
(
OConnection_BASE
::
rBHelper
.
bDisposed
);
// here you have to set your commit mode please have a look at the jdbc documentation to get a clear explanation
m_bAutoCommit
=
autoCommit
;
if
(
m_transactionHandle
)
{
setupTransaction
();
}
}
// --------------------------------------------------------------------------------
sal_Bool
SAL_CALL
OConnection
::
getAutoCommit
(
)
throw
(
SQLException
,
RuntimeException
)
sal_Bool
SAL_CALL
OConnection
::
getAutoCommit
()
throw
(
SQLException
,
RuntimeException
)
{
::
osl
::
MutexGuard
aGuard
(
m_aMutex
);
checkDisposed
(
OConnection_BASE
::
rBHelper
.
bDisposed
);
// you have to distinguish which if you are in autocommit mode or not
// at normal case true should be fine here
return
sal_True
;
return
m_bAutoCommit
;
}
// --------------------------------------------------------------------------------
void
SAL_CALL
OConnection
::
commit
(
)
throw
(
SQLException
,
RuntimeException
)
void
OConnection
::
setupTransaction
()
{
ISC_STATUS
status_vector
[
20
];
// TODO: is this sensible? If we have changed parameters then transaction
// is lost...
if
(
m_transactionHandle
)
{
isc_rollback_transaction
(
status_vector
,
&
m_transactionHandle
);
}
static
char
isc_tpb
[]
=
{
isc_tpb_version3
,
(
m_bAutoCommit
?
isc_tpb_autocommit
:
0
),
isc_tpb_write
,
isc_tpb_read_committed
,
isc_tpb_wait
,
isc_tpb_no_rec_version
};
isc_start_transaction
(
status_vector
,
&
m_transactionHandle
,
1
,
&
m_DBHandler
,
(
unsigned
short
)
sizeof
(
isc_tpb
),
isc_tpb
);
//TODO: transmit to open statements?
}
void
SAL_CALL
OConnection
::
commit
()
throw
(
SQLException
,
RuntimeException
)
{
::
osl
::
MutexGuard
aGuard
(
m_aMutex
);
checkDisposed
(
OConnection_BASE
::
rBHelper
.
bDisposed
);
// when you database does support transactions you should commit here
ISC_STATUS
status_vector
[
20
];
if
(
!
m_bAutoCommit
&&
m_transactionHandle
)
{
isc_commit_transaction
(
status_vector
,
&
m_transactionHandle
);
}
}
// --------------------------------------------------------------------------------
void
SAL_CALL
OConnection
::
rollback
(
)
throw
(
SQLException
,
RuntimeException
)
void
SAL_CALL
OConnection
::
rollback
()
throw
(
SQLException
,
RuntimeException
)
{
::
osl
::
MutexGuard
aGuard
(
m_aMutex
);
checkDisposed
(
OConnection_BASE
::
rBHelper
.
bDisposed
);
ISC_STATUS
status_vector
[
20
];
// same as commit but for the other case
if
(
!
m_bAutoCommit
&&
m_transactionHandle
)
{
isc_rollback_transaction
(
status_vector
,
&
m_transactionHandle
);
}
}
// --------------------------------------------------------------------------------
sal_Bool
SAL_CALL
OConnection
::
isClosed
(
)
throw
(
SQLException
,
RuntimeException
)
{
::
osl
::
MutexGuard
aGuard
(
m_aMutex
);
...
...
@@ -606,6 +653,8 @@ void OConnection::disposing()
if
(
isc_detach_database
(
status
,
&
m_DBHandler
))
if
(
pr_error
(
status
,
"dattach database"
))
return
;
// TODO: write to storage again?
// and delete temporary file.
dispose_ChildImpl
();
cppu
::
WeakComponentImplHelperBase
::
disposing
();
...
...
connectivity/source/drivers/firebird/FConnection.hxx
Dosyayı görüntüle @
66a716a5
...
...
@@ -108,12 +108,15 @@ namespace connectivity
sal_Bool
m_bClosed
;
sal_Bool
m_bUseCatalog
;
// should we use the catalog on filebased databases
sal_Bool
m_bUseOldDateFormat
;
sal_Bool
m_bAutoCommit
;
isc_db_handle
m_DBHandler
;
isc_tr_handle
m_transactionHandle
;
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
embed
::
XStorage
>
m_xEmbeddedStorage
;
void
buildTypeInfo
()
throw
(
::
com
::
sun
::
star
::
sdbc
::
SQLException
);
void
setupTransaction
();
public
:
virtual
void
construct
(
const
::
rtl
::
OUString
&
url
,
const
::
com
::
sun
::
star
::
uno
::
Sequence
<
::
com
::
sun
::
star
::
beans
::
PropertyValue
>&
info
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment