Jeremy-
I tried free the connection resources like the api gem said and that was no
good. I got segment faults when the test executed the valid_connection? after
the disconnect. So, that is not an option. I thought of adding to the app
connection instance an attr_acccessor and method disconnected? when it is
created. Then when I execute the sql, I could see if the conn has been
disconnected? then throw/raise the exception. This did not work either, so I pp
the objects to see what the heck was going on during a connect, disconnect and
execute.
Here is what is showed me:
"connect: #<SQLAnywhere::a_sqlany_connection:0x914829c>" <-- ansi c connection
object before extending it
#<SQLAnywhere::a_sqlany_connection:0x914829c @disconnected=false> <-- same c
object extended as it executes the sql
"SQL: SELECT NULL" <-- sql to test the connection valid_connection? == true
test
"Pool: #<Sequel::ThreadedConnectionPool:0x8e8486c>" <-- Sequel pool object
#<Sequel::ThreadedConnectionPool:0x8e8486c
@after_connect=nil,
@allocated=
{#<Thread:0x8c61008 run>=>
#<SQLAnywhere::a_sqlany_connection:0x914829c @disconnected=false>},
@available_connections=[],
@connection_handling=nil,
@db=
#<Sequel::SqlAnywhere::Database:
"sqlanywhere://localhost?DBN=Test;UID=dba;PWD=sql">,
@max_size=4,
@mutex=#<Mutex:0x8e84858>,
@sleep_time=0.001,
@timeout=5.0>
"Connection: #<SQLAnywhere::a_sqlany_connection:0x914829c>"
"disconnected? false"
"disconnect: #<SQLAnywhere::a_sqlany_connection:0x9f50b28>" <--- DB.disconnect
start
#<SQLAnywhere::a_sqlany_connection:0x9f50b28 @disconnected=false>
"after disconnect: #<SQLAnywhere::a_sqlany_connection:0x9f50b28>"
#<SQLAnywhere::a_sqlany_connection:0x9f50b28 @disconnected=true> <---
DB.disconnect end
"connect: #<SQLAnywhere::a_sqlany_connection:0x9b7d758>" <--
DB.valid_connection? start - whoa conn object different. why?
#<SQLAnywhere::a_sqlany_connection:0x9b7d758 @disconnected=false>
"SQL: SELECT NULL"
"Pool: #<Sequel::ThreadedConnectionPool:0x9c8ae70>"
#<Sequel::ThreadedConnectionPool:0x9c8ae70
@after_connect=nil,
@allocated=
{#<Thread:0x9a69038 run>=>
#<SQLAnywhere::a_sqlany_connection:0x9b7d758 @disconnected=false>},
@available_connections=[],
@connection_handling=nil,
@db=
#<Sequel::SqlAnywhere::Database:
"sqlanywhere://localhost?DBN=Test;UID=dba;PWD=sql">,
@max_size=4,
@mutex=#<Mutex:0x9c8ae5c>,
@sleep_time=0.001,
@timeout=5.0>
"Connection: #<SQLAnywhere::a_sqlany_connection:0x9b7d758>"
"disconnected? false"
F
Failures:
1) Sequel::Database should provide ability to check connections for validity
Failure/Error: Unable to find matching line from backtrace
expected: false value
got: true
# ./spec/integration/database_test.rb:99:in `block (2 levels) in <top
(required)>'
Finished in 0.33838 seconds
1 example, 1 failure
Failed examples:
rspec ./spec/integration/spec_helper.rb:77 # Sequel::Database should provide
ability to check connections for validity
I think I'm missing something very obvious or I need to override
valid_connection?. But, how I'm I getting a totally different connection
object/instance prior to executing the sql? Also, why is the pool object not
contain any available connections? available_connections = []
My goal is to get this as complete as possible. If this test is not possible,
hopefully, you can except this as it being pending for the native adapter
unless there is something really obvious that I'm missing.
Regards,
-GregD
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/groups/opt_out.