diff --git a/resources/function_help/coalesce-en_US b/resources/function_help/coalesce-en_US new file mode 100644 index 00000000000..d3673dc29a5 --- /dev/null +++ b/resources/function_help/coalesce-en_US @@ -0,0 +1,19 @@ +

coalesce() function

+Returns the first non-NULL value from the expression list. +
+This function can take any number of arguments. +

Syntax

+coalesce(expression1, expression2 ...)
+ +

Arguments

+expression - any valid expression or value, irregardless of type. +
+ +

Example

+ +coalesce(NULL, 2) → 2
+coalesce(NULL, 2, 3) → 2
+coalesce(7, NULL, 3*2) → 7

+coalesce("fieldA", "fallbackField", 'ERROR') → value of fieldA if it is non-NULL + else the value of "fallbackField" or the string 'ERROR' if both are NULL
+ diff --git a/src/providers/grass/CMakeLists.txt b/src/providers/grass/CMakeLists.txt index 90d3e2968e4..6b406889fc0 100644 --- a/src/providers/grass/CMakeLists.txt +++ b/src/providers/grass/CMakeLists.txt @@ -92,6 +92,9 @@ TARGET_LINK_LIBRARIES(qgis.g.info ${GRASS_LIBRARY_gproj} ${GDAL_LIBRARY} ) +IF (UNIX) + TARGET_LINK_LIBRARIES(qgis.g.info m) +ENDIF (UNIX) ######################################################## # Install diff --git a/tests/src/core/testqgsexpression.cpp b/tests/src/core/testqgsexpression.cpp index b48afd12bd5..675b3b49dda 100644 --- a/tests/src/core/testqgsexpression.cpp +++ b/tests/src/core/testqgsexpression.cpp @@ -295,6 +295,9 @@ class TestQgsExpression: public QObject QTest::newRow( "condition else" ) << "case when 1=0 then 'bad' else 678 end" << false << QVariant( 678 ); QTest::newRow( "condition null" ) << "case when length(123)=0 then 111 end" << false << QVariant(); QTest::newRow( "condition 2 when" ) << "case when 2>3 then 23 when 3>2 then 32 else 0 end" << false << QVariant( 32 ); + QTest::newRow( "coalesce null" ) << "coalesce(NULL)" << false << QVariant( ); + QTest::newRow( "coalesce mid-null" ) << "coalesce(1, NULL, 3)" << false << QVariant( 1 ); + QTest::newRow( "coalesce exp" ) << "coalesce(NULL, 1+1)" << false << QVariant( 2 ); // Datetime functions QTest::newRow( "to date" ) << "todate('2012-06-28')" << false << QVariant( QDate( 2012, 6, 28 ) );