Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Fix LENGTH undefined in microsoft sqlserver #330

Merged
merged 1 commit into from Dec 6, 2012

Conversation

Projects
None yet
5 participants

btrepp commented Oct 9, 2012

SQLServer does not support the LENGTH function, but has the same functionality implemented with LEN.
This change detects if the 'sqlserver' connection adapter is being used, and changes the
function accordingly.

Beau Trepp Uses LEN when using sqlserver as connection source
SQLServer does not support the LENGTH function, but has the same functionality implemented with LEN.
This change detects if the 'sqlserver' connection adapter is being used, and changes the
function accordingly.
707096d
Contributor

linuxonrails commented Nov 18, 2012

+1 same problem

Collaborator

parndt commented Dec 6, 2012

Makes sense to me!

@parndt parndt added a commit that referenced this pull request Dec 6, 2012

@parndt parndt Merge pull request #330 from btrepp/master
Fix LENGTH undefined in microsoft sqlserver
5b8be2c

@parndt parndt merged commit 5b8be2c into norman:master Dec 6, 2012

Contributor

linuxonrails commented Dec 13, 2012

It doesn't work for history slug.

TinyTds::Error: 'LENGTH' is not a recognized built-in function name.: EXEC sp_executesql N'SELECT TOP (1) [friendly_id_slugs].* FROM [friendly_id_slugs] WHERE [friendly_id_slugs].[sluggable_type] = N''World'' AND (slug = N''alatriste'' OR slug LIKE N''alatriste--%'') AND (sluggable_id <> 47) ORDER BY LENGTH(slug) DESC, slug DESC'

Using friendly_id (4.0.9) from https://github.com/norman/friendly_id.git (at master)

@linuxonrails linuxonrails added a commit to linuxonrails/friendly_id that referenced this pull request Dec 13, 2012

@linuxonrails linuxonrails fix LENGTH undefined in slug history for microsoft sqlserver. fix #330 b3594e4

@linuxonrails linuxonrails referenced this pull request Dec 13, 2012

Merged

fix #330 #350

@norman norman added a commit that referenced this pull request Dec 13, 2012

@norman norman Merge pull request #350 from linuxonrails/master
fix #330
9be8a22

Am having the same problem

daveomcd commented Jun 1, 2013

I'm running into this same issue. I'm new to Rails though and am unsure how to get the latest for this? I have added friendly_id to my gemfile and didn't specify a version. What else do i need to do to get this update fixed version? Thanks!

Edit: Solved the issue by adding the following to my rails project's gemfile.

gem 'friendly_id', '4.1.0.beta.1'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment