Re: SQLite3 and ruby / shoes gui



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/.

.



Relevant Pages

  • Re: SQLite3 and ruby / shoes gui
    ... Try to make it not depend on shoes (e.g. use puts for output) ... i get more errors talking about the that database isn't open or some ... 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 ...
    (comp.lang.ruby)
  • Re: GT.M V5.3-004 released
    ... Documentation tab to get to a page from which all user documentation ... data in database and journal files. ... On UNIX/Linux platforms, the database file size limit has been ... size, the largest database file that can be created is 1,792GB. ...
    (comp.lang.mumps)
  • Re: FrontPage security / writing to an Access database file
    ... I think if you do tools/ web settings/ database ... > database etc) I need to be able to write data to the database file. ... > script is by using the control panel to set the following IUSR permissions ... > POST commands from annonymous users but have contacted the hosting company ...
    (microsoft.public.frontpage.client)
  • RE: "Exclusive Access" (or lack thereof) suddenly an issue
    ... Via Windows Explorer navigate to the folder where your database file ... Microsoft Access Support ...
    (microsoft.public.access.gettingstarted)
  • mysql update with ruby + dbi
    ... I am trying to modify a mysql database using a file for information. ... puts "we have a match" ... # Split the web address in the database into the array ...
    (comp.lang.ruby)

Loading