Subject IBO 4.2Ib violation of Fk...
Author Eduardo Jedliczka
Delphi 6 SP2, IBO 4.2Ib, FB 1.0.821... ( have a portion of a DataModule... )

This is a little problem with no soluction...
We use IBO in our systems and we like a lot! But we are nervous with a
trouble ( FK violation in Inserts )

Maybe this problem is from any config, because of this we put a portion of
components in this mail, if any user, know this trouble, maybe can help us.

We have a query with inner join and sub-select and not much parameters...
and this works fine.

Testing our program, try insert anything and works fine.. Close the insert
window, try another thing, and try a second time this insert and....
Violation of FK...
We are curious, we list all fields in memory and it´s all fine, all correct!
And if we delete the FK, this function write trash in Database....

Example from other table with the same trouble!

Código: 0
nome: "FROM CA_LPT || WHERE COD ...."
valor: 20934532761459.2342

Maybe, the component are lose the true data and write a portion of other
select... Worse, try to read this record do a Convert Error ... it´s not a
valid integer!

Volunters! Please help-me...

PS: We try to create a view with this select but this soluctions create
others bigger troubles, and try to rewrite Select using only inner join´s,
and the problem persist!.

[]s to All!

=======================
Eduardo Jedliczka
Gerasoft - Informática
Apucarana - PR - Brasil
=======================

