diff --git a/ChangeLog b/ChangeLog index 0683af675..6e28f1d52 100755 --- a/ChangeLog +++ b/ChangeLog @@ -17,6 +17,10 @@ $Source$ * libraries/display_tbl.lib.php3, lines 715-724: return to the browse mode once a "KILL" statement has been run. Thanks to Florian Perrichot for this suggestion. + * header.inc.php3; tbl_indexes.php3; tbl_printview.php3; + tbl_properties.php3; libraries/indexes.js; lang/*: commited patch + #458014 - Advanced index generation/editing thanks to + Michal Cihar . 2001-11-08 Robin Johnson * config.inc.php3; main.php3; phpinfo.php3: fixed bug #479303 diff --git a/header.inc.php3 b/header.inc.php3 index c52e399fa..b1453d086 100755 --- a/header.inc.php3 +++ b/header.inc.php3 @@ -105,6 +105,17 @@ var jsPasswordNotSame = ' +// js index validation stuff +var errorMsg0 = ''; +var errorMsg1 = ''; +var errorMsg2 = ''; +//--> + + + diff --git a/lang/brazilian_portuguese.inc.php3 b/lang/brazilian_portuguese.inc.php3 index e47fd587b..0914d9b18 100644 --- a/lang/brazilian_portuguese.inc.php3 +++ b/lang/brazilian_portuguese.inc.php3 @@ -321,4 +321,20 @@ $strUpdateProfile = 'Update profile:';//to translate $strUpdateProfileMessage = 'The profile has been updated.';//to translate $strWithChecked = 'With selected:'; //to translate $strZip = '"zipped"'; //to translate + +// Indexes +$strAddToIndex = 'Add to index  %s column(s)'; +$strCantRenameIdxToPrimary = 'Can\'t rename index to PRIMARY!'; +$strCardinality = 'Cardinality'; +$strCreateIndex = 'Create an index on %s columns'; +$strCreateIndexTopic = 'Create a new index'; +$strIgnore = 'Ignore'; +$strIndexName = 'Index name :'; +$strIndexType = 'Index type :'; +$strModifyIndexTopic = 'Modify an index'; +$strNone = 'None'; +$strNoIndexPartsDefined = 'No index parts defined!'; +$strNoIndex = 'No index defined!'; +$strPrimaryKeyName = 'The name of the primary key must be... PRIMARY!'; +$strPrimaryKeyWarning = '("PRIMARY" must be the name of and only of a primary key!)'; ?> diff --git a/lang/bulgarian-win1251.inc.php3 b/lang/bulgarian-win1251.inc.php3 index 642e54962..d80f32781 100644 --- a/lang/bulgarian-win1251.inc.php3 +++ b/lang/bulgarian-win1251.inc.php3 @@ -323,4 +323,20 @@ $strShowAll = 'Show all'; // to translate $strStartingRecord = 'Starting record';//to translate $strTableHasBeenFlushed = 'Table %s has been flushed'; $strUseBackquotes = 'Use backquotes with tables and fields\' names'; + +// Indexes +$strAddToIndex = 'Add to index  %s column(s)'; +$strCantRenameIdxToPrimary = 'Can\'t rename index to PRIMARY!'; +$strCardinality = 'Cardinality'; +$strCreateIndex = 'Create an index on %s columns'; +$strCreateIndexTopic = 'Create a new index'; +$strIgnore = 'Ignore'; +$strIndexName = 'Index name :'; +$strIndexType = 'Index type :'; +$strModifyIndexTopic = 'Modify an index'; +$strNone = 'None'; +$strNoIndexPartsDefined = 'No index parts defined!'; +$strNoIndex = 'No index defined!'; +$strPrimaryKeyName = 'The name of the primary key must be... PRIMARY!'; +$strPrimaryKeyWarning = '("PRIMARY" must be the name of and only of a primary key!)'; ?> diff --git a/lang/catala.inc.php3 b/lang/catala.inc.php3 index ec09fb8ee..5592e14d7 100644 --- a/lang/catala.inc.php3 +++ b/lang/catala.inc.php3 @@ -322,4 +322,20 @@ $strUpdateProfile = 'Update profile:';//to translate $strUpdateProfileMessage = 'The profile has been updated.';//to translate $strUseBackquotes = 'Use backquotes with tables and fields\' names'; $strWithChecked = 'With selected:'; + +// Indexes +$strAddToIndex = 'Add to index  %s column(s)'; +$strCantRenameIdxToPrimary = 'Can\'t rename index to PRIMARY!'; +$strCardinality = 'Cardinality'; +$strCreateIndex = 'Create an index on %s columns'; +$strCreateIndexTopic = 'Create a new index'; +$strIgnore = 'Ignore'; +$strIndexName = 'Index name :'; +$strIndexType = 'Index type :'; +$strModifyIndexTopic = 'Modify an index'; +$strNone = 'None'; +$strNoIndexPartsDefined = 'No index parts defined!'; +$strNoIndex = 'No index defined!'; +$strPrimaryKeyName = 'The name of the primary key must be... PRIMARY!'; +$strPrimaryKeyWarning = '("PRIMARY" must be the name of and only of a primary key!)'; ?> diff --git a/lang/chinese_big5.inc.php3 b/lang/chinese_big5.inc.php3 index a97617431..d6b838191 100644 --- a/lang/chinese_big5.inc.php3 +++ b/lang/chinese_big5.inc.php3 @@ -322,4 +322,20 @@ $strUpdateProfileMessage = 'The profile has been updated.';//to translate $strUseBackquotes = ' Use backquotes with tables and fields names '; //to translate $strWithChecked = 'With selected:'; $strZip = '"zipped"'; //to translate + +// Indexes +$strAddToIndex = 'Add to index  %s column(s)'; +$strCantRenameIdxToPrimary = 'Can\'t rename index to PRIMARY!'; +$strCardinality = 'Cardinality'; +$strCreateIndex = 'Create an index on %s columns'; +$strCreateIndexTopic = 'Create a new index'; +$strIgnore = 'Ignore'; +$strIndexName = 'Index name :'; +$strIndexType = 'Index type :'; +$strModifyIndexTopic = 'Modify an index'; +$strNone = 'None'; +$strNoIndexPartsDefined = 'No index parts defined!'; +$strNoIndex = 'No index defined!'; +$strPrimaryKeyName = 'The name of the primary key must be... PRIMARY!'; +$strPrimaryKeyWarning = '("PRIMARY" must be the name of and only of a primary key!)'; ?> diff --git a/lang/chinese_gb.inc.php3 b/lang/chinese_gb.inc.php3 index c5174c8f3..33a9834b7 100644 --- a/lang/chinese_gb.inc.php3 +++ b/lang/chinese_gb.inc.php3 @@ -326,4 +326,20 @@ $strUpdateProfile = 'Update profile:';//to translate $strUpdateProfileMessage = 'The profile has been updated.';//to translate $strUseBackquotes = 'Use backquotes with tables and fields\' names'; $strWithChecked = 'With selected:'; + +// Indexes +$strAddToIndex = 'Add to index  %s column(s)'; +$strCantRenameIdxToPrimary = 'Can\'t rename index to PRIMARY!'; +$strCardinality = 'Cardinality'; +$strCreateIndex = 'Create an index on %s columns'; +$strCreateIndexTopic = 'Create a new index'; +$strIgnore = 'Ignore'; +$strIndexName = 'Index name :'; +$strIndexType = 'Index type :'; +$strModifyIndexTopic = 'Modify an index'; +$strNone = 'None'; +$strNoIndexPartsDefined = 'No index parts defined!'; +$strNoIndex = 'No index defined!'; +$strPrimaryKeyName = 'The name of the primary key must be... PRIMARY!'; +$strPrimaryKeyWarning = '("PRIMARY" must be the name of and only of a primary key!)'; ?> diff --git a/lang/czech-iso.inc.php3 b/lang/czech-iso.inc.php3 index e83dedd20..908683118 100644 --- a/lang/czech-iso.inc.php3 +++ b/lang/czech-iso.inc.php3 @@ -322,4 +322,20 @@ $strZip = '"zazipov $strAfterInsertBack = 'Return'; $strAfterInsertNewInsert = 'Insert a new record'; $strBookmarkDeleted = 'The bookmark has been deleted.'; + +// Indexes +$strAddToIndex = 'Add to index  %s column(s)'; +$strCantRenameIdxToPrimary = 'Can\'t rename index to PRIMARY!'; +$strCardinality = 'Cardinality'; +$strCreateIndex = 'Create an index on %s columns'; +$strCreateIndexTopic = 'Create a new index'; +$strIgnore = 'Ignore'; +$strIndexName = 'Index name :'; +$strIndexType = 'Index type :'; +$strModifyIndexTopic = 'Modify an index'; +$strNone = 'None'; +$strNoIndexPartsDefined = 'No index parts defined!'; +$strNoIndex = 'No index defined!'; +$strPrimaryKeyName = 'The name of the primary key must be... PRIMARY!'; +$strPrimaryKeyWarning = '("PRIMARY" must be the name of and only of a primary key!)'; ?> diff --git a/lang/czech-win1250.inc.php3 b/lang/czech-win1250.inc.php3 index d77eb99e3..e9398181b 100644 --- a/lang/czech-win1250.inc.php3 +++ b/lang/czech-win1250.inc.php3 @@ -324,4 +324,20 @@ $strZip = '"zazipov $strAfterInsertBack = 'Return'; $strAfterInsertNewInsert = 'Insert a new record'; $strBookmarkDeleted = 'The bookmark has been deleted.'; + +// Indexes +$strAddToIndex = 'Add to index  %s column(s)'; +$strCantRenameIdxToPrimary = 'Can\'t rename index to PRIMARY!'; +$strCardinality = 'Cardinality'; +$strCreateIndex = 'Create an index on %s columns'; +$strCreateIndexTopic = 'Create a new index'; +$strIgnore = 'Ignore'; +$strIndexName = 'Index name :'; +$strIndexType = 'Index type :'; +$strModifyIndexTopic = 'Modify an index'; +$strNone = 'None'; +$strNoIndexPartsDefined = 'No index parts defined!'; +$strNoIndex = 'No index defined!'; +$strPrimaryKeyName = 'The name of the primary key must be... PRIMARY!'; +$strPrimaryKeyWarning = '("PRIMARY" must be the name of and only of a primary key!)'; ?> diff --git a/lang/danish.inc.php3 b/lang/danish.inc.php3 index 43b7285f1..769cd5d8e 100644 --- a/lang/danish.inc.php3 +++ b/lang/danish.inc.php3 @@ -321,4 +321,20 @@ $strBookmarkDeleted = 'The bookmark has been deleted.'; $strFlushTable = 'Flush the table ("FLUSH")'; $strNoFrames = 'phpMyAdmin is more friendly with a frames-capable browser.'; $strTableHasBeenFlushed = 'Table %s has been flushed'; + +// Indexes +$strAddToIndex = 'Add to index  %s column(s)'; +$strCantRenameIdxToPrimary = 'Can\'t rename index to PRIMARY!'; +$strCardinality = 'Cardinality'; +$strCreateIndex = 'Create an index on %s columns'; +$strCreateIndexTopic = 'Create a new index'; +$strIgnore = 'Ignore'; +$strIndexName = 'Index name :'; +$strIndexType = 'Index type :'; +$strModifyIndexTopic = 'Modify an index'; +$strNone = 'None'; +$strNoIndexPartsDefined = 'No index parts defined!'; +$strNoIndex = 'No index defined!'; +$strPrimaryKeyName = 'The name of the primary key must be... PRIMARY!'; +$strPrimaryKeyWarning = '("PRIMARY" must be the name of and only of a primary key!)'; ?> diff --git a/lang/dutch.inc.php3 b/lang/dutch.inc.php3 index 84d3ff61e..5ef4fef8f 100644 --- a/lang/dutch.inc.php3 +++ b/lang/dutch.inc.php3 @@ -321,4 +321,20 @@ $strUpdateProfileMessage = 'The profile has been updated.';//to translate $strUseBackquotes = 'Gebruik backquotes bij tabellen en velden\' namen'; // what are backquotes? $strWithChecked = 'With selected:'; $strZip = '"zipped"'; //to translate + +// Indexes +$strAddToIndex = 'Add to index  %s column(s)'; +$strCantRenameIdxToPrimary = 'Can\'t rename index to PRIMARY!'; +$strCardinality = 'Cardinality'; +$strCreateIndex = 'Create an index on %s columns'; +$strCreateIndexTopic = 'Create a new index'; +$strIgnore = 'Ignore'; +$strIndexName = 'Index name :'; +$strIndexType = 'Index type :'; +$strModifyIndexTopic = 'Modify an index'; +$strNone = 'None'; +$strNoIndexPartsDefined = 'No index parts defined!'; +$strNoIndex = 'No index defined!'; +$strPrimaryKeyName = 'The name of the primary key must be... PRIMARY!'; +$strPrimaryKeyWarning = '("PRIMARY" must be the name of and only of a primary key!)'; ?> diff --git a/lang/english.inc.php3 b/lang/english.inc.php3 index 170153a99..3689120ad 100644 --- a/lang/english.inc.php3 +++ b/lang/english.inc.php3 @@ -23,6 +23,7 @@ $strAddNewField = 'Add new field'; $strAddPriv = 'Add a new Privilege'; $strAddPrivMessage = 'You have added a new privilege.'; $strAddSearchConditions = 'Add search conditions (body of the "where" clause):'; +$strAddToIndex = 'Add to index  %s column(s)'; $strAddUser = 'Add a new User'; $strAddUserMessage = 'You have added a new user.'; $strAffectedRows = 'Affected rows:'; @@ -58,6 +59,8 @@ $strBrowse = 'Browse'; $strBzip = '"bzipped"'; $strCantLoadMySQL = 'cannot load MySQL extension,
please check PHP Configuration.'; +$strCantRenameIdxToPrimary = 'Can\'t rename index to PRIMARY!'; +$strCardinality = 'Cardinality'; $strCarriage = 'Carriage return: \\r'; $strChange = 'Change'; $strCheckAll = 'Check All'; @@ -70,6 +73,8 @@ $strConfirm = 'Do you really want to do it?'; $strCopyTable = 'Copy table to (database.table):'; $strCopyTableOK = 'Table %s has been copied to %s.'; $strCreate = 'Create'; +$strCreateIndex = 'Create an index on %s columns'; +$strCreateIndexTopic = 'Create a new index'; $strCreateNewDatabase = 'Create new database'; $strCreateNewTable = 'Create new table on database '; $strCriteria = 'Criteria'; @@ -138,9 +143,12 @@ $strHostEmpty = 'The host name is empty!'; $strIdxFulltext = 'Fulltext'; $strIfYouWish = 'If you wish to load only some of a table\'s columns, specify a comma separated field list.'; +$strIgnore = 'Ignore'; $strIndex = 'Index'; -$strIndexHasBeenDropped = 'Index %s has been dropped'; $strIndexes = 'Indexes'; +$strIndexHasBeenDropped = 'Index %s has been dropped'; +$strIndexName = 'Index name :'; +$strIndexType = 'Index type :'; $strInsert = 'Insert'; $strInsertAsNewRow = 'Insert as new row'; $strInsertedRows = 'Inserted rows:'; @@ -166,6 +174,7 @@ $strLogout = 'Log out'; $strModifications = 'Modifications have been saved'; $strModify = 'Modify'; +$strModifyIndexTopic = 'Modify an index'; $strMoveTable = 'Move table to (database.table):'; $strMoveTableOK = 'Table %s has been moved to %s.'; $strMySQLReloaded = 'MySQL reloaded.'; @@ -181,7 +190,10 @@ $strNo = 'No'; $strNoDatabases = 'No databases'; $strNoDropDatabases = '"DROP DATABASE" statements are disabled.'; $strNoFrames = 'phpMyAdmin is more friendly with a frames-capable browser.'; +$strNoIndex = 'No index defined!'; +$strNoIndexPartsDefined = 'No index parts defined!'; $strNoModification = 'No change'; +$strNone = 'None'; $strNoPassword = 'No Password'; $strNoPrivileges = 'No Privileges'; $strNoQuery = 'No SQL query!'; //to translate @@ -211,6 +223,8 @@ $strPrevious = 'Previous'; $strPrimary = 'Primary'; $strPrimaryKey = 'Primary key'; $strPrimaryKeyHasBeenDropped = 'The primary key has been dropped'; +$strPrimaryKeyName = 'The name of the primary key must be... PRIMARY!'; +$strPrimaryKeyWarning = '("PRIMARY" must be the name of and only of a primary key!)'; $strPrintView = 'Print view'; $strPrivileges = 'Privileges'; $strProperties = 'Properties'; @@ -320,4 +334,5 @@ $strWrongUser = 'Wrong username/password. Access denied.'; $strYes = 'Yes'; $strZip = '"zipped"'; + ?> diff --git a/lang/finnish.inc.php3 b/lang/finnish.inc.php3 index 5fa86e52f..3d4b32eae 100644 --- a/lang/finnish.inc.php3 +++ b/lang/finnish.inc.php3 @@ -326,4 +326,20 @@ $strAfterInsertBack = 'Return'; $strAfterInsertNewInsert = 'Insert a new record'; $strBookmarkDeleted = 'The bookmark has been deleted.'; $strOverhead = 'Overhead'; + +// Indexes +$strAddToIndex = 'Add to index  %s column(s)'; +$strCantRenameIdxToPrimary = 'Can\'t rename index to PRIMARY!'; +$strCardinality = 'Cardinality'; +$strCreateIndex = 'Create an index on %s columns'; +$strCreateIndexTopic = 'Create a new index'; +$strIgnore = 'Ignore'; +$strIndexName = 'Index name :'; +$strIndexType = 'Index type :'; +$strModifyIndexTopic = 'Modify an index'; +$strNone = 'None'; +$strNoIndexPartsDefined = 'No index parts defined!'; +$strNoIndex = 'No index defined!'; +$strPrimaryKeyName = 'The name of the primary key must be... PRIMARY!'; +$strPrimaryKeyWarning = '("PRIMARY" must be the name of and only of a primary key!)'; ?> diff --git a/lang/french.inc.php3 b/lang/french.inc.php3 index 2ab0bf1ff..f529f291d 100644 --- a/lang/french.inc.php3 +++ b/lang/french.inc.php3 @@ -23,6 +23,7 @@ $strAddNewField = 'Ajouter un champ'; $strAddPriv = 'Ajouter un privilège'; $strAddPrivMessage = 'Vous avez ajouté un privilège'; $strAddSearchConditions = 'Critères de recherche (pour l\'énoncé "where"):'; +$strAddToIndex = 'Ajouter à la clef %s colonne(s)'; $strAddUser = 'Ajouter un utilisateur'; $strAddUserMessage = 'Vous avez ajouté un utilisateur'; $strAffectedRows = 'Nombre d\'enregistrements affectés :'; @@ -58,6 +59,8 @@ $strBrowse = 'Afficher'; $strBzip = '"bzippé"'; $strCantLoadMySQL = 'ne peux charger l\'extension MySQL,
vérifiez la configuration PHP'; +$strCantRenameIdxToPrimary = 'La clef ne peut être renommée PRIMARY !'; +$strCardinality = 'Cardinalité'; $strCarriage = 'Retour de chariot : \\r'; $strChange = 'Modifier'; $strCheckAll = 'Tout cocher'; @@ -70,6 +73,8 @@ $strConfirm = 'Veuillez confirmer'; $strCopyTable = 'Copier la table vers (base.table) :'; $strCopyTableOK = 'La table %s a été copiée vers %s.'; $strCreate = 'Créer'; +$strCreateIndex = 'Créer une clef sur %s colonne(s)'; +$strCreateIndexTopic = 'Créer un nouvelle clef'; $strCreateNewDatabase = 'Créer une base de données'; $strCreateNewTable = 'Créer une nouvelle table sur la base '; $strCriteria = 'Critère'; @@ -138,9 +143,12 @@ $strHostEmpty = 'Le nom de serveur est vide'; $strIdxFulltext = 'Texte entier'; $strIfYouWish = 'Si vous désirez ne charger que certaines colonnes, indiquez leurs noms, séparés par des virgules.'; +$strIgnore = 'Ignorer'; $strIndex = 'Index'; $strIndexes = 'Index'; $strIndexHasBeenDropped = 'L\'index %s a été effacé'; +$strIndexName = 'Nom de la clef :'; +$strIndexType = 'Type de clef :'; $strInsert = 'Insérer'; $strInsertAsNewRow = 'Insérer en tant que nouvel enregistrement'; $strInsertedRows = 'Nombre d\'enregistrements insérés :'; @@ -166,6 +174,7 @@ $strLogout = 'Quitter'; $strModifications = 'Les modifications ont été sauvegardées.'; $strModify = 'Modifier'; +$strModifyIndexTopic = 'Modifier une clef'; $strMoveTable = 'Déplacer la table vers (base.table) :'; $strMoveTableOK = 'La table %s a été déplacée vers %s.'; $strMySQLReloaded = 'MySQL rechargé.'; @@ -181,7 +190,10 @@ $strNo = 'Non'; $strNoDropDatabases = 'La commande "DROP DATABASE" est désactivée.'; $strNoDatabases = 'Aucune base de données'; $strNoFrames = 'L\'utilisation de phpMyAdmin est plus aisée avec un navigateur supportant les "frames".'; +$strNoIndex = 'Aucune clef n\'est définie !'; +$strNoIndexPartsDefined = 'Aucune colonne n\'a été définie pour cette clef !'; $strNoModification = 'Pas de modifications'; +$strNone = 'Nulle'; $strNoPassword = 'aucun mot de passe'; $strNoPrivileges = 'aucun privilège'; $strNoQuery = 'Aucune requête SQL !'; @@ -211,6 +223,8 @@ $strPrevious = 'Pr $strPrimary = 'Primaire'; $strPrimaryKey = 'Clé primaire'; $strPrimaryKeyHasBeenDropped = 'La clé primaire a été effacée'; +$strPrimaryKeyName = 'Le nom d\'une clef primaire doit être PRIMARY !'; +$strPrimaryKeyWarning = '("PRIMARY" doit et ne peut être que le nom d'\une clef primaire&nsbp;!)'; $strPrintView = 'Version imprimable'; $strPrivileges = 'Privilèges'; $strProperties = 'Propriétés'; diff --git a/lang/galician.inc.php3 b/lang/galician.inc.php3 index 1e654d657..e2062e46b 100644 --- a/lang/galician.inc.php3 +++ b/lang/galician.inc.php3 @@ -322,4 +322,20 @@ $strCopyTable = 'Copy table to (database.table):'; $strMoveTable = 'Move table to (database.table):'; $strMoveTableOK = 'Table %s has been moved to %s.'; $strNoQuery = 'No SQL query!'; //to translate + +// Indexes +$strAddToIndex = 'Add to index  %s column(s)'; +$strCantRenameIdxToPrimary = 'Can\'t rename index to PRIMARY!'; +$strCardinality = 'Cardinality'; +$strCreateIndex = 'Create an index on %s columns'; +$strCreateIndexTopic = 'Create a new index'; +$strIgnore = 'Ignore'; +$strIndexName = 'Index name :'; +$strIndexType = 'Index type :'; +$strModifyIndexTopic = 'Modify an index'; +$strNone = 'None'; +$strNoIndexPartsDefined = 'No index parts defined!'; +$strNoIndex = 'No index defined!'; +$strPrimaryKeyName = 'The name of the primary key must be... PRIMARY!'; +$strPrimaryKeyWarning = '("PRIMARY" must be the name of and only of a primary key!)'; ?> diff --git a/lang/german.inc.php3 b/lang/german.inc.php3 index 376ca46f0..1f8bcde39 100644 --- a/lang/german.inc.php3 +++ b/lang/german.inc.php3 @@ -322,4 +322,20 @@ $strRunningAs = 'as'; $strShowCols = 'Show columns'; $strShowTables = 'Show tables'; $strTableHasBeenFlushed = 'Table %s has been flushed'; + +// Indexes +$strAddToIndex = 'Add to index  %s column(s)'; +$strCantRenameIdxToPrimary = 'Can\'t rename index to PRIMARY!'; +$strCardinality = 'Cardinality'; +$strCreateIndex = 'Create an index on %s columns'; +$strCreateIndexTopic = 'Create a new index'; +$strIgnore = 'Ignore'; +$strIndexName = 'Index name :'; +$strIndexType = 'Index type :'; +$strModifyIndexTopic = 'Modify an index'; +$strNone = 'None'; +$strNoIndexPartsDefined = 'No index parts defined!'; +$strNoIndex = 'No index defined!'; +$strPrimaryKeyName = 'The name of the primary key must be... PRIMARY!'; +$strPrimaryKeyWarning = '("PRIMARY" must be the name of and only of a primary key!)'; ?> diff --git a/lang/greek.inc.php3 b/lang/greek.inc.php3 index fd2df57f8..760f1585d 100644 --- a/lang/greek.inc.php3 +++ b/lang/greek.inc.php3 @@ -322,4 +322,20 @@ $strTableHasBeenFlushed = 'Table %s has been flushed'; $strUpdatePrivMessage = 'You have updated the privileges for %s.';//to translate $strUpdateProfile = 'Update profile:';//to translate $strUpdateProfileMessage = 'The profile has been updated.';//to translate + +// Indexes +$strAddToIndex = 'Add to index  %s column(s)'; +$strCantRenameIdxToPrimary = 'Can\'t rename index to PRIMARY!'; +$strCardinality = 'Cardinality'; +$strCreateIndex = 'Create an index on %s columns'; +$strCreateIndexTopic = 'Create a new index'; +$strIgnore = 'Ignore'; +$strIndexName = 'Index name :'; +$strIndexType = 'Index type :'; +$strModifyIndexTopic = 'Modify an index'; +$strNone = 'None'; +$strNoIndexPartsDefined = 'No index parts defined!'; +$strNoIndex = 'No index defined!'; +$strPrimaryKeyName = 'The name of the primary key must be... PRIMARY!'; +$strPrimaryKeyWarning = '("PRIMARY" must be the name of and only of a primary key!)'; ?> diff --git a/lang/italian.inc.php3 b/lang/italian.inc.php3 index 57114099a..ca9baa2bf 100644 --- a/lang/italian.inc.php3 +++ b/lang/italian.inc.php3 @@ -324,5 +324,19 @@ $strYes = ' Si '; $strZip = '"compresso con zip"'; // To translate - +// Indexes +$strAddToIndex = 'Add to index  %s column(s)'; +$strCantRenameIdxToPrimary = 'Can\'t rename index to PRIMARY!'; +$strCardinality = 'Cardinality'; +$strCreateIndex = 'Create an index on %s columns'; +$strCreateIndexTopic = 'Create a new index'; +$strIgnore = 'Ignore'; +$strIndexName = 'Index name :'; +$strIndexType = 'Index type :'; +$strModifyIndexTopic = 'Modify an index'; +$strNone = 'None'; +$strNoIndexPartsDefined = 'No index parts defined!'; +$strNoIndex = 'No index defined!'; +$strPrimaryKeyName = 'The name of the primary key must be... PRIMARY!'; +$strPrimaryKeyWarning = '("PRIMARY" must be the name of and only of a primary key!)'; ?> diff --git a/lang/japanese.inc.php3 b/lang/japanese.inc.php3 index 4cbef2d8d..f68c66873 100644 --- a/lang/japanese.inc.php3 +++ b/lang/japanese.inc.php3 @@ -325,4 +325,20 @@ $strUpdateProfile = 'Update profile:';//to translate $strUpdateProfileMessage = 'The profile has been updated.';//to translate $strUseBackquotes = 'Use backquotes with tables and fields\' names'; $strWithChecked = 'With selected:'; + +// Indexes +$strAddToIndex = 'Add to index  %s column(s)'; +$strCantRenameIdxToPrimary = 'Can\'t rename index to PRIMARY!'; +$strCardinality = 'Cardinality'; +$strCreateIndex = 'Create an index on %s columns'; +$strCreateIndexTopic = 'Create a new index'; +$strIgnore = 'Ignore'; +$strIndexName = 'Index name :'; +$strIndexType = 'Index type :'; +$strModifyIndexTopic = 'Modify an index'; +$strNone = 'None'; +$strNoIndexPartsDefined = 'No index parts defined!'; +$strNoIndex = 'No index defined!'; +$strPrimaryKeyName = 'The name of the primary key must be... PRIMARY!'; +$strPrimaryKeyWarning = '("PRIMARY" must be the name of and only of a primary key!)'; ?> diff --git a/lang/korean.inc.php3 b/lang/korean.inc.php3 index 2ea293ffb..7f33f4c59 100644 --- a/lang/korean.inc.php3 +++ b/lang/korean.inc.php3 @@ -325,4 +325,20 @@ $strUpdateProfile = 'Update profile:';//to translate $strUpdateProfileMessage = 'The profile has been updated.';//to translate $strUseBackquotes = 'Use backquotes with tables and fields\' names'; $strWithChecked = 'With selected:'; + +// Indexes +$strAddToIndex = 'Add to index  %s column(s)'; +$strCantRenameIdxToPrimary = 'Can\'t rename index to PRIMARY!'; +$strCardinality = 'Cardinality'; +$strCreateIndex = 'Create an index on %s columns'; +$strCreateIndexTopic = 'Create a new index'; +$strIgnore = 'Ignore'; +$strIndexName = 'Index name :'; +$strIndexType = 'Index type :'; +$strModifyIndexTopic = 'Modify an index'; +$strNone = 'None'; +$strNoIndexPartsDefined = 'No index parts defined!'; +$strNoIndex = 'No index defined!'; +$strPrimaryKeyName = 'The name of the primary key must be... PRIMARY!'; +$strPrimaryKeyWarning = '("PRIMARY" must be the name of and only of a primary key!)'; ?> diff --git a/lang/norwegian.inc.php3 b/lang/norwegian.inc.php3 index 99af8a6f0..3b0c04ebe 100644 --- a/lang/norwegian.inc.php3 +++ b/lang/norwegian.inc.php3 @@ -321,4 +321,20 @@ $strZip = '"komprimert (zip)"'; $strAfterInsertBack = 'Return'; $strAfterInsertNewInsert = 'Insert a new record'; $strBookmarkDeleted = 'The bookmark has been deleted.'; + +// Indexes +$strAddToIndex = 'Add to index  %s column(s)'; +$strCantRenameIdxToPrimary = 'Can\'t rename index to PRIMARY!'; +$strCardinality = 'Cardinality'; +$strCreateIndex = 'Create an index on %s columns'; +$strCreateIndexTopic = 'Create a new index'; +$strIgnore = 'Ignore'; +$strIndexName = 'Index name :'; +$strIndexType = 'Index type :'; +$strModifyIndexTopic = 'Modify an index'; +$strNone = 'None'; +$strNoIndexPartsDefined = 'No index parts defined!'; +$strNoIndex = 'No index defined!'; +$strPrimaryKeyName = 'The name of the primary key must be... PRIMARY!'; +$strPrimaryKeyWarning = '("PRIMARY" must be the name of and only of a primary key!)'; ?> diff --git a/lang/polish.inc.php3 b/lang/polish.inc.php3 index b3b3830a5..4c3ced9ea 100644 --- a/lang/polish.inc.php3 +++ b/lang/polish.inc.php3 @@ -321,4 +321,20 @@ $strCopyTable = 'Copy table to (database.table):'; $strMoveTable = 'Move table to (database.table):'; $strMoveTableOK = 'Table %s has been moved to %s.'; $strNoQuery = 'No SQL query!'; //to translate + +// Indexes +$strAddToIndex = 'Add to index  %s column(s)'; +$strCantRenameIdxToPrimary = 'Can\'t rename index to PRIMARY!'; +$strCardinality = 'Cardinality'; +$strCreateIndex = 'Create an index on %s columns'; +$strCreateIndexTopic = 'Create a new index'; +$strIgnore = 'Ignore'; +$strIndexName = 'Index name :'; +$strIndexType = 'Index type :'; +$strModifyIndexTopic = 'Modify an index'; +$strNone = 'None'; +$strNoIndexPartsDefined = 'No index parts defined!'; +$strNoIndex = 'No index defined!'; +$strPrimaryKeyName = 'The name of the primary key must be... PRIMARY!'; +$strPrimaryKeyWarning = '("PRIMARY" must be the name of and only of a primary key!)'; ?> diff --git a/lang/portuguese.inc.php3 b/lang/portuguese.inc.php3 index ae038f229..bffb3424a 100644 --- a/lang/portuguese.inc.php3 +++ b/lang/portuguese.inc.php3 @@ -325,4 +325,20 @@ $strUpdateProfile = 'Update profile:';//to translate $strUpdateProfileMessage = 'The profile has been updated.';//to translate $strUseBackquotes = 'Use backquotes with tables and fields\' names'; $strWithChecked = 'With selected:'; + +// Indexes +$strAddToIndex = 'Add to index  %s column(s)'; +$strCantRenameIdxToPrimary = 'Can\'t rename index to PRIMARY!'; +$strCardinality = 'Cardinality'; +$strCreateIndex = 'Create an index on %s columns'; +$strCreateIndexTopic = 'Create a new index'; +$strIgnore = 'Ignore'; +$strIndexName = 'Index name :'; +$strIndexType = 'Index type :'; +$strModifyIndexTopic = 'Modify an index'; +$strNone = 'None'; +$strNoIndexPartsDefined = 'No index parts defined!'; +$strNoIndex = 'No index defined!'; +$strPrimaryKeyName = 'The name of the primary key must be... PRIMARY!'; +$strPrimaryKeyWarning = '("PRIMARY" must be the name of and only of a primary key!)'; ?> diff --git a/lang/romanian.inc.php3 b/lang/romanian.inc.php3 index 2bf363754..7cdc67e29 100644 --- a/lang/romanian.inc.php3 +++ b/lang/romanian.inc.php3 @@ -321,4 +321,20 @@ $strMoveTable = 'Move table to (database.table):'; $strMoveTableOK = 'Table %s has been moved to %s.'; $strNoQuery = 'No SQL query!'; //to translate $strZip = '"zipped"'; //to translate + +// Indexes +$strAddToIndex = 'Add to index  %s column(s)'; +$strCantRenameIdxToPrimary = 'Can\'t rename index to PRIMARY!'; +$strCardinality = 'Cardinality'; +$strCreateIndex = 'Create an index on %s columns'; +$strCreateIndexTopic = 'Create a new index'; +$strIgnore = 'Ignore'; +$strIndexName = 'Index name :'; +$strIndexType = 'Index type :'; +$strModifyIndexTopic = 'Modify an index'; +$strNone = 'None'; +$strNoIndexPartsDefined = 'No index parts defined!'; +$strNoIndex = 'No index defined!'; +$strPrimaryKeyName = 'The name of the primary key must be... PRIMARY!'; +$strPrimaryKeyWarning = '("PRIMARY" must be the name of and only of a primary key!)'; ?> diff --git a/lang/russian-koi8.inc.php3 b/lang/russian-koi8.inc.php3 index cf76083b9..e0c2967a5 100644 --- a/lang/russian-koi8.inc.php3 +++ b/lang/russian-koi8.inc.php3 @@ -322,4 +322,20 @@ $strZip = ' $strAfterInsertBack = 'Return'; $strAfterInsertNewInsert = 'Insert a new record'; $strBookmarkDeleted = 'The bookmark has been deleted.'; + +// Indexes +$strAddToIndex = 'Add to index  %s column(s)'; +$strCantRenameIdxToPrimary = 'Can\'t rename index to PRIMARY!'; +$strCardinality = 'Cardinality'; +$strCreateIndex = 'Create an index on %s columns'; +$strCreateIndexTopic = 'Create a new index'; +$strIgnore = 'Ignore'; +$strIndexName = 'Index name :'; +$strIndexType = 'Index type :'; +$strModifyIndexTopic = 'Modify an index'; +$strNone = 'None'; +$strNoIndexPartsDefined = 'No index parts defined!'; +$strNoIndex = 'No index defined!'; +$strPrimaryKeyName = 'The name of the primary key must be... PRIMARY!'; +$strPrimaryKeyWarning = '("PRIMARY" must be the name of and only of a primary key!)'; ?> diff --git a/lang/russian-win1251.inc.php3 b/lang/russian-win1251.inc.php3 index bfdfa8cdc..ff60084aa 100644 --- a/lang/russian-win1251.inc.php3 +++ b/lang/russian-win1251.inc.php3 @@ -322,4 +322,20 @@ $strZip = ' $strAfterInsertBack = 'Return'; $strAfterInsertNewInsert = 'Insert a new record'; $strBookmarkDeleted = 'The bookmark has been deleted.'; + +// Indexes +$strAddToIndex = 'Add to index  %s column(s)'; +$strCantRenameIdxToPrimary = 'Can\'t rename index to PRIMARY!'; +$strCardinality = 'Cardinality'; +$strCreateIndex = 'Create an index on %s columns'; +$strCreateIndexTopic = 'Create a new index'; +$strIgnore = 'Ignore'; +$strIndexName = 'Index name :'; +$strIndexType = 'Index type :'; +$strModifyIndexTopic = 'Modify an index'; +$strNone = 'None'; +$strNoIndexPartsDefined = 'No index parts defined!'; +$strNoIndex = 'No index defined!'; +$strPrimaryKeyName = 'The name of the primary key must be... PRIMARY!'; +$strPrimaryKeyWarning = '("PRIMARY" must be the name of and only of a primary key!)'; ?> diff --git a/lang/slovak-iso.inc.php3 b/lang/slovak-iso.inc.php3 index a1785af3a..d355468a6 100644 --- a/lang/slovak-iso.inc.php3 +++ b/lang/slovak-iso.inc.php3 @@ -325,4 +325,19 @@ $strZip = '"zo zipovan // To translate +// Indexes +$strAddToIndex = 'Add to index  %s column(s)'; +$strCantRenameIdxToPrimary = 'Can\'t rename index to PRIMARY!'; +$strCardinality = 'Cardinality'; +$strCreateIndex = 'Create an index on %s columns'; +$strCreateIndexTopic = 'Create a new index'; +$strIgnore = 'Ignore'; +$strIndexName = 'Index name :'; +$strIndexType = 'Index type :'; +$strModifyIndexTopic = 'Modify an index'; +$strNone = 'None'; +$strNoIndexPartsDefined = 'No index parts defined!'; +$strNoIndex = 'No index defined!'; +$strPrimaryKeyName = 'The name of the primary key must be... PRIMARY!'; +$strPrimaryKeyWarning = '("PRIMARY" must be the name of and only of a primary key!)'; ?> diff --git a/lang/spanish.inc.php3 b/lang/spanish.inc.php3 index 0603a2044..3876608ee 100644 --- a/lang/spanish.inc.php3 +++ b/lang/spanish.inc.php3 @@ -320,4 +320,20 @@ $strUpdateProfile = 'Update profile:';//to translate $strUpdateProfileMessage = 'The profile has been updated.';//to translate $strWithChecked = 'With selected:'; $strZip = '"zipped"'; //to translate + +// Indexes +$strAddToIndex = 'Add to index  %s column(s)'; +$strCantRenameIdxToPrimary = 'Can\'t rename index to PRIMARY!'; +$strCardinality = 'Cardinality'; +$strCreateIndex = 'Create an index on %s columns'; +$strCreateIndexTopic = 'Create a new index'; +$strIgnore = 'Ignore'; +$strIndexName = 'Index name :'; +$strIndexType = 'Index type :'; +$strModifyIndexTopic = 'Modify an index'; +$strNone = 'None'; +$strNoIndexPartsDefined = 'No index parts defined!'; +$strNoIndex = 'No index defined!'; +$strPrimaryKeyName = 'The name of the primary key must be... PRIMARY!'; +$strPrimaryKeyWarning = '("PRIMARY" must be the name of and only of a primary key!)'; ?> diff --git a/lang/swedish.inc.php3 b/lang/swedish.inc.php3 index 4eef4e574..e91385b64 100644 --- a/lang/swedish.inc.php3 +++ b/lang/swedish.inc.php3 @@ -322,4 +322,20 @@ $strZip = '"zippad"'; $strAfterInsertBack = 'Return'; $strAfterInsertNewInsert = 'Insert a new record'; $strBookmarkDeleted = 'The bookmark has been deleted.'; + +// Indexes +$strAddToIndex = 'Add to index  %s column(s)'; +$strCantRenameIdxToPrimary = 'Can\'t rename index to PRIMARY!'; +$strCardinality = 'Cardinality'; +$strCreateIndex = 'Create an index on %s columns'; +$strCreateIndexTopic = 'Create a new index'; +$strIgnore = 'Ignore'; +$strIndexName = 'Index name :'; +$strIndexType = 'Index type :'; +$strModifyIndexTopic = 'Modify an index'; +$strNone = 'None'; +$strNoIndexPartsDefined = 'No index parts defined!'; +$strNoIndex = 'No index defined!'; +$strPrimaryKeyName = 'The name of the primary key must be... PRIMARY!'; +$strPrimaryKeyWarning = '("PRIMARY" must be the name of and only of a primary key!)'; ?> diff --git a/lang/thai.inc.php3 b/lang/thai.inc.php3 index b6d56e955..d17c53c25 100644 --- a/lang/thai.inc.php3 +++ b/lang/thai.inc.php3 @@ -326,4 +326,20 @@ $strUpdateProfile = 'Update profile:';//to translate $strUpdateProfileMessage = 'The profile has been updated.';//to translate $strUseBackquotes = 'Use backquotes with tables and fields\' names'; $strWithChecked = 'With selected:'; + +// Indexes +$strAddToIndex = 'Add to index  %s column(s)'; +$strCantRenameIdxToPrimary = 'Can\'t rename index to PRIMARY!'; +$strCardinality = 'Cardinality'; +$strCreateIndex = 'Create an index on %s columns'; +$strCreateIndexTopic = 'Create a new index'; +$strIgnore = 'Ignore'; +$strIndexName = 'Index name :'; +$strIndexType = 'Index type :'; +$strModifyIndexTopic = 'Modify an index'; +$strNone = 'None'; +$strNoIndexPartsDefined = 'No index parts defined!'; +$strNoIndex = 'No index defined!'; +$strPrimaryKeyName = 'The name of the primary key must be... PRIMARY!'; +$strPrimaryKeyWarning = '("PRIMARY" must be the name of and only of a primary key!)'; ?> diff --git a/lang/turkish.inc.php3 b/lang/turkish.inc.php3 index 22add9f5b..8ddb0dd05 100644 --- a/lang/turkish.inc.php3 +++ b/lang/turkish.inc.php3 @@ -322,4 +322,20 @@ $strZip = '"ziplenmi $strAfterInsertBack = 'Return'; $strAfterInsertNewInsert = 'Insert a new record'; $strBookmarkDeleted = 'The bookmark has been deleted.'; + +// Indexes +$strAddToIndex = 'Add to index  %s column(s)'; +$strCantRenameIdxToPrimary = 'Can\'t rename index to PRIMARY!'; +$strCardinality = 'Cardinality'; +$strCreateIndex = 'Create an index on %s columns'; +$strCreateIndexTopic = 'Create a new index'; +$strIgnore = 'Ignore'; +$strIndexName = 'Index name :'; +$strIndexType = 'Index type :'; +$strModifyIndexTopic = 'Modify an index'; +$strNone = 'None'; +$strNoIndexPartsDefined = 'No index parts defined!'; +$strNoIndex = 'No index defined!'; +$strPrimaryKeyName = 'The name of the primary key must be... PRIMARY!'; +$strPrimaryKeyWarning = '("PRIMARY" must be the name of and only of a primary key!)'; ?> diff --git a/libraries/indexes.js b/libraries/indexes.js new file mode 100644 index 000000000..8b0a7aad3 --- /dev/null +++ b/libraries/indexes.js @@ -0,0 +1,87 @@ +/* $Id$ */ + + +/** + * Ensures a value submitted in a form is numeric and is in a range + * + * @param object the form + * @param string the name of the form field to check + * @param integer the minimum authorized value + * @param integer the maximum authorized value + * + * @return boolean whether a valid number has been submitted or not + */ +function checkFormElementInRange(theForm, theFieldName, min, max) +{ + var theField = theForm.elements[theFieldName]; + var val = parseInt(theField.value); + + if (typeof(min) == 'undefined') { + min = 0; + } + if (typeof(max) == 'undefined') { + max = Number.MAX_VALUE; + } + + // It's not a number + if (isNaN(val)) { + theField.select(); + alert(errorMsg1); + theField.focus(); + return false; + } + // It's a number but it is not between min and max + else if (val < min || val > max) { + theField.select(); + alert(val + errorMsg2); + theField.focus(); + return false; + } + // It's a valid number + else { + theField.value = val; + } + + return true; +} // end of the 'checkFormElementInRange()' function + + +/** + * Ensures indexes names are valid according to their type and, for a primary + * key, lock index name to 'PRIMARY' + * + * @return boolean false if there is no index form, true else + */ +function checkIndexName() +{ + if (typeof(document.forms['index_frm']) == 'undefined') { + return false; + } + + // Gets the elements pointers + var the_idx_name = document.forms['index_frm'].elements['index']; + var the_idx_type = document.forms['index_frm'].elements['index_type']; + + // Index is a primary key + if (the_idx_type.options[0].value == 'PRIMARY' && the_idx_type.options[0].selected) { + document.forms['index_frm'].elements['index'].value = 'PRIMARY'; + if (typeof(the_idx_name.disabled) != 'undefined') { + document.forms['index_frm'].elements['index'].disabled = true; + } + } + + // Other cases + else { + if (the_idx_name.value == 'PRIMARY') { + document.forms['index_frm'].elements['index'].value = ''; + } + if (typeof(the_idx_name.disabled) != 'undefined') { + document.forms['index_frm'].elements['index'].disabled = false; + } + } + + return true; +} // end of the 'checkIndexName()' function + + +onload = checkIndexName; diff --git a/tbl_indexes.php3 b/tbl_indexes.php3 new file mode 100644 index 000000000..cca988d3a --- /dev/null +++ b/tbl_indexes.php3 @@ -0,0 +1,501 @@ + back to the welcome page + if (!empty($db)) { + $is_db = @mysql_select_db($db); + } + if (empty($db) || !$is_db) { + header('Location: ' . $cfgPmaAbsoluteUri . 'main.php3?lang=' . $lang . '&server=' . $server . (isset($message) ? '&message=' . urlencode($message) : '') . '&reload=1'); + exit(); + } + // Not a valid table name -> back to the db_details.php3 + if (!empty($table)) { + $is_table = @mysql_query("SHOW TABLES LIKE '" . sql_addslashes($table, TRUE) . '\''); + } + if (empty($table) || !@mysql_numrows($is_table)) { + header('Location: ' . $cfgPmaAbsoluteUri . 'db_details.php3?lang=' . $lang . '&server=' . $server . '&db=' . urlencode($db) . (isset($message) ? '&message=' . urlencode($message) : '') . '&reload=1'); + exit(); + } else if (isset($is_table)) { + mysql_free_result($is_table); + } + + // Displays headers (if needed) + $js_to_run = ((isset($index) && isset($do_save_data)) ? 'functions.js' : 'indexes.js'); + include('./header.inc.php3'); +} // end if + + +/** + * Gets fields and indexes informations + */ +if (defined('_IDX_INCLUDED_')) { + $err_url_0 = 'db_details.php3' + . '?lang=' . $lang + . '&server=' . $server + . '&db=' . urlencode($db); +} + +// Gets table keys and store them in arrays +$indexes = array(); +$prev_index = ''; +$indexes_info = array(); +$indexes_data = array(); +// keys had already been grabbed in "tbl_properties.php3" +if (defined('_IDX_INCLUDED_')) { + $idx_cnt = count($ret_keys); +} else { + $local_query = 'SHOW KEYS FROM ' . backquote($table); + $result = mysql_query($local_query) or mysql_die('', $local_query, '', $err_url_0); + $idx_cnt = mysql_num_rows($result); +} + +for ($i = 0; $i < $idx_cnt; $i++) { + $row = (defined('_IDX_INCLUDED_') ? $ret_keys[$i] : mysql_fetch_array($result)); + + if ($row['Key_name'] != $prev_index ){ + $indexes[] = $row['Key_name']; + $prev_index = $row['Key_name']; + } + $indexes_info[$row['Key_name']]['Sequences'][] = $row['Seq_in_index']; + $indexes_info[$row['Key_name']]['Non_unique'] = $row['Non_unique']; + if (isset($row['Cardinality'])) { + $indexes_info[$row['Key_name']]['Cardinality'] = $row['Cardinality']; + } +// I don't know what does following column mean.... +// $indexes_info[$row['Key_name']]['Packed'] = $row['Packed']; + $indexes_info[$row['Key_name']]['Comment'] = $row['Comment']; + + $indexes_data[$row['Key_name']][$row['Seq_in_index']]['Column_name'] = $row['Column_name']; + if (isset($row['Sub_part'])) { + $indexes_data[$row['Key_name']][$row['Seq_in_index']]['Sub_part'] = $row['Sub_part']; + } +} // end while + +if (defined('_IDX_INCLUDED_')) { + unset($ret_keys); +} else if ($result) { + mysql_free_result($result); +} + +// Get fields and stores their name/type +// fields had already been grabbed in "tbl_properties.php3" +if (defined('_IDX_INCLUDED_')) { + mysql_data_seek($fields_rs, 0); +} else { + $local_query = 'SHOW FIELDS FROM ' . backquote($table); + $fields_rs = mysql_query($local_query) or mysql_die('', $local_query, '', $err_url_0); + $fields_cnt = mysql_num_rows($fields_rs); +} + +$fields_names = array(); +$fields_types = array(); +while ($row = mysql_fetch_array($fields_rs)) { + $fields_names[] = $row['Field']; + $fields_types[] = $row['Type']; +} // end while + +if ($fields_rs) { + mysql_free_result($fields_rs); +} + + +/** + * Stipslashes some variables if required + */ +if (get_magic_quotes_gpc()) { + if (isset($index)) { + $index = stripslashes($index); + } + if (isset($old_index)) { + $old_index = stripslashes($old_index); + } +} // end if + + +/** + * Do run the query to build the new index and moves back to + * "tbl_properties.php3" + */ +if (!defined('_IDX_INCLUDED_') + && (isset($index) && isset($do_save_data))) { + + $err_url = 'tbl_indexes.php3' + . '?lang=' . $lang + . '&server=' . $server + . '&db=' . urlencode($db) + . '&table=' . urlencode($table); + if (empty($old_index)) { + $err_url .= '&create_index=1&idx_num_fields=' . $idx_num_fields; + } else { + $err_url .= '&index=' . urlencode($old_index); + } + + if ($index_type == 'PRIMARY') { + if ($index == '') { + $index = 'PRIMARY'; + } else if ($index != 'PRIMARY') { + mysql_die($strPrimaryKeyName, '', FALSE, $err_url); + } + } else if ($index == 'PRIMARY') { + mysql_die($strCantRenameIdxToPrimary, '', FALSE, $err_url); + } + + $sql_query = 'ALTER TABLE ' . backquote($table); + + // Drops the old index + if (!empty($old_index)) { + if ($old_index == 'PRIMARY') { + $sql_query .= ' DROP PRIMARY KEY,'; + } else { + $sql_query .= ' DROP INDEX ' . backquote($old_index) .','; + } + } // end if + + // Builds the new one + switch ($index_type) { + case 'PRIMARY': + $sql_query .= ' ADD PRIMARY KEY ('; + break; + case 'FULLTEXT': + $sql_query .= ' ADD FULLTEXT ' . (empty($index) ? '' : backquote($index)) . ' ('; + break; + case 'UNIQUE': + $sql_query .= ' ADD UNIQUE ' . (empty($index) ? '' : backquote($index)) . ' ('; + break; + case 'INDEX': + $sql_query .= ' ADD INDEX ' . (empty($index) ? '' : backquote($index)) . ' ('; + break; + } // end switch + $index_fields = ''; + while (list($i, $name) = each($column)) { + if ($name != '--ignore--') { + $index_fields .= (empty($index_fields) ? '' : ',') + . backquote(get_magic_quotes_gpc() ? stripslashes($name) : $name) + . (empty($sub_part[$i]) ? '' : '(' . $sub_part[$i] . ')'); + } + } // end while + if (empty($index_fields)){ + mysql_die($strNoIndexPartsDefined, '', FALSE, $err_url); + } else { + $sql_query .= $index_fields . ')'; + } + + $result = mysql_query($sql_query) or mysql_die('', '', FALSE, $err_url); + $message = $strTable . ' ' . htmlspecialchars($table) . ' ' . $strHasBeenAltered; + + include('./tbl_properties.php3'); + exit(); +} // end builds the new index + + +/** + * Edits an index or defines a new one + */ +else if (!defined('_IDX_INCLUDED_') + && (isset($index) || isset($create_index))) { + + // Prepares the form values + if (!isset($index)) { + $index = ''; + } + if (!isset($index_type)) { + $index_type = ''; + } + if ($index == '' || !isset($indexes_info[$index])) { + $edited_index_info['Sequences'] = array(); + $edited_index_data = array(); + for ($i = 1; $i <= $idx_num_fields; $i++) { + $edited_index_info['Sequences'][] = $i; + $edited_index_data[$i] = array('Column_name' => '', 'Sub_part' => ''); + } // end for + if ($index == '' + && !isset($indexes_info['PRIMARY']) + && ($index_type == '' || $index_type == 'PRIMARY')) { + $index = 'PRIMARY'; + } + } else { + $edited_index_info = $indexes_info[$index]; + $edited_index_data = $indexes_data[$index]; + if ($edited_index_info['Comment'] == 'FULLTEXT') { + $index_type = 'FULLTEXT'; + } else if ($index == 'PRIMARY') { + $index_type = 'PRIMARY'; + } else if ($edited_index_info['Non_unique'] == '0') { + $index_type = 'UNIQUE'; + } else { + $index_type = 'INDEX'; + } + } // end if... else... + + if (isset($add_fields)) { + if (isset($prev_add_fields)) { + $added_fields += $prev_add_fields; + } + $field_cnt = count($edited_index_info['Sequences']) + 1; + for ($i = $field_cnt; $i < ($added_fields + $field_cnt); $i++) { + $edited_index_info['Sequences'][] = $i; + $edited_index_data[$i] = array('Column_name' => '', 'Sub_part' => ''); + } // end for + + // Restore entered values + while (list($i, $name) = each($column)) { + if ($name != '--ignore--'){ + $edited_index_data[$i+1]['Column_name'] = $name; + $edited_index_data[$i+1]['Sub_part'] = $sub_part[$i]; + } + } // end while + } // end if + // end preparing form values + ?> + + +
+ + + + + '; + } + echo "\n"; + ?> + + +

+ + + + + + + + + + +
  + +   +
  +   + +

+ + + + + + + + + + + + +
+ + + /> +

+ +
+ + '; + } + if (isset($idx_num_fields)) { + echo ' ' . "\n"; + } + echo '

' . "\n"; + echo ' ' . sprintf($strAddToIndex, '') . "\n"; + echo '  ' . "\n"; + +} else { + /** + * Display indexes + */ + ?> + + + + + + + ' ."\n"; + + if ($idx_cnt > 0) { + ?> + + + + + + + + + ' . "\n"; + echo ' ' . "\n"; + echo $index_td + . ' ' . htmlspecialchars($index_name) . "\n" + . ' ' . "\n"; + + if ($indexes_info[$index_name]['Comment'] == 'FULLTEXT') { + $index_type = 'FULLTEXT'; + } else if ($index_name == 'PRIMARY') { + $index_type = 'PRIMARY'; + } else if ($indexes_info[$index_name]['Non_unique'] == '0') { + $index_type = 'UNIQUE'; + } else { + $index_type = 'INDEX'; + } + echo $index_td + . ' ' . $index_type . "\n" + . ' ' . "\n"; + + echo $index_td + . ' ' . (isset($indexes_info[$index_name]['Cardinality']) ? $indexes_info[$index_name]['Cardinality'] : $strNone) . "\n" + . ' ' . "\n"; + + if ($index_name == 'PRIMARY') { + $sql_query = urlencode('ALTER TABLE ' . backquote($table) . ' DROP PRIMARY KEY'); + $js_msg = 'ALTER TABLE ' . js_format($table) . ' DROP PRIMARY KEY'; + $zero_rows = urlencode($strPrimaryKeyHasBeenDropped); + } else { + $sql_query = urlencode('ALTER TABLE ' . backquote($table) . ' DROP INDEX ' . backquote($index_name)); + $js_msg = 'ALTER TABLE ' . js_format($table) . ' DROP INDEX ' . js_format($index_name); + $zero_rows = urlencode(sprintf($strIndexHasBeenDropped, htmlspecialchars($index_name))); + } + echo $index_td + . ' ' . $strDrop . '' . "\n" + . ' ' . "\n"; + + echo $index_td + . ' ' . $strEdit . '' . "\n" + . ' ' . "\n"; + + while (list($row_no, $seq_index) = each($indexes_info[$index_name]['Sequences'])) { + if ($row_no > 0) { + echo ' ' . "\n"; + } + if (!empty($indexes_data[$index_name][$seq_index]['Sub_part'])) { + echo ' ' . "\n"; + echo ' ' . "\n"; + echo ' ' . "\n"; + } else { + echo ' ' . "\n"; + echo ' ' . "\n"; + } + } // end while + } // end while + ?> +
' . "\n" + . ' ' . $indexes_data[$index_name][$seq_index]['Column_name'] . "\n" + . ' ' . "\n" + . ' ' . $indexes_data[$index_name][$seq_index]['Sub_part'] . "\n" + . '
' . "\n" + . ' ' . $indexes_data[$index_name][$seq_index]['Column_name'] . "\n" + . '

+ ' . "\n"; + echo ' ' . $strNoIndex . '

' . "\n\n"; + } + + echo ' ' . sprintf($strCreateIndex, '') . "\n"; + echo '  ' . "\n"; + echo ' '; +} // end display indexes + +?> +
+ + + diff --git a/tbl_printview.php3 b/tbl_printview.php3 index 59fbb2ddf..870ceb005 100755 --- a/tbl_printview.php3 +++ b/tbl_printview.php3 @@ -42,40 +42,51 @@ if (MYSQL_INT_VERSION >= 32303) { $num_rows = mysql_result($result, 0, 'count'); $show_comment = ''; } // end display comments -mysql_free_result($result); +if ($result) { + mysql_free_result($result); +} /** * Gets table keys and retains them */ -$local_query = 'SHOW KEYS FROM ' . backquote($table); -$result = mysql_query($local_query) or mysql_die('', $local_query, '', $err_url); -$primary = ''; -$prev_key = ''; -$prev_seq = 0; -$i = 0; -$pk_array = array(); // will be use to emphasis prim. keys in the table view +$local_query = 'SHOW KEYS FROM ' . backquote($table); +$result = mysql_query($local_query) or mysql_die('', $local_query, '', $err_url); +$primary = ''; +$indexes = array(); +$lastIndex = ''; +$indexes_info = array(); +$indexes_data = array(); +$pk_array = array(); // will be use to emphasis prim. keys in the table view while ($row = mysql_fetch_array($result)) { - $ret_keys[] = $row; - // Unset the 'Seq_in_index' value if it's not a composite index - part 1 - if ($i > 0 && $row['Key_name'] != $prev_key && $prev_seq == 1) { - unset($ret_keys[$i-1]['Seq_in_index']); - } - $prev_key = $row['Key_name']; - $prev_seq = $row['Seq_in_index']; // Backups the list of primary keys if ($row['Key_name'] == 'PRIMARY') { $primary .= $row['Column_name'] . ', '; $pk_array[$row['Column_name']] = 1; } - $i++; -} // end while -// Unset the 'Seq_in_index' value if it's not a composite index - part 2 -if ($i > 0 && $row['Key_name'] != $prev_key && $prev_seq == 1) { - unset($ret_keys[$i-1]['Seq_in_index']); -} -mysql_free_result($result); + // Retains keys informations + if ($row['Key_name'] != $lastIndex ){ + $indexes[] = $row['Key_name']; + $lastIndex = $row['Key_name']; + } + $indexes_info[$row['Key_name']]['Sequences'][] = $row['Seq_in_index']; + $indexes_info[$row['Key_name']]['Non_unique'] = $row['Non_unique']; + if (isset($row['Cardinality'])) { + $indexes_info[$row['Key_name']]['Cardinality'] = $row['Cardinality']; + } +// I don't know what does following column mean.... +// $indexes_info[$row['Key_name']]['Packed'] = $row['Packed']; + $indexes_info[$row['Key_name']]['Comment'] = $row['Comment']; + $indexes_data[$row['Key_name']][$row['Seq_in_index']]['Column_name'] = $row['Column_name']; + if (isset($row['Sub_part'])) { + $indexes_data[$row['Key_name']][$row['Seq_in_index']]['Sub_part'] = $row['Sub_part']; + } + +} // end while +if ($result) { + mysql_free_result($result); +} /** * Gets fields properties @@ -181,8 +192,8 @@ echo "\n"; /** * Displays indexes */ -$index_count = (isset($ret_keys)) - ? count($ret_keys) +$index_count = (isset($indexes)) + ? count($indexes) : 0; if ($index_count > 0) { ?> @@ -191,69 +202,59 @@ if ($index_count > 0) {   - - - + + + + + + = 32323) { - echo "\n"; - ?> - - - - -  -' . $row['Seq_in_index'] . '-'; - } else { - $key_name = htmlspecialchars($row['Key_name']); - } - if (!isset($row['Sub_part'])) { - $row['Sub_part'] = ''; - } + while (list($index_no, $index_name) = each($indexes)) { + $cell_bgd = (($index_no % 2) ? $cfgBgcolorOne : $cfgBgcolorTwo); + $index_td = ' ' . "\n"; + echo $index_td + . ' ' . htmlspecialchars($index_name) . "\n" + . ' ' . "\n"; - if ($row['Key_name'] != $prev_key) { - $j++; - $prev_key = $row['Key_name']; - } - $bgcolor = ($j % 2) ? $cfgBgcolorOne : $cfgBgcolorTwo; - echo "\n"; - ?> - - - - = 32323) { - echo "\n"; - ?> - - - - - - - - - ' . "\n"; + + echo $index_td + . ' ' . (isset($indexes_info[$index_name]['Cardinality']) ? $indexes_info[$index_name]['Cardinality'] : $strNone) . "\n" + . ' ' . "\n"; + + while (list($row_no, $seq_index) = each($indexes_info[$index_name]['Sequences'])) { + if ($row_no > 0) { + echo ' ' . "\n"; + } + if (!empty($indexes_data[$index_name][$seq_index]['Sub_part'])) { + echo ' ' . "\n"; + echo ' ' . "\n"; + echo ' ' . "\n"; + } else { + echo ' ' . "\n"; + echo ' ' . "\n"; + } + } // end while + } // end while ?>
' . "\n"; + echo '
 
' . "\n" + . ' ' . $indexes_data[$index_name][$seq_index]['Column_name'] . "\n" + . ' ' . "\n" + . ' ' . $indexes_data[$index_name][$seq_index]['Sub_part'] . "\n" + . '
' . "\n" + . ' ' . $indexes_data[$index_name][$seq_index]['Column_name'] . "\n" + . '
0 && $row['Key_name'] != $prev_key && $prev_seq == 1) { - unset($ret_keys[$i-1]['Seq_in_index']); - } - $prev_key = $row['Key_name']; - $prev_seq = $row['Seq_in_index']; // Backups the list of primary keys if ($row['Key_name'] == 'PRIMARY') { $primary .= $row['Column_name'] . ', '; $pk_array[$row['Column_name']] = 1; } - $i++; } // end while -// Unset the 'Seq_in_index' value if it's not a composite index - part 2 -if ($i > 0 && $row['Key_name'] != $prev_key && $prev_seq == 1) { - unset($ret_keys[$i-1]['Seq_in_index']); -} mysql_free_result($result); // 3. Get fields $local_query = 'SHOW FIELDS FROM ' . backquote($table); -$result = mysql_query($local_query) or mysql_die('', $local_query, '', $err_url_0); -$fields_cnt = mysql_num_rows($result); +$fields_rs = mysql_query($local_query) or mysql_die('', $local_query, '', $err_url_0); +$fields_cnt = mysql_num_rows($fields_rs); @@ -254,7 +241,7 @@ $fields_cnt = mysql_num_rows($result); $i = 0; $aryFields = array(); -while ($row = mysql_fetch_array($result)) { +while ($row = mysql_fetch_array($fields_rs)) { $i++; $bgcolor = ($i % 2) ? $cfgBgcolorOne : $cfgBgcolorTwo; $aryFields[] = $row['Field']; @@ -362,7 +349,6 @@ while ($row = mysql_fetch_array($result)) { @@ -440,103 +426,14 @@ echo "\n\n";
+ - 0) { - echo ' ' . "\n"; - } ?> +
0) { - ?> - - - - - - - - - = 32323) { - echo "\n"; - ?> - - - - - -  -' . $row['Seq_in_index'] . '-'; - } else { - $key_name = htmlspecialchars($row['Key_name']); - } - if (!isset($row['Sub_part'])) { - $row['Sub_part'] = ''; - } - if ($row['Key_name'] == 'PRIMARY') { - $sql_query = urlencode('ALTER TABLE ' . backquote($table) . ' DROP PRIMARY KEY'); - $js_msg = 'ALTER TABLE ' . js_format($table) . ' DROP PRIMARY KEY'; - $zero_rows = urlencode($strPrimaryKeyHasBeenDropped); - } else { - $sql_query = urlencode('ALTER TABLE ' . backquote($table) . ' DROP INDEX ' . backquote($row['Key_name'])); - $js_msg = 'ALTER TABLE ' . js_format($table) . ' DROP INDEX ' . js_format($row['Key_name']); - $zero_rows = urlencode(sprintf($strIndexHasBeenDropped, htmlspecialchars($row['Key_name']))); - } - - if ($row['Key_name'] != $prev_key) { - $j++; - $prev_key = $row['Key_name']; - } - $bgcolor = ($j % 2) ? $cfgBgcolorOne : $cfgBgcolorTwo; - echo "\n"; - ?> - - - - = 32323) { - echo "\n"; - ?> - - - - - - - - - - -
  - - -
- +define('_IDX_INCLUDED_', 1); +require ('./tbl_indexes.php3'); +?>
   @@ -1242,7 +1137,7 @@ else { // MySQL < 3.23.22
  • - +