[PATCH libreoffice-4-0] pgsql-sdbc: set tablename even if we do not know the schema

Lionel Elie Mamane (via Code Review) gerrit at gerrit.libreoffice.org
Thu Apr 11 08:05:53 PDT 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/3342

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/42/3342/1

pgsql-sdbc: set tablename even if we do not know the schema

Change-Id: I74c04e1262cc413696a12aca9af603beded7b07f
---
M connectivity/source/drivers/postgresql/pq_statement.cxx
M connectivity/source/drivers/postgresql/pq_tools.cxx
2 files changed, 13 insertions(+), 3 deletions(-)



diff --git a/connectivity/source/drivers/postgresql/pq_statement.cxx b/connectivity/source/drivers/postgresql/pq_statement.cxx
index 7304b15..edf7dc3 100644
--- a/connectivity/source/drivers/postgresql/pq_statement.cxx
+++ b/connectivity/source/drivers/postgresql/pq_statement.cxx
@@ -654,7 +654,7 @@
             }
 
         }
-        else if( sourceTable.getLength() && -1 != sourceTable.indexOf( '.' ) )
+        else if( sourceTable.getLength() > 0)
         {
             splitConcatenatedIdentifier( sourceTable, &schema, &table );
         }
diff --git a/connectivity/source/drivers/postgresql/pq_tools.cxx b/connectivity/source/drivers/postgresql/pq_tools.cxx
index 84d9741..86872a7 100644
--- a/connectivity/source/drivers/postgresql/pq_tools.cxx
+++ b/connectivity/source/drivers/postgresql/pq_tools.cxx
@@ -673,10 +673,20 @@
 {
     OStringVector vec;
     tokenizeSQL( rtl::OUStringToOString( source, RTL_TEXTENCODING_UTF8 ), vec );
-    if( vec.size() == 3 )
+    switch (vec.size())
     {
-        *first = rtl::OStringToOUString( vec[0] , RTL_TEXTENCODING_UTF8 );
+    case 1:
+        *first  = OUString();
+        *second = rtl::OStringToOUString( vec[0], RTL_TEXTENCODING_UTF8 );
+        break;
+    case 3:
+        *first  = rtl::OStringToOUString( vec[0], RTL_TEXTENCODING_UTF8 );
         *second = rtl::OStringToOUString( vec[2], RTL_TEXTENCODING_UTF8 );
+        break;
+    default:
+         SAL_WARN("connectivity.drivers.postgresql",
+                  "pq_tools::splitConcatenatedIdentifier unexpected number of tokens in identifier: "
+                  << vec.size());
     }
 }
 

-- 
To view, visit https://gerrit.libreoffice.org/3342
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I74c04e1262cc413696a12aca9af603beded7b07f
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: libreoffice-4-0
Gerrit-Owner: Lionel Elie Mamane <lionel at mamane.lu>



More information about the LibreOffice mailing list