Search in sources :

Example 1 with JdbcItem

use of org.openhab.persistence.jdbc.model.JdbcItem in project openhab1-addons by openhab.

the class JdbcDerbyDAO method doGetHistItemFilterQuery.

@Override
public List<HistoricItem> doGetHistItemFilterQuery(Item item, FilterCriteria filter, int numberDecimalcount, String table, String name) {
    String sql = histItemFilterQueryProvider(filter, numberDecimalcount, table, name);
    List<Object[]> m = Yank.queryObjectArrays(sql, null);
    logger.debug("JDBC::doGetHistItemFilterQuery got Array length={}", m.size());
    List<HistoricItem> items = new ArrayList<HistoricItem>();
    for (int i = 0; i < m.size(); i++) {
        logger.debug("JDBC::doGetHistItemFilterQuery 0='{}' 1='{}'", m.get(i)[0], m.get(i)[1]);
        items.add(new JdbcItem(item.getName(), getState(item, m.get(i)[1]), objectAsDate(m.get(i)[0])));
    }
    return items;
}
Also used : ArrayList(java.util.ArrayList) JdbcItem(org.openhab.persistence.jdbc.model.JdbcItem) HistoricItem(org.openhab.core.persistence.HistoricItem)

Example 2 with JdbcItem

use of org.openhab.persistence.jdbc.model.JdbcItem in project openhab1-addons by openhab.

the class JdbcBaseDAO method doGetHistItemFilterQuery.

public List<HistoricItem> doGetHistItemFilterQuery(Item item, FilterCriteria filter, int numberDecimalcount, String table, String name) {
    String sql = histItemFilterQueryProvider(filter, numberDecimalcount, table, name);
    logger.debug("JDBC::doGetHistItemFilterQuery sql={}", sql);
    List<Object[]> m = Yank.queryObjectArrays(sql, null);
    List<HistoricItem> items = new ArrayList<HistoricItem>();
    for (int i = 0; i < m.size(); i++) {
        items.add(new JdbcItem(item.getName(), getState(item, m.get(i)[1]), objectAsDate(m.get(i)[0])));
    }
    return items;
}
Also used : ArrayList(java.util.ArrayList) JdbcItem(org.openhab.persistence.jdbc.model.JdbcItem) HistoricItem(org.openhab.core.persistence.HistoricItem)

Example 3 with JdbcItem

use of org.openhab.persistence.jdbc.model.JdbcItem in project openhab1-addons by openhab.

the class JdbcPostgresqlDAO method doGetHistItemFilterQuery.

@Override
public List<HistoricItem> doGetHistItemFilterQuery(Item item, FilterCriteria filter, int numberDecimalcount, String table, String name) {
    String sql = histItemFilterQueryProvider(filter, numberDecimalcount, table, name);
    logger.debug("JDBC::doGetHistItemFilterQuery sql={}", sql);
    List<Object[]> m = Yank.queryObjectArrays(sql, null);
    List<HistoricItem> items = new ArrayList<HistoricItem>();
    for (int i = 0; i < m.size(); i++) {
        items.add(new JdbcItem(item.getName(), getState(item, m.get(i)[1]), objectAsDate(m.get(i)[0])));
    }
    return items;
}
Also used : ArrayList(java.util.ArrayList) JdbcItem(org.openhab.persistence.jdbc.model.JdbcItem) HistoricItem(org.openhab.core.persistence.HistoricItem)

Aggregations

ArrayList (java.util.ArrayList)3 HistoricItem (org.openhab.core.persistence.HistoricItem)3 JdbcItem (org.openhab.persistence.jdbc.model.JdbcItem)3