Skip to content
Permalink
Browse files
add lower/upper support to search string (fixes #2970)
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 d2cb8b281bea66f74ac2b645447213010a9a9dfa
Showing with 12 additions and 1 deletion.
  1. +2 −0 src/core/qgssearchstringlexer.ll
  2. +8 −1 src/core/qgssearchtreenode.cpp
  3. +2 −0 src/core/qgssearchtreenode.h
@@ -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; }
@@ -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 )
@@ -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
@@ -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() );
}
}

@@ -96,6 +96,8 @@ class CORE_EXPORT QgsSearchTreeNode

// string handling
opCONCAT,
opLOWER,
opUPPER,

opROWNUM
};

0 comments on commit d2cb8b2

Please sign in to comment.