jbochi / lua-resty-cassandra

Pure Lua Cassandra client using CQL binary protocol

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support for inserting lists

subnetmarco opened this issue · comments

I'm currently trying to insert a list, like

local ok, err = session:execute([[
  INSERT INTO items (name, colors)
  VALUES (?)
]], {"Test", { "red", "blue" }})

But the client fails, returning:

cassandra.lua:285: attempt to concatenate local 'bytes' (a table value)stack traceback:
coroutine 0:
    cassandra.lua: in function 'value_representation'
    cassandra.lua:902: in function 'execute'

Lists are already supported, but you need to annotate them. Instead of
passing them directly, try something like this:

cassandra.list({'red', 'blue'})

You should also add an extra question mark in the query, since you have two
arguments: name and colors.

Let me know if this solves the issue.

On Wed, Dec 10, 2014, 00:33 Marco Palladino notifications@github.com
wrote:

I'm currently trying to insert a list, like

local ok, err = session:execute([[ INSERT INTO items (name, colors) VALUES (?)]], {"Test", { "red", "blue" }})

But the client fails, returning:

cassandra.lua:285: attempt to concatenate local 'bytes' (a table value)stack traceback:
coroutine 0:
cassandra.lua: in function 'value_representation'
cassandra.lua:902: in function 'execute'


Reply to this email directly or view it on GitHub
#24.

Thank you this works

You're welcome!

On Wed, Dec 10, 2014, 19:30 Marco Palladino notifications@github.com
wrote:

Closed #24 #24.


Reply to this email directly or view it on GitHub
#24 (comment).