String search_nickname = null;
Timestamp search_begin = null;
Timestamp search_end = null;
int search_count = -1;
Select searchLogAdapted = searchLog.clone();
ArrayList search_parts = StringUtils.split(search, ";");
Iterator search_parts_it = search_parts.iterator();
String search_part = null;
while (search_parts_it.hasNext())
{
search_part = (String)search_parts_it.next();
if (search_part.startsWith("nick="))
{
int equality_index = search_part.indexOf("=");
if (search_nickname != null ||
-1 == equality_index)
{
throw new InvalidSearchSyntaxException(bot, channel, search);
}
search_nickname = search_part.substring(equality_index+1).toLowerCase();
if ("in.co.daffodil.db.jdbc.DaffodilDBDriver".equals(getDatasource().getAliasedDriver()))
{
searchLogAdapted.whereParameterAnd("lcase(nickname)", "nickname" , "=");
}
else
{
searchLogAdapted.whereParameterAnd("lower(nickname)", "nickname" , "=");
}
}
else if (search_part.startsWith("begin="))
{
int equality_index = search_part.indexOf("=");
if (search_begin != null ||
-1 == equality_index)
{
throw new InvalidSearchSyntaxException(bot, channel, search);
}
if (null == (search_begin = parseInterval(search_part.substring(equality_index+1))))
{
throw new InvalidSearchSyntaxException(bot, channel, search);
}
searchLogAdapted.whereParameterAnd("moment", "begin", ">=");
}
else if (search_part.startsWith("end="))
{
int equality_index = search_part.indexOf("=");
if (search_end != null ||
-1 == equality_index)
{
throw new InvalidSearchSyntaxException(bot, channel, search);
}
if (null == (search_end = parseInterval(search_part.substring(equality_index+1))))
{
throw new InvalidSearchSyntaxException(bot, channel, search);
}
searchLogAdapted.whereParameterAnd("moment", "end", "<");
}
else if (search_part.startsWith("#="))
{
int equality_index = search_part.indexOf("=");
if (search_count != -1 ||
-1 == equality_index)
{
throw new InvalidSearchSyntaxException(bot, channel, search);
}
try
{
search_count = Integer.parseInt(search_part.substring(equality_index+1));
searchLogAdapted.limit(search_count);
}
catch (NumberFormatException e)
{
throw new InvalidSearchSyntaxException(bot, channel, search);
}
}
else
{
if (search_message != null)
{
throw new InvalidSearchSyntaxException(bot, channel, search);
}
search_message = search_part.toLowerCase();
if ("in.co.daffodil.db.jdbc.DaffodilDBDriver".equals(getDatasource().getAliasedDriver()))
{
searchLogAdapted.whereParameterAnd("lcase(message)", "message", "LIKE");
}
else
{
searchLogAdapted.whereParameterAnd("lower(message)", "message", "LIKE");
}
}
}
if (null == search_message &&