private void ResetTestBeforeClose(Session session, int id) { session.SQL(string.Format("CREATE TEMPORARY TABLE testResetSession{0} (id int)", id)).Execute(); session.SQL(string.Format("SET @a='session{0}'", id)).Execute(); SqlResult res = session.SQL("SELECT @a AS a").Execute(); Assert.Equal("session" + id, res.FetchAll()[0][0]); res = session.SQL("SHOW CREATE TABLE testResetSession" + id).Execute(); Assert.Equal("testResetSession" + id, res.FetchAll()[0][0]); }
protected SqlResult ExecuteSQL(string sql) { Session session = GetSession(); session.SetCurrentSchema(schemaName); SqlResult r = ExecuteSQLStatement(session.SQL(sql)); var rows = r.HasData ? r.FetchAll() : null; return(r); }
private void ResetTestAfterClose(Session session, int threadId, int id) { Assert.Equal(threadId, session.ThreadId); SqlResult res = session.SQL("SELECT @a IS NULL").Execute(); Assert.Equal((sbyte)1, res.FetchOne()[0]); var ex = Assert.Throws <MySqlException>(() => session.SQL("SHOW CREATE TABLE testResetSession" + id).Execute()); Assert.Equal(string.Format("Table 'test.testresetsession{0}' doesn't exist", id), ex.Message); session.SQL(string.Format("SET @a='session{0}'", id)).Execute(); res = session.SQL("SELECT @a AS a").Execute(); Assert.Equal("session" + id, res.FetchAll()[0][0]); }