You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Eax Melanhovich <ma...@eax.me> on 2015/06/24 16:35:22 UTC

InvalidQueryException: Invalid amount of bind variables

Hello.

I'm having some problems with Cassandra driver for Java.

Here is a simple Scala project:

https://github.com/afiskon/scala-cassandra-example

When I run it I get following output:

http://paste.ubuntu.com/11767987/

As I understand this piece of code:

```
private val id = "id"
private val description = "description"

QB.insertInto(table)
  .value(id, dto.id)
  .value(description, dto.descr)
  .getQueryString
```

... generates query string:

INSERT INTO todo_list(id,description) VALUES (1,?)

But I can't figure out why the second value is missing.

What am I doing wrong?

-- 
Best regards,
Eax Melanhovich
http://eax.me/

Re: InvalidQueryException: Invalid amount of bind variables

Posted by Eax Melanhovich <ma...@eax.me>.
Ok, I discovered that passing Statement instead of string to
executeAsync method solves a problem:

https://github.com/afiskon/scala-cassandra-example/commit/4f3f30597a4df340f739e4ec53ec9ee3d87da495

Still, according to documentation for getQueryString method described
problem should be considered a bug, right?

On Wed, 24 Jun 2015 17:35:22 +0300
Eax Melanhovich <ma...@eax.me> wrote:

> Hello.
> 
> I'm having some problems with Cassandra driver for Java.
> 
> Here is a simple Scala project:
> 
> https://github.com/afiskon/scala-cassandra-example
> 
> When I run it I get following output:
> 
> http://paste.ubuntu.com/11767987/
> 
> As I understand this piece of code:
> 
> ```
> private val id = "id"
> private val description = "description"
> 
> QB.insertInto(table)
>   .value(id, dto.id)
>   .value(description, dto.descr)
>   .getQueryString
> ```
> 
> ... generates query string:
> 
> INSERT INTO todo_list(id,description) VALUES (1,?)
> 
> But I can't figure out why the second value is missing.
> 
> What am I doing wrong?
> 



-- 
Best regards,
Eax Melanhovich
http://eax.me/