{"action":"created","comment":{"url":"https://api.github.com/repos/OlinMobileProto/Lab2/pulls/comments/42179009","id":42179009,"diff_hunk":"@@ -0,0 +1,180 @@\n+package com.mycompany.imageview;\n+\n+/**\n+ * Created by root on 9/28/15.\n+ */\n+\n+import android.content.ContentValues;\n+import android.content.Context;\n+import android.database.Cursor;\n+import android.database.sqlite.SQLiteDatabase;\n+import android.database.sqlite.SQLiteOpenHelper;\n+import android.util.Log;\n+\n+import java.io.File;\n+import java.util.LinkedList;\n+import java.util.List;\n+\n+public class MySQLiteHelper extends SQLiteOpenHelper {\n+\n+    // Database Version\n+    private static final int DATABASE_VERSION = 2;\n+    // Database Name\n+    private static final String DATABASE_NAME = \"Image_Library\";\n+\n+    // Contacts table name\n+    private static final String TABLE_CONTACTS = \"Images\";\n+    // Image Table Columns names\n+    private static final String KEY_ID = \"id\";\n+    private static final String KEY_keyword = \"keyword\";\n+    private static final String KEY_link = \"link\";\n+\n+    private static final String[] COLUMNS = {KEY_ID,KEY_keyword,KEY_link};\n+\n+\n+\n+\n+\n+\n+    public MySQLiteHelper(Context context) {\n+        super(context, DATABASE_NAME, null, DATABASE_VERSION);\n+    }\n+\n+    @Override\n+    public void onCreate(SQLiteDatabase db) {\n+        // SQL statement to create book table\n+        String CREATE_IMAGE_TABLE = \"CREATE TABLE \"+TABLE_CONTACTS+\" ( \" +\n+                KEY_ID+\" INTEGER PRIMARY KEY AUTOINCREMENT, \" +KEY_keyword+\n+                \" TEXT, \"+\n+                KEY_link+\" TEXT )\";\n+\n+        // create books table\n+        db.execSQL(CREATE_IMAGE_TABLE);\n+    }\n+\n+    @Override\n+    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {\n+        // Drop older books table if existed\n+        db.execSQL(\"DROP TABLE IF EXISTS \"+ TABLE_CONTACTS);\n+\n+        // create fresh books table\n+        this.onCreate(db);\n+    }\n+\n+\n+\n+\n+    public void add_image(Image_DB image){\n+        //for logging\n+        Log.d(\"add_image\", image.toString());\n+\n+        // 1. get reference to writable DB\n+        SQLiteDatabase db = this.getWritableDatabase();\n+\n+        // 2. create ContentValues to add key \"column\"/value\n+        ContentValues values = new ContentValues();\n+        values.put(KEY_keyword, image.getkeyword()); // get title\n+        values.put(KEY_link, image.getLink()); // get author\n+\n+        // 3. insert\n+        db.insert(TABLE_CONTACTS, // table\n+                null, //nullColumnHack\n+                values); // key/value -> keys = column names/ values = column values\n+\n+        // 4. close\n+        db.close();\n+    }\n+    public Image_DB get_image(int id){\n+\n+        // 1. get reference to readable DB\n+        SQLiteDatabase db = this.getReadableDatabase();\n+\n+        // 2. build query\n+        Cursor cursor =\n+                db.query(TABLE_CONTACTS, // a. table\n+                        COLUMNS, // b. column names\n+                        \" id = ?\", // c. selections\n+                        new String[] { String.valueOf(id) }, // d. selections args\n+                        null, // e. group by\n+                        null, // f. having\n+                        null, // g. order by\n+                        null); // h. limit\n+\n+        // 3. if we got results get the first one\n+        if (cursor != null)\n+            cursor.moveToFirst();\n+\n+        // 4. build book object\n+        Image_DB image = new Image_DB();\n+        image.set_id(Integer.parseInt(cursor.getString(0)));\n+        image.set_keyword(cursor.getString(1));\n+        image.set_link(cursor.getString(2));\n+\n+        //log\n+        Log.d(\"getBook(\" + id + \")\", image.toString());\n+\n+        // 5. return book","path":"Imageview/app/src/main/java/com/mycompany/imageview/MySQLiteHelper.java","position":116,"original_position":116,"commit_id":"f9e90324e34ffdf15dd833c427ba16cd12ee2c26","original_commit_id":"f9e90324e34ffdf15dd833c427ba16cd12ee2c26","user":{"login":"dcelik","id":5778626,"avatar_url":"https://avatars.githubusercontent.com/u/5778626?v=3","gravatar_id":"","url":"https://api.github.com/users/dcelik","html_url":"https://github.com/dcelik","followers_url":"https://api.github.com/users/dcelik/followers","following_url":"https://api.github.com/users/dcelik/following{/other_user}","gists_url":"https://api.github.com/users/dcelik/gists{/gist_id}","starred_url":"https://api.github.com/users/dcelik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dcelik/subscriptions","organizations_url":"https://api.github.com/users/dcelik/orgs","repos_url":"https://api.github.com/users/dcelik/repos","events_url":"https://api.github.com/users/dcelik/events{/privacy}","received_events_url":"https://api.github.com/users/dcelik/received_events","type":"User","site_admin":false},"body":"return book? clear up comments and logs to be more descriptive.","created_at":"2015-10-15T20:54:13Z","updated_at":"2015-10-15T20:54:13Z","html_url":"https://github.com/OlinMobileProto/Lab2/pull/15#discussion_r42179009","pull_request_url":"https://api.github.com/repos/OlinMobileProto/Lab2/pulls/15","_links":{"self":{"href":"https://api.github.com/repos/OlinMobileProto/Lab2/pulls/comments/42179009"},"html":{"href":"https://github.com/OlinMobileProto/Lab2/pull/15#discussion_r42179009"},"pull_request":{"href":"https://api.github.com/repos/OlinMobileProto/Lab2/pulls/15"}}},"pull_request":{"url":"https://api.github.com/repos/OlinMobileProto/Lab2/pulls/15","id":46698086,"html_url":"https://github.com/OlinMobileProto/Lab2/pull/15","diff_url":"https://github.com/OlinMobileProto/Lab2/pull/15.diff","patch_url":"https://github.com/OlinMobileProto/Lab2/pull/15.patch","issue_url":"https://api.github.com/repos/OlinMobileProto/Lab2/issues/15","number":15,"state":"open","locked":false,"title":"James: Commenting on Lab 2","user":{"login":"dcelik","id":5778626,"avatar_url":"https://avatars.githubusercontent.com/u/5778626?v=3","gravatar_id":"","url":"https://api.github.com/users/dcelik","html_url":"https://github.com/dcelik","followers_url":"https://api.github.com/users/dcelik/followers","following_url":"https://api.github.com/users/dcelik/following{/other_user}","gists_url":"https://api.github.com/users/dcelik/gists{/gist_id}","starred_url":"https://api.github.com/users/dcelik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dcelik/subscriptions","organizations_url":"https://api.github.com/users/dcelik/orgs","repos_url":"https://api.github.com/users/dcelik/repos","events_url":"https://api.github.com/users/dcelik/events{/privacy}","received_events_url":"https://api.github.com/users/dcelik/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-10-03T02:33:05Z","updated_at":"2015-10-15T20:54:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b0a482741694ff90bcaa31cc70443f7c1831e360","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/OlinMobileProto/Lab2/pulls/15/commits","review_comments_url":"https://api.github.com/repos/OlinMobileProto/Lab2/pulls/15/comments","review_comment_url":"https://api.github.com/repos/OlinMobileProto/Lab2/pulls/comments{/number}","comments_url":"https://api.github.com/repos/OlinMobileProto/Lab2/issues/15/comments","statuses_url":"https://api.github.com/repos/OlinMobileProto/Lab2/statuses/f9e90324e34ffdf15dd833c427ba16cd12ee2c26","head":{"label":"ZhecanJamesWang:master","ref":"master","sha":"f9e90324e34ffdf15dd833c427ba16cd12ee2c26","user":{"login":"ZhecanJamesWang","id":8936136,"avatar_url":"https://avatars.githubusercontent.com/u/8936136?v=3","gravatar_id":"","url":"https://api.github.com/users/ZhecanJamesWang","html_url":"https://github.com/ZhecanJamesWang","followers_url":"https://api.github.com/users/ZhecanJamesWang/followers","following_url":"https://api.github.com/users/ZhecanJamesWang/following{/other_user}","gists_url":"https://api.github.com/users/ZhecanJamesWang/gists{/gist_id}","starred_url":"https://api.github.com/users/ZhecanJamesWang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ZhecanJamesWang/subscriptions","organizations_url":"https://api.github.com/users/ZhecanJamesWang/orgs","repos_url":"https://api.github.com/users/ZhecanJamesWang/repos","events_url":"https://api.github.com/users/ZhecanJamesWang/events{/privacy}","received_events_url":"https://api.github.com/users/ZhecanJamesWang/received_events","type":"User","site_admin":false},"repo":{"id":43096815,"name":"Lab2","full_name":"ZhecanJamesWang/Lab2","owner":{"login":"ZhecanJamesWang","id":8936136,"avatar_url":"https://avatars.githubusercontent.com/u/8936136?v=3","gravatar_id":"","url":"https://api.github.com/users/ZhecanJamesWang","html_url":"https://github.com/ZhecanJamesWang","followers_url":"https://api.github.com/users/ZhecanJamesWang/followers","following_url":"https://api.github.com/users/ZhecanJamesWang/following{/other_user}","gists_url":"https://api.github.com/users/ZhecanJamesWang/gists{/gist_id}","starred_url":"https://api.github.com/users/ZhecanJamesWang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ZhecanJamesWang/subscriptions","organizations_url":"https://api.github.com/users/ZhecanJamesWang/orgs","repos_url":"https://api.github.com/users/ZhecanJamesWang/repos","events_url":"https://api.github.com/users/ZhecanJamesWang/events{/privacy}","received_events_url":"https://api.github.com/users/ZhecanJamesWang/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ZhecanJamesWang/Lab2","description":"Lab for photo stream app for Mobile Proto","fork":true,"url":"https://api.github.com/repos/ZhecanJamesWang/Lab2","forks_url":"https://api.github.com/repos/ZhecanJamesWang/Lab2/forks","keys_url":"https://api.github.com/repos/ZhecanJamesWang/Lab2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ZhecanJamesWang/Lab2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ZhecanJamesWang/Lab2/teams","hooks_url":"https://api.github.com/repos/ZhecanJamesWang/Lab2/hooks","issue_events_url":"https://api.github.com/repos/ZhecanJamesWang/Lab2/issues/events{/number}","events_url":"https://api.github.com/repos/ZhecanJamesWang/Lab2/events","assignees_url":"https://api.github.com/repos/ZhecanJamesWang/Lab2/assignees{/user}","branches_url":"https://api.github.com/repos/ZhecanJamesWang/Lab2/branches{/branch}","tags_url":"https://api.github.com/repos/ZhecanJamesWang/Lab2/tags","blobs_url":"https://api.github.com/repos/ZhecanJamesWang/Lab2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ZhecanJamesWang/Lab2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ZhecanJamesWang/Lab2/git/refs{/sha}","trees_url":"https://api.github.com/repos/ZhecanJamesWang/Lab2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ZhecanJamesWang/Lab2/statuses/{sha}","languages_url":"https://api.github.com/repos/ZhecanJamesWang/Lab2/languages","stargazers_url":"https://api.github.com/repos/ZhecanJamesWang/Lab2/stargazers","contributors_url":"https://api.github.com/repos/ZhecanJamesWang/Lab2/contributors","subscribers_url":"https://api.github.com/repos/ZhecanJamesWang/Lab2/subscribers","subscription_url":"https://api.github.com/repos/ZhecanJamesWang/Lab2/subscription","commits_url":"https://api.github.com/repos/ZhecanJamesWang/Lab2/commits{/sha}","git_commits_url":"https://api.github.com/repos/ZhecanJamesWang/Lab2/git/commits{/sha}","comments_url":"https://api.github.com/repos/ZhecanJamesWang/Lab2/comments{/number}","issue_comment_url":"https://api.github.com/repos/ZhecanJamesWang/Lab2/issues/comments{/number}","contents_url":"https://api.github.com/repos/ZhecanJamesWang/Lab2/contents/{+path}","compare_url":"https://api.github.com/repos/ZhecanJamesWang/Lab2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ZhecanJamesWang/Lab2/merges","archive_url":"https://api.github.com/repos/ZhecanJamesWang/Lab2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ZhecanJamesWang/Lab2/downloads","issues_url":"https://api.github.com/repos/ZhecanJamesWang/Lab2/issues{/number}","pulls_url":"https://api.github.com/repos/ZhecanJamesWang/Lab2/pulls{/number}","milestones_url":"https://api.github.com/repos/ZhecanJamesWang/Lab2/milestones{/number}","notifications_url":"https://api.github.com/repos/ZhecanJamesWang/Lab2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ZhecanJamesWang/Lab2/labels{/name}","releases_url":"https://api.github.com/repos/ZhecanJamesWang/Lab2/releases{/id}","created_at":"2015-09-24T22:38:40Z","updated_at":"2015-09-25T15:06:41Z","pushed_at":"2015-10-01T16:45:34Z","git_url":"git://github.com/ZhecanJamesWang/Lab2.git","ssh_url":"git@github.com:ZhecanJamesWang/Lab2.git","clone_url":"https://github.com/ZhecanJamesWang/Lab2.git","svn_url":"https://github.com/ZhecanJamesWang/Lab2","homepage":null,"size":254,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"OlinMobileProto:master","ref":"master","sha":"18926a0030b655e3c7ba0c9d20daf56b95e33ec0","user":{"login":"OlinMobileProto","id":11400546,"avatar_url":"https://avatars.githubusercontent.com/u/11400546?v=3","gravatar_id":"","url":"https://api.github.com/users/OlinMobileProto","html_url":"https://github.com/OlinMobileProto","followers_url":"https://api.github.com/users/OlinMobileProto/followers","following_url":"https://api.github.com/users/OlinMobileProto/following{/other_user}","gists_url":"https://api.github.com/users/OlinMobileProto/gists{/gist_id}","starred_url":"https://api.github.com/users/OlinMobileProto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OlinMobileProto/subscriptions","organizations_url":"https://api.github.com/users/OlinMobileProto/orgs","repos_url":"https://api.github.com/users/OlinMobileProto/repos","events_url":"https://api.github.com/users/OlinMobileProto/events{/privacy}","received_events_url":"https://api.github.com/users/OlinMobileProto/received_events","type":"Organization","site_admin":false},"repo":{"id":42400545,"name":"Lab2","full_name":"OlinMobileProto/Lab2","owner":{"login":"OlinMobileProto","id":11400546,"avatar_url":"https://avatars.githubusercontent.com/u/11400546?v=3","gravatar_id":"","url":"https://api.github.com/users/OlinMobileProto","html_url":"https://github.com/OlinMobileProto","followers_url":"https://api.github.com/users/OlinMobileProto/followers","following_url":"https://api.github.com/users/OlinMobileProto/following{/other_user}","gists_url":"https://api.github.com/users/OlinMobileProto/gists{/gist_id}","starred_url":"https://api.github.com/users/OlinMobileProto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OlinMobileProto/subscriptions","organizations_url":"https://api.github.com/users/OlinMobileProto/orgs","repos_url":"https://api.github.com/users/OlinMobileProto/repos","events_url":"https://api.github.com/users/OlinMobileProto/events{/privacy}","received_events_url":"https://api.github.com/users/OlinMobileProto/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/OlinMobileProto/Lab2","description":"Lab for photo stream app for Mobile Proto","fork":false,"url":"https://api.github.com/repos/OlinMobileProto/Lab2","forks_url":"https://api.github.com/repos/OlinMobileProto/Lab2/forks","keys_url":"https://api.github.com/repos/OlinMobileProto/Lab2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OlinMobileProto/Lab2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OlinMobileProto/Lab2/teams","hooks_url":"https://api.github.com/repos/OlinMobileProto/Lab2/hooks","issue_events_url":"https://api.github.com/repos/OlinMobileProto/Lab2/issues/events{/number}","events_url":"https://api.github.com/repos/OlinMobileProto/Lab2/events","assignees_url":"https://api.github.com/repos/OlinMobileProto/Lab2/assignees{/user}","branches_url":"https://api.github.com/repos/OlinMobileProto/Lab2/branches{/branch}","tags_url":"https://api.github.com/repos/OlinMobileProto/Lab2/tags","blobs_url":"https://api.github.com/repos/OlinMobileProto/Lab2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OlinMobileProto/Lab2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OlinMobileProto/Lab2/git/refs{/sha}","trees_url":"https://api.github.com/repos/OlinMobileProto/Lab2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OlinMobileProto/Lab2/statuses/{sha}","languages_url":"https://api.github.com/repos/OlinMobileProto/Lab2/languages","stargazers_url":"https://api.github.com/repos/OlinMobileProto/Lab2/stargazers","contributors_url":"https://api.github.com/repos/OlinMobileProto/Lab2/contributors","subscribers_url":"https://api.github.com/repos/OlinMobileProto/Lab2/subscribers","subscription_url":"https://api.github.com/repos/OlinMobileProto/Lab2/subscription","commits_url":"https://api.github.com/repos/OlinMobileProto/Lab2/commits{/sha}","git_commits_url":"https://api.github.com/repos/OlinMobileProto/Lab2/git/commits{/sha}","comments_url":"https://api.github.com/repos/OlinMobileProto/Lab2/comments{/number}","issue_comment_url":"https://api.github.com/repos/OlinMobileProto/Lab2/issues/comments{/number}","contents_url":"https://api.github.com/repos/OlinMobileProto/Lab2/contents/{+path}","compare_url":"https://api.github.com/repos/OlinMobileProto/Lab2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OlinMobileProto/Lab2/merges","archive_url":"https://api.github.com/repos/OlinMobileProto/Lab2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OlinMobileProto/Lab2/downloads","issues_url":"https://api.github.com/repos/OlinMobileProto/Lab2/issues{/number}","pulls_url":"https://api.github.com/repos/OlinMobileProto/Lab2/pulls{/number}","milestones_url":"https://api.github.com/repos/OlinMobileProto/Lab2/milestones{/number}","notifications_url":"https://api.github.com/repos/OlinMobileProto/Lab2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OlinMobileProto/Lab2/labels{/name}","releases_url":"https://api.github.com/repos/OlinMobileProto/Lab2/releases{/id}","created_at":"2015-09-13T15:12:26Z","updated_at":"2015-09-13T15:12:26Z","pushed_at":"2015-10-04T21:53:38Z","git_url":"git://github.com/OlinMobileProto/Lab2.git","ssh_url":"git@github.com:OlinMobileProto/Lab2.git","clone_url":"https://github.com/OlinMobileProto/Lab2.git","svn_url":"https://github.com/OlinMobileProto/Lab2","homepage":null,"size":878,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":17,"mirror_url":null,"open_issues_count":16,"forks":17,"open_issues":16,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/OlinMobileProto/Lab2/pulls/15"},"html":{"href":"https://github.com/OlinMobileProto/Lab2/pull/15"},"issue":{"href":"https://api.github.com/repos/OlinMobileProto/Lab2/issues/15"},"comments":{"href":"https://api.github.com/repos/OlinMobileProto/Lab2/issues/15/comments"},"review_comments":{"href":"https://api.github.com/repos/OlinMobileProto/Lab2/pulls/15/comments"},"review_comment":{"href":"https://api.github.com/repos/OlinMobileProto/Lab2/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/OlinMobileProto/Lab2/pulls/15/commits"},"statuses":{"href":"https://api.github.com/repos/OlinMobileProto/Lab2/statuses/f9e90324e34ffdf15dd833c427ba16cd12ee2c26"}}}}