José Eduardo
José Eduardo

Reputation: 333

Firebird BLR decoder

When I believed I was a genius and that metadata was my intellectual property, I developed a procedure in Firebird to track changes on a single table, something with ids and time stamps. So, I've done a mega clever move and deleted the source of this procedure.

Does anyone knows a BLR decoder, or the docs that I need to build one?

Upvotes: 1

Views: 2017

Answers (3)

Craig Stuntz
Craig Stuntz

Reputation: 126547

I've seen a BLR display tool (in Jason Wharton's IB admin tool), but it would only display BLR names, not transliterate back to SQL/proc language. I think what you're looking for doesn't exist.

You can get BLR documentation here, though.

Upvotes: 3

There is nice BLR (binary) to BLR (text) decoder in Firebird itself. You can enable it with set blob all (or set blobdisplay all). You can call it from ISQL:

SQL> set term !;
SQL> create procedure p1
CON> as
CON>   declare n integer = 1;
CON> begin
CON>   n = n * 2;
CON> end!
SQL> set term ;!
SQL> 
SQL> set blob all;
SQL> commit;
SQL> 
SQL> select rdb$procedure_blr from rdb$procedures where rdb$procedure_name = 'P1';

RDB$PROCEDURE_BLR 
================= 
             1a:3 
==============================================================================
RDB$PROCEDURE_BLR:  
            blr_version5,
            blr_begin,
               blr_message, 1, 1,0,
                  blr_short, 0,
               blr_begin,
                  blr_declare, 0,0, blr_long, 0,
                  blr_assignment,
                     blr_literal, blr_long, 0, 1,0,0,0,
                     blr_variable, 0,0,
                  blr_stall,
                  blr_label, 0,
                     blr_begin,
                        blr_begin,
                           blr_assignment,
                              blr_multiply,
                                 blr_variable, 0,0,
                                 blr_literal, blr_long, 0, 2,0,0,0,
                              blr_variable, 0,0,
                           blr_end,
                        blr_end,
                  blr_end,
               blr_send, 1,
                  blr_begin,
                     blr_assignment,
                        blr_literal, blr_short, 0, 0,0,
                        blr_parameter, 1, 0,0,
                     blr_end,
               blr_end,
            blr_eoc

==============================================================================

Upvotes: 4

Douglas Tosi
Douglas Tosi

Reputation: 2350

If you still have the database there is a chance the procedure source is still there somewhere but marked as deleted. You may try to open the database file on a hex editor and search for the procedure name.

Upvotes: 2

Related Questions