Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Pro PHP
|
Pro PHP Advanced PHP coding discussions. Beginning-level questions will be redirected to the Beginning PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 18th, 2007, 03:14 PM
Registered User
 
Join Date: Aug 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default pear new_class.Database.php with mdb2

http://www.wrox.com/WileyCDA/WroxTit...load_code.html

here in chapter 8 is a PEAR:DB class file new_class.Database.php
It is written in per:db but now per:db is deprecated and mdb2 is in used.

So how can i rebuild it in pear:mdb2?

Is anyone do this?


edit:

is this correct

Code:
 function startTransaction() {
    //autoCommit returns true/false if the command succeeds
    return $this->connect->autoCommit(false);
  }

  function commit() {
    $result= $this->connect->commit();

    if(DB::isError($result)) {
      throw new Exception($result->getMessage(), $result->getCode());
    }

    $this->connect->autoCommit(true);
    return true;
  }

  function abort() {
    $result= $this->connect->rollback();

    if(DB::isError($result)) {
      throw new Exception($result->getMessage(), $result->getCode());
    }

    return true;
  }
to

Code:
function startTransaction() {
    //autoCommit returns true/false if the command succeeds
    return $this->connect->beginTransaction(false);
  }

  function commit() {
    if ($this->connect->in_transaction) {
        $this->connect->commit(); 
    }  

    if(PEAR::isError($result)) {
      throw new Exception($result->getMessage(), $result->getCode());
    }

    if ($this->connect->supports('transactions')) {    
        $this->connect->beginTransaction(true);
    }

    return true;
  }

  function abort() {  
    if ($this->connect->in_transaction) {
        $result= $this->connect->rollback();
    } 

    if(PEAR::isError($result)) {
      throw new Exception($result->getMessage(), $result->getCode());
    }

    return true;
  }
 
Old August 21st, 2007, 04:22 AM
Registered User
 
Join Date: Aug 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

can someone help me with this problem?

Maybe some author of the book?






Similar Threads
Thread Thread Starter Forum Replies Last Post
Using PEAR spraveens Beginning PHP 1 December 3rd, 2006 02:07 AM
PHP PEAR installation help vinodkalpaka BOOK: Professional PHP 5 ISBN: 978-0-7645-7282-1 2 February 26th, 2006 02:42 AM
PEAR::Auth and PEAR::Auth_HTTP Ceriwaen Beginning PHP 1 February 18th, 2005 04:36 PM
What is PEAR? anshul PHP How-To 1 August 9th, 2004 11:40 AM
PEAR [email protected] PHP How-To 1 June 6th, 2003 09:24 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.