mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-10-10 19:12:42 +00:00
- added documentation
This commit is contained in:
parent
e6236378ad
commit
dfd6d69b12
|
@ -78,11 +78,11 @@ class LetoDMS_DatabaseAccess {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Baut Verbindung zur Datenquelle auf und liefert
|
* Connect to database
|
||||||
* true bei Erfolg, andernfalls false
|
*
|
||||||
|
* @return boolean true if connection could be established, otherwise false
|
||||||
*/
|
*/
|
||||||
function connect()
|
function connect() { /* {{{ */
|
||||||
{
|
|
||||||
$this->_conn = ADONewConnection($this->_driver);
|
$this->_conn = ADONewConnection($this->_driver);
|
||||||
if ($this->_database)
|
if ($this->_database)
|
||||||
$this->_conn->Connect($this->_hostname, $this->_user, $this->_passw, $this->_database);
|
$this->_conn->Connect($this->_hostname, $this->_user, $this->_passw, $this->_database);
|
||||||
|
@ -94,25 +94,30 @@ class LetoDMS_DatabaseAccess {
|
||||||
|
|
||||||
$this->_connected = true;
|
$this->_connected = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stellt sicher, dass eine Verbindung zur Datenquelle aufgebaut ist
|
* Make sure a database connection exisits
|
||||||
* true bei Erfolg, andernfalls false
|
*
|
||||||
|
* This function checks for a database connection. If it does not exists
|
||||||
|
* it will reconnect.
|
||||||
|
*
|
||||||
|
* @return boolean true if connection is established, otherwise false
|
||||||
*/
|
*/
|
||||||
function ensureConnected()
|
function ensureConnected() { /* {{{ */
|
||||||
{
|
|
||||||
if (!$this->_connected) return $this->connect();
|
if (!$this->_connected) return $this->connect();
|
||||||
else return true;
|
else return true;
|
||||||
}
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Führt die SQL-Anweisung $queryStr aus und liefert das Ergebnis-Set als Array (d.h. $queryStr
|
* Execute SQL query and return result
|
||||||
* muss eine select-anweisung sein).
|
*
|
||||||
* Falls die Anfrage fehlschlägt wird false geliefert
|
* Call this function only with sql query which return data records.
|
||||||
|
*
|
||||||
|
* @param string $queryStr sql query
|
||||||
|
* @return array/boolean data if query could be executed otherwise false
|
||||||
*/
|
*/
|
||||||
function getResultArray($queryStr)
|
function getResultArray($queryStr) { /* {{{ */
|
||||||
{
|
|
||||||
$resArr = array();
|
$resArr = array();
|
||||||
|
|
||||||
$res = $this->_conn->Execute($queryStr);
|
$res = $this->_conn->Execute($queryStr);
|
||||||
|
@ -123,37 +128,45 @@ class LetoDMS_DatabaseAccess {
|
||||||
$resArr = $res->GetArray();
|
$resArr = $res->GetArray();
|
||||||
$res->Close();
|
$res->Close();
|
||||||
return $resArr;
|
return $resArr;
|
||||||
}
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Führt die SQL-Anweisung $queryStr aus (die kein ergebnis-set liefert, z.b. insert, del usw) und
|
* Execute SQL query
|
||||||
* gibt das resultat zurück
|
*
|
||||||
|
* Call this function only with sql query which do not return data records.
|
||||||
|
*
|
||||||
|
* @param string $queryStr sql query
|
||||||
|
* @return boolean true if query could be executed otherwise false
|
||||||
*/
|
*/
|
||||||
function getResult($queryStr, $silent=false)
|
function getResult($queryStr, $silent=false) { /* {{{ */
|
||||||
{
|
|
||||||
$res = $this->_conn->Execute($queryStr);
|
$res = $this->_conn->Execute($queryStr);
|
||||||
if (!$res && !$silent)
|
if (!$res && !$silent)
|
||||||
print "<br>" . $this->getErrorMsg() . "<br>" . $queryStr . "</br>";
|
print "<br>" . $this->getErrorMsg() . "<br>" . $queryStr . "</br>";
|
||||||
|
|
||||||
return $res;
|
return $res;
|
||||||
}
|
} /* }}} */
|
||||||
|
|
||||||
function getInsertID()
|
/**
|
||||||
{
|
* Return the id of the last instert record
|
||||||
|
*
|
||||||
|
* @return integer id used in last autoincrement
|
||||||
|
*/
|
||||||
|
function getInsertID() { /* {{{ */
|
||||||
return $this->_conn->Insert_ID();
|
return $this->_conn->Insert_ID();
|
||||||
}
|
} /* }}} */
|
||||||
|
|
||||||
function getErrorMsg()
|
function getErrorMsg() { /* {{{ */
|
||||||
{
|
|
||||||
return $this->_conn->ErrorMsg();
|
return $this->_conn->ErrorMsg();
|
||||||
}
|
} /* }}} */
|
||||||
|
|
||||||
function getErrorNo()
|
function getErrorNo() { /* {{{ */
|
||||||
{
|
|
||||||
return $this->_conn->ErrorNo();
|
return $this->_conn->ErrorNo();
|
||||||
}
|
} /* }}} */
|
||||||
|
|
||||||
function createTemporaryTable($tableName, $override=false) {
|
/**
|
||||||
|
* Create various temporary tables to speed up and simplify sql queries
|
||||||
|
*/
|
||||||
|
function createTemporaryTable($tableName, $override=false) { /* {{{ */
|
||||||
if (!strcasecmp($tableName, "ttreviewid")) {
|
if (!strcasecmp($tableName, "ttreviewid")) {
|
||||||
$queryStr = "CREATE TEMPORARY TABLE IF NOT EXISTS `ttreviewid` (PRIMARY KEY (`reviewID`), INDEX (`maxLogID`)) ".
|
$queryStr = "CREATE TEMPORARY TABLE IF NOT EXISTS `ttreviewid` (PRIMARY KEY (`reviewID`), INDEX (`maxLogID`)) ".
|
||||||
"SELECT `tblDocumentReviewLog`.`reviewID`, ".
|
"SELECT `tblDocumentReviewLog`.`reviewID`, ".
|
||||||
|
@ -243,7 +256,7 @@ class LetoDMS_DatabaseAccess {
|
||||||
return $this->_ttcontentid;
|
return $this->_ttcontentid;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
} /* }}} */
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user