Little code reorganistaion (RFE #957308), removed some remaining php3 compatibility code in SQL parser.
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
function PMA_texEscape($string) {
|
||||
$escape = array('$', '%', '{', '}', '&', '#', '_', '^');
|
||||
$cnt_escape = count($escape);
|
||||
for($k=0; $k < $cnt_escape; $k++) {
|
||||
for ($k=0; $k < $cnt_escape; $k++) {
|
||||
$string = str_replace($escape[$k], '\\' . $escape[$k], $string);
|
||||
}
|
||||
return $string;
|
||||
@@ -140,7 +140,7 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
|
||||
$buffer = $crlf . '%' . $crlf . '% ' . $GLOBALS['strData'] . ': ' . $table . $crlf . '%' . $crlf
|
||||
. ' \\begin{longtable}{|';
|
||||
|
||||
for($index=0;$index<$columns_cnt;$index++) {
|
||||
for ($index=0;$index<$columns_cnt;$index++) {
|
||||
$buffer .= 'l|';
|
||||
}
|
||||
$buffer .= '} ' . $crlf ;
|
||||
@@ -174,7 +174,7 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
|
||||
|
||||
$buffer = '';
|
||||
// print each row
|
||||
for($i = 0; $i < $columns_cnt; $i++) {
|
||||
for ($i = 0; $i < $columns_cnt; $i++) {
|
||||
if ( isset($record[$columns[$i]]) && (!function_exists('is_null') || !is_null($record[$columns[$i]]))) {
|
||||
$column_value = PMA_texEscape(stripslashes($record[$columns[$i]]));
|
||||
} else {
|
||||
@@ -182,7 +182,7 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
|
||||
}
|
||||
|
||||
// last column ... no need for & character
|
||||
if($i == ($columns_cnt - 1)) {
|
||||
if ($i == ($columns_cnt - 1)) {
|
||||
$buffer .= $column_value;
|
||||
} else {
|
||||
$buffer .= $column_value . " & ";
|
||||
@@ -226,7 +226,7 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals
|
||||
$keys_query = 'SHOW KEYS FROM ' . PMA_backquote($table) . ' FROM '. PMA_backquote($db);
|
||||
$keys_result = PMA_DBI_query($keys_query);
|
||||
$unique_keys = array();
|
||||
while($key = PMA_DBI_fetch_assoc($keys_result)) {
|
||||
while ($key = PMA_DBI_fetch_assoc($keys_result)) {
|
||||
if ($key['Non_unique'] == 0) $unique_keys[] = $key['Column_name'];
|
||||
}
|
||||
PMA_DBI_free_result($keys_result);
|
||||
|
@@ -28,7 +28,7 @@ $comment_marker = '-- ';
|
||||
function PMA_fieldTypes($db, $table,$use_backquotes) {
|
||||
PMA_DBI_select_db($db);
|
||||
$table_def = PMA_DBI_query('SHOW FIELDS FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table));
|
||||
while($row = PMA_DBI_fetch_assoc($table_def)) {
|
||||
while ($row = PMA_DBI_fetch_assoc($table_def)) {
|
||||
$types[PMA_backquote($row['Field'],$use_backquotes)] = ereg_replace('\\(.*', '', $row['Type']);
|
||||
}
|
||||
return $types;
|
||||
@@ -340,7 +340,7 @@ function PMA_getTableComments($db, $table, $crlf, $do_relation = false, $do_comm
|
||||
if (isset($comments_map) && count($comments_map) > 0) {
|
||||
$schema_create .= $crlf . $GLOBALS['comment_marker'] . $crlf
|
||||
. $GLOBALS['comment_marker'] . $GLOBALS['strCommentsForTable']. ' ' . PMA_backquote($table, $use_backquotes) . ':' . $crlf;
|
||||
foreach($comments_map AS $comment_field => $comment) {
|
||||
foreach ($comments_map AS $comment_field => $comment) {
|
||||
$schema_create .= $GLOBALS['comment_marker'] . ' ' . PMA_backquote($comment_field, $use_backquotes) . $crlf
|
||||
. $GLOBALS['comment_marker'] . ' ' . PMA_backquote($comment, $use_backquotes) . $crlf;
|
||||
}
|
||||
@@ -351,7 +351,7 @@ function PMA_getTableComments($db, $table, $crlf, $do_relation = false, $do_comm
|
||||
$schema_create .= $crlf . $GLOBALS['comment_marker'] . $crlf
|
||||
. $GLOBALS['comment_marker'] . $GLOBALS['strMIMETypesForTable']. ' ' . PMA_backquote($table, $use_backquotes) . ':' . $crlf;
|
||||
@reset($mime_map);
|
||||
foreach($mime_map AS $mime_field => $mime) {
|
||||
foreach ($mime_map AS $mime_field => $mime) {
|
||||
$schema_create .= $GLOBALS['comment_marker'] . ' ' . PMA_backquote($mime_field, $use_backquotes) . $crlf
|
||||
. $GLOBALS['comment_marker'] . ' ' . PMA_backquote($mime['mimetype'], $use_backquotes) . $crlf;
|
||||
}
|
||||
@@ -361,7 +361,7 @@ function PMA_getTableComments($db, $table, $crlf, $do_relation = false, $do_comm
|
||||
if ($have_rel) {
|
||||
$schema_create .= $crlf . $GLOBALS['comment_marker'] . $crlf
|
||||
. $GLOBALS['comment_marker'] . $GLOBALS['strRelationsForTable']. ' ' . PMA_backquote($table, $use_backquotes) . ':' . $crlf;
|
||||
foreach($res_rel AS $rel_field => $rel) {
|
||||
foreach ($res_rel AS $rel_field => $rel) {
|
||||
$schema_create .= $GLOBALS['comment_marker'] . ' ' . PMA_backquote($rel_field, $use_backquotes) . $crlf
|
||||
. $GLOBALS['comment_marker'] . ' ' . PMA_backquote($rel['foreign_table'], $use_backquotes)
|
||||
. ' -> ' . PMA_backquote($rel['foreign_field'], $use_backquotes) . $crlf;
|
||||
|
Reference in New Issue
Block a user