--- parser3/src/classes/table.C 2024/09/28 14:37:53 1.365 +++ parser3/src/classes/table.C 2024/10/05 18:05:23 1.367 @@ -24,8 +24,9 @@ #include "pa_sql_connection.h" #include "pa_vbool.h" #include "pa_array.h" +#include "pa_varray.h" -volatile const char * IDENT_TABLE_C="$Id: table.C,v 1.365 2024/09/28 14:37:53 moko Exp $"; +volatile const char * IDENT_TABLE_C="$Id: table.C,v 1.367 2024/10/05 18:05:23 moko Exp $"; // class @@ -849,11 +850,11 @@ static void table_row_to_hash(Table::ele for(Array_iterator i(*info->value_fields); i; ) { size_t value_field=i.next(); if(value_fieldcount()) - hash.put(columns ? *columns->get(value_field) : String(format(value_field, 0)), new VString(*row->get(value_field))); + hash.put(columns ? *columns->get(value_field) : String(pa_uitoa(value_field)), new VString(*row->get(value_field))); } } else { // all fields for(size_t index=0; indexcount(); index++) { - hash.put(columns && index < columns->count() ? *columns->get(index) : String(format(index, 0)), new VString(*row->get(index))); + hash.put(columns && index < columns->count() ? *columns->get(index) : String(pa_uitoa(index)), new VString(*row->get(index))); } } exist=info->hash->put_dont_replace(*key, vhash); @@ -1010,6 +1011,28 @@ static void _hash(Request& r, MethodPara r.write(result); } +static void _cells(Request& r, MethodParams& params) { + Table& self_table=GET_SELF(r, VTable).table(); + size_t row_size=self_table[self_table.current()]->count(); // number of columns in current row + + if(params.count()){ + int limit=params.as_int(params.count()-1, "offset must be expression", r); + if(limit<0) + limit=0; + if(limit