powered by simpleCommunicator - 2.0.59     © 2026 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / Firebird, InterBase [игнор отключен] [закрыт для гостей] / Параметризованный ES + arith / string overflow: в трейсе нет "ERROR AT jrd8_execute".Why ?
4 сообщений из 4, страница 1 из 1
Параметризованный ES + arith / string overflow: в трейсе нет "ERROR AT jrd8_execute".Why ?
    #38827042
Таблоид
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
hi all

DDL: табличка с двумя полями (int, varchar(20)), ограничениями PK & check и одной записью.
Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
recreate table customer( id int primary key using index cust_pk_idx, name varchar(20) );
commit;

set term ^;
execute block as begin
  execute statement 'create sequence gen_cust'; when any do begin end
end
^ set term ;^
commit;
alter sequence gen_cust restart with 0;
commit;

set term ^;
create or alter trigger customer_bi for customer
active before insert position 0
as
begin
  new.id = coalesce(new.id, gen_id(gen_cust,1));
end
^ set term ;^
commit;

alter table customer add constraint cust_id_gz check( id > 0 ); 
commit;

insert into customer values( 1, 'Ozzy Osbourne' ); 
commit;

Session #1
SQL> update customer set id=id; -- лочим эту единственную запись.

Запускаю теперь трейс с конфигом "всё включено":

Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
  enabled true
   log_errors true 
  exclude_filter = "%execute block%"
  time_threshold = 0
  log_connections true
  log_transactions true
  log_statement_prepare true
  log_statement_free true
   log_statement_start true
  log_statement_finish true 
  log_trigger_start true
  log_trigger_finish true
  print_perf true
  print_blr true
  max_sql_length 3000
  max_blr_length 1000
  max_dyn_length 1000
  max_log_size 0

- после чего стартую:

Session #2
Код: plaintext
C:\...> isql localhost/3253:t0 -i stterr.sql -n

где файл "stterr.sql" есть execute block с пятью отчаянными попытками "что-нибудь да нарушить":
stterr.sql
Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
rollback;
set transaction no wait;
set term ^;
execute block as
  declare stt varchar(255); -- = 'select 1/0 from rdb$database';
  declare dummy bigint;
begin

  begin -- test #1: PK violation
    stt='insert into customer(id, name) values(:a, :b)';
    execute statement (stt) ( a := 1, b := 'john smith' ) ;
    when any do begin end
  end

  begin -- test #2: check violation
    stt='insert into customer(id, name) values(:a, :b)';
    execute statement (stt) ( a := 0, b := 'john smith' ) ;
    when any do begin end
  end

  begin -- test #3: lock conflict
    stt='update customer set name=lower(name) where id = :a';
    execute statement (stt) ( a := 1 ) ;
    when any do begin end
  end

  begin -- test #4: arith. overflow, ES with PARAMETER for violating arg.
    dummy = 91234567890; -- can not be fited into integer field
    stt='insert into customer(id, name) values(:a, :b)';
    execute statement (stt) ( a := dummy, b := 'john smith' ) ;
    when any do begin end
  end

  begin -- test #5: arith. overflow, ES w/o parameter for violating arg.
    dummy = 91234567890; -- can not be fited into integer field
    stt='insert into customer(id, name) values(' || dummy ||', :b)';
    execute statement (stt) ( b := 'john smith' ) ;
    when any do begin end
  end

end
^set term ;^
rollback;
Из того, что наплодилось в трейсе, мну сильнее всего заинтриговал фрагмент для test #4 :
Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
2014-12-06T17:52:35.1250 (528:0213B674) START_TRANSACTION
        t0 (ATT_151, SYSDBA:NONE, NONE, TCPv4:127.0.0.1)
        C:\1INSTALL\FIREBIRD\FB25SNAP\bin\isql.exe:1288
                (TRA_318, CONCURRENCY | NOWAIT | READ_WRITE)

2014-12-06T17:52:35.1250 (528:0213B674)  PREPARE_STATEMENT 
        t0 (ATT_151, SYSDBA:NONE, NONE, TCPv4:127.0.0.1)
        C:\1INSTALL\FIREBIRD\FB25SNAP\bin\isql.exe:1288
                (TRA_318, CONCURRENCY | NOWAIT | READ_WRITE)

Statement 5302:
----------------------------------------------------------------
insert into customer(id, name) values(?, ?)
      6 ms

2014-12-06T17:52:35.1250 (528:0213B674)  FREE_STATEMENT 
        t0 (ATT_151, SYSDBA:NONE, NONE, TCPv4:127.0.0.1)
        C:\1INSTALL\FIREBIRD\FB25SNAP\bin\isql.exe:1288

Statement 5302:
----------------------------------------------------------------
insert into customer(id, name) values(?, ?)

2014-12-06T17:52:35.1250 (528:0213B674) ROLLBACK_TRANSACTION
        t0 (ATT_151, SYSDBA:NONE, NONE, TCPv4:127.0.0.1)
        C:\1INSTALL\FIREBIRD\FB25SNAP\bin\isql.exe:1288
                (TRA_318, CONCURRENCY | NOWAIT | READ_WRITE)
      0 ms, 1 read(s), 1 write(s), 1 fetch(es), 1 mark(s)
Это - трейс для варианта, где в ES в виде параметра подсовывается значение, которое не может быть затолкано в соотв-щее поле.

И неважно, какое будет тут переполнение: арифметическое или строковое.
Главное то, чего при этом НЕ будет. А не будет вот этого:

Код: plaintext
1.
2.
1) EXECUTE_STATEMENT_START
2) FAILED EXECUTE_STATEMENT_FINISH
3) ERROR AT jrd8_execute

Это почему такое происходит ?
...
Рейтинг: 0 / 0
Параметризованный ES + arith / string overflow: в трейсе нет "ERROR AT jrd8_execute".Why ?
    #38827054
Dimitry Sibiryakov
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
ТаблоидЭто почему такое происходит ?
Потому что ошибка возникает ещё до выполнения запроса.
Posted via ActualForum NNTP Server 1.5
...
Рейтинг: 0 / 0
Параметризованный ES + arith / string overflow: в трейсе нет "ERROR AT jrd8_execute".Why ?
    #38827058
Таблоид
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
А есть в природе что-то типа ERROR AT jrd8_ prepare (вместо "..._execute") ? Я к тому, чтобы такие ошибки, которые на этапе подготовки запроса выскакивают, также могли быть отловлены клиентом...
...
Рейтинг: 0 / 0
Параметризованный ES + arith / string overflow: в трейсе нет "ERROR AT jrd8_execute".Why ?
    #38827062
Dimitry Sibiryakov
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
ТаблоидЯ к тому, чтобы такие ошибки, которые на этапе /подготовки /запроса
выскакивают, также могли быть отловлены клиентом...
Сдаётся мне, что эта ошибка в данном случае выкидывается между prepare и execute, так что
не относится ни к одному из них.
Posted via ActualForum NNTP Server 1.5
...
Рейтинг: 0 / 0
4 сообщений из 4, страница 1 из 1
Форумы / Firebird, InterBase [игнор отключен] [закрыт для гостей] / Параметризованный ES + arith / string overflow: в трейсе нет "ERROR AT jrd8_execute".Why ?
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]