note 62216 added to function.sqlite-last-insert-rowid

From: Date: Wed, 22 Feb 2006 16:31:41 +0000
Subject: note 62216 added to function.sqlite-last-insert-rowid
Groups: php.notes 
Request: Send a blank email to php-notes+get-104230@lists.php.net to get a copy of this message
Note that you don't need to create a primary key for your table. In the absence of an integer primary key, SQLite simply uses an internal key called "RowID" or "OID". It has all of the features of a normal integer primary key(auto-incrementing, returned by sqlite_last_insert_rowid(), accessible via SELECT, etc), except that it's handled better by SQLite and doesn't require the extra characters in the "CREATE" command. If you just want a primary key as an auto-incrementing ID for your rows, save yourself the trouble and just use "OID" instead. Also, according to the SQLite website, the id returned is for the last insert in the current *connection*, not just database. This means that if there are two connections to the same database at the same time, and both perform "INSERT", each can get it's own inserted rowid later, so basically this is thread-safe(So long as no-one calls "REINDEX"). ---- Server IP: 192.117.122.43 Probable Submitter: 84.228.138.207 ---- Manual Page -- http://www.php.net/manual/en/function.sqlite-last-insert-rowid.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+62216 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+62216&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+62216&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+62216&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+62216&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+62216&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+62216&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+62216&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+62216&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#104230) next »