Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is there a way to determine if field contains NULL or no
Message
 
 
To
11/10/2001 14:33:41
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00567112
Message ID:
00567159
Views:
18
>>Sergey,
>>
>> This whole idea started from the following. My colleague wrote a DeNull program. This programs opens table exclusively and if field allows NULLs, changes it to not allow them. It doesn't check, whether file contains NULLs or not. First of all, this process may be slow on the huge files. Secondly, all of the sudden I had VFP crash today several times when it was running this program. It worked just fine few days ago, so I had no idea, what may cause this crash...
>
>I really wouldn't know if the crash may be coming from a field being marked as Not Null while having nulls in some records.
>
>I'd rather prevent the situation than get into analysis-paralysis with it. In the DeNull.prg, before setting a field to NotNull:
>
locate for isnull(eval(cFld))
>if found()
>   replace rest (cFld) with vDefaultValue for isnull(eval(cFld))
>endif
>Alter Table ...
Dragan,

I don't think, it's the reason. It worked fine with free tables with NULLs. Here is the situation: I have a table, which is part of a database. It has lots of validation field rules and record level rule. Each field here accepts nulls. Actually, this program should not been invoked on this table, but something was not right, so it was invoked and gave crashes. The file is empty. I replicated this problem several times. I added NOVALIDATE clause to ALTER TABLE command, but it didn't help and I still got VFP Fatal Error. So, few observations come to mind:
1) DeNull program should check for not empty file
2) It should add NOVALIDATE clause
3) Something is wrong with VFP, empty table with validations and ALTER TABLE command.

Can you please try to replicate this problem?

I already sent a note to my colleague about it. I also fixed the offending piece of code to not execute DeNull program at all, but this is not a general solution.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform