mirror of
https://github.com/vrana/adminer.git
synced 2025-08-18 20:31:19 +02:00
Don't link first column id
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@781 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
@@ -86,24 +86,29 @@ function editing_name_change(field) {
|
|||||||
}
|
}
|
||||||
var plural = '(?:e?s)?';
|
var plural = '(?:e?s)?';
|
||||||
var tab_col = table + plural + '_?' + column;
|
var tab_col = table + plural + '_?' + column;
|
||||||
var re = new RegExp('^' + idf_escape(table + plural) + '\\.' + idf_escape(column) + '$'
|
var re = new RegExp('(^' + idf_escape(table + plural) + '\\.' + idf_escape(column) + '$' // table_column
|
||||||
+ '|^' + idf_escape(tab_col) + '\\.'
|
+ '|^' + idf_escape(tab_col) + '\\.' // table
|
||||||
+ '|\\.' + idf_escape(tab_col) + '$'
|
+ '|^' + idf_escape(column + plural) + '\\.' + idf_escape(table) + '$' // column_table
|
||||||
+ '|^' + idf_escape(column + plural) + '\\.' + idf_escape(table) + '$'
|
+ ')|\\.' + idf_escape(tab_col) + '$' // column
|
||||||
, 'i');
|
, 'i');
|
||||||
var candidate; // don't select anything with ambiguous match (like column `id`)
|
var candidate; // don't select anything with ambiguous match (like column `id`)
|
||||||
for (var i = opts.length; i--; ) {
|
for (var i = opts.length; i--; ) {
|
||||||
if (re.test(opts[i].value)) {
|
if (opts[i].value.substr(0, 1) != '`') { // common type
|
||||||
|
if (i == opts.length - 2 && candidate && !match[1] && name == 'fields[1]') { // single target table, link to column, first field - probably `id`
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (match = re.exec(opts[i].value)) {
|
||||||
if (candidate) {
|
if (candidate) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
|
||||||
candidate = i;
|
|
||||||
}
|
}
|
||||||
|
candidate = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (candidate) {
|
if (candidate) {
|
||||||
opts.selectedIndex = candidate;
|
opts.selectedIndex = candidate;
|
||||||
editing_type_change(type);
|
type.onchange();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user