0

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

1 Answer 1

1

:items is the table name. That's just Sequel's syntax for indicating which table you want to insert into.

Sign up to request clarification or add additional context in comments.

1 Comment

More specifically, :items is a symbol, like an internalized string constant, which is a common tool used with in Ruby. They are somewhat like singleton strings, as in all :x instances are exactly the same object but not all strings containing "x" are identical. Just equivalent.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.