Hi,

@Martijn
I didnt know you could use private routines without declaring them at the 
beginning of your package body source (I just followed the “simple package 
example” of page 63 of the alpha2 Release Notes).
But as long as you call them after implementation, it appears to be okay. 
Thanks for the learning.

Regarding to your issue. I think it is a conversion issue from alpha2 to beta1 
(as result of implementing CORE-4487) . I was able to reproduce the same error 
for a alpha2-package of my own. I even made no change at all for the package 
body, just recreated the body as-is under beta 1, and I got the signuture 
mismatch as well (rdb$valid_body_flag is 0). 

Just alter the header and recreate the body under beta1 and you will be 
probably okay. I got no errors and rdb$valid_body_flag is 1 now for this 
package.

Kind regards,
Robert



From: Martijn Tonies (Upscene Productions) 
Sent: Monday, October 27, 2014 5:19 PM
To: For discussion among Firebird Developers 
Subject: Re: [Firebird-devel] Beta 1: recreating package 
failswith"signaturemismatch" error

Hello Robbert-Jan,

Private functions not exposed to the outside is one of the things you can
do with packages.

Mind you, the error message explicitly tells me there’s a mismatch for
routine ADD_ORDER_TO_INVOICE

Also mind you, the package ALREADY EXISTS with the exact same definition,
I just added a space somewhere and tried executing this statement.

With regards,

Martijn Tonies
Upscene Productions




Hi Martijn,
Maybe it is too obvious, but it looks like your body has four routines and your 
header only three (CHECK_INVOICE_EXISTS is missing), hence the signutare 
mismatch.
Kind regards,
Robert

From: Martijn Tonies (Upscene Productions) 
Sent: Monday, October 27, 2014 12:54 PM
To: firebird-devel@lists.sourceforge.net 
Subject: [Firebird-devel] Beta 1: recreating package fails with 
"signaturemismatch" error

Hi,

I noticed this in a recent nightly build last Saturday, it’s still there in 
Beta 1.

I have a package, with a routine, when I tried modifying the body, it returns 
an error:

----8<----
unsuccessful metadata update
RECREATE PACKAGE BODY C_INVOICE failed
Procedure ADD_ORDER_TO_INVOICE has a signature mismatch on package body 
C_INVOICE
while executing:
RECREATE PACKAGE BODY C_INVOICE AS
begin
  function CHECK_INVOICE_EXISTS(InvoiceID T_KEY_INT_REQUIRED) returns boolean as
  begin
    if (not exists(select * from invoices where id = :InvoiceID))
    then exception object_does_not_exist using ('Invoice', InvoiceID);
    else return True;
  end
      
  function INVOICE_ORDER(OrderID T_KEY_INT_REQUIRED) returns T_KEY_INT_REQUIRED 
as
  declare variable CustomerID T_KEY_INT_OPTIONAL;
  declare variable InvoiceID T_KEY_INT_REQUIRED;  
  begin              
    CustomerID = C_ORDER.GET_CUSTOMER_ID(OrderID);
    InvoiceID = CREATE_INVOICE(CustomerID);
    execute procedure ADD_ORDER_TO_INVOICE(InvoiceID, OrderID);
    return InvoiceID;
  end
  function CREATE_INVOICE(CustomerID T_KEY_INT_REQUIRED) returns 
T_KEY_INT_REQUIRED as
  declare variable InvoiceID T_KEY_INT_REQUIRED;
  begin
    insert into invoices (Customer_ID)
    values (:CustomerID)
    returning ID into :InvoiceID;
    return InvoiceID;
  end
  procedure ADD_ORDER_TO_INVOICE(InvoiceID T_KEY_INT_REQUIRED, OrderID 
T_KEY_INT_REQUIRED) as
  begin
    CHECK_INVOICE_EXISTS(InvoiceID);
    insert into invoice_order(Invoice_ID, Order_ID)
    values (:InvoiceID, :OrderID);
  end  
end

----8<----

This is the package header:

---8<---
begin
  function INVOICE_ORDER(OrderID T_KEY_INT_REQUIRED) returns T_KEY_INT_REQUIRED;
  function CREATE_INVOICE(CustomerID T_KEY_INT_REQUIRED) returns 
T_KEY_INT_REQUIRED;
  procedure ADD_ORDER_TO_INVOICE(InvoiceID T_KEY_INT_REQUIRED, OrderID 
T_KEY_INT_REQUIRED);
end
----8<---



I have no idea what’s wrong, do you?

With regards,

Martijn Tonies
Upscene Productions



--------------------------------------------------------------------------------
------------------------------------------------------------------------------



--------------------------------------------------------------------------------
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel



--------------------------------------------------------------------------------
------------------------------------------------------------------------------



--------------------------------------------------------------------------------
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel



--------------------------------------------------------------------------------
------------------------------------------------------------------------------



--------------------------------------------------------------------------------
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel
------------------------------------------------------------------------------
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to