Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id D2C7764FCFE for ; Sat, 15 Nov 2008 22:51:04 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 90070-03 for ; Sat, 15 Nov 2008 22:51:00 -0400 (AST) X-Greylist: delayed 00:05:25.184598 by SQLgrey-1.7.6 Received: from out1.smtp.messagingengine.com (out1.smtp.messagingengine.com [66.111.4.25]) by mail.postgresql.org (Postfix) with ESMTP id 6206164FCC4 for ; Sat, 15 Nov 2008 22:50:58 -0400 (AST) Received: from compute2.internal (compute2.internal [10.202.2.42]) by out1.messagingengine.com (Postfix) with ESMTP id CE4AD1B68F3 for ; Sat, 15 Nov 2008 21:45:30 -0500 (EST) Received: from web5.messagingengine.com ([10.202.2.214]) by compute2.internal (MEProxy); Sat, 15 Nov 2008 21:45:30 -0500 Received: by web5.messagingengine.com (Postfix, from userid 99) id B01F26E181; Sat, 15 Nov 2008 21:45:30 -0500 (EST) Message-Id: <1226803530.24888.1284994985@webmail.messagingengine.com> X-Sasl-Enc: ktQWyWjcdVnWKI2ir8uUV4S28wAWxBPuqvRhAkK36RB8 1226803530 From: "V S P" To: pgsql-php@postgresql.org Content-Disposition: inline Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="KOI8-R" MIME-Version: 1.0 X-Mailer: MessagingEngine.com Webmail Interface Subject: [Q] PDO use to bind arrays for insert Date: Sat, 15 Nov 2008 21:45:30 -0500 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200811/11 X-Sequence-Number: 3922 Hi, I appologize in advance, if this is not the right place to ask (but I would appreciate then a pointer where I could ask) I am using PHP 5.2.6 and Postgres 8.3 both on windows right now. Wanted to know if there is a way to pass via PDO (because that's how I connect now to Postgres) an array of values to insert at once for example: I have a PHP class: cwork $work_id; $work_desc; I have, say, an array of 50 objects of type cwork arr_work I would like to insert all items in the array at once so that I would do one trip to the database. instead of performing insert SQL in a loop for each item. In oracle such functionality is called array inserts or bulk insert (sometimes). And in C++/OCI the interface is to basically specifying a character array of values (with byte offsets) for eacho of the fields. So there would be an array of work_id, and array of work_desc and both of those of the same length would have been specified and bound to the bind variables Thanks in advance, VSP -- V S P toreason@fastmail.fm -- http://www.fastmail.fm - Or how I learned to stop worrying and love email again