Beispiel #1
0
    void arithmeticExpression_2()
    {
        cout << "\nbuild arithmetic column by using accessing methods:" << endl;
        erydbSelectExecutionPlan::Parser parser;
        std::vector<Token> tokens;
        Token t;
        
        ArithmeticColumn b;
        cout << b;
        
        ConstantColumn *c1 = new ConstantColumn();
        c1->constval("'ASIA'");
        c1->type(ConstantColumn::LITERAL);
        //CPPUNIT_ASSERT (c1->data() == "'ASIA'(l)");
        
        t.value = c1;
        tokens.push_back(t);
        
        t.value = new Operator ("/");
        tokens.push_back(t);        
        
        ConstantColumn *c2 = new ConstantColumn(5);        
        CPPUNIT_ASSERT (c2->type() == ConstantColumn::NUM);
        t.value = c2;
        tokens.push_back(t);
        
        ParseTree* tree = parser.parse(tokens.begin(), tokens.end());
        b.expression (tree);

        cout << b;
        cout << " --- end of test 7 ---" << endl;                 
    }
Beispiel #2
0
	ArithmeticColumn* makeArithmeticColumn()
	{
		ArithmeticColumn *ret;
		ParseTree *t;
		
		t = makeParseTree();
		ret = new ArithmeticColumn();
		ret->expression(t);
		ret->alias("ArithmeticColumn");
		ret->data("AD");
		return ret;
	}