Re: Time to standardize the ``last insert id'' concept...

2003-05-28 Thread John . Tobey
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

Re: Time to standardize the ``last insert id'' concept...

2003-05-27 Thread Tim Bunce
On Tue, May 27, 2003 at 09:33:21AM -0400, [EMAIL PROTECTED] wrote: 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,

Re: Time to standardize the ``last insert id'' concept...

2003-03-12 Thread Tim Bunce
On Tue, Mar 11, 2003 at 01:30:30PM -0800, Michael Peppler wrote: It looks like it pays to question things. The following works, although I was sure it wouldn't: my ($sth, $sth2); $sth = $dbh-prepare(insert dbi_insert(c, i) values(?,?)); for(my $i = 0; $i 2; $i++) {

Re: Time to standardize the ``last insert id'' concept...

2003-03-12 Thread Michael Peppler
On Wed, 2003-03-12 at 03:11, Tim Bunce wrote: On Tue, Mar 11, 2003 at 01:30:30PM -0800, Michael Peppler wrote: It looks like it pays to question things. The following works, although I was sure it wouldn't: my ($sth, $sth2); $sth = $dbh-prepare(insert dbi_insert(c, i)

Re: Time to standardize the ``last insert id'' concept...

2003-03-11 Thread Michael Peppler
On Mon, 2003-03-10 at 15:50, Tim Bunce wrote: On Mon, Mar 10, 2003 at 02:50:08PM -0800, Michael Peppler wrote: On Mon, 2003-03-10 at 12:36, Tim Bunce wrote: Taking a different tack... *if* @@identity is a sequence and AutoCommit is off then then select max($column) from $table would

Re: Time to standardize the ``last insert id'' concept...

2003-03-11 Thread Tim Bunce
On Tue, Mar 11, 2003 at 09:20:48AM -0800, Michael Peppler wrote: On Mon, 2003-03-10 at 15:50, Tim Bunce wrote: On Mon, Mar 10, 2003 at 02:50:08PM -0800, Michael Peppler wrote: On Mon, 2003-03-10 at 12:36, Tim Bunce wrote: Taking a different tack... *if* @@identity is a sequence and

Re: Time to standardize the ``last insert id'' concept...

2003-03-11 Thread Michael Peppler
On Tue, 2003-03-11 at 12:50, Tim Bunce wrote: [ignore the previous 'empty' reply, finger trouble] On Tue, Mar 11, 2003 at 09:20:48AM -0800, Michael Peppler wrote: On Mon, 2003-03-10 at 15:50, Tim Bunce wrote: On Mon, Mar 10, 2003 at 02:50:08PM -0800, Michael Peppler wrote: On Mon,

Re: Time to standardize the ``last insert id'' concept...

2003-03-10 Thread Tim Bunce
On Sun, Mar 09, 2003 at 12:33:10PM -0800, Jonathan Leffler wrote: Tim Bunce wrote: Jonathan Leffler wrote: Tim Bunce wrote: Can you tell if the last insert generated a SERIAL or SERIAL8 id? Or would the application need to give you a hint? I don't need an application hint, though I can't

Re: Time to standardize the ``last insert id'' concept...

2003-03-10 Thread Michael Peppler
On Sat, 2003-03-08 at 13:11, Tim Bunce wrote: On Fri, Mar 07, 2003 at 04:28:33PM -0800, Michael Peppler wrote: On Fri, 2003-03-07 at 14:15, Tim Bunce wrote: I'd appreciate a summary of which drivers support some form of ``last insert id'' and details of the interface they provide.

Re: Time to standardize the ``last insert id'' concept...

2003-03-10 Thread Michael Peppler
On Mon, 2003-03-10 at 08:27, Tim Bunce wrote: On Mon, Mar 10, 2003 at 07:41:19AM -0800, Michael Peppler wrote: On Sat, 2003-03-08 at 13:11, Tim Bunce wrote: On Fri, Mar 07, 2003 at 04:28:33PM -0800, Michael Peppler wrote: On Fri, 2003-03-07 at 14:15, Tim Bunce wrote: I'd appreciate

Re: Time to standardize the ``last insert id'' concept...

2003-03-10 Thread Michael Peppler
On Mon, 2003-03-10 at 12:36, Tim Bunce wrote: On Mon, Mar 10, 2003 at 08:37:45AM -0800, Michael Peppler wrote: Note that you *can't* get at the @@identity value if you insert data using placeholders. This is because Sybase also localizes the @@variables within each stored

Re: Time to standardize the ``last insert id'' concept...

