Diff for /parser3/src/classes/table.C between versions 1.98 and 1.100

version 1.98, 2001/08/02 09:58:33 version 1.100, 2001/08/07 13:54:13
Line 327  static void _menu(Request& r, const Stri Line 327  static void _menu(Request& r, const Stri
         VTable& vtable=*static_cast<VTable *>(r.self);          VTable& vtable=*static_cast<VTable *>(r.self);
         Table& table=vtable.table();          Table& table=vtable.table();
         bool need_delim=false;          bool need_delim=false;
         vtable.lock(); int saved_current=table.current();          int saved_current=table.current();
         for(int row=0; row<table.size(); row++) {          int size=table.size();
           for(int row=0; row<size; row++) {
                 table.set_current(row);                  table.set_current(row);
   
                 Value& processed_body=r.process(body_code);                  Value& processed_body=r.process(body_code);
Line 340  static void _menu(Request& r, const Stri Line 341  static void _menu(Request& r, const Stri
                 }                  }
                 r.write_pass_lang(processed_body);                  r.write_pass_lang(processed_body);
         }          }
         table.set_current(saved_current); vtable.unlock();          table.set_current(saved_current);
 }  }
   
 static void _empty(Request& r, const String& method_name, MethodParams *params) {  static void _empty(Request& r, const String& method_name, MethodParams *params) {
Line 507  static void _flip(Request& r, const Stri Line 508  static void _flip(Request& r, const Stri
                                 new_table+=&new_row;                                  new_table+=&new_row;
                         }                          }
   
         vtable.set_table(new_table);          r.write_no_lang(*new(pool) VTable(pool, &new_table));
 }  }
   
 static void _append(Request& r, const String& method_name, MethodParams *params) {  static void _append(Request& r, const String& method_name, MethodParams *params) {
Line 521  static void _append(Request& r, const St Line 522  static void _append(Request& r, const St
         string.split(row, 0, "\t", 1, String::UL_CLEAN);          string.split(row, 0, "\t", 1, String::UL_CLEAN);
   
         VTable& vtable=*static_cast<VTable *>(r.self);          VTable& vtable=*static_cast<VTable *>(r.self);
         // disable ^a.menu{^a.append[]}  
         vtable.lock();  
         vtable.table()+=&row;          vtable.table()+=&row;
         vtable.unlock();  
 }  }
   
 static void _join(Request& r, const String& method_name, MethodParams *params) {  static void _join(Request& r, const String& method_name, MethodParams *params) {
Line 618  static void _sql(Request& r, const Strin Line 616  static void _sql(Request& r, const Strin
         Value& statement=params->as_junction(0, "statement must be code");          Value& statement=params->as_junction(0, "statement must be code");
   
         ulong limit=0;          ulong limit=0;
         if(params->size()>1) {  
                 Value& limit_code=params->as_junction(1, "limit must be expression");  
                 limit=(uint)r.process(limit_code).as_double();  
         }  
   
         ulong offset=0;          ulong offset=0;
         if(params->size()>2) {          if(params->size()>1) {
                 Value& offset_code=params->as_junction(2, "offset must be expression");                  Value& options_param=params->as_no_junction(1, "options must be hash, not code");
                 offset=(ulong)r.process(offset_code).as_double();                  if(Hash *options=options_param.get_hash()) {
                           if(Value *vlimit=(Value *)options->get(*sql_limit_name))
                                   limit=(ulong)r.process(*vlimit).as_double();
                           if(Value *voffset=(Value *)options->get(*sql_offset_name))
                                   offset=(ulong)r.process(*voffset).as_double();
                   } else
                           PTHROW(0, 0,
                                   &method_name,
                                   "options must be hash");
         }          }
   
         Temp_lang temp_lang(r, String::UL_SQL);          Temp_lang temp_lang(r, String::UL_SQL);
Line 814  MTable::MTable(Pool& apool) : Methoded(a Line 815  MTable::MTable(Pool& apool) : Methoded(a
         add_native_method("join", Method::CT_DYNAMIC, _join, 1, 1);          add_native_method("join", Method::CT_DYNAMIC, _join, 1, 1);
   
   
         // ^table:sql[query][(count[;offset])]          // ^table:sql[query]
         add_native_method("sql", Method::CT_DYNAMIC, _sql, 1, 3);          // ^table:sql[query][$.limit(1) $.offset(2)]
           add_native_method("sql", Method::CT_DYNAMIC, _sql, 1, 2);
   
         // ^table:dir[path]          // ^table:dir[path]
         // ^table:dir[path][regexp]          // ^table:dir[path][regexp]

Removed from v.1.98  
changed lines
  Added in v.1.100


E-mail: