Bugfix thx to aresh yawari: if tables had _ in their names it did not work
This commit is contained in:
@@ -29,12 +29,13 @@ if (isset($do) && $do == 'import') {
|
|||||||
if (is_dir($docpath)) {
|
if (is_dir($docpath)) {
|
||||||
$handle = opendir($docpath);
|
$handle = opendir($docpath);
|
||||||
while ($file = @readdir ($handle)) {
|
while ($file = @readdir ($handle)) {
|
||||||
$filename = basename($file);
|
$_filename = basename($file);
|
||||||
// echo '<p>Working on file ' . $filename . '</p>';
|
// echo '<p>Working on file ' . $filename . '</p>';
|
||||||
$parts = explode('_', $filename);
|
|
||||||
if (count($parts) == 3 && $parts[1] == 'field' && $parts[2] == 'comment.txt') {
|
if (strpos($_filename,"_field_comment.txt")!=false)
|
||||||
$tab = $parts[0];
|
{
|
||||||
//echo '<h1>Working on Table ' . $tab . '</h1>';
|
$_tab = substr($_filename,0,strlen($_filename)-strlen("_field_comment.txt"));
|
||||||
|
//echo '<h1>Working on Table ' . $_tab . '</h1>';
|
||||||
$fd = fopen($docpath . $file, 'r');
|
$fd = fopen($docpath . $file, 'r');
|
||||||
if ($fd) {
|
if ($fd) {
|
||||||
while (!feof($fd)) {
|
while (!feof($fd)) {
|
||||||
@@ -46,11 +47,11 @@ if (isset($do) && $do == 'import') {
|
|||||||
. ' (db_name, table_name, column_name, comment) '
|
. ' (db_name, table_name, column_name, comment) '
|
||||||
. ' VALUES('
|
. ' VALUES('
|
||||||
. '\'' . PMA_sqlAddslashes($db) . '\','
|
. '\'' . PMA_sqlAddslashes($db) . '\','
|
||||||
. '\'' . PMA_sqlAddslashes(trim($tab)) . '\','
|
. '\'' . PMA_sqlAddslashes(trim($_tab)) . '\','
|
||||||
. '\'' . PMA_sqlAddslashes(trim($inf[0])) . '\','
|
. '\'' . PMA_sqlAddslashes(trim($inf[0])) . '\','
|
||||||
. '\'' . PMA_sqlAddslashes(trim($inf[1])) . '\')';
|
. '\'' . PMA_sqlAddslashes(trim($inf[1])) . '\')';
|
||||||
if (PMA_query_as_cu($qry)) {
|
if (PMA_query_as_cu($qry)) {
|
||||||
echo '<p>Added comment for column ' . htmlspecialchars($tab) . '.' . htmlspecialchars($inf[0]) . '</p>';
|
echo '<p>Added comment for column ' . htmlspecialchars($_tab) . '.' . htmlspecialchars($inf[0]) . '</p>';
|
||||||
} else {
|
} else {
|
||||||
echo '<p>Writing of comment not possible</p>';
|
echo '<p>Writing of comment not possible</p>';
|
||||||
}
|
}
|
||||||
@@ -62,13 +63,13 @@ if (isset($do) && $do == 'import') {
|
|||||||
. '(master_db, master_table, master_field, foreign_db, foreign_table, foreign_field)'
|
. '(master_db, master_table, master_field, foreign_db, foreign_table, foreign_field)'
|
||||||
. ' VALUES('
|
. ' VALUES('
|
||||||
. '\'' . PMA_sqlAddslashes($db) . '\', '
|
. '\'' . PMA_sqlAddslashes($db) . '\', '
|
||||||
. '\'' . PMA_sqlAddslashes(trim($tab)) . '\', '
|
. '\'' . PMA_sqlAddslashes(trim($_tab)) . '\', '
|
||||||
. '\'' . PMA_sqlAddslashes(trim($inf[0])) . '\', '
|
. '\'' . PMA_sqlAddslashes(trim($inf[0])) . '\', '
|
||||||
. '\'' . PMA_sqlAddslashes($db) . '\', '
|
. '\'' . PMA_sqlAddslashes($db) . '\', '
|
||||||
. '\'' . PMA_sqlAddslashes(trim($for[0])) . '\','
|
. '\'' . PMA_sqlAddslashes(trim($for[0])) . '\','
|
||||||
. '\'' . PMA_sqlAddslashes(trim($for[1])) . '\')';
|
. '\'' . PMA_sqlAddslashes(trim($for[1])) . '\')';
|
||||||
if (PMA_query_as_cu($qry)) {
|
if (PMA_query_as_cu($qry)) {
|
||||||
echo '<p>Added relation for column ' . htmlspecialchars($tab) . '.' . htmlspecialchars($inf[0]) . ' to ' . htmlspecialchars($for) . '</p>';
|
echo '<p>Added relation for column ' . htmlspecialchars($_tab) . '.' . htmlspecialchars($inf[0]) . ' to ' . htmlspecialchars($for) . '</p>';
|
||||||
} else {
|
} else {
|
||||||
echo "<p>writing of Relation not possible</p>";
|
echo "<p>writing of Relation not possible</p>";
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user