v.5.5.3 Adapter / MSSQL / TypedDataTable from sproc
Hi,
today I fighted with strange behavior of TypedView resultset from sproc.
I have several apps using the same MSSQL database.
Sometimes I need to insert new column into some table.
Simple job, even I do not need rebuild all apps using this changed table.
Old apps doesn't know about new field, but work fine, can read and also can write (write if new column can be null of course.)
The same for views, I can insert columns and old apps without resync will continue working fine.
Yesterday I changed common sproc returning resultset, I inserted another column.
I expected that old apps will work fine as in sproc resultset is just extra column.
Today I realized strange behavior for changed sproc.
Say I had in sproc: SELECT PartNo, LotNo, IsOK...
I inserted column SerialNo and changed sproc to SELECT PartNo, LotNo, SerialNo, IsOK...
Old programs since that change returned in "IsOK" field always FALSE, finally I found out, that in fact LLBLGen takes fields by index, not by names and therefore it still takes data from 3rd column (originally IsOK column) but now 3rd field is string SerialNo, and IsOK therefore returns FALSE for any row.
EDIT: seems it returns DBnull and that is converted to False by typedview code for IsOK field
Public Property [IsOk]() As System.Boolean
Get
Return CType(IIf(IsIsOkNull(), TypeDefaultValue.GetDefaultValue(GetType(System.Boolean)), Me(_parent.IsOkColumn)), System.Boolean)
End Get
Set
Me(_parent.IsOkColumn) = Value
End Set
End Property
Is this behavior for sproc by design or is it some bug?
For entities and views I can insert new fields without any problem for old apps, just in case of stored procedures I had this problem.
EDIT: Q:Why I do such dirty things like inserting fields into tables, view and sproc without rebuilding all apps using common tables/views/sproc?
A: I make apps for automotive industry running in 247, impossible to test and update all mfg. apps communicating with various equipment at the same time.
I never faced any issue with modified tables or views, just today having issue with modified sproc. Instead of returning OK status, all products reported today FALSE status and it took me whole day to find out the reason is: inserted field in sproc