Subject Re: [firebird-support] Metadata update
Author David Johnson
DDL is committed immediately.

In your script, use an ascending sideways loop to wrap all of your DDL.
In case of an error, use a descending sideways loop to wrap the converse
DDL.

boolean updateMetadata ()
{
boolean result = false;
int i;

try
{
for ( i=0;i<DDL_STMT_COUNT;i++)
{
switch (i)
{
case 0: {
setUpTable ();
break;
}
case 1: {
constructStoredProcedure ();
break;
}
case etc ...
}
}
result = true;
}
catch (SQLException ex)
{
logException (ex);
for (i=i-1; i >= 0; i--)
{
switch (i)
{
case 0: {
dropTable ();
break;
}
case 1: {
dropStoredProcedure ();
break;
}
case etc ...
}
}
}
return result;

On Wed, 2005-09-07 at 10:31 +0000, Carlos Macao wrote:
> I was trying to build an automated application install which among
> other tasks tries to update DB metadata with a bunch of scripts. I
> was looking for a solution which could protect all this operations
> under a transaction umbrella with a unique and final commit or
> rollback conditioned by the install success.
>
> The problem has to do with compiled statements which depend on new
> fresh metadata entries (like inserting a new SP which depends on a
> new Table, all in the same script using only a final commit).
>
> Is there any way to achieve that with this Firebird limitation?
>
> Best regards,
> Carlos Macao
>
>
>
>
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Visit http://firebird.sourceforge.net and click the Resources item
> on the main (top) menu. Try Knowledgebase and FAQ links !
>
> Also search the knowledgebases at http://www.ibphoenix.com
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Yahoo! Groups Links
>
>
>
>
>
>
>