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 |
} |
} |
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])) { |
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(); |
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 |
|
?> |