Book Image

Couchbase Essentials

Book Image

Couchbase Essentials

Overview of this book

Table of Contents (15 chapters)
Couchbase Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

SDK support


At the time of writing this book, SDK support for N1QL is somewhat limited. .NET, Java, PHP, and Node.js have experimental support for N1QL. Ruby and Python should see N1QL support in the future. Until both the N1QL framework and the SDKs are more locked down, it's worth keeping an eye out for changes. At this stage, we'll look briefly at a Java snippet that demonstrates how to use N1QL with the 2.0 SDK:

Observable<QueryResult> result = bucket.query("select * from beer-sample");

Notice that the N1QL language is reminiscent of working with SQL-oriented frameworks such as JDBC or ADO.NET.

If you're familiar with prepared statements in SQL, where you provide parameters as positional arguments to a query statement with placeholders, there are work items for the Couchbase N1QL team to provide support for these types of queries. The advantage of prepared statements is that the query optimizer doesn't have to reparse and replan the execution with each run of query that differs only...