/**
  * Tests for PMA_backquoteSplit() method.
  *
  * @return void
  * @test
  */
 public function testPMABackquoteSplit()
 {
     $text = "test `PMA` Back `quote` Split";
     $this->assertEquals(array('`PMA`', '`quote`'), PMA_backquoteSplit($text));
 }
Пример #2
0
    // end while
}
// end if (updates for internal relations)
// u p d a t e s    f o r    f o r e i g n    k e y s
// (for now, one index name only; we keep the definitions if the
// foreign db is not the same)
if (isset($_REQUEST['destination_foreign'])) {
    $display_query = '';
    $seen_error = false;
    foreach ($_REQUEST['destination_foreign'] as $master_field_md5 => $foreign_string) {
        $create = false;
        $drop = false;
        // Map the fieldname's md5 back to it's real name
        $master_field = $multi_edit_columns_name[$master_field_md5];
        if (!empty($foreign_string)) {
            list($foreign_db, $foreign_table, $foreign_field) = PMA_backquoteSplit($foreign_string);
            if (!isset($existrel_foreign[$master_field])) {
                // no key defined for this field
                $create = true;
            } elseif (PMA_Util::backquote($existrel_foreign[$master_field]['foreign_db']) != $foreign_db || PMA_Util::backquote($existrel_foreign[$master_field]['foreign_table']) != $foreign_table || PMA_Util::backquote($existrel_foreign[$master_field]['foreign_field']) != $foreign_field || $_REQUEST['constraint_name'][$master_field_md5] != $existrel_foreign[$master_field]['constraint'] || $_REQUEST['on_delete'][$master_field_md5] != (!empty($existrel_foreign[$master_field]['on_delete']) ? $existrel_foreign[$master_field]['on_delete'] : 'RESTRICT') || $_REQUEST['on_update'][$master_field_md5] != (!empty($existrel_foreign[$master_field]['on_update']) ? $existrel_foreign[$master_field]['on_update'] : 'RESTRICT')) {
                // another foreign key is already defined for this field
                // or an option has been changed for ON DELETE or ON UPDATE
                $drop = true;
                $create = true;
            }
            // end if... else....
        } elseif (isset($existrel_foreign[$master_field])) {
            $drop = true;
        }
        // end if... else....
        $tmp_error_drop = false;