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
24f26145
Kaydet (Commit)
24f26145
authored
Ock 18, 2001
tarafından
Kai Sommerfeld
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
#82177# - Added support for additional column data ( case-sensitivity, ... ).
üst
b0e3817d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
303 additions
and
51 deletions
+303
-51
resultsetmetadata.hxx
ucbhelper/inc/ucbhelper/resultsetmetadata.hxx
+207
-27
resultsetmetadata.cxx
ucbhelper/source/provider/resultsetmetadata.cxx
+96
-24
No files found.
ucbhelper/inc/ucbhelper/resultsetmetadata.hxx
Dosyayı görüntüle @
24f26145
...
@@ -2,9 +2,9 @@
...
@@ -2,9 +2,9 @@
*
*
* $RCSfile: resultsetmetadata.hxx,v $
* $RCSfile: resultsetmetadata.hxx,v $
*
*
* $Revision: 1.
1.1.1
$
* $Revision: 1.
2
$
*
*
* last change: $Author:
hr $ $Date: 2000-09-18 17:03:37
$
* last change: $Author:
kso $ $Date: 2001-01-18 09:02:53
$
*
*
* The Contents of this file are made available subject to the terms of
* The Contents of this file are made available subject to the terms of
* either of the following licenses
* either of the following licenses
...
@@ -62,6 +62,8 @@
...
@@ -62,6 +62,8 @@
#ifndef _UCBHELPER_RESULTSETMETADATA_HXX
#ifndef _UCBHELPER_RESULTSETMETADATA_HXX
#define _UCBHELPER_RESULTSETMETADATA_HXX
#define _UCBHELPER_RESULTSETMETADATA_HXX
#include <vector>
#ifndef _COM_SUN_STAR_UNO_REFERENCE_HXX_
#ifndef _COM_SUN_STAR_UNO_REFERENCE_HXX_
#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/uno/Reference.hxx>
#endif
#endif
...
@@ -72,6 +74,9 @@
...
@@ -72,6 +74,9 @@
#ifndef _COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_
#ifndef _COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_
#include <com/sun/star/lang/XTypeProvider.hpp>
#include <com/sun/star/lang/XTypeProvider.hpp>
#endif
#endif
#ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_
#include <com/sun/star/sdbc/ColumnValue.hpp>
#endif
#ifndef _COM_SUN_STAR_SDBC_XRESULTSETMETADATA_HPP_
#ifndef _COM_SUN_STAR_SDBC_XRESULTSETMETADATA_HPP_
#include <com/sun/star/sdbc/XResultSetMetaData.hpp>
#include <com/sun/star/sdbc/XResultSetMetaData.hpp>
#endif
#endif
...
@@ -94,16 +99,98 @@ namespace ucb
...
@@ -94,16 +99,98 @@ namespace ucb
//=========================================================================
//=========================================================================
/**
* This is a structure that holds additional meta data for one column
* of a resultset. The default values set in the constructor should be a
* good guess for many UCB use cases.
*/
struct
ResultSetColumnData
{
/** @see ResultSetMetaData::isAutoIncrement */
sal_Bool
isAutoIncrement
;
/** @see ResultSetMetaData::isCaseSensitive */
sal_Bool
isCaseSensitive
;
/** @see ResultSetMetaData::isSearchable */
sal_Bool
isSearchable
;
/** @see ResultSetMetaData::isCurrency */
sal_Bool
isCurrency
;
/** @see ResultSetMetaData::isNullable */
sal_Int32
isNullable
;
/** @see ResultSetMetaData::isSigned */
sal_Bool
isSigned
;
/** @see ResultSetMetaData::getColumnDisplaySize */
sal_Int32
columnDisplaySize
;
/** @see ResultSetMetaData::getColumnLabel */
::
rtl
::
OUString
columnLabel
;
/** @see ResultSetMetaData::getSchemaName */
::
rtl
::
OUString
schemaName
;
/** @see ResultSetMetaData::getPrecision */
sal_Int32
precision
;
/** @see ResultSetMetaData::getScale */
sal_Int32
scale
;
/** @see ResultSetMetaData::getTableName */
::
rtl
::
OUString
tableName
;
/** @see ResultSetMetaData::getCatalogName */
::
rtl
::
OUString
catalogName
;
/** @see ResultSetMetaData::getColumnTypeName */
::
rtl
::
OUString
columnTypeName
;
/** @see ResultSetMetaData::isReadOnly */
sal_Bool
isReadOnly
;
/** @see ResultSetMetaData::isWritable */
sal_Bool
isWritable
;
/** @see ResultSetMetaData::isDefinitelyWritable */
sal_Bool
isDefinitelyWritable
;
/** @see ResultSetMetaData::getColumnServiceName */
::
rtl
::
OUString
columnServiceName
;
inline
ResultSetColumnData
();
};
// Note: Never change the initial values! Implementations using this struct
// may havily depend on the behaviour of the default constructor.
ResultSetColumnData
::
ResultSetColumnData
()
:
isAutoIncrement
(
sal_False
),
isCaseSensitive
(
sal_False
),
isSearchable
(
sal_False
),
isCurrency
(
sal_False
),
isNullable
(
::
com
::
sun
::
star
::
sdbc
::
ColumnValue
::
NULLABLE
),
isSigned
(
sal_False
),
columnDisplaySize
(
16
),
precision
(
-
1
),
scale
(
0
),
isReadOnly
(
sal_True
),
isWritable
(
sal_False
),
isDefinitelyWritable
(
sal_False
)
{
}
//=========================================================================
struct
ResultSetMetaData_Impl
;
struct
ResultSetMetaData_Impl
;
/**
/**
* This is a simple implementation of the interface XResultSetMetaData.
* This is an implementation of the interface XResultSetMetaData. It can be
* Some methods will simply return standard values. Other calculating the
* used to implement the interface
* return values using the property sequence provided to the constructor of
* com::sun::star::sdbc::XResultSetMetaDataSupplier, which is required for
* this class.
* implementations of service com.sun.star.ucb.ContentResultSet.
* One can derive from this class, if other implementations of any methods
* is needed, but for many cases this implementation should do good guesses
* for many use cases.
*/
*/
class
ResultSetMetaData
:
class
ResultSetMetaData
:
public
::
cppu
::
OWeakObject
,
public
::
cppu
::
OWeakObject
,
...
@@ -138,6 +225,26 @@ public:
...
@@ -138,6 +225,26 @@ public:
::
com
::
sun
::
star
::
beans
::
Property
>&
rProps
,
::
com
::
sun
::
star
::
beans
::
Property
>&
rProps
,
sal_Bool
bReadOnly
=
sal_True
);
sal_Bool
bReadOnly
=
sal_True
);
/**
* Constructor.
*
* @param rxSMgr is a Servive Manager.
* @param rProps is a sequence of properties (partially) describing the
* columns of a resultset.
* @param rColumnData contains additional meta data for the columns of
* a resultset, which override the default values returned by the
* appropriate methods of this class. The length of rColumnData
* must be the same as length of rProps.
* rColumnData[ 0 ] corresponds to data in rProps[ 0 ],
* rColumnData[ 1 ] corresponds to data in rProps[ 1 ], ...
*/
ResultSetMetaData
(
const
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
lang
::
XMultiServiceFactory
>&
rxSMgr
,
const
::
com
::
sun
::
star
::
uno
::
Sequence
<
::
com
::
sun
::
star
::
beans
::
Property
>&
rProps
,
const
std
::
vector
<
ResultSetColumnData
>&
rColumnData
);
/**
/**
* Destructor.
* Destructor.
*/
*/
...
@@ -150,7 +257,10 @@ public:
...
@@ -150,7 +257,10 @@ public:
XTYPEPROVIDER_DECL
()
XTYPEPROVIDER_DECL
()
// XResultSetMetaData
// XResultSetMetaData
/**
/**
* Returns the number of columns of the resultset.
*
* @return the length of the property sequence.
* @return the length of the property sequence.
*/
*/
virtual
sal_Int32
SAL_CALL
virtual
sal_Int32
SAL_CALL
...
@@ -158,78 +268,102 @@ public:
...
@@ -158,78 +268,102 @@ public:
throw
(
::
com
::
sun
::
star
::
sdbc
::
SQLException
,
throw
(
::
com
::
sun
::
star
::
sdbc
::
SQLException
,
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
/**
/**
* Checks whether column is automatically numbered, which makes it
* read-only.
*
* @param column is the number of the column for that a value shall
* @param column is the number of the column for that a value shall
* be returned. The first column is 1, the second is 2, ...
* be returned. The first column is 1, the second is 2, ...
* @return t
he value of member m_bReadOnly
.
* @return t
rue, if column is automatically numbered
.
*/
*/
virtual
sal_Bool
SAL_CALL
virtual
sal_Bool
SAL_CALL
isAutoIncrement
(
sal_Int32
column
)
isAutoIncrement
(
sal_Int32
column
)
throw
(
::
com
::
sun
::
star
::
sdbc
::
SQLException
,
throw
(
::
com
::
sun
::
star
::
sdbc
::
SQLException
,
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
/**
/**
* Checks whether column is case sensitive.
*
* @param column is the number of the column for that a value shall
* @param column is the number of the column for that a value shall
* be returned. The first column is 1, the second is 2, ...
* be returned. The first column is 1, the second is 2, ...
* @return
always tru
e.
* @return
true, if column is case sensitiv
e.
*/
*/
virtual
sal_Bool
SAL_CALL
virtual
sal_Bool
SAL_CALL
isCaseSensitive
(
sal_Int32
column
)
isCaseSensitive
(
sal_Int32
column
)
throw
(
::
com
::
sun
::
star
::
sdbc
::
SQLException
,
throw
(
::
com
::
sun
::
star
::
sdbc
::
SQLException
,
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
/**
/**
* Checks whether the value stored in column can be used in a
* WHERE clause.
*
* @param column is the number of the column for that a value shall
* @param column is the number of the column for that a value shall
* be returned. The first column is 1, the second is 2, ...
* be returned. The first column is 1, the second is 2, ...
* @return
always fals
e.
* @return
true, if the column is searchabl
e.
*/
*/
virtual
sal_Bool
SAL_CALL
virtual
sal_Bool
SAL_CALL
isSearchable
(
sal_Int32
column
)
isSearchable
(
sal_Int32
column
)
throw
(
::
com
::
sun
::
star
::
sdbc
::
SQLException
,
throw
(
::
com
::
sun
::
star
::
sdbc
::
SQLException
,
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
/**
/**
* Checks whether column is a cash value.
*
* @param column is the number of the column for that a value shall
* @param column is the number of the column for that a value shall
* be returned. The first column is 1, the second is 2, ...
* be returned. The first column is 1, the second is 2, ...
* @return
always fals
e.
* @return
true, if the column is a cash valu
e.
*/
*/
virtual
sal_Bool
SAL_CALL
virtual
sal_Bool
SAL_CALL
isCurrency
(
sal_Int32
column
)
isCurrency
(
sal_Int32
column
)
throw
(
::
com
::
sun
::
star
::
sdbc
::
SQLException
,
throw
(
::
com
::
sun
::
star
::
sdbc
::
SQLException
,
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
/**
/**
* Checks whether a NULL can be stored in column.
*
* @see com::sun::star::sdbc::ColumnValue
*
* @param column is the number of the column for that a value shall
* @param column is the number of the column for that a value shall
* be returned. The first column is 1, the second is 2, ...
* be returned. The first column is 1, the second is 2, ...
* @return always ColumnValue::NULLABLE.
* @return ::com::sun::star::sdbc::ColumnValue::NULLABLE, if a NULL
* can be stored in the column.
*/
*/
virtual
sal_Int32
SAL_CALL
virtual
sal_Int32
SAL_CALL
isNullable
(
sal_Int32
column
)
isNullable
(
sal_Int32
column
)
throw
(
::
com
::
sun
::
star
::
sdbc
::
SQLException
,
throw
(
::
com
::
sun
::
star
::
sdbc
::
SQLException
,
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
/**
/**
* Checks whether the value stored in column is a signed number.
*
* @param column is the number of the column for that a value shall
* @param column is the number of the column for that a value shall
* be returned. The first column is 1, the second is 2, ...
* be returned. The first column is 1, the second is 2, ...
* @return
always false
.
* @return
true, if the value stored in column is a signed number
.
*/
*/
virtual
sal_Bool
SAL_CALL
virtual
sal_Bool
SAL_CALL
isSigned
(
sal_Int32
column
)
isSigned
(
sal_Int32
column
)
throw
(
::
com
::
sun
::
star
::
sdbc
::
SQLException
,
throw
(
::
com
::
sun
::
star
::
sdbc
::
SQLException
,
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
/**
/**
* Gets the normal maximum width in characters for column.
*
* @param column is the number of the column for that a value shall
* @param column is the number of the column for that a value shall
* be returned. The first column is 1, the second is 2, ...
* be returned. The first column is 1, the second is 2, ...
* @return
always 16
.
* @return
the normal maximum width in characters for column
.
*/
*/
virtual
sal_Int32
SAL_CALL
virtual
sal_Int32
SAL_CALL
getColumnDisplaySize
(
sal_Int32
column
)
getColumnDisplaySize
(
sal_Int32
column
)
throw
(
::
com
::
sun
::
star
::
sdbc
::
SQLException
,
throw
(
::
com
::
sun
::
star
::
sdbc
::
SQLException
,
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
/**
/**
* Gets the suggested column title for column, to be used in print-
* outs and displays.
*
* @param column is the number of the column for that a value shall
* @param column is the number of the column for that a value shall
* be returned. The first column is 1, the second is 2, ...
* be returned. The first column is 1, the second is 2, ...
* @return the
name of the property that corresponds to column
.
* @return the
column label
.
*/
*/
virtual
::
rtl
::
OUString
SAL_CALL
virtual
::
rtl
::
OUString
SAL_CALL
getColumnLabel
(
sal_Int32
column
)
getColumnLabel
(
sal_Int32
column
)
throw
(
::
com
::
sun
::
star
::
sdbc
::
SQLException
,
throw
(
::
com
::
sun
::
star
::
sdbc
::
SQLException
,
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
/**
/**
* Gets the name of column.
*
* @param column is the number of the column for that a value shall
* @param column is the number of the column for that a value shall
* be returned. The first column is 1, the second is 2, ...
* be returned. The first column is 1, the second is 2, ...
* @return the name of the property that corresponds to column.
* @return the name of the property that corresponds to column.
...
@@ -239,36 +373,55 @@ public:
...
@@ -239,36 +373,55 @@ public:
throw
(
::
com
::
sun
::
star
::
sdbc
::
SQLException
,
throw
(
::
com
::
sun
::
star
::
sdbc
::
SQLException
,
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
/**
/**
* Gets the schema name for the table from which column of this
* result set was derived.
* Because this feature is not widely supported, the return value
* for many DBMSs will be an empty string.
*
* @param column is the number of the column for that a value shall
* @param column is the number of the column for that a value shall
* be returned. The first column is 1, the second is 2, ...
* be returned. The first column is 1, the second is 2, ...
* @return
always
an empty string.
* @return
the schema name of column or
an empty string.
*/
*/
virtual
::
rtl
::
OUString
SAL_CALL
virtual
::
rtl
::
OUString
SAL_CALL
getSchemaName
(
sal_Int32
column
)
getSchemaName
(
sal_Int32
column
)
throw
(
::
com
::
sun
::
star
::
sdbc
::
SQLException
,
throw
(
::
com
::
sun
::
star
::
sdbc
::
SQLException
,
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
/**
/**
* For number types, getprecision gets the number of decimal digits
* in column.
* For character types, it gets the maximum length in characters for
* column.
* For binary types, it gets the maximum length in bytes for column.
*
* @param column is the number of the column for that a value shall
* @param column is the number of the column for that a value shall
* be returned. The first column is 1, the second is 2, ...
* be returned. The first column is 1, the second is 2, ...
* @return
always -1
.
* @return
the precision for the column
.
*/
*/
virtual
sal_Int32
SAL_CALL
virtual
sal_Int32
SAL_CALL
getPrecision
(
sal_Int32
column
)
getPrecision
(
sal_Int32
column
)
throw
(
::
com
::
sun
::
star
::
sdbc
::
SQLException
,
throw
(
::
com
::
sun
::
star
::
sdbc
::
SQLException
,
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
/**
/**
* Gets the number of digits to the right of the decimal point for
* values in column.
*
* @param column is the number of the column for that a value shall
* @param column is the number of the column for that a value shall
* be returned. The first column is 1, the second is 2, ...
* be returned. The first column is 1, the second is 2, ...
* @return
always 0
.
* @return
the scale of the column
.
*/
*/
virtual
sal_Int32
SAL_CALL
virtual
sal_Int32
SAL_CALL
getScale
(
sal_Int32
column
)
getScale
(
sal_Int32
column
)
throw
(
::
com
::
sun
::
star
::
sdbc
::
SQLException
,
throw
(
::
com
::
sun
::
star
::
sdbc
::
SQLException
,
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
/**
/**
* Gets the name of the table from which column of this result set
* was derived or "" if there is none (for example, for a join).
* Because this feature is not widely supported, the return value
* for many DBMSs will be an empty string.
*
* @param column is the number of the column for that a value shall
* @param column is the number of the column for that a value shall
* be returned. The first column is 1, the second is 2, ...
* be returned. The first column is 1, the second is 2, ...
* @return
always
an empty string.
* @return
the table name for column or
an empty string.
*/
*/
virtual
::
rtl
::
OUString
SAL_CALL
virtual
::
rtl
::
OUString
SAL_CALL
getTableName
(
sal_Int32
column
)
getTableName
(
sal_Int32
column
)
...
@@ -276,14 +429,24 @@ public:
...
@@ -276,14 +429,24 @@ public:
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
virtual
::
rtl
::
OUString
SAL_CALL
virtual
::
rtl
::
OUString
SAL_CALL
/**
/**
* Gets the catalog name for the table from which column of this
* result set was derived.
* Because this feature is not widely supported, the return value
* for many DBMSs will be an empty string.
*
* @param column is the number of the column for that a value shall
* @param column is the number of the column for that a value shall
* be returned. The first column is 1, the second is 2, ...
* be returned. The first column is 1, the second is 2, ...
* @return
always
an empty string.
* @return
the catalog name for column or
an empty string.
*/
*/
getCatalogName
(
sal_Int32
column
)
getCatalogName
(
sal_Int32
column
)
throw
(
::
com
::
sun
::
star
::
sdbc
::
SQLException
,
throw
(
::
com
::
sun
::
star
::
sdbc
::
SQLException
,
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
/**
/**
* Gets the JDBC type for the value stored in column. ... The STRUCT
* and DISTINCT type codes are always returned for structured and
* distinct types, regardless of whether the value will be mapped
* according to the standard mapping or be a custom mapping.
*
* @param column is the number of the column for that a value shall
* @param column is the number of the column for that a value shall
* be returned. The first column is 1, the second is 2, ...
* be returned. The first column is 1, the second is 2, ...
* @return the type of the property that corresponds to column - mapped
* @return the type of the property that corresponds to column - mapped
...
@@ -294,45 +457,62 @@ public:
...
@@ -294,45 +457,62 @@ public:
throw
(
::
com
::
sun
::
star
::
sdbc
::
SQLException
,
throw
(
::
com
::
sun
::
star
::
sdbc
::
SQLException
,
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
/**
/**
* Gets the type name used by this particular data source for the
* values stored in column. If the type code for the type of value
* stored in column is STRUCT, DISTINCT or JAVA_OBJECT, this method
* returns a fully-qualified SQL type name.
*
* @param column is the number of the column for that a value shall
* @param column is the number of the column for that a value shall
* be returned. The first column is 1, the second is 2, ...
* be returned. The first column is 1, the second is 2, ...
* @return
always an empty string
.
* @return
the column type name
.
*/
*/
virtual
::
rtl
::
OUString
SAL_CALL
virtual
::
rtl
::
OUString
SAL_CALL
getColumnTypeName
(
sal_Int32
column
)
getColumnTypeName
(
sal_Int32
column
)
throw
(
::
com
::
sun
::
star
::
sdbc
::
SQLException
,
throw
(
::
com
::
sun
::
star
::
sdbc
::
SQLException
,
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
/**
/**
* Indicates whether a column is definitely not writable.
*
* @param column is the number of the column for that a value shall
* @param column is the number of the column for that a value shall
* be returned. The first column is 1, the second is 2, ...
* be returned. The first column is 1, the second is 2, ...
* @return t
he value of member m_bReadOnly
.
* @return t
rue, if the column is definetely not writable
.
*/
*/
virtual
sal_Bool
SAL_CALL
virtual
sal_Bool
SAL_CALL
isReadOnly
(
sal_Int32
column
)
isReadOnly
(
sal_Int32
column
)
throw
(
::
com
::
sun
::
star
::
sdbc
::
SQLException
,
throw
(
::
com
::
sun
::
star
::
sdbc
::
SQLException
,
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
/**
/**
* Indicates whether it is possible for a write on the column to succeed.
*
* @param column is the number of the column for that a value shall
* @param column is the number of the column for that a value shall
* be returned. The first column is 1, the second is 2, ...
* be returned. The first column is 1, the second is 2, ...
* @return t
he inverted value of member m_bReadOnly
.
* @return t
rue, if it is possible for a write to succeed
.
*/
*/
virtual
sal_Bool
SAL_CALL
virtual
sal_Bool
SAL_CALL
isWritable
(
sal_Int32
column
)
isWritable
(
sal_Int32
column
)
throw
(
::
com
::
sun
::
star
::
sdbc
::
SQLException
,
throw
(
::
com
::
sun
::
star
::
sdbc
::
SQLException
,
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
/**
/**
* Indicates whether a write on the column will definitely succeed.
*
* @param column is the number of the column for that a value shall
* @param column is the number of the column for that a value shall
* be returned. The first column is 1, the second is 2, ...
* be returned. The first column is 1, the second is 2, ...
* @return t
he inverted value of member m_bReadOnly
.
* @return t
rue, if a write on the column will definetely succeed
.
*/
*/
virtual
sal_Bool
SAL_CALL
virtual
sal_Bool
SAL_CALL
isDefinitelyWritable
(
sal_Int32
column
)
isDefinitelyWritable
(
sal_Int32
column
)
throw
(
::
com
::
sun
::
star
::
sdbc
::
SQLException
,
throw
(
::
com
::
sun
::
star
::
sdbc
::
SQLException
,
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
/**
/**
* Returns the fully-qualified name of the service whose instances
* are manufactured if the method
* com::sun::star::sdbc::ResultSet::getObject is called to retrieve a
* value from the column.
*
* @param column is the number of the column for that a value shall
* @param column is the number of the column for that a value shall
* be returned. The first column is 1, the second is 2, ...
* be returned. The first column is 1, the second is 2, ...
* @return always an empty string.
* @return the service name for column or an empty string, if no service
* is applicable.
*/
*/
virtual
::
rtl
::
OUString
SAL_CALL
virtual
::
rtl
::
OUString
SAL_CALL
getColumnServiceName
(
sal_Int32
column
)
getColumnServiceName
(
sal_Int32
column
)
...
...
ucbhelper/source/provider/resultsetmetadata.cxx
Dosyayı görüntüle @
24f26145
...
@@ -2,9 +2,9 @@
...
@@ -2,9 +2,9 @@
*
*
* $RCSfile: resultsetmetadata.cxx,v $
* $RCSfile: resultsetmetadata.cxx,v $
*
*
* $Revision: 1.
1.1.1
$
* $Revision: 1.
2
$
*
*
* last change: $Author:
hr $ $Date: 2000-09-18 17:03:37
$
* last change: $Author:
kso $ $Date: 2001-01-18 09:03:55
$
*
*
* The Contents of this file are made available subject to the terms of
* The Contents of this file are made available subject to the terms of
* either of the following licenses
* either of the following licenses
...
@@ -63,10 +63,12 @@
...
@@ -63,10 +63,12 @@
TODO
TODO
**************************************************************************
**************************************************************************
- Search for @@@ in this file to find out what's to do
*************************************************************************/
*************************************************************************/
#ifndef _VOS_DIAGNOSE_HXX_
#include <vos/diagnose.hxx>
#endif
#ifndef _COM_SUN_STAR_BEANS_PROPERTY_HPP_
#ifndef _COM_SUN_STAR_BEANS_PROPERTY_HPP_
#include <com/sun/star/beans/Property.hpp>
#include <com/sun/star/beans/Property.hpp>
#endif
#endif
...
@@ -79,9 +81,6 @@
...
@@ -79,9 +81,6 @@
#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#endif
#endif
#ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_
#include <com/sun/star/sdbc/ColumnValue.hpp>
#endif
#ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_
#ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_
#include <com/sun/star/sdbc/DataType.hpp>
#include <com/sun/star/sdbc/DataType.hpp>
#endif
#endif
...
@@ -126,9 +125,18 @@ namespace ucb
...
@@ -126,9 +125,18 @@ namespace ucb
struct
ResultSetMetaData_Impl
struct
ResultSetMetaData_Impl
{
{
osl
::
Mutex
m_aMutex
;
osl
::
Mutex
m_aMutex
;
std
::
vector
<
ResultSetColumnData
>
m_aColumnData
;
sal_Bool
m_bObtainedTypes
;
sal_Bool
m_bObtainedTypes
;
sal_Bool
m_bGlobalReadOnlyValue
;
ResultSetMetaData_Impl
()
:
m_bObtainedTypes
(
sal_False
)
{}
ResultSetMetaData_Impl
(
sal_Int32
nSize
)
:
m_aColumnData
(
nSize
),
m_bObtainedTypes
(
sal_False
),
m_bGlobalReadOnlyValue
(
sal_True
)
{}
ResultSetMetaData_Impl
(
const
std
::
vector
<
ResultSetColumnData
>&
rColumnData
)
:
m_aColumnData
(
rColumnData
),
m_bObtainedTypes
(
sal_False
),
m_bGlobalReadOnlyValue
(
sal_False
)
{}
};
};
}
}
...
@@ -145,13 +153,27 @@ ResultSetMetaData::ResultSetMetaData(
...
@@ -145,13 +153,27 @@ ResultSetMetaData::ResultSetMetaData(
const
Reference
<
XMultiServiceFactory
>&
rxSMgr
,
const
Reference
<
XMultiServiceFactory
>&
rxSMgr
,
const
Sequence
<
Property
>&
rProps
,
const
Sequence
<
Property
>&
rProps
,
sal_Bool
bReadOnly
)
sal_Bool
bReadOnly
)
:
m_pImpl
(
new
ResultSetMetaData_Impl
),
:
m_pImpl
(
new
ResultSetMetaData_Impl
(
rProps
.
getLength
()
)
),
m_xSMgr
(
rxSMgr
),
m_xSMgr
(
rxSMgr
),
m_aProps
(
rProps
),
m_aProps
(
rProps
),
m_bReadOnly
(
bReadOnly
)
m_bReadOnly
(
bReadOnly
)
{
{
}
}
//=========================================================================
ResultSetMetaData
::
ResultSetMetaData
(
const
Reference
<
XMultiServiceFactory
>&
rxSMgr
,
const
Sequence
<
Property
>&
rProps
,
const
std
::
vector
<
ResultSetColumnData
>&
rColumnData
)
:
m_pImpl
(
new
ResultSetMetaData_Impl
(
rColumnData
)
),
m_xSMgr
(
rxSMgr
),
m_aProps
(
rProps
),
m_bReadOnly
(
sal_True
)
{
VOS_ENSURE
(
rColumnData
.
size
()
==
sal_uInt32
(
rProps
.
getLength
()
),
"ResultSetMetaData ctor - different array sizes!"
);
}
//=========================================================================
//=========================================================================
// virtual
// virtual
ResultSetMetaData
::~
ResultSetMetaData
()
ResultSetMetaData
::~
ResultSetMetaData
()
...
@@ -202,7 +224,10 @@ sal_Bool SAL_CALL ResultSetMetaData::isAutoIncrement( sal_Int32 column )
...
@@ -202,7 +224,10 @@ sal_Bool SAL_CALL ResultSetMetaData::isAutoIncrement( sal_Int32 column )
read-only.
read-only.
*/
*/
return
m_bReadOnly
;
if
(
(
column
<
1
)
||
(
column
>
m_aProps
.
getLength
()
)
)
return
sal_False
;
return
m_pImpl
->
m_aColumnData
[
column
-
1
].
isAutoIncrement
;
}
}
//=========================================================================
//=========================================================================
...
@@ -210,8 +235,10 @@ sal_Bool SAL_CALL ResultSetMetaData::isAutoIncrement( sal_Int32 column )
...
@@ -210,8 +235,10 @@ sal_Bool SAL_CALL ResultSetMetaData::isAutoIncrement( sal_Int32 column )
sal_Bool
SAL_CALL
ResultSetMetaData
::
isCaseSensitive
(
sal_Int32
column
)
sal_Bool
SAL_CALL
ResultSetMetaData
::
isCaseSensitive
(
sal_Int32
column
)
throw
(
SQLException
,
RuntimeException
)
throw
(
SQLException
,
RuntimeException
)
{
{
// @@@
if
(
(
column
<
1
)
||
(
column
>
m_aProps
.
getLength
()
)
)
return
sal_False
;
return
sal_False
;
return
m_pImpl
->
m_aColumnData
[
column
-
1
].
isCaseSensitive
;
}
}
//=========================================================================
//=========================================================================
...
@@ -224,8 +251,10 @@ sal_Bool SAL_CALL ResultSetMetaData::isSearchable( sal_Int32 column )
...
@@ -224,8 +251,10 @@ sal_Bool SAL_CALL ResultSetMetaData::isSearchable( sal_Int32 column )
WHERE clause.
WHERE clause.
*/
*/
// @@@
if
(
(
column
<
1
)
||
(
column
>
m_aProps
.
getLength
()
)
)
return
sal_False
;
return
sal_False
;
return
m_pImpl
->
m_aColumnData
[
column
-
1
].
isSearchable
;
}
}
//=========================================================================
//=========================================================================
...
@@ -237,8 +266,10 @@ sal_Bool SAL_CALL ResultSetMetaData::isCurrency( sal_Int32 column )
...
@@ -237,8 +266,10 @@ sal_Bool SAL_CALL ResultSetMetaData::isCurrency( sal_Int32 column )
Checks whether column is a cash value.
Checks whether column is a cash value.
*/
*/
// @@@
if
(
(
column
<
1
)
||
(
column
>
m_aProps
.
getLength
()
)
)
return
sal_False
;
return
sal_False
;
return
m_pImpl
->
m_aColumnData
[
column
-
1
].
isCurrency
;
}
}
//=========================================================================
//=========================================================================
...
@@ -251,9 +282,10 @@ sal_Int32 SAL_CALL ResultSetMetaData::isNullable( sal_Int32 column )
...
@@ -251,9 +282,10 @@ sal_Int32 SAL_CALL ResultSetMetaData::isNullable( sal_Int32 column )
Possible values: see com/sun/star/sdbc/ColumnValue.idl
Possible values: see com/sun/star/sdbc/ColumnValue.idl
*/
*/
// All columns may contain NULL. Think of result sets containing
if
(
(
column
<
1
)
||
(
column
>
m_aProps
.
getLength
()
)
)
// UCB contents of different types...
return
ColumnValue
::
NULLABLE
;
return
ColumnValue
::
NULLABLE
;
return
m_pImpl
->
m_aColumnData
[
column
-
1
].
isNullable
;
}
}
//=========================================================================
//=========================================================================
...
@@ -265,8 +297,10 @@ sal_Bool SAL_CALL ResultSetMetaData::isSigned( sal_Int32 column )
...
@@ -265,8 +297,10 @@ sal_Bool SAL_CALL ResultSetMetaData::isSigned( sal_Int32 column )
Checks whether the value stored in column is a signed number.
Checks whether the value stored in column is a signed number.
*/
*/
// @@@
if
(
(
column
<
1
)
||
(
column
>
m_aProps
.
getLength
()
)
)
return
sal_False
;
return
sal_False
;
return
m_pImpl
->
m_aColumnData
[
column
-
1
].
isSigned
;
}
}
//=========================================================================
//=========================================================================
...
@@ -278,8 +312,10 @@ sal_Int32 SAL_CALL ResultSetMetaData::getColumnDisplaySize( sal_Int32 column )
...
@@ -278,8 +312,10 @@ sal_Int32 SAL_CALL ResultSetMetaData::getColumnDisplaySize( sal_Int32 column )
Gets the normal maximum width in characters for column.
Gets the normal maximum width in characters for column.
*/
*/
// @@@
if
(
(
column
<
1
)
||
(
column
>
m_aProps
.
getLength
()
)
)
return
16
;
return
16
;
return
m_pImpl
->
m_aColumnData
[
column
-
1
].
columnDisplaySize
;
}
}
//=========================================================================
//=========================================================================
...
@@ -295,6 +331,10 @@ OUString SAL_CALL ResultSetMetaData::getColumnLabel( sal_Int32 column )
...
@@ -295,6 +331,10 @@ OUString SAL_CALL ResultSetMetaData::getColumnLabel( sal_Int32 column )
if
(
(
column
<
1
)
||
(
column
>
m_aProps
.
getLength
()
)
)
if
(
(
column
<
1
)
||
(
column
>
m_aProps
.
getLength
()
)
)
return
OUString
();
return
OUString
();
OUString
aLabel
=
m_pImpl
->
m_aColumnData
[
column
-
1
].
columnLabel
;
if
(
aLabel
.
getLength
()
)
return
aLabel
;
return
m_aProps
.
getConstArray
()[
column
-
1
].
Name
;
return
m_aProps
.
getConstArray
()[
column
-
1
].
Name
;
}
}
...
@@ -325,7 +365,10 @@ OUString SAL_CALL ResultSetMetaData::getSchemaName( sal_Int32 column )
...
@@ -325,7 +365,10 @@ OUString SAL_CALL ResultSetMetaData::getSchemaName( sal_Int32 column )
for many DBMSs will be an empty string.
for many DBMSs will be an empty string.
*/
*/
if
(
(
column
<
1
)
||
(
column
>
m_aProps
.
getLength
()
)
)
return
OUString
();
return
OUString
();
return
m_pImpl
->
m_aColumnData
[
column
-
1
].
schemaName
;
}
}
//=========================================================================
//=========================================================================
...
@@ -341,8 +384,10 @@ sal_Int32 SAL_CALL ResultSetMetaData::getPrecision( sal_Int32 column )
...
@@ -341,8 +384,10 @@ sal_Int32 SAL_CALL ResultSetMetaData::getPrecision( sal_Int32 column )
For binary types, it gets the maximum length in bytes for column.
For binary types, it gets the maximum length in bytes for column.
*/
*/
// @@@
if
(
(
column
<
1
)
||
(
column
>
m_aProps
.
getLength
()
)
)
return
-
1
;
return
-
1
;
return
m_pImpl
->
m_aColumnData
[
column
-
1
].
precision
;
}
}
//=========================================================================
//=========================================================================
...
@@ -355,8 +400,10 @@ sal_Int32 SAL_CALL ResultSetMetaData::getScale( sal_Int32 column )
...
@@ -355,8 +400,10 @@ sal_Int32 SAL_CALL ResultSetMetaData::getScale( sal_Int32 column )
values in column.
values in column.
*/
*/
// @@@
if
(
(
column
<
1
)
||
(
column
>
m_aProps
.
getLength
()
)
)
return
0
;
return
0
;
return
m_pImpl
->
m_aColumnData
[
column
-
1
].
scale
;
}
}
//=========================================================================
//=========================================================================
...
@@ -371,7 +418,10 @@ OUString SAL_CALL ResultSetMetaData::getTableName( sal_Int32 column )
...
@@ -371,7 +418,10 @@ OUString SAL_CALL ResultSetMetaData::getTableName( sal_Int32 column )
for many DBMSs will be an empty string.
for many DBMSs will be an empty string.
*/
*/
if
(
(
column
<
1
)
||
(
column
>
m_aProps
.
getLength
()
)
)
return
OUString
();
return
OUString
();
return
m_pImpl
->
m_aColumnData
[
column
-
1
].
tableName
;
}
}
//=========================================================================
//=========================================================================
...
@@ -386,7 +436,10 @@ OUString SAL_CALL ResultSetMetaData::getCatalogName( sal_Int32 column )
...
@@ -386,7 +436,10 @@ OUString SAL_CALL ResultSetMetaData::getCatalogName( sal_Int32 column )
for many DBMSs will be an empty string.
for many DBMSs will be an empty string.
*/
*/
if
(
(
column
<
1
)
||
(
column
>
m_aProps
.
getLength
()
)
)
return
OUString
();
return
OUString
();
return
m_pImpl
->
m_aColumnData
[
column
-
1
].
catalogName
;
}
}
//=========================================================================
//=========================================================================
...
@@ -541,8 +594,7 @@ OUString SAL_CALL ResultSetMetaData::getColumnTypeName( sal_Int32 column )
...
@@ -541,8 +594,7 @@ OUString SAL_CALL ResultSetMetaData::getColumnTypeName( sal_Int32 column )
if
(
(
column
<
1
)
||
(
column
>
m_aProps
.
getLength
()
)
)
if
(
(
column
<
1
)
||
(
column
>
m_aProps
.
getLength
()
)
)
return
OUString
();
return
OUString
();
// @@@ According to DG, the type name may be empty.
return
m_pImpl
->
m_aColumnData
[
column
-
1
].
columnTypeName
;
return
OUString
();
}
}
//=========================================================================
//=========================================================================
...
@@ -550,8 +602,15 @@ OUString SAL_CALL ResultSetMetaData::getColumnTypeName( sal_Int32 column )
...
@@ -550,8 +602,15 @@ OUString SAL_CALL ResultSetMetaData::getColumnTypeName( sal_Int32 column )
sal_Bool
SAL_CALL
ResultSetMetaData
::
isReadOnly
(
sal_Int32
column
)
sal_Bool
SAL_CALL
ResultSetMetaData
::
isReadOnly
(
sal_Int32
column
)
throw
(
SQLException
,
RuntimeException
)
throw
(
SQLException
,
RuntimeException
)
{
{
// ContentResultSet's are completely read-only.
if
(
m_pImpl
->
m_bGlobalReadOnlyValue
)
return
m_bReadOnly
;
return
m_bReadOnly
;
if
(
(
column
<
1
)
||
(
column
>
m_aProps
.
getLength
()
)
)
return
sal_True
;
// autoincrement==true => readonly
return
m_pImpl
->
m_aColumnData
[
column
-
1
].
isAutoIncrement
||
m_pImpl
->
m_aColumnData
[
column
-
1
].
isReadOnly
;
}
}
//=========================================================================
//=========================================================================
...
@@ -559,8 +618,13 @@ sal_Bool SAL_CALL ResultSetMetaData::isReadOnly( sal_Int32 column )
...
@@ -559,8 +618,13 @@ sal_Bool SAL_CALL ResultSetMetaData::isReadOnly( sal_Int32 column )
sal_Bool
SAL_CALL
ResultSetMetaData
::
isWritable
(
sal_Int32
column
)
sal_Bool
SAL_CALL
ResultSetMetaData
::
isWritable
(
sal_Int32
column
)
throw
(
SQLException
,
RuntimeException
)
throw
(
SQLException
,
RuntimeException
)
{
{
// ContentResultSet's are completely read-only.
if
(
m_pImpl
->
m_bGlobalReadOnlyValue
)
return
!
m_bReadOnly
;
return
!
m_bReadOnly
;
if
(
(
column
<
1
)
||
(
column
>
m_aProps
.
getLength
()
)
)
return
sal_False
;
return
m_pImpl
->
m_aColumnData
[
column
-
1
].
isWritable
;
}
}
//=========================================================================
//=========================================================================
...
@@ -568,8 +632,13 @@ sal_Bool SAL_CALL ResultSetMetaData::isWritable( sal_Int32 column )
...
@@ -568,8 +632,13 @@ sal_Bool SAL_CALL ResultSetMetaData::isWritable( sal_Int32 column )
sal_Bool
SAL_CALL
ResultSetMetaData
::
isDefinitelyWritable
(
sal_Int32
column
)
sal_Bool
SAL_CALL
ResultSetMetaData
::
isDefinitelyWritable
(
sal_Int32
column
)
throw
(
SQLException
,
RuntimeException
)
throw
(
SQLException
,
RuntimeException
)
{
{
// ContentResultSet's are completely read-only.
if
(
m_pImpl
->
m_bGlobalReadOnlyValue
)
return
!
m_bReadOnly
;
return
!
m_bReadOnly
;
if
(
(
column
<
1
)
||
(
column
>
m_aProps
.
getLength
()
)
)
return
sal_False
;
return
m_pImpl
->
m_aColumnData
[
column
-
1
].
isDefinitelyWritable
;
}
}
//=========================================================================
//=========================================================================
...
@@ -583,6 +652,9 @@ OUString SAL_CALL ResultSetMetaData::getColumnServiceName( sal_Int32 column )
...
@@ -583,6 +652,9 @@ OUString SAL_CALL ResultSetMetaData::getColumnServiceName( sal_Int32 column )
a value from the column.
a value from the column.
*/
*/
if
(
(
column
<
1
)
||
(
column
>
m_aProps
.
getLength
()
)
)
return
OUString
();
return
OUString
();
return
m_pImpl
->
m_aColumnData
[
column
-
1
].
columnServiceName
;
}
}
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