Php-couch base SDK vs php-ext-couchbase


#1

I would like to use php-ext-couchbase as it has more functions to choose from but it appears to be older on Github. Is one more official than the other?


#2

Please More explain your question


#3

I guess @fnsnoop is asking about the difference between https://github.com/couchbase/php-ext-couchbase which is place where 1.x SDK lives and https://github.com/couchbaselabs/php-couchbase which is new 2.0 series of PHP SDK


#4

Thats the question, I am confused why the newer version doesnt have all the functions that the old one has. I am very interested in the setMulti() function.

I am also receiving some odd errors on the newer version. Every 8 or so gets on the same key, I receive this error.

Warning: Invalid callback , no array or string given in CouchbaseNative on line 1111

I think this is because I am running PHP 5.3 on a 64 bit system.


#5

Hey fnsnoop,

What kind of operations were you looking for that existed in the PHP 1.x series of client, but which is missing from the 2.x series? Additionally, can you post an example of your code which causes the periodic callback error?

Cheers, Brett


#6

I would like to insert more than 1 document at a time with a set command. The 1.x series has a setMulti().

My code for getting the error below.

$cluster = new CouchbaseCluster('127.0.0.1:8091','','');
$bucket = $cluster->openBucket('default');
$value = $bucket->get("key here");

echo "<pre>";
print_r($value);
echo "</pre>";

#7

Hey fnsnoop,

This is still possible, it’s just rolled into the main set of operations, for instance:

$bucket->upsert(array(
  'key1' => 'value1',
  'key2' => 'value2'
));

Cheers, Brett


#8

I have tried this and both keys get inserted but the values dont make it. The values shows up as null.


#9

Hey fnsoop,

I sincerely apologize, I forgot a level of array there:

$bucket->upsert(array(
  'key1' => array('value' => 'value1'),
  'key2' => array('value' => 'value2')
));

The additional level exists as you can specify various operation options on a per-key basis.

Cheers, Brett


#10

Hi.

Could I question regarding this?

Is it possible with CAS value?

Actually, I’m looking for a solution like this.
http://www.couchbase.com/issues/browse/PCBC-118?page=com.atlassian.streams.streams-jira-plugin:activity-stream-issue-tab

But not easy to find any reference from newest document.

Could you please help on this as well?

Thanks


#11

Hey ronpark,

You can put a CAS value as the ‘cas’ key of the inner array (alongside value).

Cheers, Brett


#12

Ok. Let me try it as you mentioned.
And ask you later if I have other problem. :smiley:

Many thanks for kindly help.