Re: Same options in i4gl, dbaccess & upscol?
Posted in 1997
On Tue, 4 Nov 1997, Nelson Fredsell wrote:
> >The DB-Access constraints should be specified when the table is created,
> >but will not be enforced by UPSCOL or the form system -- the form system
> >and UPSCOL predate the database-enforced constraints, so it is unaware that
> >they exist and does not know it should look for them. It would be sensible
> >to have that ability, but that would require changes to I4GL.
>
> So, when I use INPUT DEFAULT for a screen, none of the
> default/constraint work I've done at the table/column level thru
> dbaccess will show up.
It won't be used in the application validation of the data; it will show up
if the application tries to insert data that violates the database rules.
This is the last line of defence, but can be invaluable.
> Hearty implementation of data rules requires work at both column and
> screen levels, right? This appears to be true even for primary key
> information and referential integrity?
Ideally, yes, but I4GL has been in maintenance mode (as opposed to
enhancement mode) for a while now. Adding support for such new features
(new compared with the 4.10 OnLine and Se against which it was designed
to work) has not happened, more's the pity.
> Since these utilities are not well integrated with each other I wonder
> if one might be inclined to not use them so much, and opt for data
> validation thru code (i4gl) instead. That way one can "see" what is
> going on all in one place instead of trying to guess at what level
> rules have been implemented. Or, maybe attention to detail thru the
> utilities is really worth the effort, in order to insure solid data.
I'd put all the available enforcement in the database. I'd also mirror
those constraints in the I4GL code. I probably wouldn't use UPSCOL.
> I'm working on the time stamp field on a screen form and am getting
> "00:00". My column is datetime hour to second as you suggested. The
> upscol default is CURRENT. I tried "default = current" at the form
> (*.per) level and still no luck: "00:00". Thru dbaccess
> query-language I INSERTed a row and received the proper time stamp
> (implemented thru dbaccess Defaults option). What have I missed?
I don't know; possibly the HOUR TO MINUTE qualifier? The following code
works for me (6.05.UC1 I4GL-RDS on Solaris 2.5.1):
-- kk.sql --
create table d(t datetime hour to minute);
-- kk.4gl --
database fglbld
main
define t datetime hour to minute
open form f from "kk"
display form f
input t from d.t
close form f
clear screen
display t
end main
-- kk.per --
database fglbld
screen
{
time [f000 ]
}
tables
d
attributes
f000 = d.t, default = current hour to minute;
end
Yours,
Jonathan Leffler (johnl@informix.com) #include <witticism.h>