[Libreoffice-commits] core.git: Branch 'aoo/trunk' - wizards/com

Damjan Jovanovic damjan at apache.org
Sat Nov 7 12:08:08 PST 2015


 wizards/com/sun/star/wizards/db/SQLQueryComposer.java |    4 ++++
 1 file changed, 4 insertions(+)

New commits:
commit 046771cac8605e5826a150e4454eff332b65d517
Author: Damjan Jovanovic <damjan at apache.org>
Date:   Sat Nov 7 18:26:04 2015 +0000

    #i126029# Base query wizard error due to missing quoting of table and column names
    
    During the Base query design wizard,
    com.sun.star.wizards.ui.FilterComponent.getFilterConditions()
    calls
    com.sun.star.wizards.db.SQLQueryComposer.getSelectClause()
    before its
    getFromClause(). However the getSelectClause() needs composedCommandNames
    which is populated only by getFromClause() in order to quote table and column names.
    Without this, table and column names that need quoting (spaces, special characters,
    reserved words) produce errors.

diff --git a/wizards/com/sun/star/wizards/db/SQLQueryComposer.java b/wizards/com/sun/star/wizards/db/SQLQueryComposer.java
index f8ea6aa..37e7c9b 100644
--- a/wizards/com/sun/star/wizards/db/SQLQueryComposer.java
+++ b/wizards/com/sun/star/wizards/db/SQLQueryComposer.java
@@ -83,6 +83,10 @@ public class SQLQueryComposer
 
     public String getSelectClause(boolean _baddAliasFieldNames) throws SQLException
     {
+        // getFromClause() must be called first to populate composedCommandNames,
+        // but it's idempotent, so let's call it now in case the caller didn't already:
+        getFromClause();
+
         String sSelectBaseClause = "SELECT ";
         String sSelectClause = sSelectBaseClause;
         for (int i = 0; i < CurDBMetaData.FieldColumns.length; i++)


More information about the Libreoffice-commits mailing list