Beefy Boxes and Bandwidth Generously Provided by pair Networks Cowboy Neal with Hat
We don't bite newbies here... much
 
PerlMonks  

Re^5: Sequences, last_insert_id, SQLite, and Oracle

by terce (Friar)
on Jun 15, 2005 at 04:27 UTC ( [id://466831]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Re^4: Sequences, last_insert_id, SQLite, and Oracle
in thread Sequences, last_insert_id, SQLite, and Oracle

I'm not talking about sequences (in an Oracle sense) here. If the OP was building code for Oracle only, then sequences (or any other of the Oracle specific solutions mentioned below) would provide a perfect solution. Unfortunately, SQLite doesn't yet support sequences properly, so another soultion is required.

I guess my example was unclear - I should have labelled my table used as a source of unique ID's something other than "sequence".

It also occurs to me I'm forgetting that Oracle implements implicit transactions, which would make this more problematic.
  • Comment on Re^5: Sequences, last_insert_id, SQLite, and Oracle

Replies are listed 'Best First'.
Re^6: Sequences, last_insert_id, SQLite, and Oracle
by etcshadow (Priest) on Jun 15, 2005 at 15:51 UTC
    Yeah, unfortunately, there's just no getting around using database-specific features for this sort of thing. Every RDBMS handles these specific issues differently.

    The best thing, really, is to write yourself an InsertRow function which abstracts this stuff away, but unfortunately it's gonna have to execute different code for different databases. To my knowledge (and I just looked at the code on CPAN to make sure), Class::DBI doesn't even handle this all that well. Oh, well.

    ------------ :Wq Not an editor command: Wq

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://466831]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.