On Monday, January 7, 2019 at 12:11:50 PM UTC-8, [email protected] 
wrote:
>
> Thanks, Jeremy. I made this work as below, learning in the way some Ruby 
> syntax. My way went brutal but will work for now, I need to trace how the 
> actual inserts implemented and get some permanence metrics. I have a 
> question. The #multi_insert use json that assures the constancy of 
> delimiters. The #import takes Chr(39) encoded values. As you see in my code 
> I build it dynamically from my json but on the SQL side it is basically a 
> string. So, if any of my values have single quote then I presume I need to 
> escape it but as I tested it works for some reasons. I did not look into 
> your code but did you have the single quote provision built in already?
>
> chunk.msgpack_each{|tag, time, data|
>       paylod << JSON.parse(data)
>   num += 1 
>     } 
> paylod.each do |key, value|
> sqlvalues = key.values
> sqlkeys = key.keys
> end 
> columslist = sqlkeys.map { |x| x.to_sym }
>     begin
>       client[@table.to_sym].import(columslist, [sqlvalues])  
>     ensure
>       client.disconnect
>     end
> $log.info "Inserted record: #{num}"
>

Except in a few cases (see 
http://sequel.jeremyevans.net/rdoc/files/doc/security_rdoc.html), Sequel 
will automatically escape strings appropriately when literalizing them into 
SQL.

Thanks,
Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to