// append an ascii-version of biarith void BiArith::generateCacheKey(CacheWA& cwa) const { ItemExpr::generateCacheKey(cwa); // append an indication of rounding mode for datetime arithmetic functions if ( isKeepLastDay() ) cwa += "r1"; else if ( isStandardNormalization() ) cwa += "r0"; if (getOperatorType() == ITM_DIVIDE) { cwa += " arm:"; // arith rounding mode char dFmt[20]; str_itoa(roundingMode_, dFmt); cwa += dFmt; } }
short BiArith::codeGen(Generator * generator) { Attributes ** attr; ExpGenerator * eg = generator->getExpGenerator(); if (eg->genItemExpr(this, &attr, (1+getArity()), -1) == 1) return 0; // if temp space is needed for this operation, set it. if (attr[0]->isComplexType()) { eg->addTempsLength(((ComplexType *)attr[0])->setTempSpaceInfo(getOperatorType(), #pragma nowarn(1506) // warning elimination eg->getTempsLength())); #pragma warn(1506) // warning elimination } attr[0]->resetlastdaymonthflag(); attr[0]->resetlastdayonerrflag(); // Check to see which type of rounding is needed for add_months, date_add // functions. Set flags here for use in executor datetime.cpp. if (isStandardNormalization()) attr[0]->setlastdayonerrflag(); if (isKeepLastDay()) attr[0]->setlastdaymonthflag(); ex_arith_clause * arith_clause = new(generator->getSpace()) ex_arith_clause(getOperatorType(), attr, generator->getSpace(), (short)getRoundingMode(), getDivToDownscale()); generator->getExpGenerator()->linkClause(this, arith_clause); return 0; }