Thomas B.
2014-04-18 8087b13d20019b506b701bc8f5e5d6d2a0fa6a54
Merge pull request #176 from marcoliverteschke/master

Limit list_tables() and list_cols() to current schema
1 files modified
7 ■■■■■ changed files
program/lib/Roundcube/rcube_db.php 7 ●●●●● patch | view | raw | blame | history
program/lib/Roundcube/rcube_db.php
@@ -609,7 +609,8 @@
    {
        // 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 @@
     */
    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);