/[papo]/gnue/phpforms/src/database.inc
ViewVC logotype

Diff of /gnue/phpforms/src/database.inc

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

revision 1.3 by charlie, Tue Aug 27 18:15:54 2002 UTC revision 1.4 by styxman, Fri Nov 8 17:07:44 2002 UTC
# Line 159  class PGSQL_DB extends database { Line 159  class PGSQL_DB extends database {
159          }                          }                
160      }      }
161      // ****      // ****
162      function getEmptyResultSet($table) {        function getEmptyResultSet($table,$order_by=Null) {  
163          $r=new PGSQL_Resultset;          $r=new PGSQL_Resultset;
164          $r->setDatabase($this);          $r->setDatabase($this);
165          $r->setTable($table);          $r->setTable($table);
166          return $r;          return $r;
167      }      }
168      function getResultSet($table,$query) {      function getResultSet($table,$query,$order_by=Null) {
169          $r=$this->getEmptyResultSet($table);          $r=$this->getEmptyResultSet($table,$order_by);
170          $res=$this->select($query);          // create sql
171            $sql = "select OID,* from ".$table;
172            if (count($query)) {
173                reset($query);
174                while (list($k,$v)=each($query)) {
175                    if (strlen($v)>0) {
176                        $where=$where2." ".$k." LIKE '".$v."' ";
177                        $where2=$where."AND";
178                        // get field info like: defaultQuery
179                        // ignoreCaseOnquery, sloopyQuery...
180                    }
181                }
182            };
183            if (isset($where))
184                $sql=$sql." WHERE ".$where;          
185            if (isset($order_by))
186                $sql=$sql." ORDER BY ".$order_by;
187            DEBUG(3,"DATABASE ADAPTER:EXECUTING SQL ".$sql);
188            $res=$this->select($sql);
189          if (count($res)>0) $r->setCache($res);          if (count($res)>0) $r->setCache($res);
190          return $r;          return $r;
191      }      }
# Line 394  class SessionCacheDB extends database { Line 412  class SessionCacheDB extends database {
412          };          };
413          return $indexList;          return $indexList;
414      }      }
415        function commit($table) {
416            # do nothing
417        }
418      function addTable($table) {      function addTable($table) {
419          DEBUG(5,"SessionCacheDB.AddTable: Tablename='".$table."'");          DEBUG(5,"SessionCacheDB.AddTable: Tablename='".$table."'");
420          if (!isset($this->datastore[$table])) {          if (!isset($this->datastore[$table])) {
# Line 486  class SessionCacheResultSet extends Resu Line 507  class SessionCacheResultSet extends Resu
507          $this->to_delete=array();          $this->to_delete=array();
508          $this->changed=array();          $this->changed=array();
509          $this->setFilter($this->filter);          $this->setFilter($this->filter);
510            $this->dbcon->commit($this->table);
511      }      }
512      function rollback() {      function rollback() {
513          $this->to_delete=array();          $this->to_delete=array();
# Line 581  class SessionCacheResultSet extends Resu Line 603  class SessionCacheResultSet extends Resu
603          print "<BR>";          print "<BR>";
604      }      }
605  }  }
 ?>  
606    class MailGatewayDB extends SessionCacheDB {
607        function MailGatewayDB() {
608            $this->attr=array();
609            $this->datastore=array();
610            $this->datacount=array();
611            $this->datastore["demotable"]=array(0=>array("File"=>"Hello"));
612            DEBUG(3,"New MailGatewayDB object");
613        }
614        function commit($table) {
615            $tosend=$datastore[$table];
616            print_r($tosend);
617            $m="GNU Enterprise PHP Form Result\n";
618            $m=$m."\n";        
619    #        reset($tosend);
620    #        while (list ($k, $v) = each ($dtsdata)) {
621    #            $m=$m."\n Datasource: ".$k."\n";
622    #            reset($v["cache"]);
623    #            while (list ($k1, $v1) = each ($v["cache"])) {
624    #                $m=$m."\n Record: ".$k1."\n";
625    #                reset($v1);
626    #                while (list ($k2, $v2) = each ($v1)) {
627    #                    $m=$m.$k2.":".$v2."\n";
628    #                }
629    #
630    #            }
631    #        }
632            $mailaddr=$this->attr["EMAIL"];
633            if (array_key_exists("MAILTITLE",$this->attr)) {
634                $title=$this->attr["MAILTITLE"];
635            } else {
636                $title="GNUe Forms - content submission";
637            };
638            mail ($mailaddr,$title,$m);
639            echo "<H1>MAIL SENT TO ".$mailaddr."</H1>";
640            session_destroy();
641            exit(0);  
642        }
643    }
644    ?>

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

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26