PCBC-106 Adding Touch (& Get-with-Touch) Support

This changeset addresses PCBC-106 by adding touch/mulit-touch
functionality as well as touch options to the existing get
functions.

Change-Id: I8a2eb0bc945dc9674457f63768b2cb7ed2de3c30
Reviewed-on: http://review.couchbase.org/21055
Reviewed-by: Mordechai Nunberg <mnunberg@haskalah.org>
Tested-by: Mordechai Nunberg <mnunberg@haskalah.org>
Reviewed-by: Matt Ingenthron <matt@couchbase.com>
PCBC-103: Support for Get-with-Lock

This changeset adds support for setting a lock when using get
functions.

Change-Id: I0f63530d257436cdd5a9eb910e54e1e4d389c144
Reviewed-on: http://review.couchbase.org/21062
Tested-by: Mordechai Nunberg <mnunberg@haskalah.org>
Reviewed-by: Mordechai Nunberg <mnunberg@haskalah.org>
Reviewed-by: Matt Ingenthron <matt@couchbase.com>
PCBC-117 Checking that expiry times are non-negative

This adds checks to the following operations to ensure that the expiry
times specified by the user are non-negative:
* add
* set
* set-multi
* replace
* append
* prepend
* cas
* increment
* decrement
* get
* get-multi
* get-delayed
* touch
* touch-multi

If the check is not successful (i.e. if the user has supplied a
negative value), a fatal error is thrown by the extension.

This is the master-branch version of an equivalent bugfix commit on
1.0.x.  During development of this patch fix, two small bugs (arginfo
handling of flags param for multi-get, initial return_value set within
touch commands) were encountered and fixed as well.

Change-Id: I08eab920c5ca51901b4973ce6669b07b7e3acee7
Reviewed-on: http://review.couchbase.org/21090
Reviewed-by: Mordechai Nunberg <mnunberg@haskalah.org>
Reviewed-by: Matt Ingenthron <matt@couchbase.com>
Tested-by: Michael Jackson <mjackson@omniti.com>
Provide more helpful error when encountering older library

(mjackson: fixing sense of a test to check for non-zero [-n] instead of
zero [-z] length string of the version missmatch error variable)

Change-Id: I135dd77bc6f13ba576ab199bec2203b04a807d34
Reviewed-on: http://review.couchbase.org/21177
Reviewed-by: Michael Jackson <mjackson@omniti.com>
Tested-by: Michael Jackson <mjackson@omniti.com>
Reviewed-by: Mordechai Nunberg <mnunberg@haskalah.org>
Tested-by: Mordechai Nunberg <mnunberg@haskalah.org>
Restructure tests

Add new tests which are based on an xunit-type framework (compatible
with but not dependent on PHPUnit).

At this stage there are still some redundant legacy tests, and these
will be removed in a subsequent commit).

Change-Id: I83d6396105f362f7129c765e16e7938d8de4543d
Reviewed-on: http://review.couchbase.org/21119
Reviewed-by: Michael Jackson <mjackson@omniti.com>
Tested-by: Michael Jackson <mjackson@omniti.com>
Reviewed-by: Matt Ingenthron <matt@couchbase.com>
Remove deprecated testfiles (list follows)

=== List of replacements ===

OLD  NEW
---  ---
001: **no replacement yet (load test)
002: Connection
003: MutateBasic
004: MutateBasic
005: **TBD
006: **No flush tests yet
007: GetMulti
008: Delete
009: **TBD (need to modify touch)
010: Arithmetic
011: MutateBasic
012: ServerStats
013: Replace
014: AppendPrepend
015: IntegerArgs
016: Errors
017: GetMulti
018: EmptyKey
019: Delay
020: Delay
021: Delay
022: Arithmetic
023: Serialization
024: Serialization
025: Serialization
026: Prefix
027: Compression (broken in the ext)
028: Connection
029: IntegerArgs
030: ViewSimple
031: ViewSimple
032: GetMulti
033: Errors
034: ViewSimple
036: Connection

037..050: **TBD (Negative expiry)

Change-Id: I44f1488138f2166ecf58fea171ece3be9b79441d
Reviewed-on: http://review.couchbase.org/21212
Reviewed-by: Michael Jackson <mjackson@omniti.com>
Tested-by: Michael Jackson <mjackson@omniti.com>
Tested-by: Mordechai Nunberg <mnunberg@haskalah.org>
Reviewed-by: Mordechai Nunberg <mnunberg@haskalah.org>
Refactor negative expiry tests

Change-Id: I4ed82839f1a419f5cc3bdf388f8405bba44f5db2
Reviewed-on: http://review.couchbase.org/21228
Reviewed-by: Michael Jackson <mjackson@omniti.com>
Reviewed-by: Mordechai Nunberg <mnunberg@haskalah.org>
Tested-by: Mordechai Nunberg <mnunberg@haskalah.org>
Support skip sections

This allows tests to be skipped and generate the --SKIPIF-- section in
phpt

(mjackson: making negative expiry error E_RECOVERABLE_ERROR; this is
a fatal like E_ERROR but can be caught by a user-defined error handler
function, which makes testing these conditions much easier.)

Change-Id: I4e1510845c17d19b75900198e449ffd602cd7eb7
Reviewed-on: http://review.couchbase.org/21236
Reviewed-by: Michael Jackson <mjackson@omniti.com>
Tested-by: Michael Jackson <mjackson@omniti.com>
Tested-by: Mordechai Nunberg <mnunberg@haskalah.org>
PCBC-51 Extending test coverage

