Menu

#1180 squirrel 3.6 fails on mysql plugin delimiter stmt

None
open
nobody
3
2018-12-22
2015-02-11
jmason
No

Squirrel 3.6 with all plugins loaded - including mysql plugin fails to recognize the delimiter statement so you can't change the statement delimiter in a sql script ( see example below ).
Mysql plugin is loaded correctly: the mysql specific features show up in the menus.
Mysql server is 5.6.
Running on mac osx 10.10.2, JDK 1.7.0.68

The same script below works fine in mysql workbench.
Thanks
Jim

DELIMITER //
CREATE PROCEDURE dorepeat(p1 INT)
BEGIN
SET @x = 0;
REPEAT SET @x = @x + 1; UNTIL @x > p1 END REPEAT;
END;
]
//
DELIMITER ;
commit;

Discussion

  • Neville Rowe

    Neville Rowe - 2015-02-22

    I'm going to take a look at this, but it won't be an easy one to fix. I believe DELIMITER // is more of an instruction to the front end. I suspect MySQL Workbench is processing this command itself, whereas SquirrelSQL is trying to pass the whole command block over to the server.

     
  • Neville Rowe

    Neville Rowe - 2015-02-22

    Okay I believe I was right - the above SQL generates two calls to the MySQL Server - CREATE PROCEDURE and COMMIT. The two DELIMITER calls tell the workbench how much to treat as a unit-of-work. However the MySQL plugin has some existing code in MysqlQueryTokenizer which is trying to do the correct thing so I'm trying to understand that better.

     
  • jmason

    jmason - 2015-02-24

    Thanks for looking at this Neville but I'd like to close this ticket with a status of 'not an issue for Squirrel'.
    The example I referenced was from MySQL. While the example worked fine for the Delimiter in the MySQL workbench, it failed in Squirrel. The difference is Squirrel uses the MySQL JDBC driver which does not recognize a standard block terminator expression ( here Delimiter <chars> ). The MySQL team does not support using their JDBC driver for DML work instead preferring a command shell or the work bench only.
    By comparison IBM DB2 and Oracle both support a block terminator expression in the JDBC driver which is why I could create SQL procedures easily from Squirrel on those platforms.
    Thanks for your help but this is a limitation of the database JDBC driver, not Squirrel.
    It would be a help if you made note of this in documentation so other developers would understand where to look for this support.</chars>

     
  • Neville Rowe

    Neville Rowe - 2015-03-01

    I'll make an appropriate note in the documentation. That said even though the MySQL people don't like DML through JDBC, it does work therefore it would be best if SquirrelSQL handled the MySQL dialect properly. So I'll carry on trying to get it to work appropriately.

     
  • jmason

    jmason - 2015-06-01

    This is not an issue now.
    The MySQL plugin for squirrel has a default block separator character for procedures of |

    You can't use a delimiter statement but the example below works fine in squirrel....

    drop procedure if exists kpi_calc_do;

    create procedure kpi_calc_do
    (
    in kpi_name varchar(50)
    )
    begin
    declare i int default 0;
    end
    |
    ;

    call kpi_calc_do('akpi_name')
    ;

     

Log in to post a comment.

MongoDB Logo MongoDB