On Aug 15, 2013, at 11:27 AM, Jeremy Evans <[email protected]> wrote:

> On Thursday, August 15, 2013 6:37:31 AM UTC-7, GregD wrote:
> 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\")"
> 
> 
> That's not the correct SQL.  A graph should always have explicitly qualified 
> selections.  For example, on SQLite:
> 
> SELECT `items`.`id`, `items`.`number`, `b`.`id` AS 'b_id', `b`.`number` AS 
> 'b_number' FROM `items` LEFT OUTER JOIN `items` AS 'b' ON (`b`.`id` = 
> `items`.`id`)
>  
> So the first thing you should do is find out why it isn't generating the 
> correct SQL.

How?  This is from the select_clause_methods.  It looks right or follows 
others.  Not sure maybe something in the old mssql shared adapter I copied is 
not making it work.  Agree, the problem is there is no b_id or b_number which 
would give me the 4 name/value pairs.  I'll dig.
> 
> Here is the code gist of the Database and Dataset Modules.
> 
> 
> https://gist.github.com/gditrick/6240781
> 
> This appears to be based off a very old version of the mssql adapter.  Much 
> has changed in the meantime.  I can't see what is causing it to give 
> incorrect SQL for the graph call, though.
> 

Yes, it is probably an old mssql adapter.  I copied it along time ago to get at 
least get selects/updates/inserts to work via a jdbc connection.  Never had it 
fully functional because I was only interested in some basic sql.

>  
> 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:
> 
> You probably should turn on auto_commit on the connection if it supports it.  
> That is what the other Sequel adapters do. 
> 
Yea, I can do that.  Will make it part of the server config to either turn it 
on or off making the default to turn it on.

> Sorry I can't be more help.

NP.  Thanks for at least taking the time to look this over.  Hopefully, this is 
something simple and I can figure it out.  It is definitely in the SQL 
generation which should be making those last 2 column names to be unique. 

> 
> Thanks,
> Jeremy
> 
> -- 
> 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.

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