Skip to content
Permalink
Browse files

Fix datasource uri with explicit schema

Fixes #34823
  • Loading branch information
elpaso committed Mar 3, 2020
1 parent 794215d commit e286044eaf8773126a9f21ae4be1497cf6569375
Showing with 11 additions and 1 deletion.
  1. +4 −1 src/core/qgsdatasourceuri.cpp
  2. +7 −0 tests/src/core/testqgsdatasourceuri.cpp
@@ -86,7 +86,6 @@ QgsDataSourceUri::QgsDataSourceUri( const QString &u )
}
else
{
mSchema.clear();
mTable = pval;
}

@@ -118,6 +117,10 @@ QgsDataSourceUri::QgsDataSourceUri( const QString &u )
mGeometryColumn = QString();
}
}
else if ( pname == QLatin1String( "schema" ) )
{
mSchema = pval;
}
else if ( pname == QLatin1String( "key" ) )
{
mKeyColumn = pval;
@@ -50,6 +50,7 @@ void TestQgsDataSourceUri::checkparser_data()
QTest::addColumn<QgsDataSourceUri::SslMode>( "sslmode" );
QTest::addColumn<QString>( "sql" );
QTest::addColumn<QString>( "myparam" );
QTest::addColumn<QString>( "schema" );


QTest::newRow( "oci" )
@@ -71,6 +72,7 @@ void TestQgsDataSourceUri::checkparser_data()
<< QgsDataSourceUri::SslPrefer // sslmode
<< "" // sql
<< "myvalue" // myparam
<< "myschema"
;

QTest::newRow( "pgrast" )
@@ -92,8 +94,10 @@ void TestQgsDataSourceUri::checkparser_data()
<< QgsDataSourceUri::SslPrefer // sslmode
<< "" // sql
<< "" // myparam
<< "public"
;


QTest::newRow( "pgmlsz" )
<< "PG: dbname=mydb host=myhost user=myname password=mypasswd port=5432 mode=2 schema=public column=geom table=mytable type=MultiLineStringZ"
<< "mytable" // table
@@ -113,6 +117,7 @@ void TestQgsDataSourceUri::checkparser_data()
<< QgsDataSourceUri::SslPrefer // sslmode
<< "" // sql
<< "" // myparam
<< "public"
;

QTest::newRow( "DB2" )
@@ -134,6 +139,7 @@ void TestQgsDataSourceUri::checkparser_data()
<< QgsDataSourceUri::SslPrefer // sslmode
<< "" // sql
<< "myvalue" // myparam
<< "TEST"
;
}

@@ -157,6 +163,7 @@ void TestQgsDataSourceUri::checkparser()
QFETCH( QgsDataSourceUri::SslMode, sslmode );
QFETCH( QString, sql );
QFETCH( QString, myparam );
QFETCH( QString, schema );

QgsDataSourceUri ds( uri );
QCOMPARE( ds.table(), table );

0 comments on commit e286044

Please sign in to comment.
You can’t perform that action at this time.