Source for file class.DB.php
Documentation is available at class.DB.php
* Ermöglicht Datenbankzugriff
* @author Kay Koch, <kay.koch@gmx.de>
* @subpackage foundation_db
die('This file was generated for PHP 5');
/* user defined includes */
// section -64--88-122--2-f41e9:1009a89d5b2:-7fb5-includes begin
// section -64--88-122--2-f41e9:1009a89d5b2:-7fb5-includes end
/* user defined constants */
// section -64--88-122--2-f41e9:1009a89d5b2:-7fb5-constants begin
// section -64--88-122--2-f41e9:1009a89d5b2:-7fb5-constants end
* Ermöglicht Datenbankzugriff
* @author Kay Koch, <kay.koch@gmx.de>
* @subpackage foundation_db
private static $oInstance =
null;
* verbindet zur Datenbank
* @author Kay Koch, <kay.koch@gmx.de>
// section -64--88-122--2-f41e9:1009a89d5b2:-7f97 begin
$this->link_id =
mysql_connect($this->server, $this->user, $this->password);
throw
new Exception ("Link-ID == false, connect failed");
if ($this->database !=
"") $this->select_db($this->database);
// section -64--88-122--2-f41e9:1009a89d5b2:-7f97 end
* @author Kay Koch, <kay.koch@gmx.de>
// section -64--88-122--2-f41e9:1009a89d5b2:-7f91 begin
if ($database !=
"") $this->database =
$database;
throw
new Exception ("cannot use database " .
$this->database);
// section -64--88-122--2-f41e9:1009a89d5b2:-7f91 end
* liefert einen link zu einer SQL-Eingabe
* @author Kay Koch, <kay.koch@gmx.de>
public function query($query_string)
// section -64--88-122--2-f41e9:1009a89d5b2:-7f8e begin
// $query_string= mysql_real_escape_string($query_string);
$this->query_id =
mysql_query($query_string, $this->link_id);
throw
new Exception ("Invalid SQL: " .
$query_string);
$returnValue =
$this->query_id;
// section -64--88-122--2-f41e9:1009a89d5b2:-7f8e end
* liefert Array aus link_id
* @author Kay Koch, <kay.koch@gmx.de>
* @return src_foundation_db_DB
public function fetch_array($query_id, $type =
MYSQL_BOTH)
// section -64--88-122--2-f41e9:1009a89d5b2:-7f8c begin
if ($query_id != -
1) $this->query_id =
$query_id;
// section -64--88-122--2-f41e9:1009a89d5b2:-7f8c end
* setzt Speicherplatz frei
* @author Kay Koch, <kay.koch@gmx.de>
// section -64--88-122--2-f41e9:1009a89d5b2:-7f8a begin
if ($query_id != -
1) $this->query_id =
$query_id;
// section -64--88-122--2-f41e9:1009a89d5b2:-7f8a end
return (int)
$returnValue;
* liefert Array für eine SQL-Anfrage mit ener Zeile
* @author Kay Koch, <kay.koch@gmx.de>
// section -64--88-122--2-f41e9:1009a89d5b2:-7f82 begin
$this->query($query_string);
// section -64--88-122--2-f41e9:1009a89d5b2:-7f82 end
return (array)
$returnValue;
* liefert neue auto_inkrement
* @author Kay Koch, <kay.koch@gmx.de>
// section -64--88-122--2-f41e9:1009a89d5b2:-7f79 begin
// section -64--88-122--2-f41e9:1009a89d5b2:-7f79 end
return (int)
$returnValue;
* stellt Verbindung zur Datenbank her
* @author Kay Koch, <kay.koch@gmx.de>
// section -64--88-122--2-f41e9:1009a89d5b2:-7f6c begin
$this->server =
$arrAccess[0];
$this->user =
$arrAccess[1];
$this->password =
$arrAccess[2];
$this->database =
$arrAccess[3];
// section -64--88-122--2-f41e9:1009a89d5b2:-7f6c end
* löscht die Verbindung am Ende
* @author Kay Koch, <kay.koch@gmx.de>
# mysql_close($this->link_id);
* @author Kay Koch, <kay.koch@gmx.de>
// section -64--88-122--2-56db4adb:103a2d2e802:-7fd3 begin
$result =
$this->query("SHOW COLUMNS FROM $tableName");
while ($row =
$this->fetch_array($result, MYSQL_ASSOC)) {
$returnValue[] =
$row['Field'];
// section -64--88-122--2-56db4adb:103a2d2e802:-7fd3 end
return (array)
$returnValue;
* @author Kay Koch, <kay.koch@gmx.de>
// section -64--88-122--2-56db4adb:103a2d2e802:-7fc7 begin
$sql =
"OPTIMIZE TABLE ";
$results =
$this->query("SHOW tables");
while ($row =
$this->fetch_array($results, MYSQL_NUM)) {
// section -64--88-122--2-56db4adb:103a2d2e802:-7fc7 end
* liefert die Anzahl der Resultate
* @author Kay Koch, <kay.koch@gmx.de>
// section -64--88-0-1--1e6707e3:1048f065750:-7ff3 begin
if ($query_id != -
1) $this->query_id =
$query_id;
// section -64--88-0-1--1e6707e3:1048f065750:-7ff3 end
return (int)
$returnValue;
} /* end of class src_foundation_db_DB */
Documentation generated on Sat, 24 Mar 2007 09:59:05 +0100 by phpDocumentor 1.3.1