@arr = $sth >fetchrow_array;
The biggest difference is that in case of DBI, the statement first has to be 
prepared before it is executed. Two statements are needed for this functionality.
The MySQL code 
fetchrow
 and the respective DB2 code 
fetchrow_array
functions return the next row of data from the statement handle generated by the 
query
 or 
execute
 commands.
INSERT, UPDATE, and DELETE statements
Generally, the same functions can be used for the 
INSERT
, 
UPDATE
 and 
DELETE
statements as for the 
SELECT
 statement discussed above. For the non SELECT 
statement, DBI provides a faster substitute for 
DBI::prepare/DBI::execute
 pair 
with the 
DBI::do
 function:
$rows_affected = $dbh >do($sql_statement);
For further information, please refer to the DBI documentation previously.
Disconnecting database
The Mysql.pm interface does not provide a disconnect function, because MySQL 
does not support transactions yet. Whenever the database handle loses its 
value, Mysql.pm closes the database connection. However, databases that do 
support transactions need to be explicitly disconnected. The DBI interface 
supports the disconnect function for the database handle.
Example 7 21   Disconnecting DB2 database using DBI
use DBI;
use DBD::DB2::Constants;
use DBD::DB2;
my $user="itsosj";
my $password="itsosj";
$dbh = DBI >connect("dbi:DB2:itsodb2", $username, $password);
...
$dbh >disconnect;
7.2.2  Converting MySQL PHP applications to DB2 UDB
With PHP applications, different approaches can be used to access DB2:
iODBC with ODBC compliant drivers
iODBC is provided by OpenLink Software. iODBC is the acronym for 
Independent Open DataBase Connectivity, an Open Source platform 
 Chapter 7. Application porting 
177






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

san diego web hosting

 

Our partners: PHP: Hypertext Preprocessor Cheap Web Hosting JSP Web Hosting Ontario Web Hosting  Jsp Web Hosting

Cheapest Web Hosting Java Hosting Cheapest Hosting

Visionwebhosting.net Business web hosting division of Vision Web Hosting Inc.. All rights reserved