Subject | Re: [IBO] default value in table field |
---|---|
Author | Jason Wharton |
Post date | 2001-06-04T23:52:40Z |
Defaults defined on the server don't care at all what value the column has.
The only time they are applied is if the column is omitted from the INSERT
statement. Otherwise, it will take a NULL as any other value if it is a part
of the INSERT statement.
In IBO if you flag a column as COMPUTED in the column attributes this will
prevent it from being used in any of the automatic DML it generates. This
may or may not be what you want to do.
GetServerDefaults is really the only workaround for this problem but I don't
like it much since it is currently slower than I would like it to be.
HTH,
Jason Wharton
CPS - Mesa AZ
http://www.ibobjects.com
The only time they are applied is if the column is omitted from the INSERT
statement. Otherwise, it will take a NULL as any other value if it is a part
of the INSERT statement.
In IBO if you flag a column as COMPUTED in the column attributes this will
prevent it from being used in any of the automatic DML it generates. This
may or may not be what you want to do.
GetServerDefaults is really the only workaround for this problem but I don't
like it much since it is currently slower than I would like it to be.
HTH,
Jason Wharton
CPS - Mesa AZ
http://www.ibobjects.com
----- Original Message -----
From: "Lucas Franzen" <luc@...>
To: <IBObjects@yahoogroups.com>
Sent: Monday, June 04, 2001 5:30 AM
Subject: Re: [IBO] default value in table field
>
> Adalberto,
>
> if you have a Query on your client side that will have SQL like:
>
> SELECT * FROM FINFILE
>
> NFILE_UP will be part of the select statement.
> Thus the client will also know, that this field is defined NOT NULL so
> it will cause an error every time you're trying to post the record,
> without having assigned a value to this field.
>
> If you change your SQL to:
> SELECT nfile, des60 FROM FINFILE
>
> NFILE_UP will NOT be part of the SQL statement - so if you save the
> record, the server will receive NULL for that field and WILL react the
> way you expect it to.
>
> As you stated in your example:
>
> Insert into Finfile (nfile,des60) values ('Customers','Customer
> Information')
>
> does work.
>
> It works since NFILE_UP is NOT part of the insert statement.
>
> HTH
> Luc.
>
>
>
> baldiniadalb@... schrieb:
> >
> > Nando, Helen
> >
> > NFILE_UP is a secondary field I use only for some checks or for set
> > order sequence.
> > I am looking for a solution that allow me to don't worry with
> > calculated fields into the application. So I thought to charge
> > Database to do it for me.
> >
> > I constructed Before_Insert and Before_Update triggers :
> > NEW.nfile_up := Upper(New.nfile) and following SQL instruction :
> >
> > Insert into Finfile (nfile,des60) values ('Customers','Customer
> > Information') it works well !!
> >
> > Delphi, IBConsole, IB_WISQL ... require data for all not null fields.
> > I put Default Value to cheat them , but it doesn't work.
> > They don't use default value definitions.
> >
> > Second solution : I tried it but it doesn't work; IBO always use
> > database definitions and test NFILE_UP as required.
> >
> > Finally : it seems I have to accept to fill these information into
> > all applications that will post records.
> >
> > Thanks,
> > Adalberto
> >
> >
> >
> > Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>