c++ - Cassandra datastax cpp driver - avoiding unnecessary copies -
I use the following method to create my insert statement for Cassandra (using datastax cpp driver) :
ssStmt1 & lt; & Lt; "Insert some table (...) value (....)" string sStatement1 = ssStmt1.str (); Castestring cass1 = cass_string_init (sStatement1.c_str ()); CassStatement * pStmt1 = cass_statement_new (cass1, 0);
I have also tried the following:
CassString cass1 = cass_string_init ("Enter some table (id, date, c) value (? ,?,?); "); CassStatement * pStmt1 = cass_statement_new (cass1, 3); Cass_statement_bind_uuid (pStmt1, 0, uuidKey); Cass_statement_bind_int64 (PSTMT1, 1, timestamp); Cass_statement_bind_string (pStmt1, 2, sSomething);
The first pattern works with mixed keys, the second is not. The key has a timestamp and a UUID.
Timestamp is one of two errors in the field (based on the used bond statement).
If bound in this way:
cass_statement_bind_int64_by_name (pStmt1, "date", timestamp);
I get the following error:
Invalid zero value for the clustering key part.
If bound in this way:
cass_statement_bind_int64 (pStmt1, 1, timestamp);
I get the following error:
expected by 8 or by 0 bytes (19)
The first pattern above writes the data to a stringstream. This is then copied to a std :: string, before copying it into a cass string, e.g. It is very disabled; The purpose of using Cassandra was not good when the purpose was for high transaction rates.
Can anyone explain why I am trying to bind these 64 errors with the timestamp field?
(The timestamp is stored in Cosmos as INS 64 - the millisecond number after the age. Cassandra.h file says that they are bound as int64)
(Search for timestamp)
I will need more information to set this error:
Expected 8 or 0 bytes long (19)
Are you able to share your code?
The result of trying to use the "by_name" method on the following error is a non-finished statement:
Invalid zero value for the clustering key part.
To create a statement to bind a value, return metadata is necessary Reference: Also, be sure to check the result of cass_statement_bind_int64_by_name ()
.
I have created an example that uses a composite key and a mixed partition key:
Hope, it helps.
Comments
Post a Comment