Fixing Record::lastInsertId()

As I explained in pull request #473, wrapping fetchColumn() inside an if-statement will avoid a fatal error. At the same time we can return 0, making sure that the method will pass the phpunit tests.