Forum Moderators: coopster & phranque

Message Too Old, No Replies

DBI, what does \%attr mean?

         

csdude55

5:56 am on Sep 11, 2021 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Probably a noob question, but I can't find it.

I'm looking at this:

$ary_ref = $dbh->selectrow_arrayref($statement, \%attr, @bind_values);

[metacpan.org...]

What, exactly, is the use of \%attr? The definition feels like it might be in Greek:

"Reference to a hash of attribute values passed to methods"

I made a test with \%junk and tried printing the key => value of %junk, but it was just empty.

robzilla

7:47 am on Sep 11, 2021 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



See the table on this page: [google.com...]

csdude55

5:55 pm on Sep 11, 2021 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Thanks, @robzilla! I discovered last night that your link doesn't work on mobile (it goes to the page but doesn't open the chart), so for future readers:

Used to specify the attributes Slice, Columns, or MaxRows, working as similar methods


So I understand that it's used to assign values rather than retrieve them. Cool.

With that said... I can't find anything about those attributes, either. I think that "MaxRows" is pretty self explanatory, but how does it differ from using LIMIT? And I'm guessing that "Columns" is similar (same?) to defining the columns in the SELECT statement? What's the advantage of using it in \%attr instead?

I can't find anything on "Slice", everything takes me to info about array slicing :-/

robzilla

7:44 pm on Sep 11, 2021 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I'm sure there's an advantage to using those in certain situations, I just can't think of any ;-)

As for Slice, see this post: [perlmonks.org...]