Diff for /parser3/src/classes/table.C between versions 1.282 and 1.287

version 1.282, 2011/11/19 04:15:31 version 1.287, 2012/05/23 16:26:40
Line 1 Line 1
 /** @file  /** @file
         Parser: @b table parser class.          Parser: @b table parser class.
   
         Copyright (c) 2001-2009 ArtLebedev Group (http://www.artlebedev.com)          Copyright (c) 2001-2012 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)
 */  */
   
 static const char * const IDENT_TABLE_C="$Date$";  
   
 #if (!defined(NO_STRINGSTREAM) && !defined(FREEBSD4))  #if (!defined(NO_STRINGSTREAM) && !defined(FREEBSD4))
 #include <sstream>  #include <sstream>
 #endif  #endif
Line 23  static const char * const IDENT_TABLE_C= Line 21  static const char * const IDENT_TABLE_C=
 #include "pa_vbool.h"  #include "pa_vbool.h"
 #include "pa_array.h"  #include "pa_array.h"
   
   volatile const char * IDENT_TABLE_C="$Id$";
   
 // class  // class
   
 class MTable: public Methoded {  class MTable: public Methoded {
Line 209  static void _create(Request& r, MethodPa Line 209  static void _create(Request& r, MethodPa
                 data.split(head, raw_pos_after, "\n", String::L_AS_IS, 1);                  data.split(head, raw_pos_after, "\n", String::L_AS_IS, 1);
                 if(head.count()) {                  if(head.count()) {
                         size_t col_pos_after=0;                          size_t col_pos_after=0;
                         head[0]->split(*columns, col_pos_after, *separators.scolumn, String::L_AS_IS);                          if(head[0]->is_empty())
                                   *columns += new String();
                           else
                                   head[0]->split(*columns, col_pos_after, *separators.scolumn, String::L_AS_IS);
                 }                  }
         }          }
   
Line 924  static void _sort(Request& r, MethodPara Line 927  static void _sort(Request& r, MethodPara
                 old_table.set_current(i);                  old_table.set_current(i);
                 // calculate key value                  // calculate key value
                 seq[i].row=old_table[i];                  seq[i].row=old_table[i];
                 Value& value=r.process_to_value(key_maker).as_expr_result(true/*return string as-is*/);                  Value& value=r.process_to_value(key_maker);
                 if(i==0) // determining key values type by first one                  if(i==0) // determining key values type by first one
                         key_values_are_strings=value.is_string();                          key_values_are_strings=value.is_string();
   
                 if(key_values_are_strings)                  if(key_values_are_strings)
                         seq[i].value.c_str=value.as_string().cstr();                          seq[i].value.c_str=value.as_string().cstr();
                 else                  else
                         seq[i].value.d=value.as_double();                          seq[i].value.d=value.as_expr_result().as_double();
         }          }
   
         // @todo: handle this elsewhere          // @todo: handle this elsewhere
Line 1275  static void _select(Request& r, MethodPa Line 1278  static void _select(Request& r, MethodPa
   
         Table& result_table=*new Table(source_table.columns());          Table& result_table=*new Table(source_table.columns());
   
         if(size_t size=source_table.count() && limit>0){          size_t size=source_table.count();
           if(offset<0)
                   offset+=size;
           if(size && limit>0 && offset>=0 && (size_t)offset<size){
                 size_t saved_current=source_table.current();                  size_t saved_current=source_table.current();
                 size_t appended=0;                  size_t appended=0;
   

Removed from v.1.282  
changed lines
  Added in v.1.287


E-mail: