summaryrefslogtreecommitdiff
path: root/connectivity
diff options
context:
space:
mode:
authorLionel Elie Mamane <lionel@mamane.lu>2011-09-16 17:26:39 +0200
committerLionel Elie Mamane <lionel@mamane.lu>2011-11-17 21:15:30 +0100
commit04922d56872618a9821bbe713294d5155a78a3db (patch)
tree4eb328f71705a077f486c0f6e7e413639bcff4ad /connectivity
parent4ab98d466333ff797a4911bc4dfe51761a487118 (diff)
Overhaul (Updateable)RecordSet properties to semi-sane state
- Set all (Updateable)RecordSet properties in constructors - BaseResultSet: give properties their proper disjoint handle, add IsBookmarkable.
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/source/drivers/postgresql/pq_baseresultset.cxx17
-rw-r--r--connectivity/source/drivers/postgresql/pq_baseresultset.hxx7
-rw-r--r--connectivity/source/drivers/postgresql/pq_preparedstatement.cxx4
-rw-r--r--connectivity/source/drivers/postgresql/pq_resultset.cxx19
-rw-r--r--connectivity/source/drivers/postgresql/pq_updateableresultset.hxx22
5 files changed, 58 insertions, 11 deletions
diff --git a/connectivity/source/drivers/postgresql/pq_baseresultset.cxx b/connectivity/source/drivers/postgresql/pq_baseresultset.cxx
index 3234245dda75..8381c72b6722 100644
--- a/connectivity/source/drivers/postgresql/pq_baseresultset.cxx
+++ b/connectivity/source/drivers/postgresql/pq_baseresultset.cxx
@@ -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 );
diff --git a/connectivity/source/drivers/postgresql/pq_baseresultset.hxx b/connectivity/source/drivers/postgresql/pq_baseresultset.hxx
index b52338436095..6a9ec394696b 100644
--- a/connectivity/source/drivers/postgresql/pq_baseresultset.hxx
+++ b/connectivity/source/drivers/postgresql/pq_baseresultset.hxx
@@ -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,
diff --git a/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx b/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx
index 0c652719df0d..d6b1fc08107d 100644
--- a/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx
+++ b/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx
@@ -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 ) )
diff --git a/connectivity/source/drivers/postgresql/pq_resultset.cxx b/connectivity/source/drivers/postgresql/pq_resultset.cxx
index ad85fb31b0ca..d62557456cec 100644
--- a/connectivity/source/drivers/postgresql/pq_resultset.cxx
+++ b/connectivity/source/drivers/postgresql/pq_resultset.cxx
@@ -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 );
}
diff --git a/connectivity/source/drivers/postgresql/pq_updateableresultset.hxx b/connectivity/source/drivers/postgresql/pq_updateableresultset.hxx
index 869714d878a2..5c5f74f0c71f 100644
--- a/connectivity/source/drivers/postgresql/pq_updateableresultset.hxx
+++ b/connectivity/source/drivers/postgresql/pq_updateableresultset.hxx
@@ -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();