Version: v0.6.0 - Beta.  We welcome contributors & feedback.  THanks!

Db.selectRows

Db.selectRows($sql)

Description

Return the result of a SQL 'select' statement as a List of Maps.

Each Map represents one row of the result.

$query = sql'SELECT id, name FROM users ORDER BY name';
$users = Db.selectRows($query);

// Example result:
// [
//     { id: 1, name: 'Ann' },
//     { id: 3, name: 'Bob' },
//     { id: 2, name: 'Cody' },
// ]

foreach $users as $user {
    print($user.name);
}