Author: m4rw3r
(2009/05/19 21:45) Almost 3 years ago
Fixes #42, #43, #44 and #45 Thanks for spotting those Stan!
388
{
389
$this->q_cached = false;
390
391
// reset select if it is the default "*"
392
if(is_string($this->q_select))
393
394
$this->q_select = array();
395
}
396
if($cols === false)
397
398
$obj = new IgnitedQuery();
399
...
return $obj;
402
403
404
400
401
405
if(is_array($cols))
406
407
// many columns in array
1452
1453
/**
1454
* Specifies an alias for this subquery.
1455
*
1456
* Note: This only applies if this object is a subquery
1457
1458
* @access public
1459
* @param string The alias
1460
* @param bool If to protect identifiers
1461
* @return $this
1462
*/
1463
function &alias($alias)
1464
function &alias($alias, $protect_identifiers = true)
1465
if($this->q_as !== false)
1466
$this->q_as = $this->_protect_identifiers($alias);
1467
$this->q_as = ($protect_identifiers ? $this->_protect_identifiers($alias) : $alias);
1468
return $this;
1469
1470
1471
if(is_object($data['model']))
// add the child class helpers to the record
foreach($joined_model->child_class_helpers as $name => $hclass)
foreach($joined_model->child_class_helpers as $hname => $hclass)
$obj->$name =& new $hclass($o);
$obj->$hname =& new $hclass($o);
426
if(is_object($model))
427
428
429
foreach($model->child_class_helpers as $name => $hclass)
foreach($model->child_class_helpers as $hname => $hclass)
430
431
$result[$sid]->$name =& new $hclass($result[$sid]);
$result[$sid]->$hname =& new $hclass($result[$sid]);
432
433
434
440
441
if( ! empty($result))
442
443
$result =& array_shift($result);
reset($result);
444
$result =& $result[key($result)];
445
446
else
447
448
387
$o->$name = new $hclass($o); // PHP 4: $obj->$name =& new $hclass($o);
$o->$hname = new $hclass($o); // PHP 4: $obj->$name =& new $hclass($o);
425
$result[$sid]->$name = new $hclass($result[$sid]); // PHP 4: $result[$sid]->$name =& new $hclass($result[$sid]);
$result[$sid]->$hname = new $hclass($result[$sid]); // PHP 4: $result[$sid]->$name =& new $hclass($result[$sid]);
{{{{{// reset select if it is the default "*"if(is_string($this->q_select)){$this->q_select = array();}{{*** @param bool If to protect identifiers*function &alias($alias, $protect_identifiers = true){{$this->q_as = $this->_protect_identifiers($alias);$this->q_as = ($protect_identifiers ? $this->_protect_identifiers($alias) : $alias);{{foreach($joined_model->child_class_helpers as $hname => $hclass){{$obj->$hname =& new $hclass($o);{{foreach($model->child_class_helpers as $hname => $hclass){{$result[$sid]->$hname =& new $hclass($result[$sid]);{{{{$result =& array_shift($result);reset($result);$result =& $result[key($result)];{{{{foreach($joined_model->child_class_helpers as $hname => $hclass){{$o->$hname = new $hclass($o); // PHP 4: $obj->$name =& new $hclass($o);{{foreach($model->child_class_helpers as $hname => $hclass){{$result[$sid]->$hname = new $hclass($result[$sid]); // PHP 4: $result[$sid]->$name =& new $hclass($result[$sid]);