Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Remove unnecessary code from Connection::insert #314
added a commit
this pull request
May 14, 2013
This code breaks insert() calls with $data = array(), since array_fill() expects the second parameter to be positive (not 0). In MySQL, there can actually exist tables which have an automatic primary key and all other fields with default.
In case you do not want to accept empty $data for insert() anymore, you should 1) document that and 2) throw an exception which explains what's wrong (the warning triggered by array_fill() is not enough).
Already cloned the repository... however, it won't be easy to write a test, if there is no existing approach for testing database methods like insert, update, delete, fetch,...? I usually do this with static file fixtures recorded from a database server during the first test run. Would this be ok?
The fix btw would just reverting this particular change, since the code obviously was not "unnecessary".