Mahdi A. Sbeih wrote:

>I am issuing this statement that involves 2 database servers:
>
>$sql_stmt = $db_handle->prepare("
>                                 insert into $table
>                                 select * from $src_db:$table
>                                 ");
>This statement is called many times, does that
>means that each time this sql stmt is called,
>a new connection to the $src_db is made?
>

It depends in part on whether the databases are logged or not, and on 
how many of the statements are executed in a single transaction.  If the 
statements are executed in a single transaction, then (more or less by 
definition) a single connection will be used for all operations.  If 
each statement is in a separate transaction, then there could be a new 
connection per statement (though one would hope not).

>I want both databases to be locked exclusively, this
>is done easily for the source one, using the $db_handle
>to issue " database db_name exclusive"
>
>How can I do the same for the $src_db, there is no db_handle 
>for it?  Any feedback??
>

Now that's an interesting point.  I don't think there is a way to obtain 
the second exclusive database lock.  Although you could obtain an 
exclusive DB lock by creating a new $dbh, that would prevent the 
cross-database data transfers from working, which would be entirely 
counter-productive.

>__________________________
>Mahdi A. Sbeih
>IDS Software Systems
>Software Engineer
>Tel: 650-349-0500, ext 134
>[EMAIL PROTECTED]
>__________________________ 
>


-- 
Jonathan Leffler ([EMAIL PROTECTED], [EMAIL PROTECTED])
Guardian of DBD::Informix 1.00.PC1 -- see http://www.cpan.org/
#include <disclaimer.h>



Reply via email to