phpgroupware-developers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Phpgroupware-developers] Is there some problem using adodb?


From: Sigurd Nes
Subject: Re: [Phpgroupware-developers] Is there some problem using adodb?
Date: Sat, 11 Jun 2005 01:34:11 +0200
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)

This is exactly how I use the db-object - but in some functions I call on objects from other classes within a loop. This other class may have the db-objects named as from the caller - and this tamper with the original db-object. However - this is no problem if using the old db-layer which currently is used in the api 0.9.16.005. The problem manifests itself when changing to HEAD where the old db-layer is substituted with adodb. Since it is not a problem with the old db-layer - I was wondering if there could be a way to make the adodb work as the old one in this matter.

Regards

Sigurd

Alan Oshry wrote:
Sigurd,
I'm probably not answering your question, but it seems that if you had something like this in your class instantiator --------------- class some_class
{
    var $db;
    var $db2;
//instantiator
    function some_class
    {
        $this->db  = $GLOBALS['phpgw']->db;
        $this->db2 = $this->db;
    }
....... Then you would have 2 seperate copies that could run independently. You could have function 2 using db2, and function 1 using db. That way db and db2 keep their pointers and results, how you have it now wouldn't the original query resultset/pointer get replaced with the query in function 2? *Alan Oshry*
Revelant Technologies
------------------------------------------------------------------------
*From:* Sigurd Nes
*Sent:* Fri 6/10/2005 3:52 PM
*To:* address@hidden
*Subject:* Re: [Phpgroupware-developers] Is there some problem using adodb?

I agree - I was a bit inaccurate - actually - the function2 in the example resides in another class - so the correct call from function1 would be like :
function function1 ()
{
   $sql = "SELECT * FROM phpgw_accounts";
   $this->db->query($sql,__LINE__,__FILE__);
   while ($this->db->next_record())
   {
     $this->other_object->function2($this->db->f('account_id'));
   }
}

I realise that this will not work when calling a function within the same class using the same db-objekt. Using the old db-layer calling function2 in an other class really does work - but not for the new adodb implementation. It seems like the db-object is some kind created as a globally object (if there is such a kind), and get messed up when it get called from a different class with the same name.

Regards

Sigurd


Chris Weiss wrote:
used that way, i'm not sure why you think it wouldn't be affected.

and, IIRC(WIPD)* that's the old db way not adodb.  the way you have
it, you would need a seperate db object for each function.


* If I Remember Correctly (Which I Possibly Don't)


On 6/10/05, sigurdne <address@hidden> wrote:

it seems like the db-objekt of funcion1 is affekted by function2. Is there a
way to get around this?

example:

$this->db = $GLOBALS['phpgw']->db;

function function1 ()
{
 $sql = "SELECT * FROM phpgw_accounts";
 $this->db->query($sql,__LINE__,__FILE__);
 while ($this->db->next_record())
 {
   $this->function2($this->db->f('account_id'));
 }
}

function function2 ($account_id)
{
 $sql = "SELECT * FROM phpgw_accounts WHERE account_id = $account_id";
 $this->db->query($sql,__LINE__,__FILE__);
 $this->db->next_record();
 _debug_array($this->db->f('account_lastname'));
}


Regards

Sigurd



_______________________________________________
Phpgroupware-developers mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/phpgroupware-developers





_______________________________________________
Phpgroupware-developers mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/phpgroupware-developers






_______________________________________________
Phpgroupware-developers mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/phpgroupware-developers


------------------------------------------------------------------------

_______________________________________________
Phpgroupware-developers mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/phpgroupware-developers





reply via email to

[Prev in Thread] Current Thread [Next in Thread]