This commit extends the new style testing regime started by Mark Nunberg
and makes it the default for make test.  (Some of these tests do fail
presently, but I believe all tests currently failing represent actual
problems with the extension, not incorrectly written test cases, e.g.
failures triggered by a memory leak when pulling server statistics from
a 2.0 beta server.)

Change-Id: Id2a0dfc4b912b9578030c6c1b35f091fd18f3076
Reviewed-on: http://review.couchbase.org/21320
Reviewed-by: Mordechai Nunberg <mnunberg@haskalah.org>
Tested-by: Mordechai Nunberg <mnunberg@haskalah.org>
PCBC-128 Fixing hash-inconsistency error w/ touch-multi

The root cause was an inappropriate call to a zval destructor on
return_value before the touch_impl function returned. Other misc.
cleanup to the return value array handling (using add_* array api
functions instead of direct zend_hash_* functions).

Change-Id: I800f0e60b106b24e28c42fe4907aa004348a8454
Reviewed-on: http://review.couchbase.org/21349
Reviewed-by: Mordechai Nunberg <mnunberg@haskalah.org>
Tested-by: Mordechai Nunberg <mnunberg@haskalah.org>
PCBC-129: Fixing memory leaks in stats calls

This fix clears up the memory leaks observed when calling the server
statistics functions of the extension against a 2.0b server.

Change-Id: I6d36b6498883e8357c45cf5e4e00afbd56287ca3
Reviewed-on: http://review.couchbase.org/21350
Reviewed-by: Mordechai Nunberg <mnunberg@haskalah.org>
Tested-by: Mordechai Nunberg <mnunberg@haskalah.org>
PCBC-131 - Fix crashes in multi touch

Change-Id: I24bf49e2bdc62622194dad7ce5ef7fa6fd462e3f
Reviewed-on: http://review.couchbase.org/21385
Reviewed-by: Michael Jackson <mjackson@omniti.com>
Tested-by: Michael Jackson <mjackson@omniti.com>
Tested-by: Mordechai Nunberg <mnunberg@haskalah.org>
Updates to release 1.1.0-dp4.

Change-Id: Ia816f7274dd0c4ad72539ad2fba35007ed24dac8
Reviewed-on: http://review.couchbase.org/21060
Reviewed-by: Michael Jackson <mjackson@omniti.com>
Reviewed-by: Mordechai Nunberg <mnunberg@haskalah.org>
Reviewed-by: Matt Ingenthron <matt@couchbase.com>
Tested-by: Matt Ingenthron <matt@couchbase.com>
PCBC-134 Improving error info on connection failure

This changeset lets getResultCode/getResultMessage work if
connection failed (and adds the required extra checks in other places
to make sure nothing would be "fooled" by the presence of a valid
resource, if that resource isn't actually connected to Couchbase).

(amended to include added connection checking in views.c)
(amended to address some concerns Mark had)
(amended to fix some breakage under phpunit, and formatting)

Change-Id: I855a303593c54d480b50199f77793afc2f9696ca
Reviewed-on: http://review.couchbase.org/21433
Reviewed-by: Mordechai Nunberg <mnunberg@haskalah.org>
Tested-by: Mordechai Nunberg <mnunberg@haskalah.org>
Reviewed-by: Michael Jackson <mjackson@omniti.com>
Tested-by: Michael Jackson <mjackson@omniti.com>
Upgrade to latest libcouchbase API (fixes build)

Change-Id: Ib6cf61c7e72f242012c412dd3cb834508c369518
Reviewed-on: http://review.couchbase.org/21544
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Reviewed-by: Michael Jackson <mjackson@omniti.com>
Reviewed-by: Matt Ingenthron <matt@couchbase.com>
Remove compiler warnings

Part of the code for building up error messages used the
wrong formatting options.

Change-Id: I1ac360d51bdb942452e168a49f6bfe66b0837b58
Reviewed-on: http://review.couchbase.org/21811
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Update to use the names in the current lcb api

We changed the name of the function related to the http
callbacks so that they are generic.

Change-Id: I488ac49f7b1ae98570b149983d0e3778b02c10e0
Reviewed-on: http://review.couchbase.org/21812
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Reviewed-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Update metadata for 1.1.0-dp5 release.

Change-Id: Ie3638591923d03ab8f855c0c0b7fea6dff59ab3b
Reviewed-on: http://review.couchbase.org/21854
Reviewed-by: Michael Jackson <mjackson@omniti.com>
Tested-by: Mordechai Nunberg <mnunberg@haskalah.org>
Reviewed-by: Mordechai Nunberg <mnunberg@haskalah.org>
Help editors print the correct size of the tabs

Change-Id: Ia811e1034b8480a0887d3d00f172edabe3de12c7
Reviewed-on: http://review.couchbase.org/21874
Reviewed-by: Michael Jackson <mjackson@omniti.com>
Reviewed-by: Matt Ingenthron <matt@couchbase.com>
Tested-by: Matt Ingenthron <matt@couchbase.com>
Build views.c as a separate file

Change-Id: I92a9f29fd0d356cfb3cd0e5d3d05a81e6e16f7e1
Reviewed-on: http://review.couchbase.org/21875
Reviewed-by: Michael Jackson <mjackson@omniti.com>
Reviewed-by: Matt Ingenthron <matt@couchbase.com>
Tested-by: Trond Norbye <trond.norbye@gmail.com>