Hi Murray > I find I'm having to write code that gets back the ID created by an > AUTO_INCREMENT in order to do various cross-referenced insertions. > For MySQL there's a function called LAST_INSERT_ID() that returns the > last auto-increment-generated value, but this is a MySQLism and the > mechanism for doing this for PostgreSQL is different.
You are right, each database requires different statements for sequences. In PostgreSQL, Oracle and many others you also need to know the name of the sequence to retrieve the last ID and use different queries. > Would it be possible to create an odbx_*() function that does this > for me so that I don't have to know how to do it for various back > ends? To be honest, I'm not very keen on implementing functions for hiding SQL statement differences. You also won't be able to create a portable, database independent application without knowing about the limitations and special requirements of the databases you would like to support. In my opinion, the better way would be to make the statements configurable that your application is using. Then, you and the users of your application are much more flexible and would enable them to adapt the application to their needs. Norbert ------------------------------------------------------------------------------ This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev _______________________________________________ libopendbx-devel mailing list libopendbx-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libopendbx-devel http://www.linuxnetworks.de/doc/index.php/OpenDBX