I am not able to add columns whenever i change the keyid. In existing
keyid i m able to add columns. Here is the code that I am using.
<?php
// session_start();
session_start();
if (!empty($_SESSION['badAgent'])) {
// echo 'BAD AGENT';
// exit; // bail on problem agents
}
error_reporting(E_ALL);
require_once(dirname(__FILE__).'/../config.php');
if (!PandraCore::connect('default', 'localhost')) {
die(PandraCore::$lastError);
}
$keyId = 'content1';
$keyspace = 'Keyspace1';
$columnFamily = 'Standard2';
$put = new PandraColumnFamily($keyId,
$keyspace,
$columnFamily
);
//$put = new content();
$put->setKeyID($keyId);
//$put->setColumn('city','meerut111');
$put->addColumn('city')->setValue('meerut221111');
$put->addColumn('state')->setValue('AP');
if (!$put->save()) {
die($put->lastError());
}
echo 'hi';
//unset($put);
$put1 = new PandraColumnFamily($keyId,
$keyspace,
$columnFamily
);
$put1->load('content');
echo '<pre>'.$put1->toJSON(TRUE);
print_r($put1);
This looks like correct usage, you're saving city/state for key
'content1' and then loading a non-existant key 'content'.
If I'm understanding this ok, if you're trying to clone key 'content1'
into 'content', then you'll need to set key 'content' after the load.
... eg :
$put1 = new PandraColumnFamily($keyId,
$keyspace,
$columnFamily
);
$put1->load('content');
echo '<pre>'.$put1->toJSON(TRUE);
print_r($put1);
... should be :
$put1 = new PandraColumnFamily($keyId,
$keyspace,
$columnFamily
);
$put1->load();
$put1->setKeyID('content');
echo '<pre>'.$put1->toJSON(TRUE);
print_r($put1);
... key 'content' should then be savable.
Is that what you're after?
--
To unsubscribe, reply using "remove me" as the subject.
Hi :)
There's a supercolumn usage example @
http://github.com/mjpearson/Pandra/blob/master/examples/address_supercolumn.php
which might be useful, it shows how to create child classes via the
init() methods, attach supercolumns to column families etc. Do you
have a sample of the code you're working on? I'm happy to help out.
The object structure is fairly dynamic, checking out the interfaces
for 'columnpathable' (binds columnfamilies, supercolumns and columns)
and 'containerchild' (binds supercolumns and columns) would be a good
place to start conceptually if you need to work efficiently with
complex structures.
-michael
--