Timeline for What is the best value to use for id in an ActiveRecord pattern (PHP)
Current License: CC BY-SA 3.0
7 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Apr 27, 2011 at 4:47 | vote | accept | dqhendricks | ||
| Apr 27, 2011 at 3:25 | answer | added | Dean Harding | timeline score: 2 | |
| Apr 27, 2011 at 2:19 | comment | added | dqhendricks | @Demian Brecht yes, I have seen examples of that solution, and I like it very much, but I need the code to be able to work with other rdbms. | |
| Apr 27, 2011 at 1:54 | comment | added | Demian Brecht | actually, you can accurately get the last insert id using postgres (INSERT ... RETURNING id postgresql.org/docs/8.2/static/sql-insert.html). not sure if that's applicable to you though, but it sounds like you may not have a db solution decided on yet... | |
| Apr 27, 2011 at 1:02 | comment | added | dqhendricks | @Demian Brecht because you cannot accurately get the last insert id for use in a subsequent query. there will always be a chance that another insert has been made between when you insert a record and retrive the last insert id. also, this option is only available on some rdbms. | |
| Apr 27, 2011 at 0:47 | comment | added | Demian Brecht | Why is auto-increment out of the question? | |
| Apr 27, 2011 at 0:46 | history | asked | dqhendricks | CC BY-SA 3.0 |