MXS-1196: Add smarter delimiter handling

DELIMITER $$;
--delimiter $$
This commit is contained in:
Johan Wikman
2017-05-16 12:11:35 +03:00
parent e7ef6c855f
commit ceaf2110ab

View File

@ -14,6 +14,7 @@
#include "testreader.hh"
#include <algorithm>
#include <map>
#include <iostream>
using std::istream;
using std::string;
@ -244,7 +245,21 @@ TestReader::result_t TestReader::get_statement(std::string& stmt)
trim(line);
if (line.length() > 0)
{
m_delimiter = line;
if (line.length() >= m_delimiter.length())
{
if (line.substr(line.length() - m_delimiter.length()) == m_delimiter)
{
m_delimiter = line.substr(0, line.length() - m_delimiter.length());
}
else
{
m_delimiter = line;
}
}
else
{
m_delimiter = line;
}
}
continue;