oibo8x / subsonicproject

Automatically exported from code.google.com/p/subsonicproject
0 stars 0 forks source link

Validation always fails on fixed-length Binary columns #27

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
http://www.codeplex.com/subsonic/WorkItem/View.aspx?WorkItemId=11784
This was already brought up once long ago, and seemed to have been fixed
for awhile, but now it is back for some reason -- perhaps because the bug
has moved from ActiveRecord.cs to RecordBase.cs.

We have in our SQL Server 2005 DB a table with a binary(3) column. On
insert or update when the function ValidateColumnSettings is called, the
length-validation fails.

This happens in ActiveRecord\RecordBase.cs line 531 because the ToString()
method of the byte array (member: "settingValue") is called and the length
of the return value (which is always "System.Byte[]") is compared to '3'. 
13 is always greater than 3 -- this is the wrong behavior, but will go
unnoticed unless you have a binary column with less than 13 bytes.

Instead, perhaps the length of the array should be compared -- or no
validation should be done for the length of binary columns.

NOTE: The exception is actually thrown in ActiveRecord.cs at line 222, due
to the nature of SubSonic's validation logic.

Version: 2.1.1 (svn rev 479)
Attachment: patched RecordBase.cs to fix bug

Original issue reported on code.google.com by adamnof...@gmail.com on 29 Jul 2008 at 3:09

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks for notification and patch. Included for next commit.

Original comment by ever...@gmail.com on 8 Aug 2008 at 7:21