MyBatis Migration delimiter

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

MyBatis Migration delimiter

odoisneau
I am new to myBatis migration and so far it works great but now I have to run a script where the delimiter is changed.  How can I run a sql like this in a mysql db?


delimiter ;


delimiter //

drop trigger if exists foo //

create trigger         foo after insert on foo

  for each row

.....

end;

//


--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: MyBatis Migration delimiter

Iwao AVE!
Hi,

There is a special syntax: -- @DELIMITER
Assuming you want to change the delimiter to a dollar sign, your script would look as follows.

-- Change the delimiter to '$'
-- @DELIMITER $

-- Trigger definition
drop trigger if exists foo;
create trigger foo after insert on foo
  for each row
.....
end;

-- Change the delimiter back to ';'
-- @DELIMITER ;

Reading the source code, it seems that the delimiter has to be a single character.

Regards,
Iwao

2017-05-30 9:32 GMT+09:00 <[hidden email]>:
I am new to myBatis migration and so far it works great but now I have to run a script where the delimiter is changed.  How can I run a sql like this in a mysql db?


delimiter ;


delimiter //

drop trigger if exists foo //

create trigger         foo after insert on foo

  for each row

.....

end;

//


--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.