Change Field Value "empty string" -> "null"
Posted: Fri 02 Apr 2010 14:47
My enviroment:
Windows XP
Delphi 2007 W32 (R2) + dbexpida40.dll (v. 2.20.10)
Firebird 1.5
The problem:
I have a table this table
CREATE TABLE TABLETEST (
ID INTEGER NOT NULL,
FIELDREQUIRED CHAR(10) NOT NULL
);
I try to inser record with SQLDataSet+DataSetProvider+ClientDataSet, this part of code:
... CUT ...
ClientDataSet1.Insert;
ClientDataSet1ID.AsInteger:=1;
ClientDataSet1FIELDREQUIRED.AsString:=' ';
ClientDataSet1.Post;
ClientDataSet1.ApplyUpdates(0);
... CUT ...
The ApplyUpdates fails for:
validation error for column FIELDREQUIRED, value "*** null ***"
My analysis:
In Provider.pas the value of parameter n° 2 (for column FIELDREQUIRED) is set to '', correctly.
Part of Provider.pas:
FieldLine := WideFormat('%s%s%s%s%2:s, ', [FieldLine, PSQLInfo(Tree.Data)^.QuotedTableDot,
QuoteChar, Field.Origin]);
ParamLine := ParamLine + '?, ';
***** >> Value := Field.NewValue; << ********
if VarIsClear(Value) then Value := Field.OldValue;
TParam(Params.Add).AssignFieldValue(Field, Value);
end;
Provider.pas Line 4095 (in the "TSQLResolver.GenInsertSQL").
This i ok but with dll "dbexpida40.dll" not work, otherwise with ""dbxint30.dll" work !!
Help me!
Thk
PS: I tired to use "Contact Form" for send a example, but not work...
Windows XP
Delphi 2007 W32 (R2) + dbexpida40.dll (v. 2.20.10)
Firebird 1.5
The problem:
I have a table this table
CREATE TABLE TABLETEST (
ID INTEGER NOT NULL,
FIELDREQUIRED CHAR(10) NOT NULL
);
I try to inser record with SQLDataSet+DataSetProvider+ClientDataSet, this part of code:
... CUT ...
ClientDataSet1.Insert;
ClientDataSet1ID.AsInteger:=1;
ClientDataSet1FIELDREQUIRED.AsString:=' ';
ClientDataSet1.Post;
ClientDataSet1.ApplyUpdates(0);
... CUT ...
The ApplyUpdates fails for:
validation error for column FIELDREQUIRED, value "*** null ***"
My analysis:
In Provider.pas the value of parameter n° 2 (for column FIELDREQUIRED) is set to '', correctly.
Part of Provider.pas:
FieldLine := WideFormat('%s%s%s%s%2:s, ', [FieldLine, PSQLInfo(Tree.Data)^.QuotedTableDot,
QuoteChar, Field.Origin]);
ParamLine := ParamLine + '?, ';
***** >> Value := Field.NewValue; << ********
if VarIsClear(Value) then Value := Field.OldValue;
TParam(Params.Add).AssignFieldValue(Field, Value);
end;
Provider.pas Line 4095 (in the "TSQLResolver.GenInsertSQL").
This i ok but with dll "dbexpida40.dll" not work, otherwise with ""dbxint30.dll" work !!
Help me!
Thk
PS: I tired to use "Contact Form" for send a example, but not work...