Anyone- 

Trying to get Sybase SqlAnywhere to work for Sequel using the native 
sqlanywhere driver: https://github.com/sqlanywhere/sqlanywhere and having a few 
issues with the integration tests. I just started this in my spare time, so I 
haven't gotten very far yet. One thing that has me stuck are these 2 failing 
tests and need a solution is: 


rspec ./spec/integration/dataset_test.rb:67 # Simple Dataset operations should 
graph correctly 
rspec ./spec/integration/dataset_test.rb:71 # Simple Dataset operations should 
graph correctly with a subselect 




The SQL generated is correct and works in the Sybase Client software: 


"SELECT * FROM \"ITEMS\" LEFT OUTER JOIN \"ITEMS\" AS \"B\" ON (\"B\".\"ID\" = 
\"ITEMS\".\"ID\")" 


and 



"SELECT * FROM (SELECT * FROM \"ITEMS\") AS \"ITEMS\" LEFT OUTER JOIN (SELECT * 
FROM (SELECT * FROM \"ITEMS\") AS \"T1\") AS \"B\" ON (\"B\".\"ID\" = 
\"ITEMS\".\"ID\")" 



The tests expect this result: 



expected: [{:items=>{:id=>1, :number=>10}, :b=>{:id=>1, :number=>10}}] 
got: [{:items=>nil, :b=>nil}] (using ==) 



But in both cases, I get a 1 row resultset with 4 columns that graph like this: 


ID NUMBER ID NUMBER 
1 10 1 10 


So if I build a hash of this I will only have a hash with 1 key/value pair. Is 
this common for other drivers? Or, do they actually/usually prefix them with 
"ITEMS" and "B"? I would think there would be both types. 


Here is the code gist of the Database and Dataset Modules. 


https://gist.github.com/gditrick/6240781 


Forgive the pp, I'm old school when debugging. Also, the shared_sqlamywhere.rb 
file was started as a copy of another adapter's shared one, so there is 
probably a lot in it that is not needed or possibly wrong, but I know some of 
it is correct since stuff is starting to work after modifying it. :) 


One other question: 
I could not get much to work until I added the commit in the Databaset#execute 
method on line 99 
https://gist.github.com/gditrick/6240781#file-sqlanywhere-rb-L99 . I did not 
see this in other adapters in Sequel. I'm sure this is wrong and probably need 
allow Sequel to issue the commit someplace. I've seen definitions for a 
"COMMIT", but define it like it was in other adapters did not work. Looking at 
AR's SqlAnywhere adapter, it seems they are doing it with this: 


SA.instance.api.sqlany_commit(@connection) if @auto_commit 


So, I put in the similar code to get things working on line 99 
https://gist.github.com/gditrick/6240781#file-sqlanywhere-rb-L99 , but it feels 
wrong and usually that means it is wrong. 


Thanks, 


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

Reply via email to