Need php equivalant for the JAVA snippet |
[eluser]halwaraj[/eluser]
I have this JAVA code snippet: Code: PreparedStatement ps = conn.prepareStatement("insert query for auto key table", Statement.RETURN_GENERATED_KEYS); Is there something similar in CI. Its there in ZEND i know. The above code snippet returns the auto generated keys like PK, to be used later as FK.
[eluser]halwaraj[/eluser]
Any ideas how does the above function call work? I mean the implementation. There might be situation wherein I insert a row (suppose the generated id is 6) and before I call the db->insert_id, somebody else inserts other records into the database (and suppose the generated id in this case is 7). So what am I gonna get when I call the above function? Is it 6 or 7? I mean there would be a lot of simultaneous requests in the real world.
[eluser]xwero[/eluser]
In the mysql driver it uses mysql_insert_id which uses mysql's last_insert_id function internally i guess. How is it done in java? |
Welcome Guest, Not a member yet? Register Sign In |