summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas B. <thomas@roundcube.net>2014-04-18 13:26:55 +0200
committerThomas B. <thomas@roundcube.net>2014-04-18 13:26:55 +0200
commit8087b13d20019b506b701bc8f5e5d6d2a0fa6a54 (patch)
tree95ec1ee59ae73a5bc03c2b07eb88f4c8fdd2cc53
parent7bd684f918d878070f6e4943b275d75dad0e0813 (diff)
parent78a58162d8e9c46a90c8406605f4e58bd6ca54fe (diff)
Merge pull request #176 from marcoliverteschke/master
Limit list_tables() and list_cols() to current schema
-rw-r--r--program/lib/Roundcube/rcube_db.php7
1 files changed, 4 insertions, 3 deletions
diff --git a/program/lib/Roundcube/rcube_db.php b/program/lib/Roundcube/rcube_db.php
index 2828f26ee..a2271fd6d 100644
--- a/program/lib/Roundcube/rcube_db.php
+++ b/program/lib/Roundcube/rcube_db.php
@@ -609,7 +609,8 @@ class rcube_db
{
// get tables if not cached
if ($this->tables === null) {
- $q = $this->query('SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES ORDER BY TABLE_NAME');
+ $q = $this->query('SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = ? ORDER BY TABLE_NAME',
+ array($this->db_dsnw_array['database']));
if ($q) {
$this->tables = $q->fetchAll(PDO::FETCH_COLUMN, 0);
@@ -631,8 +632,8 @@ class rcube_db
*/
public function list_cols($table)
{
- $q = $this->query('SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = ?',
- array($table));
+ $q = $this->query('SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = ? AND TABLE_SCHEMA = ?',
+ array($table, $this->db_dsnw_array['database']));
if ($q) {
return $q->fetchAll(PDO::FETCH_COLUMN, 0);