php-cassandra-binary
php-cassandra-binary copied to clipboard
Blob data received correctly
Check this changes for blob columns.
Sorry, how do you make a request to the database? What is now working perfectly. What exactly do you save as blob into blob column?
A normal query ( select * from keyspace.columnfamily) to a column family with blob columns. The data is displayed as 0x binary strings when running from cqlsh command line.
The same query from this library was producing an error (more length than data available)
How do I check.
$database = new Database(['127.0.0.1'], 'for_tests');
$database->connect();
//$database->query('DROP TABLE "tests";');
$database->query('CREATE TABLE "tests" (
id int PRIMARY KEY,
"blobData" blob
);');
$database->query(
'INSERT INTO "tests" (id, "blobData") VALUES
(:id, :blob)', [
'id' => 1,
'blob' => 3
]);
$result = $database->query('SELECT "blobData" FROM "tests" WHERE "id" = 1;');
This returns me to '3'. :tada:
At the same time, if you make a query using cqlsh, the value will be:
0x0000000133
As far as I understand, all right. Purpose - to provide data on their value is not in hex.
Am I wrong :question:
What happens when you run that query after going to cqlsh with something like this?
insert into tests (id, "blobData") values (2, 0x03);