Reputation: 864
I have a table:
CREATE TABLE agency (
documentCode ASCII,
sectionCode ASCII,
checkedAt TIMESTAMP,
PRIMARY KEY (franchisedCode, agencyCode)
)
;
I can change the structure of my database, if needed.
I would set a timestamp:
$cassandra = $cluster->connect($keyspace);
$statement = $cassandra->prepare('
INSERT INTO agency
( documentCode
, sectionCode
, checkedAt
) VALUES
( :documentCode
, :sectionCode
, :checkedAt
);
');
$arguments = [
'documentCode' => $code1,
'sectionCode' => $code2,
'checkedAt' => $mixed,
];
var_dump($arguments);
$options = new ExecutionOptions([
'arguments' => $arguments,
]);
$cassandra->execute($statement, $options);
I tested some values for $mixed
:
null
works123456789
fails, even if I cast to int
or string
'2016-06-06T12:34:56+00:00'
fails'2016-06-06T12:34:56'
fails '2016-06-06'
failsThe error message is Fatal error: Uncaught Cassandra\Exception\InvalidArgumentException: Invalid value type
Can you see something wrong? Thanks
Upvotes: 1
Views: 795
Reputation: 864
Well, I solved my issue.
I have to use Object Type:
$checkedAt = new \Cassandra\Timestamp($checkedAt);
Upvotes: 1