diff --git a/libraries/Table.class.php b/libraries/Table.class.php index d17f69c72e..fec4f1d419 100644 --- a/libraries/Table.class.php +++ b/libraries/Table.class.php @@ -169,7 +169,8 @@ class PMA_Table */ function getFullName($backquoted = false) { - return $this->getDbName($backquoted) . '.' . $this->getName($backquoted); + return $this->getDbName($backquoted) . '.' + . $this->getName($backquoted); } /** @@ -187,7 +188,8 @@ class PMA_Table } // use cached data or load information with SHOW command - if (isset(PMA_Table::$cache[$db][$table]) || $GLOBALS['cfg']['Server']['DisableIS']) { + if (isset(PMA_Table::$cache[$db][$table]) + || $GLOBALS['cfg']['Server']['DisableIS']) { $type = PMA_Table::sGetStatusInfo($db, $table, 'TABLE_TYPE'); return $type == 'VIEW'; } @@ -239,7 +241,10 @@ class PMA_Table */ function loadStructure() { - $table_info = PMA_DBI_get_tables_full($this->getDbName(), $this->getName()); + $table_info = PMA_DBI_get_tables_full( + $this->getDbName(), + $this->getName() + ); if (false === $table_info) { return false; @@ -250,13 +255,17 @@ class PMA_Table if ($this->get('TABLE_ROWS') === null) { $this->set( 'TABLE_ROWS', - PMA_Table::countRecords($this->getDbName(), $this->getName(), true) + PMA_Table::countRecords( + $this->getDbName(), + $this->getName(), + true + ) ); } $create_options = explode(' ', $this->get('TABLE_ROWS')); - // export create options by its name as variables into gloabel namespace + // export create options by its name as variables into global namespace // f.e. pack_keys=1 becomes available as $pack_keys with value of '1' foreach ($create_options as $each_create_option) { $each_create_option = explode('=', $each_create_option); @@ -283,7 +292,8 @@ class PMA_Table $engine = null; // if called static, with parameters if (! empty($db) && ! empty($table)) { - $engine = PMA_Table::sGetStatusInfo($db, $table, 'ENGINE', null, true); + $engine = PMA_Table::sGetStatusInfo( + $db, $table, 'ENGINE', null, true); } return (! empty($engine) && ((strtoupper($engine) == 'MERGE') || (strtoupper($engine) == 'MRG_MYISAM'))); @@ -292,7 +302,8 @@ class PMA_Table static public function sGetToolTip($db, $table) { return PMA_Table::sGetStatusInfo($db, $table, 'Comment') - . ' (' . PMA_Table::countRecords($db, $table) . ' ' . __('Rows') . ')'; + . ' (' . PMA_Table::countRecords($db, $table) + . ' ' . __('Rows') . ')'; } /** @@ -330,7 +341,10 @@ class PMA_Table // array_key_exists allows for null values if (!array_key_exists($info, PMA_Table::$cache[$db][$table])) { if (! $disable_error) { - trigger_error(__('unknown table status: ') . $info, E_USER_WARNING); + trigger_error( + __('unknown table status: ') . $info, + E_USER_WARNING + ); } return false; } @@ -349,15 +363,16 @@ class PMA_Table * @param bool|string $null with 'NULL' or 'NOT NULL' * @param string $default_type whether default is CURRENT_TIMESTAMP, * NULL, NONE, USER_DEFINED - * @param string $default_value default value for USER_DEFINED default type + * @param string $default_value default value for USER_DEFINED + * default type * @param string $extra 'AUTO_INCREMENT' * @param string $comment field comment * @param array &$field_primary list of fields for PRIMARY KEY * @param string $index * * @todo move into class PMA_Column - * @todo on the interface, some js to clear the default value when the default - * current_timestamp is checked + * @todo on the interface, some js to clear the default value when the + * default current_timestamp is checked * * @return string field specification */ @@ -514,8 +529,9 @@ class PMA_Table // for a VIEW, $row_count is always false at this point if (false === $row_count || $row_count < $GLOBALS['cfg']['MaxExactCount']) { - // Make an exception for views in I_S and D_D schema in Drizzle, as these map to - // in-memory data and should execute fast enough + // Make an exception for views in I_S and D_D schema in + // Drizzle, as these map to in-memory data and should execute + // fast enough if (! $is_view || (PMA_DRIZZLE && PMA_is_system_schema($db))) { $row_count = PMA_DBI_fetch_value( 'SELECT COUNT(*) FROM ' . PMA_backquote($db) . '.' @@ -530,8 +546,8 @@ class PMA_Table if ($GLOBALS['cfg']['MaxExactCountViews'] == 0) { $row_count = 0; } else { - // Counting all rows of a VIEW could be too long, so use - // a LIMIT clause. + // Counting all rows of a VIEW could be too long, + // so use a LIMIT clause. // Use try_query because it can fail (when a VIEW is // based on a table that no longer exists) $result = PMA_DBI_try_query( @@ -590,17 +606,19 @@ class PMA_Table } // end function /** - * Inserts existing entries in a PMA_* table by reading a value from an old entry + * Inserts existing entries in a PMA_* table by reading a value from an old + * entry * - * @param string $work The array index, which Relation feature to check - * ('relwork', 'commwork', ...) + * @param string $work The array index, which Relation feature to + * check ('relwork', 'commwork', ...) * @param string $pma_table The array index, which PMA-table to update * ('bookmark', 'relation', ...) * @param array $get_fields Which fields will be SELECT'ed from the old entry * @param array $where_fields Which fields will be used for the WHERE query * (array('FIELDNAME' => 'FIELDVALUE')) - * @param array $new_fields Which fields will be used as new VALUES. These are - * the important keys which differ from the old entry + * @param array $new_fields Which fields will be used as new VALUES. + * These are the important keys which differ + * from the old entry * (array('FIELDNAME' => 'NEW FIELDVALUE')) * * @global relation variable @@ -836,7 +854,8 @@ class PMA_Table $parsed_sql = PMA_SQP_parse($GLOBALS['sql_constraints_query']); $i = 0; - // find the first $table_delimiter, it must be the source table name + // find the first $table_delimiter, it must be the source + // table name while ($parsed_sql[$i]['type'] != $table_delimiter) { $i++; // maybe someday we should guard against going over limit @@ -845,11 +864,13 @@ class PMA_Table //} } - // replace it by the target table name, no need to PMA_backquote() + // replace it by the target table name, no need + // to PMA_backquote() $parsed_sql[$i]['data'] = $target; - // now we must remove all $table_delimiter that follow a CONSTRAINT - // keyword, because a constraint name must be unique in a db + // now we must remove all $table_delimiter that follow a + // CONSTRAINT keyword, because a constraint name must be + // unique in a db $cnt = $parsed_sql['len'] - 1; @@ -887,7 +908,8 @@ class PMA_Table PMA_DBI_query($sql_set_mode); $GLOBALS['sql_query'] .= "\n\n" . $sql_set_mode . ';'; - $sql_insert_data = 'INSERT INTO ' . $target . ' SELECT * FROM ' . $source; + $sql_insert_data = 'INSERT INTO ' . $target + . ' SELECT * FROM ' . $source; PMA_DBI_query($sql_insert_data); $GLOBALS['sql_query'] .= "\n\n" . $sql_insert_data . ';'; } @@ -920,8 +942,8 @@ class PMA_Table unset($remove_query); } - // updating bookmarks is not possible since only a single table is moved, - // and not the whole DB. + // updating bookmarks is not possible since only a single table is + // moved, and not the whole DB. if ($GLOBALS['cfgRelation']['displaywork']) { $table_query = 'UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($GLOBALS['cfgRelation']['table_info']) @@ -1286,8 +1308,16 @@ class PMA_Table */ public function getUniqueColumns($backquoted = true) { - $sql = PMA_DBI_get_table_indexes_sql($this->getDbName(), $this->getName(), 'Non_unique = 0'); - $uniques = PMA_DBI_fetch_result($sql, array('Key_name', null), 'Column_name'); + $sql = PMA_DBI_get_table_indexes_sql( + $this->getDbName(), + $this->getName(), + 'Non_unique = 0' + ); + $uniques = PMA_DBI_fetch_result( + $sql, + array('Key_name', null), + 'Column_name' + ); $return = array(); foreach ($uniques as $index) { @@ -1315,7 +1345,11 @@ class PMA_Table */ public function getIndexedColumns($backquoted = true) { - $sql = PMA_DBI_get_table_indexes_sql($this->getDbName(), $this->getName(), 'Seq_in_index = 1'); + $sql = PMA_DBI_get_table_indexes_sql( + $this->getDbName(), + $this->getName(), + 'Seq_in_index = 1' + ); $indexed = PMA_DBI_fetch_result($sql, 'Column_name', 'Column_name'); $return = array(); @@ -1401,7 +1435,8 @@ class PMA_Table return $message; } - // Remove some old rows in table_uiprefs if it exceeds the configured maximum rows + // Remove some old rows in table_uiprefs if it exceeds the configured + // maximum rows $sql_query = 'SELECT COUNT(*) FROM ' . $pma_table; $rows_count = PMA_DBI_fetch_value($sql_query); $max_rows = $GLOBALS['cfg']['Server']['MaxTableUiprefs']; diff --git a/libraries/dbi/drizzle.dbi.lib.php b/libraries/dbi/drizzle.dbi.lib.php index 457bc291de..e47e15691b 100644 --- a/libraries/dbi/drizzle.dbi.lib.php +++ b/libraries/dbi/drizzle.dbi.lib.php @@ -28,15 +28,15 @@ if (!defined('PMA_MYSQL_CLIENT_API')) { /** * Helper function for connecting to the database server * - * @param PMA_Drizzle $drizzle - * @param string $host - * @param int $port - * @param string $uds - * @param string $user - * @param string $password - * @param string $db - * @param int $options - * @return PMA_DrizzleCon + * @param PMA_Drizzle $drizzle + * @param string $host + * @param int $port + * @param string $uds + * @param string $user + * @param string $password + * @param string $db + * @param int $options + * @return PMA_DrizzleCon */ function PMA_DBI_real_connect($drizzle, $host, $port, $uds, $user, $password, $db = null, $options = DRIZZLE_CON_NONE) { @@ -52,12 +52,12 @@ function PMA_DBI_real_connect($drizzle, $host, $port, $uds, $user, $password, $d /** * connects to the database server * - * @param string $user drizzle user name - * @param string $password drizzle user password - * @param bool $is_controluser - * @param array $server host/port/socket - * @param bool $auxiliary_connection (when true, don't go back to login if connection fails) - * @return mixed false on error or a mysqli object on success + * @param string $user drizzle user name + * @param string $password drizzle user password + * @param bool $is_controluser + * @param array $server host/port/socket + * @param bool $auxiliary_connection (when true, don't go back to login if connection fails) + * @return mixed false on error or a mysqli object on success */ function PMA_DBI_connect($user, $password, $is_controluser = false, $server = null, $auxiliary_connection = false) { @@ -134,8 +134,8 @@ function PMA_DBI_connect($user, $password, $is_controluser = false, $server = nu /** * selects given database * - * @param string $dbname database name to select - * @param PMA_DrizzleCom $link connection object + * @param string $dbname database name to select + * @param PMA_DrizzleCom $link connection object * @return bool */ function PMA_DBI_select_db($dbname, $link = null) @@ -153,10 +153,10 @@ function PMA_DBI_select_db($dbname, $link = null) /** * runs a query and returns the result * - * @param string $query query to execute - * @param PMA_DrizzleCon $link connection object - * @param int $options - * @return PMA_DrizzleResult + * @param string $query query to execute + * @param PMA_DrizzleCon $link connection object + * @param int $options + * @return PMA_DrizzleResult */ function PMA_DBI_real_query($query, $link, $options) { @@ -170,8 +170,8 @@ function PMA_DBI_real_query($query, $link, $options) /** * returns array of rows with associative and numeric keys from $result * - * @param PMA_DrizzleResult $result - * @return array + * @param PMA_DrizzleResult $result Drizzle result object + * @return array */ function PMA_DBI_fetch_array($result) { @@ -181,8 +181,8 @@ function PMA_DBI_fetch_array($result) /** * returns array of rows with associative keys from $result * - * @param PMA_DrizzleResult $result - * @return array + * @param PMA_DrizzleResult $result Drizzle result object + * @return array */ function PMA_DBI_fetch_assoc($result) { @@ -192,8 +192,8 @@ function PMA_DBI_fetch_assoc($result) /** * returns array of rows with numeric keys from $result * - * @param PMA_DrizzleResult $result - * @return array + * @param PMA_DrizzleResult $result Drizzle result object + * @return array */ function PMA_DBI_fetch_row($result) { @@ -203,9 +203,9 @@ function PMA_DBI_fetch_row($result) /** * Adjusts the result pointer to an arbitrary row in the result * - * @param PMA_DrizzleResult $result - * @param int $offset - * @return boolean true on success, false on failure + * @param PMA_DrizzleResult $result Drizzle result object + * @param int $offset + * @return boolean true on success, false on failure */ function PMA_DBI_data_seek($result, $offset) { @@ -215,7 +215,7 @@ function PMA_DBI_data_seek($result, $offset) /** * Frees memory associated with the result * - * @param PMA_DrizzleResult $result + * @param PMA_DrizzleResult $result */ function PMA_DBI_free_result($result) { @@ -227,7 +227,7 @@ function PMA_DBI_free_result($result) /** * Check if there are any more query results from a multi query * - * @return bool false + * @return bool false */ function PMA_DBI_more_results() { @@ -241,7 +241,7 @@ function PMA_DBI_more_results() /** * Prepare next result from multi_query * - * @return bool false + * @return bool false */ function PMA_DBI_next_result() { @@ -254,8 +254,8 @@ function PMA_DBI_next_result() /** * Returns a string representing the type of connection used - * @param PMA_DrizzleCon $link connection object - * @return string type of connection used + * @param PMA_DrizzleCon $link connection object + * @return string type of connection used */ function PMA_DBI_get_host_info($link = null) { @@ -275,8 +275,8 @@ function PMA_DBI_get_host_info($link = null) /** * Returns the version of the Drizzle protocol used - * @param PMA_DrizzleCon $link connection object - * @return int version of the Drizzle protocol used + * @param PMA_DrizzleCon $link connection object + * @return int version of the Drizzle protocol used */ function PMA_DBI_get_proto_info($link = null) { @@ -293,7 +293,7 @@ function PMA_DBI_get_proto_info($link = null) /** * returns a string that represents the client library version - * @return string Drizzle client library version + * @return string Drizzle client library version */ function PMA_DBI_get_client_info() { @@ -303,8 +303,8 @@ function PMA_DBI_get_client_info() /** * returns last error message or false if no errors occured * - * @param PMA_DrizzleCon $link connection object - * @return string|bool $error or false + * @param PMA_DrizzleCon $link connection object + * @return string|bool $error or false */ function PMA_DBI_getError($link = null) { @@ -343,8 +343,8 @@ function PMA_DBI_getError($link = null) /** * returns the number of rows returned by last query * - * @param PMA_DrizzleResult $result - * @return string|int + * @param PMA_DrizzleResult $result Drizzle result object + * @return string|int */ function PMA_DBI_num_rows($result) { @@ -359,8 +359,8 @@ function PMA_DBI_num_rows($result) /** * returns last inserted auto_increment id for given $link or $GLOBALS['userlink'] * - * @param PMA_DrizzleCon $link connection object - * @return string|int + * @param PMA_DrizzleCon $link connection object + * @return string|int */ function PMA_DBI_insert_id($link = null) { @@ -386,9 +386,9 @@ function PMA_DBI_insert_id($link = null) /** * returns the number of rows affected by last query * - * @param PMA_DrizzleResult $link connection object - * @param bool $get_from_cache - * @return string|int + * @param PMA_DrizzleResult $link connection object + * @param bool $get_from_cache + * @return string|int */ function PMA_DBI_affected_rows($link = null, $get_from_cache = true) { @@ -409,8 +409,8 @@ function PMA_DBI_affected_rows($link = null, $get_from_cache = true) /** * returns metainfo for fields in $result * - * @param PMA_DrizzleResult $result - * @return array meta info for fields in $result + * @param PMA_DrizzleResult $result Drizzle result object + * @return array meta info for fields in $result */ function PMA_DBI_get_fields_meta($result) { @@ -500,8 +500,8 @@ function PMA_DBI_get_fields_meta($result) /** * return number of fields in given $result * - * @param PMA_DrizzleResult $result - * @return int field count + * @param PMA_DrizzleResult $result Drizzle result object + * @return int field count */ function PMA_DBI_num_fields($result) { @@ -511,9 +511,9 @@ function PMA_DBI_num_fields($result) /** * returns the length of the given field $i in $result * - * @param PMA_DrizzleResult $result - * @param int $i field - * @return int length of field + * @param PMA_DrizzleResult $result Drizzle result object + * @param int $i field + * @return int length of field */ function PMA_DBI_field_len($result, $i) { @@ -524,9 +524,9 @@ function PMA_DBI_field_len($result, $i) /** * returns name of $i. field in $result * - * @param PMA_DrizzleResult $result - * @param int $i field - * @return string name of $i. field in $result + * @param PMA_DrizzleResult $result Drizzle result object + * @param int $i field + * @return string name of $i. field in $result */ function PMA_DBI_field_name($result, $i) { @@ -537,9 +537,9 @@ function PMA_DBI_field_name($result, $i) /** * returns concatenated string of human readable field flags * - * @param PMA_DrizzleResult $result - * @param int $i field - * @return string field flags + * @param PMA_DrizzleResult $result Drizzle result object + * @param int $i field + * @return string field flags */ function PMA_DBI_field_flags($result, $i) { @@ -576,7 +576,9 @@ function PMA_DBI_field_flags($result, $i) // structure. Watch out: some types like DATE returns 63 in charsetnr // so we have to check also the type. // Unfortunately there is no equivalent in the mysql extension. - if (($type == DRIZZLE_COLUMN_TYPE_DRIZZLE_BLOB || $type == DRIZZLE_COLUMN_TYPE_DRIZZLE_VARCHAR) && 63 == $charsetnr) { + if (($type == DRIZZLE_COLUMN_TYPE_DRIZZLE_BLOB + || $type == DRIZZLE_COLUMN_TYPE_DRIZZLE_VARCHAR) + && 63 == $charsetnr) { $flags .= 'binary '; } if ($f & DRIZZLE_COLUMN_FLAGS_ZEROFILL) {