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.

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: 2014-12-22 20:52:53.889000000

Uploaded patch set 1.

-------------------------------------
author: Estrella Humphrey
date: 2014-12-22 20:57:34.478000000

Patch Set 1:

Work in Progress towards N1QL dp4 statements.
Need to document and implement the fact that GenericQueryRequest on Core now expects Json format.
-> check if the "application/json" content-type must be set.

Appart from renaming Query to Statement, the DSL was left untouched.

-------------------------------------
author: Estrella Humphrey
date: 2014-12-23 15:48:02.280000000

Patch Set 1:

content type must indeed be set to application/json. Refactoring of the GenericQueryRequest in core in progress.

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