>Hi Aleksey,
>
>>I don't think the error is caused by the fact that you are working with a free table.
>
>mmm. With a dbc's table, you can define a DEFAULT '', and then the error don't happen, the FREE is relevant.
>
Hi Fabio,
And I argue that it is irrelevant because the error can be reported for DBC tables as well. What is relevant, is that there is a non-NULL field which isn't assigned a value.
>>For a new record, non-modified fields are not included by CursorAdapter into INSERT command.
>
>mmm. except with a SETFDL() revert,
>how can I insert a record without having modified fields ?
>
Very simple, don't assign values to the fields.
>
>with patience, can you study this repro.
>For me this is a BIG BUG.
>
I don't see anything new here. There was a bug in VFP6, in some scenarios (or my be always) SQL-INSERT didn't revert inserted record in case of a failure. The bug was fixed later, but VFPODBC driver is based on VFP 6 code. Thanks for brining our attention to this.
SET NULL ON
CLEAR
?VERSION()
ON ERROR ?ERROR(),MESSAGE()
CREATE CURSOR foo (f1 I NOT NULL, f2 I NOT NULL)
INSERT INTO foo (f1) VALUES (1)
INSERT INTO foo (f1) VALUES (2)
?ALIAS(),"RECCOUNT() = ",RECCOUNT()
LIST
ON ERROR
Results:
Visual FoxPro 07.00.0000.9262 for Windows
1581 Field F2 does not accept null values.
1581 Field F2 does not accept null values.
FOO RECCOUNT() = 2
Record# F1 F2
1 1 0
2 2 0
Visual FoxPro 08.00.0000.3117 for Windows
1581 Field F2 does not accept null values.
1581 Field F2 does not accept null values.
FOO RECCOUNT() = 0
>
>
>* next fire the standard ( Bad design !) error F4
>
>INSERT INTO custser (custserid) VALUES (3779862)
>
>BROWSE LAST
>
Could you please elaborate on this "( Bad design !)" comment. I bet many people would like to know what exactly did you mean.
Thanks,
Aleksey.