Foreign Keys - MyISAM (2)

Help
2010-10-29
2013-06-06
  • Great app - I am tempted to allow end users to edit values after hiding all the important stuff :)

    I am in the same boat as simsalabim - using MYISAM - partly because of speed, but also for full text searching, apart from some other reasons. Obviously at the minute the is no foreign key support - and I understand you response that I will need to modify your code to make this (virtually) happen.

    But is the a way currently to display the field the foreign key is referring to beside the parent tables results (even if at the moment I cannot modify it directly)
    e.g.

    Table 1
    t1_id   name    country
    1       peter     1
    2       robert    3
    Table 2
    t2_id   country
    1       France
    2       UK
    3       Denmark
    

    In adminer editor is the anyway to show this in a MYISAM db:

    t1_id     Name      Country_name
    1         peter       France
    2         robert      Denmark
    
     
  • Jakub Vrána
    Jakub Vrána
    2010-10-29

    You can modify the displayed value in selectVal() method. However I've added the support for virtual foreign keys in Git. Now you can define the foreignKeys() method in your customization like this:

    function foreignKeys($table) {
    $connection = connection();
    $result = $connection->query("SELECT * FROM foreign_keys WHERE from_table = " . $connection->quote($table));
    $return = array();
    while ($row = $result->fetch_assoc()) {
    $return = array("table" => $row, "source" => array($row), "target" => array($row));
    }
    return $return;
    }

     
  • Excellant news. Thanks for the quick response. I will take a look as soon as I can.