mirror of
https://github.com/php/pecl-database-ibm_db2.git
synced 2026-03-23 23:02:16 +01:00
45 lines
1.0 KiB
PHP
45 lines
1.0 KiB
PHP
--TEST--
|
|
IBM-DB2: db2_num_rows - insert, delete
|
|
--SKIPIF--
|
|
<?php require_once('skipif.inc'); ?>
|
|
--FILE--
|
|
<?php
|
|
|
|
require_once('connection.inc');
|
|
|
|
$conn = db2_connect($db,$username,$password);
|
|
db2_autocommit( $conn, DB2_AUTOCOMMIT_OFF );
|
|
|
|
if ($conn) {
|
|
$result = db2_exec($conn,"insert into t_string values(123,1.222333,'one to one')");
|
|
if ($result) {
|
|
$cols = db2_num_fields($result);
|
|
echo 'col: ' . $cols . ',';
|
|
$rows = db2_num_rows($result);
|
|
echo 'affected row: ' . $rows ;
|
|
}
|
|
else {
|
|
echo db2_stmt_errormsg();
|
|
}
|
|
$result = db2_exec($conn,"delete from t_string where a=123");
|
|
if ($result) {
|
|
$cols = db2_num_fields($result);
|
|
echo 'col: ' . $cols . ',';
|
|
$rows = db2_num_rows($result);
|
|
echo 'affected row: ' . $rows ;
|
|
}
|
|
else {
|
|
echo db2_stmt_errormsg();
|
|
}
|
|
|
|
db2_rollback($conn);
|
|
db2_close($conn);
|
|
}
|
|
else {
|
|
echo 'no connection: ' . db2_conn_errormsg();
|
|
}
|
|
|
|
?>
|
|
--EXPECT--
|
|
col: 0,affected row: 1col: 0,affected row: 1
|