Created
May 16, 2012 16:47
-
-
Save jamesgecko/2712098 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PS C:\Users\denton\code\portal> jruby --1.9 .\app.rb | |
[2012-05-16 12:24:12] INFO WEBrick 1.3.1 | |
[2012-05-16 12:24:12] INFO ruby 1.9.2 (2012-02-22) [java] | |
== Sinatra/1.3.2 has taken the stage on 4567 for development with backup from WEBrick | |
[2012-05-16 12:24:12] INFO WEBrick::HTTPServer#start: pid=7092 port=4567 | |
JRuby limited openssl loaded. http://jruby.org/openssl | |
gem install jruby-openssl for full support. | |
I, [2012-05-16T12:24:14.318000 #7092] INFO -- : (0.057000s) SELECT CAST(SERVERPROPERTY('ProductVers | |
ion') AS varchar) | |
I, [2012-05-16T12:24:14.389000 #7092] INFO -- : (0.058000s) SELECT TOP (1) * FROM [POLICYS] WHERE ( | |
([AGENCYID] = 2) AND ([RECNUM] = N'30689')) | |
I, [2012-05-16T12:24:14.400000 #7092] INFO -- : =========== | |
I, [2012-05-16T12:24:14.410000 #7092] INFO -- : {:from=>[:MiscellaneousClasses], :where=>#<Sequel:: | |
SQL::BooleanExpression @op=>:AND, @args=>[#<Sequel::SQL::BooleanExpression @op=>:"=", @args=>[#<Sequ | |
el::SQL::QualifiedIdentifier @table=>:MiscellaneousClasses, @column=>:agencyid>, 2]>, #<Sequel::SQL: | |
:BooleanExpression @op=>:"=", @args=>[#<Sequel::SQL::QualifiedIdentifier @table=>:MiscellaneousClass | |
es, @column=>:recnum>, "HOME"]>]>, :limit=>1} | |
I, [2012-05-16T12:24:14.493000 #7092] INFO -- : (0.057000s) SELECT TOP (1) * FROM [MISCELLANEOUSCLA | |
SSES] WHERE (([MISCELLANEOUSCLASSES].[AGENCYID] = 2) AND ([MISCELLANEOUSCLASSES].[RECNUM] = N'HOME') | |
) | |
Sequel::DatabaseError - NativeException: com.microsoft.sqlserver.jdbc.SQLServerException: Conversion | |
failed when converting the nvarchar value 'HOME' to data type int.: | |
com/microsoft/sqlserver/jdbc/SQLServerException.java:216:in `makeFromDatabaseError' | |
com/microsoft/sqlserver/jdbc/SQLServerResultSet.java:4853:in `nextRow' | |
com/microsoft/sqlserver/jdbc/SQLServerResultSet.java:1781:in `fetchBufferNext' | |
com/microsoft/sqlserver/jdbc/SQLServerResultSet.java:1034:in `next' | |
c:/dev/jruby-1.6.7/lib/ruby/gems/1.8/gems/sequel-3.34.1/lib/sequel/adapters/jdbc.rb:740:in ` | |
process_result_set_convert' | |
c:/dev/jruby-1.6.7/lib/ruby/gems/1.8/gems/sequel-3.34.1/lib/sequel/adapters/jdbc.rb:713:in ` | |
process_result_set' | |
c:/dev/jruby-1.6.7/lib/ruby/gems/1.8/gems/sequel-3.34.1/lib/sequel/adapters/jdbc.rb:600:in ` | |
fetch_rows' | |
c:/dev/jruby-1.6.7/lib/ruby/gems/1.8/gems/sequel-3.34.1/lib/sequel/adapters/jdbc.rb:235:in ` | |
execute' | |
c:/dev/jruby-1.6.7/lib/ruby/gems/1.8/gems/sequel-3.34.1/lib/sequel/adapters/jdbc.rb:524:in ` | |
statement' | |
c:/dev/jruby-1.6.7/lib/ruby/gems/1.8/gems/sequel-3.34.1/lib/sequel/adapters/jdbc.rb:233:in ` | |
execute' | |
c:/dev/jruby-1.6.7/lib/ruby/gems/1.8/gems/sequel-3.34.1/lib/sequel/connection_pool/threaded. | |
rb:101:in `hold' | |
c:/dev/jruby-1.6.7/lib/ruby/gems/1.8/gems/sequel-3.34.1/lib/sequel/database/connecting.rb:23 | |
4:in `synchronize' | |
c:/dev/jruby-1.6.7/lib/ruby/gems/1.8/gems/sequel-3.34.1/lib/sequel/adapters/jdbc.rb:232:in ` | |
execute' | |
c:/dev/jruby-1.6.7/lib/ruby/gems/1.8/gems/sequel-3.34.1/lib/sequel/dataset/actions.rb:744:in | |
`execute' | |
c:/dev/jruby-1.6.7/lib/ruby/gems/1.8/gems/sequel-3.34.1/lib/sequel/adapters/jdbc.rb:600:in ` | |
fetch_rows' | |
c:/dev/jruby-1.6.7/lib/ruby/gems/1.8/gems/sequel-3.34.1/lib/sequel/dataset/actions.rb:131:in | |
`each' | |
c:/dev/jruby-1.6.7/lib/ruby/gems/1.8/gems/sequel-3.34.1/lib/sequel/dataset/actions.rb:55:in | |
`all' | |
c:/dev/jruby-1.6.7/lib/ruby/gems/1.8/gems/sequel-3.34.1/lib/sequel/model/associations.rb:144 | |
4:in `_load_associated_object_array' | |
c:/dev/jruby-1.6.7/lib/ruby/gems/1.8/gems/sequel-3.34.1/lib/sequel/model/associations.rb:143 | |
8:in `_load_associated_object' | |
c:/dev/jruby-1.6.7/lib/ruby/gems/1.8/gems/sequel-3.34.1/lib/sequel/model/associations.rb:145 | |
4:in `_load_associated_objects' | |
c:/dev/jruby-1.6.7/lib/ruby/gems/1.8/gems/sequel-3.34.1/lib/sequel/model/associations.rb:153 | |
2:in `load_associated_objects' | |
c:/dev/jruby-1.6.7/lib/ruby/gems/1.8/gems/sequel-3.34.1/lib/sequel/model/associations.rb:105 | |
9:in `misc_class' | |
C:/Users/denton/code/portal/controllers/policy.rb:54:in `HEAD /policy/:id' | |
org/jruby/RubyMethod.java:121:in `call' | |
c:/dev/jruby-1.6.7/lib/ruby/gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:1211:in `compile | |
!' | |
org/jruby/RubyProc.java:258:in `call' | |
c:/dev/jruby-1.6.7/lib/ruby/gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:785:in `route!' | |
c:/dev/jruby-1.6.7/lib/ruby/gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:801:in `route_ev | |
al' | |
c:/dev/jruby-1.6.7/lib/ruby/gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:785:in `route!' | |
c:/dev/jruby-1.6.7/lib/ruby/gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:822:in `process_ | |
route' | |
org/jruby/RubyKernel.java:1197:in `catch' | |
c:/dev/jruby-1.6.7/lib/ruby/gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:820:in `process_ | |
route' | |
c:/dev/jruby-1.6.7/lib/ruby/gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:784:in `route!' | |
org/jruby/RubyArray.java:1615:in `each' | |
c:/dev/jruby-1.6.7/lib/ruby/gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:783:in `route!' | |
c:/dev/jruby-1.6.7/lib/ruby/gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:886:in `dispatch | |
!' | |
c:/dev/jruby-1.6.7/lib/ruby/gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:719:in `call!' | |
c:/dev/jruby-1.6.7/lib/ruby/gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:871:in `invoke' | |
org/jruby/RubyKernel.java:1197:in `catch' | |
c:/dev/jruby-1.6.7/lib/ruby/gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:871:in `invoke' | |
c:/dev/jruby-1.6.7/lib/ruby/gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:719:in `call!' | |
c:/dev/jruby-1.6.7/lib/ruby/gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:705:in `call' | |
c:/dev/jruby-1.6.7/lib/ruby/gems/1.8/gems/rack-protection-1.2.0/lib/rack/protection/xss_head | |
er.rb:22:in `call' | |
c:/dev/jruby-1.6.7/lib/ruby/gems/1.8/gems/rack-protection-1.2.0/lib/rack/protection/base.rb: | |
47:in `call' | |
c:/dev/jruby-1.6.7/lib/ruby/gems/1.8/gems/rack-protection-1.2.0/lib/rack/protection/base.rb: | |
47:in `call' | |
c:/dev/jruby-1.6.7/lib/ruby/gems/1.8/gems/rack-protection-1.2.0/lib/rack/protection/path_tra | |
versal.rb:16:in `call' | |
c:/dev/jruby-1.6.7/lib/ruby/gems/1.8/gems/rack-protection-1.2.0/lib/rack/protection/json_csr | |
f.rb:17:in `call' | |
c:/dev/jruby-1.6.7/lib/ruby/gems/1.8/gems/rack-protection-1.2.0/lib/rack/protection/base.rb: | |
47:in `call' | |
c:/dev/jruby-1.6.7/lib/ruby/gems/1.8/gems/rack-protection-1.2.0/lib/rack/protection/xss_head | |
er.rb:22:in `call' | |
c:/dev/jruby-1.6.7/lib/ruby/gems/1.8/gems/rack-1.4.1/lib/rack/session/abstract/id.rb:205:in | |
`context' | |
c:/dev/jruby-1.6.7/lib/ruby/gems/1.8/gems/rack-1.4.1/lib/rack/session/abstract/id.rb:200:in | |
`call' | |
c:/dev/jruby-1.6.7/lib/ruby/gems/1.8/gems/rack-1.4.1/lib/rack/logger.rb:15:in `call' | |
c:/dev/jruby-1.6.7/lib/ruby/gems/1.8/gems/rack-1.4.1/lib/rack/head.rb:9:in `call' | |
c:/dev/jruby-1.6.7/lib/ruby/gems/1.8/gems/rack-1.4.1/lib/rack/methodoverride.rb:21:in `call' | |
c:/dev/jruby-1.6.7/lib/ruby/gems/1.8/gems/sinatra-1.3.2/lib/sinatra/showexceptions.rb:21:in | |
`call' | |
c:/dev/jruby-1.6.7/lib/ruby/gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:1334:in `call' | |
c:/dev/jruby-1.6.7/lib/ruby/gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:1416:in `synchro | |
nize' | |
c:/dev/jruby-1.6.7/lib/ruby/gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:1334:in `call' | |
c:/dev/jruby-1.6.7/lib/ruby/gems/1.8/gems/rack-1.4.1/lib/rack/handler/webrick.rb:59:in `serv | |
ice' | |
c:/dev/jruby-1.6.7/lib/ruby/1.9/webrick/httpserver.rb:111:in `service' | |
c:/dev/jruby-1.6.7/lib/ruby/1.9/webrick/httpserver.rb:70:in `run' | |
c:/dev/jruby-1.6.7/lib/ruby/1.9/webrick/server.rb:183:in `start_thread' | |
0:0:0:0:0:0:0:1 - - [16/May/2012:12:24:13 CDT] "GET /policy/30689 HTTP/1.1" 500 156348 | |
http://www.google.com/url?sa=D&q=http://localhost:4567/policy/30689&usg=AFQjCNGhhdmcu4gcARU9DmPrnlrx | |
cY2dmA -> /policy/30689 | |
0:0:0:0:0:0:0:1 - - [16/May/2012:12:24:15 CDT] "GET /__sinatra__/500.png HTTP/1.1" 304 0 | |
http://localhost:4567/policy/30689 -> /__sinatra__/500.png |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
get '/policy/:id' do |id| | |
p = Policy.filter(agencyid: session[:agencyid], recnum: id).first | |
Policy.def_column_alias :klass, :class | |
logger.info '===========' | |
logger.info p.misc_class_dataset.opts.inspect | |
logger.info p.misc_class[:description] | |
logger.info '===========' | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT TOP 1 policys.agencyid, policys.class, MiscellaneousClasses.description | |
FROM MiscellaneousClasses | |
LEFT JOIN Policys on Policys.class = MiscellaneousClasses.class | |
WHERE policys.recnum = 30689 | |
agencyid class description | |
2 HOME Homeowners |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sequel.inflections do |inflect| | |
inflect.clear :all | |
end | |
class Policy < Sequel::Model(:Policys) | |
set_primary_key [:agencyid, :recnum] | |
many_to_one :misc_class, class: :MiscClass, | |
key: [:agencyid, :klass], key_column: [:agencyid, :class] | |
end | |
class MiscClass < Sequel::Model(:MiscellaneousClasses) | |
set_primary_key [:agencyid, :recnum] | |
one_to_many :policy, class: :Policy, | |
key: [:agencyid, :klass], key_column: [:agencyid, :class] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment