Subject | [IBO] Re: Default values not defaulting for some field |
---|---|
Author | ming |
Post date | 2012-02-06T03:02:44Z |
thank u for your support ! Jason, Hellen
how to send you, the working sample app
can i send via email attachment?
here the text dump, copy paste below to the delphi
---------------
object Form1: TForm1
Left = 0
Top = 0
Caption = 'Form1'
ClientHeight = 300
ClientWidth = 920
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object IB_UpdateBar1: TIB_UpdateBar
Left = 152
Top = 256
Width = 120
Height = 25
Ctl3D = False
ParentCtl3D = False
TabOrder = 0
DataSource = IB_DataSource1
ReceiveFocus = False
CustomGlyphsSupplied = []
end
object IB_DatasetBar1: TIB_DatasetBar
Left = 278
Top = 256
Width = 120
Height = 25
Ctl3D = False
ParentCtl3D = False
TabOrder = 1
DataSource = IB_DataSource1
ReceiveFocus = False
CustomGlyphsSupplied = []
end
object IB_TransactionBar1: TIB_TransactionBar
Left = 8
Top = 256
Width = 120
Height = 25
Ctl3D = False
ParentCtl3D = False
TabOrder = 2
CustomGlyphsSupplied = []
IB_Transaction = IB_Transaction1
ReceiveFocus = False
end
object IB_Grid1: TIB_Grid
Left = 8
Top = 8
Width = 390
Height = 242
CustomGlyphsSupplied = []
DataSource = IB_DataSource1
TabOrder = 3
end
object Memo1: TMemo
Left = 404
Top = 8
Width = 501
Height = 242
Lines.Strings = (
'/***************************************************************' +
'***************/'
'/*** Generated by IBExpert 2/6/2012 9:51:23 AM ' +
' ***/'
'/***************************************************************' +
'***************/'
''
'/***************************************************************' +
'***************/'
'/*** Following SET SQL DIALECT is just for the Database Com' +
'parer ***/'
'/***************************************************************' +
'***************/'
'SET SQL DIALECT 3;'
''
''
''
'/***************************************************************' +
'***************/'
'/*** Tables ' +
' ***/'
'/***************************************************************' +
'***************/'
''
''
'CREATE GENERATOR GEN_TCONTACT_ID;'
''
'CREATE TABLE TCONTACT ('
' CONTACT_ID INTEGER_1 NOT NULL /* INTEGER_1 = INTEGER */' +
','
' TITLE_NAME VARCHAR10 /* VARCHAR10 = VARCHAR(10) */,'
' FIRST_NAME VARCHAR20 NOT NULL /* VARCHAR20 = VARCHAR(20' +
') */,'
' LAST_NAME VARCHAR20 /* VARCHAR20 = VARCHAR(20) */,'
' FULL_NAME COMPUTED BY (first_name ||'
'case'
' when last_name is null then '#39#39
' else '#39' '#39' || last_name'
'end),'
' SEX CHAR1 /* CHAR1 = CHAR(1) */,'
' JOB_POSITION VARCHAR40 /* VARCHAR40 = VARCHAR(40) */,'
' MOBILE_PHONE1 VARCHAR20 /* VARCHAR20 = VARCHAR(20) */,'
' MOBILE_PHONE2 VARCHAR20 /* VARCHAR20 = VARCHAR(20) */,'
' EMAIL1 VARCHAR30 /* VARCHAR30 = VARCHAR(30) */,'
' EMAIL2 VARCHAR30 /* VARCHAR30 = VARCHAR(30) */,'
' HOME_ADDR VARCHAR80 /* VARCHAR80 = VARCHAR(80) */,'
' HOME_CITY VARCHAR30 /* VARCHAR30 = VARCHAR(30) */,'
' HOME_PROVINCE VARCHAR30 /* VARCHAR30 = VARCHAR(30) */,'
' HOME_POST_CODE VARCHAR10 /* VARCHAR10 = VARCHAR(10) */,'
' HOME_COUNTRY VARCHAR20 /* VARCHAR20 = VARCHAR(20) */,'
' HOME_PHONE VARCHAR20 /* VARCHAR20 = VARCHAR(20) */,'
' NPWP VARCHAR20 /* VARCHAR20 = VARCHAR(20) */,'
' BIRTHDATE DATE_1 /* DATE_1 = DATE */,'
' YEARS_OLD COMPUTED BY (((CAST('#39'TODAY'#39' AS DATE)-tcontac' +
't.BIRTHDATE)/360)),'
' INFO VARCHAR80 /* VARCHAR80 = VARCHAR(80) */,'
' ISSUSPEND BOOLEAN_DEFAULT_0 /* BOOLEAN_DEFAULT_0 = SMA' +
'LLINT DEFAULT 0 */,'
' LAST_UPDATE TIMESTAMP_1 DEFAULT current_timestamp NOT NU' +
'LL /* TIMESTAMP_1 = '
'TIMESTAMP */,'
' LAST_USER VARCHAR30 DEFAULT current_user /* VARCHAR30 ' +
'= VARCHAR(30) */,'
' KODE_CABANG INTEGER_1 /* INTEGER_1 = INTEGER */'
');'
''
''
''
''
'/* Check constraints definition */'
''
'ALTER TABLE TCONTACT ADD CONSTRAINT CHK1_TCONTACT_SEX check (sex' +
' in ('#39'F'#39','#39'M'#39'));'
'ALTER TABLE TCONTACT ADD CONSTRAINT CHK1_TCONTACT_EMAIL1 check (' +
'email1 like '#39'%@%.'
'%'#39');'
'ALTER TABLE TCONTACT ADD CONSTRAINT CHK1_TCONTACT_EMAIL2 check (' +
'email2 like '#39'%@%.'
'%'#39');'
''
''
'/***************************************************************' +
'***************/'
'/*** Unique Constraints ' +
' ***/'
'/***************************************************************' +
'***************/'
''
'ALTER TABLE TCONTACT ADD CONSTRAINT UNQ1_TCONTACT UNIQUE (FIRST_' +
'NAME, LAST_NAME, '
'BIRTHDATE);'
''
''
'/***************************************************************' +
'***************/'
'/*** Primary Keys ' +
' ***/'
'/***************************************************************' +
'***************/'
''
'ALTER TABLE TCONTACT ADD CONSTRAINT PK_TCONTACT PRIMARY KEY (CON' +
'TACT_ID);'
''
''
'/***************************************************************' +
'***************/'
'/*** Triggers ' +
' ***/'
'/***************************************************************' +
'***************/'
''
''
'SET TERM ^ ;'
''
''
''
'/***************************************************************' +
'***************/'
'/*** Triggers for tables ' +
' ***/'
'/***************************************************************' +
'***************/'
''
''
''
'/* Trigger: TCONTACT_AIUD0 */'
'CREATE OR ALTER TRIGGER TCONTACT_AIUD0 FOR TCONTACT'
'ACTIVE AFTER INSERT OR UPDATE OR DELETE POSITION 0'
'AS'
'begin'
' /* Trigger text */'
' POST_EVENT '#39'Contact Person'#39';'
'end'
'^'
''
''
'/* Trigger: TCONTACT_BI */'
'CREATE OR ALTER TRIGGER TCONTACT_BI FOR TCONTACT'
'ACTIVE BEFORE INSERT POSITION 0'
'AS'
'BEGIN'
' IF (NEW.CONTACT_ID IS NULL) THEN'
' NEW.CONTACT_ID = GEN_ID(GEN_TCONTACT_ID,1);'
'END'
'^'
''
''
'/* Trigger: TCONTACT_BIU0 */'
'CREATE OR ALTER TRIGGER TCONTACT_BIU0 FOR TCONTACT'
'ACTIVE BEFORE UPDATE POSITION 0'
'AS'
'begin'
' /* Trigger text */'
' new.last_user = current_user;'
' new.last_update = current_timestamp;'
'end'
'^'
''
''
'SET TERM ; ^'
''
''
''
'/***************************************************************' +
'***************/'
'/*** Privileges ' +
' ***/'
'/***************************************************************' +
'***************/')
TabOrder = 4
end
object IB_Connection1: TIB_Connection
CacheStatementHandles = False
PasswordStorage = psNotSecure
SQLDialect = 3
Params.Strings = (
'PATH=D:\project\GL\bin\db\MITRACHEM.FDB'
'CHARACTER SET=UTF8'
'USER NAME=SYSDBA'
'SQL DIALECT=3')
Left = 40
Top = 16
SavedPassword = '.JuMbLe.01.432B0639073E0E4B49'
end
object IB_Query1: TIB_Query
DatabaseName = 'D:\project\GL\bin\db\MITRACHEM.FDB'
IB_Connection = IB_Connection1
IB_Transaction = IB_Transaction1
SQL.Strings = (
'SELECT *'
'FROM TCONTACT'
'FOR UPDATE')
GeneratorLinks.Strings = (
'CONTACT_ID=GEN_TCONTACT_ID')
GetServerDefaults = True
KeyLinks.Strings = (
'CONTACT_ID')
KeyRelation = 'TCONTACT'
RequestLive = True
Left = 120
Top = 16
end
object IB_Transaction1: TIB_Transaction
IB_Connection = IB_Connection1
Isolation = tiCommitted
Left = 40
Top = 80
end
object IB_DataSource1: TIB_DataSource
Dataset = IB_Query1
Left = 192
Top = 16
end
end
-----------------------
how to send you, the working sample app
can i send via email attachment?
here the text dump, copy paste below to the delphi
---------------
object Form1: TForm1
Left = 0
Top = 0
Caption = 'Form1'
ClientHeight = 300
ClientWidth = 920
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object IB_UpdateBar1: TIB_UpdateBar
Left = 152
Top = 256
Width = 120
Height = 25
Ctl3D = False
ParentCtl3D = False
TabOrder = 0
DataSource = IB_DataSource1
ReceiveFocus = False
CustomGlyphsSupplied = []
end
object IB_DatasetBar1: TIB_DatasetBar
Left = 278
Top = 256
Width = 120
Height = 25
Ctl3D = False
ParentCtl3D = False
TabOrder = 1
DataSource = IB_DataSource1
ReceiveFocus = False
CustomGlyphsSupplied = []
end
object IB_TransactionBar1: TIB_TransactionBar
Left = 8
Top = 256
Width = 120
Height = 25
Ctl3D = False
ParentCtl3D = False
TabOrder = 2
CustomGlyphsSupplied = []
IB_Transaction = IB_Transaction1
ReceiveFocus = False
end
object IB_Grid1: TIB_Grid
Left = 8
Top = 8
Width = 390
Height = 242
CustomGlyphsSupplied = []
DataSource = IB_DataSource1
TabOrder = 3
end
object Memo1: TMemo
Left = 404
Top = 8
Width = 501
Height = 242
Lines.Strings = (
'/***************************************************************' +
'***************/'
'/*** Generated by IBExpert 2/6/2012 9:51:23 AM ' +
' ***/'
'/***************************************************************' +
'***************/'
''
'/***************************************************************' +
'***************/'
'/*** Following SET SQL DIALECT is just for the Database Com' +
'parer ***/'
'/***************************************************************' +
'***************/'
'SET SQL DIALECT 3;'
''
''
''
'/***************************************************************' +
'***************/'
'/*** Tables ' +
' ***/'
'/***************************************************************' +
'***************/'
''
''
'CREATE GENERATOR GEN_TCONTACT_ID;'
''
'CREATE TABLE TCONTACT ('
' CONTACT_ID INTEGER_1 NOT NULL /* INTEGER_1 = INTEGER */' +
','
' TITLE_NAME VARCHAR10 /* VARCHAR10 = VARCHAR(10) */,'
' FIRST_NAME VARCHAR20 NOT NULL /* VARCHAR20 = VARCHAR(20' +
') */,'
' LAST_NAME VARCHAR20 /* VARCHAR20 = VARCHAR(20) */,'
' FULL_NAME COMPUTED BY (first_name ||'
'case'
' when last_name is null then '#39#39
' else '#39' '#39' || last_name'
'end),'
' SEX CHAR1 /* CHAR1 = CHAR(1) */,'
' JOB_POSITION VARCHAR40 /* VARCHAR40 = VARCHAR(40) */,'
' MOBILE_PHONE1 VARCHAR20 /* VARCHAR20 = VARCHAR(20) */,'
' MOBILE_PHONE2 VARCHAR20 /* VARCHAR20 = VARCHAR(20) */,'
' EMAIL1 VARCHAR30 /* VARCHAR30 = VARCHAR(30) */,'
' EMAIL2 VARCHAR30 /* VARCHAR30 = VARCHAR(30) */,'
' HOME_ADDR VARCHAR80 /* VARCHAR80 = VARCHAR(80) */,'
' HOME_CITY VARCHAR30 /* VARCHAR30 = VARCHAR(30) */,'
' HOME_PROVINCE VARCHAR30 /* VARCHAR30 = VARCHAR(30) */,'
' HOME_POST_CODE VARCHAR10 /* VARCHAR10 = VARCHAR(10) */,'
' HOME_COUNTRY VARCHAR20 /* VARCHAR20 = VARCHAR(20) */,'
' HOME_PHONE VARCHAR20 /* VARCHAR20 = VARCHAR(20) */,'
' NPWP VARCHAR20 /* VARCHAR20 = VARCHAR(20) */,'
' BIRTHDATE DATE_1 /* DATE_1 = DATE */,'
' YEARS_OLD COMPUTED BY (((CAST('#39'TODAY'#39' AS DATE)-tcontac' +
't.BIRTHDATE)/360)),'
' INFO VARCHAR80 /* VARCHAR80 = VARCHAR(80) */,'
' ISSUSPEND BOOLEAN_DEFAULT_0 /* BOOLEAN_DEFAULT_0 = SMA' +
'LLINT DEFAULT 0 */,'
' LAST_UPDATE TIMESTAMP_1 DEFAULT current_timestamp NOT NU' +
'LL /* TIMESTAMP_1 = '
'TIMESTAMP */,'
' LAST_USER VARCHAR30 DEFAULT current_user /* VARCHAR30 ' +
'= VARCHAR(30) */,'
' KODE_CABANG INTEGER_1 /* INTEGER_1 = INTEGER */'
');'
''
''
''
''
'/* Check constraints definition */'
''
'ALTER TABLE TCONTACT ADD CONSTRAINT CHK1_TCONTACT_SEX check (sex' +
' in ('#39'F'#39','#39'M'#39'));'
'ALTER TABLE TCONTACT ADD CONSTRAINT CHK1_TCONTACT_EMAIL1 check (' +
'email1 like '#39'%@%.'
'%'#39');'
'ALTER TABLE TCONTACT ADD CONSTRAINT CHK1_TCONTACT_EMAIL2 check (' +
'email2 like '#39'%@%.'
'%'#39');'
''
''
'/***************************************************************' +
'***************/'
'/*** Unique Constraints ' +
' ***/'
'/***************************************************************' +
'***************/'
''
'ALTER TABLE TCONTACT ADD CONSTRAINT UNQ1_TCONTACT UNIQUE (FIRST_' +
'NAME, LAST_NAME, '
'BIRTHDATE);'
''
''
'/***************************************************************' +
'***************/'
'/*** Primary Keys ' +
' ***/'
'/***************************************************************' +
'***************/'
''
'ALTER TABLE TCONTACT ADD CONSTRAINT PK_TCONTACT PRIMARY KEY (CON' +
'TACT_ID);'
''
''
'/***************************************************************' +
'***************/'
'/*** Triggers ' +
' ***/'
'/***************************************************************' +
'***************/'
''
''
'SET TERM ^ ;'
''
''
''
'/***************************************************************' +
'***************/'
'/*** Triggers for tables ' +
' ***/'
'/***************************************************************' +
'***************/'
''
''
''
'/* Trigger: TCONTACT_AIUD0 */'
'CREATE OR ALTER TRIGGER TCONTACT_AIUD0 FOR TCONTACT'
'ACTIVE AFTER INSERT OR UPDATE OR DELETE POSITION 0'
'AS'
'begin'
' /* Trigger text */'
' POST_EVENT '#39'Contact Person'#39';'
'end'
'^'
''
''
'/* Trigger: TCONTACT_BI */'
'CREATE OR ALTER TRIGGER TCONTACT_BI FOR TCONTACT'
'ACTIVE BEFORE INSERT POSITION 0'
'AS'
'BEGIN'
' IF (NEW.CONTACT_ID IS NULL) THEN'
' NEW.CONTACT_ID = GEN_ID(GEN_TCONTACT_ID,1);'
'END'
'^'
''
''
'/* Trigger: TCONTACT_BIU0 */'
'CREATE OR ALTER TRIGGER TCONTACT_BIU0 FOR TCONTACT'
'ACTIVE BEFORE UPDATE POSITION 0'
'AS'
'begin'
' /* Trigger text */'
' new.last_user = current_user;'
' new.last_update = current_timestamp;'
'end'
'^'
''
''
'SET TERM ; ^'
''
''
''
'/***************************************************************' +
'***************/'
'/*** Privileges ' +
' ***/'
'/***************************************************************' +
'***************/')
TabOrder = 4
end
object IB_Connection1: TIB_Connection
CacheStatementHandles = False
PasswordStorage = psNotSecure
SQLDialect = 3
Params.Strings = (
'PATH=D:\project\GL\bin\db\MITRACHEM.FDB'
'CHARACTER SET=UTF8'
'USER NAME=SYSDBA'
'SQL DIALECT=3')
Left = 40
Top = 16
SavedPassword = '.JuMbLe.01.432B0639073E0E4B49'
end
object IB_Query1: TIB_Query
DatabaseName = 'D:\project\GL\bin\db\MITRACHEM.FDB'
IB_Connection = IB_Connection1
IB_Transaction = IB_Transaction1
SQL.Strings = (
'SELECT *'
'FROM TCONTACT'
'FOR UPDATE')
GeneratorLinks.Strings = (
'CONTACT_ID=GEN_TCONTACT_ID')
GetServerDefaults = True
KeyLinks.Strings = (
'CONTACT_ID')
KeyRelation = 'TCONTACT'
RequestLive = True
Left = 120
Top = 16
end
object IB_Transaction1: TIB_Transaction
IB_Connection = IB_Connection1
Isolation = tiCommitted
Left = 40
Top = 80
end
object IB_DataSource1: TIB_DataSource
Dataset = IB_Query1
Left = 192
Top = 16
end
end
-----------------------
--- In IBObjects@yahoogroups.com, "IBO Support List" <supportlist@...> wrote:
>
> Will you please send me a working sample app so that I can see your issue
> first-hand?
>
> Jason
>
> -----Original Message-----
> From: IBObjects@yahoogroups.com [mailto:IBObjects@yahoogroups.com] On Behalf
> Of ming
> Sent: 31 January 2012 04:00 PM
> To: IBObjects@yahoogroups.com
> Subject: [IBO] Re: Default values not defaulting for some field
>
> hi all
>
> my problem for default value still error in ibo even i use the newest ibo,
> any sugestion for my problem?
>
> because the trigger can be alternative but i think not eficient for every
> table i must add before insert for 1 field only type data varchar.
>
> Need solution, any body help me please...
>
>
> --- In IBObjects@yahoogroups.com, "ming" <ming2_id@> wrote:
> >
> > hi
> >
> > i have a some field with set default value, like :
> > LAST_UPDATE TIMESTAMP_1 DEFAULT current_timestamp NOT NULL
> > LAST_USER VARCHAR30 DEFAULT current_user NOT NULL
> >
> > i test with ib_expert to add new record, the default value field run
> corectly.
> >
> > but when i develop with ibo 4.9.14 36, + delphi 2010
> > getserverdefault=true
> > the result last_update is corectly
> > but the last_user is always null VALUE
> >
> > Is there another way to get the value of default server ?
> >
> > i try open dialog ib_query in tab fields says:
> > last_update (timestamp) TIMESTAMP /* dv=current_tempstamp */
> > last_user (vartext) varchar(30) /*cs=NONE */ /*dv=current_user */
> >
> > i think the difference cs=NONE. whats its mean cs=None ?
> >
> > thanks
> >
> > ming2
>