sqlite_fetch_object

SQLiteResult::fetchObject

SQLiteUnbuffered::fetchObject

(PHP 5 < 5.4.0)

sqlite_fetch_object -- SQLiteResult::fetchObject -- SQLiteUnbuffered::fetchObjectFetches the next row from a result set as an object

Description

object sqlite_fetch_object ( resource $result [, string $class_name [, array $ctor_params [, bool $decode_binary = true ]]] )

Object oriented style (method):

object SQLiteResult::fetchObject ([ string $class_name [, array $ctor_params [, bool $decode_binary = true ]]] )
object SQLiteUnbuffered::fetchObject ([ string $class_name [, array $ctor_params [, bool $decode_binary = true ]]] )
Warning

This function is currently not documented; only its argument list is available.

Коментарии

Автор:
This function is not implemented in the PECL extension version 1.0.3  http://pecl.php.net/package/SQLite/1.0.3
2004-09-22 01:34:29
http://php5.kiev.ua/manual/ru/function.sqlite-fetch-object.html
As the sqlite_fetch_object function is not implemented in the PECL extension version 1.0.3.
I?ve rewrite the sqlite_fetch_object in PHP :

// An empty class
class bidon {
}
   
// Fetch resultset as an object
function sqlite_fetch_object(&$resource){
                $arr =  sqlite_fetch_array($resource);
                $obj = new bidon();
                foreach ($arr as $key => $value) {
                        # Check is valid $T_VARIABLE
                        if (ereg(\"[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*\", $key)) {
                                $obj->$key;
                        }
                }
                return $obj;
}

Voila
2006-02-04 06:35:57
http://php5.kiev.ua/manual/ru/function.sqlite-fetch-object.html
Here a light workaround for PHP 4.x which I use in my DBAccess class :

<?
 
function sqlite_fetch_object(&$result) {
   
$vO sqlite_fetch_array($resultSQLITE_ASSOC);

    if(
$vO) {
     
$vO = (object) $vO;
    }

    return 
$vO;
  }
?>

HTH Holger
2006-03-11 21:39:53
http://php5.kiev.ua/manual/ru/function.sqlite-fetch-object.html
Here is the function from "cscm at meuh dot dyndns dot org" rewriten.
I think it will work better when really assigning the values ;-)
Also I'd replace the empty "bidon" class by stdClass wich is such an empty class and is provided by default.

// Fetch resultset as an object
function sqlite_fetch_object(&$resource){
               $arr =  sqlite_fetch_array($resource);
               $obj = new stdClass();
               foreach ($arr as $key => $value) {
                       # Check is valid $T_VARIABLE
                       if (ereg(\"[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*\", $key)) {
                               $obj->$key = $value;
                       }
               }
               return $obj;
}
2006-08-12 13:13:33
http://php5.kiev.ua/manual/ru/function.sqlite-fetch-object.html

    Поддержать сайт на родительском проекте КГБ