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
54439ff5
Kaydet (Commit)
54439ff5
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 ResultSet class.
Change-Id: Ice2bd493cf016603d372fe7867cf1ec899f52d8b
üst
80eba296
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
31 deletions
+52
-31
FResultSet.cxx
connectivity/source/drivers/firebird/FResultSet.cxx
+51
-30
FResultSet.hxx
connectivity/source/drivers/firebird/FResultSet.hxx
+1
-1
No files found.
connectivity/source/drivers/firebird/FResultSet.cxx
Dosyayı görüntüle @
54439ff5
...
@@ -54,10 +54,23 @@ using namespace com::sun::star::container;
...
@@ -54,10 +54,23 @@ using namespace com::sun::star::container;
using
namespace
com
::
sun
::
star
::
io
;
using
namespace
com
::
sun
::
star
::
io
;
using
namespace
com
::
sun
::
star
::
util
;
using
namespace
com
::
sun
::
star
::
util
;
typedef
struct
vary
{
/*
short
vary_length
;
* Print the status, the SQLCODE, and exit.
char
vary_string
[
1
];
* Also, indicate which operation the error occured on.
}
VARY
;
*/
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
;
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// IMPLEMENT_SERVICE_INFO(OResultSet,"com.sun.star.sdbcx.OResultSet","com.sun.star.sdbc.ResultSet");
// IMPLEMENT_SERVICE_INFO(OResultSet,"com.sun.star.sdbcx.OResultSet","com.sun.star.sdbc.ResultSet");
...
@@ -86,7 +99,7 @@ sal_Bool SAL_CALL OResultSet::supportsService( const ::rtl::OUString& _rServiceN
...
@@ -86,7 +99,7 @@ sal_Bool SAL_CALL OResultSet::supportsService( const ::rtl::OUString& _rServiceN
}
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
OResultSet
::
OResultSet
(
OStatement_Base
*
pStmt
,
TTable
table
,
sal_Int32
rows
,
sal_Int32
fields
)
OResultSet
::
OResultSet
(
OStatement_Base
*
pStmt
)
:
OResultSet_BASE
(
m_aMutex
)
:
OResultSet_BASE
(
m_aMutex
)
,
OPropertySetHelper
(
OResultSet_BASE
::
rBHelper
)
,
OPropertySetHelper
(
OResultSet_BASE
::
rBHelper
)
,
m_aStatement
((
OWeakObject
*
)
pStmt
)
,
m_aStatement
((
OWeakObject
*
)
pStmt
)
...
@@ -95,11 +108,39 @@ OResultSet::OResultSet(OStatement_Base* pStmt, TTable table, sal_Int32 rows, sal
...
@@ -95,11 +108,39 @@ OResultSet::OResultSet(OStatement_Base* pStmt, TTable table, sal_Int32 rows, sal
,
m_pStatement
(
pStmt
)
,
m_pStatement
(
pStmt
)
,
m_bWasNull
(
sal_True
)
,
m_bWasNull
(
sal_True
)
,
m_row
(
-
1
)
,
m_row
(
-
1
)
,
m_rowCount
(
rows
)
,
m_fieldCount
(
fields
)
,
m_sqldata
(
table
)
{
{
isc_stmt_handle
stmt
=
m_pStatement
->
getSTMTHandler
();
XSQLDA
*
sqlda
=
m_pStatement
->
getOUTsqlda
();
if
(
sqlda
==
NULL
)
{
m_rowCount
=
0
;
m_fieldCount
=
0
;
}
else
{
m_rowCount
=
0
;
m_fieldCount
=
sqlda
->
sqld
;
}
ISC_STATUS_ARRAY
status
;
// status vector
ISC_STATUS
retcode
;
int
j
=
0
;
while
((
retcode
=
isc_dsql_fetch
(
status
,
&
stmt
,
1
,
sqlda
))
==
0
)
{
m_rowCount
++
;
TRow
row
(
m_fieldCount
);
XSQLVAR
*
var
=
NULL
;
for
(
j
=
0
,
var
=
sqlda
->
sqlvar
;
j
<
m_fieldCount
;
j
++
,
var
++
)
{
row
[
j
]
=
OUString
(
var
->
sqldata
,
var
->
sqllen
,
RTL_TEXTENCODING_UTF8
);
}
m_sqldata
.
push_back
(
row
);
}
if
(
retcode
!=
100L
)
{
printf
(
"DEBUG !!! retcode %i: "
,
retcode
);
if
(
pr_error
(
status
,
"fetch data"
))
return
;
}
}
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
OResultSet
::~
OResultSet
()
OResultSet
::~
OResultSet
()
...
@@ -325,31 +366,13 @@ sal_Int16 SAL_CALL OResultSet::getShort( sal_Int32 columnIndex ) throw(SQLExcept
...
@@ -325,31 +366,13 @@ sal_Int16 SAL_CALL OResultSet::getShort( sal_Int32 columnIndex ) throw(SQLExcept
::
osl
::
MutexGuard
aGuard
(
m_aMutex
);
::
osl
::
MutexGuard
aGuard
(
m_aMutex
);
checkDisposed
(
OResultSet_BASE
::
rBHelper
.
bDisposed
);
checkDisposed
(
OResultSet_BASE
::
rBHelper
.
bDisposed
);
char
*
str
=
strdup
(
OUStringToOString
(
m_sqldata
[
m_row
][
columnIndex
-
1
]
,
RTL_TEXTENCODING_UTF8
).
getStr
());
sal_Int16
nRet
=
0
;
sal_Int16
nRet
=
*
str
;
return
nRet
;
return
nRet
;
}
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
/*
* 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
;
}
::
rtl
::
OUString
SAL_CALL
OResultSet
::
getString
(
sal_Int32
columnIndex
)
throw
(
SQLException
,
RuntimeException
)
::
rtl
::
OUString
SAL_CALL
OResultSet
::
getString
(
sal_Int32
columnIndex
)
throw
(
SQLException
,
RuntimeException
)
{
{
::
osl
::
MutexGuard
aGuard
(
m_aMutex
);
::
osl
::
MutexGuard
aGuard
(
m_aMutex
);
...
@@ -357,8 +380,6 @@ static int pr_error (long* status, char* operation)
...
@@ -357,8 +380,6 @@ static int pr_error (long* status, char* operation)
checkColumnIndex
(
columnIndex
);
checkColumnIndex
(
columnIndex
);
checkRowIndex
(
sal_True
/* must be on row */
);
checkRowIndex
(
sal_True
/* must be on row */
);
printf
(
"DEBUG !!! OResultSet::getString => row: %i, column: %i
\n
"
,
m_row
,
columnIndex
);
return
m_sqldata
[
m_row
][
columnIndex
-
1
];
return
m_sqldata
[
m_row
][
columnIndex
-
1
];
}
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
...
...
connectivity/source/drivers/firebird/FResultSet.hxx
Dosyayı görüntüle @
54439ff5
...
@@ -123,7 +123,7 @@ namespace connectivity
...
@@ -123,7 +123,7 @@ namespace connectivity
public
:
public
:
DECLARE_SERVICE_INFO
();
DECLARE_SERVICE_INFO
();
OResultSet
(
OStatement_Base
*
pStmt
,
TTable
sqldata
,
sal_Int32
rows
,
sal_Int32
fields
);
OResultSet
(
OStatement_Base
*
pStmt
);
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
uno
::
XInterface
>
operator
*
()
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
uno
::
XInterface
>
operator
*
()
...
...
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