summaryrefslogtreecommitdiff
path: root/dbaccess/source/ui/browser
diff options
context:
space:
mode:
authorFrank Schoenheit [fs] <frank.schoenheit@sun.com>2010-09-30 09:49:33 +0200
committerFrank Schoenheit [fs] <frank.schoenheit@sun.com>2010-09-30 09:49:33 +0200
commit13b5be5ec753e5d08ae10b78114147d94a21c152 (patch)
tree7f393c0904c194799b8b04dbc8b8b0a0ca59dc27 /dbaccess/source/ui/browser
parent3f80aa43531aecebaea860c7efbb4c95d9f4b6d0 (diff)
dba34b: #ii109580# impl_sanitizeRowSetClauses_nothrow: completed the check for order column validity
Diffstat (limited to 'dbaccess/source/ui/browser')
-rw-r--r--dbaccess/source/ui/browser/unodatbr.cxx38
1 files changed, 33 insertions, 5 deletions
diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx
index 9e4427a78081..d34ec0c4e11a 100644
--- a/dbaccess/source/ui/browser/unodatbr.cxx
+++ b/dbaccess/source/ui/browser/unodatbr.cxx
@@ -457,8 +457,12 @@ void SbaTableQueryBrowser::impl_sanitizeRowSetClauses_nothrow()
return;
// the tables participating in the statement
- Reference< XTablesSupplier > xSuppTables( xComposer, UNO_QUERY_THROW );
- Reference< XNameAccess > xTableNames( xSuppTables->getTables(), UNO_QUERY_THROW );
+ const Reference< XTablesSupplier > xSuppTables( xComposer, UNO_QUERY_THROW );
+ const Reference< XNameAccess > xTableNames( xSuppTables->getTables(), UNO_QUERY_THROW );
+
+ // the columns participating in the statement
+ const Reference< XColumnsSupplier > xSuppColumns( xComposer, UNO_QUERY_THROW );
+ const Reference< XNameAccess > xColumnNames( xSuppColumns->getColumns(), UNO_QUERY_THROW );
// .............................................................................................................
// check if the order columns apply to tables which really exist in the statement
@@ -469,10 +473,34 @@ void SbaTableQueryBrowser::impl_sanitizeRowSetClauses_nothrow()
{
const Reference< XPropertySet > xOrderColumn( xOrderColumns->getByIndex(c), UNO_QUERY_THROW );
::rtl::OUString sTableName;
- OSL_VERIFY( xOrderColumn->getPropertyValue( PROPERTY_TABLENAME ) >>= sTableName);
+ OSL_VERIFY( xOrderColumn->getPropertyValue( PROPERTY_TABLENAME ) >>= sTableName );
+ ::rtl::OUString sColumnName;
+ OSL_VERIFY( xOrderColumn->getPropertyValue( PROPERTY_NAME ) >>= sColumnName );
+
+ if ( sTableName.getLength() == 0 )
+ {
+ if ( !xColumnNames->hasByName( sColumnName ) )
+ {
+ invalidColumn = true;
+ break;
+ }
+ }
+ else
+ {
+ if ( !xTableNames->hasByName( sTableName ) )
+ {
+ invalidColumn = true;
+ break;
+ }
- if ( !xTableNames->hasByName( sTableName ) )
- invalidColumn = true;
+ const Reference< XColumnsSupplier > xSuppTableColumns( xTableNames->getByName( sTableName ), UNO_QUERY_THROW );
+ const Reference< XNameAccess > xTableColumnNames( xSuppTableColumns->getColumns(), UNO_QUERY_THROW );
+ if ( !xTableColumnNames->hasByName( sColumnName ) )
+ {
+ invalidColumn = true;
+ break;
+ }
+ }
}
if ( invalidColumn )