Overhaul (Updateable)RecordSet properties to semi-sane state
- Set all (Updateable)RecordSet properties in constructors - BaseResultSet: give properties their proper disjoint handle, add IsBookmarkable.
This commit is contained in:
parent
4ab98d4663
commit
04922d5687
5 changed files with 58 additions and 11 deletions
|
@ -93,23 +93,29 @@ static ::cppu::IPropertyArrayHelper & getResultSetPropertyArrayHelper()
|
|||
{
|
||||
static Property aTable[] =
|
||||
{
|
||||
// LEM TODO: this needs to be kept in sync with other, e.g. pq_statics.css:508
|
||||
// Should really share!
|
||||
// At least use for the handles the #define'd values in .hxx file...
|
||||
Property(
|
||||
OUString( RTL_CONSTASCII_USTRINGPARAM("CursorName") ), 0,
|
||||
::getCppuType( (OUString *)0) , 0 ),
|
||||
Property(
|
||||
OUString( RTL_CONSTASCII_USTRINGPARAM("EscapeProcessing") ), 0,
|
||||
OUString( RTL_CONSTASCII_USTRINGPARAM("EscapeProcessing") ), 1,
|
||||
::getBooleanCppuType() , 0 ),
|
||||
Property(
|
||||
OUString( RTL_CONSTASCII_USTRINGPARAM("FetchDirection") ), 0,
|
||||
OUString( RTL_CONSTASCII_USTRINGPARAM("FetchDirection") ), 2,
|
||||
::getCppuType( (sal_Int32 *)0) , 0 ),
|
||||
Property(
|
||||
OUString( RTL_CONSTASCII_USTRINGPARAM("FetchSize") ), 0,
|
||||
OUString( RTL_CONSTASCII_USTRINGPARAM("FetchSize") ), 3,
|
||||
::getCppuType( (sal_Int32 *)0) , 0 ),
|
||||
Property(
|
||||
OUString( RTL_CONSTASCII_USTRINGPARAM("ResultSetConcurrency") ), 0,
|
||||
OUString( RTL_CONSTASCII_USTRINGPARAM("IsBookmarkable") ), 4,
|
||||
::getBooleanCppuType() , 0 ),
|
||||
Property(
|
||||
OUString( RTL_CONSTASCII_USTRINGPARAM("ResultSetConcurrency") ), 5,
|
||||
::getCppuType( (sal_Int32 *)0) , 0 ),
|
||||
Property(
|
||||
OUString( RTL_CONSTASCII_USTRINGPARAM("ResultSetType") ), 0,
|
||||
OUString( RTL_CONSTASCII_USTRINGPARAM("ResultSetType") ), 6,
|
||||
::getCppuType( (sal_Int32 *)0) , 0 )
|
||||
};
|
||||
OSL_ASSERT( sizeof(aTable) / sizeof(Property) == BASERESULTSET_SIZE );
|
||||
|
@ -614,6 +620,7 @@ sal_Bool BaseResultSet::convertFastPropertyValue(
|
|||
break;
|
||||
}
|
||||
case BASERESULTSET_ESCAPE_PROCESSING:
|
||||
case BASERESULTSET_IS_BOOKMARKABLE:
|
||||
{
|
||||
sal_Bool val;
|
||||
bRet = ( rValue >>= val );
|
||||
|
|
|
@ -45,10 +45,11 @@ static const sal_Int32 BASERESULTSET_CURSOR_NAME = 0;
|
|||
static const sal_Int32 BASERESULTSET_ESCAPE_PROCESSING = 1;
|
||||
static const sal_Int32 BASERESULTSET_FETCH_DIRECTION = 2;
|
||||
static const sal_Int32 BASERESULTSET_FETCH_SIZE = 3;
|
||||
static const sal_Int32 BASERESULTSET_RESULT_SET_CONCURRENCY = 4;
|
||||
static const sal_Int32 BASERESULTSET_RESULT_SET_TYPE = 5;
|
||||
static const sal_Int32 BASERESULTSET_IS_BOOKMARKABLE = 4;
|
||||
static const sal_Int32 BASERESULTSET_RESULT_SET_CONCURRENCY = 5;
|
||||
static const sal_Int32 BASERESULTSET_RESULT_SET_TYPE = 6;
|
||||
|
||||
#define BASERESULTSET_SIZE 6
|
||||
#define BASERESULTSET_SIZE 7
|
||||
|
||||
class BaseResultSet : public cppu::OComponentHelper,
|
||||
public cppu::OPropertySetHelper,
|
||||
|
|
|
@ -366,6 +366,10 @@ sal_Bool PreparedStatement::execute( )
|
|||
OStringVector::size_type vars = 0;
|
||||
for( OStringVector::size_type i = 0 ; i < m_splittedStatement.size() ; ++i )
|
||||
{
|
||||
// LEM TODO: instead of this manual mucking with SQL
|
||||
// could we use PQexecParams / PQExecPrepared / ...?
|
||||
// Only snafu is giving the types of the parameters and
|
||||
// that it needs $1, $2, etc instead of "?"
|
||||
const OString &str = m_splittedStatement[i];
|
||||
// printf( "Splitted %d %s\n" , i , str.getStr() );
|
||||
if( isQuoted( str ) )
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
#include "pq_resultset.hxx"
|
||||
#include "pq_resultsetmetadata.hxx"
|
||||
|
||||
#include <com/sun/star/sdbc/FetchDirection.hpp>
|
||||
#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
|
||||
#include <com/sun/star/sdbc/ResultSetType.hpp>
|
||||
#include <com/sun/star/sdbc/DataType.hpp>
|
||||
|
||||
|
@ -81,9 +83,20 @@ ResultSet::ResultSet( const ::rtl::Reference< RefCountedMutex > & refMutex,
|
|||
m_table( table ),
|
||||
m_ppSettings( ppSettings )
|
||||
{
|
||||
// sal_Bool b = sal_True;
|
||||
// m_props[RESULTSET_IS_BOOKMARKABLE] = Any( &b, getBooleanCppuType() );
|
||||
m_props[ BASERESULTSET_RESULT_SET_TYPE] = makeAny(
|
||||
// LEM TODO: shouldn't these things be inherited from the statement or something like that?
|
||||
sal_Bool b = sal_False;
|
||||
// Positioned update/delete not supported, so no cursor name
|
||||
// Fetch direction and size are cursor-specific things, so not used now.
|
||||
// Fetch size not set
|
||||
m_props[ BASERESULTSET_FETCH_DIRECTION ] = makeAny(
|
||||
com::sun::star::sdbc::FetchDirection::UNKNOWN);
|
||||
// No escape processing for now
|
||||
m_props[ BASERESULTSET_ESCAPE_PROCESSING ] = Any( &b, getBooleanCppuType() );
|
||||
// Bookmarks not implemented for now
|
||||
m_props[ BASERESULTSET_IS_BOOKMARKABLE ] = Any( &b, getBooleanCppuType() );
|
||||
m_props[ BASERESULTSET_RESULT_SET_CONCURRENCY ] = makeAny(
|
||||
com::sun::star::sdbc::ResultSetConcurrency::READ_ONLY );
|
||||
m_props[ BASERESULTSET_RESULT_SET_TYPE ] = makeAny(
|
||||
com::sun::star::sdbc::ResultSetType::SCROLL_INSENSITIVE );
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,9 @@
|
|||
#include "pq_sequenceresultset.hxx"
|
||||
#include "pq_resultsetmetadata.hxx"
|
||||
|
||||
#include <com/sun/star/sdbc/FetchDirection.hpp>
|
||||
#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
|
||||
#include <com/sun/star/sdbc/ResultSetType.hpp>
|
||||
#include <com/sun/star/sdbc/XResultSetUpdate.hpp>
|
||||
#include <com/sun/star/sdbc/XRowUpdate.hpp>
|
||||
|
||||
|
@ -70,6 +73,25 @@ protected:
|
|||
m_primaryKey( primaryKey ),
|
||||
m_insertRow( false )
|
||||
{
|
||||
// LEM TODO: this duplicates code in pq_resultset.cxx, except for different value
|
||||
// of ResultSetConcurrency. Baaad.
|
||||
// Why is an updatable ResultSet a sequenceresultset in the first place?
|
||||
// This seems to imply that the whole data is fetched once and kept in memory. BAAAAD.
|
||||
// LEM TODO: shouldn't these things be inherited from the statement or something like that?
|
||||
sal_Bool b = sal_False;
|
||||
// Positioned update/delete not supported, so no cursor name
|
||||
// Fetch direction and size are cursor-specific things, so not used now.
|
||||
// Fetch size not set
|
||||
m_props[ BASERESULTSET_FETCH_DIRECTION ] = com::sun::star::uno::makeAny(
|
||||
com::sun::star::sdbc::FetchDirection::UNKNOWN);
|
||||
// No escape processing for now
|
||||
m_props[ BASERESULTSET_ESCAPE_PROCESSING ] = com::sun::star::uno::Any( &b, getBooleanCppuType() );
|
||||
// Bookmarks not implemented for now
|
||||
m_props[ BASERESULTSET_IS_BOOKMARKABLE ] = com::sun::star::uno::Any( &b, getBooleanCppuType() );
|
||||
m_props[ BASERESULTSET_RESULT_SET_CONCURRENCY ] = com::sun::star::uno::makeAny(
|
||||
com::sun::star::sdbc::ResultSetConcurrency::UPDATABLE );
|
||||
m_props[ BASERESULTSET_RESULT_SET_TYPE ] = com::sun::star::uno::makeAny(
|
||||
com::sun::star::sdbc::ResultSetType::SCROLL_INSENSITIVE );
|
||||
}
|
||||
|
||||
rtl::OUString buildWhereClause();
|
||||
|
|
Loading…
Reference in a new issue