* @param type The type to bind as
*/
public SQLExpression bindVariable(UnboundExpression expr, Class type)
{
String varName = expr.getVariableName();
Symbol varSym = compilation.getSymbolTable().getSymbol(varName);
if (varSym.getValueType() == null)
{
varSym.setValueType(type);
}
AbstractClassMetaData cmd = ec.getMetaDataManager().getMetaDataForClass(type, clr);
if (cmd != null)
{
// Variable is persistent type, so add cross join (may need changing later on in compilation)
DatastoreClass varTable = storeMgr.getDatastoreClass(varSym.getValueType().getName(), clr);
SQLTable varSqlTbl = stmt.crossJoin(varTable, "VAR_" + varName, null);
SQLTableMapping varSqlTblMapping = new SQLTableMapping(varSqlTbl, cmd, varTable.getIdMapping());
setSQLTableMappingForAlias(varName, varSqlTblMapping);
return exprFactory.newExpression(stmt, varSqlTbl, varTable.getIdMapping());
}