Diff for /parser3/src/classes/string.C between versions 1.233 and 1.237

version 1.233, 2016/11/01 23:10:41 version 1.237, 2018/01/19 16:47:35
Line 1 Line 1
 /** @file  /** @file
         Parser: @b string parser class.          Parser: @b string parser class.
   
         Copyright (c) 2001-2015 Art. Lebedev Studio (http://www.artlebedev.com)          Copyright (c) 2001-2017 Art. Lebedev Studio (http://www.artlebedev.com)
         Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)          Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)
 */  */
   
Line 381  static void _match(Request& r, MethodPar Line 381  static void _match(Request& r, MethodPar
   
         if(Value* value=regexp.as(VREGEX_TYPE)){          if(Value* value=regexp.as(VREGEX_TYPE)){
                 if(options && options->is_defined())                  if(options && options->is_defined())
                         throw Exception(PARSER_RUNTIME,                          throw Exception(PARSER_RUNTIME, 0, "you can not specify regex-object and options together");
                                 0,  
                                 "you can not specify regex-object and options together"  
                         );  
                 vregex=static_cast<VRegex*>(value);                  vregex=static_cast<VRegex*>(value);
         } else {          } else {
                 vregex=new VRegex(r.charsets.source(),                  vregex=new VRegex(r.charsets.source(), &regexp.as_string(), (options) ? (&options->as_string()) : 0);
                         &regexp.as_string(),  
                         (options)?(&options->as_string()):0);  
                 vregex->study();                  vregex->study();
                 vrcleaner.vregex=vregex;                  vrcleaner.vregex=vregex;
         }          }
Line 398  static void _match(Request& r, MethodPar Line 393  static void _match(Request& r, MethodPar
         int matches_count=0;          int matches_count=0;
   
         if(params_count<3) { // search          if(params_count<3) { // search
                 Table* table=src.match(vregex,                  Table* table=src.match(vregex, search_action, 0, matches_count);
                         search_action, 0,  
                         matches_count);  
   
                 if(table){                  if(table){
                         r.write(*new VTable(table));                          r.write(*new VTable(table));
Line 504  public: Line 497  public:
                         result=new String(str, String::L_TAINTED /* no length as 0x00 can be inside */ );                          result=new String(str, String::L_TAINTED /* no length as 0x00 can be inside */ );
                         return false;                          return false;
                 } catch(...) {                  } catch(...) {
                         error=SQL_Error("exception occured in String_sql_event_handlers::add_row_cell");                          error=SQL_Error("exception occurred in String_sql_event_handlers::add_row_cell");
                         return true;                          return true;
                 }                  }
         }          }
Line 826  MString::MString(): Methoded("string") { Line 819  MString::MString(): Methoded("string") {
         // ^string.split[delim][options]          // ^string.split[delim][options]
         // ^string.split[delim][options][column name]          // ^string.split[delim][options][column name]
         add_native_method("split", Method::CT_DYNAMIC, _split, 1, 3);          add_native_method("split", Method::CT_DYNAMIC, _split, 1, 3);
                 // old names for backward compatibility          // old names for backward compatibility
                 // ^string.lsplit[delim]          // ^string.lsplit[delim]
                 add_native_method("lsplit", Method::CT_DYNAMIC, _lsplit, 1, 1);          add_native_method("lsplit", Method::CT_DYNAMIC, _lsplit, 1, 1);
                 // ^string.rsplit[delim]          // ^string.rsplit[delim]
                 add_native_method("rsplit", Method::CT_DYNAMIC, _rsplit, 1, 1);          add_native_method("rsplit", Method::CT_DYNAMIC, _rsplit, 1, 1);
           
         // ^string.match[regexp][options]          // ^string.match[regexp][options]
         // ^string.match[regexp][options]{replacement-code}          // ^string.match[regexp][options]{replacement-code}
         // ^string.match[regexp][options]{replacement-code}{code-if-nothing-is-found}          // ^string.match[regexp][options]{replacement-code}{code-if-nothing-is-found}

Removed from v.1.233  
changed lines
  Added in v.1.237


E-mail: