chop-dbhi / dataexpress

[NOT MAINTAINED] DataExpress is a simple, Scala-based cross database ETL toolkit supporting Postgres, MySql, Oracle, SQLServer, and Sqlite
http://dataexpress.research.chop.edu
BSD 2-Clause "Simplified" License
72 stars 9 forks source link

Code should not assume that keys will be returned #13

Closed mitalia closed 11 years ago

mitalia commented 12 years ago

For various (bad) reasons, the default insert behavior for single rows in DataExpress has been to do an insert and have the driver return the primary key of the just inserted row. This has largely been because the Postgres driver echoes the entire row back when you do this.

This behavior is non-standard. In fact, mySQL will REFUSE to return any results set at all when the key column isn't an auto-generated key. Furthermore, it ONLY returns the key, not the rest of the row.

I am therefore adding an insertReturningKeys method that will do this when you really want it, but it will no longer be the default. There are likely knock-on effects inside the DSL for dealing with insertReturningKeys. In the meantime, I am converting all calls to "insert" into "insertReturningKeys" so as to preserve existing functionality until this can be fully addressed.

mitalia commented 11 years ago

This behavior has been fixed in subsequent versions