Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

•Re: 2Re: Can SQL be used without a database?

by merlyn (Sage)
on Dec 30, 2003 at 20:03 UTC ( #317764=note: print w/replies, xml ) Need Help??

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

I do not think that SQLite offers auto-incremented ID's for you.
The number one FAQ entry at
(1) How do I create an AUTOINCREMENT field.
Short answer: A column declared INTEGER PRIMARY KEY will autoincrement.

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.

  • Comment on •Re: 2Re: Can SQL be used without a database?

Replies are listed 'Best First'.
getting the SQLite incremented ID
by lachoy (Parson) on Dec 30, 2003 at 22:22 UTC

    ...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";

    M-x auto-bs-mode

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2022-06-26 13:31 GMT
Find Nodes?
    Voting Booth?
    My most frequent journeys are powered by:

    Results (85 votes). Check out past polls.