I see others have answered your question but I'm not sure I agree with them all. When you say "Do the $Sth->execute() read the entire table and put it into an array in memory?" if you are talking about what happens in Perl or the XS code DBD::ODBC uses the answer is no. In ODBC terms what happens (in this simplified pseudo code is like this):
you call $dbh->prepare: SQLPrepare(select whatever from whatever); you call $sth->execute SQLDescribeParam(called per parameter and parameters bound with SQLB +indParameter) - does not happen in your case as you haven't got any SQLExecute SQLNumResultCols(to find if there is a result-set and how many colum +ns) various calls to SQLDescribeCol and SQLColAttributes to find out abo +ut the columns you call $sth->fetchrow; If the columns are not already bound: SQLBindCol for each column SQLFetch (one row requested from ODBC driver) you call $sth->fetchrow; SQLFetch (one row requested from ODBC driver)
What happens in the database and between the database and the ODBC driver is difficult to answer as it depends on the driver and database. For instance, with MS SQL Server using the TDS protocol then unless you've changed the default cursor, the database gathers all the rows and sends them down the socket and the driver reads whatever it decides (could be 1 row, could be multiple rows).
When you use fetchall_* DBI calls fetch repeatedly in the DBD and stores the rows.
In reply to Re: Fetchrow question
by mje
in thread Fetchrow question
by alainb
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |