<?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: PEAR::MDB2</title>
	<atom:link href="http://cow.neondragon.net/index.php/682-Pearmdb2/feed" rel="self" type="application/rss+xml" />
	<link>http://cow.neondragon.net/index.php/682-Pearmdb2</link>
	<description>Helping you to get the most out of modern technology and communications since 2004.</description>
	<lastBuildDate>Tue, 07 Feb 2012 14:38:07 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Ethan Brown</title>
		<link>http://cow.neondragon.net/index.php/682-Pearmdb2/comment-page-1#comment-708</link>
		<dc:creator>Ethan Brown</dc:creator>
		<pubDate>Wed, 30 Nov -0001 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">#comment-708</guid>
		<description>&lt;p&gt;Hi.&#160; I&#039;m also converting to MDB2 from DB.&#160; The most annoying thing I&#039;m encountering is the necessity of having to include the datatypes during an update.&#160; For example:&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&#160;&#160;&#160; $query = &quot;UPDATE ip_location SET primary_ip = ?, loc_id = ?, component_type_id = ? &quot;&lt;br /&gt;&#160;&#160;&#160; &#160;&#160;&#160; . &quot; WHERE primary_ip = ?&quot;;&lt;br /&gt;&#160;&#160;&#160; $vals = array($ip, $loc_id, $device_id, $original_ip);&lt;br /&gt;&#160;&#160;&#160; $types = array(&#039;text&#039;, &#039;integer&#039;, &#039;integer&#039;, &#039;text&#039;);&lt;/p&gt;&lt;p&gt;&#160;$sth = $db_conn-&gt;prepare($query, $types);&lt;/p&gt;&lt;p&gt;$result = $sth-&gt;execute($vals);&lt;/p&gt;&lt;p&gt;&#160;If I omit the $types (it is an optional argument), I get an error about inserting text into an integer field.&lt;/p&gt;&lt;p&gt;The PEAR::DB library&#160; (and the perl DBD modules) don&#039;t require one to specify the $types.&#160; I always thought that was one of the really nice aspects of coding in scripting languages that were looser with data types.&#160; It&#039;s going require quite a bit of coding to port from DB to MDB2 because of the $types issue.&#160; I don&#039;t suppose you&#039;ve come across any way to have MDB2 do more of the work in this regard?&lt;/p&gt;&lt;p&gt;&#160;Thanks,&lt;/p&gt;&lt;p&gt;Ethan&#160; (ethan@ethanbrown.org)&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&#160;&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>Hi.&nbsp; I&#8217;m also converting to MDB2 from DB.&nbsp; The most annoying thing I&#8217;m encountering is the necessity of having to include the datatypes during an update.&nbsp; For example: </p>
<p>&nbsp;&nbsp;&nbsp; $query = &quot;UPDATE ip_location SET primary_ip = ?, loc_id = ?, component_type_id = ? &quot;<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; . &quot; WHERE primary_ip = ?&quot;;<br />&nbsp;&nbsp;&nbsp; $vals = array($ip, $loc_id, $device_id, $original_ip);<br />&nbsp;&nbsp;&nbsp; $types = array(&#8216;text&#8217;, &#8216;integer&#8217;, &#8216;integer&#8217;, &#8216;text&#8217;);</p>
<p>&nbsp;$sth = $db_conn-&gt;prepare($query, $types);</p>
<p>$result = $sth-&gt;execute($vals);</p>
<p>&nbsp;If I omit the $types (it is an optional argument), I get an error about inserting text into an integer field.</p>
<p>The PEAR::DB library&nbsp; (and the perl DBD modules) don&#8217;t require one to specify the $types.&nbsp; I always thought that was one of the really nice aspects of coding in scripting languages that were looser with data types.&nbsp; It&#8217;s going require quite a bit of coding to port from DB to MDB2 because of the $types issue.&nbsp; I don&#8217;t suppose you&#8217;ve come across any way to have MDB2 do more of the work in this regard?</p>
<p>&nbsp;Thanks,</p>
<p>Ethan&nbsp; (ethan@ethanbrown.org)</p>
<p>&nbsp;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Khlo</title>
		<link>http://cow.neondragon.net/index.php/682-Pearmdb2/comment-page-1#comment-709</link>
		<dc:creator>Khlo</dc:creator>
		<pubDate>Wed, 30 Nov -0001 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">#comment-709</guid>
		<description>&lt;p&gt;Hi there,&lt;/p&gt;&lt;p&gt;You don&#039;t &lt;em&gt;have to&lt;/em&gt; specify datatypes. PEAR::MDB2 will detect the datatype of the variable you send to it and use that if you don&#039;t provide a datatype. So if you have a string which contains a number, it&#039;ll detect a string and fail.&lt;/p&gt;&lt;p&gt;You can get around this by manually typecasting e.g. by doing:&lt;/p&gt;&lt;pre&gt;$vals = array($ip, (int)$loc_id, (int)$device_id, $original_ip); &lt;/pre&gt;&lt;p&gt;I&#039;m actually using this method at the moment. It is a bit strange that MDB2 has this behavior in a weakly-typed programming language but that&#039;s just the way it is.&lt;/p&gt;&lt;p&gt;I believe specifying the types actually keeps your code cleaner and makes it run faster so it may be worth going through all your code and specifying datatypes.&#160;&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>Hi there,</p>
<p>You don&#8217;t <em>have to</em> specify datatypes. PEAR::MDB2 will detect the datatype of the variable you send to it and use that if you don&#8217;t provide a datatype. So if you have a string which contains a number, it&#8217;ll detect a string and fail.</p>
<p>You can get around this by manually typecasting e.g. by doing:</p>
<pre>$vals = array($ip, (int)$loc_id, (int)$device_id, $original_ip); </pre>
<p>I&#8217;m actually using this method at the moment. It is a bit strange that MDB2 has this behavior in a weakly-typed programming language but that&#8217;s just the way it is.</p>
<p>I believe specifying the types actually keeps your code cleaner and makes it run faster so it may be worth going through all your code and specifying datatypes.&nbsp;</p>
]]></content:encoded>
	</item>
</channel>
</rss>

