
var SqlObject = require ('./object');
var Value = require ('./value');

/**
 * A holder for another object.
 */
module.exports = new Class
({
	Extends: SqlObject
	,Properties:
	{
		id:
		{
			type: String
			,value: null
		}
	}

	,render: function (params)
	{
		if (params)
		{
			var object = params[this.id];

			if (object !== undefined)
			{
				if (!(object instanceof SqlObject))
				{
					var sqlValue = new Value ();
					sqlValue.value = object;
					return sqlValue.render ();
				}
				else
					return object.render (params);
			}
		}
			
		return '#'+ this.id;
	}
});
