/[cvs]/nfo/php/libs/org.netfrag.flib/Application/RPC/ProxyObject.php
ViewVC logotype

Diff of /nfo/php/libs/org.netfrag.flib/Application/RPC/ProxyObject.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by joko, Thu Dec 5 21:44:09 2002 UTC revision 1.3 by joko, Fri Dec 6 04:12:54 2002 UTC
# Line 3  Line 3 
3  ##    $Id$  ##    $Id$
4  ##    -------------------------------------------------------------------------------------  ##    -------------------------------------------------------------------------------------
5  ##    $Log$  ##    $Log$
6    ##    Revision 1.3  2002/12/06 04:12:54  joko
7    ##    + replaced 'xyzCache' through 'xyzProxy'
8    ##    + function store(...)
9    ##
10  ##    Revision 1.2  2002/12/05 21:44:09  joko  ##    Revision 1.2  2002/12/05 21:44:09  joko
11  ##    + debugging  ##    + debugging
12  ##  ##
# Line 72  class ProxyObject { Line 76  class ProxyObject {
76      if ($objectId) {      if ($objectId) {
77        $this->objectId = $objectId;        $this->objectId = $objectId;
78        $this->load();        $this->load();
79        //$this->_saveCache();        //$this->_saveProxy();
80      }      }
81    }    }
82    
83    function load() {    function load() {
84      if (!$this->_loadState()) {      if (!$this->_loadState()) {
85        if (!$this->_loadCache()) {        if (!$this->_loadProxy()) {
86          $this->_loadBackend();          $this->_loadBackend();
87        }        }
88      }      }
# Line 97  class ProxyObject { Line 101  class ProxyObject {
101    
102    function flush() {    function flush() {
103      $this->flushState();      $this->flushState();
104      $this->flushCache();      $this->flushProxy();
105    }          }      
106    
107    function _commit() {    function _commit() {
108      $this->_saveBackend($this->attributes);      $this->_saveBackend($this->attributes);
109      $this->flushState();      $this->flushState();
110      $this->flushCache();      $this->flushProxy();
111    }      }  
112    
113    
# Line 112  class ProxyObject { Line 116  class ProxyObject {
116    function _create() {    function _create() {
117      $this->_createBackend($this->attributes);      $this->_createBackend($this->attributes);
118      $this->flushState();      $this->flushState();
119      $this->flushCache();      $this->flushProxy();
120    }      }  
121    */    */
122    
# Line 128  class ProxyObject { Line 132  class ProxyObject {
132      $this->attributes = $data;      $this->attributes = $data;
133    }    }
134    
135    function flushCache() {    function flushProxy() {
136          connectdb();          connectdb();
137      $sql = "DELETE FROM f_proxy WHERE oid='$this->objectId'";      $sql = "DELETE FROM f_proxy WHERE oid='$this->objectId'";
138      send_sql($sql);      send_sql($sql);
# Line 158  class ProxyObject { Line 162  class ProxyObject {
162      // TODO: throw exception-message back to user if operation fails      // TODO: throw exception-message back to user if operation fails
163    }    }
164    
165    function _loadCache() {    function _loadProxy() {
166      logp(get_class($this) . "->_loadCache()", LOG_DEBUG);      logp(get_class($this) . "->_loadProxy()", LOG_DEBUG);
167      connectdb();      connectdb();
168      $sql = "SELECT payload FROM f_proxy WHERE oid='$this->objectId'";      $sql = "SELECT payload FROM f_proxy WHERE oid='$this->objectId'";
169      if ($res = send_sql($sql)) {      if ($res = send_sql($sql)) {
# Line 172  class ProxyObject { Line 176  class ProxyObject {
176      }      }
177    }    }
178        
179    function _saveCache() {    // TODO: use PEAR here
180      logp(get_class($this) . "->_saveCache()", LOG_DEBUG);    function _saveProxy() {
181        logp(get_class($this) . "->_saveProxy()", LOG_DEBUG);
182          connectdb();          connectdb();
183          if ($this->payload) {          if ($this->payload) {
184        //$sql = "INSERT INTO f_proxy SET payload='$this->payload' WHERE oid='$this->objectId'";        //$sql = "INSERT INTO f_proxy SET payload='$this->payload' WHERE oid='$this->objectId'";
# Line 197  class ProxyObject { Line 202  class ProxyObject {
202          print dumpVar($result);          print dumpVar($result);
203        }        }
204        $this->payload = serialize($result);        $this->payload = serialize($result);
205        $this->_saveCache();        $this->_saveProxy();
206      }      }
207    }    }
208        
# Line 216  class ProxyObject { Line 221  class ProxyObject {
221        $this->meta[decoded] = 1;        $this->meta[decoded] = 1;
222      }      }
223    }    }
224      
225      function store($struct) {
226        $this->payload = serialize($struct);
227        $this->_saveProxy();
228      }
229    
230  }  }
231    

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed