Skip to content

Commit

Permalink
add lower/upper support to search string (fixes #2970)
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@14154 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Aug 27, 2010
1 parent 886c17f commit d2cb8b2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/core/qgssearchstringlexer.ll
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ string "'"{str_char}*"'"
"to int" { yylval.op = QgsSearchTreeNode::opTOINT; return FUNCTION;}
"to real" { yylval.op = QgsSearchTreeNode::opTOREAL; return FUNCTION;}
"to string" { yylval.op = QgsSearchTreeNode::opTOSTRING; return FUNCTION;}
"lower" { yylval.op = QgsSearchTreeNode::opLOWER; return FUNCTION;}
"upper" { yylval.op = QgsSearchTreeNode::opUPPER; return FUNCTION;}
"||" { return CONCAT; }
Expand Down
9 changes: 8 additions & 1 deletion src/core/qgssearchtreenode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@ QString QgsSearchTreeNode::makeSearchString()
{
if ( mOp == opSQRT || mOp == opSIN || mOp == opCOS || mOp == opTAN ||
mOp == opASIN || mOp == opACOS || mOp == opATAN ||
mOp == opTOINT || mOp == opTOREAL || mOp == opTOSTRING )
mOp == opTOINT || mOp == opTOREAL || mOp == opTOSTRING ||
mOp == opLOWER || mOp == opUPPER )
{
// functions
switch ( mOp )
Expand All @@ -207,6 +208,8 @@ QString QgsSearchTreeNode::makeSearchString()
case opTOINT: str += "to int"; break;
case opTOREAL: str += "to real"; break;
case opTOSTRING: str += "to string"; break;
case opLOWER: str += "lower"; break;
case opUPPER: str += "upper"; break;
default: str += "?";
}
// currently all functions take one parameter
Expand Down Expand Up @@ -672,6 +675,10 @@ QgsSearchTreeValue QgsSearchTreeNode::valueAgainst( const QgsFieldMap& fields, c
return QgsSearchTreeValue( val1 );
case opTOSTRING:
return QgsSearchTreeValue( QString::number( val1 ) );
case opLOWER:
return QgsSearchTreeValue( value1.string().toLower() );
case opUPPER:
return QgsSearchTreeValue( value1.string().toUpper() );
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/core/qgssearchtreenode.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ class CORE_EXPORT QgsSearchTreeNode

// string handling
opCONCAT,
opLOWER,
opUPPER,

opROWNUM
};
Expand Down

0 comments on commit d2cb8b2

Please sign in to comment.