1
0
mirror of https://github.com/e107inc/e107.git synced 2025-04-22 13:41:52 +02:00

new methods added to PDO class.

This commit is contained in:
Cameron 2019-02-11 16:19:07 -08:00
parent c34f8b41f3
commit 4e6b68a709
3 changed files with 68 additions and 7 deletions

@ -369,7 +369,37 @@
public function columnCount();
/**
* Set the current database language
* @param string $lang English, French etc.
* @return null
*/
public function setLanguage($lang);
/**
* Get the current database language
* @return string $lang English, French etc.
*/
public function getLanguage();
/**
* Drop/delete table and all it's data
* @param string $table name without the prefix
* @return bool|int
*/
public function dropTable($table);
/**
* Returns the last database query used.
* @return string
*/
function getLastQuery();
}

@ -99,7 +99,7 @@
function db_IsLang($table, $multiple=false)
{
$this->hasLanguage($table, $multiple);
return $this->hasLanguage($table, $multiple);
}

@ -1563,7 +1563,7 @@ class e_db_pdo implements e_db
* @access private
* @return mixed the name of the language table (eg. lan_french_news) or an array of all matching language tables. (with mprefix)
*/
function hasLanguage($table, $multiple=false)
public function hasLanguage($table, $multiple=false)
{
//When running a multi-language site with english included. English must be the main site language.
// WARNING!!! FALSE is critical important - if missed, expect dead loop (prefs are calling db handler as well when loading)
@ -2344,7 +2344,16 @@ class e_db_pdo implements e_db
}
/**
* Drop/delete table and all it's data
* @param string $table name without the prefix
* @return bool|int
*/
public function dropTable($table)
{
$name = $this->mySQLPrefix.strtolower($table);
return $this->gen("DROP TABLE IF EXISTS ".$name);
}
/**
* Dump MySQL Table(s) to a file in the Backup folder.
@ -2530,16 +2539,20 @@ class e_db_pdo implements e_db
$this->mySQLlastErrText = '';
}
function getLastQuery()
/**
* Returns the last database query used.
* @return string
*/
public function getLastQuery()
{
return $this->mySQLlastQuery;
}
private function setSQLMode()
{
$this->db_Query("SET SESSION sql_mode='NO_ENGINE_SUBSTITUTION';");
}
@ -2554,7 +2567,6 @@ class e_db_pdo implements e_db
$this->db_Query("SET NAMES `$charset`");
$this->mySQLcharset = $charset;
}
@ -2563,6 +2575,25 @@ class e_db_pdo implements e_db
return $this->mySQLcharset;
}
/**
* Set the database language
* @param string $lang French, German etc.
*/
public function setLanguage($lang)
{
$this->mySQLlanguage = $lang;
}
/**
* Get the current database language. eg. English, French etc.
* @return string
*/
public function getLanguage()
{
return $this->mySQLlanguage;
}
/**
* Get the _FIELD_DEFS and _NOTNULL definitions for a table
*<code>