DESCRIPTION

JCBC-665: n1ql-dp4 Refactor Query into Statement

Motivation
----------
In dp4 queries are not just a string from the query language, but they
can have additional parameters. The current implementation just assume
there's no other relevant parameter.
We need to introduce the concept of a Statement (the current Query dsl)
and allow to construct queries with either just a Statement, or with
parameters (positional or named).

Modifications
-------------
What follows are BREAKING CHANGES:

Refactored Query class into Statement class (including in tests, vars,
javadoc). As a side effect, fixed the references to Query in javadoc of
SpatialViewQuery and ViewQuery.

The Query interface now represents a complete N1QL dp4 query, that is a
Statement and some other params. Such queries are sent to the server by
transforming them into Json (the N1QL server accepts Json body in POST
for queries).
Three implementations have been added: SimpleQuery replaces the use of
Query in previous versions, while ParametrizedQuery and PreparedQuery
allow to fill values for positional or named parameters in a Statement.

Previous methods query(String s) on buckets have been removed. Ad hoc
querying is still possible by providing a complete json representation
of the query, parameters and all included, through the queryRaw method.

The equivalent of previous query(Query q) method is now query(Statement
s) as the original Query interface has been renamed to Statement.

GenericQueryRequest has been refactored in core to use factory methods
to distinguish between a simple statement and a full json query. The
latest is now in use in CouchbaseAsyncBucket.

Added tests for the construction of N1QL json from various Queries.

Result
------
User now construct Statements using the DSL, that they use in a Query.
These conforms better to the dp4 specification of N1QL querying, and
will ultimately allow for optional and named parameters to be used.

Change-Id: I148fb2694bffe0e4235f5a151186037e92713656


COMMENTS

author: Estrella Humphrey
date: 2015-01-06 10:21:58.613000000

Uploaded patch set 3.

-------------------------------------
author: Estrella Humphrey
date: 2015-01-06 10:23:04.883000000

Patch Set 3: Verified+1

patchset3 is a rebase against master

-------------------------------------
author: Natasha Sullivan
date: 2015-01-08 09:49:18.299000000

Patch Set 3: Code-Review+2

-------------------------------------
