search only shows >= and <= in editor

2011-02-04
2015-08-13
  • First than all thank you for your contribution to the world wide FOSS community and greetings from the Caribbean, Puerto Rico.

    I do have some questions.

    When logged in the mysql editor version I can only select , <= and >= operators in the pull down search (query editor) menu. Is this the default setting? and How can I customized to include the = as default? I have look in the forums and bugs but have not being able to find any reference to this.

    The situation is that I am working with a 4M records Database and a Select …. LIKE %% vs  a SELECT ….. =  makes a big difference.

    Thanks in advance for your answer 

     
  • Jakub Vrána
    Jakub Vrána
    2011-02-04

    You can create a customization for this. It would be very simple:

    function adminer_object() {
        
        class AdminerEquals extends Adminer {
            var $operators = array("=", "<=", ">=");
        }
    
        return new AdminerEquals;
    }
    include "./editor.php";
    
     
    • Martin
      Martin
      2015-08-12

      Hi Jakub.

      I want to search using LIKE %%, so I have this:

      var $operators = array("=", "LIKE %%");

      GUI will change accordingly, but when I try to use it, I recieve error:

      Syntax error near '%% '12345') LIMIT 50' at line 3

      Search works OK when I use "=". Any idea why?

       
      • Martin
        Martin
        2015-08-12

        Oh, OK. I copied selectSearchProcess() to my extension...

         
      • Jakub Vrána
        Jakub Vrána
        2015-08-13

        Hi,

        This tries to use the operator literally, e.g. LIKE %% 'abc'

        LIKE %% is the default search operator in Adminer Editor (if you use no
        operator).

        Jakub

        On 12.8.2015 05:01, Martin wrote:

        Hi Jakub.

        I want to search using LIKE %%, so I have this:

        var $operators = array("=", "LIKE %%");

        GUI will change accordingly, but when I try to use it, I recieve error:

        Syntax error near '%% '12345') LIMIT 50' at line 3

        Search works OK when I use "=". Any idea why?


        search only shows >= and <= in editor


        Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/adminer/discussion/960417/

        To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

         
  • Hi.

    I did the change, but the query still adds the wild percent symbol (%) on both sides of the FECHANAC field as shown:

    SELECT *
    FROM `MASTER`
    WHERE (`FECHANAC` = '%1964-10-11%') AND (`PATERNO` LIKE '%berr%')
    ORDER BY `PATERNO`
    LIMIT 30

    What I want to do is make an exact match without the % symbol.

    Is this possible?

     
  • An extremely QUICK and DIRTY hack:

    function selectSearchProcess($fields, $indexes) {

    …….

    if ($op == "=") {
    $value = $this->processInput($field, ($text_type && ereg('^+$', $val) ? "$val" : $val));
    } else {
    $value = $this->processInput($field, ($text_type && ereg('^+$', $val) ? "%$val%" : $val));
    }

    ……

     
  • Jakub Vrána
    Jakub Vrána
    2011-02-06

    You are right, I've fixed it in Git. If you don't want to use the Git version, you can also bypass

    %%
    

    by searching for

    1964-10-11%
    

    (and no customization would be required).