use of com.actiontech.dble.plan.common.item.Item in project dble by actiontech.
the class TestMySQLItemVisitor method testWhere.
// TODO:ORDER BY /GROUP BY position
@Test
public void testWhere() {
MySqlSelectQueryBlock query = getQuery("select col1,col2 from table1 where a =1 ");
SQLExpr expr = query.getWhere();
MySQLItemVisitor v = new MySQLItemVisitor(this.currentDb, utf8Charset, null);
expr.accept(v);
Item item = v.getItem();
Assert.assertEquals(true, "a = 1".equals(item.getItemName()));
}
use of com.actiontech.dble.plan.common.item.Item in project dble by actiontech.
the class ItemFuncCase method valInt.
@Override
public BigInteger valInt() {
Item item = findItem();
if (item == null) {
nullValue = true;
return BigInteger.ZERO;
}
BigInteger res = item.valInt();
nullValue = item.isNullValue();
return res;
}
use of com.actiontech.dble.plan.common.item.Item in project dble by actiontech.
the class ItemFuncCase method valReal.
@Override
public BigDecimal valReal() {
Item item = findItem();
if (item == null) {
nullValue = true;
return BigDecimal.ZERO;
}
BigDecimal res = item.valReal();
nullValue = item.isNullValue();
return res;
}
use of com.actiontech.dble.plan.common.item.Item in project dble by actiontech.
the class ItemFuncCase method valStr.
@Override
public String valStr() {
FieldTypes i = fieldType();
if (i == FieldTypes.MYSQL_TYPE_DATETIME || i == FieldTypes.MYSQL_TYPE_TIMESTAMP) {
return valStringFromDatetime();
} else if (i == FieldTypes.MYSQL_TYPE_DATE) {
return valStringFromDate();
} else if (i == FieldTypes.MYSQL_TYPE_TIME) {
return valStringFromTime();
} else {
Item item = findItem();
if (item != null) {
String res;
if ((res = item.valStr()) != null) {
nullValue = false;
return res;
}
}
}
nullValue = true;
return null;
}
use of com.actiontech.dble.plan.common.item.Item in project dble by actiontech.
the class ItemFuncIf method valInt.
@Override
public BigInteger valInt() {
Item arg = args.get(0).valBool() ? args.get(1) : args.get(2);
BigInteger value = arg.valInt();
nullValue = arg.isNullValue();
return value;
}
Aggregations