Useless use of a (constant|hash element) in void context?

ADFH mpm at
Sun Oct 5 20:09:18 CDT 2003

"Fox, Michael" <Michael.Fox at> wrote:
> Yep, this is the portable way to get metadata for the data to be
> returned by the statement handle, but if you want to get primary key
> info for a table in a portable way then use the primary_key_info and
> primary_key methods 

From: Andrew Creer <ac at>
> For MySQL the DBI methods
>  $sth->{NAME}
>  $sth->{TYPE}
>  $sth->{PRECISION}
>  $sth->{SCALE}
>  $sth->{NULLABLE}
> all return arrays of relavent data after you have done a
>  $sth->execute()

So instead of using "SHOW COLUMNS FROM table" I should be doing a
limited "SELECT * FROM table LIMIT 1" and then reading the data shown
above (as it's not always for data that exists in database)..

The problem I have with this is, what does one do when there is no data
in the table... as I'm dealing with data which may potentially be the
first INSERT in the table.

Perhaps being able to fetch the metadata alone for a given table should
become a standardised function available in DBI?

From: Scott Penrose <scottp at>
> Instead, you need here to assign a hashref, which is the only way to 
> assign a hash to a scalar.

So how does one get a reference out of a hash constructor - case of two
line process?

	my %temphash=( .... => .... , .... );

I guess I've always been curious - what's the difference between
prefixing something with an ampersand or a backslash? I'm thinking
ampersand dereferences and backslash generates reference. Is an area I
never quite got (once I figure out this stuff, I think I'll revisit
scoping in Perl then OO then making modules - experience is beginning to
tell me, that just like learning vi :) , things tend to just "click"
after awhile)..


More information about the Melbourne-pm mailing list