Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/ruby
- require File.dirname(__FILE__) '/../../config/boot'
- require "rubygems"
- require_gem "activerecord"
- #Ruby standard includes
- require 'xmlrpc/server'
- #custom includes
- require "Log/Log.rb"
- require "Session/SessionManager.rb"
- require "XmlRpc/RpcClasses.rb"
- require "Settings.rb"
- # Read database config via YAML
- @dbs = YAML::load(ERB.new(IO.read("./database.yml")).result)
- # If for some reason we wanted to change the connection string (maybe chan
- # in mid program we could have a different database under either the test
- # historical paramaters and then just set this to @dbs["test"] or @dbs["pr
- curr_db = @dbs["production"]
- # these parameters are YAML file specific, which should make it easy to ch
- # changing the source code for the program.
- ActiveRecord::Base.establish_connection(
- :adapter => curr_db["adapter"],
- :database => curr_db["database"], # The current database in the YML file
- # If this is changed the database.yml file needs to be
- :host => curr_db["host"],
- :username => curr_db["username"],
- :password => curr_db["password"]
- )
- begin
- resultset = ValidDataTable.find(:all)
- $log << "result is: \n"
- $log << " is of type " << resultset.inspect << "\n"
- $log.flush
- $log << "Analysis: \n"
- resultset.each { |result|
- $log << "\t" << result.class << "\n"
- }
- rescue => stuff
- $log << "We got an exception..."
- $log << stuff
- end
- begin
- resultset = ValidDataTable.find(:all)
- $log << "result is: "
- $log << resultset
- rescue => stuff
- $log << "We got an exception..."
- $log << stuff
- end
- #DBConnect()
- appServer = XMLRPC::Server.new(Settings::ListenPort, Settings::ListenIP)
- include XmlRpc
- registerClasses(appServer)
- appServer.serve
- ------------------------------output--------------------------
- result is:
- is of type We got an exception...
- can't convert String into Integer
- result is: #<ValidDataTable:0xb75ee20c>#<ValidDataTable:0xb75ee1d0>
- -----------------------------stacktrace-----------------------
- It won't give me one. The app server stuff does wierd stuff with output.
- --------------------------default exception handling output-----------
- ./appServer.rb:40:in `<<': can't convert String into Integer (TypeError)
- from ./appServer.rb:40
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement