Subject Re: [IBO] IBOTable EditSQL not using primary key in 5.9.5
Author Guilherme Luiz Lanius

Hi Jason,

here is my DML so you can try to test this problem. If you can't reproduce like this I can make a sample app.

Thank you.

CREATE TABLE "SAC_CF"
(
  "SAC_CF_DT_EMIS"     DATE NOT NULL,
  "SAC_CF_CONTROLE"     FLOAT NOT NULL,
  "SAC_CF_NRO_CUPOM"     FLOAT,
  "SAC_CF_VLR_PROD"     NUMERIC(15,2),
  "SAC_CF_PER_DESC"     NUMERIC(17,4),
  "SAC_CF_VLR_DESC"     NUMERIC(15,2),
  "SAC_CF_PER_ACRE"     NUMERIC(17,4),
  "SAC_CF_VLR_ACRE"     NUMERIC(15,2),
  "SAC_CF_TOTAL_CF"     NUMERIC(15,2),
  "SAC_CF_VLR_PAGO"     NUMERIC(15,2),
  "SAC_CF_VLR_TROCO"     NUMERIC(15,2),
  "SAC_CF_VLR_PARCIAL_DEV"     NUMERIC(15,2),
  "SAC_CF_SITUACAO"     CHAR(1),
  "SAC_CF_VLR_PARCELA"     NUMERIC(15,2),
  "SAC_CF_LOJA"     INTEGER NOT NULL,
  "SAC_CF_CLIENTE"     INTEGER,
  "SAC_CF_NM_CLIENTE"     VARCHAR(100),
  "SAC_CF_FORMA_PGTO"     INTEGER,
  "SAC_CF_FORMA_PGTO2"     INTEGER,
  "SAC_CF_COND"     INTEGER,
  "SAC_CF_CAIXA"     INTEGER,
  "SAC_CF_OUTROS_DESC"     FLOAT,
  "SAC_CF_TELEVENDA"     INTEGER,
  "SAC_CF_CIDADE_COD"     INTEGER,
  "SAC_CF_ENDERECO"     VARCHAR(100),
  "SAC_CF_BAIRRO"     VARCHAR(40),
  "SAC_CF_DEPTO"     INTEGER,
  "SAC_CF_PLACA"     VARCHAR(10),
  "SAC_CF_KM"     INTEGER,
  "SAC_CF_CPFCNPJ"     VARCHAR(18),
  "SAC_CF_FATURADO"     INTEGER,
  "SAC_CF_VLR_IMPOSTOS"     FLOAT,
  "SAC_CF_NOTAFISCAL"     INTEGER,
  "SAC_CF_ECF"     INTEGER,
  "SAC_CF_VLR_FRETE"     FLOAT,
  "SAC_CF_HR_EMIS"     TIME,
  "SAC_CF_CEP"     VARCHAR(8),
  "SAC_CF_BC_ICMS"     FLOAT,
  "SAC_CF_VL_ICMS"     FLOAT,
  "SAC_CF_VL_IPI"     FLOAT,
  "SAC_CF_VL_COFINS"     FLOAT,
  "SAC_CF_VL_PIS"     FLOAT,
  "SAC_CF_NFE_CHAVE"     VARCHAR(50),
  "SAC_CF_NFE_PROTOCOLO"     VARCHAR(50),
  "SAC_CF_CNF"     INTEGER,
  "SAC_CF_TRANSP"     INTEGER,
  "SAC_CF_IND_PRES"     INTEGER,
  "SAC_CF_COD_AUTORIZADO"     INTEGER,
  "SAC_CF_VOL_QTD"     VARCHAR(10),
  "SAC_CF_VLR_PROD_SPROMO"     FLOAT,
CONSTRAINT "SAC_CF_PRIMARY" PRIMARY KEY ("SAC_CF_LOJA", "SAC_CF_DT_EMIS", "SAC_CF_CONTROLE")
);

