[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Phpgroupware-developers] Is there some problem using adodb?
From: |
Chris Weiss |
Subject: |
Re: [Phpgroupware-developers] Is there some problem using adodb? |
Date: |
Fri, 10 Jun 2005 16:40:11 -0500 |
also keep in mind that php4 makes copies by default, but php5 makes
references. SO if you're using php5 both $db and $db2 would act
directly on $GLOBALS['phpgw']->db, but in php4 they would not
On 6/10/05, Alan Oshry <address@hidden> 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
>
>
>