summaryrefslogtreecommitdiff
path: root/connectivity
diff options
context:
space:
mode:
authorLionel Elie Mamane <lionel@mamane.lu>2013-04-10 17:16:27 +0200
committerLionel Elie Mamane <lionel@mamane.lu>2013-04-10 18:12:09 +0200
commitfe294e9208cd022acb163aa2f8f27aa0a05d09ca (patch)
tree219b42b0b0207998f5c17bb2987eba4b6d8a3a2f /connectivity
parentb8361945d6aa3690e2ef9eca8b18395602d8b682 (diff)
pgsql-sdbc: set tablename even if we do not know the schema
Change-Id: I74c04e1262cc413696a12aca9af603beded7b07f
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/source/drivers/postgresql/pq_statement.cxx2
-rw-r--r--connectivity/source/drivers/postgresql/pq_tools.cxx14
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 6326da34ec2a..cfbbd9fc7a6a 100644
--- a/connectivity/source/drivers/postgresql/pq_statement.cxx
+++ b/connectivity/source/drivers/postgresql/pq_statement.cxx
@@ -648,7 +648,7 @@ bool executePostgresCommand( const OString & cmd, struct CommandData *data )
}
}
- 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 5ac5626e99e6..ccce76f018c1 100644
--- a/connectivity/source/drivers/postgresql/pq_tools.cxx
+++ b/connectivity/source/drivers/postgresql/pq_tools.cxx
@@ -670,10 +670,20 @@ void splitConcatenatedIdentifier( const OUString & source, OUString *first, OUSt
{
OStringVector vec;
tokenizeSQL( OUStringToOString( source, RTL_TEXTENCODING_UTF8 ), vec );
- if( vec.size() == 3 )
+ switch (vec.size())
{
- *first = OStringToOUString( vec[0] , RTL_TEXTENCODING_UTF8 );
+ case 1:
+ *first = OUString();
+ *second = OStringToOUString( vec[0], RTL_TEXTENCODING_UTF8 );
+ break;
+ case 3:
+ *first = OStringToOUString( vec[0], RTL_TEXTENCODING_UTF8 );
*second = OStringToOUString( vec[2], RTL_TEXTENCODING_UTF8 );
+ break;
+ default:
+ SAL_WARN("connectivity.postgresql",
+ "pq_tools::splitConcatenatedIdentifier unexpected number of tokens in identifier: "
+ << vec.size());
}
}