"Bad type in structure" means that some property/parameter is of an invalid type. e.g. a string instead of an object, an object of the wrong class, etc.
One thing that jumps out at me is this line...
I believe that all timestamps must now be defined by an instance of the cassandra_Clock class instead of just a raw timestamp.
$clock = new cassandra_Clock();
$clock->timestamp = time();
I just got done making a little PHP high level client for Cassandra .7; a big help to me was to open up the various files under the $GLOBALS['THRIFT_ROOT'].'/packages/cassandra/ directory. These files contain all the cassanda_* classes, so you can see explicitly how they work, and what they need to work. Also the cassandra wiki on the API07 is a great tool.
Any problems you run into I've probably just ran into myself! :-)
On Mon, Oct 4, 2010 at 12:02 AM, Kevin Withnall <email@example.com>
I've just installed the latest version of cassandra (0.7.0 beta 2) and
re-made the relevant thrift libraries.
There doesn't seem to be many php examples around so i'm struggling to
get something basic to work. I had it working under 0.6.0 but had
other issues hence the upgrade.
I've tried to execute 'get' as well as get_slice but theres something
im missing i think. the cassandra cli will show the data thats
inserted as the first part of this but I can't read it back.
[default@Keyspace1] get Standard1['1']
=> (column=656d61696c, firstname.lastname@example.org, timestamp=1286162622)
Returned 1 results.
The error I get from php is
exception 'TProtocolException' with message 'Bad type in structure.'
Any ideas would be really appreciated.
--- cut here ---
$GLOBALS['THRIFT_ROOT'] = '/var/www/cassandra';
// Make a connection to the Thrift interface to Cassandra
$socket = new TSocket("127.0.0.1", 9160);
$transport = new TFramedTransport($socket, 10240, 10240);
$protocol = new TBinaryProtocolAccelerated($transport);
$client = new CassandraClient($protocol);
$col = new cassandra_Column();
$columnParent = new cassandra_ColumnParent();
$columnParent->column_family = "Standard1";
$columnParent->super_column = NULL;
$consistency_level = cassandra_ConsistencyLevel::ZERO;
$retval=$client->insert($key, $columnParent, $col, $consistency_level);
$sliceRange = new cassandra_SliceRange();
$sliceRange->start = '';
$sliceRange->finish = '';
$predicate = new cassandra_SlicePredicate();
$predicate->slice_range = $sliceRange;
$consistency_level = cassandra_ConsistencyLevel::ONE;
$result = $client->get_slice("Keyspace1", $key, $columnParent,
--- cut here ---