[Rails] Sybase ctlib Adapter

John Sheets metacasa at comcast.net
Wed Feb 1 14:05:57 GMT 2006


Hi,

I've been trying to update Will Sobel's sybase-ctlib adapter to pass  
unit tests on Rails 1.0.  It's been a slow, sloggy process for me so  
far, as I've been learning Ruby, Rails, and Sybase administration all  
in one go.  (c:  It's been a saving grace to have a good starting  
point (thanks Will!).

   http://dev.rubyonrails.org/ticket/2030

The big issue I'm facing right now is reconciling fixtures and the  
insert() method.  I couldn't tell for certain from looking at the SQL  
in test/fixtures/db_definitions whether the unit test tables should  
have (1) auto-generated id's (IDENTITY in Sybase) or (2) app- 
generated id's.  Near as I could tell, the SQL for db2, mysql,  
postgresql, and sqlserver use #1, while firebird, oci, and sqlite use  
#2.  Just guessing tho.

In case #1, insert() would work as is for Sybase, but the fixtures  
bail since they try to explicitly set the id's.  You can override  
this with SET IDENTITY_INSERT, but I'm not sure how to hook into the  
fixtures to flip this on and off.  This would be my preferred approach.

In case #2, the fixtures work fine, but insert() fails because of the  
missing id value.  I assume I'd have to generate my own id, e.g,.  
with max() + 1?  It doesn't look like the other adapters are doing  
this, so I'm guessing case #1 is the way to go.

Of course, in the bigger picture, I'm not sure how ActiveRecord is  
intended to handle id generation if the table (or database) doesn't  
support auto-increment.  What's the rule?

Also, is anyone else out there working on the ctlib adapter?

I'd appreciate any insights.  Looking forward to getting this done so  
I can go back to being a regular Rails user.  (c:

Thanks,
John

-- 
John R. Sheets
http://umber.sourceforge.net
http://writersforge.sourceforge.net


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060201/abc9ee84/attachment.html


More information about the Rails mailing list