<?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: php MsSQL Backup</title>
	<atom:link href="http://www.php-trivandrum.org/code-snippets/php-mssql-backup/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.php-trivandrum.org/code-snippets/php-mssql-backup/</link>
	<description>Get addicted to PHP</description>
	<lastBuildDate>Tue, 07 Sep 2010 16:40:09 +0530</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: jijutm</title>
		<link>http://www.php-trivandrum.org/code-snippets/php-mssql-backup/comment-page-1/#comment-13818</link>
		<dc:creator>jijutm</dc:creator>
		<pubDate>Fri, 19 Feb 2010 17:17:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.php-trivandrum.org/?p=982#comment-13818</guid>
		<description>&lt;a href=&quot;#comment-13816&quot; rel=&quot;nofollow&quot;&gt;@lkaiman&lt;/a&gt; 
I am not sure, you asking for backup of MySQL or MSSQL ?, if it is MySQL you dont need to bother about creating the INSERT statements for backups, better think about writing csv output.</description>
		<content:encoded><![CDATA[<p><a href="#comment-13816">@lkaiman</a><br />
I am not sure, you asking for backup of MySQL or MSSQL ?, if it is MySQL you dont need to bother about creating the INSERT statements for backups, better think about writing csv output.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: lkaiman</title>
		<link>http://www.php-trivandrum.org/code-snippets/php-mssql-backup/comment-page-1/#comment-13816</link>
		<dc:creator>lkaiman</dc:creator>
		<pubDate>Fri, 19 Feb 2010 13:43:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.php-trivandrum.org/?p=982#comment-13816</guid>
		<description>hi,

...scuse me for my english...

how do you proceed for make a backup with a data type &quot;timestamp&quot; ?

It is in this part:
function buildInsertQuery($a, $table, $struct){
	
	// do some value escaping
	foreach($a as $field =&gt; $value){
		switch($struct[$field][&#039;type&#039;]){
			case &#039;varchar&#039;:
			case &#039;nchar&#039;:
			case &#039;char&#039;:
			case &#039;text&#039;:
			case &#039;datetime&#039;:
				if(!is_null($value)) $a[$field] = &quot;&#039;&quot; . str_replace(&quot;&#039;&quot;,&quot;&#039;&#039;&quot;, $value) . &quot;&#039;&quot;;
				elseif($struct[$field][&#039;null&#039;] == &#039;NO&#039;) $a[$field] = &quot;&#039;&#039;&quot;;
				else  $a[$field] = &quot;NULL&quot;;
			break;	
			case &#039;timestamp&#039;: $a[$field]=&#039;?????????????&#039;; break;
			case &#039;numeric&#039;:
			case &#039;int&#039;:
				$a[$field] = sprintf(&quot;%d&quot;, $value);
			break;
		}
	}
	
	return &#039;INSERT INTO [&#039;.$table.&#039;] ([&#039;.implode(&#039;],[&#039;, array_keys($a)).&#039;]) VALUES (&#039;.implode(&#039;,&#039;,array_values($a)).&#039;);&#039;;
}</description>
		<content:encoded><![CDATA[<p>hi,</p>
<p>&#8230;scuse me for my english&#8230;</p>
<p>how do you proceed for make a backup with a data type &#8220;timestamp&#8221; ?</p>
<p>It is in this part:<br />
function buildInsertQuery($a, $table, $struct){</p>
<p>	// do some value escaping<br />
	foreach($a as $field =&gt; $value){<br />
		switch($struct[$field]['type']){<br />
			case &#8216;varchar&#8217;:<br />
			case &#8216;nchar&#8217;:<br />
			case &#8216;char&#8217;:<br />
			case &#8216;text&#8217;:<br />
			case &#8216;datetime&#8217;:<br />
				if(!is_null($value)) $a[$field] = &#8220;&#8216;&#8221; . str_replace(&#8221;&#8216;&#8221;,&#8221;&#8221;&#8221;, $value) . &#8220;&#8216;&#8221;;<br />
				elseif($struct[$field]['null'] == &#8216;NO&#8217;) $a[$field] = &#8220;&#8221;&#8221;;<br />
				else  $a[$field] = &#8220;NULL&#8221;;<br />
			break;<br />
			case &#8216;timestamp&#8217;: $a[$field]=&#8217;?????????????&#8217;; break;<br />
			case &#8216;numeric&#8217;:<br />
			case &#8216;int&#8217;:<br />
				$a[$field] = sprintf(&#8221;%d&#8221;, $value);<br />
			break;<br />
		}<br />
	}</p>
<p>	return &#8216;INSERT INTO ['.$table.'] (['.implode('],[', array_keys($a)).']) VALUES (&#8217;.implode(&#8217;,',array_values($a)).&#8217;);&#8217;;<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Undisclosed</title>
		<link>http://www.php-trivandrum.org/code-snippets/php-mssql-backup/comment-page-1/#comment-13782</link>
		<dc:creator>Undisclosed</dc:creator>
		<pubDate>Sun, 07 Feb 2010 01:39:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.php-trivandrum.org/?p=982#comment-13782</guid>
		<description>he used the same technique in the end and it worked</description>
		<content:encoded><![CDATA[<p>he used the same technique in the end and it worked</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: High School</title>
		<link>http://www.php-trivandrum.org/code-snippets/php-mssql-backup/comment-page-1/#comment-13774</link>
		<dc:creator>High School</dc:creator>
		<pubDate>Thu, 04 Feb 2010 20:59:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.php-trivandrum.org/?p=982#comment-13774</guid>
		<description>Great article . Will definitely apply it to my blog.Thanks.</description>
		<content:encoded><![CDATA[<p>Great article . Will definitely apply it to my blog.Thanks.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
