DBD-DB2

 view release on metacpan or  search on metacpan

dbdimp.c  view on Meta::CPAN

		      		  strncmp( pState, "40003", 5 ) == 0 ) ) {
			/* ping should not throw an error when it detects a dead  */
			/* connection so reset error code and message but keep    */
			/* connection state                                       */
			sv_setsv( DBIc_ERRSTR(imp_dbh), &PL_sv_undef );
			sv_setsv( DBIc_ERR(imp_dbh), &PL_sv_undef );
			return FALSE; /* Connection is dead */
	  	}
    	}
	
    	return TRUE; /* Connection is still alive */
}

int dbd_db_commit( SV *dbh,
		imp_dbh_t *imp_dbh ) {

	SQLRETURN ret;
    	ret = SQLEndTran(SQL_HANDLE_DBC,imp_dbh->hdbc,SQL_COMMIT);
	CHECK_ERROR(dbh, SQL_HANDLE_DBC, imp_dbh->hdbc, ret, "Commit Failed");
    	EOI(ret);
    	return TRUE;

tests/perld060_pingConnWithNormalDisconnect.pl  view on Meta::CPAN

$dbh->disconnect;
check_error( "DISCONNECT" );
if ($DBI::err != 0)
{
  goto end;
}

print "Testing connection... ";
if( $dbh->ping )
{
  print "Error: connection appears to be alive\n";
}
else
{
  print "disconnected.\n";
}
print "  err=", $dbh->err, "\n";
print "  errstr=", $dbh->errstr, "\n";
print "  state=", $dbh->state, "\n";

fvt_end_testcase($testcase, $success);

tests/perld061_pingConnWithForceAppAll.pl  view on Meta::CPAN


# Only print messages in case of error so we can safely skip this step
# in client/server environments
if( !&is_client_server || &is_loopback )
{
  `db2 force application all`;

  # Test connection, should get SQLSTATE=40003
  if( $dbh->ping )
  {
    print "Error: connection appears to be alive\n";
  }

  if( defined( $dbh->err ) && $dbh->err != 0 )
  {
    print "Error: unexpected SQLCODE: ", $dbh->err, "\n";
  }

  if( defined( $dbh->errstr ) && $dbh->errstr ne "" )
  {
    print "Error: unexpected error message: ", $dbh->errstr, "\n";
  }

  if( $dbh->state != "40003" )
  {
    print "Error: unexpected SQLSTATE: ", $dbh->state, "\n";
  }
  # Test connection again, should get SQLSTATE=08003
  if( $dbh->ping )
  {
    print "Error: connection appears to be alive\n";
  }

  if( defined( $dbh->err ) && $dbh->err != 0 )
  {
    print "Error: unexpected SQLCODE: ", $dbh->err, "\n";
  }

  if( defined( $dbh->errstr ) && $dbh->errstr ne "" )
  {
    print "Error: unexpected error message: ", $dbh->errstr, "\n";

tests/perld062_pingConnWithdb2stop.pl  view on Meta::CPAN


# Only print messages in case of error so we can safely skip this step
# in client/server environments
if( !&is_client_server || &is_loopback )
{
  `db2stop force`;

  # Test connection, should get SQLSTATE=40003
  if( $dbh->ping )
  {
    print "Error: connection appears to be alive\n";
  }

  if( defined( $dbh->err ) && $dbh->err != 0 )
  {
    print "Error: unexpected SQLCODE: ", $dbh->err, "\n";
  }

  if( defined( $dbh->errstr ) && $dbh->errstr ne "" )
  {
    print "Error: unexpected error message: ", $dbh->errstr, "\n";
  }

  if( $dbh->state != "40003" )
  {
    print "Error: unexpected SQLSTATE: ", $dbh->state, "\n";
  }

  # Test connection again, should get SQLSTATE=08003
  if( $dbh->ping )
  {
    print "Error: connection appears to be alive\n";
  }

  if( defined( $dbh->err ) && $dbh->err != 0 )
  {
    print "Error: unexpected SQLCODE: ", $dbh->err, "\n";
  }

  if( defined( $dbh->errstr ) && $dbh->errstr ne "" )
  {
    print "Error: unexpected error message: ", $dbh->errstr, "\n";



( run in 0.928 second using v1.01-cache-2.11-cpan-39bf76dae61 )