PHP utility collection with hybrid and fluent APIs.

⌈⌋ branch:  hybrid7 libraries


Check-in [1cfd351bc9]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Silently return NULL for absent ->column data from first result row.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:1cfd351bc92481a10a1319bcbab79789c3f00f9f
User & Date: mario 2015-01-07 15:32:08
Context
2015-01-13
18:47
Obsolete/unused bindings for Inspekt check-in: 2734b95caa user: mario tags: trunk
2015-01-07
15:32
Silently return NULL for absent ->column data from first result row. check-in: 1cfd351bc9 user: mario tags: trunk
2015-01-06
17:29
Remove debugging examples. check-in: b453cef6ba user: mario tags: trunk
Changes

Changes to db.php.

383
384
385
386
387
388
389
390
391
392







393
394
395
396
397
398
399
        return call_user_func_array(array($this->results, $func), $args);
    }

    // Single column access
    function offsetGet($name) {
    
        // get first result, transfuse into $this
        if (is_object($this->results)) {
            $this->exchangeArray($this->results->fetch());
            unset($this->results);







        }
        
        // suffice __get
        return parent::offsetGet($name);
    }

    // Just let PDOStatement handle the Traversable







|
<

>
>
>
>
>
>
>







383
384
385
386
387
388
389
390

391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
        return call_user_func_array(array($this->results, $func), $args);
    }

    // Single column access
    function offsetGet($name) {
    
        // get first result, transfuse into $this
        if (is_object($r = $this->results)) {

            unset($this->results);
            if ($row = $r->fetch()) {
                $this->exchangeArray($row);
            }
            // no row returned, silently return
            else {
                return NULL;
            }
        }
        
        // suffice __get
        return parent::offsetGet($name);
    }

    // Just let PDOStatement handle the Traversable