Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blob data received correctly #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gonzalophp
Copy link

Check this changes for blob columns.

@evseevnn-zz
Copy link
Owner

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?

@gonzalophp
Copy link
Author

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)

@evseevnn-zz
Copy link
Owner

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'. 🎉
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 ❓

@gonzalophp
Copy link
Author

What happens when you run that query after going to cqlsh with something like this?

insert into tests (id, "blobData") values (2, 0x03);

@evseevnn-zz evseevnn-zz self-assigned this Jul 31, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants