incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ollif Lee <ollif...@gmail.com>
Subject Re: Purpose of BLOB datatype
Date Tue, 09 Jul 2013 14:40:40 GMT
Thank you for your patience. That is what I have expected.
PS. Do you know any direct ways in CQL to handle BLOB, just like DataStax
Java driver?


On Tue, Jul 9, 2013 at 4:53 PM, Sylvain Lebresne <sylvain@datastax.com>wrote:

> > Pls explain why and how.
>
> Why and how what?
>
> Not encoding blobs into strings is the "preferred way" because that's
> obviously
> more efficient (in speed and space), since you don't do any encoding pass.
>
> As for how, "use prepared statement" was the "how". What are the exact
> lines of
> code to use to do prepared statements will depends on the client driver you
> use, and you should check your driver documentation.
>
> But, to give you an example, if you use the DataStax Java driver
> (https://github.com/datastax/java-driver), this might look something like:
>
>   PreparedStatement st = session.prepare("INSERT INTO foo(myKey, myBlob)
> VALUES (?, ?)");
>   String myKey = ...;
>   ByteBuffer myBlob = ...;
>   session.execute(st.bind(myKey, myBlob));
>
>
> --
> Sylvain
>

Mime
View raw message