Diff for /parser3/src/classes/hash.C between versions 1.105 and 1.110

version 1.105, 2010/08/04 15:11:44 version 1.110, 2011/05/19 06:58:40
Line 26  public: // VStateless_class Line 26  public: // VStateless_class
   
 public:  public:
         MHash();          MHash();
 public: // Methoded  
         bool used_directly() { return true; }  
 };  };
   
 // global variable  // global variable
Line 70  public: Line 68  public:
                 empty(0) {                  empty(0) {
         }          }
   
         bool add_column(SQL_Error& error, const char* str, size_t length) {          bool add_column(SQL_Error& error, const char* str, size_t ) {
                 try {                  try {
                         columns+=new String(str, String::L_TAINTED, length);                          columns+=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 Hash_sql_event_handlers::add_column");                          error=SQL_Error("exception occured in Hash_sql_event_handlers::add_column");
Line 109  public: Line 107  public:
                 return false;                  return false;
         }          }
   
         bool add_row_cell(SQL_Error& error, const char *ptr, size_t length) {          bool add_row_cell(SQL_Error& error, const char *ptr, size_t ) {
                 try {                  try {
                         String& cell=*new String(ptr, String::L_TAINTED, length);                          String& cell=*new String(ptr, String::L_TAINTED /* no length as 0x00 can be inside */);
   
                         bool duplicate=false;                          bool duplicate=false;
                         if(one_bool_column) {                          if(one_bool_column) {
Line 308  static void _sql(Request& r, MethodParam Line 306  static void _sql(Request& r, MethodParam
         ulong offset=0;          ulong offset=0;
         bool distinct=false;          bool distinct=false;
         Table2hash_value_type value_type=C_HASH;          Table2hash_value_type value_type=C_HASH;
         if(params.count()>1) {          if(params.count()>1)
                 Value& voptions=params.as_no_junction(1, "options must be hash, not code");                  if(HashStringValue* options=params.as_hash(1)) {
                 if(voptions.is_defined() && !voptions.is_string())                          int valid_options=0;
                         if(HashStringValue* options=voptions.get_hash()) {                          if(Value* vbind=options->get(sql_bind_name)) {
                                 int valid_options=0;                                  valid_options++;
                                 if(Value* vbind=options->get(sql_bind_name)) {                                  bind=vbind->get_hash();
                                         valid_options++;                          }
                                         bind=vbind->get_hash();                          if(Value* vlimit=options->get(sql_limit_name)) {
                                 }                                  valid_options++;
                                 if(Value* vlimit=options->get(sql_limit_name)) {                                  limit=(ulong)r.process_to_value(*vlimit).as_double();
                                         valid_options++;                          }
                                         limit=(ulong)r.process_to_value(*vlimit).as_double();                          if(Value* voffset=options->get(sql_offset_name)) {
                                 }                                  valid_options++;
                                 if(Value* voffset=options->get(sql_offset_name)) {                                  offset=(ulong)r.process_to_value(*voffset).as_double();
                                         valid_options++;                          }
                                         offset=(ulong)r.process_to_value(*voffset).as_double();                          if(Value* vdistinct=options->get(sql_distinct_name)) {
                                 }                                  valid_options++;
                                 if(Value* vdistinct=options->get(sql_distinct_name)) {                                  distinct=r.process_to_value(*vdistinct).as_bool();
                                         valid_options++;                          }
                                         distinct=r.process_to_value(*vdistinct).as_bool();                          if(Value* vvalue_type=options->get(sql_value_type_name)) {
                                 }                                  valid_options++;
                                 if(Value* vvalue_type=options->get(sql_value_type_name)) {                                  value_type=get_value_type(r.process_to_value(*vvalue_type));
                                         valid_options++;                          }
                                         value_type=get_value_type(r.process_to_value(*vvalue_type));                          if(valid_options!=options->count())
                                 }                                  throw Exception(PARSER_RUNTIME, 0, CALLED_WITH_INVALID_OPTION);
                                 if(valid_options!=options->count())                  }
                                         throw Exception(PARSER_RUNTIME, 0, CALLED_WITH_INVALID_OPTION);  
                         } else  
                                 throw Exception(PARSER_RUNTIME, 0, OPTIONS_MUST_BE_HASH);  
         }  
   
         SQL_Driver::Placeholder* placeholders=0;          SQL_Driver::Placeholder* placeholders=0;
         uint placeholders_count=0;          uint placeholders_count=0;
Line 491  static void _at(Request& r, MethodParams Line 485  static void _at(Request& r, MethodParams
                         pos+=count;                          pos+=count;
         }          }
   
         if(count && pos >= 0 && pos < count){          if(count && pos >= 0 && (size_t)pos < count){
                 if(pos == 0)                  if(pos == 0)
                         r.write_assign_lang(*hash.first_value());                          r.write_assign_lang(*hash.first_value());
                 else if(pos == count-1)                  else if((size_t)pos == count-1)
                         r.write_assign_lang(*hash.last_value());                          r.write_assign_lang(*hash.last_value());
                 else                  else
                         for(HashStringValue::Iterator i(hash); i; i.next(), pos-- )                          for(HashStringValue::Iterator i(hash); i; i.next(), pos-- )

Removed from v.1.105  
changed lines
  Added in v.1.110


E-mail: