Re: Which DB/Software suite combo is best for Web<->DB implementation
Posted in 1999
John Mullee (john@exmachina.net) wrote:
: I said:
: > > Don't even think about Informix's web datablade.
: Thomas Tatum wrote:
: > I disagree.
:
: Validating a date in Informix Web-Datablade tags.
: This resembles no language I ever heard of, except maybe RPG. But not
: really.
That's because it isn't a programming language. It's meant to
be used as mark-up directioves for HTML. If you want to
do some serious programming stuff, use 'C', or SPL, or
Java, and implement your code as a UDR.
i.e.
CREATE FUNCTION DateIsValid ( ARG1 LVARCHAR, Arg2 LVARCHAR, Arg3 LVARCHAR )
RETURNING boolean
--
-- Use SPL to check the validity of the date. Alternatively.
-- you might simply try the INFORMIX date check routines and
-- catch the exception. In any case, return 't' if it's OK, and
-- 'f' otherwise.
--
END FUNCTION;
The the whole ugly mess John posted reduces to:
<?MIVAR NAME=MMI_VALDATE>TRUE<?/MIVAR>
<?MISQL SQL="EXECUTE FUNCTION DateIsValid ( '$year_date_birth', '$month_date_birth', '$day_date_birth')">
<?MIVAR COND(=,$1,'f')>$(SETVAR,$MMI_VALDATE,FALSE)<?/MIVAR>
And those of you more conversant in the Web Blade than I can probably
reduce this further. The advantage of this is that you can re-use the
DateIsValid() function all over the place without re-using the
reams of mark-up. Also, if you find a bug, then you can simply
change the function to fix it, rather than re-writing lots of code.
The trick is this: think of it as if you're building the application
in the ORDBMS, and using the WebBlade as the means of interfacing the
DBMS to HTML.
Hope this helps!
KR
Pb