On Saturday 07 June 2014 16:31:32 Med Hamza wrote:
> Hi Martin,
>
>       I am working with firebird database embedded.
> When the user insert record, the default values of fields are always null.
>
> Eg CREATE TABLE t1 (c1 date default CURRENT_DATE,
>                                              c2 default 'C')
> INSERT INTO t1 (c1,c2) VALUES (:c1,:c2)    -----> this statement is in
> msesqlquery.SQLinsert--
>
> after post& commit c1 and c2 are null.
>
AFAIK DEFAULT values are solely used for columns without values in INSERT 
statement.
"
INSERT INTO t1 (c1,c2) VALUES (:c1,:c2)
"
actually supplies values for c1 and c2. Either remove c1 and c2 from VALUES or 
use a BEFORE INSERT trigger in Firebird table:
"
...
 if new.c1 is null then begin
  new.c1 = CURRENT_DATE;
 end;
 if new.c2 is null then begin
  new.c2 = 'C';
 end;
...
"
If the insert statement is built automatically it is possible to exclude field 
values by disabling <datafield>.ProviderFlags pfInUpdate.

Martin

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their 
applications. Written by three acclaimed leaders in the field, 
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk

Reply via email to