Diff for /parser3/src/classes/hash.C between versions 1.32 and 1.35

version 1.32, 2002/01/16 10:28:33 version 1.35, 2002/02/08 08:30:10
Line 1 Line 1
 /** @file  /** @file
         Parser: @b hash parser class.          Parser: @b hash parser class.
   
         Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com)          Copyright (c) 2001, 2002 ArtLebedev Group (http://www.artlebedev.com)
         Author: Alexander Petrosyan <paf@design.ru> (http://paf.design.ru)          Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)
   
         $Id$          $Id$
 */  */
Line 200  static void _sql(Request& r, const Strin Line 200  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& voptions=params->as_no_junction(1, "options must be hash, not code");
                 offset=(ulong)r.process(offset_code).as_double();                  if(voptions.is_defined())
                           if(Hash *options=voptions.get_hash(&method_name)) {
                                   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
                                   throw Exception(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 334  MHash::MHash(Pool& apool) : Methoded(apo Line 338  MHash::MHash(Pool& apool) : Methoded(apo
         // ^a.delete[key]          // ^a.delete[key]
         add_native_method("delete", Method::CT_DYNAMIC, _delete, 1, 1);          add_native_method("delete", Method::CT_DYNAMIC, _delete, 1, 1);
   
         // ^hash:sql[query][(count[;offset])]          // ^hash:sql[query][$.limit(1) $.offset(2)]
         add_native_method("sql", Method::CT_DYNAMIC, _sql, 1, 3);          add_native_method("sql", Method::CT_DYNAMIC, _sql, 1, 2);
   
         // ^hash._keys[]          // ^hash._keys[]
         add_native_method("_keys", Method::CT_DYNAMIC, _keys, 0, 0);              add_native_method("_keys", Method::CT_DYNAMIC, _keys, 0, 0);    

Removed from v.1.32  
changed lines
  Added in v.1.35


E-mail: