{"action":"created","comment":{"url":"https://api.github.com/repos/47deg/scala-sqlite-droid/pulls/comments/34698040","id":34698040,"diff_hunk":"@@ -0,0 +1,79 @@\n+package com.fortysevendeg.android.sqlite.util\n+\n+import java.lang.reflect.Method\n+import java.sql.{PreparedStatement, ResultSet, Types}\n+\n+import com.fortysevendeg.android.sqlite\n+\n+import android.database.Cursor\n+\n+import scala.annotation.tailrec\n+import scala.util.{Failure, Success, Try}\n+\n+object CursorUtils {\n+\n+  trait CursorProcessor[T] {\n+    def move(t: T): Boolean\n+    def close(t: T): Unit\n+    def isClosed(t: T): Boolean\n+  }\n+\n+  implicit def `Cursor processor` = new CursorProcessor[Cursor] {\n+\n+    def move(cursor: Cursor): Boolean = cursor.moveToNext()\n+\n+    def close(cursor: Cursor): Unit = Try(cursor.close())\n+\n+    def isClosed(cursor: Cursor): Boolean = cursor.isClosed\n+  }\n+\n+  implicit def `ResultSet processor` = new CursorProcessor[ResultSet] {\n+\n+    def move(resultSet: ResultSet): Boolean = resultSet.next()\n+\n+    def close(resultSet: ResultSet): Unit = Try(resultSet.close())\n+\n+    def isClosed(resultSet: ResultSet): Boolean = resultSet.isClosed\n+\n+  }\n+\n+  private def processCursor[T, C](c: C)(process: C => T, until: Option[Int] = None)(implicit cursorProcessor: CursorProcessor[C]) = {\n+    def untilTrue(size: Int) = until map (_ > size) getOrElse true\n+    @tailrec\n+    def loop(seq: Seq[T], c: C): Seq[T] = {","path":"src/main/scala/com/fortysevendeg/android/sqlite/util/CursorUtils.scala","position":43,"original_position":43,"commit_id":"f7962700e904a199e4b592b6717db6302214dde5","original_commit_id":"f7962700e904a199e4b592b6717db6302214dde5","user":{"login":"fedefernandez","id":720923,"avatar_url":"https://avatars.githubusercontent.com/u/720923?v=3","gravatar_id":"","url":"https://api.github.com/users/fedefernandez","html_url":"https://github.com/fedefernandez","followers_url":"https://api.github.com/users/fedefernandez/followers","following_url":"https://api.github.com/users/fedefernandez/following{/other_user}","gists_url":"https://api.github.com/users/fedefernandez/gists{/gist_id}","starred_url":"https://api.github.com/users/fedefernandez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fedefernandez/subscriptions","organizations_url":"https://api.github.com/users/fedefernandez/orgs","repos_url":"https://api.github.com/users/fedefernandez/repos","events_url":"https://api.github.com/users/fedefernandez/events{/privacy}","received_events_url":"https://api.github.com/users/fedefernandez/received_events","type":"User","site_admin":false},"body":"Nope, good point","created_at":"2015-07-15T16:28:00Z","updated_at":"2015-07-15T16:28:00Z","html_url":"https://github.com/47deg/scala-sqlite-droid/pull/6#discussion_r34698040","pull_request_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/pulls/6","_links":{"self":{"href":"https://api.github.com/repos/47deg/scala-sqlite-droid/pulls/comments/34698040"},"html":{"href":"https://github.com/47deg/scala-sqlite-droid/pull/6#discussion_r34698040"},"pull_request":{"href":"https://api.github.com/repos/47deg/scala-sqlite-droid/pulls/6"}}},"pull_request":{"url":"https://api.github.com/repos/47deg/scala-sqlite-droid/pulls/6","id":39995409,"html_url":"https://github.com/47deg/scala-sqlite-droid/pull/6","diff_url":"https://github.com/47deg/scala-sqlite-droid/pull/6.diff","patch_url":"https://github.com/47deg/scala-sqlite-droid/pull/6.patch","issue_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/issues/6","number":6,"state":"open","locked":false,"title":"Database meta data","user":{"login":"fedefernandez","id":720923,"avatar_url":"https://avatars.githubusercontent.com/u/720923?v=3","gravatar_id":"","url":"https://api.github.com/users/fedefernandez","html_url":"https://github.com/fedefernandez","followers_url":"https://api.github.com/users/fedefernandez/followers","following_url":"https://api.github.com/users/fedefernandez/following{/other_user}","gists_url":"https://api.github.com/users/fedefernandez/gists{/gist_id}","starred_url":"https://api.github.com/users/fedefernandez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fedefernandez/subscriptions","organizations_url":"https://api.github.com/users/fedefernandez/orgs","repos_url":"https://api.github.com/users/fedefernandez/repos","events_url":"https://api.github.com/users/fedefernandez/events{/privacy}","received_events_url":"https://api.github.com/users/fedefernandez/received_events","type":"User","site_admin":false},"body":"This PR gives the DatabaseMetadata implementation.\r\n\r\nSummary of the work:\r\n- The implementation has been split in `SQLDroidDatabaseMetaData.scala` and `SQLiteDatabaseMetaDataSupport` (supports only gives boolean values indicating what's supported)\r\n- The `PrimaryKey` logic has been moved to a `class` with an `apply` method\r\n- `SQLDroidDatabaseMetaData` has a companion object that contains methods and fields to create SQL statements\r\n- The cursor methods has been moved to a new object called `CursorUtils`\r\n\r\n@juanpedromoreno please, could you review? no hurries, thanks\r\n\r\n","created_at":"2015-07-15T07:37:40Z","updated_at":"2015-07-15T16:28:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3ba4ee8f8adf4b0e3ebba29f7df0d8b0513915ff","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/pulls/6/commits","review_comments_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/pulls/6/comments","review_comment_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/pulls/comments{/number}","comments_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/issues/6/comments","statuses_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/statuses/f7962700e904a199e4b592b6717db6302214dde5","head":{"label":"47deg:fede-database-meta-data","ref":"fede-database-meta-data","sha":"f7962700e904a199e4b592b6717db6302214dde5","user":{"login":"47deg","id":479857,"avatar_url":"https://avatars.githubusercontent.com/u/479857?v=3","gravatar_id":"","url":"https://api.github.com/users/47deg","html_url":"https://github.com/47deg","followers_url":"https://api.github.com/users/47deg/followers","following_url":"https://api.github.com/users/47deg/following{/other_user}","gists_url":"https://api.github.com/users/47deg/gists{/gist_id}","starred_url":"https://api.github.com/users/47deg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/47deg/subscriptions","organizations_url":"https://api.github.com/users/47deg/orgs","repos_url":"https://api.github.com/users/47deg/repos","events_url":"https://api.github.com/users/47deg/events{/privacy}","received_events_url":"https://api.github.com/users/47deg/received_events","type":"Organization","site_admin":false},"repo":{"id":37643527,"name":"scala-sqlite-droid","full_name":"47deg/scala-sqlite-droid","owner":{"login":"47deg","id":479857,"avatar_url":"https://avatars.githubusercontent.com/u/479857?v=3","gravatar_id":"","url":"https://api.github.com/users/47deg","html_url":"https://github.com/47deg","followers_url":"https://api.github.com/users/47deg/followers","following_url":"https://api.github.com/users/47deg/following{/other_user}","gists_url":"https://api.github.com/users/47deg/gists{/gist_id}","starred_url":"https://api.github.com/users/47deg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/47deg/subscriptions","organizations_url":"https://api.github.com/users/47deg/orgs","repos_url":"https://api.github.com/users/47deg/repos","events_url":"https://api.github.com/users/47deg/events{/privacy}","received_events_url":"https://api.github.com/users/47deg/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/47deg/scala-sqlite-droid","description":"SQLite JDBC Driver for Android in Scala","fork":false,"url":"https://api.github.com/repos/47deg/scala-sqlite-droid","forks_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/forks","keys_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/keys{/key_id}","collaborators_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/teams","hooks_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/hooks","issue_events_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/issues/events{/number}","events_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/events","assignees_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/assignees{/user}","branches_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/branches{/branch}","tags_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/tags","blobs_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/git/refs{/sha}","trees_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/git/trees{/sha}","statuses_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/statuses/{sha}","languages_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/languages","stargazers_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/stargazers","contributors_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/contributors","subscribers_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/subscribers","subscription_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/subscription","commits_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/commits{/sha}","git_commits_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/git/commits{/sha}","comments_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/comments{/number}","issue_comment_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/issues/comments{/number}","contents_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/contents/{+path}","compare_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/compare/{base}...{head}","merges_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/merges","archive_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/downloads","issues_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/issues{/number}","pulls_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/pulls{/number}","milestones_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/milestones{/number}","notifications_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/labels{/name}","releases_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/releases{/id}","created_at":"2015-06-18T07:08:05Z","updated_at":"2015-06-18T07:13:20Z","pushed_at":"2015-07-15T09:58:46Z","git_url":"git://github.com/47deg/scala-sqlite-droid.git","ssh_url":"git@github.com:47deg/scala-sqlite-droid.git","clone_url":"https://github.com/47deg/scala-sqlite-droid.git","svn_url":"https://github.com/47deg/scala-sqlite-droid","homepage":null,"size":19536,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"47deg:master","ref":"master","sha":"ed395dc7c4634c93e086b9e9dd249010930a52c2","user":{"login":"47deg","id":479857,"avatar_url":"https://avatars.githubusercontent.com/u/479857?v=3","gravatar_id":"","url":"https://api.github.com/users/47deg","html_url":"https://github.com/47deg","followers_url":"https://api.github.com/users/47deg/followers","following_url":"https://api.github.com/users/47deg/following{/other_user}","gists_url":"https://api.github.com/users/47deg/gists{/gist_id}","starred_url":"https://api.github.com/users/47deg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/47deg/subscriptions","organizations_url":"https://api.github.com/users/47deg/orgs","repos_url":"https://api.github.com/users/47deg/repos","events_url":"https://api.github.com/users/47deg/events{/privacy}","received_events_url":"https://api.github.com/users/47deg/received_events","type":"Organization","site_admin":false},"repo":{"id":37643527,"name":"scala-sqlite-droid","full_name":"47deg/scala-sqlite-droid","owner":{"login":"47deg","id":479857,"avatar_url":"https://avatars.githubusercontent.com/u/479857?v=3","gravatar_id":"","url":"https://api.github.com/users/47deg","html_url":"https://github.com/47deg","followers_url":"https://api.github.com/users/47deg/followers","following_url":"https://api.github.com/users/47deg/following{/other_user}","gists_url":"https://api.github.com/users/47deg/gists{/gist_id}","starred_url":"https://api.github.com/users/47deg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/47deg/subscriptions","organizations_url":"https://api.github.com/users/47deg/orgs","repos_url":"https://api.github.com/users/47deg/repos","events_url":"https://api.github.com/users/47deg/events{/privacy}","received_events_url":"https://api.github.com/users/47deg/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/47deg/scala-sqlite-droid","description":"SQLite JDBC Driver for Android in Scala","fork":false,"url":"https://api.github.com/repos/47deg/scala-sqlite-droid","forks_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/forks","keys_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/keys{/key_id}","collaborators_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/teams","hooks_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/hooks","issue_events_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/issues/events{/number}","events_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/events","assignees_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/assignees{/user}","branches_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/branches{/branch}","tags_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/tags","blobs_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/git/refs{/sha}","trees_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/git/trees{/sha}","statuses_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/statuses/{sha}","languages_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/languages","stargazers_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/stargazers","contributors_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/contributors","subscribers_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/subscribers","subscription_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/subscription","commits_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/commits{/sha}","git_commits_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/git/commits{/sha}","comments_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/comments{/number}","issue_comment_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/issues/comments{/number}","contents_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/contents/{+path}","compare_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/compare/{base}...{head}","merges_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/merges","archive_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/downloads","issues_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/issues{/number}","pulls_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/pulls{/number}","milestones_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/milestones{/number}","notifications_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/labels{/name}","releases_url":"https://api.github.com/repos/47deg/scala-sqlite-droid/releases{/id}","created_at":"2015-06-18T07:08:05Z","updated_at":"2015-06-18T07:13:20Z","pushed_at":"2015-07-15T09:58:46Z","git_url":"git://github.com/47deg/scala-sqlite-droid.git","ssh_url":"git@github.com:47deg/scala-sqlite-droid.git","clone_url":"https://github.com/47deg/scala-sqlite-droid.git","svn_url":"https://github.com/47deg/scala-sqlite-droid","homepage":null,"size":19536,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/47deg/scala-sqlite-droid/pulls/6"},"html":{"href":"https://github.com/47deg/scala-sqlite-droid/pull/6"},"issue":{"href":"https://api.github.com/repos/47deg/scala-sqlite-droid/issues/6"},"comments":{"href":"https://api.github.com/repos/47deg/scala-sqlite-droid/issues/6/comments"},"review_comments":{"href":"https://api.github.com/repos/47deg/scala-sqlite-droid/pulls/6/comments"},"review_comment":{"href":"https://api.github.com/repos/47deg/scala-sqlite-droid/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/47deg/scala-sqlite-droid/pulls/6/commits"},"statuses":{"href":"https://api.github.com/repos/47deg/scala-sqlite-droid/statuses/f7962700e904a199e4b592b6717db6302214dde5"}}}}