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
cf921921
Kaydet (Commit)
cf921921
authored
May 27, 2013
tarafından
Javier Fernandez
Kaydeden (comit)
Andrzej J.R. Hunt
Tem 16, 2013
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Properly implementing the connection construction.
Change-Id: I6bb114d871697483a1a4246496f73252e5307534
üst
05fb9dca
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
45 deletions
+35
-45
FConnection.cxx
connectivity/source/drivers/firebird/FConnection.cxx
+30
-44
FConnection.hxx
connectivity/source/drivers/firebird/FConnection.hxx
+5
-1
No files found.
connectivity/source/drivers/firebird/FConnection.cxx
Dosyayı görüntüle @
cf921921
...
@@ -45,6 +45,7 @@
...
@@ -45,6 +45,7 @@
#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
using
namespace
connectivity
::
firebird
;
using
namespace
connectivity
::
firebird
;
using
namespace
connectivity
;
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
using
namespace
com
::
sun
::
star
::
uno
;
using
namespace
com
::
sun
::
star
::
uno
;
...
@@ -62,6 +63,7 @@ OConnection::OConnection(FirebirdDriver* _pDriver)
...
@@ -62,6 +63,7 @@ OConnection::OConnection(FirebirdDriver* _pDriver)
m_bUseOldDateFormat
(
sal_False
)
m_bUseOldDateFormat
(
sal_False
)
{
{
m_pDriver
->
acquire
();
m_pDriver
->
acquire
();
m_DBHandler
=
NULL
;
}
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
OConnection
::~
OConnection
()
OConnection
::~
OConnection
()
...
@@ -78,56 +80,40 @@ void SAL_CALL OConnection::release() throw()
...
@@ -78,56 +80,40 @@ void SAL_CALL OConnection::release() throw()
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
/* Print the status, the SQLCODE, and exit.
* Also, indicate which operation the error occured on.
*/
static
int
pr_error
(
long
*
status
,
char
*
operation
)
{
printf
(
"[
\n
"
);
printf
(
"PROBLEM ON
\"
%s
\"
.
\n
"
,
operation
);
isc_print_status
(
status
);
printf
(
"SQLCODE:%d
\n
"
,
isc_sqlcode
(
status
));
printf
(
"]
\n
"
);
return
1
;
}
void
OConnection
::
construct
(
const
::
rtl
::
OUString
&
url
,
const
Sequence
<
PropertyValue
>&
info
)
throw
(
SQLException
)
void
OConnection
::
construct
(
const
::
rtl
::
OUString
&
url
,
const
Sequence
<
PropertyValue
>&
info
)
throw
(
SQLException
)
{
{
printf
(
"DEBUG !!! connectivity.firebird"
,
"=> OConnection::construct()"
);
osl_atomic_increment
(
&
m_refCount
);
osl_atomic_increment
(
&
m_refCount
);
// some example code how to get the information out of the sequence
// some example code how to get the information out of the sequence
sal_Int32
nLen
=
url
.
indexOf
(
':'
);
ISC_STATUS_ARRAY
status
;
/* status vector */
nLen
=
url
.
indexOf
(
':'
,
nLen
+
1
);
isc_db_handle
db
=
NULL
;
/* database handle */
::
rtl
::
OUString
aDSN
(
"DSN="
),
aUID
,
aPWD
,
aSysDrvSettings
;
aDSN
+=
url
.
copy
(
nLen
+
1
);
if
(
isc_attach_database
(
status
,
0
,
"/home/javi/Firebird/test/new.fdb"
,
&
db
,
0
,
NULL
))
if
(
pr_error
(
status
,
"attach database"
))
const
char
*
pUser
=
"user"
;
return
;
const
char
*
pTimeout
=
"Timeout"
;
const
char
*
pSilent
=
"Silent"
;
m_DBHandler
=
db
;
const
char
*
pPwd
=
"password"
;
const
char
*
pUseCatalog
=
"UseCatalog"
;
const
char
*
pSysDrv
=
"SystemDriverSettings"
;
sal_Int32
nTimeout
=
20
;
sal_Bool
bSilent
=
sal_True
;
const
PropertyValue
*
pBegin
=
info
.
getConstArray
();
const
PropertyValue
*
pEnd
=
pBegin
+
info
.
getLength
();
for
(;
pBegin
!=
pEnd
;
++
pBegin
)
{
if
(
!
pBegin
->
Name
.
compareToAscii
(
pTimeout
))
pBegin
->
Value
>>=
nTimeout
;
else
if
(
!
pBegin
->
Name
.
compareToAscii
(
pSilent
))
pBegin
->
Value
>>=
bSilent
;
else
if
(
!
pBegin
->
Name
.
compareToAscii
(
pUser
))
{
pBegin
->
Value
>>=
aUID
;
aDSN
=
aDSN
+
::
rtl
::
OUString
(
";UID="
)
+
aUID
;
}
else
if
(
!
pBegin
->
Name
.
compareToAscii
(
pPwd
))
{
pBegin
->
Value
>>=
aPWD
;
aDSN
=
aDSN
+
::
rtl
::
OUString
(
";PWD="
)
+
aPWD
;
}
else
if
(
!
pBegin
->
Name
.
compareToAscii
(
pUseCatalog
))
{
pBegin
->
Value
>>=
m_bUseCatalog
;
}
else
if
(
!
pBegin
->
Name
.
compareToAscii
(
pSysDrv
))
{
pBegin
->
Value
>>=
aSysDrvSettings
;
aDSN
+=
::
rtl
::
OUString
(
";"
);
aDSN
+=
aSysDrvSettings
;
}
}
m_sUser
=
aUID
;
osl_atomic_decrement
(
&
m_refCount
);
osl_atomic_decrement
(
&
m_refCount
);
}
}
...
...
connectivity/source/drivers/firebird/FConnection.hxx
Dosyayı görüntüle @
cf921921
...
@@ -50,6 +50,8 @@
...
@@ -50,6 +50,8 @@
#include <map>
#include <map>
#include <ibase.h>
namespace
connectivity
namespace
connectivity
{
{
namespace
firebird
namespace
firebird
...
@@ -64,6 +66,7 @@ namespace connectivity
...
@@ -64,6 +66,7 @@ namespace connectivity
class
FirebirdDriver
;
class
FirebirdDriver
;
class
ODatabaseMetaData
;
class
ODatabaseMetaData
;
typedef
OMetaConnection_BASE
OConnection_BASE
;
// implements basics and text encoding
typedef
OMetaConnection_BASE
OConnection_BASE
;
// implements basics and text encoding
typedef
::
std
::
vector
<
::
connectivity
::
OTypeInfo
>
TTypeInfoVector
;
typedef
::
std
::
vector
<
::
connectivity
::
OTypeInfo
>
TTypeInfoVector
;
typedef
std
::
vector
<
::
com
::
sun
::
star
::
uno
::
WeakReferenceHelper
>
OWeakRefArray
;
typedef
std
::
vector
<
::
com
::
sun
::
star
::
uno
::
WeakReferenceHelper
>
OWeakRefArray
;
...
@@ -99,7 +102,7 @@ namespace connectivity
...
@@ -99,7 +102,7 @@ namespace connectivity
sal_Bool
m_bClosed
;
sal_Bool
m_bClosed
;
sal_Bool
m_bUseCatalog
;
// should we use the catalog on filebased databases
sal_Bool
m_bUseCatalog
;
// should we use the catalog on filebased databases
sal_Bool
m_bUseOldDateFormat
;
sal_Bool
m_bUseOldDateFormat
;
isc_db_handle
m_DBHandler
;
void
buildTypeInfo
()
throw
(
::
com
::
sun
::
star
::
sdbc
::
SQLException
);
void
buildTypeInfo
()
throw
(
::
com
::
sun
::
star
::
sdbc
::
SQLException
);
...
@@ -147,6 +150,7 @@ namespace connectivity
...
@@ -147,6 +150,7 @@ namespace connectivity
// should we use the catalog on filebased databases
// should we use the catalog on filebased databases
inline
sal_Bool
isCatalogUsed
()
const
{
return
m_bUseCatalog
;
}
inline
sal_Bool
isCatalogUsed
()
const
{
return
m_bUseCatalog
;
}
inline
::
rtl
::
OUString
getUserName
()
const
{
return
m_sUser
;
}
inline
::
rtl
::
OUString
getUserName
()
const
{
return
m_sUser
;
}
inline
isc_db_handle
getDBHandler
()
const
{
return
m_DBHandler
;
}
inline
FirebirdDriver
*
getDriver
()
const
{
return
m_pDriver
;}
inline
FirebirdDriver
*
getDriver
()
const
{
return
m_pDriver
;}
inline
rtl_TextEncoding
getTextEncoding
()
const
{
return
m_nTextEncoding
;
}
inline
rtl_TextEncoding
getTextEncoding
()
const
{
return
m_nTextEncoding
;
}
};
};
...
...
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