pike.git / lib / modules / ADT.pmod / Table.pmod

version» Context lines:

pike.git/lib/modules/ADT.pmod/Table.pmod:1:   // Table.pmod by Fredrik Noring, 1998 - // $Id: Table.pmod,v 1.17 2001/01/05 21:10:06 grubba Exp $ + // $Id: Table.pmod,v 1.18 2001/01/05 21:12:19 grubba Exp $      #pike __REAL_VERSION__   #define TABLE_ERR(msg) throw(({ "(Table) "+msg+"\n", backtrace() }))      //! ADT.Table is a generic module for manipulating tables.   //!   //! Each table contains one or several columns.   //! Each column is associated with a name, the column name.   //! Optionally, one can provide a column type. The Table module can do a number   //! of operations on a given table, like computing the sum of a column,
pike.git/lib/modules/ADT.pmod/Table.pmod:100:       //! This method returns the contents of a given row as an array.    array row(int row_number)    {    return copy_value(table[row_number]);    }       //! Same as @[col()].    array `[](int|string column)    { -  return col(c); +  return col(column);    }       //! This method compares two tables. They are equal if the contents    //! of the tables and the column names are equal. The column name    //! comparison is case insensitive.    int `==(object table)    {    return (equal(Array.map(fields, lower_case),    Array.map(indices(table), lower_case)) &&    equal(local::table, values(table)));
pike.git/lib/modules/ADT.pmod/Table.pmod:170:       mixed max_col(int|string c)    {    return op_col(max, c);    }       //! This method returns a new table object with the selected columns only.    object select(int|string ... columns)    {    array t = ({}); -  cs = remap(cs); +  columns = remap(columns);    for(int r = 0; r < sizeof(table); r++) -  t += ({ rows(table[r], cs) }); -  return copy(t, rows(fields, cs), rows(types, cs)); +  t += ({ rows(table[r], columns) }); +  return copy(t, rows(fields, columns), rows(types, columns));    }       //! Like @[select()], but the given @[columns] will not be in the    //! resulting table.    object remove(int|string ... columns)    {    return select(@remap(fields) - remap(columns, 1));    }       //! This method calls the function for each row. If the function