FirebirdSQL / firebird

Firebird server, client and tools
https://www.firebirdsql.org/
1.23k stars 212 forks source link

Execute statement with various count of parameters [CORE2813] #3200

Open firebird-automations opened 14 years ago

firebird-automations commented 14 years ago

Submitted by: Vladimir Arkhipov (arkinform)

Firebird 2.5 has a very powerful possibility to make execute statements on remote databases. And I have an idea to make online backup database. I can make trigger for needed tables, I can generate dynamic sql statements (insert, update or delete) with parameters for fields, received from system tables (rdb$relation_fields). But I can NOT set values of these parameters in execute statement. I can only static set n parameter values, but there are many different tables and tables structure may be upgraded. P.S. I know that replication may be used for backup databases, but this method very easy and stable to use and doesn't need external applications. BTW, will be usefull to know table name inside the trigger (for example, context variable TABLE_NAME)

Example: declare variable st statement; as begin st = prepare statement ('insert into table (id, name) values (:id, :name)'); st.setparameter(1, 99); st.setparameter(2, 'Test'); execute statement st; end

firebird-automations commented 14 years ago
Modified by: Vladimir Arkhipov (arkinform) description: Firebird 2\.5 has a very powerful possibility to make execute statements on remote databases\. And I have an idea to make online backup database\. I can make trigger for needed tables, I can generate dynamic sql statements \(insert, update or delete\) with parameters for fields, received from system tables \(rdb$relation\_fields\)\. But I can NOT set values of these parameters in execute statement\. I can only static set n parameter values, but there are many different tables and tables structure may be upgraded\. P\.S\. I know that replication may be used for backup databases, but this method very easy and stable to use and doesn't need external applications\. BTW, will be usefull to know table name inside the trigger \(for example, context variable TABLE\_NAME\) =\> Firebird 2\.5 has a very powerful possibility to make execute statements on remote databases\. And I have an idea to make online backup database\. I can make trigger for needed tables, I can generate dynamic sql statements \(insert, update or delete\) with parameters for fields, received from system tables \(rdb$relation\_fields\)\. But I can NOT set values of these parameters in execute statement\. I can only static set n parameter values, but there are many different tables and tables structure may be upgraded\. P\.S\. I know that replication may be used for backup databases, but this method very easy and stable to use and doesn't need external applications\. BTW, will be usefull to know table name inside the trigger \(for example, context variable TABLE\_NAME\) Example: declare variable st statement; as begin st = prepare statement \('insert into table \(id, name\) values \(:id, :name\)'\); st\.setparameter\(1, 99\); st\.setparameter\(2, 'Test'\); execute statement st; end