I tried the example provided on Windows (both server and client are Win7 64 bit) using the command line client shipped with MariaDB 10.1:
Enter password: ********
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 5
Server version: 10.1.1-MariaDB
mariadb.org binary distribution
Copyright (c) 2000, 2014, Oracle, SkySQL Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> use test;
Database changed
MariaDB [test]> IF @have_csv = 'YES' THEN
-> CREATE TABLE IF NOT EXISTS general_log (
-> event_time TIMESTAMP(6) NOT NULL,
-> user_host MEDIUMTEXT NOT NULL,
-> thread_id BIGINT(21) UNSIGNED NOT NULL,
-> server_id INTEGER UNSIGNED NOT NULL,
-> command_type VARCHAR(64) NOT NULL,
-> argument MEDIUMTEXT NOT NULL
-> ) engine=CSV CHARACTER SET utf8 comment="General log";
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MariaDB server version for the right syntax to use near '' a
t line 9
MariaDB [test]> END IF;
Obviously the SEMICOLON after comment="General log" disturbs. But this is no better:
MariaDB [test]> IF @have_csv = 'YES' THEN
-> CREATE TABLE IF NOT EXISTS general_log (
-> event_time TIMESTAMP(6) NOT NULL,
-> user_host MEDIUMTEXT NOT NULL,
-> thread_id BIGINT(21) UNSIGNED NOT NULL,
-> server_id INTEGER UNSIGNED NOT NULL,
-> command_type VARCHAR(64) NOT NULL,
-> argument MEDIUMTEXT NOT NULL
-> ) engine=CSV CHARACTER SET utf8 comment="General log"
-> END IF;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MariaDB server version for the right syntax to use near 'END
IF' at line 10
MariaDB [test]>
What is the problem here? Is it someWindows-specific bug/issue? BTW it is the same in SQLyog (compiled with MariaDB C-API) as in commandline.
-- Peter
-- Webyog