Reputation: 1043
very new to ruby so any help is appreciated. I'm trying to use a different gem(Sequel) to insert data into a mysql database. The catch is, some of this data contains mysql special characters which is why i'm trying to use the other mysql driver Sequel as someone recommended to me.
Here's the error when i use the native mysql gem:
[user@server nessus-report-database]# ./testme.rb 949293931.nessus
949293931.nessus
1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'backported' to the remote SSH server without changing its version number.
Bann' at line 47
My main question is i'm not sure i understand the documentation for the Sequel gem which gives the following examples:
DB[:items].insert([1,2,3])
# INSERT INTO items VALUES (1, 2, 3)
The part that is throwing me off is DB[:items]
. what is the [:items] portion? is this a variable that i would set the value of to my columns i want to update? And also does anyone know if this example above would escape special characters for mysql?
Documentation for this gem is here: http://sequel.jeremyevans.net/rdoc/classes/Sequel/Dataset.html#method-i-insert
Upvotes: 0
Views: 355
Reputation: 8467
:items
is the table name. That's just Sequel's syntax for indicating which table you want to insert into.
Upvotes: 1