--- parser3/src/classes/table.C 2015/07/28 14:42:44 1.306 +++ parser3/src/classes/table.C 2015/08/02 21:21:25 1.308 @@ -22,7 +22,7 @@ #define USE_STRINGSTREAM #endif -volatile const char * IDENT_TABLE_C="$Id: table.C,v 1.306 2015/07/28 14:42:44 moko Exp $"; +volatile const char * IDENT_TABLE_C="$Id: table.C,v 1.308 2015/08/02 21:21:25 moko Exp $"; // class @@ -804,7 +804,9 @@ static void table_row_to_hash(Table::ele table=new Table(*info->table, table_options/*no rows, just structure*/); info->hash->put(*key, new VTable(table)); } - *table+=row; + Table::element_type row_copy(new ArrayString(row->count())); + row_copy->append(*row); + *table+=row_copy; break; } } @@ -1162,6 +1164,11 @@ static void _insert(Request& r, MethodPa table.insert(table.current(), row); } +static void _delete(Request& r, MethodParams& params) { + Table& table=GET_SELF(r, VTable).table(); + table.remove_current(); +} + static void join_named_row(Table& src, Table* dest) { Table::columns_type dest_columns=dest->columns(); size_t dest_columns_count=dest_columns->count(); @@ -1488,6 +1495,9 @@ MTable::MTable(): Methoded("table") { // ^table.insert{row{tab}data} before current row add_native_method("insert", Method::CT_DYNAMIC, _insert, 1, 1); + // ^table.delete[] current row + add_native_method("delete", Method::CT_DYNAMIC, _delete, 0, 0); + // ^table.join[table][$.limit(10) $.offset(1) $.offset[cur] ] add_native_method("join", Method::CT_DYNAMIC, _join, 1, 2);