{"action":"created","issue":{"url":"https://api.github.com/repos/doctrine/dbal/issues/2264","labels_url":"https://api.github.com/repos/doctrine/dbal/issues/2264/labels{/name}","comments_url":"https://api.github.com/repos/doctrine/dbal/issues/2264/comments","events_url":"https://api.github.com/repos/doctrine/dbal/issues/2264/events","html_url":"https://github.com/doctrine/dbal/pull/2264","id":122580563,"number":2264,"title":"Add sqlite3 driver (BenMorel)","user":{"login":"zeroedin-bill","id":4266849,"avatar_url":"https://avatars.githubusercontent.com/u/4266849?v=3","gravatar_id":"","url":"https://api.github.com/users/zeroedin-bill","html_url":"https://github.com/zeroedin-bill","followers_url":"https://api.github.com/users/zeroedin-bill/followers","following_url":"https://api.github.com/users/zeroedin-bill/following{/other_user}","gists_url":"https://api.github.com/users/zeroedin-bill/gists{/gist_id}","starred_url":"https://api.github.com/users/zeroedin-bill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zeroedin-bill/subscriptions","organizations_url":"https://api.github.com/users/zeroedin-bill/orgs","repos_url":"https://api.github.com/users/zeroedin-bill/repos","events_url":"https://api.github.com/users/zeroedin-bill/events{/privacy}","received_events_url":"https://api.github.com/users/zeroedin-bill/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-12-16T19:15:38Z","updated_at":"2015-12-17T10:10:58Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/doctrine/dbal/pulls/2264","html_url":"https://github.com/doctrine/dbal/pull/2264","diff_url":"https://github.com/doctrine/dbal/pull/2264.diff","patch_url":"https://github.com/doctrine/dbal/pull/2264.patch"},"body":"This PR supplements and closes #840.\r\n\r\nI made some changes to the exception handling in the driver. SQLite3 is one of the only non-PDO drivers that throws exceptions instead of errors. The changes I made allow the exceptions thrown by the underlying driver to be chained into the SQLite3Exception.\r\n\r\nI also added some phpdoc @ since and @ author annotations.\r\n\r\n/ping @BenMorel @deeky666 @stof\r\n\r\n## From BenMorel's Original PR #840:\r\n\r\nThis PR adds an additional driver using the [SQLite3](http://php.net/manual/fr/book.sqlite3.php) class, in addition to the PDO_SQLITE driver.\r\n\r\n## Why this driver?\r\n\r\nEven though the PDO SQLite driver is already available to interact with SQLite databases, PDO currently has a big limitation: it [does not allow to load SQLite extensions](https://bugs.php.net/bug.php?id=64810).\r\n\r\nThis functionality is provided by the `SQLite3` class, which becomes your only option if you need to use your PHP application with an SQLite extension such as [SpatiaLite](http://www.gaia-gis.it/gaia-sins/)."},"comment":{"url":"https://api.github.com/repos/doctrine/dbal/issues/comments/165407106","html_url":"https://github.com/doctrine/dbal/pull/2264#issuecomment-165407106","issue_url":"https://api.github.com/repos/doctrine/dbal/issues/2264","id":165407106,"user":{"login":"BenMorel","id":1952838,"avatar_url":"https://avatars.githubusercontent.com/u/1952838?v=3","gravatar_id":"","url":"https://api.github.com/users/BenMorel","html_url":"https://github.com/BenMorel","followers_url":"https://api.github.com/users/BenMorel/followers","following_url":"https://api.github.com/users/BenMorel/following{/other_user}","gists_url":"https://api.github.com/users/BenMorel/gists{/gist_id}","starred_url":"https://api.github.com/users/BenMorel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BenMorel/subscriptions","organizations_url":"https://api.github.com/users/BenMorel/orgs","repos_url":"https://api.github.com/users/BenMorel/repos","events_url":"https://api.github.com/users/BenMorel/events{/privacy}","received_events_url":"https://api.github.com/users/BenMorel/received_events","type":"User","site_admin":false},"created_at":"2015-12-17T10:10:58Z","updated_at":"2015-12-17T10:10:58Z","body":"@zeroedin-bill If we cannot give the driver an existing instance of `SQLite3`, then creating the instance pre-configured to throw exceptions is fine to me (as you say, getting the instance from the driver and calling `enableExceptions(false)` would be... weird (although still possible).\r\n\r\nHowever, if I look at the PDO driver, [it is possible to pass an existing `PDO` instance](http://doctrine-orm.readthedocs.org/projects/doctrine-dbal/en/latest/reference/configuration.html#driver):\r\n\r\n- `pdo`: Specifies an existing PDO instance to use.\r\n\r\nIf we somehow want to support the same for SQLite3, then we have to support exceptions *and* warnings. Do we want this, by the way?\r\n\r\n> There are a few places in the driver on codepaths used by the DBAL driver where a warning can be triggered without setting the error code in the driver. If the driver is not in exception mode, and we're using @ on all the calls, the error could simply be swallowed by the DBAL driver. There are some places in other code paths not used by DBAL where warnings can be thrown without setting the error code also.\r\n\r\nWhat code are we talking about here? To me, the only errors \"swallowed\" (to be converted to exceptions anyway) are in the methods implementing the `Connection` interface, so there is no interference with any other code as far as I can see. You will never get a swallowed warning without an exception.\r\n\r\nI don't like adding unnecessary complexity either, but due to PHP's historical support for several different error handling mechanism, I think that the driver layer handling both use cases is the correct way to go. Unless you want to jail the `SQLite3` instance and make it inaccessible to the developer."}}