Req #68470 [NEW]: Wish:Add prefix to field name while mysqli_result::fetch_object

From: Date: Fri, 21 Nov 2014 10:47:59 +0000
Subject: Req #68470 [NEW]: Wish:Add prefix to field name while mysqli_result::fetch_object
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-188725@lists.php.net to get a copy of this message
From:             eglic dot csdn at gmail dot com
Operating system: All
PHP version:      5.6.3
Package:          MySQLi related
Bug Type:         Feature/Change Request
Bug description:Wish:Add prefix to field name while mysqli_result::fetch_object

Description:
------------
I tought to improve fetch_object such as follow code is useful:

mysqli_result::fetch_object ([ string $class_name = "stdClass" [[,
string $field_name_prefix = ''], array $params ]] )

example code :

$result = $mysqli->query("select id,name from user limit 1");
$user = $result->fetch_object('stdClass','__');
var_dump($user);

output :

object stdClass {
  $__id = 1;
  $__name = 'someone';
}

-----------------------------------
in addition , i have a question :
 why call __constructor at the last in this method?



-- 
Edit bug report at https://bugs.php.net/bug.php?id=68470&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=68470&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=68470&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=68470&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=68470&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=68470&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=68470&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=68470&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=68470&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=68470&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=68470&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=68470&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=68470&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=68470&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=68470&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=68470&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=68470&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=68470&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=68470&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=68470&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=68470&r=mysqlcfg



Thread (4 messages)

« previous php.bugs (#188725) next »