Skip to content

Commit

Permalink
Merge pull request phpmyadmin#313 from kasunchathuranga/DBI_naming_cl…
Browse files Browse the repository at this point in the history
…eanUp2

Function naming made compliant with PEAR standards V2
  • Loading branch information
nijel committed May 6, 2013
2 parents c3c5db6 + 53d7c58 commit 4126b11
Show file tree
Hide file tree
Showing 95 changed files with 524 additions and 523 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ phpMyAdmin - ChangeLog
+ PMA_DBI functions in database_interface.lib.php renamed to be compliant with PEAR standards
+ [interface] Make warning about existing config directory clearer
+ rfe #1414 Allow specifying controlport
+ PMA_DBI functions in database interface libraries renamed to be compliant with PEAR standards

4.0.1.0 (not yet released)
- bug #3879 Import broken for CSV using LOAD DATA
Expand Down
4 changes: 2 additions & 2 deletions db_datadict.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
/**
* Selects the database and gets tables names
*/
PMA_DBI_select_db($db);
PMA_DBI_selectDb($db);
$tables = PMA_DBI_getTables($db);

$count = 0;
Expand All @@ -76,7 +76,7 @@
* Gets table keys and retains them
*/

PMA_DBI_select_db($db);
PMA_DBI_selectDb($db);
$indexes = PMA_DBI_getTableIndexes($db, $table);
$primary = '';
$indexes = array();
Expand Down
4 changes: 2 additions & 2 deletions db_operations.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
PMA_runProcedureAndFunctionDefinitions($db);

// go back to current db, just in case
PMA_DBI_select_db($db);
PMA_DBI_selectDb($db);

$tables_full = PMA_DBI_getTablesFull($db);

Expand Down Expand Up @@ -109,7 +109,7 @@
}

// go back to current db, just in case
PMA_DBI_select_db($db);
PMA_DBI_selectDb($db);

