Name

sqlSelectHash — returns a hash for a single row of results from a SQL statement

Synopsis

my %hash = $slashdb->sqlSelectHash($select);
my %hash = $slashdb->sqlSelectHash($select, $from);
my %hash = $slashdb->sqlSelectHash($select, $from, $where);
my %hash = $slashdb->sqlSelectHash($select, $from, $where, $other);

sqlSelectHash works exactly the same as sqlSelectHashRef, except that it creates a hash from the reference before returning the results. Note that it still returns only the first row of the result set.

Example

my %user = $selfdb->sqlSelectHash('*', 'users', "uid=$uid");
print "Username: $user{nickname}, homepage: $user{homepage}\n";

Get Running Weblogs with Slash now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.