{"action":"created","comment":{"url":"https://api.github.com/repos/datastax/java-driver/pulls/comments/46807398","id":46807398,"diff_hunk":"@@ -22,49 +22,89 @@\n /**\n  * A simple {@code RegularStatement} implementation built directly from a query\n  * string.\n- * <p>\n- * Use {@link Session#newSimpleStatement(String)} to create a new instance of this\n- * class.\n  */\n public class SimpleStatement extends RegularStatement {\n \n     private final String query;\n     private final Object[] values;\n-    private final Cluster cluster;\n \n     private volatile ByteBuffer routingKey;\n     private volatile String keyspace;\n-    \n-    protected SimpleStatement(String query, Cluster cluster) {\n-        this(query, cluster, (Object[]) null);\n+\n+    /**\n+     * Creates a new {@code SimpleStatement} with the provided query string (and no values).\n+     *\n+     * @param query the query string.\n+     */\n+    public SimpleStatement(String query) {\n+        this(query, (Object[]) null);\n     }\n \n-    protected SimpleStatement(String query, Cluster cluster, Object... values) {\n+    /**\n+     * Creates a new {@code SimpleStatement} with the provided query string and values.\n+     * <p>\n+     * This version of SimpleStatement is useful when you want to execute a\n+     * query only once (and thus do not want to resort to prepared statement), but\n+     * do not want to convert all column values to string (typically, if you have blob\n+     * values, encoding them to a hexadecimal string is not very efficient). In\n+     * that case, you can provide a query string with bind markers to this constructor\n+     * along with the values for those bind variables. When executed, the server will\n+     * prepare the provided, bind the provided values to that prepare statement and\n+     * execute the resulting statement. Thus,\n+     * <pre>\n+     *   session.execute(new SimpleStatement(query, value1, value2, value3));\n+     * </pre>\n+     * is functionally equivalent to\n+     * <pre>\n+     *   PreparedStatement ps = session.prepare(query);\n+     *   session.execute(ps.bind(value1, value2, value3));\n+     * </pre>\n+     * except that the former version:\n+     * <ul>\n+     *   <li>Requires only one round-trip to a Cassandra node.</li>\n+     *   <li>Does not left any prepared statement stored in memory (neither client or\n+     *   server side) once it has been executed.</li>\n+     * </ul>\n+     * <p>\n+     * Note that the type of the {@code values} provided to this method will\n+     * not be validated by the driver as is done by {@link BoundStatement#bind} since\n+     * {@code query} is not parsed (and hence the driver cannot know what those value\n+     * should be). The codec to serialize each value will be chosen in the codec registry\n+     * associated with this session's cluster, based on the value's Java type\n+     * (this is the equivalent to calling {@link CodecRegistry#codecFor(Object)}).\n+     * If too many or too few values are provided, or if a value is not a valid one for\n+     * the variable it is bound to, an\n+     * {@link com.datastax.driver.core.exceptions.InvalidQueryException} will be thrown\n+     * by Cassandra at execution time. A {@code CodecNotFoundException} may be\n+     * thrown by this constructor however, if the codec registry does not know how to\n+     * handle one of the values.\n+     *\n+     * @param query the query string.\n+     * @param values values required for the execution of {@code query}.\n+     * @throws IllegalArgumentException if the number of values is greater than 65535.\n+     */\n+    public SimpleStatement(String query, Object... values) {\n         if (values != null && values.length > 65535)\n             throw new IllegalArgumentException(\"Too many values, the maximum allowed is 65535\");\n         this.query = query;\n         this.values = values;\n-        this.cluster = cluster;\n     }\n \n+    /**\n+     * {@inheritDoc}\n+     *\n+     * Note that this implementation doesn't actually use the protocol version and codec registry.","path":"driver-core/src/main/java/com/datastax/driver/core/SimpleStatement.java","position":84,"original_position":84,"commit_id":"094a05ed2e62f17296f938c6010c3629b4b76fa2","original_commit_id":"094a05ed2e62f17296f938c6010c3629b4b76fa2","user":{"login":"adutra","id":463876,"avatar_url":"https://avatars.githubusercontent.com/u/463876?v=3","gravatar_id":"","url":"https://api.github.com/users/adutra","html_url":"https://github.com/adutra","followers_url":"https://api.github.com/users/adutra/followers","following_url":"https://api.github.com/users/adutra/following{/other_user}","gists_url":"https://api.github.com/users/adutra/gists{/gist_id}","starred_url":"https://api.github.com/users/adutra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adutra/subscriptions","organizations_url":"https://api.github.com/users/adutra/orgs","repos_url":"https://api.github.com/users/adutra/repos","events_url":"https://api.github.com/users/adutra/events{/privacy}","received_events_url":"https://api.github.com/users/adutra/received_events","type":"User","site_admin":false},"body":"Nit: no need to mention \"protocol version\" here.","created_at":"2015-12-07T10:48:25Z","updated_at":"2015-12-07T10:48:25Z","html_url":"https://github.com/datastax/java-driver/pull/549#discussion_r46807398","pull_request_url":"https://api.github.com/repos/datastax/java-driver/pulls/549","_links":{"self":{"href":"https://api.github.com/repos/datastax/java-driver/pulls/comments/46807398"},"html":{"href":"https://github.com/datastax/java-driver/pull/549#discussion_r46807398"},"pull_request":{"href":"https://api.github.com/repos/datastax/java-driver/pulls/549"}}},"pull_request":{"url":"https://api.github.com/repos/datastax/java-driver/pulls/549","id":52682618,"html_url":"https://github.com/datastax/java-driver/pull/549","diff_url":"https://github.com/datastax/java-driver/pull/549.diff","patch_url":"https://github.com/datastax/java-driver/pull/549.patch","issue_url":"https://api.github.com/repos/datastax/java-driver/issues/549","number":549,"state":"open","locked":false,"title":"JAVA-1007: Make SimpleStatement and QueryBuilder \"detached\" again.","user":{"login":"olim7t","id":259423,"avatar_url":"https://avatars.githubusercontent.com/u/259423?v=3","gravatar_id":"","url":"https://api.github.com/users/olim7t","html_url":"https://github.com/olim7t","followers_url":"https://api.github.com/users/olim7t/followers","following_url":"https://api.github.com/users/olim7t/following{/other_user}","gists_url":"https://api.github.com/users/olim7t/gists{/gist_id}","starred_url":"https://api.github.com/users/olim7t/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/olim7t/subscriptions","organizations_url":"https://api.github.com/users/olim7t/orgs","repos_url":"https://api.github.com/users/olim7t/repos","events_url":"https://api.github.com/users/olim7t/events{/privacy}","received_events_url":"https://api.github.com/users/olim7t/received_events","type":"User","site_admin":false},"body":"Signature changes in statement classes:\r\n\r\n* `Statement#getRoutingKey(ProtocolVersion, CodecRegistry)`\r\n* `RegularStatement#getValues(ProtocolVersion, CodecRegistry)`\r\n* `RegularStatement#getQueryString(CodecRegistry)`, with a no-arg overload that uses the default instance.\r\n* `RegularStatement#hasValues(CodecRegistry)`, with a no-arg overload that uses the default instance.\r\n\r\nSee javadocs for when to use each method. I added a paragraph in `BuiltStatement` javadoc to explain why it needs the codec registry.","created_at":"2015-12-04T15:30:26Z","updated_at":"2015-12-07T10:48:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"554d101163b28f92d27fdf19f7a2c8adb07f31d2","assignee":null,"milestone":{"url":"https://api.github.com/repos/datastax/java-driver/milestones/2","html_url":"https://github.com/datastax/java-driver/milestones/3.0.0-beta1","labels_url":"https://api.github.com/repos/datastax/java-driver/milestones/2/labels","id":1381937,"number":2,"title":"3.0.0-beta1","description":"","creator":{"login":"olim7t","id":259423,"avatar_url":"https://avatars.githubusercontent.com/u/259423?v=3","gravatar_id":"","url":"https://api.github.com/users/olim7t","html_url":"https://github.com/olim7t","followers_url":"https://api.github.com/users/olim7t/followers","following_url":"https://api.github.com/users/olim7t/following{/other_user}","gists_url":"https://api.github.com/users/olim7t/gists{/gist_id}","starred_url":"https://api.github.com/users/olim7t/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/olim7t/subscriptions","organizations_url":"https://api.github.com/users/olim7t/orgs","repos_url":"https://api.github.com/users/olim7t/repos","events_url":"https://api.github.com/users/olim7t/events{/privacy}","received_events_url":"https://api.github.com/users/olim7t/received_events","type":"User","site_admin":false},"open_issues":1,"closed_issues":10,"state":"open","created_at":"2015-10-28T17:51:46Z","updated_at":"2015-12-04T18:26:04Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/datastax/java-driver/pulls/549/commits","review_comments_url":"https://api.github.com/repos/datastax/java-driver/pulls/549/comments","review_comment_url":"https://api.github.com/repos/datastax/java-driver/pulls/comments{/number}","comments_url":"https://api.github.com/repos/datastax/java-driver/issues/549/comments","statuses_url":"https://api.github.com/repos/datastax/java-driver/statuses/094a05ed2e62f17296f938c6010c3629b4b76fa2","head":{"label":"datastax:java1007","ref":"java1007","sha":"094a05ed2e62f17296f938c6010c3629b4b76fa2","user":{"login":"datastax","id":573369,"avatar_url":"https://avatars.githubusercontent.com/u/573369?v=3","gravatar_id":"","url":"https://api.github.com/users/datastax","html_url":"https://github.com/datastax","followers_url":"https://api.github.com/users/datastax/followers","following_url":"https://api.github.com/users/datastax/following{/other_user}","gists_url":"https://api.github.com/users/datastax/gists{/gist_id}","starred_url":"https://api.github.com/users/datastax/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/datastax/subscriptions","organizations_url":"https://api.github.com/users/datastax/orgs","repos_url":"https://api.github.com/users/datastax/repos","events_url":"https://api.github.com/users/datastax/events{/privacy}","received_events_url":"https://api.github.com/users/datastax/received_events","type":"Organization","site_admin":false},"repo":{"id":6765281,"name":"java-driver","full_name":"datastax/java-driver","owner":{"login":"datastax","id":573369,"avatar_url":"https://avatars.githubusercontent.com/u/573369?v=3","gravatar_id":"","url":"https://api.github.com/users/datastax","html_url":"https://github.com/datastax","followers_url":"https://api.github.com/users/datastax/followers","following_url":"https://api.github.com/users/datastax/following{/other_user}","gists_url":"https://api.github.com/users/datastax/gists{/gist_id}","starred_url":"https://api.github.com/users/datastax/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/datastax/subscriptions","organizations_url":"https://api.github.com/users/datastax/orgs","repos_url":"https://api.github.com/users/datastax/repos","events_url":"https://api.github.com/users/datastax/events{/privacy}","received_events_url":"https://api.github.com/users/datastax/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/datastax/java-driver","description":"DataStax Java Driver for Apache Cassandra","fork":false,"url":"https://api.github.com/repos/datastax/java-driver","forks_url":"https://api.github.com/repos/datastax/java-driver/forks","keys_url":"https://api.github.com/repos/datastax/java-driver/keys{/key_id}","collaborators_url":"https://api.github.com/repos/datastax/java-driver/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/datastax/java-driver/teams","hooks_url":"https://api.github.com/repos/datastax/java-driver/hooks","issue_events_url":"https://api.github.com/repos/datastax/java-driver/issues/events{/number}","events_url":"https://api.github.com/repos/datastax/java-driver/events","assignees_url":"https://api.github.com/repos/datastax/java-driver/assignees{/user}","branches_url":"https://api.github.com/repos/datastax/java-driver/branches{/branch}","tags_url":"https://api.github.com/repos/datastax/java-driver/tags","blobs_url":"https://api.github.com/repos/datastax/java-driver/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/datastax/java-driver/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/datastax/java-driver/git/refs{/sha}","trees_url":"https://api.github.com/repos/datastax/java-driver/git/trees{/sha}","statuses_url":"https://api.github.com/repos/datastax/java-driver/statuses/{sha}","languages_url":"https://api.github.com/repos/datastax/java-driver/languages","stargazers_url":"https://api.github.com/repos/datastax/java-driver/stargazers","contributors_url":"https://api.github.com/repos/datastax/java-driver/contributors","subscribers_url":"https://api.github.com/repos/datastax/java-driver/subscribers","subscription_url":"https://api.github.com/repos/datastax/java-driver/subscription","commits_url":"https://api.github.com/repos/datastax/java-driver/commits{/sha}","git_commits_url":"https://api.github.com/repos/datastax/java-driver/git/commits{/sha}","comments_url":"https://api.github.com/repos/datastax/java-driver/comments{/number}","issue_comment_url":"https://api.github.com/repos/datastax/java-driver/issues/comments{/number}","contents_url":"https://api.github.com/repos/datastax/java-driver/contents/{+path}","compare_url":"https://api.github.com/repos/datastax/java-driver/compare/{base}...{head}","merges_url":"https://api.github.com/repos/datastax/java-driver/merges","archive_url":"https://api.github.com/repos/datastax/java-driver/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/datastax/java-driver/downloads","issues_url":"https://api.github.com/repos/datastax/java-driver/issues{/number}","pulls_url":"https://api.github.com/repos/datastax/java-driver/pulls{/number}","milestones_url":"https://api.github.com/repos/datastax/java-driver/milestones{/number}","notifications_url":"https://api.github.com/repos/datastax/java-driver/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/datastax/java-driver/labels{/name}","releases_url":"https://api.github.com/repos/datastax/java-driver/releases{/id}","created_at":"2012-11-19T18:44:41Z","updated_at":"2015-12-07T10:21:36Z","pushed_at":"2015-12-06T19:36:30Z","git_url":"git://github.com/datastax/java-driver.git","ssh_url":"git@github.com:datastax/java-driver.git","clone_url":"https://github.com/datastax/java-driver.git","svn_url":"https://github.com/datastax/java-driver","homepage":null,"size":19174,"stargazers_count":541,"watchers_count":541,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":397,"mirror_url":null,"open_issues_count":31,"forks":397,"open_issues":31,"watchers":541,"default_branch":"2.1"}},"base":{"label":"datastax:3.0","ref":"3.0","sha":"4f9d98a794eba41edaa68076a1b468c02e6dd79a","user":{"login":"datastax","id":573369,"avatar_url":"https://avatars.githubusercontent.com/u/573369?v=3","gravatar_id":"","url":"https://api.github.com/users/datastax","html_url":"https://github.com/datastax","followers_url":"https://api.github.com/users/datastax/followers","following_url":"https://api.github.com/users/datastax/following{/other_user}","gists_url":"https://api.github.com/users/datastax/gists{/gist_id}","starred_url":"https://api.github.com/users/datastax/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/datastax/subscriptions","organizations_url":"https://api.github.com/users/datastax/orgs","repos_url":"https://api.github.com/users/datastax/repos","events_url":"https://api.github.com/users/datastax/events{/privacy}","received_events_url":"https://api.github.com/users/datastax/received_events","type":"Organization","site_admin":false},"repo":{"id":6765281,"name":"java-driver","full_name":"datastax/java-driver","owner":{"login":"datastax","id":573369,"avatar_url":"https://avatars.githubusercontent.com/u/573369?v=3","gravatar_id":"","url":"https://api.github.com/users/datastax","html_url":"https://github.com/datastax","followers_url":"https://api.github.com/users/datastax/followers","following_url":"https://api.github.com/users/datastax/following{/other_user}","gists_url":"https://api.github.com/users/datastax/gists{/gist_id}","starred_url":"https://api.github.com/users/datastax/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/datastax/subscriptions","organizations_url":"https://api.github.com/users/datastax/orgs","repos_url":"https://api.github.com/users/datastax/repos","events_url":"https://api.github.com/users/datastax/events{/privacy}","received_events_url":"https://api.github.com/users/datastax/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/datastax/java-driver","description":"DataStax Java Driver for Apache Cassandra","fork":false,"url":"https://api.github.com/repos/datastax/java-driver","forks_url":"https://api.github.com/repos/datastax/java-driver/forks","keys_url":"https://api.github.com/repos/datastax/java-driver/keys{/key_id}","collaborators_url":"https://api.github.com/repos/datastax/java-driver/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/datastax/java-driver/teams","hooks_url":"https://api.github.com/repos/datastax/java-driver/hooks","issue_events_url":"https://api.github.com/repos/datastax/java-driver/issues/events{/number}","events_url":"https://api.github.com/repos/datastax/java-driver/events","assignees_url":"https://api.github.com/repos/datastax/java-driver/assignees{/user}","branches_url":"https://api.github.com/repos/datastax/java-driver/branches{/branch}","tags_url":"https://api.github.com/repos/datastax/java-driver/tags","blobs_url":"https://api.github.com/repos/datastax/java-driver/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/datastax/java-driver/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/datastax/java-driver/git/refs{/sha}","trees_url":"https://api.github.com/repos/datastax/java-driver/git/trees{/sha}","statuses_url":"https://api.github.com/repos/datastax/java-driver/statuses/{sha}","languages_url":"https://api.github.com/repos/datastax/java-driver/languages","stargazers_url":"https://api.github.com/repos/datastax/java-driver/stargazers","contributors_url":"https://api.github.com/repos/datastax/java-driver/contributors","subscribers_url":"https://api.github.com/repos/datastax/java-driver/subscribers","subscription_url":"https://api.github.com/repos/datastax/java-driver/subscription","commits_url":"https://api.github.com/repos/datastax/java-driver/commits{/sha}","git_commits_url":"https://api.github.com/repos/datastax/java-driver/git/commits{/sha}","comments_url":"https://api.github.com/repos/datastax/java-driver/comments{/number}","issue_comment_url":"https://api.github.com/repos/datastax/java-driver/issues/comments{/number}","contents_url":"https://api.github.com/repos/datastax/java-driver/contents/{+path}","compare_url":"https://api.github.com/repos/datastax/java-driver/compare/{base}...{head}","merges_url":"https://api.github.com/repos/datastax/java-driver/merges","archive_url":"https://api.github.com/repos/datastax/java-driver/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/datastax/java-driver/downloads","issues_url":"https://api.github.com/repos/datastax/java-driver/issues{/number}","pulls_url":"https://api.github.com/repos/datastax/java-driver/pulls{/number}","milestones_url":"https://api.github.com/repos/datastax/java-driver/milestones{/number}","notifications_url":"https://api.github.com/repos/datastax/java-driver/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/datastax/java-driver/labels{/name}","releases_url":"https://api.github.com/repos/datastax/java-driver/releases{/id}","created_at":"2012-11-19T18:44:41Z","updated_at":"2015-12-07T10:21:36Z","pushed_at":"2015-12-06T19:36:30Z","git_url":"git://github.com/datastax/java-driver.git","ssh_url":"git@github.com:datastax/java-driver.git","clone_url":"https://github.com/datastax/java-driver.git","svn_url":"https://github.com/datastax/java-driver","homepage":null,"size":19174,"stargazers_count":541,"watchers_count":541,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":397,"mirror_url":null,"open_issues_count":31,"forks":397,"open_issues":31,"watchers":541,"default_branch":"2.1"}},"_links":{"self":{"href":"https://api.github.com/repos/datastax/java-driver/pulls/549"},"html":{"href":"https://github.com/datastax/java-driver/pull/549"},"issue":{"href":"https://api.github.com/repos/datastax/java-driver/issues/549"},"comments":{"href":"https://api.github.com/repos/datastax/java-driver/issues/549/comments"},"review_comments":{"href":"https://api.github.com/repos/datastax/java-driver/pulls/549/comments"},"review_comment":{"href":"https://api.github.com/repos/datastax/java-driver/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/datastax/java-driver/pulls/549/commits"},"statuses":{"href":"https://api.github.com/repos/datastax/java-driver/statuses/094a05ed2e62f17296f938c6010c3629b4b76fa2"}}}}