Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MultiEnum (function set) throws a truncation error on query #8

Open
wilr opened this issue May 8, 2013 · 0 comments
Open

MultiEnum (function set) throws a truncation error on query #8

wilr opened this issue May 8, 2013 · 0 comments

Comments

@wilr
Copy link
Member

wilr commented May 8, 2013

From http://open.silverstripe.org/ticket/8160

When using DBField 'MultiEnum?' SS translates this to MySQL set command. MSSQL doesn't have set and doesn't even have Enum, that is why mssql module translates both. Enum works correctly by search for the longest option and then setting the mssql field to varchar(). Since mssql module function set directly returns function enum there is a truncation error because varchar() is not long enough.

Example:

Enum('Apple, Oranges, Mango') => resulting field Varchar(7)
MultiEnum?('Apple, Oranges, Mango') => resulting field Varchar(7) error
I fixed this by bypassing Enum varchar length selection with a value of 255

My fix; Line 1023: $maxLength = 255;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant