#353 Unable to use binary as id properly

3.7.0
closed-fixed
nobody
None
5
2014-12-09
2013-12-06
Andy
No

When binary are used as id column, the function HEX is automatically used to display them. However, the display value is used without UNHEX when manipulating the row thus rows can never updated from the UI. Everything has to be done by query.

Discussion

  • Marçal Juan Llaó

    Yes, same problem here! I'm saving UUID's in binary(16) and it's really annoying :S.

    Thanks!

     
  • Jakub Vrána

    Jakub Vrána - 2014-02-24
    • status: open --> closed-out-of-date
     
  • Jakub Vrána

    Jakub Vrána - 2014-02-24

    This seems to be fixed in newer Adminer versions. Please upgrade and let me know if it still doesn't work for you.

     
  • Marçal Juan Llaó

    It's failing in v4.0.3. When I click on "edit" link on a data row.

     
  • Jakub Vrána

    Jakub Vrána - 2014-02-25

    It should be now fixed on GitHub. Please verify if it works for you.

     
  • Jakub Vrána

    Jakub Vrána - 2014-02-25
    • status: closed-out-of-date --> closed-fixed
     
  • Andy

    Andy - 2014-02-25

    Fantastic!

    I just gave it a spin, it works great. Many thanks, and congrats on this great app.
    I don't even know what we were doing before...

    Regards,

    Andy

     
  • mtlife

    mtlife - 2014-10-08

    The bug / unwanted behavior is still in there. It's easily removable from the latest revision in master (4.1.1dev) by removing:

        if (preg_match("~binary~", $field["type"])) {
            return "HEX(" . idf_escape($field["field"]) . ")";
        }
    

    and

        if (preg_match("~binary~", $field["type"])) {
            $return = "UNHEX($return)";
        }
    

    from mysql.inc.php so that these functions look like this:

    <?php
    /** Convert field in select and edit
    * @param array one element from fields()
    * @return string
    */
    function convert_field($field) {
        if ($field["type"] == "bit") {
            return "BIN(" . idf_escape($field["field"]) . " + 0)"; // + 0 is required outside MySQLnd
        }
        if (preg_match("~geometry|point|linestring|polygon~", $field["type"])) {
            return "AsWKT(" . idf_escape($field["field"]) . ")";
        }
    }
    
    /** Convert value in edit after applying functions back
    * @param array one element from fields()
    * @param string
    * @return string
    */
    function unconvert_field($field, $return) {
        if ($field["type"] == "bit") {
            $return = "CONV($return, 2, 10) + 0";
        }
        if (preg_match("~geometry|point|linestring|polygon~", $field["type"])) {
            $return = "GeomFromText($return)";
        }
        return $return;
    }
    

    Personally I can live without this function, but I can see why some people need it there. Maybe add a setting for it?

     
  • Jakub Vrána

    Jakub Vrána - 2014-10-25

    I couldn't reproduce it. Please provide exact steps to reproduce it (including the table dump with no private information).

     
  • Eduardo Romero

    Eduardo Romero - 2014-12-09

    It still not solved on 4.1.0. When trying to edit a row that has an ID of type binary, one is not able to edit the fields.

    See here for a SQL dump

    See the screenshots on how to reproduce:

    step 1
    step 2

    Same behaviour occurs if you click Edit | Delete on screen #1 (select table), the only thing that seems to work is when clicking [ ] whole result because it does it in another way.

    1 http://i.imgur.com/DCqQPfA.png

    2 http://i.imgur.com/vk5FojF.png

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks