[Libreoffice-commits] core.git: connectivity/source

Lionel Elie Mamane lionel at mamane.lu
Sun Aug 7 16:53:55 UTC 2016


 connectivity/source/drivers/postgresql/pq_resultsetmetadata.cxx |    4 --
 connectivity/source/drivers/postgresql/pq_tools.cxx             |   14 ----------
 connectivity/source/drivers/postgresql/pq_tools.hxx             |    1 
 connectivity/source/drivers/postgresql/pq_xtable.cxx            |    5 +--
 connectivity/source/drivers/postgresql/pq_xtables.cxx           |    6 +---
 connectivity/source/drivers/postgresql/pq_xtables.hxx           |    2 -
 connectivity/source/drivers/postgresql/pq_xview.cxx             |    5 +--
 connectivity/source/drivers/postgresql/pq_xviews.cxx            |    6 +---
 8 files changed, 10 insertions(+), 33 deletions(-)

New commits:
commit b6976604ca15259af3a3ee95e10d24937bd63b9a
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date:   Thu Jun 23 10:33:38 2016 +0000

    Revert "tdf#67302 Resolving tablesSupplier name clash for postgresql"
    
    As explained in https://bugs.documentfoundation.org/67302
    this is the right thing to do in that directory, but cannot
    be comitted in isolation. All callers of that function in
    all of LibreOffice need to be adapted to the new syntax
    of the returned value (that is that the value is now properly escaped). This needs to be done at the same time in all drivers and all places that call this API (+documented in the release notes).
    
    This reverts commit d43f4390e006716ca538ad92d09bd012179efd66.
    
    Change-Id: I8f33fd68ec09d67dd6d38ae50d8ae156f11c5357
    Reviewed-on: https://gerrit.libreoffice.org/26593
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>

diff --git a/connectivity/source/drivers/postgresql/pq_resultsetmetadata.cxx b/connectivity/source/drivers/postgresql/pq_resultsetmetadata.cxx
index cec6070..c2e64df 100644
--- a/connectivity/source/drivers/postgresql/pq_resultsetmetadata.cxx
+++ b/connectivity/source/drivers/postgresql/pq_resultsetmetadata.cxx
@@ -212,9 +212,7 @@ void ResultSetMetaData::checkTable()
             {
                 const OUString name   (getTableName ( 1 ));
                 const OUString schema (getSchemaName( 1 ));
-                const OUString EscapedName (name.replaceAll("\"","\"\"" ));
-                const OUString EscapedSchema ( schema.replaceAll("\"","\"\""));
-                const OUString composedName( schema.isEmpty() ? name : ("\"" + EscapedSchema + "\".\"" + EscapedName + "\"") );
+                const OUString composedName( schema.isEmpty() ? name : (schema + "." + name) );
                 tables->getByName( composedName ) >>= m_table;
             }
         }
diff --git a/connectivity/source/drivers/postgresql/pq_tools.cxx b/connectivity/source/drivers/postgresql/pq_tools.cxx
index 2d0bc57e..4e6df8b 100644
--- a/connectivity/source/drivers/postgresql/pq_tools.cxx
+++ b/connectivity/source/drivers/postgresql/pq_tools.cxx
@@ -463,20 +463,6 @@ void splitSQL( const OString & sql, OStringVector &vec )
 
 }
 
