本文介绍了Firebird BLR是否包含相关的字段大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Firebird和InterBase以BLR(令牌化)格式保留存储过程和触发器的编译形式.

Firebird and InterBase keep a compiled form of stored procedures and triggers in BLR (tokenized) format.

但是我真的不知道BLR的结构.

But I do not really know the structure of BLR.

字段大小是BLR的一部分吗?

Is field size the part of the BLR?

当存储过程包含两个字段(源和目标)时,会出现一些问题,稍后再更改这两个字段的大小吗?

Would I get some problems when a stored procedure contains two fields (source and destination), and later I'll change the size of these two fields?

例如,它们的长度为varchar(50),但是现在我通过系统表更新将其更改为varchar(100).会发生什么?它只会复制50个字符还是全部复制(100)?

For example they were varchar(50) long, but now I change them to varchar(100) with system table updates. What will happen? Would it only copy 50 characters, or all (100)?

还是BLR仅包含对象链接(表和字段)?

Or does BLR contains only object links (tables and fields)?

我将尝试使用伪"代码进行演示:

I will try to demonstrate with "pseudo" code:

begin
  for select comp_id, comp_name from companies where ...
    into :ci, :cn 
    do begin
      -- somehow we're adding this to another table
      insert into new_clients (id, name) values (:ci, :cn);
    end
end;

这可能是触发器或存储过程.

This could be a trigger or stored procedure.

  1. Comp_namenew_clients.name最初是varchar(50).
  2. 我添加了此过程或触发器.一天都可以正常工作.
  3. 后来我意识到这些字段太短,无法容纳我的数据.
  4. 我使用GUI(例如IBExpert)将这些字段更改为varchar(150).
  5. 没关系,现在都已经是varchar(150).
  1. Comp_name, and new_clients.name are initially varchar(50).
  2. I add this procedure or trigger. It is working fine for a day.
  3. Later I realize these fields are too short to fit my data.
  4. I use a GUI (for example IBExpert) to change these fields to varchar(150).
  5. It's ok, all of them are varchar(150) now.

那会发生什么?

  1. 如果BLR也包含字段大小,那么我更改字段大小也没关系.触发器副本包含50个字符,因为它已预先编译好了长度.
  2. 如果BLR仅使用与表和字段相关/链接/标记,我们可以更改字段而不必担心复制功能.

问题是一样的:BLR是否包含相关字段的大小?

The question is same: does BLR contains the related fields' sizes or not?

推荐答案

首先,您可以在ISQL中看到过程的BLR:

First, you can see BLR of a procedure in ISQL:


SQL> create or alter procedure p1 (i1 varchar(10), i2 varchar(20)) returns (o1 varchar(30)) as begin end!
SQL> set blob all!
SQL> commit!
SQL> select rdb$procedure_blr from rdb$procedures where rdb$procedure_name = 'P1'!

blr_version5,
blr_begin,
   blr_message, 0, 4,0,
      blr_varying2, 0,0, 10,0,
      blr_short, 0,
      blr_varying2, 0,0, 20,0,
      blr_short, 0,
   blr_message, 1, 3,0,
      blr_varying2, 0,0, 30,0,
      blr_short, 0,
      blr_short, 0,
   blr_receive, 0,
    ...
blr_eoc

第二,永远不要更改系统表.

Second, don't, ever, change system tables.

第三,是的,您会遇到问题!这就是为什么没有ALTER PROCEDURE PARAMETER命令的原因.

Third, yes, you'll have a problem! It's why there is no ALTER PROCEDURE PARAMETER command.

这篇关于Firebird BLR是否包含相关的字段大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-18 09:32