Package org.boris.expr.util

Examples of org.boris.expr.util.Database


        // Get database argument
        Expr edb = evalArg(args[0]);
        if (!(edb instanceof ExprArray)) {
            return ExprError.VALUE;
        }
        Database db = Database.valueOf((ExprArray) edb);
        if (db == null) {
            return ExprError.VALUE;
        }

        // Get field argument
        Expr ef = evalArg(args[1]);
        String field = null;
        if (ef instanceof ExprString) {
            field = ((ExprString) ef).str;
        } else if (ef instanceof ExprInteger) {
            int col = ((ExprInteger) ef).intValue();
            int cc = db.getColumnCount();
            if (col < 1 || col > cc)
                return ExprError.VALUE;
            field = db.getColumnName(col - 1);
        }

        // Get criteria argument
        Expr ec = evalArg(args[2]);
        if (!(ec instanceof ExprArray)) {
View Full Code Here


import org.boris.expr.util.Database;

public class ExcelDatabaseFunctionsTest extends TH
{
    public void testDatabase() throws Exception {
        Database db = Database.valueOf(loadArray("db1-d.txt"));
        assertEquals(db.get(2, "Yield"), 9);
        Criteria c = Criteria.valueOf(loadArray("db1-c.txt"));
        assertEquals(c.matches(db, 3), true);
    }
View Full Code Here

TOP

Related Classes of org.boris.expr.util.Database

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.