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ߏ:e3ҞYR#'-+r?jkeoA~NxRd3zG:~LhHtnS|dĶ9fQH?gqY eZ\ 1M:8(~nl$d>&4anz/?xBEHSݸHp4]Anٴvb @CA5z|ʬj !pNp\wA6K:eQثwo L)҃ }H4+Ķ9fQH?gqY eZA"g0M <$d>&4anz/?xB s=FF"@Yx7nbt*Vla1 @CA5z|ʬj0}gg-G̓,n!iYGaI?V' {RmqLV3K 1&rJidPE_:ʰCz?6[:C܁=Ǒn4VU[# a qXYy1ܳ;K}S1Ѹ['kJܖ,A\?& 񰢊-1yrqn$e lIJTr#u@htׂiPT91ڏX:F2fVy)9m| =`dP8Ŀx8!ln8xtëu6 dzzY'#Qثwo 뀺5 HҙxOw 8ja-aHt\\fK1.l!>a/0iYK#V N%ᑠ#RKFE޿{TAi[ Q.LoV~&83Uc*ʼ>7a)statements $result[PDO::ATTR_EMULATE_PREPARES] = false; return $result; } /** * Returns list of tables in a database * * @return array List of all tables of the current database */ public function list_tables() { // get tables if not cached if ($this->tables === null) { $q = $this->query("SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES" . " WHERE TABLE_SCHEMA = ? AND TABLE_TYPE = 'BASE TABLE'" . " ORDER BY TABLE_NAME", $this->db_dsnw_array['database']); $this->tables = $q ? $q->fetchAll(PDO::FETCH_COLUMN, 0) : []; } return $this->tables; } /** * Returns list of columns in database table * * @param string $table Table name * * @return array List of table cols */ public function list_cols($table) { $q = $this->query("SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS" . " WHERE TABLE_SCHEMA = ? AND TABLE_NAME = ?", $this->db_dsnw_array['database'], $table); if ($q) { return $q->fetchAll(PDO::FETCH_COLUMN, 0); } return []; } /** * Get database runtime variables * * @param string $varname Variable name * @param mixed $default Default value if variable is not set * * @return mixed Variable value or default */ public function get_variable($varname, $default = null) { if (!isset($this->variables)) { $this->variables = []; } if (array_key_exists($varname, $this->variables)) { return $this->variables[$varname]; } // configured value has higher prio $conf_value = rcube::get_instance()->config->get('db_' . $varname); if ($conf_value !== null) { return $this->variables[$varname] = $conf_value; } $result = $this->query('SHOW VARIABLES LIKE ?', $varname); while ($row = $this->fetch_array($result)) { $this->variables[$row[0]] = $row[1]; } // not found, use default if (!isset($this->variables[$varname])) { $this->variables[$varname] = $default; } return $this->variables[$varname]; } /** * INSERT ... ON DUPLICATE KEY UPDATE (or equivalent). * When not supported by the engine we do UPDATE and INSERT. * * @param string $table Table name (should be already passed via table_name() with quoting) * @param array $keys Hash array (column => value) of the unique constraint * @param array $columns List of columns to update * @param array $values List of values to update (number of elements * should be the same as in $columns) * * @return PDOStatement|bool Query handle or False on error * @todo Multi-insert support */ public function insert_or_update($table, $keys, $columns, $values) { $columns = array_map(function($i) { return "`$i`"; }, $columns); $cols = implode(', ', array_map(function($i) { return "`$i`"; }, array_keys($keys))); $cols .= ', ' . implode(', ', $columns); $vals = implode(', ', array_map(function($i) { return $this->quote($i); }, $keys)); $vals .= ', ' . rtrim(str_repeat('?, ', count($columns)), ', '); $update = implode(', ', array_map(function($i) { return "$i = VALUES($i)"; }, $columns)); return $this->query("INSERT INTO $table ($cols) VALUES ($vals)" . " ON DUPLICATE KEY UPDATE $update", $values); } }