Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
Checking mergeability… Don't worry, you can still create the pull request.
  • 14 commits
  • 8 files changed
  • 0 commit comments
  • 3 contributors
Commits on Feb 24, 2012
@janl janl PHP 5.2 and 5.3 report resources differently. Fix tests accordingly.
Change-Id: Ic889f11f7202686e4a775bb0beac39cda18607ac
Reviewed-on: http://review.couchbase.org/13512
Reviewed-by: Jan Lehnardt <jan@couchbase.com>
Tested-by: Jan Lehnardt <jan@couchbase.com>
936c7cc
Commits on Feb 27, 2012
@laruence laruence Fix PCBC-45 plug memory leaks
Change-Id: Ib6314a40bc570c53dc3790e35f26af02109b0dc7
Reviewed-on: http://review.couchbase.org/13575
Reviewed-by: Jan Lehnardt <jan@couchbase.com>
Tested-by: Jan Lehnardt <jan@couchbase.com>
fdd255a
@janl janl fix segfault on mac
Change-Id: I44b563da95a48163ffee2ccd4a31dcaa048658c0
Reviewed-on: http://review.couchbase.org/13626
Reviewed-by: Jan Lehnardt <jan@couchbase.com>
Tested-by: Jan Lehnardt <jan@couchbase.com>
Reviewed-by: Matt Ingenthron <matt@couchbase.com>
0078cb3
Commits on Feb 28, 2012
@janl janl full s/[cCompresser]/compressor/
Change-Id: I552b949abede26615173757c3b241a59c838c0dd
Reviewed-on: http://review.couchbase.org/13664
Reviewed-by: Jan Lehnardt <jan@couchbase.com>
Tested-by: Jan Lehnardt <jan@couchbase.com>
d5ba5df
Commits on Mar 01, 2012
@janl janl bump version to 1.0.0
Change-Id: I6cf69c2e8c48260a1a02c56eaf4797426b469080
Reviewed-on: http://review.couchbase.org/13707
Reviewed-by: Jan Lehnardt <jan@couchbase.com>
Tested-by: Jan Lehnardt <jan@couchbase.com>
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
8d39547
@janl janl Rename version() method and functions to getVersion and get_version.
Change-Id: I8660f7298daa8c9dc96cc27a53773232cacd10e9
Reviewed-on: http://review.couchbase.org/13708
Reviewed-by: Jan Lehnardt <jan@couchbase.com>
Tested-by: Jan Lehnardt <jan@couchbase.com>
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
f2276bf
@janl janl s/tabs/spaces/ in README
Change-Id: I65b10f3412d1ff1f8dde80907f0a37b84adfc6e9
Reviewed-on: http://review.couchbase.org/13710
Reviewed-by: Jan Lehnardt <jan@couchbase.com>
Tested-by: Jan Lehnardt <jan@couchbase.com>
e6aa1dc
@janl janl add compat notice
Change-Id: I3107b7f3874ac91966ea4d6967f1c394e00eb541
Reviewed-on: http://review.couchbase.org/13711
Reviewed-by: Jan Lehnardt <jan@couchbase.com>
Tested-by: Jan Lehnardt <jan@couchbase.com>
64a259a
@janl janl remove EXPERIMENTAL update Credits comment in README
Change-Id: Ibb503a9a7d9f7ef3dde48bfdffce844d9310c4ed
Reviewed-on: http://review.couchbase.org/13712
Reviewed-by: Jan Lehnardt <jan@couchbase.com>
Tested-by: Jan Lehnardt <jan@couchbase.com>
661604a
Commits on Mar 05, 2012
@pierrejoye pierrejoye - fix windows build and void* ptr arithmetic
Change-Id: Idb5df8de0af05a99ff4824fd714e33da7012922c
Reviewed-on: http://review.couchbase.org/13750
Reviewed-by: Jan Lehnardt <jan@couchbase.com>
Tested-by: Jan Lehnardt <jan@couchbase.com>
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
7971ee4
@janl janl spaces -> tabs, as per PHP source styleguide
Change-Id: I0b515c2994a08b2161b7f36781527244d31ae0df
Reviewed-on: http://review.couchbase.org/13751
Reviewed-by: Jan Lehnardt <jan@couchbase.com>
Tested-by: Jan Lehnardt <jan@couchbase.com>
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
c6c5ead
@janl janl Fix argument parsing for ::increment().
Don't require the first parameter to be a resource.

