UNIX_TIMESTAMP can take optional parameter (bug #1039193).

This commit is contained in:
Michal Čihař
2004-10-19 16:34:30 +00:00
parent 0277d8cdff
commit 0e9ad7053e
2 changed files with 12 additions and 8 deletions

View File

@@ -24,6 +24,8 @@ $Source$
Fix left frame reloading after dropping table (bug #1034531). Fix left frame reloading after dropping table (bug #1034531).
* config.inc.php, libraries/config_import.lib.php: Offer UNIX_TIMESTAMP * config.inc.php, libraries/config_import.lib.php: Offer UNIX_TIMESTAMP
also for numeric fields. also for numeric fields.
* tbl_replace.php: UNIX_TIMESTAMP can take optional parameter (bug
#1039193).
2004-10-17 Marc Delisle <lem9@users.sourceforge.net> 2004-10-17 Marc Delisle <lem9@users.sourceforge.net>
* lang/turkish update, thanks to boralioglu. * lang/turkish update, thanks to boralioglu.

View File

@@ -107,7 +107,7 @@ $message = '';
foreach ($loop_array AS $primary_key_index => $enc_primary_key) { foreach ($loop_array AS $primary_key_index => $enc_primary_key) {
// skip fields to be ignored // skip fields to be ignored
if (!$using_key && isset($GLOBALS['insert_ignore_' . $enc_primary_key])) continue; if (!$using_key && isset($GLOBALS['insert_ignore_' . $enc_primary_key])) continue;
// Restore the "primary key" to a convenient format // Restore the "primary key" to a convenient format
$primary_key = urldecode($enc_primary_key); $primary_key = urldecode($enc_primary_key);
@@ -121,10 +121,10 @@ foreach ($loop_array AS $primary_key_index => $enc_primary_key) {
$me_funcs = isset($funcs['multi_edit']) && isset($funcs['multi_edit'][$enc_primary_key]) ? $funcs['multi_edit'][$enc_primary_key] : null; $me_funcs = isset($funcs['multi_edit']) && isset($funcs['multi_edit'][$enc_primary_key]) ? $funcs['multi_edit'][$enc_primary_key] : null;
$me_fields_type = isset($fields_type['multi_edit']) && isset($fields_type['multi_edit'][$enc_primary_key]) ? $fields_type['multi_edit'][$enc_primary_key] : null; $me_fields_type = isset($fields_type['multi_edit']) && isset($fields_type['multi_edit'][$enc_primary_key]) ? $fields_type['multi_edit'][$enc_primary_key] : null;
$me_fields_null = isset($fields_null['multi_edit']) && isset($fields_null['multi_edit'][$enc_primary_key]) ? $fields_null['multi_edit'][$enc_primary_key] : null; $me_fields_null = isset($fields_null['multi_edit']) && isset($fields_null['multi_edit'][$enc_primary_key]) ? $fields_null['multi_edit'][$enc_primary_key] : null;
if ($using_key && isset($me_fields_type) && is_array($me_fields_type) && isset($primary_key)) { if ($using_key && isset($me_fields_type) && is_array($me_fields_type) && isset($primary_key)) {
$prot_result = PMA_DBI_query('SELECT * FROM ' . PMA_backquote($table) . ' WHERE ' . $primary_key . ';'); $prot_result = PMA_DBI_query('SELECT * FROM ' . PMA_backquote($table) . ' WHERE ' . $primary_key . ';');
$prot_row = PMA_DBI_fetch_assoc($prot_result); $prot_row = PMA_DBI_fetch_assoc($prot_result);
PMA_DBI_free_result($prot_result); PMA_DBI_free_result($prot_result);
unset($prot_result); unset($prot_result);
} }
@@ -137,13 +137,15 @@ foreach ($loop_array AS $primary_key_index => $enc_primary_key) {
if (empty($me_funcs[$encoded_key])) { if (empty($me_funcs[$encoded_key])) {
$cur_value = $val . ', '; $cur_value = $val . ', ';
} else if (preg_match('@^(UNIX_TIMESTAMP)$@', $me_funcs[$encoded_key]) && $val != '\'\'') {
$cur_value = $me_funcs[$encoded_key] . '(' . $val . '), ';
} else if (preg_match('@^(NOW|CURDATE|CURTIME|UNIX_TIMESTAMP|RAND|USER|LAST_INSERT_ID)$@', $me_funcs[$encoded_key])) { } else if (preg_match('@^(NOW|CURDATE|CURTIME|UNIX_TIMESTAMP|RAND|USER|LAST_INSERT_ID)$@', $me_funcs[$encoded_key])) {
$cur_value = $me_funcs[$encoded_key] . '(), '; $cur_value = $me_funcs[$encoded_key] . '(), ';
} else { } else {
$cur_value = $me_funcs[$encoded_key] . '(' . $val . '), '; $cur_value = $me_funcs[$encoded_key] . '(' . $val . '), ';
} }
if ($is_insert) { if ($is_insert) {
// insert, no need to add column // insert, no need to add column
$valuelist .= $cur_value; $valuelist .= $cur_value;
} else if (empty($me_funcs[$encoded_key]) } else if (empty($me_funcs[$encoded_key])
@@ -159,7 +161,7 @@ foreach ($loop_array AS $primary_key_index => $enc_primary_key) {
// get rid of last , // get rid of last ,
$valuelist = preg_replace('@, $@', '', $valuelist); $valuelist = preg_replace('@, $@', '', $valuelist);
// Builds the sql query // Builds the sql query
if ($is_insert) { if ($is_insert) {
if (empty($query)) { if (empty($query)) {