-void splitDoubleQuoteEscapedIdentifiers( const OUString & source, OUString *first, OUString *second)
-{
-    int a = source.indexOf("\".\"");
-    OString tempstring = OUStringToOString(source , RTL_TEXTENCODING_UTF8);
-    if(a > 0)
-    {
-        //remove start and end double quote as well as escaped double quotes
-        *first =OStringToOUString(OString(&tempstring.getStr()[1],a-2) , RTL_TEXTENCODING_UTF8);
-        *first=first->replaceAll("\"\"","\"");
-        *second =OStringToOUString(OString(&tempstring.getStr()[a+2],source.getLength()-a-2) , RTL_TEXTENCODING_UTF8);
-        *second=second->replaceAll("\"\"","\"");
-    }
-}
-
 void tokenizeSQL( const OString & sql, OStringVector &vec  )
 {
     int length = sql.getLength();
diff --git a/connectivity/source/drivers/postgresql/pq_tools.hxx b/connectivity/source/drivers/postgresql/pq_tools.hxx
index 8c17c28..6ab147c 100644
--- a/connectivity/source/drivers/postgresql/pq_tools.hxx
+++ b/connectivity/source/drivers/postgresql/pq_tools.hxx
@@ -111,7 +111,6 @@ OUString array2String( const css::uno::Sequence< css::uno::Any > &seq );
 css::uno::Reference< css::sdbc::XConnection > extractConnectionFromStatement(
     const css::uno::Reference< css::uno::XInterface > & stmt );
 
-void splitDoubleQuoteEscapedIdentifiers( const OUString & source, OUString *first, OUString *second);
 void splitConcatenatedIdentifier( const OUString & source, OUString *first, OUString *second);
 
 
diff --git a/connectivity/source/drivers/postgresql/pq_xtable.cxx b/connectivity/source/drivers/postgresql/pq_xtable.cxx
index 8e0ae92..4b8d451 100644
--- a/connectivity/source/drivers/postgresql/pq_xtable.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xtable.cxx
@@ -154,13 +154,12 @@ void Table::rename( const OUString& newName )
 
     OUString newTableName;
     OUString newSchemaName;
-    //changing schema + dot + table-name to "schema"."table-name"
     // OOo2.0 passes schema + dot + new-table-name while
     // OO1.1.x passes new Name without schema
     // in case name contains a dot, it is interpreted as schema.tablename
-    if( newName.indexOf( "\".\"" ) >= 0 )
+    if( newName.indexOf( '.' ) >= 0 )
     {
-        splitDoubleQuoteEscapedIdentifiers( newName, &newSchemaName, &newTableName );
+        splitConcatenatedIdentifier( newName, &newSchemaName, &newTableName );
     }
     else
     {
diff --git a/connectivity/source/drivers/postgresql/pq_xtables.cxx b/connectivity/source/drivers/postgresql/pq_xtables.cxx
index ce3a17e..63e6c6a 100644
--- a/connectivity/source/drivers/postgresql/pq_xtables.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xtables.cxx
@@ -133,10 +133,8 @@ void Tables::refresh()
 
             {
                 m_values.push_back( makeAny( prop ) );
-                OUString EscapedName = /* ::dbtools::composeTableNameForSelect(); */ name.replaceAll("\"","\"\"");
-                OUString EscapedSchema = schema.replaceAll("\"","\"\"");
-                OUStringBuffer buf( EscapedName.getLength() + EscapedSchema.getLength() + 1);
-                buf.append("\"" + EscapedSchema + "\".\"" + EscapedName + "\"");
+                OUStringBuffer buf( name.getLength() + schema.getLength() + 1);
+                buf.append( schema + "." + name );
                 map[ buf.makeStringAndClear() ] = tableIndex;
                 ++tableIndex;
             }
diff --git a/connectivity/source/drivers/postgresql/pq_xtables.hxx b/connectivity/source/drivers/postgresql/pq_xtables.hxx
index 9e542ab..c2e45f0 100644
--- a/connectivity/source/drivers/postgresql/pq_xtables.hxx
+++ b/connectivity/source/drivers/postgresql/pq_xtables.hxx
@@ -38,7 +38,7 @@
 #define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_XTABLES_HXX
 
 #include "pq_xcontainer.hxx"
-#include "connectivity/dbtools.hxx"
+
 namespace pq_sdbc_driver
 {
 
diff --git a/connectivity/source/drivers/postgresql/pq_xview.cxx b/connectivity/source/drivers/postgresql/pq_xview.cxx
index 2ed4ece..c42f533 100644
--- a/connectivity/source/drivers/postgresql/pq_xview.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xview.cxx
@@ -102,13 +102,12 @@ void View::rename( const OUString& newName )
 
     OUString newTableName;
     OUString newSchemaName;
-    //changing schema + dot + table-name to "schema"."table-name"
     // OOo2.0 passes schema + dot + new-table-name while
     // OO1.1.x passes new Name without schema
     // in case name contains a dot, it is interpreted as schema.tablename
-    if( newName.indexOf( "\".\"" ) >= 0 )
+    if( newName.indexOf( '.' ) >= 0 )
     {
-        splitDoubleQuoteEscapedIdentifiers( newName, &newSchemaName, &newTableName );
+        splitConcatenatedIdentifier( newName, &newSchemaName, &newTableName );
     }
     else
     {
diff --git a/connectivity/source/drivers/postgresql/pq_xviews.cxx b/connectivity/source/drivers/postgresql/pq_xviews.cxx
index 0e471bc..cd12d58 100644
--- a/connectivity/source/drivers/postgresql/pq_xviews.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xviews.cxx
@@ -114,10 +114,8 @@ void Views::refresh()
 
             {
                 m_values.push_back( makeAny( prop ) );
-                OUString EscapedTable = table.replaceAll("\"","\"\"");
-                OUString EscapedSchema = schema.replaceAll("\"","\"\"");
-                OUStringBuffer buf( EscapedTable.getLength() + EscapedSchema.getLength() + 1);
-                buf.append("\"" + EscapedSchema + "\".\"" + EscapedTable + "\"");
+                OUStringBuffer buf( table.getLength() + schema.getLength() + 1);
+                buf.append( schema + "." + table );
                 map[ buf.makeStringAndClear() ] = viewIndex;
                 ++viewIndex;
             }


More information about the Libreoffice-commits mailing list