Utf8String CreateTableSqlStatementBuilder::sqlStatement() const { if (!sqlStatementBuilder.isBuild()) bindAll(); return sqlStatementBuilder.sqlStatement(); }
bool duration_expression::bindAll(Environment & bs,State & s,const expression * exp) { if(const binary_expression * be = dynamic_cast<const binary_expression *>(exp)) { return bindAll(bs,s,be->getLHS()) && bindAll(bs,s,be->getRHS()); } else if(const uminus_expression * u = dynamic_cast<const uminus_expression *>(exp)) { return bindAll(bs,s,u->getExpr()); } else if(const func_term * fe = dynamic_cast<const func_term *>(exp)) { return s.firstBinding(bs,fe); } else return true; };
string duration_expression::createAll(State & s) { stringstream dur; if(const num_expression * val = dynamic_cast<const num_expression*>(exp)) { dur << nm << " = " << val->double_value() << "\n"; return dur.str(); }; Environment bs; if(!bindAll(bs,s,exp)) return ""; recordOne(dur,s,bs); done = false; while(nextBinding(bs,s,exp)) { done = false; if(s.safeBinding(bs,exp)) recordOne(dur,s,bs); }; return dur.str(); };
/** * operator() * Executes the command * * Ensure there's at most one extra argument. * * If there is an argument that must be an integer and it replaces the * default exit status (0). * * Send an exit event to the Tcl Server * * Join with the tcl server. * * Invoke Tcl_Exit to exit the application. * * @param interp - Reference to the encapsulated interpreter that is running * the command. * @param objv - Array of CTCLObjects that represent the command words. * @return int - Though actually this function does not return unless * there is an error, in which case it returns TCL_ERROR. */ int CExit::operator()(CTCLInterpreter& interp, std::vector<CTCLObject>& objv) { try { bindAll(interp, objv); requireAtMost(objv, 2, "exit takes at most the status parameters"); // Default the exit status and override it if there is a param: int status = 0; if (objv.size() == 2) { status = objv[1]; // Throws if not integer. } CExit::exit(status); } catch (std::string msg) { interp.setResult(msg); } return TCL_ERROR; }