{"action":"created","comment":{"url":"https://api.github.com/repos/doctrine/dbal/pulls/comments/47883337","id":47883337,"diff_hunk":"@@ -0,0 +1,216 @@\n+<?php\n+/*\n+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n+ * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n+ *\n+ * This software consists of voluntary contributions made by many individuals\n+ * and is licensed under the MIT license. For more information, see\n+ * <http://www.doctrine-project.org>.\n+ */\n+\n+namespace Doctrine\\DBAL\\Driver\\SQLite3;\n+\n+use Doctrine\\DBAL\\Driver\\Connection;\n+use Doctrine\\DBAL\\Driver\\ServerInfoAwareConnection;\n+\n+/**\n+ * SQLite3 implementation of the Connection interface.\n+ *\n+ * @since 2.6\n+ * @author Ben Morel <benjamin.morel@gmail.com>\n+ * @author Bill Schaller <bill@zeroedin.com>\n+ */\n+class SQLite3Connection extends SQLite3Abstract implements Connection, ServerInfoAwareConnection\n+{\n+    /**\n+     * @param string      $filename\n+     * @param int|null    $flags\n+     * @param string|null $encryption_key\n+     *\n+     * @throws SQLite3Exception\n+     */\n+    public function __construct($filename, $flags = null, $encryption_key = null)\n+    {\n+        try {\n+            if ($flags === null) {\n+                $this->sqlite3 = new \\SQLite3($filename);\n+            } elseif ($encryption_key === null) {\n+                $this->sqlite3 = new \\SQLite3($filename, $flags);\n+            } else {\n+                $this->sqlite3 = new \\SQLite3($filename, $flags, $encryption_key);\n+            }\n+\n+            $this->sqlite3->enableExceptions(true);\n+        } catch (\\Exception $e) {\n+            throw $this->wrapDriverException($e);\n+        }\n+    }\n+\n+    /**\n+     * Returns the underlying SQLite3 object.\n+     *\n+     * @return \\SQLite3\n+     */\n+    public function getSQLite3()\n+    {\n+        return $this->sqlite3;\n+    }\n+\n+    /**\n+     * {@inheritdoc}\n+     */\n+    public function prepare($prepareString)\n+    {\n+        try {\n+            $statement = @ $this->sqlite3->prepare($prepareString);","path":"lib/Doctrine/DBAL/Driver/SQLite3/SQLite3Connection.php","position":74,"original_position":74,"commit_id":"2a1427f86efc46e13d59dfb4ca41c9ee19c28e36","original_commit_id":"2a1427f86efc46e13d59dfb4ca41c9ee19c28e36","user":{"login":"deeky666","id":1411514,"avatar_url":"https://avatars.githubusercontent.com/u/1411514?v=3","gravatar_id":"","url":"https://api.github.com/users/deeky666","html_url":"https://github.com/deeky666","followers_url":"https://api.github.com/users/deeky666/followers","following_url":"https://api.github.com/users/deeky666/following{/other_user}","gists_url":"https://api.github.com/users/deeky666/gists{/gist_id}","starred_url":"https://api.github.com/users/deeky666/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deeky666/subscriptions","organizations_url":"https://api.github.com/users/deeky666/orgs","repos_url":"https://api.github.com/users/deeky666/repos","events_url":"https://api.github.com/users/deeky666/events{/privacy}","received_events_url":"https://api.github.com/users/deeky666/received_events","type":"User","site_admin":false},"body":"We should defer this to the constructor of the statement as it is done in other driver implementations, so that the statement resource is encapsulated by `SQLite3Statement`","created_at":"2015-12-17T09:13:33Z","updated_at":"2015-12-17T09:13:33Z","html_url":"https://github.com/doctrine/dbal/pull/2264#discussion_r47883337","pull_request_url":"https://api.github.com/repos/doctrine/dbal/pulls/2264","_links":{"self":{"href":"https://api.github.com/repos/doctrine/dbal/pulls/comments/47883337"},"html":{"href":"https://github.com/doctrine/dbal/pull/2264#discussion_r47883337"},"pull_request":{"href":"https://api.github.com/repos/doctrine/dbal/pulls/2264"}}},"pull_request":{"url":"https://api.github.com/repos/doctrine/dbal/pulls/2264","id":53884890,"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","issue_url":"https://api.github.com/repos/doctrine/dbal/issues/2264","number":2264,"state":"open","locked":false,"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},"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/).","created_at":"2015-12-16T19:15:38Z","updated_at":"2015-12-17T09:13:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3367a1312605e48667e87cb32f5c46a32d597858","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/doctrine/dbal/pulls/2264/commits","review_comments_url":"https://api.github.com/repos/doctrine/dbal/pulls/2264/comments","review_comment_url":"https://api.github.com/repos/doctrine/dbal/pulls/comments{/number}","comments_url":"https://api.github.com/repos/doctrine/dbal/issues/2264/comments","statuses_url":"https://api.github.com/repos/doctrine/dbal/statuses/2a1427f86efc46e13d59dfb4ca41c9ee19c28e36","head":{"label":"zeroedin-bill:add-sqlite3-driver","ref":"add-sqlite3-driver","sha":"2a1427f86efc46e13d59dfb4ca41c9ee19c28e36","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},"repo":{"id":13302396,"name":"dbal","full_name":"zeroedin-bill/dbal","owner":{"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},"private":false,"html_url":"https://github.com/zeroedin-bill/dbal","description":"Doctrine Database Abstraction Layer","fork":true,"url":"https://api.github.com/repos/zeroedin-bill/dbal","forks_url":"https://api.github.com/repos/zeroedin-bill/dbal/forks","keys_url":"https://api.github.com/repos/zeroedin-bill/dbal/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zeroedin-bill/dbal/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zeroedin-bill/dbal/teams","hooks_url":"https://api.github.com/repos/zeroedin-bill/dbal/hooks","issue_events_url":"https://api.github.com/repos/zeroedin-bill/dbal/issues/events{/number}","events_url":"https://api.github.com/repos/zeroedin-bill/dbal/events","assignees_url":"https://api.github.com/repos/zeroedin-bill/dbal/assignees{/user}","branches_url":"https://api.github.com/repos/zeroedin-bill/dbal/branches{/branch}","tags_url":"https://api.github.com/repos/zeroedin-bill/dbal/tags","blobs_url":"https://api.github.com/repos/zeroedin-bill/dbal/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zeroedin-bill/dbal/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zeroedin-bill/dbal/git/refs{/sha}","trees_url":"https://api.github.com/repos/zeroedin-bill/dbal/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zeroedin-bill/dbal/statuses/{sha}","languages_url":"https://api.github.com/repos/zeroedin-bill/dbal/languages","stargazers_url":"https://api.github.com/repos/zeroedin-bill/dbal/stargazers","contributors_url":"https://api.github.com/repos/zeroedin-bill/dbal/contributors","subscribers_url":"https://api.github.com/repos/zeroedin-bill/dbal/subscribers","subscription_url":"https://api.github.com/repos/zeroedin-bill/dbal/subscription","commits_url":"https://api.github.com/repos/zeroedin-bill/dbal/commits{/sha}","git_commits_url":"https://api.github.com/repos/zeroedin-bill/dbal/git/commits{/sha}","comments_url":"https://api.github.com/repos/zeroedin-bill/dbal/comments{/number}","issue_comment_url":"https://api.github.com/repos/zeroedin-bill/dbal/issues/comments{/number}","contents_url":"https://api.github.com/repos/zeroedin-bill/dbal/contents/{+path}","compare_url":"https://api.github.com/repos/zeroedin-bill/dbal/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zeroedin-bill/dbal/merges","archive_url":"https://api.github.com/repos/zeroedin-bill/dbal/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zeroedin-bill/dbal/downloads","issues_url":"https://api.github.com/repos/zeroedin-bill/dbal/issues{/number}","pulls_url":"https://api.github.com/repos/zeroedin-bill/dbal/pulls{/number}","milestones_url":"https://api.github.com/repos/zeroedin-bill/dbal/milestones{/number}","notifications_url":"https://api.github.com/repos/zeroedin-bill/dbal/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zeroedin-bill/dbal/labels{/name}","releases_url":"https://api.github.com/repos/zeroedin-bill/dbal/releases{/id}","created_at":"2013-10-03T15:43:57Z","updated_at":"2015-03-30T19:09:02Z","pushed_at":"2015-12-16T20:50:50Z","git_url":"git://github.com/zeroedin-bill/dbal.git","ssh_url":"git@github.com:zeroedin-bill/dbal.git","clone_url":"https://github.com/zeroedin-bill/dbal.git","svn_url":"https://github.com/zeroedin-bill/dbal","homepage":"http://www.doctrine-project.org/projects/dbal","size":20907,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"doctrine:master","ref":"master","sha":"de6c0bd243d058eb9f086144a6fed9d435737c78","user":{"login":"doctrine","id":209254,"avatar_url":"https://avatars.githubusercontent.com/u/209254?v=3","gravatar_id":"","url":"https://api.github.com/users/doctrine","html_url":"https://github.com/doctrine","followers_url":"https://api.github.com/users/doctrine/followers","following_url":"https://api.github.com/users/doctrine/following{/other_user}","gists_url":"https://api.github.com/users/doctrine/gists{/gist_id}","starred_url":"https://api.github.com/users/doctrine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/doctrine/subscriptions","organizations_url":"https://api.github.com/users/doctrine/orgs","repos_url":"https://api.github.com/users/doctrine/repos","events_url":"https://api.github.com/users/doctrine/events{/privacy}","received_events_url":"https://api.github.com/users/doctrine/received_events","type":"Organization","site_admin":false},"repo":{"id":677464,"name":"dbal","full_name":"doctrine/dbal","owner":{"login":"doctrine","id":209254,"avatar_url":"https://avatars.githubusercontent.com/u/209254?v=3","gravatar_id":"","url":"https://api.github.com/users/doctrine","html_url":"https://github.com/doctrine","followers_url":"https://api.github.com/users/doctrine/followers","following_url":"https://api.github.com/users/doctrine/following{/other_user}","gists_url":"https://api.github.com/users/doctrine/gists{/gist_id}","starred_url":"https://api.github.com/users/doctrine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/doctrine/subscriptions","organizations_url":"https://api.github.com/users/doctrine/orgs","repos_url":"https://api.github.com/users/doctrine/repos","events_url":"https://api.github.com/users/doctrine/events{/privacy}","received_events_url":"https://api.github.com/users/doctrine/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/doctrine/dbal","description":"Doctrine Database Abstraction Layer","fork":false,"url":"https://api.github.com/repos/doctrine/dbal","forks_url":"https://api.github.com/repos/doctrine/dbal/forks","keys_url":"https://api.github.com/repos/doctrine/dbal/keys{/key_id}","collaborators_url":"https://api.github.com/repos/doctrine/dbal/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/doctrine/dbal/teams","hooks_url":"https://api.github.com/repos/doctrine/dbal/hooks","issue_events_url":"https://api.github.com/repos/doctrine/dbal/issues/events{/number}","events_url":"https://api.github.com/repos/doctrine/dbal/events","assignees_url":"https://api.github.com/repos/doctrine/dbal/assignees{/user}","branches_url":"https://api.github.com/repos/doctrine/dbal/branches{/branch}","tags_url":"https://api.github.com/repos/doctrine/dbal/tags","blobs_url":"https://api.github.com/repos/doctrine/dbal/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/doctrine/dbal/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/doctrine/dbal/git/refs{/sha}","trees_url":"https://api.github.com/repos/doctrine/dbal/git/trees{/sha}","statuses_url":"https://api.github.com/repos/doctrine/dbal/statuses/{sha}","languages_url":"https://api.github.com/repos/doctrine/dbal/languages","stargazers_url":"https://api.github.com/repos/doctrine/dbal/stargazers","contributors_url":"https://api.github.com/repos/doctrine/dbal/contributors","subscribers_url":"https://api.github.com/repos/doctrine/dbal/subscribers","subscription_url":"https://api.github.com/repos/doctrine/dbal/subscription","commits_url":"https://api.github.com/repos/doctrine/dbal/commits{/sha}","git_commits_url":"https://api.github.com/repos/doctrine/dbal/git/commits{/sha}","comments_url":"https://api.github.com/repos/doctrine/dbal/comments{/number}","issue_comment_url":"https://api.github.com/repos/doctrine/dbal/issues/comments{/number}","contents_url":"https://api.github.com/repos/doctrine/dbal/contents/{+path}","compare_url":"https://api.github.com/repos/doctrine/dbal/compare/{base}...{head}","merges_url":"https://api.github.com/repos/doctrine/dbal/merges","archive_url":"https://api.github.com/repos/doctrine/dbal/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/doctrine/dbal/downloads","issues_url":"https://api.github.com/repos/doctrine/dbal/issues{/number}","pulls_url":"https://api.github.com/repos/doctrine/dbal/pulls{/number}","milestones_url":"https://api.github.com/repos/doctrine/dbal/milestones{/number}","notifications_url":"https://api.github.com/repos/doctrine/dbal/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/doctrine/dbal/labels{/name}","releases_url":"https://api.github.com/repos/doctrine/dbal/releases{/id}","created_at":"2010-05-20T17:01:42Z","updated_at":"2015-12-16T08:32:05Z","pushed_at":"2015-12-16T20:50:50Z","git_url":"git://github.com/doctrine/dbal.git","ssh_url":"git@github.com:doctrine/dbal.git","clone_url":"https://github.com/doctrine/dbal.git","svn_url":"https://github.com/doctrine/dbal","homepage":"http://www.doctrine-project.org/projects/dbal","size":23429,"stargazers_count":685,"watchers_count":685,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":584,"mirror_url":null,"open_issues_count":311,"forks":584,"open_issues":311,"watchers":685,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/doctrine/dbal/pulls/2264"},"html":{"href":"https://github.com/doctrine/dbal/pull/2264"},"issue":{"href":"https://api.github.com/repos/doctrine/dbal/issues/2264"},"comments":{"href":"https://api.github.com/repos/doctrine/dbal/issues/2264/comments"},"review_comments":{"href":"https://api.github.com/repos/doctrine/dbal/pulls/2264/comments"},"review_comment":{"href":"https://api.github.com/repos/doctrine/dbal/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/doctrine/dbal/pulls/2264/commits"},"statuses":{"href":"https://api.github.com/repos/doctrine/dbal/statuses/2a1427f86efc46e13d59dfb4ca41c9ee19c28e36"}}}}