[pLog-svn] db vs pdb confusion...
Oscar Renalias
oscar at renalias.net
Sat Jan 27 19:16:01 EST 2007
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
>
More information about the pLog-svn
mailing list