Closed griessbach14943 closed 6 months ago
Referencing the field name alone will of course fail, but via table alias e.g. tblMytest.NULL actually returns the correct content. But I have searched a little further, the error already appears when creating the *.db2 file, If I correct the file, the restore works.
Best Regards Ulf Neugebauer
@griessbach14943
Ooops. Somehow I missed the issue. There was a lot of noise in GoFish spamming me, so I fear I ignored the VFPX section.
I will look at the problem later this week. Would you mind to send me an example dbf?
It's always a problem to use internal designators as user defined designators. Not that VFP give a good example. Anyway, I like to discourage everybody.
The special handler needed sadly will slow down FoxBin2Prg.
@griessbach14943 Thank you. Is closing this issue intended?
@griessbach14943 I recommend that you always use the latest version of FoxBin2Prg. Best via Thor. Anyway, the problem exist in recent version 1.21.02
Analysing the problem:
Basically, the problem is on how VFP looks up fields, variables and build in literals. One must understand, that NULL
is identical to .NULL.
(with dots).
To determine the value of a field to store with the db2 file, FoxBin2Prg uses:
luValue = Evaluate(lcField)
this is for your table like
lcField = "NULL"
luValue = Evaluate(lcField)
and luValue is null after this.
So VFP first looks up the build in literal, then the field, then the variable.
To completely understand, try the following:
use tblMyTest.dbf alias tblMyTest
NULL = 'A'
?NULL
?m.NULL
?tblMyTest.NULL
?!NULL
SELECT null FROM tblMyTest
Again, this is a problem of using Reserved Words (see help for Reserved Words in VFP help). So, be not surprised if your field returns unexpected results.
The problem for FoxBin2Prg is simple enough to solve by just adding the alias.
@griessbach14943 Sorry, but just to be picky:
The problem is not on a fields caption (this is a fields property for a DBC bound table), its about a fields name.
@griessbach14943 New version is available here and via Thor.
Super Job, jetzt klappt es auch mit xCase, ich denke das was DIE Ausnahme von der Regel! Danke!
Immer gerne.
NULL ist halt der eine Bezeichner, der in VFP auch als Konstante geht. Zum Glück war es weiter kein lauf-zeitlicher Aufwand, das zu flicken.
ℹ Computer information
📝 Provide detailed reproduction steps (if any)
I have been using XCASE from Resolution for years to create and maintain databases. For some time now, I have also been versioning the respective models together with my projects. I have noticed that field contents are not restored if the field was named "NULL".
TEST: CREATE Table tblMyTest ( MyName c(10), MyField l, Null l) INSERT INTO tblMyTest Values( "Row 1", .T., .T. ) INSERT INTO tblMyTest Values( "Row 2", .F., .F. ) INSERT INTO tblMyTest Values( "Row 3", .T., .T. ) INSERT INTO tblMyTest Values( "Row 4", .F., .F. )
Table original
After Restore via Text to Bin
Best Regards Ulf Neugebauer