On Dec 16, 4:59 am, Pete <[email protected]> wrote:
> Hi,
>
> I have an application that uses Sequel (2.8.0). It was built against
> MySQL and works fine there. However due to infrastructure limitations
> I need to get it working against MSSQL (2000).
>
> It looks like either the odbc/mssql adapter is not up-to-date or
> possibly it supports SqlServer 2005+ but is not backwards compatible
> with SqlServer 2000.
>
> The issues I have been encountering are:
> * attempting to quote column names with " (not valid) rather than
> surrounding them in []

This is fairly simple to fix by adding a quoted_identifier method that
uses [] instead of "" to quote identifiers.  The MSSQL adapter already
does this, so make sure you are using :db_type=>'mssql' option when
instantiating the database.

> * wrapping table names in parentheses (not valid) - they can be quoted
> using []

If you are the same person that posted on IRC, this is because you did
DB["Countries"] instead of DB[:Countries].  If you give DB#[] a
string, it treats it as a literal SQL string, and when you did count
on it, it uses it as a subquery (surrounding it in ()).

> * when calling dataset.count it generates something like "select NCOUNT
> (*) from table" which isn't valid

I'm not sure where the NCOUNT is coming from, it doesn't appear to be
Sequel (according to fgrep -ri ncount).  If Sequel is using NCOUNT
someplace, please let me know.

> * when writing a date/time to the database it is trying to use an iso
> format which doesn't work with 2000.

That should be fairly easy to fix inside Dataset#literal in mssql.rb.

> * when writing a String to the database it is escaping \ (backslash)
> characters even though SqlServer 2000 does not give backslash a
> special meaning.

Again, that should be fairly easy to fix inside Dataset#literal in
mssql.rb.

> I'm not sure how much further the rabbit-hole goes. I've managed to
> patch these issues but as I mention above, I'm not sure whether I am
> undoing support for 2005 or whether this adapter simply isn't being
> used - or I have something else broken in my environment.

I don't do any testing against MSSQL, but I do know quite a few people
are using it.  If you are one of the people that are using MSSQL with
Sequel, please speak up and be willing to test patches.

Since you've already got patches, please submit them (pull request,
Google code issue, pastie, etc.) so I can consider them for inclusion.

Thanks,
Jeremy
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to