4GL: datetime does accept inconsistent dates
Posted in 1999
Topics: Installation, Setup & Upgrades, Stored Procedures & SPL, Connectivity: ESQL/C, 4GL & Embedded SQL, Platform-Specific Issues
Hi, We are running i4gl 7.20.ud4 on HP-UX 10.20 Since we upgrade to 4gl 7.20 (Y2K compatible), 4gl does not check the value of a datetime when using a let. It does accept dates like "1999-99-99 00:00:00.000" or "00-00-00 00:00:00.000". This last format is the file entry for NULLs in our business. Do you know about new versions or Shell variables that could solve this problem ? Informix support tells us that it seems to be a new Bug. Here is a small 4gl test case DATABASE stores7 MAIN DEFINE date_1 DATETIME YEAR TO SECOND LET date_1 = "1999-12-12 00:00:00" display date_1 sleep 2 IF date_1 IS NULL THEN display 'NULL' sleep 4 ELSE display 'PAS NULL' sleep 4 END IF LET date_1 = "00-00-00 00:00:00" display date_1 sleep 2 IF date_1 IS NULL THEN display 'NULL' sleep 4 ELSE display 'PAS NULL' sleep 4 END IF END MAIN Any help will be appreciated Marc Allard
Add WHENEVER ANY ERROR STOP before the first LET statement and recompile.. If it still accepts erroneous datetimes, you've got a bug. Marc Allard wrote: > We are running i4gl 7.20.ud4 on HP-UX 10.20 > Since we upgrade to 4gl 7.20 (Y2K compatible), 4gl does not check the value > of a datetime > when using a let. > It does accept dates like "1999-99-99 00:00:00.000" or "00-00-00 > 00:00:00.000". > This last format is the file entry for NULLs in our business. > Do you know about new versions or Shell variables that could solve this > problem ? > Informix support tells us that it seems to be a new Bug. > > Here is a small 4gl test case > > DATABASE stores7 > MAIN > DEFINE date_1 DATETIME YEAR TO SECOND > LET date_1 = "1999-12-12 00:00:00" > display date_1 sleep 2 > IF date_1 IS NULL > THEN display 'NULL' sleep 4 > ELSE display 'PAS NULL' sleep 4 > END IF > > LET date_1 = "00-00-00 00:00:00" > display date_1 sleep 2 > IF date_1 IS NULL > THEN display 'NULL' sleep 4 > ELSE display 'PAS NULL' sleep 4 > END IF > END MAIN > > Any help will be appreciated > > Marc Allard -- Jonathan Leffler (jleffler@informix.com, jleffler@earthlink.net) Guardian of DBD::Informix v0.62 -- see http://www.perl.com/CPAN #include <disclaimer.h>
Marc Allard wrote: > Hi, > > We are running i4gl 7.20.ud4 on HP-UX 10.20 > Since we upgrade to 4gl 7.20 (Y2K compatible), 4gl does not check the value > of a datetime > when using a let. > It does accept dates like "1999-99-99 00:00:00.000" or "00-00-00 > 00:00:00.000". > This last format is the file entry for NULLs in our business. > Do you know about new versions or Shell variables that could solve this > problem ? > Informix support tells us that it seems to be a new Bug. > > Here is a small 4gl test case > > DATABASE stores7 > MAIN > DEFINE date_1 DATETIME YEAR TO SECOND > LET date_1 = "1999-12-12 00:00:00" > display date_1 sleep 2 > IF date_1 IS NULL > THEN display 'NULL' sleep 4 > ELSE display 'PAS NULL' sleep 4 > END IF > > LET date_1 = "00-00-00 00:00:00" > display date_1 sleep 2 > IF date_1 IS NULL > THEN display 'NULL' sleep 4 > ELSE display 'PAS NULL' sleep 4 > END IF > END MAIN > > Any help will be appreciated > > Marc Allard We tested it, our compiler came up with a Runtime Error. -- Compliments of QueriX -------------------------------------------------------------------------------------------------- QueriX 4GL Compilers are Informix 4GL Compatible. Some features are: True Windows GUI Clients. ActiveX support. HTML Report Generation. More rigorous error handling. Connection to other RDBMS such as Oracle. Connection to all versions of Informix 4GL with no need to change compiler. For more details visit: http://www.querix.com/ ---------------------------------------------------------------------------------------------------