Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:30335 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 36746 invoked by uid 1010); 26 Jun 2007 01:39:57 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 36731 invoked from network); 26 Jun 2007 01:39:57 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Jun 2007 01:39:57 -0000 Authentication-Results: pb1.pair.com header.from=kevin@oceania.net; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=kevin@oceania.net; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain oceania.net designates 64.22.118.220 as permitted sender) X-PHP-List-Original-Sender: kevin@oceania.net X-Host-Fingerprint: 64.22.118.220 unknown Received: from [64.22.118.220] ([64.22.118.220:1594] helo=swamp.oceania.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 4F/52-01436-96E60864 for ; Mon, 25 Jun 2007 21:39:57 -0400 Received: from localhost.localdomain ([58.172.208.212]) by swamp.oceania.net (8.13.8/8.13.8) with SMTP id l5Q0fsU1014312; Tue, 26 Jun 2007 10:41:54 +1000 Date: Tue, 26 Jun 2007 11:49:40 +1000 To: internals@lists.php.net Cc: wez@php.net Message-ID: <20070626114940.2b6c51a0.kevin@oceania.net> Organization: Oceania X-Mailer: Sylpheed version 0.9.12 (GTK+ 1.2.10; i386-vine-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: pdo_mysql patch From: kevin@oceania.net (Kevin Waterson) currently pdo_mysql is unable to discern between a BLOB and a TEXT field in mysql_statement.c By using the current if (IS_BLOB(F->flags)), which is now deprecated in the mysql c api, it will be true for both TEXT and BLOB fields. By updating a little to the newer api and checking with F->type we get the same result, however, further checking on the character set number can distinguish between BINARY and CHAR, VARBINARY and VARCHAR, and BLOB and TEXT fields. When using PDOStatement::getColumnMeta() any field with charsetnr of 63 reports as text, rather than blob. Patch follows... --- old.c 2007-06-26 11:27:57.000000000 +1000 +++ mysql_statement.c 2007-06-26 11:26:47.000000000 +1000 @@ -581,8 +581,12 @@ if (F->flags & UNIQUE_KEY_FLAG) { add_next_index_string(flags, "unique_key", 1); } - if (IS_BLOB(F->flags)) { - add_next_index_string(flags, "blob", 1); + if(F->type == MYSQL_TYPE_BLOB) { + if(F->charsetnr == 63) { + add_next_index_string(flags, "blob", 1); + } else { + add_next_index_string(flags, "text", 1); + } } str = type_to_name_native(F->type); if (str) { -- "Democracy is two wolves and a lamb voting on what to have for lunch. Liberty is a well-armed lamb contesting the vote."