When to use $sth->fetchrow_hashref, $sth->fetchrow_arrayref and $sth->fetchrow_array?

前端 未结 5 1711
梦谈多话
梦谈多话 2021-02-08 04:28

I know that:

  • $sth->fetchrow_hashref returns a hashref of the fetched row from database,
  • $sth->fetchrow_arrayref returns an
5条回答
  •  爱一瞬间的悲伤
    2021-02-08 05:20

    You could do worse than read DBI recipes by gmax.

    It notes, among other things:

    The problem arises when your result set, by mean of a JOIN, has one or more columns with the same name. In this case, an arrayref will report all the columns without even noticing that a problem was there, while a hashref will lose the additional columns

提交回复
热议问题