<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: How to (and how not to) pass an array from PHP to the database</title>
	<atom:link href="http://maggienelson.com/2007/07/how-to-and-how-not-to-pass-an-array-from-php-to-the-database/feed/" rel="self" type="application/rss+xml" />
	<link>http://maggienelson.com/2007/07/how-to-and-how-not-to-pass-an-array-from-php-to-the-database/</link>
	<description>databases and code goodness</description>
	<lastBuildDate>Thu, 01 Apr 2010 23:53:35 -0400</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Christopher Jones</title>
		<link>http://maggienelson.com/2007/07/how-to-and-how-not-to-pass-an-array-from-php-to-the-database/comment-page-1/#comment-11</link>
		<dc:creator>Christopher Jones</dc:creator>
		<pubDate>Mon, 16 Jul 2007 20:30:05 +0000</pubDate>
		<guid isPermaLink="false">http://maggienelson.com/blog/?p=16#comment-11</guid>
		<description>Hi Maggie,
Can you share any results to show the performance improvement?
Another optimization for your example is to use the bulk FORALL statement.  So instead of the PL/SQL code:
for i in p_toy_ids.first .. p_toy_ids.last loop
insert into user_toy (
user_id,
toy_id)
values (
p_user_id,
p_toy_ids(i));
end loop;
You could use:
forall i in indices of p_toy_ids
insert into user_toy (
user_id,
toy_id)
values (
p_user_id,
p_toy_ids(i));
A side note for users of the OCI8 extension is that oci_bind_array_by_name() lets you pass an array without needing an intermediate function like parse_string_to_list_string().
</description>
		<content:encoded><![CDATA[<p>Hi Maggie,<br />
Can you share any results to show the performance improvement?<br />
Another optimization for your example is to use the bulk FORALL statement.  So instead of the PL/SQL code:<br />
for i in p_toy_ids.first .. p_toy_ids.last loop<br />
insert into user_toy (<br />
user_id,<br />
toy_id)<br />
values (<br />
p_user_id,<br />
p_toy_ids(i));<br />
end loop;<br />
You could use:<br />
forall i in indices of p_toy_ids<br />
insert into user_toy (<br />
user_id,<br />
toy_id)<br />
values (<br />
p_user_id,<br />
p_toy_ids(i));<br />
A side note for users of the OCI8 extension is that oci_bind_array_by_name() lets you pass an array without needing an intermediate function like parse_string_to_list_string().</p>
]]></content:encoded>
	</item>
</channel>
</rss>
