Board index » delphi » Re: IBX 6.08, Delphi 6 and null memo field

Re: IBX 6.08, Delphi 6 and null memo field


2008-02-27 06:15:34 AM
delphi137
Have you tried
JobQuery.FieldByName('JOB_REQUIREMENT').Clear;
--
Bill Todd (TeamB)
 
 

Re: IBX 6.08, Delphi 6 and null memo field

Hi,
I am using Delphi 6 sp2 with IBX 6.08 (I assume this is latest IBX for D6) and IB
6.0.2.0 under Windows XP sp2.
I find that no matter how I set a memo field under IBX, IBX always set
string '' in the Memo field in the database.
And I search the web, and find this dicussion:
groups.google.com/group/borland.public.delphi.database.interbaseexpress/browse_thread/thread/2caaf975c47c9d6/5eb119403639b081
Jeff suggest set TMemoField to string '' and IBX will update Interbase as
null.
Here is a simple test using Employee.Job table:
JobQuery is IBQuery, and I use TIBUpdateSQL to post the query.
JobQuery.Insert;
JobQuery.FieldByName('JOB_CODE').AsString := 'Admin';
JobQuery.FieldByName('JOB_GRADE').AsInteger := 4;;
JobQuery.FieldByName('JOB_COUNTRY').AsString := 'England';
JobQuery.FieldByName('JOB_TITLE').AsString := 'MyTest';
JobQuery.FieldByName('MIN_SALARY').AsInteger := 28000;
JobQuery.FieldByName('MAX_SALARY').AsInteger := 55000;
JobQuery.FieldByName('JOB_REQUIREMENT').AsString := '';
JobQuery.Post;
But when I look at the data under IBConsole, the JOB_REQUIREMENT value is
'', not null.
Can anyone tell me how can I fix this please?
Cheers,
Tao
 

Re: IBX 6.08, Delphi 6 and null memo field

I try both
MemoField.Clear and MemoField.Value = null
But no luck, both still update the database as string ''.
Cheers,
Tao
"Bill Todd [TeamB]" <XXXX@XXXXX.COM>writes
Quote
Have you tried

JobQuery.FieldByName('JOB_REQUIREMENT').Clear;

--
Bill Todd (TeamB)
 

Re: IBX 6.08, Delphi 6 and null memo field

tao lin writes:
Quote
Hi,

I am using Delphi 6 sp2 with IBX 6.08 (I assume this is latest IBX for D6) and IB
6.0.2.0 under Windows XP sp2.

I find that no matter how I set a memo field under IBX, IBX always set
string '' in the Memo field in the database.
And I search the web, and find this dicussion:
groups.google.com/group/borland.public.delphi.database.interbaseexpress/browse_thread/thread/2caaf975c47c9d6/5eb119403639b081

Jeff suggest set TMemoField to string '' and IBX will update Interbase as
null.

Here is a simple test using Employee.Job table:

JobQuery is IBQuery, and I use TIBUpdateSQL to post the query.

JobQuery.Insert;
JobQuery.FieldByName('JOB_CODE').AsString := 'Admin';
JobQuery.FieldByName('JOB_GRADE').AsInteger := 4;;
JobQuery.FieldByName('JOB_COUNTRY').AsString := 'England';
JobQuery.FieldByName('JOB_TITLE').AsString := 'MyTest';
JobQuery.FieldByName('MIN_SALARY').AsInteger := 28000;
JobQuery.FieldByName('MAX_SALARY').AsInteger := 55000;
JobQuery.FieldByName('JOB_REQUIREMENT').AsString := '';
JobQuery.Post;

But when I look at the data under IBConsole, the JOB_REQUIREMENT value is
'', not null.

Can anyone tell me how can I fix this please?

Cheers,

Tao



Use IBDataset instead. IBUpdateSQL assigns params using Variants, TBlobField
and TMemoField both convert null blobs to the empty string when calling
AsVarient. IBDataset (always the best choice for working with IBX) does not go
thru variants. you also should call Clear instead of AsString, but in this case
both should result in null being stored with IBDataset.
--
Jeff Overcash (TeamB)
(Please do not email me directly unless asked. Thank You)
And so I patrol in the valley of the shadow of the tricolor
I must fear evil. For I am but mortal and mortals can only die.
Asking questions, pleading answers from the nameless
faceless watchers that stalk the carpeted corridors of Whitehall.
(Fish)
 

Re: IBX 6.08, Delphi 6 and null memo field

tao lin writes:
Quote
I try both

MemoField.Clear and MemoField.Value = null

But no luck, both still update the database as string ''.

Cheers,

Tao

I have used Query.FieldByName('field').AsPointer := nil to set fields to
null. It might work for memo fields.
 

Re: IBX 6.08, Delphi 6 and null memo field

Thank you for your suggestion, Jeff. It works!
">
Quote
Use IBDataset instead. IBUpdateSQL assigns params using Variants,
TBlobField and TMemoField both convert null blobs to the empty string when
calling AsVarient. IBDataset (always the best choice for working with
IBX) does not go thru variants. you also should call Clear instead of
AsString, but in this case both should result in null being stored with
IBDataset.

--
Jeff Overcash (TeamB)
(Please do not email me directly unless asked. Thank You)
And so I patrol in the valley of the shadow of the tricolor
I must fear evil. For I am but mortal and mortals can only die.
Asking questions, pleading answers from the nameless
faceless watchers that stalk the carpeted corridors of Whitehall.
(Fish)