in reply to Maintaining column name and column order using DBI

You can use the "NAME" (or NAME_uc, NAME_lc) statement handle attribute (see this section of the docs) to access the names of the columns as an arrayref. Their ordering should be preserved (may be DBD-dependent, though). If there are multiple columns with the same name, they will get clobbered when DBI puts them into a hash for you, so keep that in mind as well. You may also need to bypass DBI's selectrow_* shortcuts so that you actually get access a statement handle for this NAME attribute.

BTW, many DB designers/coders will tell you that SELECT * queries are bad style.

blokhead

  • Comment on Re: Maintaining column name and column order using DBI