<?xml version="1.0" standalone="yes"?>
  <DATAPACKET Version="2.0">
<METADATA>
<FIELDS>
<FIELD attrname="TRI_KEY" fieldtype="string.uni" SUBTYPE="FixedChar" WIDTH="62">
<PARAM Name="ORIGIN" Value="RDB$TRIGGER_NAME" Roundtrip="True"/>
</FIELD>
<FIELD attrname="TAB" fieldtype="string.uni" SUBTYPE="FixedChar" WIDTH="62">
<PARAM Name="ORIGIN" Value="RDB$RELATION_NAME" Roundtrip="True"/>
</FIELD>
<FIELD attrname="TIP" fieldtype="string" SUBTYPE="FixedChar" WIDTH="33">
<PARAM Name="PROVFLAGS" Value="0" Type="i4" Roundtrip="True"/>
<PARAM Name="ORIGIN" Value="TIP" Roundtrip="True"/>
</FIELD>
<FIELD attrname="FONTE_FB" fieldtype="bin.hex" SUBTYPE="Text">
<PARAM Name="PROVFLAGS" Value="1" Type="i4" Roundtrip="True"/>
<PARAM Name="ORIGIN" Value="RDB$TRIGGER_SOURCE" Roundtrip="True"/>
</FIELD>
</FIELDS>
<PARAMS DEFAULT_ORDER="1"/>
</METADATA>
<ROWDATA>
<ROW TRI_KEY="ARQUIVO_BI" TAB="ARQUIVO" TIP="BEFORE INSERT" FONTE_FB="AS&#010;DECLARE VARIABLE tmp DECIMAL(18,0);&#010;BEGIN&#010;  IF (NEW.CODIGOARQUIVO IS NULL) THEN&#010;    NEW.CODIGOARQUIVO = GEN_ID(GENARQUIVOID, 1);&#010;  ELSE&#010;  BEGIN&#010;    tmp = GEN_ID(GENARQUIVOID, 0);&#010;    if (tmp &lt; new.CODIGOARQUIVO) then&#010;      tmp = GEN_ID(GENARQUIVOID, new.CODIGOARQUIVO-tmp);&#010;  END&#010;END"/>
<ROW TRI_KEY="DOCUMENTO_BI" TAB="DOCUMENTO" TIP="BEFORE INSERT" FONTE_FB="AS&#010;DECLARE VARIABLE tmp DECIMAL(18,0);&#010;BEGIN&#010;  IF (NEW.CODIGODOCUMENTO IS NULL) THEN&#010;    NEW.CODIGODOCUMENTO = GEN_ID(GENDOCUMENTOID, 1);&#010;  ELSE&#010;  BEGIN&#010;    tmp = GEN_ID(GENDOCUMENTOID, 0);&#010;    if (tmp &lt; new.CODIGODOCUMENTO) then&#010;      tmp = GEN_ID(GENDOCUMENTOID, new.CODIGODOCUMENTO-tmp);&#010;  END&#010;END"/>
<ROW TRI_KEY="EXPRESSAOCONTA_BI" TAB="EXPRESSAOCONTA" TIP="BEFORE INSERT" FONTE_FB="AS&#010;DECLARE VARIABLE tmp DECIMAL(18,0);&#010;BEGIN&#010;  IF (NEW.CODIGOEXPRECONTA IS NULL) THEN&#010;    NEW.CODIGOEXPRECONTA = GEN_ID(GENEXPRESSAOCONTA, 1);&#010;  ELSE&#010;  BEGIN&#010;    tmp = GEN_ID(GENEXPRESSAOCONTA, 0);&#010;    if (tmp &lt; new.CODIGOEXPRECONTA) then&#010;      tmp = GEN_ID(GENEXPRESSAOCONTA, new.CODIGOEXPRECONTA-tmp);&#010;  END&#010;END"/>
<ROW TRI_KEY="FAILUREG" TAB="LOGGERAL" TIP="BEFORE DELETE" FONTE_FB="AS &#013;&#010;BEGIN &#013;&#010;    exception Error;&#013;&#010;END"/>
<ROW TRI_KEY="LOGGERALBI" TAB="LOGGERAL" TIP="BEFORE INSERT" FONTE_FB="AS&#013;&#010;DECLARE VARIABLE i INTEGER;&#013;&#010;begin&#013;&#010;  if (new.IDLOG is null) then&#013;&#010;    new.IDLOG = GEN_ID(GENLOG, 1);&#013;&#010;  else&#013;&#010;    if (new.IDLOG &gt; GEN_ID(GENLOG, 0)) then&#013;&#010;      i = GEN_ID( GENLOG, new.IDLOG - GEN_ID( GENLOG, 0 ) );&#013;&#010;  if (new.DATAHORAINICIO is null) then&#013;&#010;    new.DATAHORAINICIO = current_timestamp;&#013;&#010;end"/>
</ROWDATA>
</DATAPACKET>
