Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

getting the SQLite incremented ID

by lachoy (Parson)
on Dec 30, 2003 at 22:22 UTC ( [id://317795]=note: print w/replies, xml ) Need Help??


in reply to •Re: 2Re: Can SQL be used without a database?
in thread Can SQL be used without a database?

...and using the DBI func method will pull out the value for you after an insert:

$dbh->do( q{ CREATE TABLE foo ( id integer not null primary key, name varchar(20) ) }); $dbh->do( "INSERT INTO foo ( name ) VALUES ( 'bar' )" ); print "ID of record: ", $dbh->func( 'last_insert_rowid' ), "\n";

Chris
M-x auto-bs-mode

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://317795]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2024-04-19 05:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found