/*  Index definitions for SAC_CF */
CREATE INDEX "IDX_CF_LOJA" ON "SAC_CF"("SAC_CF_LOJA", "SAC_CF_CAIXA", "SAC_CF_CONTROLE");


Em 28/09/2017 23:54, 'Jason Wharton' jason@... [IBObjects] escreveu:
 

This is unexpected behavior.  Please at least provide the DDL for your tables, constraints, indexes, etc.
 
A sample app is alwyas greatly appreciated.
 
Thanks,
Jason Wharton
 


From: IBObjects@yahoogroups.com [mailto:IBObjects@yahoogroups.com]
Sent: Thursday, September 28, 2017 6:52 AM
To: IBObjects@yahoogroups.com
Subject: Re: [IBO] IBOTable EditSQL not using primary key in 5.9.5

 

Hey Jason,

could you take a look into this? Do know if there is a way to fix this or need some test example to help you find the issue?

I need to upgrade to 5.9.5 so I can upgrade to Tokyo, but I can't until I fix this.

Thank you.


Em 21/09/2017 11:36, Guilherme Luiz Lanius speka@... [IBObjects] escreveu:
 

Hello,

I'm upgrading from 5.7.3 to 5.9.5 but I just found a problem with EDISQL
on IBOTable, it's not using the primary key when updating.

Primary Key is SAC_CF_LOJA, SAC_CF_DT_EMIS, SAC_CF_CONTROLE

5.7.3 SQL

UPDATE SAC_CF
  SET SAC_CF.SAC_CF_LOJA = ? /* SAC_CF.SAC_CF_LOJA */
    , SAC_CF.SAC_CF_DT_EMIS = ? /* SAC_CF.SAC_CF_DT_EMIS */
    , SAC_CF.SAC_CF_CONTROLE = ? /* SAC_CF.SAC_CF_CONTROLE */
    , SAC_CF.SAC_CF_NRO_CUPOM = ? /* SAC_CF.SAC_CF_NRO_CUPOM */
    , SAC_CF.SAC_CF_CAIXA = ? /* SAC_CF.SAC_CF_CAIXA */
WHERE SAC_CF.SAC_CF_LOJA = ? /* OLD.SAC_CF_LOJA */
  AND SAC_CF.SAC_CF_DT_EMIS = ? /* OLD.SAC_CF_DT_EMIS */
  AND SAC_CF.SAC_CF_CONTROLE = ? /* OLD.SAC_CF_CONTROLE */
PLAN (SAC_CF INDEX (SAC_CF_PRIMARY))

5.9.5 SQL

/* IBO System EditSQL with UpdateMode umAllWhereKey */
UPDATE SAC_CF
  SET SAC_CF.SAC_CF_LOJA = ?/* NEW.SAC_CF.SAC_CF_LOJA */
    , SAC_CF.SAC_CF_DT_EMIS = ?/* NEW.SAC_CF.SAC_CF_DT_EMIS */
    , SAC_CF.SAC_CF_CONTROLE = ?/* NEW.SAC_CF.SAC_CF_CONTROLE */
    , SAC_CF.SAC_CF_NRO_CUPOM = ?/* NEW.SAC_CF.SAC_CF_NRO_CUPOM */
    , SAC_CF.SAC_CF_CAIXA = ?/* NEW.SAC_CF.SAC_CF_CAIXA */
WHERE SAC_CF.SAC_CF_DT_EMIS = ?/* OLD.SAC_CF.SAC_CF_DT_EMIS */
  AND SAC_CF.SAC_CF_CONTROLE = ?/* OLD.SAC_CF.SAC_CF_CONTROLE */
RETURNING SAC_CF_LOJA
        , SAC_CF_DT_EMIS
        , SAC_CF_CONTROLE
        , SAC_CF_NRO_CUPOM
        , SAC_CF_CAIXA
PLAN (SAC_CF NATURAL)