Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Not a Problem
    • Affects Version/s: 1.0.0-beta1
    • Fix Version/s: None
    • Component/s: Core
    • Labels:
      None

      Description

      Currently PreparedStatments do not support collections. Even if CQL3 doesn't support it yet, it would be nice to be able to use the same syntax so we do not have to concat strings and just send the string over the write everytime.

        Gliffy Diagrams

          Activity

          Hide
          joaquin Joaquin Casares added a comment -

          PreparedStatements do accept collections as seen here:
          https://github.com/datastax/java-driver/blob/1.0.0-beta1/driver-core/src/test/java/com/datastax/driver/core/PreparedStatementTest.java#L119

          There is a test for Lists, Sets, and Maps. All other helper code that is used in these test functions can be found here:

          https://github.com/datastax/java-driver/blob/1.0.0-beta1/driver-core/src/test/java/com/datastax/driver/core/TestUtils.java

          I'll see if I can get some clearer examples going in the future.

          Show
          joaquin Joaquin Casares added a comment - PreparedStatements do accept collections as seen here: https://github.com/datastax/java-driver/blob/1.0.0-beta1/driver-core/src/test/java/com/datastax/driver/core/PreparedStatementTest.java#L119 There is a test for Lists, Sets, and Maps. All other helper code that is used in these test functions can be found here: https://github.com/datastax/java-driver/blob/1.0.0-beta1/driver-core/src/test/java/com/datastax/driver/core/TestUtils.java I'll see if I can get some clearer examples going in the future.
          Hide
          chanan Chanan Braunstein added a comment -

          Sorry, I think I had the syntax wrong the first time I tried it.

          By the way, is it possible to use the Query builder to create prepared statements (that have parameters)?

          Show
          chanan Chanan Braunstein added a comment - Sorry, I think I had the syntax wrong the first time I tried it. By the way, is it possible to use the Query builder to create prepared statements (that have parameters)?
          Hide
          pcmanus Sylvain Lebresne added a comment -

          is it possible to use the Query builder to create prepared statements (that have parameters)?

          Yes, you can use QueryBuilder.bindMarker() to insert a ... bind marker (and then use toString() to pass it to session.prepare). If I trust the git history, this even got into beta1.

          Show
          pcmanus Sylvain Lebresne added a comment - is it possible to use the Query builder to create prepared statements (that have parameters)? Yes, you can use QueryBuilder.bindMarker() to insert a ... bind marker (and then use toString() to pass it to session.prepare). If I trust the git history, this even got into beta1.
          Hide
          igor-petruk Igor Petruk added a comment - - edited

          Thank you for your response, Chanan.

          I am not sure if this is working correctly.

          I use in("edge_id",bindMarker()) clause.

          When I do toString() I see "where edge_id in ", which means single Long. I would expect it to generate "where edge_id in ?" and I should be able to use collection as a bind parameter, but this syntax doesn't work, event is directly specified as text.

          Is there a way to actually use list as a bind param?

          I am also asked question on StackOverflow

          http://stackoverflow.com/questions/16918853/prepared-statement-with-collection-in-in-clause-in-datastax-cassandra-cql-driver

          Thanks

          Show
          igor-petruk Igor Petruk added a comment - - edited Thank you for your response, Chanan. I am not sure if this is working correctly. I use in("edge_id",bindMarker()) clause. When I do toString() I see "where edge_id in ", which means single Long. I would expect it to generate "where edge_id in ?" and I should be able to use collection as a bind parameter, but this syntax doesn't work, event is directly specified as text. Is there a way to actually use list as a bind param? I am also asked question on StackOverflow http://stackoverflow.com/questions/16918853/prepared-statement-with-collection-in-in-clause-in-datastax-cassandra-cql-driver Thanks
          Hide
          pcmanus Sylvain Lebresne added a comment -

          Is there a way to actually use list as a bind param?

          No, this is not yet supported, see https://issues.apache.org/jira/browse/CASSANDRA-4210 for more context.

          When that's fixed in Cassandra, we'll support it in the query builder, but since it is not...
          Though I'm not fully sure how we'll support it without breaking the current behavior

          Show
          pcmanus Sylvain Lebresne added a comment - Is there a way to actually use list as a bind param? No, this is not yet supported, see https://issues.apache.org/jira/browse/CASSANDRA-4210 for more context. When that's fixed in Cassandra, we'll support it in the query builder, but since it is not... Though I'm not fully sure how we'll support it without breaking the current behavior

            People

            • Assignee:
              Unassigned
              Reporter:
              chanan Chanan Braunstein
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development