Re: [firebird-support] How to query all variable names from a database?
On 2019-06-06 21:37, Gabor Boros mlngl...@bgss.hu [firebird-support] wrote: > Hi All, > > I need to know all stored procedure variable names from a (2.5) > database. I not see these in system tables like parameters or fields. > But I see these with a text editor. For example... > > Create a new database and a procedure in it: > > CREATE PROCEDURE MY_PROC AS DECLARE VARIABLE MY_VAR INTEGER; BEGIN END > > Set RDB$PROCEDURES.RDB$PROCEDURE_SOURCE to NULL. > > Backup the database with gbak. I see MY_VAR text in the resulting > backup > file (and in the restored database) with a text editor. > > So, where is the variable names stored and how to query these? Firebird has no need for the variable name as queryable information, so it isn't stored in the metadata tables contrary to parameters or columns. The variable name is available in the source column (RDB$PROCEDURE_SOURCE), but as far as I can tell from small experiments it isn't even in the compiled BLR, eg use CAST(RDB$PROCEDURE_BLR AS BLOB SUB_TYPE TEXT) to show the BLR in 'readable' form. This is actually pretty logical, because the name is only relevant for the human reading and writing the code. For the runtime it is just a 'slot' with a numerical id where a value is stored. So there is no other mechanism to get variable names than to parse the RDB$PROCEDURE_SOURCE yourself. Mark
[firebird-support] How to query all variable names from a database?
Hi All, I need to know all stored procedure variable names from a (2.5) database. I not see these in system tables like parameters or fields. But I see these with a text editor. For example... Create a new database and a procedure in it: CREATE PROCEDURE MY_PROC AS DECLARE VARIABLE MY_VAR INTEGER; BEGIN END Set RDB$PROCEDURES.RDB$PROCEDURE_SOURCE to NULL. Backup the database with gbak. I see MY_VAR text in the resulting backup file (and in the restored database) with a text editor. So, where is the variable names stored and how to query these? Gabor ++ Visit http://www.firebirdsql.org and click the Documentation item on the main (top) menu. Try FAQ and other links from the left-side menu there. Also search the knowledgebases at http://www.ibphoenix.com/resources/documents/ ++ Yahoo Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/firebird-support/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/firebird-support/join (Yahoo! ID required) <*> To change settings via email: firebird-support-dig...@yahoogroups.com firebird-support-fullfeatu...@yahoogroups.com <*> To unsubscribe from this group, send an email to: firebird-support-unsubscr...@yahoogroups.com <*> Your use of Yahoo Groups is subject to: https://info.yahoo.com/legal/us/yahoo/utos/terms/