2003-03-10 Thread Tim Bunce
On Mon, Mar 10, 2003 at 02:50:08PM -0800, Michael Peppler wrote: On Mon, 2003-03-10 at 12:36, Tim Bunce wrote: Taking a different tack... *if* @@identity is a sequence and AutoCommit is off then then select max($column) from $table would get it. No? Yes, that would work. However, the

Re: Time to standardize the ``last insert id'' concept...

2003-03-09 Thread Tim Bunce
On Sat, Mar 08, 2003 at 09:44:16PM -0800, Jonathan Leffler wrote: Tim Bunce wrote: Can you tell if the last insert generated a SERIAL or SERIAL8 id? Or would the application need to give you a hint? I don't need an application hint, though I can't readily tell either. The SERIAL I can

Re: Time to standardize the ``last insert id'' concept...

2003-03-09 Thread Tim Bunce
On Sat, Mar 08, 2003 at 07:24:59PM -0500, John Siracusa wrote: Just a quick question on the topic. How far are you willing to go (or willing to let DBD authors go) to support the API you're planning? | this far | :) For example, Postgres has a SERIAL psuedo-type that really just

Re: Time to standardize the ``last insert id'' concept...

2003-03-09 Thread Jonathan Leffler
Tim Bunce wrote: Jonathan Leffler wrote: Tim Bunce wrote: Can you tell if the last insert generated a SERIAL or SERIAL8 id? Or would the application need to give you a hint? I don't need an application hint, though I can't readily tell either. The SERIAL I can guess pretty reliably simply by

RE: Time to standardize the ``last insert id'' concept...

2003-03-09 Thread Jeff Urlwin
On Sat, Mar 08, 2003 at 07:24:59PM -0500, John Siracusa wrote: Just a quick question on the topic. How far are you willing to go (or willing to let DBD authors go) to support the API you're planning? | this far | :) For example, Postgres has a SERIAL psuedo-type

Re: Time to standardize the ``last insert id'' concept...

2003-03-09 Thread John Siracusa
On 3/9/03 3:21 PM, Tim Bunce wrote: For postgres the tablename_columnname_seq name is part of the core system so there's really no guessing going on (as I understand it). That's only true for the SERIAL pseudo-type's auto-generated sequences. A table could have its primary key column default

Re: Time to standardize the ``last insert id'' concept...

2003-03-08 Thread Tim Bunce
On Fri, Mar 07, 2003 at 04:28:33PM -0800, Michael Peppler wrote: On Fri, 2003-03-07 at 14:15, Tim Bunce wrote: I'd appreciate a summary of which drivers support some form of ``last insert id'' and details of the interface they provide. Specifically... via an attribute or method?

Re: Time to standardize the ``last insert id'' concept...

2003-03-08 Thread Jonathan Leffler
Tim Bunce wrote: I'd appreciate a summary of which drivers support some form of ``last insert id'' and details of the interface they provide. Specifically... via an attribute or method? at the sth or dbh level, or both? any other details that might be relevant...

Re: Time to standardize the ``last insert id'' concept...

2003-03-08 Thread Tim Bunce
On Fri, Mar 07, 2003 at 11:12:00PM -0800, Jonathan Leffler wrote: Tim Bunce wrote: I'd appreciate a summary of which drivers support some form of ``last insert id'' and details of the interface they provide. Specifically... via an attribute or method? at the sth or dbh level, or

Re: Time to standardize the ``last insert id'' concept...

2003-03-08 Thread John Siracusa
Just a quick question on the topic. How far are you willing to go (or willing to let DBD authors go) to support the API you're planning? For example, Postgres has a SERIAL psuedo-type that really just creates a sequence behind the scenes for you. I currently get the last insert id using DBD::Pg

Re: Time to standardize the ``last insert id'' concept...

2003-03-08 Thread Jonathan Leffler
Tim Bunce wrote: On Fri, Mar 07, 2003 at 11:12:00PM -0800, Jonathan Leffler wrote: Tim Bunce wrote: I'd appreciate a summary of which drivers support some form of ``last insert id'' and details of the interface they provide. Specifically... via an attribute or method? at the sth or

Time to standardize the ``last insert id'' concept...

2003-03-07 Thread Tim Bunce
I'd appreciate a summary of which drivers support some form of ``last insert id'' and details of the interface they provide. Specifically... via an attribute or method? at the sth or dbh level, or both? any other details that might be relevant... Also, for databases that

Re: Time to standardize the ``last insert id'' concept...

2003-03-07 Thread Michael Peppler
On Fri, 2003-03-07 at 14:15, Tim Bunce wrote: I'd appreciate a summary of which drivers support some form of ``last insert id'' and details of the interface they provide. Specifically... via an attribute or method? at the sth or dbh level, or both? any other details that