I have written a sign in / out program to record start & finish times
of staff.
I have 1 ruby script that currently handles my connection and all
query's, deletions, Updates and additions to the tables with the
currently connected DB.
I now have a need to get another connection to a database on the same
server. how best would I do this?
below is the current connection setup
require 'sequel.rb'
require 'logger'
class Dopen
def initialize
@path = "/path to log files/"
@log = Logger.new("#...@path}db - info.log")
@log.level = Logger::DEBUG
@log.debug('initialing the DB access!')
@db = Sequel.connect(:adapter => 'mysql', :localhost =>
'localhost', :database => 'test', :user => 'dave', :password =>
'test')
rescue DBI::DatabaseError => e
@log.debug("Asn error occurred\nError code: #{e.err}\nError
message: #{e.errstr}")
ensure
@log.debug('DB closed!')
@db.disconnect if @db
end
=begin
In here i have method calls to get data from the table and
delete rows etc but not shown.
=end
end
the schema is something like this...
Database - test
Table test
id - pimary autoincrement
name
address
barcode
phone
email
Database - codes
Table barcdoes
barcode
datetime
code
flag
Best of my knowledge there isn't a index on this table (I've copied
from someone else and they don't have a column called id or a primary
index).
What i am wanting to do is get a barcode belonging to a person then
get all matches for that code found in the 2nd database table
barcodes.
from this i spit them out to a report.
How best to get the connection to the second database?
I don't really care about having them joined (1 dataset for both
Tables )
@db = Sequel.connect(:adapter => 'mysql', :localhost =>
'localhost', :database => 'test', :user => 'dave', :password =>
'test'; :adapter => 'mysql', :localhost => 'localhost', :database =>
'codes', :user => 'ann', :password => 'test')
I had tried another Sequal.connect statement but was getting errors so
believe that approach to be wrong.
@db = Sequel.connect(:adapter => 'mysql', :localhost =>
'localhost', :database => 'test', :user => 'dave', :password =>
'test')
@db1 = Sequel.connect(:adapter => 'mysql', :localhost =>
'localhost', :database => 'codes', :user => 'ann', :password =>
'test')
rgds,
dave.
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sequel-talk?hl=en.