On Mon, May 26, 2003 at 10:31:36PM -0700, Jonathan Leffler wrote: > > What should you return if no value has been generated (yet)?
undef seems most reasonable. I think "undefined" would be better (as in, "don't do that"). Databases are likely to do various things, for example Sybase seems to give 0. I don't think the Sybase driver wants to translate 0 to undef (perhaps 0 is legitimate sometimes) or try to keep track of whether an ID has been generated yet. Ideally, the last-inserted-id would be returned in the same step as the insert, maybe in the form of $id = $dbh->insertrow("INSERT INTO ..."), but I understand you are tailoring the interface to the standard practice of stateful handles. -John