///PD_TRACE_DECLARE_FUNCTION ( SDB__MTHRTRIMPARSER_PARSE, "_mthRTrimParser::parse" )
   INT32 _mthRTrimParser::parse( const bson::BSONElement &e,
                                 _mthSAction &action ) const
   {
      INT32 rc = SDB_OK ;
      PD_TRACE_ENTRY(SDB__MTHRTRIMPARSER_PARSE ) ;

#if defined (_DEBUG)
      if ( 0 != _name.compare( e.fieldName() ) )
      {
         PD_LOG( PDERROR, "field name[%s] is not valid",
                 e.fieldName() ) ;
         rc = SDB_INVALIDARG ;
         goto error ;
      }
#endif
      if ( e.eoo() )
      {
         PD_LOG( PDERROR, "invalid element" ) ;
         rc = SDB_INVALIDARG ;
         goto error ;
      }

      action.setAttribute( MTH_S_ATTR_PROJECTION ) ;
      action.setFunc( &mthRTrimBuild,
                      &mthRTrimGet ) ;
      action.setName( _name.c_str() ) ;
   done:
      PD_TRACE_EXITRC( SDB__MTHRTRIMPARSER_PARSE, rc ) ;
      return rc ;
   error:
      goto done ;
   }
   ///PD_TRACE_DECLARE_FUNCTION ( SDB__MTHINCLUDEPARSER_PARSE, "_mthIncludeParser::parse" )
   INT32 _mthIncludeParser::parse( const bson::BSONElement &e,
                                   _mthSAction &action ) const
   {
      INT32 rc = SDB_OK ;
      PD_TRACE_ENTRY( SDB__MTHINCLUDEPARSER_PARSE ) ;
      SDB_ASSERT( !e.eoo(), "can not be eoo" ) ;

      if ( !e.isNumber() )
      {
         PD_LOG( PDERROR, "invalid element type[%d]", e.type() ) ;
         rc = SDB_INVALIDARG ;
         goto error ;
      }

#if defined (_DEBUG)
      if ( 0 != _name.compare( e.fieldName() ) )
      {
         PD_LOG( PDERROR, "field name[%s] is not valid",
                 e.fieldName() ) ;
         rc = SDB_INVALIDARG ;
         goto error ;
      }
#endif

      action.setName( _name.c_str() ) ;
      if ( 0 == e.numberLong() )
      {
         action.setAttribute( MTH_S_ATTR_EXCLUDE ) ;
      }
      else
      {
         action.setAttribute( MTH_S_ATTR_INCLUDE ) ;
         action.setFunc( &mthIncludeBuild,
                         &mthIncludeGet ) ;
      }
   done:
      PD_TRACE_EXITRC( SDB__MTHINCLUDEPARSER_PARSE, rc ) ;
      return rc ;
   error:
      goto done ;
   }
   ///PD_TRACE_DECLARE_FUNCTION ( SDB__MTHSACTIONPARSER_GETACTION, "_mthSActionParser::getAction" )
   INT32 _mthSActionParser::parse( const bson::BSONElement &e,
                                   _mthSAction &action ) const
   {
      INT32 rc = SDB_OK ;
      PD_TRACE_ENTRY( SDB__MTHSACTIONPARSER_GETACTION ) ;
      SDB_ASSERT( !e.eoo(), "can not be invalid" ) ;
      const CHAR *fieldName = e.fieldName() ;
      action.clear() ;

      if ( '$' != *fieldName )
      {
         goto done ;
      }

      {
      PARSERS::const_iterator itr = _parsers.find( fieldName ) ;
      if ( _parsers.end() == itr )
      {
         PD_LOG( PDERROR, "can not find the parser of action[%s]",
                 fieldName ) ;
         rc = SDB_INVALIDARG ;
         goto error ;
      }

      rc = itr->second->parse( e, action ) ;
      if ( SDB_OK != rc )
      {
         PD_LOG( PDERROR, "failed to parse action:%d", rc ) ;
         goto error ;
      } 
      }

   done:
      PD_TRACE_EXITRC( SDB__MTHSACTIONPARSER_GETACTION, rc ) ;
      return rc ;
   error:
      goto done ;
   }
   ///PD_TRACE_DECLARE_FUNCTION ( SDB__MTHSUBSTRPARSER_PARSE, "_mthSubStrParser::parse" )
   INT32 _mthSubStrParser::parse( const bson::BSONElement &e,
                                  _mthSAction &action ) const
   {
      INT32 rc = SDB_OK ;
      PD_TRACE_ENTRY( SDB__MTHSUBSTRPARSER_PARSE ) ;
      INT32 begin = 0 ;
      INT32 limit = -1 ;
#if defined (_DEBUG)
      if ( 0 != _name.compare( e.fieldName() ) )
      {
         PD_LOG( PDERROR, "field name[%s] is not valid",
                 e.fieldName() ) ;
         rc = SDB_INVALIDARG ;
         goto error ;
      }
#endif

      if ( e.isNumber() && 0 <=  e.numberInt())
      {
         limit = e.numberInt() ;
      }
      else if ( e.isNumber() )
      {
         begin = e.numberInt() ;
      }
      else if ( Array == e.type() )
      {
         BSONObjIterator i( e.embeddedObject() ) ;
         BSONElement ele ;
         if ( !i.more() )
         {
            goto invalid_arg ;
         }

         ele = i.next() ;
         if ( !ele.isNumber() )
         {
            goto invalid_arg ;
         }

         begin = ele.numberInt() ;

         if ( !i.more() )
         {
            goto invalid_arg ;
         }

         ele = i.next() ;
         if ( !ele.isNumber() )
         {
            goto invalid_arg ;
         }

         limit = ele.numberInt() ;
      }
      else
      {
         PD_LOG( PDERROR, "invalid element" ) ;
         rc = SDB_INVALIDARG ;
         goto error ;
      }

      action.setAttribute( MTH_S_ATTR_PROJECTION ) ;
      action.setFunc( &mthSubStrBuild,
                      &mthSubStrGet ) ;
      action.setName( _name.c_str() ) ;
      action.setArg( BSON( "arg1" << begin << "arg2" << limit ) ) ;
      
   done:
      PD_TRACE_EXITRC( SDB__MTHSUBSTRPARSER_PARSE, rc ) ;
      return rc ;
   error:
      goto done ;
   invalid_arg:
      PD_LOG( PDERROR, "invalid substr argument:%s",
                    e.toString( TRUE, TRUE ).c_str() ) ;
      rc = SDB_INVALIDARG ;
      goto error ;
   }