[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - connectivity/source
Lionel Elie Mamane
lionel at mamane.lu
Fri Mar 4 11:47:44 UTC 2016
connectivity/source/drivers/postgresql/pq_databasemetadata.cxx | 22 +++++++---
1 file changed, 17 insertions(+), 5 deletions(-)
New commits:
commit 95b10e373d117f3ed3e53987aa40a65d1ca6d1a0
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date: Thu Mar 3 19:41:54 2016 +0100
tdf#92538 use proper schema name for type names
Change-Id: I7e428e4530765925bd35c7f4fcde7f95ceb12243
Reviewed-on: https://gerrit.libreoffice.org/22876
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
diff --git a/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx b/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx
index a742d4a..14cb74e 100644
--- a/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx
+++ b/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx
@@ -2192,6 +2192,16 @@ static sal_Int32 getMaxScale( sal_Int32 dataType )
return ret;
}
+namespace
+{
+ OUString construct_full_typename(OUString ns, OUString tn)
+ {
+ if(ns.isEmpty() || ns == "pg_catalog")
+ return tn;
+ else
+ return ns + "." + tn;
+ }
+}
static void pgTypeInfo2ResultSet(
SequenceAnyVector &vec,
@@ -2256,7 +2266,7 @@ static void pgTypeInfo2ResultSet(
row[CREATE_PARAMS] <<= OUString("length, scale");
}
- row[TYPE_NAME] <<= xRow->getString(1);
+ row[TYPE_NAME] <<= construct_full_typename(xRow->getString(6), xRow->getString(1));
row[DATA_TYPE] <<= OUString::number(dataType);
row[PRECISION] <<= OUString::number( precision );
sal_Int32 nullable = xRow->getBoolean(4) ?
@@ -2298,8 +2308,9 @@ static void pgTypeInfo2ResultSet(
"pg_type.typtype AS typtype," //2
"pg_type.typlen AS typlen," //3
"pg_type.typnotnull AS typnotnull," //4
- "pg_type.typname AS typname " //5
- "FROM pg_type "
+ "pg_type.typname AS typname, " //5
+ "pg_namespace.nspname as typns " //6
+ "FROM pg_type LEFT JOIN pg_namespace ON pg_type.typnamespace=pg_namespace.oid "
"WHERE pg_type.typtype = 'b' "
"OR pg_type.typtype = 'p'"
);
@@ -2313,8 +2324,9 @@ static void pgTypeInfo2ResultSet(
"t2.typtype AS typtype,"
"t2.typlen AS typlen,"
"t2.typnotnull AS typnotnull,"
- "t2.typname as realtypname "
- "FROM pg_type as t1 LEFT JOIN pg_type AS t2 ON t1.typbasetype=t2.oid "
+ "t2.typname as realtypname, "
+ "pg_namespace.nspname as typns "
+ "FROM pg_type as t1 LEFT JOIN pg_type AS t2 ON t1.typbasetype=t2.oid LEFT JOIN pg_namespace ON t1.typnamespace=pg_namespace.oid "
"WHERE t1.typtype = 'd'" );
pgTypeInfo2ResultSet( vec, rs );
More information about the Libreoffice-commits
mailing list