I am feeling constricted and frustrated!
I have had I believe a very good sniff on google trying to find some
help with my problem (namely using SQLite).
got and printed off the FAQ from
sqlite-ruby.rubyforge.org/sqlite3/faq.html and it gives me enough to
hang myself with!
this is the code i have that directly relates to sqlite.
db.execute("select * from customers where '#{@cust_no}'") do |row|
debug row
end
Now the debug is a shoes call to put output to it's debug window so this
could easily be changed to a puts for ruby.
all i am wanting to do is to enter a customer number and have the data
printed to the screen (or to the debug screen within shoes to help me
prove i can do it).
the error i get is /usr/local/lib/shoes/ruby/lib/sqlite3/errors.rb line
62
library routine called out of sequence.
Now the code I'm trying to copy is this...
db = SQLite3::database.new("test.db")
db.execute("select * from test") do |row|
... <I've just put the debug row in here!!!>
end
now i'm only shown you the db.execute part as i think we can safely
assume that the database is open and my db variable is a valid handle or
i get more errors talking about the that database isn't open or some
such messages.
Soooooo what am i doing wrong?
also what is the correct way to do things with sqlite - 1 table per
database file or can you have multiple tables within 1 database file?
e.g.
Customer.db has X tables all relating to one another just like you might
have with postgesql or mysql?
anyone point me to some more ruby & sqlite3 sample code?
currently i have 3 files each with 1 table in them and will be wanting
to extract data from them depending on the customer number being viewed.
so ...
Customer number is a UNIQUE numeric value to the customer and it has a
field in jobs table that has that customers number in it.
Jobs has a UNIQUE field called job_nos and the 3rd table parts has a
field for the job_nos that's held in the job table.
cheers,
dave
···
--
Posted via http://www.ruby-forum.com/.