// Duplicate the bookmarks for this db (done once for each db)
PMA_duplicateBookmarks($_error, $db);
Expand Down
20 changes: 10 additions & 10 deletions db_printview.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,28 +37,28 @@
if ($cfg['SkipLockedTables'] == true) {
$result = PMA_DBI_query('SHOW OPEN TABLES FROM ' . PMA_Util::backquote($db) . ';');
// Blending out tables in use
if ($result != false && PMA_DBI_num_rows($result) > 0) {
while ($tmp = PMA_DBI_fetch_row($result)) {
if ($result != false && PMA_DBI_numRows($result) > 0) {
while ($tmp = PMA_DBI_fetchRow($result)) {
// if in use memorize tablename
if (preg_match('@in_use=[1-9]+@i', $tmp[0])) {
$sot_cache[$tmp[0]] = true;
}
}
PMA_DBI_free_result($result);
PMA_DBI_freeResult($result);
if (isset($sot_cache)) {
$result = PMA_DBI_query('SHOW TABLES FROM ' . PMA_Util::backquote($db) . ';', null, PMA_DBI_QUERY_STORE);
if ($result != false && PMA_DBI_num_rows($result) > 0) {
while ($tmp = PMA_DBI_fetch_row($result)) {
if ($result != false && PMA_DBI_numRows($result) > 0) {
while ($tmp = PMA_DBI_fetchRow($result)) {
if (! isset($sot_cache[$tmp[0]])) {
$sts_result = PMA_DBI_query('SHOW TABLE STATUS FROM ' . PMA_Util::backquote($db) . ' LIKE \'' . sqlAddSlashes($tmp[0], true) . '\';');
$sts_tmp = PMA_DBI_fetch_assoc($sts_result);
$sts_tmp = PMA_DBI_fetchAssoc($sts_result);
$tables[] = $sts_tmp;
} else { // table in use
$tables[] = array('Name' => $tmp[0]);
}
}
PMA_DBI_free_result($result);
PMA_DBI_freeResult($result);
$sot_ready = true;
}
}
Expand All @@ -68,11 +68,11 @@
if (! isset($sot_ready)) {
$result = PMA_DBI_query('SHOW TABLE STATUS FROM ' . PMA_Util::backquote($db) . ';');
if (PMA_DBI_num_rows($result) > 0) {
while ($sts_tmp = PMA_DBI_fetch_assoc($result)) {
if (PMA_DBI_numRows($result) > 0) {
while ($sts_tmp = PMA_DBI_fetchAssoc($result)) {
$tables[] = $sts_tmp;
}
PMA_DBI_free_result($result);
PMA_DBI_freeResult($result);
unset($res);
}
}
Expand Down
6 changes: 3 additions & 3 deletions db_tracking.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
$all_tables_result = PMA_queryAsControlUser($all_tables_query);

// If a HEAD version exists
if (PMA_DBI_num_rows($all_tables_result) > 0) {
if (PMA_DBI_numRows($all_tables_result) > 0) {
?>
<div id="tracked_tables">
<h3><?php echo __('Tracked tables');?></h3>
Expand Down Expand Up @@ -104,7 +104,7 @@
}

$style = 'odd';
while ($one_result = PMA_DBI_fetch_array($all_tables_result)) {
while ($one_result = PMA_DBI_fetchArray($all_tables_result)) {
list($table_name, $version_number) = $one_result;
$table_query = ' SELECT * FROM ' .
PMA_Util::backquote($GLOBALS['cfg']['Server']['pmadb']) . '.' .
Expand All @@ -114,7 +114,7 @@
. '\' AND `version` = \'' . $version_number . '\'';

$table_result = PMA_queryAsControlUser($table_query);
$version_data = PMA_DBI_fetch_array($table_result);
$version_data = PMA_DBI_fetchArray($table_result);

if ($version_data['tracking_active'] == 1) {
$version_status = __('active');
Expand Down
2 changes: 1 addition & 1 deletion export.php
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,7 @@ function PMA_exportOutputHandler($line)
$sql_query = preg_replace('%;\s*$%', '', $sql_query);
}
$local_query = $sql_query . $add_query;
PMA_DBI_select_db($db);
PMA_DBI_selectDb($db);
} else {
$local_query = 'SELECT * FROM ' . PMA_Util::backquote($db)
. '.' . PMA_Util::backquote($table) . $add_query;
Expand Down
2 changes: 1 addition & 1 deletion import.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@


if (strlen($db)) {
PMA_DBI_select_db($db);
PMA_DBI_selectDb($db);
}

@set_time_limit($cfg['ExecTimeLimit']);
Expand Down
12 changes: 6 additions & 6 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
}
}
if ($GLOBALS['cfg']['ShowServerInfo'] || empty($cfg['Server']['verbose'])) {
$server_info .= PMA_DBI_get_host_info();
$server_info .= PMA_DBI_getHostInfo();
}
if (! empty($cfg['Server']['verbose']) && $GLOBALS['cfg']['ShowServerInfo']) {
$server_info .= ')';
Expand Down Expand Up @@ -245,7 +245,7 @@
'li_server_version'
);
PMA_printListItem(
__('Protocol version:') . ' ' . PMA_DBI_get_proto_info(),
__('Protocol version:') . ' ' . PMA_DBI_getProtoInfo(),
'li_mysql_proto'
);
PMA_printListItem(
Expand All @@ -272,7 +272,7 @@
PMA_printListItem($_SERVER['SERVER_SOFTWARE'], 'li_web_server_software');

if ($server > 0) {
$client_version_str = PMA_DBI_get_client_info();
$client_version_str = PMA_DBI_getClientInfo();
if (preg_match('#\d+\.\d+\.\d+#', $client_version_str)
&& in_array($GLOBALS['cfg']['Server']['extension'], array('mysql', 'mysqli'))
) {
Expand Down Expand Up @@ -486,12 +486,12 @@
* (a difference on the third digit does not count).
* If someday there is a constant that we can check about mysqlnd,
* we can use it instead of strpos().
* If no default server is set, PMA_DBI_get_client_info() is not defined yet.
* If no default server is set, PMA_DBI_getClientInfo() is not defined yet.
* Drizzle can speak MySQL protocol, so don't warn about version mismatch for
* Drizzle servers.
*/
if (function_exists('PMA_DBI_get_client_info') && !PMA_DRIZZLE) {
$_client_info = PMA_DBI_get_client_info();
if (function_exists('PMA_DBI_getClientInfo') && !PMA_DRIZZLE) {
$_client_info = PMA_DBI_getClientInfo();
if ($server > 0
&& strpos($_client_info, 'mysqlnd') === false
&& substr(PMA_MYSQL_CLIENT_API, 0, 3) != substr(PMA_MYSQL_INT_VERSION, 0, 3)
Expand Down
8 changes: 4 additions & 4 deletions libraries/DBQbe.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -263,13 +263,13 @@ private function _setCriteriaTablesAndColumns()
null,
PMA_DBI_QUERY_STORE
);
$all_tables_count = PMA_DBI_num_rows($all_tables);
$all_tables_count = PMA_DBI_numRows($all_tables);
if (0 == $all_tables_count) {
PMA_Message::error(__('No tables found in database.'))->display();
exit;
}
// The tables list gets from MySQL
while (list($table) = PMA_DBI_fetch_row($all_tables)) {
while (list($table) = PMA_DBI_fetchRow($all_tables)) {
$columns = PMA_DBI_getColumns($this->_db, $table);

if (empty($this->_criteriaTables[$table])
Expand All @@ -296,7 +296,7 @@ private function _setCriteriaTablesAndColumns()
} // end foreach
} // end if
} // end while
PMA_DBI_free_result($all_tables);
PMA_DBI_freeResult($all_tables);

// sets the largest width found
$this->_realwidth = $this->_form_column_width . 'ex';
Expand Down Expand Up @@ -1065,7 +1065,7 @@ private function _getIndexes($all_tables, $all_columns,
private function _getLeftJoinColumnCandidates($all_tables, $all_columns,
$where_clause_columns
) {
PMA_DBI_select_db($this->_db);
PMA_DBI_selectDb($this->_db);
$candidate_columns = array();

// Get unique columns and index columns
Expand Down
4 changes: 2 additions & 2 deletions libraries/DbSearch.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ private function _setSearchParams()
*
* @todo can we make use of fulltextsearch IN BOOLEAN MODE for this?
* PMA_backquote
* PMA_DBI_free_result
* PMA_DBI_fetch_assoc
* PMA_DBI_freeResult
* PMA_DBI_fetchAssoc
* $GLOBALS['db']
* explode
* count
Expand Down
26 changes: 13 additions & 13 deletions libraries/DisplayResults.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -2509,7 +2509,7 @@ private function _getTableBody(
|| ($_SESSION['tmp_user_values']['disp_direction']
== self::DISP_DIR_HORIZONTAL_FLIPPED);

while ($row = PMA_DBI_fetch_row($dt_result)) {
while ($row = PMA_DBI_fetchRow($dt_result)) {

// "vertical display" mode stuff
$table_body_html .= $this->_getVerticalDisplaySupportSegments(
Expand Down Expand Up @@ -2860,7 +2860,7 @@ private function _getRowValues(

// PMA_mysql_fetch_fields returns BLOB in place of
// TEXT fields type so we have to ensure it's really a BLOB
$field_flags = PMA_DBI_field_flags($dt_result, $i);
$field_flags = PMA_DBI_fieldFlags($dt_result, $i);

$vertical_display['data'][$row_no][$i]
= $this->_getDataCellForBlobColumns(
Expand Down Expand Up @@ -3839,7 +3839,7 @@ private function _getDataCellForNonNumericAndNonBlobColumns(
) {

$is_analyse = $this->__get('is_analyse');
$field_flags = PMA_DBI_field_flags($dt_result, $col_index);
$field_flags = PMA_DBI_fieldFlags($dt_result, $col_index);
if (stristr($field_flags, self::BINARY_FIELD)
&& ($GLOBALS['cfg']['ProtectBinary'] == 'all'
|| $GLOBALS['cfg']['ProtectBinary'] == 'noblob')
Expand Down Expand Up @@ -4773,7 +4773,7 @@ private function _getSortedColumnMessage(
if ($sorted_column_index !== false) {

// fetch first row of the result set
$row = PMA_DBI_fetch_row($dt_result);
$row = PMA_DBI_fetchRow($dt_result);

// initializing default arguments
$default_function = '_mimeDefaultFunction';
Expand Down Expand Up @@ -4802,8 +4802,8 @@ private function _getSortedColumnMessage(
);

// fetch last row of the result set
PMA_DBI_data_seek($dt_result, $this->__get('num_rows') - 1);
$row = PMA_DBI_fetch_row($dt_result);
PMA_DBI_dataSeek($dt_result, $this->__get('num_rows') - 1);
$row = PMA_DBI_fetchRow($dt_result);

// check for non printable sorted row data
$meta = $fields_meta[$sorted_column_index];
Expand All @@ -4826,7 +4826,7 @@ private function _getSortedColumnMessage(
);

// reset to first row for the loop in _getTableBody()
PMA_DBI_data_seek($dt_result, 0);
PMA_DBI_dataSeek($dt_result, 0);

// we could also use here $sort_expression_nodirection
return ' [' . htmlspecialchars($sort_column)
Expand Down Expand Up @@ -5073,8 +5073,8 @@ private function _getMultiRowOperationLinks(
}

// fetch last row of the result set
PMA_DBI_data_seek($dt_result, $this->__get('num_rows') - 1);
$row = PMA_DBI_fetch_row($dt_result);
PMA_DBI_dataSeek($dt_result, $this->__get('num_rows') - 1);
$row = PMA_DBI_fetchRow($dt_result);

// $clause_is_unique is needed by getTable() to generate the proper param
// in the multi-edit and multi-delete form
Expand All @@ -5087,7 +5087,7 @@ private function _getMultiRowOperationLinks(
);

// reset to first row for the loop in _getTableBody()
PMA_DBI_data_seek($dt_result, 0);
PMA_DBI_dataSeek($dt_result, 0);

$links_html .= '<input type="hidden" name="clause_is_unique"'
.' value="' . $clause_is_unique . '" />' . "\n";
Expand Down Expand Up @@ -5511,13 +5511,13 @@ private function _getRowData(

$dispresult = PMA_DBI_tryQuery($dispsql, null, PMA_DBI_QUERY_STORE);

if ($dispresult && PMA_DBI_num_rows($dispresult) > 0) {
list($dispval) = PMA_DBI_fetch_row($dispresult, 0);
if ($dispresult && PMA_DBI_numRows($dispresult) > 0) {
list($dispval) = PMA_DBI_fetchRow($dispresult, 0);
} else {
$dispval = __('Link not found');
}

@PMA_DBI_free_result($dispresult);
@PMA_DBI_freeResult($dispresult);

} else {
$dispval = '';
Expand Down
2 changes: 1 addition & 1 deletion libraries/Error.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ protected function getArg($arg, $function)
'mysqli_connect',
'mysqli_real_connect',
'PMA_DBI_connect',
'PMA_DBI_real_connect',
'PMA_DBI_realConnect',
);

if (in_array($function, $include_functions)) {
Expand Down
12 changes: 6 additions & 6 deletions libraries/List_Database.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -455,11 +455,11 @@ protected function checkAgainstPrivTables()
$tmp_alldbs = PMA_DBI_query('SHOW DATABASES;', $GLOBALS['controllink']);
// all databases cases - part 2
if (isset($tmp_mydbs['%'])) {
while ($tmp_row = PMA_DBI_fetch_row($tmp_alldbs)) {
while ($tmp_row = PMA_DBI_fetchRow($tmp_alldbs)) {
$dblist[] = $tmp_row[0];
} // end while
} else {
while ($tmp_row = PMA_DBI_fetch_row($tmp_alldbs)) {
while ($tmp_row = PMA_DBI_fetchRow($tmp_alldbs)) {
$tmp_db = $tmp_row[0];
if (isset($tmp_mydbs[$tmp_db]) && $tmp_mydbs[$tmp_db] == 1) {
$dblist[] = $tmp_db;
Expand Down Expand Up @@ -489,7 +489,7 @@ protected function checkAgainstPrivTables()
} // end if ... elseif ...
} // end while
} // end else
PMA_DBI_free_result($tmp_alldbs);
PMA_DBI_freeResult($tmp_alldbs);
unset($tmp_mydbs);
} // end if

Expand All @@ -499,13 +499,13 @@ protected function checkAgainstPrivTables()
$local_query .= ' AND `User` = \'';
$local_query .= PMA_Util::sqlAddSlashes($GLOBALS['cfg']['Server']['user']) . '\'';
$rs = PMA_DBI_tryQuery($local_query, $GLOBALS['controllink']);
if ($rs && @PMA_DBI_num_rows($rs)) {
while ($row = PMA_DBI_fetch_assoc($rs)) {
if ($rs && @PMA_DBI_numRows($rs)) {
while ($row = PMA_DBI_fetchAssoc($rs)) {
if (!in_array($row['Db'], $dblist)) {
$dblist[] = $row['Db'];
}
} // end while
PMA_DBI_free_result($rs);
PMA_DBI_freeResult($rs);
} // end if
}
}
Expand Down
2 changes: 1 addition & 1 deletion libraries/RecentTable.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function getFromDb()
= " SELECT `tables` FROM " . $this->_pmaTable .
" WHERE `username` = '" . $GLOBALS['cfg']['Server']['user'] . "'";

$row = PMA_DBI_fetch_array(PMA_queryAsControlUser($sql_query));
$row = PMA_DBI_fetchArray(PMA_queryAsControlUser($sql_query));
if (isset($row[0])) {
return json_decode($row[0], true);
} else {
Expand Down
4 changes: 2 additions & 2 deletions libraries/StorageEngine.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ function getVariablesStatus()

$sql_query = 'SHOW GLOBAL VARIABLES ' . $like . ';';
$res = PMA_DBI_query($sql_query);
while ($row = PMA_DBI_fetch_assoc($res)) {
while ($row = PMA_DBI_fetchAssoc($res)) {
if (isset($variables[$row['Variable_name']])) {
$mysql_vars[$row['Variable_name']] = $variables[$row['Variable_name']];
} elseif (! $like
Expand All @@ -279,7 +279,7 @@ function getVariablesStatus()
= PMA_ENGINE_DETAILS_TYPE_PLAINTEXT;
}
}
PMA_DBI_free_result($res);
PMA_DBI_freeResult($res);

return $mysql_vars;
}
Expand Down
Loading

0 comments on commit 4126b11

Please sign in to comment.