<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="http://www.bytemycode.com/rssformat.xsl"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/">
	<channel>
		<title>byteMyCode: Snippet Revisions</title>
		<link>http://www.bytemycode.com</link>
		<description>Revisions for this snippet.</description>
		<pubDate>Thu, 04 Dec 2008 15:45:55 +0000</pubDate>
		<copyright>1998-2008 </copyright>
		<language>en-us</language>
		<image>
		      <link>http://www.bytemycode.com</link>
		      <url>http://www.bytemycode.com/img/rss_title.gif</url>
		      <title>byteMyCode</title>
		</image>

	
	<item>
		<title>SQL Templating 1</title>
		<link>http://www.bytemycode.com/snippets/snippet/88/1/</link>
		<comments>http://www.bytemycode.com/snippets/snippet/88/comments/</comments>
		<pubDate>Fri, 17 Feb 2006 04:36:49 +0000</pubDate>
		<dc:creator>mercutio</dc:creator>
		<category>mysql</category>
		<guid isPermaLink="false">http://www.bytemycode.com/snippets/snippet/88/</guid>
		<description>
			<![CDATA[
				<p>I use this method for keeping my sql templates away from my code.<br /><br />You can extend upon the idea, as I have done in the past, by placing SQL handing classes between your scripts and the template library.<br /><br />Things to note here:<br /><br />The lesser userd heredoc string method. The reason this is used is to keep the SQL clear and well laid out, and not as messy as using quotes.<br /><br />vsprintf() is a very handy function if you don't want to hard code the number of parameters to interpolate your string with.<br /><br />The use of sprintf templates offers you additional security. For example, only allowing numbers to be placed where a %d falls. This, of course, shouldn't be the only security on user supplied variables, but comes in extra handy for debugging purposes.<br /><br />Regarding the TODO in there, it would take a check of the number of % placeholders there are in the template. One caveat is remembering to remove the count of %%'s that appear (the literal percentage).</p>
			]]>
		</description>
	</item>

	
	<item>
		<title>SQL Templating 2</title>
		<link>http://www.bytemycode.com/snippets/snippet/88/2/</link>
		<comments>http://www.bytemycode.com/snippets/snippet/88/comments/</comments>
		<pubDate>Fri, 17 Feb 2006 04:39:10 +0000</pubDate>
		<dc:creator>mercutio</dc:creator>
		<category>mysql</category>
		<guid isPermaLink="false">http://www.bytemycode.com/snippets/snippet/88/</guid>
		<description>
			<![CDATA[
				<p>I use this method for keeping my sql templates away from my code.<br /><br />You can extend upon the idea, as I have done in the past, by placing SQL handing classes between your scripts and the template library.<br /><br />Things to note here:<br /><br />The lesser userd heredoc string method. The reason this is used is to keep the SQL clear and well laid out, and not as messy as using quotes.<br /><br />vsprintf() is a very handy function if you don't want to hard code the number of parameters to interpolate your string with.<br /><br />The use of sprintf templates offers you additional security. For example, only allowing numbers to be placed where a %d falls. This, of course, shouldn't be the only security on user supplied variables, but comes in extra handy for debugging purposes.<br /><br />Regarding the TODO in there, it would take a check of the number of % placeholders there are in the template. One caveat is remembering to remove the count of %%'s that appear (the literal percentage).<br /><br /><br />P.S, this system doesn't appear to like the < < < ENDSQL used to define the beginning of a heredoc statement.</p>
			]]>
		</description>
	</item>

	
	<item>
		<title>SQL Templating 3</title>
		<link>http://www.bytemycode.com/snippets/snippet/88/3/</link>
		<comments>http://www.bytemycode.com/snippets/snippet/88/comments/</comments>
		<pubDate>Fri, 17 Feb 2006 04:52:36 +0000</pubDate>
		<dc:creator>mercutio</dc:creator>
		<category>mysql</category>
		<guid isPermaLink="false">http://www.bytemycode.com/snippets/snippet/88/</guid>
		<description>
			<![CDATA[
				<p>I use this method for keeping my sql templates away from my code.<br /><br />You can extend upon the idea, as I have done in the past, by placing SQL handing classes between your scripts and the template library.<br /><br />Things to note here:<br /><br />The lesser userd heredoc string method. The reason this is used is to keep the SQL clear and well laid out, and not as messy as using quotes.<br /><br />vsprintf() is a very handy function if you don't want to hard code the number of parameters to interpolate your string with.<br /><br />The use of sprintf templates offers you additional security. For example, only allowing numbers to be placed where a %d falls. This, of course, shouldn't be the only security on user supplied variables, but comes in extra handy for debugging purposes.<br /><br />Regarding the TODO in there, it would take a check of the number of % placeholders there are in the template. One caveat is remembering to remove the count of %%'s that appear (the literal percentage).</p>
			]]>
		</description>
	</item>

	
	</channel>
</rss>