Change-Id: If8c11b8e2aefa9c7c9ede84ec58519bf000c99fb
Reviewed-on: http://review.couchbase.org/13762
Reviewed-by: Matt Ingenthron <matt@couchbase.com>
Reviewed-by: Jan Lehnardt <jan@couchbase.com>
Tested-by: Jan Lehnardt <jan@couchbase.com>
37d7bd6
@janl janl happy new year
Change-Id: I07c7c0931db5a20d670ce6b01b6ab7299771c7b6
Reviewed-on: http://review.couchbase.org/13775
Reviewed-by: Jan Lehnardt <jan@couchbase.com>
Tested-by: Jan Lehnardt <jan@couchbase.com>
b43d1e7
Commits on Mar 30, 2012
@pierrejoye pierrejoye - fix w32, does not build fine yet
Change-Id: Ib98210180e32fd6928d24ff6345a54d4f907e6fa
Reviewed-on: http://review.couchbase.org/14428
Reviewed-by: Jan Lehnardt <jan@couchbase.com>
Tested-by: Jan Lehnardt <jan@couchbase.com>
2532dcd
View
0  EXPERIMENTAL
No changes.
View
25 README.md
@@ -9,10 +9,10 @@ libcouchbase
## Installation
$ phpize
- $ ./configure
- $ make
- $ make test # assumes a Couchbase Server 1.8 or later running on 127.0.0.1:8091
- $ make install
+ $ ./configure
+ $ make
+ $ make test # assumes a Couchbase Server 1.8 or later running on 127.0.0.1:8091
+ $ make install
If you are using a webserver installation of PHP, you might need to restart your webserver.
@@ -21,12 +21,17 @@ If you are using a webserver installation of PHP, you might need to restart your
Create a new script `test.php`:
<?php
- $cb = new Couchbase("127.0.0.1:8091", "Administrator", "password", "default");
- $cb->set("a", 1);
- $a = $cb->get("a");
- echo $a;
- ?>
+ $cb = new Couchbase("127.0.0.1:8091", "Administrator", "password", "default");
+ $cb->set("a", 1);
+ $a = $cb->get("a");
+ echo $a;
+ ?>
+# Compatibility
+
+PHP 5.2.9 or later.
+
+Windows support is coming in the next release.
## License
@@ -34,7 +39,7 @@ Apache License 2.0
## Credits
-Couchbase
+See CREDITS file. Thanks all!
## Copyright
View
14 config.w32
@@ -1,13 +1,13 @@
// $Id$
// vim:ft=javascript
-// If your extension references something external, use ARG_WITH
-// ARG_WITH("couchbase", "for couchbase support", "no");
-
-// Otherwise, use ARG_ENABLE
-// ARG_ENABLE("couchbase", "enable couchbase support", "no");
+ARG_WITH("couchbase", "for couchbase support", "no");
if (PHP_COUCHBASE != "no") {
- EXTENSION("couchbase", "couchbase.c");
+ if (CHECK_LIB("libcouchbase.lib", "couchbase", PHP_COUCHBASE) &&
+ CHECK_LIB("libvbucket.lib", "couchbase", PHP_COUCHBASE) &&
+ CHECK_HEADER_ADD_INCLUDE("couchbase.h", "CFLAGS_COUCHBASE", PHP_COUCHBASE+ ";" + PHP_PHP_BUILD + "\\include\\libcouchbase") &&
+ CHECK_HEADER_ADD_INCLUDE("vbucket.h", "CFLAGS_COUCHBASE", PHP_COUCHBASE+ ";" + PHP_PHP_BUILD + "\\include\\libvbucket")) {
+ EXTENSION("couchbase", "couchbase.c");
+ }
}
-
View
4,164 couchbase.c
2,103 additions, 2,061 deletions not shown
View
120 php_couchbase.h
@@ -1,20 +1,20 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright 2011 Couchbase, Inc. |
+ | Copyright 2012 Couchbase, Inc. |
+----------------------------------------------------------------------+
- | Licensed under the Apache License, Version 2.0 (the "License"); |
- | you may not use this file except in compliance with the License. |
- | You may obtain a copy of the License at |
- | http://www.apache.org/licenses/LICENSE-2.0 |
- | Unless required by applicable law or agreed to in writing, software |
- | distributed under the License is distributed on an "AS IS" BASIS, |
- | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
- | implied. See the License for the specific language governing |
- | permissions and limitations under the License. |
+ | Licensed under the Apache License, Version 2.0 (the "License"); |
+ | you may not use this file except in compliance with the License. |
+ | You may obtain a copy of the License at |
+ | http://www.apache.org/licenses/LICENSE-2.0 |
+ | Unless required by applicable law or agreed to in writing, software |
+ | distributed under the License is distributed on an "AS IS" BASIS, |
+ | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
+ | implied. See the License for the specific language governing |
+ | permissions and limitations under the License. |
+----------------------------------------------------------------------+
- | Author: Xinchen Hui <laruence@php.net> |
+ | Author: Xinchen Hui <laruence@php.net> |
+----------------------------------------------------------------------+
*/
@@ -28,18 +28,20 @@ extern zend_module_entry couchbase_module_entry;
extern zend_class_entry *couchbase_ce;
#ifdef PHP_WIN32
-# define PHP_COUCHBASE_API __declspec(dllexport)
-# define strtoull _strtoui64
+# define PHP_COUCHBASE_API __declspec(dllexport)
+# define strtoull _strtoui64
#elif defined(__GNUC__) && __GNUC__ >= 4
-# define PHP_COUCHBASE_API __attribute__ ((visibility("default")))
+# define PHP_COUCHBASE_API __attribute__ ((visibility("default")))
#else
-# define PHP_COUCHBASE_API
+# define PHP_COUCHBASE_API
#endif
#ifdef ZTS
#include "TSRM.h"
#endif
+#include <libcouchbase/couchbase.h>
+
#ifdef ZTS
#define COUCHBASE_G(v) TSRMG(couchbase_globals_id, zend_couchbase_globals *, v)
#else
@@ -56,65 +58,65 @@ extern zend_class_entry *couchbase_ce;
#define COUCHBASE_ARG_PREFIX static
#endif
-#define PHP_COUCHBASE_VERSION "0.0.1"
-#define PHP_COUCHBASE_RESOURCE "Couchbase"
+#define PHP_COUCHBASE_VERSION "1.0.0"
+#define PHP_COUCHBASE_RESOURCE "Couchbase"
#define PHP_COUCHBASE_PERSISTENT_RESOURCE "Persistent Couchbase"
#define COUCHBASE_PROPERTY_HANDLE "_handle"
-#define COUCHBASE_OPT_SERIALIZER 1
-#define COUCHBASE_OPT_COMPRESSION 2
-#define COUCHBASE_OPT_PREFIX_KEY 3
+#define COUCHBASE_OPT_SERIALIZER 1
+#define COUCHBASE_OPT_COMPRESSION 2
+#define COUCHBASE_OPT_PREFIX_KEY 3
-#define COUCHBASE_SERIALIZER_PHP 0
-#define COUCHBASE_SERIALIZER_DEFAULT COUCHBASE_SERIALIZER_PHP
-#define COUCHBASE_SERIALIZER_DEFAULT_NAME "php"
-#define COUCHBASE_SERIALIZER_JSON 1
-#define COUCHBASE_SERIALIZER_JSON_ARRAY 2
+#define COUCHBASE_SERIALIZER_PHP 0
+#define COUCHBASE_SERIALIZER_DEFAULT COUCHBASE_SERIALIZER_PHP
+#define COUCHBASE_SERIALIZER_DEFAULT_NAME "php"
+#define COUCHBASE_SERIALIZER_JSON 1
+#define COUCHBASE_SERIALIZER_JSON_ARRAY 2
-#define COUCHBASE_IS_JSON 30
-#define COUCHBASE_IS_SERIALIZED 31
-#define COUCHBASE_GET_TYPE(f) ((f) & 31)
+#define COUCHBASE_IS_JSON 30
+#define COUCHBASE_IS_SERIALIZED 31
+#define COUCHBASE_GET_TYPE(f) ((f) & 31)
-#define COUCHBASE_COMPRESSION_MASK 224 /* 7 << 5 */
-#define COUCHBASE_COMPRESSION_NONE 0
-#define COUCHBASE_COMPRESSION_FASTLZ 1
-#define COUCHBASE_COMPRESSION_ZLIB 2
+#define COUCHBASE_COMPRESSION_MASK 224 /* 7 << 5 */
+#define COUCHBASE_COMPRESSION_NONE 0
+#define COUCHBASE_COMPRESSION_FASTLZ 1
+#define COUCHBASE_COMPRESSION_ZLIB 2
-#define COUCHBASE_GET_COMPRESSION(f) ((f) >> 5)
-#define COUCHBASE_SET_COMPRESSION(f, c) ((f) = ((f) & ~COUCHBASE_COMPRESSION_MASK) | (c) << 5)
+#define COUCHBASE_GET_COMPRESSION(f) ((f) >> 5)
+#define COUCHBASE_SET_COMPRESSION(f, c) ((f) = ((f) & ~COUCHBASE_COMPRESSION_MASK) | (c) << 5)
#ifndef Z_ADDREF_P
-#define Z_ADDREF_P ZVAL_ADDREF
+#define Z_ADDREF_P ZVAL_ADDREF
#endif
typedef struct _php_couchbase_res {
- libcouchbase_t handle;
- libcouchbase_io_opt_t *io;
- long seqno;
- char async;
- char serializer;
- char compresser;
- char *prefix_key;
- int prefix_key_len;
- libcouchbase_error_t rc; /* returned code */
+ libcouchbase_t handle;
+ libcouchbase_io_opt_t *io;
+ long seqno;
+ char async;
+ char serializer;
+ char compressor;
+ char *prefix_key;
+ int prefix_key_len;
+ libcouchbase_error_t rc; /* returned code */
} php_couchbase_res;
typedef struct _php_couchbase_ctx {
- zval *rv;
- zval *cas;
- php_couchbase_res *res;
- unsigned char flags;
- void *extended_value;
+ zval *rv;
+ zval *cas;
+ php_couchbase_res *res;
+ unsigned char flags;
+ void *extended_value;
} php_couchbase_ctx;
ZEND_BEGIN_MODULE_GLOBALS(couchbase)
- char serializer_real;
- char *serializer;
- char compresser_real;
- char *compresser;
- long compression_threshold;
- double compression_factor;
+ char serializer_real;
+ char *serializer;
+ char compressor_real;
+ char *compressor;
+ long compression_threshold;
+ double compression_factor;
ZEND_END_MODULE_GLOBALS(couchbase)
PHP_GINIT_FUNCTION(couchbase);
@@ -145,7 +147,7 @@ PHP_METHOD(couchbase, decrement);
PHP_METHOD(couchbase, getResultCode);
PHP_METHOD(couchbase, setOption);
PHP_METHOD(couchbase, getOption);
-PHP_METHOD(couchbase, version);
+PHP_METHOD(couchbase, getVersion);
PHP_FUNCTION(couchbase_connect);
PHP_FUNCTION(couchbase_add);
@@ -168,9 +170,9 @@ PHP_FUNCTION(couchbase_decrement);
PHP_FUNCTION(couchbase_get_result_code);
PHP_FUNCTION(couchbase_set_option);
PHP_FUNCTION(couchbase_get_option);
-PHP_FUNCTION(couchbase_version);
+PHP_FUNCTION(couchbase_get_version);
-#endif /* PHP_COUCHBASE_H */
+#endif /* PHP_COUCHBASE_H */
/*
* Local variables:
View
2  tests/002.phpt
@@ -18,5 +18,5 @@ resource(%d) of type (Couchbase)
Warning: couchbase_connect(): Failed to connect libcouchbase to server: Authentication error in %s002.php on line %d
Couchbase Object
(
- [_handle:Couchbase:private] => Resource id #%d
+ [%s] => Resource id #%d
)
View
7 tests/010.phpt
@@ -25,6 +25,12 @@ var_dump(couchbase_increment($handle, "key", $offset = 1, $create = true, $expir
var_dump(couchbase_get($handle, "key"));
couchbase_delete($handle, "key");
+$cb = new Couchbase(COUCHBASE_CONFIG_HOST, COUCHBASE_CONFIG_USER, COUCHBASE_CONFIG_PASSWD, COUCHBASE_CONFIG_BUCKET);
+$key = uniqid("couchbase_");
+$cb->set($key, 1);
+var_dump($cb->increment($key));
+
+
?>
--EXPECTF--
int(3)
@@ -36,3 +42,4 @@ Warning: couchbase_increment(): Faild to increment value in server: Not a number
bool(false)
int(2)
int(2)
+int(2)
View
2  tests/028.phpt
@@ -17,5 +17,5 @@ print_r($handle);
resource(%d) of type (Couchbase)
Couchbase Object
(
- [_handle:Couchbase:private] => Resource id #%d
+ [%s] => Resource id #%d
)

No commit comments for this range

Something went wrong with that request. Please try again.