From bfc06577ff24985c11d92d90933e68b9c3aebf82 Mon Sep 17 00:00:00 2001 From: DSB Date: Sat, 28 Jul 2012 20:27:25 +0000 Subject: [PATCH] SQL-Server / Show variables: - added column which outputs numeric values in human readable form (e.g. xx MB) MySQLi: - added option max_allowed_packet = 64MB at each connection for handling big blob fields (should be moved to general options array later on) --- .../scripts/sql-server/show-variables.phtml | 26 ++++++++++++++----- library/Msd/Db/Mysql.php | 4 +-- library/Msd/Db/Mysqli.php | 11 +++++--- 3 files changed, 30 insertions(+), 11 deletions(-) diff --git a/application/views/scripts/sql-server/show-variables.phtml b/application/views/scripts/sql-server/show-variables.phtml index a6526fe..c488267 100644 --- a/application/views/scripts/sql-server/show-variables.phtml +++ b/application/views/scripts/sql-server/show-variables.phtml @@ -19,20 +19,34 @@ # lang->L_NAME;?> lang->L_VALUE;?> + lang->L_INTERPRETED_AS_BYTES;?> getHelper('cycle')->cycle(array('row-even', 'row-odd')); - foreach ($this->variables as $name => $value) : ?> + foreach ($this->variables as $name => $value) { + if (strpos($value, ',') !== false) { + $value = str_replace(',', ', ', $value); + } + ?> . escape($name);?> escape($value);?> - - + byteOutput($value); + } else { + echo '-'; + } + ?> + + +


- \ No newline at end of file + diff --git a/library/Msd/Db/Mysql.php b/library/Msd/Db/Mysql.php index deab38c..d753469 100644 --- a/library/Msd/Db/Mysql.php +++ b/library/Msd/Db/Mysql.php @@ -38,7 +38,7 @@ class Msd_Db_Mysql extends Msd_Db_MysqlCommon * $this->_connectionHandle. * Returns true on success or false if connection couldn't be established. * - * @throws Exception + * @throws Msd_Exception * @return bool **/ protected function _dbConnect() @@ -124,7 +124,7 @@ class Msd_Db_Mysql extends Msd_Db_MysqlCommon * * Returns true if selection was succesfull otherwise false. * - * @throws Exception + * @throws Msd_Exception * @param string $database The database to select * * @return bool diff --git a/library/Msd/Db/Mysqli.php b/library/Msd/Db/Mysqli.php index d30ae7b..00dbf05 100644 --- a/library/Msd/Db/Mysqli.php +++ b/library/Msd/Db/Mysqli.php @@ -31,6 +31,8 @@ class Msd_Db_Mysqli extends Msd_Db_MysqlCommon * Create a connection to MySQL and store the connection handle in * $this->connectionHandle. * + * @throws Msd_Exception + * * @return boolean **/ protected function _dbConnect() @@ -49,6 +51,8 @@ class Msd_Db_Mysqli extends Msd_Db_MysqlCommon $this->_socket ); error_reporting($errorReporting); + $this->_mysqli->init(); + $this->_mysqli->options(MYSQLI_READ_DEFAULT_GROUP, 'max_allowed_packet=64M'); if ($this->_mysqli->connect_errno) { $error = $this->_mysqli->connect_error; $errno = $this->_mysqli->connect_errno; @@ -141,8 +145,8 @@ class Msd_Db_Mysqli extends Msd_Db_MysqlCommon * is returned. * * @param string $query The query to execute - * @param const $kind Type of result set - * @param boolean $getRows Wether to fetch all rows and return them + * @param int $kind Type of result set + * @param boolean $getRows Whether to fetch all rows and return them * * @return resource|array */ @@ -183,7 +187,7 @@ class Msd_Db_Mysqli extends Msd_Db_MysqlCommon * * Can be used to walk through result sets. * - * @param const $kind + * @param int $kind * * @return array|object */ @@ -197,6 +201,7 @@ class Msd_Db_Mysqli extends Msd_Db_MysqlCommon return $this->_resultHandle->fetch_object(); break; case self::ARRAY_NUMERIC: + default: return $this->_resultHandle->fetch_array(MYSQLI_NUM); break; }