#
# This file contains parser tests, specifically created for MaxScale.
#

SELECT * INTO @a, @b FROM t1;
SELECT * FROM t1 INTO @a, @b;

SELECT a, b INTO @a, @b FROM t1;
SELECT a, b FROM t1 INTO @a, @b;

SELECT * FROM t1 INTO OUTFILE '/tmp/dump1';
SELECT * INTO OUTFILE '/tmp/dump1' FROM t1;

SELECT * FROM t1 INTO DUMPFILE '/tmp/dump1';
SELECT * INTO DUMPFILE '/tmp/dump1' FROM t1;

SHOW SLAVE STATUS;
SHOW MASTER STATUS;
SHOW ALL SLAVES STATUS;
SHOW SLAVE HOSTS;
SHOW WARNINGS;


CALL f1();
CALL db1.f1();

SELECT f1();
SELECT db.f1();
SELECT f1() FROM tbl1;
SELECT db.f1() FROM db.tbl1;

SHOW GRANTS;

CREATE VIEW mysqltest.dummyview AS SELECT dummyfield FROM mysqltest.dummytable;

SELECT fld FROM tbl WHERE GRANTEE = '\'dummy\'@\'localhost\'';

SELECT TABLE_SCHEMA, TABLE_NAME, GROUP_CONCAT(PRIVILEGE_TYPE ORDER BY PRIVILEGE_TYPE ASC ,TABLE_NAME SEPARATOR ', ') AS PRIVILEGES FROM TABLE_PRIVILEGES WHERE GRANTEE = '\'dummy\'@\'localhost\'' GROUP BY TABLE_SCHEMA, TABLE_NAME;
SELECT TABLE_SCHEMA, TABLE_NAME, GROUP_CONCAT(PRIVILEGE_TYPE SEPARATOR ', ') AS PRIVILEGES FROM TABLE_PRIVILEGES WHERE GRANTEE = '\'dummy\'@\'localhost\'' GROUP BY TABLE_SCHEMA, TABLE_NAME;
SELECT DISTINCT i, GROUP_CONCAT(  d1, d2 ORDER BY d1, d2 ) FROM t1 a1 NATURAL JOIN t1 a2 GROUP BY i WITH ROLLUP;

SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
SET GLOBAL TRANSACTION ISOLATION LEVEL SERIALIZABLE;
SET TRANSACTION READ ONLY;
SET TRANSACTION READ WRITE;

set autocommit=0;
set autocommit=1;
set @@autocommit=0;
set @@autocommit=1;
SET autocommit=ON;
SET autocommit=true;
SET autocommit=FALSE;
SET autocommit=Off;

LOAD DATA LOCAL INFILE '/tmp/data.csv' INTO TABLE test.t1;

START TRANSACTION;
START TRANSACTION READ ONLY;
START TRANSACTION READ WRITE;
START TRANSACTION READ ONLY, WITH CONSISTENT SNAPSHOT;
START TRANSACTION READ WRITE, WITH CONSISTENT SNAPSHOT;
START TRANSACTION WITH CONSISTENT SNAPSHOT, READ ONLY;
START TRANSACTION WITH CONSISTENT SNAPSHOT, READ WRITE;

BEGIN;
BEGIN WORK;
COMMIT;
COMMIT WORK;
ROLLBACK;
ROLLBACK WORK;

SAVEPOINT id;
ROLLBACK WORK TO SAVEPOINT id;
ROLLBACK TO SAVEPOINT id;
ROLLBACK WORK TO id;
ROLLBACK TO id;
RELEASE SAVEPOINT id;

SELECT her FROM (SELECT @@server_id as her) as t WHERE her REGEXP '.*';

select * from db1.t1 union select * from db2.t2;

# Names is a keyword as well
select names from t;

call p1();
call p1(@var);

create or replace table t (a int);
