At 05:21 AM 18/08/2007, you wrote:
>Hi all,
>
>I'm trying to do the following:
>
>a- Start a transaction
>b- Alter a table adding a new field
>c- Set a new value to the new field for all the registers in the table
>d- Commit
>
>c) fails because it "can't see" the newly added field. I have to commit
>between b) and c).
>
>Is this correct?

No.

>Is there a way to avoid it?

Yes, absolutely.  Understand the difference between Data Definition 
Language (DDL) statements and Data Manipulation Language (DML) 
statements in SQL.  Don't try to execute DDL and DML statements 
inside the same transaction.

DDL statements change metadata, i.e., they define/redefine the 
database objects.  They usually begin with the keywords CREATE, 
ALTER, RECREATE, CREATE OR ALTER, REPLACE or DROP.  A DDL statement 
must be committed in order for all of the required changes to system 
tables to take effect.

DML statements change user data.  Only if the commit of the DDL 
request succeeds will the database be ready to accept DML statements 
that will work with the changed structures.  Indeed, there are some 
DDL statements that will *fail* if the database object, or a 
dependent object, is in use....

Helen


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Firebird-net-provider mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider

Reply via email to