Re: SQLite3 and ruby / shoes gui
- From: Dave Lilley <dglnz2@xxxxxxxxx>
- Date: Tue, 9 Jun 2009 02:34:32 -0500
Brian Candler wrote:
Please try to post a *complete* program which demonstrates the problem.
Try to make it not depend on shoes (e.g. use puts for output)
Then there's a good chance that someone will be able to run it, see the
error in detail, and help you to fix it.
At the moment the only error you've shown is this:
the error i get is /usr/local/lib/shoes/ruby/lib/sqlite3/errors.rb line
62
library routine called out of sequence.
which isn't very much detail.
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.
"routine called out of sequence" sounds like you *might* have forgotten
to open the database properly. That's why it's important to show a
complete, minimal program that replicates the problem.
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?
You can have multiple tables within one file - this is how Rails sets
things up anyway. If you didn't have them in one file, I'd be surprised
if you could join between them.
Brian.
Thanks for the comments Brian,
below is a Ruby script that does what i wanted with shoes!
simple as asking for a customer nos t ofind user enters it and the data
returned.
The only thing i had to change was where i had the SQL.
tried to have it as this...
row = db.execute("select * from customers where cust_nos =
'@{cust_nos}'")
but nothing would display in the iteration so I am happy with how i've
got the thing to work.
require "sqlite3"
db = SQLite3::Database.new( "customer" )
puts 'customer Nos to find'
cust_nos = gets.chomp
stmt = "select * from customers where cust_nos = " + cust_nos
row = db.execute(stmt)
row.each {|t| puts t}
regarding the 1 table = 1 file rule i either read or saw in a video/cast
online
I think i shall put it to the SQLite forum.
dave.
--
Posted via http://www.ruby-forum.com/.
.
- References:
- SQLite3 and ruby / shoes gui
- From: Dave Lilley
- Re: SQLite3 and ruby / shoes gui
- From: Brian Candler
- SQLite3 and ruby / shoes gui
- Prev by Date: Re: How to sort array ascending, except zero ?
- Next by Date: Re: Ruby 1.9.x Concurrency
- Previous by thread: Re: SQLite3 and ruby / shoes gui
- Next by thread: sqlite3 & joins
- Index(es):
Relevant Pages
|
Loading