Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:100053 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 85963 invoked from network); 26 Jul 2017 20:09:47 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Jul 2017 20:09:47 -0000 Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.128.171 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 209.85.128.171 mail-wr0-f171.google.com Received: from [209.85.128.171] ([209.85.128.171:36678] helo=mail-wr0-f171.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 25/6C-49004-A07F8795 for ; Wed, 26 Jul 2017 16:09:47 -0400 Received: by mail-wr0-f171.google.com with SMTP id y43so135793887wrd.3 for ; Wed, 26 Jul 2017 13:09:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:user-agent:in-reply-to:references:mime-version :content-transfer-encoding:subject:to:from:message-id; bh=KUFHnMZmKQXzpXqUOJnLCnPFyj1Fhi/2+Tq/bQWN2SY=; b=C9cGs+vqFGE3hsf8XUAi8uhFRpifcprwDeCXMEutm9wBE4YqM/KnIfRPR620Pr5Yql ievUGtzWO0BYnG3JGYTYxRysGyBvodN/y4RvbP56M0cm+a/YDNkQBJ2EKoAyHfw10Fe1 90Bh18Vi9XGjHgIOC8W9uLTE54rSwv+J7TAOAkh4Oj8JdeWb/h/DAjjjB8yakCbEirC4 7IKC9s9L4vlV9f0X69Frw3HxtmNUgmiYtJ+99Megn1phbLtJNDjW2+rXPHzUF6LHvKbr ZwjRGn3l//cwhlxGH9eL/wRyBiPxDHc0cmvcnaELCqq3sRzQFYUxp+iKV0NqDnHMNQj3 jGnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:user-agent:in-reply-to:references :mime-version:content-transfer-encoding:subject:to:from:message-id; bh=KUFHnMZmKQXzpXqUOJnLCnPFyj1Fhi/2+Tq/bQWN2SY=; b=ilLo+GBOIsBK2VwDVfx2g2ekkkAx50+oUm38+84YWSRT61QgCr9eo5f8L4LbyFqLNw 7wlgdDaTK0AUZFeEuSuOx6IiIt+vmzj1eny2z/aIkXsQkYLChMXijZklA4AjyDSFmJtm pOfRR2G5OHlnnFmf4DUlFW4Ux4aNNY5BiljtVr8GBaWoBN2GZE7hgAp7Z8JnOeejBFHb u2NNXMl6sHOlZwVpjKwGa6NKC+kzZS58Y54NfxavykOzHFO+BpW3XwE4/D4uIK1+Lemt H45xUls03ZafcY5dA8YSE+sfRmbOT5cIYXnMEIpVsyfVZiiKYit9Fxh3YxZqFbItcrMt R00w== X-Gm-Message-State: AIVw11205I6F6oUngDamam/nOnlOZrohTncOJoiAUtKT8RQ5OK/KG10S Dm5VMXkBEk11lMVS X-Received: by 10.223.134.39 with SMTP id 36mr1782747wrv.244.1501099783649; Wed, 26 Jul 2017 13:09:43 -0700 (PDT) Received: from ?IPv6:2a00:23c4:4bd2:6e00:f916:8888:9aec:4050? ([2a00:23c4:4bd2:6e00:f916:8888:9aec:4050]) by smtp.gmail.com with ESMTPSA id k4sm14130313wrc.34.2017.07.26.13.09.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Jul 2017 13:09:42 -0700 (PDT) Date: Wed, 26 Jul 2017 21:09:40 +0100 User-Agent: K-9 Mail for Android In-Reply-To: <84.D6.49004.EC298795@pb1.pair.com> References: <6B.63.49004.FFD68795@pb1.pair.com> <84.D6.49004.EC298795@pb1.pair.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable To: internals@lists.php.net,=?UTF-8?Q?Micha=C5=82?= Message-ID: Subject: Re: [PHP-DEV] PDO native JSON / array support From: rowan.collins@gmail.com (Rowan Collins) On 26 July 2017 14:02:03 BST, "Micha=C5=82" wrote: >JSON should be automatically converted to proper type(s)=2E > >$data =3D ['name' =3D> 'John']; >$sth =3D $dbh->prepare('INSERT INTO table (json_column) values (:data)'); >$sth->bindParam(':data', $data, PDO::PARAM_JSON); // new parameter > > >SELECT json_column FROM table; >$stmt->fetch(PDO::FETCH_ASSOC) should return > >array( > [json_column] =3D> array('name' =3D> 'John') >) This feels like unnecessary magic to me, when you can already write this, = and have all the power and flexibility of the existing JSON functions: $data =3D ['name' =3D> 'John']; $sth =3D $dbh->prepare('INSERT INTO table (json_column) values (:data)'); $sth->bindParam(':data', json_encode($data), PDO::PARAM_STRING); As I say, array types are much more fiddly, so support for those would be = great - that could just be well-tested encode /decode functions=2E Regards, --=20 Rowan Collins [IMSoP]