Changes between Version 6 and Version 9 of Ticket #1207


Ignore:
Timestamp:
Jan 15, 2024, 6:12:15 PM (10 months ago)
Author:
Denis_N
Comment:

Во-первых, насколько я вижу, значение столбца bond в mismatchQuery проверяется на NULL и на пустую строку (''). Но bond имеет числовой тип (int)! Как его значение может быть строкой??? В чем смысл такого сравнения?

alx, исправил в описании

Посмотрел changeset:312/base. Насколько я понял, в столбце bond предлагается хранить ссылку на запись истории (по ключу N). Не следует ли, в таком случае, добавить также foreign key во избежание возможных неконсистентностей?

У себя на сервере в базе изменил. Создал тикет для san: https://trac.adc-line.ru/mc-04/ticket/1252#comment:1

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #1207 – Description

    v6 v9  
    1414(select products.serial, history.uid, history.date, hist1.total from history inner join
    1515(select uid, count(uid) as total from history where ((`history`.type_write = 'mismatch' and (`history`.`status` is null or `history`.`status` = 'fail'))
    16     or (`history`.type_write = 'mismatch' and `history`.`status` = 'ok' and (`history`.bond is null or `history`.bond = ''))) and comment is not null and  comment != '' group by uid) as hist1 on history.uid = hist1.uid
     16    or (`history`.type_write = 'mismatch' and `history`.`status` = 'ok' and `history`.bond is null)) and comment is not null and  comment != '' group by uid) as hist1 on history.uid = hist1.uid
    1717inner join products on products.uid = history.uid where (products.name like searchName
    1818and products.serial like searchSerial and history.comment like searchComment) and (history.uid, history.date) in
    1919(select uid, max(date) from history where ((`history`.type_write = 'mismatch' and (`history`.`status` is null or `history`.`status` = 'fail'))
    20     or (`history`.type_write = 'mismatch' and `history`.`status` = 'ok' and (`history`.bond is null or `history`.bond = ''))) and history.comment like searchComment and comment is not null and comment != '' group by uid )
     20    or (`history`.type_write = 'mismatch' and `history`.`status` = 'ok' and `history`.bond is null)) and history.comment like searchComment and comment is not null and comment != '' group by uid )
    2121group by products.serial, history.uid, history.date, hist1.total order by history.date desc) as hist2
    2222where (@mintotal := @minTotal + total)) as hust2 where hust2.mintotal > min and hust2.prevtotal < max;