Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:98465 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 70678 invoked from network); 10 Mar 2017 06:24:48 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Mar 2017 06:24:48 -0000 Authentication-Results: pb1.pair.com header.from=ocramius@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ocramius@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.182 as permitted sender) X-PHP-List-Original-Sender: ocramius@gmail.com X-Host-Fingerprint: 209.85.220.182 mail-qk0-f182.google.com Received: from [209.85.220.182] ([209.85.220.182:36562] helo=mail-qk0-f182.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 3E/C3-31244-BA642C85 for ; Fri, 10 Mar 2017 01:24:43 -0500 Received: by mail-qk0-f182.google.com with SMTP id 1so153651933qkl.3 for ; Thu, 09 Mar 2017 22:24:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=/mEFN6yFmdpb+2cgqk9WQ6rGWAZkAthtEO9qq8cKwEY=; b=Ro57Ng+xTXPqSWpi+WE5WKSgfIYWWoqQuWyWX399ocihPWXWWx6rOFFHvT0WQjF/yj jNoI1tFSF+/gGL9b24BRCyUt427ohBF3iPCtur80wT5TgU9d5y79R49yOzlja7bliBZL 9hwjCacOiLTOkJPBAK4XLvxQYCZK9RIEMj2Yf0FdZ11JZj45snPqk96UdOleUJg5lSzc G2TiLp3+sKCNdkxLpji+obRgB8LYcgQf9IP4WF+aVCdOh3zxB5uENZ/x/JfNDxAmUHCW 2+tZM1cFaV7qq/sse03NB4Gaspq27nTFpzwEhySDekN1e8oLzJSC5CZYLW8WjZQltO5B mPOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=/mEFN6yFmdpb+2cgqk9WQ6rGWAZkAthtEO9qq8cKwEY=; b=Vk0MJwcufff4oGfCtOD4cYLlhKXcExRA+WO/Q454mcxH1oJFUteCpHIB2YhzjrCsdQ CERPGWc07qxbKAANpd9I+CuNPF6MnhbBO71oz0d7tXyuzFqOsCIUHTmE1IjkgfbZIDSN kS4at47tFOI0AxQGRjOXJuZ7IFs7ORBVRCwa+y70DxlQIBWK06M+ERDZKs1kJmsUIRP+ Kuyv3klny1wdMrH97r6ZXINvuCR2eVq5uG9tscp20mSkAQlXIaFiLtbS0c3nCfPReCRa cwg++Z8kakmGe6losSMH7DJ2AVJT+2OkSC7xvIALdMqkLeH9oXwnZg1csLmmJIySf9wu tPEA== X-Gm-Message-State: AMke39livXrZqkx4ArNJWmsyfHswyCNEMx+Z9Khn+xCX3fVdysxFufHjIY6I2OBU8Dq8uBPNUHJoQPHlcTIoag== X-Received: by 10.237.36.153 with SMTP id t25mr18755944qtc.134.1489127081141; Thu, 09 Mar 2017 22:24:41 -0800 (PST) MIME-Version: 1.0 Received: by 10.237.44.70 with HTTP; Thu, 9 Mar 2017 22:24:20 -0800 (PST) In-Reply-To: References: Date: Fri, 10 Mar 2017 01:24:20 -0500 Message-ID: To: Adam Baratz Cc: Matteo Beccati , "internals@lists.php.net" Content-Type: multipart/alternative; boundary=001a113f3c3cb27360054a5a6a76 Subject: Re: [PHP-DEV] Re: [RFC] Extended String Types For PDO From: ocramius@gmail.com (Marco Pivetta) --001a113f3c3cb27360054a5a6a76 Content-Type: text/plain; charset=UTF-8 Hey Adam, On Thu, Mar 9, 2017 at 11:07 AM, Adam Baratz wrote: > However, I see no reference about the expected input/output encoding >> (Unicode data is a bit vague). Is it expected to be UFT-8? Or maybe >> match the internal encoding of the driver (e.g. UTF-16?)? What happens >> if I try to quote a latin1 string? > > > I think this is mostly covered by my BC note: "These constants wouldn't > affect anything related to the character set used for connections." My only > intentions with my proposed change is to let people prepend an "N" to some > quoted values. The pdo_mysql and pdo_dblib quote functions are otherwise > ignorant of encoding. It's all bytes to them. There are different hooks to > set the encoding for a connection. I'm not aware of issues with either > extension dealing with multibyte characters in output. > > If that doesn't make sense, pass on a code snippet and I can think through > how it would work. > > Since I am still skeptical about this, I asked around and told people to >> bind parameters with unicode strings and poke me back: works correctly. >> So what is this addition doing exactly? Shouldn't this be treated as an >> SQL Server *BUG* instead? Why push it on the toolchain? >> > > It is true that you get the correct result right now. But this happens > because the DB will automatically cast values that are quoted incorrectly. > This addition would ensures that quoted values don't have an implicit cast > applied, which makes queries more expensive. I can put the links I shared > earlier into the RFC for easier reference. > > Thanks, > Adam > I've read the links, hence my skepticism and me labeling this as "yet another way that SQL Server decides to make things harder and buggy". It is a bug in SQL Server, unless I'm missing the reason for this to exist (or maybe there was such a reason in 1991). As for BC compliance, this will still break code, as current overrides to prepared statements (in DBAL, specifically) directly compare the parameter type to a constant (no bitmask comparison). Marco Pivetta http://twitter.com/Ocramius http://ocramius.github.com/ --001a113f3c3cb27360054a5a6a76--