[pLog-svn] db vs pdb confusion...

Jon Daley plogworld at jon.limedaley.com
Sat Jan 27 19:54:22 EST 2007


 	Yes, I just figured that out - I don't know what I was thinking. 
It does look like there is too much code in db.class.php - ie. why do the 
buildWhereCondition, buildUpdateQuery, etc. exist in that class? 
Shouldn't the pdb classes only be used?  Maybe that is just for backward 
compatibility?

  On Sun, 28 Jan 2007, Oscar Renalias wrote:

> Db::getDb() returns a reference to the right database driver,
> currently PDbMySQLDriver only so you can call the
> PDbDriverBase::Affected_Rows() in that object to get what you're
> looking for.
>
> On 28 Jan 2007, at 01:57, Jon Daley wrote:
>
>> I haven't ever quite understood how all the database stuff works.
>>
>> I have a function that I was typing the mysql directly, and I
>> thought that
>> perhaps I should use the Db::buildUpdateQuery instead.  Is that the
>> right
>> thing to do?
>>
>> What I am missing is I don't know how to get to the Affected_Rows()
>> function, that exists in mysqldriver, but not mysqlrecordset.
>>
>>
>>
>>      function confirmSubscription($confirmation){
>>          include_once( PLOG_CLASS_PATH."class/database/
>> db.class.php" );
>> //        $prefix = Db::getPrefix();
>> //        $query = "UPDATE {$prefix}subscribe ".
>> //            "SET active=1, confirm=NULL ".
>> //            "WHERE confirm='$confirmation'";
>>          $db =& Db::getDb();
>>          $query = Db::buildUpdateQuery("subscribe",
>>                                        array("active" => 1,
>>                                              "confirm" => NULL),
>>                                        array("confirm" =>
>> $confirmation));
>>          if(!$db->Execute($query))
>>              return false;
>>
>>              // TODO: check affected_rows, and make sure
>>              // that it is at least 1.
>>          return true;
>>      }
>>
>>
>> --
>> Jon Daley
>> http://jon.limedaley.com/
>>
>> To be upset over what you don't have is to waste what you do have.
>> -- Unknown
>> _______________________________________________
>> pLog-svn mailing list
>> pLog-svn at devel.lifetype.net
>> http://limedaley.com/mailman/listinfo/plog-svn
>>
>
> _______________________________________________
> pLog-svn mailing list
> pLog-svn at devel.lifetype.net
> http://limedaley.com/mailman/listinfo/plog-svn
>

-- 
Jon Daley
http://jon.limedaley.com/

There are really only two bases: 2 and e.
-- Michael Brian McElroy


More information about the pLog-svn mailing list