- - - - - - - - - - - - - -
object Connection: TIB_Connection
DefaultTransaction = Transaction
PasswordStorage = psNotSecure
SQLDialect = 3
Params.Strings = (
'PATH=C:\Arquivos de programas\GeraSoft\DADOS\GeraSoft.Fb'
'CHARACTER SET=WIN1252'
'USER NAME=SYSDBA'
'SQL DIALECT=3'
'SERVER=192.168.0.199')
Left = 24
Top = 24
SavedPassword = '.JuMbLe.01.432B0639073E0E4B49'
end
object Transaction: TIB_Transaction
IB_Connection = Connection
ServerAutoCommit = True
Isolation = tiCommitted
Left = 88
Top = 24
end
object SessionProps: TIB_SessionProps
AllowDefaultConnection = True
AllowDefaultTransaction = True
BusyCursor = -17
StoreActive = False
TimerInterval = 5000
UseCursor = False
YieldCursor = -19
EditingColor = clInfoBk
InsertingColor = clInfoBk
DeletingColor = clRed
SearchingColor = clAqua
ReadOnlyColor = clWindow
SelectedColor = clBlue
InvalidColor = clNone
PreparedColor = clWindow
BrowsingColor = clWindow
Left = 127
Top = 274
end
object QyCa_Lct: TIB_Query
DatabaseName = 'C:\Arquivos de programas\GeraSoft\DADOS\GeraSoft.Fb'
FieldsGridLabel.Strings = (
'CODEMPRESA=CodEmpresa'
'CODFILIAL=CodFilial'
'DATA=Data'
'NUMLANC=Num.Lanc'
'CODHISTORICO=Cod.Historico'
'VALOR=Valor'
'COMPLEMENTO=Complemento'
'CODUSUARIO=Usu'#225'rio'
'NOMEUSUARIO=NomeUsu'#225'rio'
'NOMEFILIAL=Filial'
'NOMEHISTORICO=Hist'#243'rico'
'DEBITO=D'#233'bito'
'NOMECONTADEBITO=D'#233'bito'
'CREDITO=Cr'#233'dito'
'NOMECONTACREDITO=Cr'#233'dito')
FieldsDisplayWidth.Strings = (
'COMPLEMENTO=135')
IB_Connection = Connection
SQL.Strings = (
'SELECT L.CODEMPRESA, '

'L.CODFILIAL, (Select F.Fantasia from GE_FIL F where F.CodEmpresa' +
'=L.CodEmpresa and F.CodFilial=l.CodFilial) as NomeFilial,'
'L.DATA, L.NUMLANC, '
'L.CODHISTORICO, H.NOME AS NomeHistorico,'

'H.Debito,(select C.Nome from Ca_Cta C where (C.CodConta=H.Debito' +
' and C.CodEmpresa=H.CodEmpresa)) as NomeContaDebito,'

'H.Credito,(select C.Nome from Ca_Cta C where (C.CodConta=H.Credi' +
'to and C.CodEmpresa=H.CodEmpresa)) as NomeContaCredito,'
'L.VALOR, L.COMPLEMENTO, '

'L.CODUSUARIO, (Select U.Nome from GE_USU U where U.CodUsuario=L.' +
'CodUsuario) as NomeUsuario'
'FROM CA_LCT L'

'inner Join Ca_His H on ((H.CodHistorico=L.CodHistorico) and (H.C' +
'odEmpresa=L.CodEmpresa))'
'WHERE L.CODEMPRESA=:CODEMPRESA and L.NumLanc=:NumLanc')
OnError = QyCa_CtaError
CallbackInc = 20
ColorScheme = True
DeleteSQL.Strings = (
'DELETE FROM CA_LCT'
'WHERE'
' CODEMPRESA = :OLD_CODEMPRESA AND'
' NUMLANC = :OLD_NUMLANC')
EditSQL.Strings = (
'UPDATE CA_LCT SET'
' CODEMPRESA = :CODEMPRESA, /*PK*/'
' NUMLANC = :NUMLANC, /*PK*/'
' CODFILIAL = :CODFILIAL,'
' DATA = :DATA,'
' CODHISTORICO = :CODHISTORICO,'
' VALOR = :VALOR,'
' COMPLEMENTO = :COMPLEMENTO,'
' CODUSUARIO = :CODUSUARIO'
'WHERE'
' CODEMPRESA = :OLD_CODEMPRESA AND'
' NUMLANC = :OLD_NUMLANC')
InsertSQL.Strings = (
'INSERT INTO CA_LCT('
' CODEMPRESA, /*PK*/'
' NUMLANC, /*PK*/'
' CODFILIAL,'
' DATA,'
' CODHISTORICO,'
' VALOR,'
' COMPLEMENTO,'
' CODUSUARIO)'
'VALUES ('
' :CODEMPRESA,'
' :NUMLANC,'
' :CODFILIAL,'
' :DATA,'
' :CODHISTORICO,'
' :VALOR,'
' :COMPLEMENTO,'
' :CODUSUARIO)')
KeyLinks.Strings = (
'CA_LCT.NUMLANC'
'CA_LCT.CODEMPRESA')
KeyLinksAutoDefine = False
MasterSearchFlags = [msfOpenMasterOnOpen, msfSearchAppliesToMasterOnly]
OrderingItemNo = 4
OrderingItems.Strings = (
'DATA=DATA;DATA DESC'
'NUMLANC=NUMLANC;NUMLANC DESC'
'CODFILIAL=L.CODFILIAL,NUMLANC;L.CODFILIAL DESC,NUMLANC DESC'
'VALOR=L.VALOR;L.VALOR DESC'
'COMPLEMENTO=L.COMPLEMENTO;L.COMPLEMENTO DESC'
'CODHISTORICO=L.CODHISTORICO;L.CODHISTORICO DESC'
'NOMEHISTORICO=H.NOME;H.NOME DESC'
'DEBITO=H.DEBITO;H.DEBITO DESC'
'CREDITO=H.CREDITO;H.CREDITO DESC'
'CODUSUARIO=L.CODUSUARIO;L.CODUSUARIO DESC')
OrderingLinks.Strings = (
'DATA=1'
'NUMLANC=2'
'CODFILIAL=3'
'VALOR=4'
'COMPLEMENTO=5'
'CODHISTORICO=6'
'NOMEHISTORICO=7'
'DEBITO=8'
'CREDITO=9'
'CODUSUARIO=10')
RefreshAction = raKeepDataPos
RefreshOnParamChange = False
BeforePost = QyCa_LctBeforePost
BufferSynchroFlags = []
FetchWholeRows = True
Left = 224
Top = 152
end
object DsCa_Lct: TIB_DataSource
AutoEdit = False
AutoInsert = False
Dataset = QyCa_Lct
Left = 280
Top = 152
end