{"action":"created","comment":{"url":"https://api.github.com/repos/laravel/framework/pulls/comments/42878887","id":42878887,"diff_hunk":"@@ -200,6 +204,19 @@ public function compileTruncate(Builder $query)\n     }\n \n     /**\n+     * Compile an exists statement into SQL.\n+     *\n+     * @param \\Illuminate\\Database\\Query\\Builder $query\n+     * @return string\n+     */\n+    public function compileExists(Builder $query)\n+    {\n+        $select = $this->compileSelect($query);\n+\n+        return \"select cast(case when exists($select) then 1 else 0 end as bit) as {$this->wrap('exists')}\";","path":"src/Illuminate/Database/Query/Grammars/SqlServerGrammar.php","position":24,"original_position":24,"commit_id":"2fae3bd611a6fe200e58243ab36101d972b16ab8","original_commit_id":"2fae3bd611a6fe200e58243ab36101d972b16ab8","user":{"login":"acasar","id":6329543,"avatar_url":"https://avatars.githubusercontent.com/u/6329543?v=3","gravatar_id":"","url":"https://api.github.com/users/acasar","html_url":"https://github.com/acasar","followers_url":"https://api.github.com/users/acasar/followers","following_url":"https://api.github.com/users/acasar/following{/other_user}","gists_url":"https://api.github.com/users/acasar/gists{/gist_id}","starred_url":"https://api.github.com/users/acasar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/acasar/subscriptions","organizations_url":"https://api.github.com/users/acasar/orgs","repos_url":"https://api.github.com/users/acasar/repos","events_url":"https://api.github.com/users/acasar/events{/privacy}","received_events_url":"https://api.github.com/users/acasar/received_events","type":"User","site_admin":false},"body":"@JosephSilber exists should be a lot faster than count since it doesn't scan the whole table -according to MSDN official site.","created_at":"2015-10-23T15:32:22Z","updated_at":"2015-10-23T15:32:22Z","html_url":"https://github.com/laravel/framework/pull/10689#discussion_r42878887","pull_request_url":"https://api.github.com/repos/laravel/framework/pulls/10689","_links":{"self":{"href":"https://api.github.com/repos/laravel/framework/pulls/comments/42878887"},"html":{"href":"https://github.com/laravel/framework/pull/10689#discussion_r42878887"},"pull_request":{"href":"https://api.github.com/repos/laravel/framework/pulls/10689"}}},"pull_request":{"url":"https://api.github.com/repos/laravel/framework/pulls/10689","id":48500695,"html_url":"https://github.com/laravel/framework/pull/10689","diff_url":"https://github.com/laravel/framework/pull/10689.diff","patch_url":"https://github.com/laravel/framework/pull/10689.patch","issue_url":"https://api.github.com/repos/laravel/framework/issues/10689","number":10689,"state":"open","locked":false,"title":"[5.1] Sql server exists fix #2","user":{"login":"acasar","id":6329543,"avatar_url":"https://avatars.githubusercontent.com/u/6329543?v=3","gravatar_id":"","url":"https://api.github.com/users/acasar","html_url":"https://github.com/acasar","followers_url":"https://api.github.com/users/acasar/followers","following_url":"https://api.github.com/users/acasar/following{/other_user}","gists_url":"https://api.github.com/users/acasar/gists{/gist_id}","starred_url":"https://api.github.com/users/acasar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/acasar/subscriptions","organizations_url":"https://api.github.com/users/acasar/orgs","repos_url":"https://api.github.com/users/acasar/repos","events_url":"https://api.github.com/users/acasar/events{/privacy}","received_events_url":"https://api.github.com/users/acasar/received_events","type":"User","site_admin":false},"body":"I prepared a fix as suggested here: https://github.com/laravel/framework/issues/10580\r\n\r\nCan anyone with SQL Server confirm that this works now?","created_at":"2015-10-22T19:22:11Z","updated_at":"2015-10-23T15:32:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8f485de6da3b80447a99920a5a7fc3ab4a57af13","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/laravel/framework/pulls/10689/commits","review_comments_url":"https://api.github.com/repos/laravel/framework/pulls/10689/comments","review_comment_url":"https://api.github.com/repos/laravel/framework/pulls/comments{/number}","comments_url":"https://api.github.com/repos/laravel/framework/issues/10689/comments","statuses_url":"https://api.github.com/repos/laravel/framework/statuses/2fae3bd611a6fe200e58243ab36101d972b16ab8","head":{"label":"acasar:sql-server-exists-fix","ref":"sql-server-exists-fix","sha":"2fae3bd611a6fe200e58243ab36101d972b16ab8","user":{"login":"acasar","id":6329543,"avatar_url":"https://avatars.githubusercontent.com/u/6329543?v=3","gravatar_id":"","url":"https://api.github.com/users/acasar","html_url":"https://github.com/acasar","followers_url":"https://api.github.com/users/acasar/followers","following_url":"https://api.github.com/users/acasar/following{/other_user}","gists_url":"https://api.github.com/users/acasar/gists{/gist_id}","starred_url":"https://api.github.com/users/acasar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/acasar/subscriptions","organizations_url":"https://api.github.com/users/acasar/orgs","repos_url":"https://api.github.com/users/acasar/repos","events_url":"https://api.github.com/users/acasar/events{/privacy}","received_events_url":"https://api.github.com/users/acasar/received_events","type":"User","site_admin":false},"repo":{"id":44394741,"name":"framework","full_name":"acasar/framework","owner":{"login":"acasar","id":6329543,"avatar_url":"https://avatars.githubusercontent.com/u/6329543?v=3","gravatar_id":"","url":"https://api.github.com/users/acasar","html_url":"https://github.com/acasar","followers_url":"https://api.github.com/users/acasar/followers","following_url":"https://api.github.com/users/acasar/following{/other_user}","gists_url":"https://api.github.com/users/acasar/gists{/gist_id}","starred_url":"https://api.github.com/users/acasar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/acasar/subscriptions","organizations_url":"https://api.github.com/users/acasar/orgs","repos_url":"https://api.github.com/users/acasar/repos","events_url":"https://api.github.com/users/acasar/events{/privacy}","received_events_url":"https://api.github.com/users/acasar/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/acasar/framework","description":"","fork":true,"url":"https://api.github.com/repos/acasar/framework","forks_url":"https://api.github.com/repos/acasar/framework/forks","keys_url":"https://api.github.com/repos/acasar/framework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/acasar/framework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/acasar/framework/teams","hooks_url":"https://api.github.com/repos/acasar/framework/hooks","issue_events_url":"https://api.github.com/repos/acasar/framework/issues/events{/number}","events_url":"https://api.github.com/repos/acasar/framework/events","assignees_url":"https://api.github.com/repos/acasar/framework/assignees{/user}","branches_url":"https://api.github.com/repos/acasar/framework/branches{/branch}","tags_url":"https://api.github.com/repos/acasar/framework/tags","blobs_url":"https://api.github.com/repos/acasar/framework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/acasar/framework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/acasar/framework/git/refs{/sha}","trees_url":"https://api.github.com/repos/acasar/framework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/acasar/framework/statuses/{sha}","languages_url":"https://api.github.com/repos/acasar/framework/languages","stargazers_url":"https://api.github.com/repos/acasar/framework/stargazers","contributors_url":"https://api.github.com/repos/acasar/framework/contributors","subscribers_url":"https://api.github.com/repos/acasar/framework/subscribers","subscription_url":"https://api.github.com/repos/acasar/framework/subscription","commits_url":"https://api.github.com/repos/acasar/framework/commits{/sha}","git_commits_url":"https://api.github.com/repos/acasar/framework/git/commits{/sha}","comments_url":"https://api.github.com/repos/acasar/framework/comments{/number}","issue_comment_url":"https://api.github.com/repos/acasar/framework/issues/comments{/number}","contents_url":"https://api.github.com/repos/acasar/framework/contents/{+path}","compare_url":"https://api.github.com/repos/acasar/framework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/acasar/framework/merges","archive_url":"https://api.github.com/repos/acasar/framework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/acasar/framework/downloads","issues_url":"https://api.github.com/repos/acasar/framework/issues{/number}","pulls_url":"https://api.github.com/repos/acasar/framework/pulls{/number}","milestones_url":"https://api.github.com/repos/acasar/framework/milestones{/number}","notifications_url":"https://api.github.com/repos/acasar/framework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/acasar/framework/labels{/name}","releases_url":"https://api.github.com/repos/acasar/framework/releases{/id}","created_at":"2015-10-16T15:41:02Z","updated_at":"2015-10-16T15:41:07Z","pushed_at":"2015-10-22T20:52:32Z","git_url":"git://github.com/acasar/framework.git","ssh_url":"git@github.com:acasar/framework.git","clone_url":"https://github.com/acasar/framework.git","svn_url":"https://github.com/acasar/framework","homepage":"http://laravel.com","size":18909,"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":"5.1"}},"base":{"label":"laravel:5.1","ref":"5.1","sha":"aec203a2168a8286bf1fdaf1e90c0d19619b79ea","user":{"login":"laravel","id":958072,"avatar_url":"https://avatars.githubusercontent.com/u/958072?v=3","gravatar_id":"","url":"https://api.github.com/users/laravel","html_url":"https://github.com/laravel","followers_url":"https://api.github.com/users/laravel/followers","following_url":"https://api.github.com/users/laravel/following{/other_user}","gists_url":"https://api.github.com/users/laravel/gists{/gist_id}","starred_url":"https://api.github.com/users/laravel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/laravel/subscriptions","organizations_url":"https://api.github.com/users/laravel/orgs","repos_url":"https://api.github.com/users/laravel/repos","events_url":"https://api.github.com/users/laravel/events{/privacy}","received_events_url":"https://api.github.com/users/laravel/received_events","type":"Organization","site_admin":false},"repo":{"id":7548986,"name":"framework","full_name":"laravel/framework","owner":{"login":"laravel","id":958072,"avatar_url":"https://avatars.githubusercontent.com/u/958072?v=3","gravatar_id":"","url":"https://api.github.com/users/laravel","html_url":"https://github.com/laravel","followers_url":"https://api.github.com/users/laravel/followers","following_url":"https://api.github.com/users/laravel/following{/other_user}","gists_url":"https://api.github.com/users/laravel/gists{/gist_id}","starred_url":"https://api.github.com/users/laravel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/laravel/subscriptions","organizations_url":"https://api.github.com/users/laravel/orgs","repos_url":"https://api.github.com/users/laravel/repos","events_url":"https://api.github.com/users/laravel/events{/privacy}","received_events_url":"https://api.github.com/users/laravel/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/laravel/framework","description":"","fork":false,"url":"https://api.github.com/repos/laravel/framework","forks_url":"https://api.github.com/repos/laravel/framework/forks","keys_url":"https://api.github.com/repos/laravel/framework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/laravel/framework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/laravel/framework/teams","hooks_url":"https://api.github.com/repos/laravel/framework/hooks","issue_events_url":"https://api.github.com/repos/laravel/framework/issues/events{/number}","events_url":"https://api.github.com/repos/laravel/framework/events","assignees_url":"https://api.github.com/repos/laravel/framework/assignees{/user}","branches_url":"https://api.github.com/repos/laravel/framework/branches{/branch}","tags_url":"https://api.github.com/repos/laravel/framework/tags","blobs_url":"https://api.github.com/repos/laravel/framework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/laravel/framework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/laravel/framework/git/refs{/sha}","trees_url":"https://api.github.com/repos/laravel/framework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/laravel/framework/statuses/{sha}","languages_url":"https://api.github.com/repos/laravel/framework/languages","stargazers_url":"https://api.github.com/repos/laravel/framework/stargazers","contributors_url":"https://api.github.com/repos/laravel/framework/contributors","subscribers_url":"https://api.github.com/repos/laravel/framework/subscribers","subscription_url":"https://api.github.com/repos/laravel/framework/subscription","commits_url":"https://api.github.com/repos/laravel/framework/commits{/sha}","git_commits_url":"https://api.github.com/repos/laravel/framework/git/commits{/sha}","comments_url":"https://api.github.com/repos/laravel/framework/comments{/number}","issue_comment_url":"https://api.github.com/repos/laravel/framework/issues/comments{/number}","contents_url":"https://api.github.com/repos/laravel/framework/contents/{+path}","compare_url":"https://api.github.com/repos/laravel/framework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/laravel/framework/merges","archive_url":"https://api.github.com/repos/laravel/framework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/laravel/framework/downloads","issues_url":"https://api.github.com/repos/laravel/framework/issues{/number}","pulls_url":"https://api.github.com/repos/laravel/framework/pulls{/number}","milestones_url":"https://api.github.com/repos/laravel/framework/milestones{/number}","notifications_url":"https://api.github.com/repos/laravel/framework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/laravel/framework/labels{/name}","releases_url":"https://api.github.com/repos/laravel/framework/releases{/id}","created_at":"2013-01-10T21:27:28Z","updated_at":"2015-10-22T23:48:42Z","pushed_at":"2015-10-23T15:30:22Z","git_url":"git://github.com/laravel/framework.git","ssh_url":"git@github.com:laravel/framework.git","clone_url":"https://github.com/laravel/framework.git","svn_url":"https://github.com/laravel/framework","homepage":"http://laravel.com","size":69563,"stargazers_count":4234,"watchers_count":4234,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2454,"mirror_url":null,"open_issues_count":78,"forks":2454,"open_issues":78,"watchers":4234,"default_branch":"5.1"}},"_links":{"self":{"href":"https://api.github.com/repos/laravel/framework/pulls/10689"},"html":{"href":"https://github.com/laravel/framework/pull/10689"},"issue":{"href":"https://api.github.com/repos/laravel/framework/issues/10689"},"comments":{"href":"https://api.github.com/repos/laravel/framework/issues/10689/comments"},"review_comments":{"href":"https://api.github.com/repos/laravel/framework/pulls/10689/comments"},"review_comment":{"href":"https://api.github.com/repos/laravel/framework/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/laravel/framework/pulls/10689/commits"},"statuses":{"href":"https://api.github.com/repos/laravel/framework/statuses/2fae3bd611a6fe200e58243ab36101d972b16ab8"}}}}