From: Zachary Scott Date: 2012-04-27T16:06:49+09:00 Subject: Re: ruby/shoes GUI - sqlite, how to isert a variable key in table? From what I've read[1], sqlite will coerce values into the declared datatype of the column[2]. 1: http://viewsourcecode.org/why/hacking/aQuickGuideToSQLite.html 2: http://www.sqlite.org/different.html#typing On Fri, Apr 27, 2012 at 2:52 AM, Michel wrote: > Le vendredi 27 avril 2012 à 15:35 +0900, Zachary Scott a écrit : > > Hi Danilo, How are you enjoying shoooes? > > Make sure to interpolate those instance variables! > > db.execute "insert into db.table (column-name) values (#{@ivar})" > > Yes, you can do like that. But I think that works only with VARCHAR types, > because #{var} calls the to_s method on var. > > Regards, > Michel. > > On Thu, Apr 26, 2012 at 10:47 PM, Danilo L. wrote: >> Hello, I am struggling to insert a variable into a table, for example: >> >> >> @name = edit_line >> >> db = SQLite3::Database.new "test.db" >> db.execute "create table teste (teste VARCHAR(25))" >> db.execute "insert into teste (teste) values (@name)" >> >> >> How can I add what has been written in edit line in table? >> >> -- >> Posted via http://www.ruby-forum.com/. >> > >