Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:62846 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 84420 invoked from network); 6 Sep 2012 07:40:28 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Sep 2012 07:40:28 -0000 Authentication-Results: pb1.pair.com smtp.mail=johannes.schlueter@oracle.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=johannes.schlueter@oracle.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain oracle.com designates 148.87.113.117 as permitted sender) X-PHP-List-Original-Sender: johannes.schlueter@oracle.com X-Host-Fingerprint: 148.87.113.117 rcsinet15.oracle.com Received: from [148.87.113.117] ([148.87.113.117:40192] helo=rcsinet15.oracle.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 0E/D3-01139-B6358405 for ; Thu, 06 Sep 2012 03:40:27 -0400 Received: from ucsinet22.oracle.com (ucsinet22.oracle.com [156.151.31.94]) by rcsinet15.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with ESMTP id q867eKNX022866 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 6 Sep 2012 07:40:21 GMT Received: from acsmt356.oracle.com (acsmt356.oracle.com [141.146.40.156]) by ucsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id q867eJWj029275 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 6 Sep 2012 07:40:19 GMT Received: from abhmt119.oracle.com (abhmt119.oracle.com [141.146.116.71]) by acsmt356.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id q867eIXa029872; Thu, 6 Sep 2012 02:40:18 -0500 Received: from [192.168.1.40] (/188.174.208.45) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 06 Sep 2012 00:40:18 -0700 References: <20111118210619.GA13490@panix.com> <1326977447.2722.10.camel@guybrush> <20120905232412.GA24245@analysisandsolutions.com> Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 In-Reply-To: <20120905232412.GA24245@analysisandsolutions.com> Message-ID: Date: Thu, 6 Sep 2012 01:31:13 +0200 Cc: PHP Internals List To: Daniel Convissor Mime-Version: 1.0 (1.0) X-Mailer: iPod Mail (9B206) X-Source-IP: ucsinet22.oracle.com [156.151.31.94] Subject: Re: [PHP-DEV] mysqli_fetch_field() mysqlnd & libmysql differences From: johannes.schlueter@oracle.com (=?utf-8?Q?Johannes_Schl=C3=BCter?=) Hi, On Sep 6, 2012, at 1:24, Daniel Convissor = wrote: > Hi Johannes: >=20 > On Thu, Jan 19, 2012 at 01:50:47PM +0100, Johannes Schl=C3=BCter wrote: >>=20 >> unsigned long length >>=20 >> The width of the field. This corresponds to the display length, >> in bytes. >>=20 >> The server determines the length value before it generates the >> result set, so this is the minimum length required for a data >> type capable of holding the largest possible value from the >> result column, without knowing in advance the actual values that >> will be produced by the query for the result set. >>=20 >> http://dev.mysql.com/doc/refman/5.5/en/c-api-data-structures.html >=20 > Pardon me for looping back around to this old discussion. I had a > moment to look at this in PEAR::DB the other day. A new perspective > came to mind... >=20 > It seems the field length in the C API is there to aid C programmers > with memory allocation. >=20 > The field length in PHP is there for PHP programmers to reverse engineer > database structures. >=20 > These are different purposes and the output should reflect such. >=20 > For example, the userland PHP field length could lead to someone dumping > a structure that has a VARCHAR(10). The exported metadata would say > VARCHAR(30). Then it gets imported and dumped again, and now we're up > to VARCHAR(90). Not fun. This is all correct - but there isn't much we can do. The server provides th= is data. Trying to "fix" it on the client side will likely become a mess. If= we create a mess I prefer doing it in user land (db2, mdb, doctrine, propel= , ...) where "everybody" can debug/fix it. Johannes > Thanks for your reconsideration, > --Dan >=20 > --=20 > T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y > data intensive web and database programming > http://www.AnalysisAndSolutions.com/ > 4015 7th Ave #4, Brooklyn NY 11232 v: 718-854-0335