2012年3月3日 星期六

MyDac 5.x 修正ftMemo為空時,變成Null

最近準備升級Mysql 4.x -> 5.5
不小發現元件的一個bug,在Memo型態空值時,變會成null
造成5.5 update會跳出 can not be null
簡單的修正方式如下

DBAccess.pas
3375 行
function TDAParam.GetIsNull: boolean;
begin
  if IsBlobDataType then begin
  if DataType in [ftMemo, ftWideMemo] then Result := false
  else Result := TBlob(FParamObject).Size = 0;//原code是只要size為0就是null
  end else
   Result := inherited IsNull;
end;