appdb/include appData.php screenshot.php

WineHQ wineowner at wine.codeweavers.com
Sun Jun 10 18:07:51 CDT 2007


ChangeSet ID:	31176
CVSROOT:	/opt/cvs-commit
Module name:	appdb
Changes by:	wineowner at winehq.org	2007/06/10 18:07:51

Modified files:
	include        : appData.php screenshot.php 

Log message:
	Alexander Nicolaysen Sørnes <alex at thehandofagony.com>
	Allow appData constructor to import appData derived objects

Patch: http://cvs.winehq.org/patch.py?id=31176

Old revision  New revision  Changes     Path
 1.24          1.25          +15 -1      appdb/include/appData.php
 1.69          1.70          +3 -3       appdb/include/screenshot.php

Index: appdb/include/appData.php
diff -u -p appdb/include/appData.php:1.24 appdb/include/appData.php:1.25
--- appdb/include/appData.php:1.24	10 Jun 2007 23: 7:51 -0000
+++ appdb/include/appData.php	10 Jun 2007 23: 7:51 -0000
@@ -15,11 +15,25 @@ class appData
     var $sSubmitTime;
     var $sDescription;
 
-    function appData($iId = null, $oRow = null)
+    function appData($iId = null, $oRow = null, $oObject = null)
     {
         if(!$iId && !$oRow)
             return;
 
+        /* Since all objects stored in the appData table have a number of common
+           members, we can import such an object into an appData one without
+           making an SQL query */
+        if($oObject && $iId)
+        {
+            $this->iSubmitterId = $oObject->iSubmitterId;
+            $this->sDescription = $oObject->sDescription;
+            $this->iAppId = $oObject->iAppId;
+            $this->iVersionId = $oObject->iVersionId;
+            $this->sSubmitTime = $oObject->sSubmitTime;
+            $this->iId = $iId;
+            return;
+        }
+
         if(!$oRow)
         {
             $hResult = query_parameters("SELECT * FROM appData WHERE id = '?'", $iId);
Index: appdb/include/screenshot.php
diff -u -p appdb/include/screenshot.php:1.69 appdb/include/screenshot.php:1.70
--- appdb/include/screenshot.php:1.69	10 Jun 2007 23: 7:51 -0000
+++ appdb/include/screenshot.php	10 Jun 2007 23: 7:51 -0000
@@ -131,7 +131,7 @@ class Screenshot {
     function delete($bSilent=false)
     {
         /* appData has a universal function for removing database entries */
-        $oAppData = new appData($this->iScreenshotId);
+        $oAppData = new appData($this->iScreenshotId, null, $this);
         if($oAppData->delete())
         {
             /* make sure the screenshot and thumbnail is loaded */
@@ -562,7 +562,7 @@ class Screenshot {
     /* arg1 = OM object, arg2 = CSS style, arg3 = text for edit link */
     function objectOutputTableRow($oObject, $sClass, $sEditLinkLabel)
     {
-        $oAppData = new AppData();
+        $oAppData = new AppData($this->iScreenshotId, null, $this);
         $oAppData->objectOutputTableRow($oObject, $sClass, $sEditLinkLabel);
     }
 
@@ -573,7 +573,7 @@ class Screenshot {
 
     function outputEditor()
     {
-        $oAppData = new appData($this->iScreenshotId);
+        $oAppData = new appData($this->iScreenshotId, null, $this);
         $oAppData->outputEditorGeneric();
 
         echo '<tr valign=top><td class=color0><b>Submited screenshot</b></td>',"\n";



More information about the wine-cvs mailing list