The branch, master has been updated via 3d007a60979b3c413cc43c55641ec9af12f5f0d9 (commit) from b40fdde6e811631a44622fe5bad851febe449079 (commit)
- Log ----------------------------------------------------------------- commit 3d007a60979b3c413cc43c55641ec9af12f5f0d9 Author: Michal Čihař mcihar@suse.cz Date: Thu Jul 21 11:17:42 2011 +0200
Whitespace cleanup
-----------------------------------------------------------------------
Summary of changes: libraries/server_synchronize.lib.php | 64 +++++++++++++++++----------------- 1 files changed, 32 insertions(+), 32 deletions(-)
diff --git a/libraries/server_synchronize.lib.php b/libraries/server_synchronize.lib.php index 54f15bd..57aaa02 100644 --- a/libraries/server_synchronize.lib.php +++ b/libraries/server_synchronize.lib.php @@ -1,4 +1,4 @@ -<?php +<?php /* vim: set expandtab sw=4 ts=4 sts=4: */
/** @@ -34,7 +34,7 @@ function PMA_getMatchingTables($trg_tables, $src_tables, &$matching_tables, &$un /** * PMA_getNonMatchingTargetTables() places tables present * in target database but are absent from source database -* +* * @param $trg_tables array of target database table names, * * @param $matching_tables $matching tables array containing names of matching tables, @@ -99,7 +99,7 @@ function PMA_dataDiffInTables($src_db, $trg_db, $src_link, $trg_link, &$matching $fld[] = $field_name; } } - $matching_tables_fields[$matching_table_index] = $fld; + $matching_tables_fields[$matching_table_index] = $fld; $fields_num[$matching_table_index] = sizeof($fld); $matching_tables_keys[$matching_table_index] = $is_key;
@@ -128,13 +128,13 @@ function PMA_dataDiffInTables($src_db, $trg_db, $src_link, $trg_link, &$matching
for ($j = 0; $j < $source_size; $j++) { $starting_index = 0; - $update_field = 0; + $update_field = 0;
- if (isset($source_result_set[$j]) && ($all_keys_match)) { + if (isset($source_result_set[$j]) && ($all_keys_match)) {
- // Query the target server to see which rows already exist + // Query the target server to see which rows already exist $trg_select_query = "SELECT * FROM " . PMA_backquote($trg_db) . "." - . PMA_backquote($matching_table[$matching_table_index]) . " WHERE "; + . PMA_backquote($matching_table[$matching_table_index]) . " WHERE ";
if (sizeof($is_key) == 1) { $trg_select_query .= $is_key[0]. "='" . $source_result_set[$j] . "'"; @@ -148,11 +148,11 @@ function PMA_dataDiffInTables($src_db, $trg_db, $src_link, $trg_link, &$matching }
$target_result_set = PMA_DBI_fetch_result($trg_select_query, null, null, $trg_link); - if ($target_result_set) { + if ($target_result_set) {
- // Fetch the row from the source server to do a comparison + // Fetch the row from the source server to do a comparison $src_select_query = "SELECT * FROM " . PMA_backquote($src_db) . "." - . PMA_backquote($matching_table[$matching_table_index]) . " WHERE "; + . PMA_backquote($matching_table[$matching_table_index]) . " WHERE ";
if (sizeof($is_key) == 1) { $src_select_query .= $is_key[0] . "='" . $source_result_set[$j] . "'"; @@ -180,7 +180,7 @@ function PMA_dataDiffInTables($src_db, $trg_db, $src_link, $trg_link, &$matching if ($source_result_set[$j]) { $update_array[$matching_table_index][$update_row][$is_key[0]] = $source_result_set[$j]; } - } elseif (sizeof($is_key) > 1) { + } elseif (sizeof($is_key) > 1) { for ($n=0; $n < sizeof($is_key); $n++) { if (isset($src_result_set[0][$is_key[$n]])) { $update_array[$matching_table_index][$update_row][$is_key[$n]] = $src_result_set[0][$is_key[$n]]; @@ -204,7 +204,7 @@ function PMA_dataDiffInTables($src_db, $trg_db, $src_link, $trg_link, &$matching $update_array[$matching_table_index][$update_row][$is_key[0]] = $source_result_set[$j];
} - } elseif (sizeof($is_key) > 1) { + } elseif (sizeof($is_key) > 1) { for ($n = 0; $n < sizeof($is_key); $n++) { if (isset($src_result_set[0][$is_key[$n]])) { $update_array[$matching_table_index][$update_row][$is_key[$n]] = $src_result_set[0][$is_key[$n]]; @@ -250,10 +250,10 @@ function PMA_dataDiffInTables($src_db, $trg_db, $src_link, $trg_link, &$matching } } } - } else { - /** - * Placing the primary key, and the value of primary key of the row that is to be inserted in the target table - */ + } else { + /** + * Placing the primary key, and the value of primary key of the row that is to be inserted in the target table + */ if (sizeof($is_key) == 1) { if (isset($source_result_set[$j])) { $insert_array[$matching_table_index][$insert_row][$is_key[0]] = $source_result_set[$j]; @@ -305,11 +305,11 @@ function PMA_dataDiffInTables($src_db, $trg_db, $src_link, $trg_link, &$matching function PMA_findDeleteRowsFromTargetTables(&$delete_array, $matching_table, $matching_table_index, $trg_keys, $src_keys, $trg_db, $trg_link,$src_db, $src_link) { if (isset($trg_keys[$matching_table_index])) { - $target_key_values = PMA_get_column_values($trg_db, $matching_table[$matching_table_index], $trg_keys[$matching_table_index], $trg_link); + $target_key_values = PMA_get_column_values($trg_db, $matching_table[$matching_table_index], $trg_keys[$matching_table_index], $trg_link); $target_row_size = sizeof($target_key_values); } if (isset($src_keys[$matching_table_index])) { - $source_key_values = PMA_get_column_values($src_db, $matching_table[$matching_table_index], $src_keys[$matching_table_index], $src_link); + $source_key_values = PMA_get_column_values($src_db, $matching_table[$matching_table_index], $src_keys[$matching_table_index], $src_link); $source_size = sizeof($source_key_values); } $all_keys_match = 1; @@ -480,7 +480,7 @@ function PMA_insertIntoTargetTable($matching_table, $src_db, $trg_db, $src_link, $select_query .= $array_insert[$matching_table_index][$insert_row][$matching_tables_keys[$matching_table_index][$i]] . "'" ;
if ($i < (sizeof($matching_tables_keys[$matching_table_index]) - 1)) { - $select_query.= " AND "; + $select_query.= " AND "; } } $select_query .= "; "; @@ -518,15 +518,15 @@ function PMA_insertIntoTargetTable($matching_table, $src_db, $trg_db, $src_link, PMA_deleteFromTargetTable($trg_db, $trg_link, $matching_tables, $table_index[0], $target_tables_keys, $delete_array, $display); unset($delete_array[$table_index[0]]); } - PMA_addColumnsInTargetTable($src_db, $trg_db, $src_link, $trg_link, $matching_tables, $source_columns, $add_column_array, + PMA_addColumnsInTargetTable($src_db, $trg_db, $src_link, $trg_link, $matching_tables, $source_columns, $add_column_array, $matching_tables_fields, $criteria, $matching_tables_keys, $target_tables_keys, $uncommon_tables,$uncommon_tables_fields, $table_index[0], $uncommon_cols, $display); unset($add_column_array[$table_index[0]]); } - if (isset($add_indexes_array[$table_index[0]]) || isset($remove_indexes_array[$table_index[0]]) + if (isset($add_indexes_array[$table_index[0]]) || isset($remove_indexes_array[$table_index[0]]) || isset($alter_indexes_array[$table_index[0]])) { - PMA_applyIndexesDiff ($trg_db, $trg_link, $matching_tables, $source_indexes, $target_indexes, $add_indexes_array, $alter_indexes_array, - $remove_indexes_array, $table_index[0], $display); + PMA_applyIndexesDiff ($trg_db, $trg_link, $matching_tables, $source_indexes, $target_indexes, $add_indexes_array, $alter_indexes_array, + $remove_indexes_array, $table_index[0], $display);
unset($add_indexes_array[$table_index[0]]); unset($alter_indexes_array[$table_index[0]]); @@ -669,7 +669,7 @@ function PMA_populateTargetTables($src_db, $trg_db, $src_link, $trg_link, $uncom }
/** -* PMA_deleteFromTargetTable() delete rows from target table +* PMA_deleteFromTargetTable() delete rows from target table * * @param $trg_db name of target database * @param $trg_link connection established with target server @@ -734,9 +734,9 @@ function PMA_deleteFromTargetTable($trg_db, $trg_link, $matching_tables, $table_ * @param $matching_tables array containing names of matching tables * @param $source_columns array containing columns information of the source tables * @param $target_columns array containing columns information of the target tables -* @param $alter_str_array three dimensional associative array first index being the matching table index, second index being column name for which target +* @param $alter_str_array three dimensional associative array first index being the matching table index, second index being column name for which target * column have some criteria different and third index containing the criteria which is different. -* @param $add_column_array two dimensional associative array, first index of the array contain the matching table number and second index contain the +* @param $add_column_array two dimensional associative array, first index of the array contain the matching table number and second index contain the * column name which is to be added in the target table * @param $uncommon_columns array containing the columns that are present in the target table but not in the source table * @param $criteria array containing the criterias which are to be checked for field that is present in source table and target table @@ -788,7 +788,7 @@ function PMA_structureDiffInTables($src_db, $trg_db, $src_link, $trg_link, $matc } /** * PMA_addColumnsInTargetTable() adds column that are present in source table but not in target table -* +* * @param $src_db name of source database * @param $trg_db name of target database * @param $src_link connection established with source server @@ -813,7 +813,7 @@ function PMA_addColumnsInTargetTable($src_db, $trg_db, $src_link, $trg_link, $ma if (isset($add_column_array[$table_counter][$matching_tables_fields[$table_counter][$i]])) { $query = "ALTER TABLE " . PMA_backquote($trg_db) . '.' . PMA_backquote($matching_tables[$table_counter]). " ADD COLUMN " . $add_column_array[$table_counter][$matching_tables_fields[$table_counter][$i]] . " " . $source_columns[$table_counter][$matching_tables_fields[$table_counter][$i]]['Type']; - + if($source_columns[$table_counter][$matching_tables_fields[$table_counter][$i]]['Null'] == 'NO') { $query .= ' Not Null '; } elseif ($source_columns[$table_counter][$matching_tables_fields[$table_counter][$i]]['Null'] == 'YES') { @@ -864,7 +864,7 @@ function PMA_addColumnsInTargetTable($src_db, $trg_db, $src_link, $trg_link, $ma
$is_fk_result = PMA_DBI_fetch_result($is_fk_query, null, null, $src_link);
- //If column is a foreign key then it is checked that referenced table exist in target db. If referenced table does not exist in target db then + //If column is a foreign key then it is checked that referenced table exist in target db. If referenced table does not exist in target db then //it is created first. if (isset($is_fk_result)) { if (in_array($is_fk_result[0]['REFERENCED_TABLE_NAME'], $uncommon_tables)) { @@ -873,8 +873,8 @@ function PMA_addColumnsInTargetTable($src_db, $trg_db, $src_link, $trg_link, $ma PMA_createTargetTables($src_db, $trg_db, $trg_link, $src_link, $uncommon_tables, $table_index[0], $uncommon_tables_fields); unset($uncommon_tables[$table_index[0]]); } - $fk_query = "ALTER TABLE " . PMA_backquote($trg_db) . '.' . PMA_backquote($matching_tables[$table_counter]) . - "ADD CONSTRAINT FOREIGN KEY " . $add_column_array[$table_counter][$matching_tables_fields[$table_counter][$i]] . " + $fk_query = "ALTER TABLE " . PMA_backquote($trg_db) . '.' . PMA_backquote($matching_tables[$table_counter]) . + "ADD CONSTRAINT FOREIGN KEY " . $add_column_array[$table_counter][$matching_tables_fields[$table_counter][$i]] . " (" . $add_column_array[$table_counter][$matching_tables_fields[$table_counter][$i]] . ") REFERENCES " . PMA_backquote($trg_db) . '.' . PMA_backquote($is_fk_result[0]['REFERENCED_TABLE_NAME']) . " (" . $is_fk_result[0]['REFERENCED_COLUMN_NAME'] . ");";
@@ -1000,7 +1000,7 @@ function PMA_alterTargetTableStructure($trg_db, $trg_link, $matching_tables, &$s } elseif($criteria[$i] == 'Default') { if(! (isset($alter_str_array[$matching_table_index][$matching_tables_fields[$matching_table_index][$t]][$criteria[2]]))) { $sql_query .= " Not Null " ; - } + } if (is_string($alter_str_array[$matching_table_index][$matching_tables_fields[$matching_table_index][$t]][$criteria[$i]])) { if ($source_columns[$matching_table_index][$matching_tables_fields[$matching_table_index][$t]]['Type'] != 'timestamp') { $sql_query .= " DEFAULT '" . $alter_str_array[$matching_table_index][$matching_tables_fields[$matching_table_index][$t]][$criteria[$i]] . "'";
hooks/post-receive