[pLog-svn] r2508 - in plog/trunk/class: dao/userdata database
jondaley at devel.plogworld.net
jondaley at devel.plogworld.net
Thu Sep 22 01:00:28 GMT 2005
Author: jondaley
Date: 2005-09-22 01:00:28 +0000 (Thu, 22 Sep 2005)
New Revision: 2508
Modified:
plog/trunk/class/dao/userdata/ploguserdataprovider.class.php
plog/trunk/class/database/db.class.php
Log:
please check this - as I might not know what I am doing. These functions seem to not work at all. It might be nice to have default values on buildWhere* functions, but since the number of parameters was wrong in one of the callers, probably something changed, so we want to catch those rather than miss them with default values. Does this look right to you?
Modified: plog/trunk/class/dao/userdata/ploguserdataprovider.class.php
===================================================================
--- plog/trunk/class/dao/userdata/ploguserdataprovider.class.php 2005-09-21 23:45:54 UTC (rev 2507)
+++ plog/trunk/class/dao/userdata/ploguserdataprovider.class.php 2005-09-22 01:00:28 UTC (rev 2508)
@@ -111,7 +111,7 @@
if( $searchTerms != "" )
$whereSearch = $this->buildSearchCondition( $searchTerms );
- $where = Db::buildWhereCondition( Array( $whereStatus, $whereSearch ));
+ $where = Db::buildWhereConditions( Array( $whereStatus, $whereSearch ), null, ", ");
$query = "SELECT * FROM ".$this->getPrefix()."users $where ORDER BY id ASC";
@@ -369,7 +369,7 @@
if( $searchTerms != "" )
$whereSearch = $this->buildSearchCondition( $searchTerms );
- $where = $this->buildWhereCondition( Array( $whereStatus, $whereSearch ), false );
+ $where = $this->buildWhereConditions( Array( $whereStatus, $whereSearch ), null, ", ");
return( $this->getNumItems( $table, $where ));
}
Modified: plog/trunk/class/database/db.class.php
===================================================================
--- plog/trunk/class/database/db.class.php 2005-09-21 23:45:54 UTC (rev 2507)
+++ plog/trunk/class/database/db.class.php 2005-09-22 01:00:28 UTC (rev 2508)
@@ -207,9 +207,14 @@
if( is_array($whereColumn) ) {
$conditions = array();
foreach( $whereColumn as $column => $value ) {
- $conditions[] = Db::buildWhereCondition( $column, $value );
+ if($column && $value){
+ $conditions[] = Db::buildWhereCondition( $column, $value );
+ }
}
- $queryPart .= implode( $whereGlue , $conditions );
+ $imploded = implode( $whereGlue , $conditions );
+ if(!$imploded)
+ return null;
+ $queryPart .= $imploded;
} elseif( !empty($whereColumn) ) {
$queryPart .= Db::buildWhereCondition( $whereColumn, $whereValue );
}
More information about the pLog-svn
mailing list