webCOMAND

io_comand_repo\row_set

A COMAND Row Set is an ordered list of associative arrays where the keys represent the columns selected by a query and the values represent the row values. A row set can be accessed like a standard PHP array, except row sets also provide additional information and methods.

To access a row set like a standard PHP array, use:

  • foreach - It can be iterated with foreach($row_set as $row).
  • count - It's rows can be counted with count().
  • indexes - It's rows can be referenced with an array index, like $row_set[0].
  • append - A row can be appended to the end of row set with $row_set[] = $row.
  • unset - A row can be removed from a row set with unset($row_set[0]).
$row_set = $repo->get_rows("SELECT Title WHERE Title LIKE '%System%'");
$num_children = count($row_set);
foreach($row_set as $row) {
	echo( $row['Title'] . "\n" );
}

In addition, a row set also has properties and methods that provide information about the columns and rows, such as column names.

Properties

colums

An ordered array of columns selected by a query. Each element in the array contains an associative array with the column metadata below.

The key/value pairs are currently returned by PDOStatement::getColumnMeta. However, they will eventually be abstracted from PDO-specific information. Only native_type and name are guaranteed to be supported in future versions of the API.
  • native_type - The PHP native type used to represent the column value.
  • name - The name of this column as returned by the database.
  • driver:decl_type - The SQL type used to represent the column value in the database. If the column in the result set is the result of a function, this value is NULL.
  • flags - Any flags set for this column.
  • table - The name of this column's table as returned by the database.
  • len - The length of this column. Normally -1 for types other than floating point decimals.
  • precision - The numeric precision of this column. Normally 0 for types other than floating point decimals.
  • pdo_type - The type of this column as represented by the PDO::PARAM_* constants.