Changeset 279

User picture

Author: m4rw3r

(2009/05/19 21:45) Almost 3 years ago

Fixes #42, #43, #44 and #45
Thanks for spotting those Stan!

Affected files

Updated trunk/application/libraries/Ignitedquery.php Download diff

278279
388
	{
388
	{
389
		$this->q_cached = false;
389
		$this->q_cached = false;
390
		
390
		
391
		// reset select if it is the default "*"
392
		if(is_string($this->q_select))
393
		{
394
			$this->q_select = array();
395
		}
396
		
391
		if($cols === false)
397
		if($cols === false)
392
		{
398
		{
393
			$obj = new IgnitedQuery();
399
			$obj = new IgnitedQuery();
...
...
396
			return $obj;
402
			return $obj;
397
		}
403
		}
398
		
404
		
399
		// reset select if it is the default "*"
400
		if(is_string($this->q_select))
401
		{
402
			$this->q_select = array();
403
		}
404
		
405
		if(is_array($cols))
405
		if(is_array($cols))
406
		{
406
		{
407
			// many columns in array
407
			// many columns in array
...
...
1452
	
1452
	
1453
	/**
1453
	/**
1454
	 * Specifies an alias for this subquery.
1454
	 * Specifies an alias for this subquery.
1455
	 * 
1455
	 *
1456
	 * Note: This only applies if this object is a subquery
1456
	 * Note: This only applies if this object is a subquery
1457
	 * 
1457
	 *
1458
	 * @access public
1458
	 * @access public
1459
	 * @param string The alias
1459
	 * @param string The alias
1460
	 * 
1460
	 * @param bool		If to protect identifiers
1461
	 *
1461
	 * @return $this
1462
	 * @return $this
1462
	 */
1463
	 */
1463
	function &alias($alias)
1464
	function &alias($alias, $protect_identifiers = true)
1464
	{
1465
	{
1465
		if($this->q_as !== false)
1466
		if($this->q_as !== false)
1466
			$this->q_as = $this->_protect_identifiers($alias);
1467
			$this->q_as = ($protect_identifiers ? $this->_protect_identifiers($alias) : $alias);
1467
		
1468
1468
		return $this;
1469
		return $this;
1469
	}
1470
	}
1470
	
1471
	

Updated trunk/application/libraries/ignitedrecord/Base.php Download diff

278279
388
				if(is_object($data['model']))
388
				if(is_object($data['model']))
389
				{
389
				{
390
					// add the child class helpers to the record
390
					// add the child class helpers to the record
391
					foreach($joined_model->child_class_helpers as $name => $hclass)
391
					foreach($joined_model->child_class_helpers as $hname => $hclass)
392
					{
392
					{
393
						$obj->$name =& new $hclass($o);
393
						$obj->$hname =& new $hclass($o);
394
					}
394
					}
395
				}
395
				}
396
				
396
				
...
...
426
				if(is_object($model))
426
				if(is_object($model))
427
				{
427
				{
428
					// add the child class helpers to the record
428
					// add the child class helpers to the record
429
					foreach($model->child_class_helpers as $name => $hclass)
429
					foreach($model->child_class_helpers as $hname => $hclass)
430
					{
430
					{
431
						$result[$sid]->$name =& new $hclass($result[$sid]);
431
						$result[$sid]->$hname =& new $hclass($result[$sid]);
432
					}
432
					}
433
				}
433
				}
434
			}
434
			}
...
...
440
		{
440
		{
441
			if( ! empty($result))
441
			if( ! empty($result))
442
			{
442
			{
443
				$result =& array_shift($result);
443
				reset($result);
444
				$result =& $result[key($result)];
445
				
444
			}
446
			}
445
			else
447
			else
446
			{
448
			{

Updated trunk/application/libraries/ignitedrecord/Base_php5.php Download diff

278279
387
				if(is_object($data['model']))
387
				if(is_object($data['model']))
388
				{
388
				{
389
					// add the child class helpers to the record
389
					// add the child class helpers to the record
390
					foreach($joined_model->child_class_helpers as $name => $hclass)
390
					foreach($joined_model->child_class_helpers as $hname => $hclass)
391
					{
391
					{
392
						$o->$name = new $hclass($o); // PHP 4: $obj->$name =& new $hclass($o);
392
						$o->$hname = new $hclass($o); // PHP 4: $obj->$name =& new $hclass($o);
393
					}
393
					}
394
				}
394
				}
395
				
395
				
...
...
425
				if(is_object($model))
425
				if(is_object($model))
426
				{
426
				{
427
					// add the child class helpers to the record
427
					// add the child class helpers to the record
428
					foreach($model->child_class_helpers as $name => $hclass)
428
					foreach($model->child_class_helpers as $hname => $hclass)
429
					{
429
					{
430
						$result[$sid]->$name = new $hclass($result[$sid]); // PHP 4: $result[$sid]->$name =& new $hclass($result[$sid]);
430
						$result[$sid]->$hname = new $hclass($result[$sid]); // PHP 4: $result[$sid]->$name =& new $hclass($result[$sid]);
431
					}
431
					}
432
				}
432
				}
433
			}
433
			}