Skip to content

Commit 3a4fa2f

Browse files
committedSep 7, 2012
Merge pull request #225 from lynxlynxlynx/master
linking fix + coalesce tests + coalesce doc
2 parents c5763f9 + 89811ae commit 3a4fa2f

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed
 
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<h3>coalesce() function</h3>
2+
Returns the first non-NULL value from the expression list.
3+
<br>
4+
This function can take any number of arguments.
5+
<h4>Syntax</h4>
6+
<code>coalesce(expression1, expression2 ...)</code><br>
7+
8+
<h4>Arguments</h4>
9+
<code>expression</code> - any valid expression or value, irregardless of type.
10+
<br>
11+
12+
<h4>Example</h4>
13+
<!-- Show example of function.-->
14+
<code>coalesce(NULL, 2) &rarr; 2</code><br>
15+
<code>coalesce(NULL, 2, 3) &rarr; 2</code><br>
16+
<code>coalesce(7, NULL, 3*2) &rarr; 7</code><br><br>
17+
<code>coalesce("fieldA", "fallbackField", 'ERROR') &rarr; value of fieldA if it is non-NULL
18+
else the value of "fallbackField" or the string 'ERROR' if both are NULL</code><br>
19+

‎src/providers/grass/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ TARGET_LINK_LIBRARIES(qgis.g.info
9292
${GRASS_LIBRARY_gproj}
9393
${GDAL_LIBRARY}
9494
)
95+
IF (UNIX)
96+
TARGET_LINK_LIBRARIES(qgis.g.info m)
97+
ENDIF (UNIX)
9598

9699
########################################################
97100
# Install

‎tests/src/core/testqgsexpression.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,9 @@ class TestQgsExpression: public QObject
295295
QTest::newRow( "condition else" ) << "case when 1=0 then 'bad' else 678 end" << false << QVariant( 678 );
296296
QTest::newRow( "condition null" ) << "case when length(123)=0 then 111 end" << false << QVariant();
297297
QTest::newRow( "condition 2 when" ) << "case when 2>3 then 23 when 3>2 then 32 else 0 end" << false << QVariant( 32 );
298+
QTest::newRow( "coalesce null" ) << "coalesce(NULL)" << false << QVariant( );
299+
QTest::newRow( "coalesce mid-null" ) << "coalesce(1, NULL, 3)" << false << QVariant( 1 );
300+
QTest::newRow( "coalesce exp" ) << "coalesce(NULL, 1+1)" << false << QVariant( 2 );
298301

299302
// Datetime functions
300303
QTest::newRow( "to date" ) << "todate('2012-06-28')" << false << QVariant( QDate( 2012, 6, 28 ) );

0 commit comments

Comments
 (0)
Please sign in to comment.