appdb/include distribution.php
WineHQ
wineowner at wine.codeweavers.com
Wed Jan 31 20:06:38 CST 2007
ChangeSet ID: 30921
CVSROOT: /opt/cvs-commit
Module name: appdb
Changes by: wineowner at winehq.org 2007/01/31 20:06:38
Modified files:
include : distribution.php
Log message:
Alexander Nicolaysen Sørnes <alex at thehandofagony.com>
Allow object creation from a mysql resource, allow objectGetEntries() to limit the range of
entries requested, this will be necessary for future performance optimizations
Patch: http://cvs.winehq.org/patch.py?id=30921
Old revision New revision Changes Path
1.10 1.11 +29 -34 appdb/include/distribution.php
Index: appdb/include/distribution.php
diff -u -p appdb/include/distribution.php:1.10 appdb/include/distribution.php:1.11
--- appdb/include/distribution.php:1.10 1 Feb 2007 2: 6:38 -0000
+++ appdb/include/distribution.php 1 Feb 2007 2: 6:38 -0000
@@ -18,31 +18,30 @@ class distribution {
var $aTestingIds;
// constructor, fetches the data.
- function distribution($iDistributionId = null)
+ function distribution($iDistributionId = null, $oRow = null)
{
// we are working on an existing distribution.
if(is_numeric($iDistributionId))
{
// We fetch the data related to this distribution.
- if(!$this->$iDistributionId)
+ if(!$oRow)
{
$sQuery = "SELECT *
FROM distributions
WHERE distributionId = '?'";
if($hResult = query_parameters($sQuery, $iDistributionId))
- {
$oRow = mysql_fetch_object($hResult);
- if($oRow)
- {
- $this->iDistributionId = $iDistributionId;
- $this->sName = $oRow->name;
- $this->sDescription = $oRow->description;
- $this->sUrl = $oRow->url;
- $this->sSubmitTime = $oRow->submitTime;
- $this->iSubmitterId = $oRow->submitterId;
- $this->sQueued = $oRow->queued;
- }
- }
+ }
+
+ if($oRow)
+ {
+ $this->iDistributionId = $iDistributionId;
+ $this->sName = $oRow->name;
+ $this->sDescription = $oRow->description;
+ $this->sUrl = $oRow->url;
+ $this->sSubmitTime = $oRow->submitTime;
+ $this->iSubmitterId = $oRow->submitterId;
+ $this->sQueued = $oRow->queued;
}
/*
@@ -438,30 +437,26 @@ class distribution {
echo html_tr($aCells, $sClass);
}
- function objectGetEntries($bQueued)
+ function objectGetEntries($bQueued, $iRows = 0, $iStart = 0)
{
- if($bQueued)
- {
- if(distribution::canEdit())
- {
- /* Only users with edit privileges are allowed to view queued
- items, so return NULL in that case */
- $sQuery = "SELECT distributionId FROM distributions
- WHERE queued = '?' ORDER BY name";
- return query_parameters($sQuery, $bQueued ? "true" : "false");
- } else
- return NULL;
- } else
- {
- $sQuery = "SELECT distributionId FROM distributions
- WHERE queued = '?' ORDER BY name";
- return query_parameters($sQuery, "false");
- }
+ /* Only users with edit privileges are allowed to view queued
+ items, so return NULL in that case */
+ if($bQueued && !distribution::canEdit())
+ return NULL;
+
+ if(!$iRows)
+ $iRows = distribution::getNumberOfDistributions($bQueued);
+
+ $sQuery = "SELECT * FROM distributions
+ WHERE queued = '?' ORDER BY name LIMIT ?,?";
+
+ return query_parameters($sQuery, $bQueued ? "true" : "false",
+ $iStart, $iRows);
}
- function ObjectGetInstanceFromRow($oRow)
+ function objectGetInstanceFromRow($oRow)
{
- return new distribution($oRow->distributionId);
+ return new distribution($oRow->distributionId, $oRow);
}
function objectOutputTableRow($sClass = "")
More information about the wine-cvs
mailing list