How can I change the MySQL query delimiter using the C API? I tried sending DELIMITER |
as a query, complained about ..the right syntax to use near 'delimiter' at line 1
..
Tried DELIMITER |;
too, no luck. Tried DELIMITER |; SELECT 1|
, no luck. :(
The reason I ask is that I need to create a trigger through the C API such as the following:
create trigger increase_count after insert on torrent_clients for each row
begin
IF NEW.BytesLeft = 0 THEN
UPDATE torrents SET Seeders = Seeders + 1 WHERE torrents.InfoHash = NEW.InfoHash;
ELSE
UPDATE torrents SET Leechers = Leechers + 1 WHERE torrents.InfoHash = NEW.InfoHash;
END IF;
end|
but I don't think there is a way to do it without changing the delimiter, is there?
Thanks!
EDIT: Note that I do need to explicitly write the delimiter at the end, as I'm running multiple queries with only one API call (I have multi statements on)
EDIT2: the mysqlclient that uses the C api does this so there must be a way..