StrataFrame Forum

Wait for each database to finish deployment before moving to next database

http://forum.strataframe.net/Topic31253.aspx

By Marcel Heitlager - 7/5/2012

Hi,

I modified the sample data installer to try to update multiple databases.  I loop through DbeApplicationData and dbeConnectionsData to retrieve the database names and update the databases.

How can I pause the loop until a database finishes updating before moving on to the next?

<snippet>
     Do
       '-- do some stuff here.
       '-- then get to actual migration.

                            '-- Create the DatabaseMigrator instance
                            If _SQLUserName.Length = 0 Then
                                _DatabaseSetup = New DatabaseMigrator(connections.cs_server, True, Me, connections.cs_username, connections.cs_password)
                            Else
                                _DatabaseSetup = New DatabaseMigrator(_SQLServer, False, Me, connections.cs_username, connections.cs_password)
                            End If
 
                            '-- Begin the deployment of the meta-data (does not include the data in this phase)
                            _DatabaseSetup.DeployMetaData(_PackagePath & "\AES_AWAPPM.pkg", "", laDTNames)

'---I NEED TO PAUSE IT HERE TO WAIT FOR UPDATE TO FINISH BEFORE MOVING ON.

       Loop While connections.MoveNext()
</snippet>

I looked at the _DatabaseSetup_BuildComplete event.  But how can I tie that in to make it wait?


Thanks,

Marcel
By Ivan George Borges - 7/6/2012

Hi Marcel.

Maybe you could create a Private List/Array in you class to store your ServerNames and a Private Integer to serve as an index later to hold the current index.
In your loop, you only build your List.
You can put your DatabaseMigrator call into a Sub using the current Index, which was started with 0.
After you go through your loop building your DB list, you can make the first call to the sub where you put your call to the DeployMetaData.
Create the BuildComplete event Handler and in it increase your index on 1 and recall the same sub, which will now get your second DB name and so on, until you go through them all.