Package com.uwyn.rife.database.queries

Examples of com.uwyn.rife.database.queries.Select


      .column("channel", String.class, 30, CreateTable.NOTNULL)
      .column("servername", String.class, 60, CreateTable.NOTNULL)
      .columns(SeenData.class)
      .primaryKey("SEEN_PK", new String[] {"botname", "channel", "servername", "nickname"});

    mGetSeen = (Select)new Select(getDatasource())
      .from("seen")
      .whereParameter("botname", "=")
      .whereParameterAnd("channel", "=")
      .whereParameterAnd("servername", "=")
      .whereParameterAnd("lower(nickname)", "nickname", "=");
View Full Code Here


{
  public in_co_daffodil_db_jdbc_DaffodilDBDriver(Datasource datasource)
  {
    super(datasource);

    mGetSeen = (Select)new Select(getDatasource())
      .from("seen")
      .whereParameter("botname", "=")
      .whereParameterAnd("channel", "=")
      .whereParameterAnd("servername", "=")
      .whereParameterAnd("lcase(nickname)", "nickname", "=");
View Full Code Here

      .fieldParameter("username")
      .fieldParameter("hostname")
      .fieldParameter("message")
      .fieldParameter("raw");

    mSearchLog = (Select)new Select(getDatasource())
      .from(mCreateTableLog.getTable())
      .field("moment")
      .field("raw")
      .orderBy("moment", Select.DESC)
      .whereParameter("botname", "=")
      .whereParameterAnd("channel", "=")
      .whereParameterAnd("servername", "=");

    mGetLogMessages = (Select)new Select(getDatasource())
      .from(mCreateTableLog.getTable())
      .field("moment")
      .field("raw")
      .orderBy("moment", Select.ASC)
      .whereParameter("botname", "=")
View Full Code Here

      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 &&
View Full Code Here

        .getLogger("com.uwyn.drone.tools")
        .warning("Tried to install IndexQueueDbStructure but it failed; " +
            "probably already installed.");
    }
   
    final Select get_messages = new Select(d);
    get_messages
      .field("moment")
      .field("botname")
      .field("channel")
      .field("servername")
      .field("nickname")
      .field("username")
      .field("hostname")
      .field("message")
      .from("log");

    final Select count_messages = new Select(d);
    count_messages
      .field("count(*)")
      .from("log");

    class Scope
    {
View Full Code Here

TOP

Related Classes of com.uwyn.rife.database.queries.Select

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.