<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Florin Chiş</title>
	<atom:link href="http://florin-chis.scream.ro/feed/" rel="self" type="application/rss+xml" />
	<link>http://florin-chis.scream.ro</link>
	<description>MySQL snippets, tips and tricks</description>
	<lastBuildDate>Fri, 30 Dec 2011 22:36:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Convert UTF8 diacritics to ASCII in MySQL for use in website links</title>
		<link>http://florin-chis.scream.ro/convert-utf8-string-to-ascii-in-mysql-for-use-in-website-links/</link>
		<comments>http://florin-chis.scream.ro/convert-utf8-string-to-ascii-in-mysql-for-use-in-website-links/#comments</comments>
		<pubDate>Wed, 28 Dec 2011 16:36:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MySQL small projects]]></category>
		<category><![CDATA[conversion]]></category>
		<category><![CDATA[latin]]></category>
		<category><![CDATA[link]]></category>
		<category><![CDATA[procedure]]></category>
		<category><![CDATA[translation]]></category>
		<category><![CDATA[utf8]]></category>

		<guid isPermaLink="false">http://florin-chis.scream.ro/?p=47</guid>
		<description><![CDATA[A very common problem for web developers is to maintain a normalized link (a string to identify a page) for their webpages when that string is from a foreign language that contains diacritic. For example, the string &#8220;ştiaţi că&#8230;&#8221; (in Romanian means &#8220;did you know&#8221;), should be converted to &#8220;stiati ca&#8230;&#8221;, so romanian diacritics are [...]]]></description>
			<content:encoded><![CDATA[<p>A very common problem for web developers is to maintain a normalized link (a string to identify a page) for their webpages when that string is from a foreign language that contains diacritic. For example, the string &#8220;ştiaţi că&#8230;&#8221; (in Romanian means &#8220;did you know&#8221;), should be converted to &#8220;stiati ca&#8230;&#8221;, so romanian diacritics are converted to it&#8217;s latin representation. That means that <span style="color: #ff0000;"><strong>&#8220;ă&#8221;</strong></span> becomes <span style="color: #ff0000;"><strong>&#8220;a&#8221;</strong></span>, <span style="color: #ff0000;"><strong>&#8220;ş&#8221;</strong></span> becomes <span style="color: #ff0000;"><strong>&#8220;s&#8221;</strong></span> and <span style="color: #ff0000;"><strong>&#8220;ţ&#8221;</strong></span> becomes <span style="color: #ff0000;"><strong>&#8220;t&#8221;</strong></span>. This transformation is useful because some search engines and some browsers don&#8217;t get well with these diacritics.<br />
There is a mysql stored routine to convert such characters. That procedure uses a mysql table that contain about 400 characters and their latin representation. This is a mapping table between different alphabets and latin alphabet. The table has been created based on standard mysql charsets (see <a href="http://www.collation-charts.org/mysql60/mysql604.utf8_general_ci.european.html" target="_blank">Collation chart for utf8_general_ci, European alphabets</a>). Procedure listing is shown below. There is a text file with <a href="/wp-content/uploads/2011/12/utf8_translation_table_create_and_fill.txt" target="_blank">SQL queries to create utf8_translation and it&#8217;s content</a>.</p>
<div class="codecolorer-container mysql mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br /></div></td><td><div class="mysql codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #990099; font-weight: bold;">CREATE</span> <span style="color: #990099; font-weight: bold;">FUNCTION</span> <span style="color: #008000;">`util<span style="color: #008080; font-weight: bold;">_</span>utf8<span style="color: #008080; font-weight: bold;">_</span>to<span style="color: #008080; font-weight: bold;">_</span>ascii`</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008000;">`<span style="color: #008080; font-weight: bold;">_</span>str`</span> <span style="color: #999900; font-weight: bold;">VARCHAR</span><span style="color: #FF00FF;">&#40;</span><span style="color: #FF6666;">255</span><span style="color: #FF00FF;">&#41;</span><span style="color: #FF00FF;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #990099; font-weight: bold;">RETURNS</span> <span style="color: #999900; font-weight: bold;">varchar</span><span style="color: #FF00FF;">&#40;</span><span style="color: #FF6666;">255</span><span style="color: #FF00FF;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #990099; font-weight: bold;">LANGUAGE SQL</span><br />
&nbsp; &nbsp; <span style="color: #990099; font-weight: bold;">SQL SECURITY</span> <span style="color: #990099; font-weight: bold;">INVOKER</span><br />
&nbsp; &nbsp; <span style="color: #990099; font-weight: bold;">COMMENT</span> <span style="color: #008000;">'Convert UTF8 to ASCII based on utf8<span style="color: #008080; font-weight: bold;">_</span>translation'</span><br />
<span style="color: #990099; font-weight: bold;">BEGIN</span><br />
&nbsp; &nbsp; <span style="color: #990099; font-weight: bold;">DECLARE</span> cutf8 <span style="color: #999900; font-weight: bold;">VARCHAR</span><span style="color: #FF00FF;">&#40;</span><span style="color: #FF6666;">5</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">;</span><br />
&nbsp; &nbsp; <span style="color: #990099; font-weight: bold;">DECLARE</span> cascii <span style="color: #000099;">CHAR</span><span style="color: #FF00FF;">&#40;</span><span style="color: #FF6666;">1</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">;</span><br />
&nbsp; &nbsp; <span style="color: #990099; font-weight: bold;">DECLARE</span> newStr <span style="color: #999900; font-weight: bold;">VARCHAR</span><span style="color: #FF00FF;">&#40;</span><span style="color: #FF6666;">255</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">;</span><br />
&nbsp; &nbsp; <span style="color: #990099; font-weight: bold;">DECLARE</span> done <span style="color: #999900; font-weight: bold;">INT</span> <span style="color: #990099; font-weight: bold;">DEFAULT</span> <span style="color: #FF6666;">0</span><span style="color: #000033;">;</span><br />
&nbsp; &nbsp; <span style="color: #990099; font-weight: bold;">DECLARE</span> cur1 CURSOR FOR <span style="color: #990099; font-weight: bold;">SELECT</span> u.c_utf8<span style="color: #000033;">,</span> u.c_ascii <span style="color: #990099; font-weight: bold;">FROM</span> utf8_translation <span style="color: #990099; font-weight: bold;">AS</span> u<span style="color: #000033;">;</span><br />
&nbsp; &nbsp; <span style="color: #990099; font-weight: bold;">DECLARE</span> CONTINUE <span style="color: #990099; font-weight: bold;">HANDLER</span> FOR <span style="color: #CC0099; font-weight: bold;">NOT</span> FOUND <span style="color: #990099; font-weight: bold;">SET</span> done <span style="color: #CC0099;">=</span> <span style="color: #FF6666;">1</span><span style="color: #000033;">;</span><br />
&nbsp; &nbsp; OPEN cur1<span style="color: #000033;">;</span><br />
&nbsp; &nbsp; <span style="color: #990099; font-weight: bold;">SET</span> newStr <span style="color: #CC0099;">=</span> _str<span style="color: #000033;">;</span><br />
&nbsp; &nbsp; read_loop: <span style="color: #990099; font-weight: bold;">LOOP</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; FETCH cur1 <span style="color: #990099; font-weight: bold;">INTO</span> cutf8<span style="color: #000033;">,</span> cascii<span style="color: #000033;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">IF</span> done <span style="color: #009900;">THEN</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; LEAVE read_loop<span style="color: #000033;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">END</span> <span style="color: #009900;">IF</span><span style="color: #000033;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">IF</span> <span style="color: #FF00FF;">&#40;</span><span style="color: #000099;">LOCATE</span><span style="color: #FF00FF;">&#40;</span>cutf8<span style="color: #000033;">,</span> _str<span style="color: #FF00FF;">&#41;</span><span style="color: #FF00FF;">&#41;</span> <span style="color: #009900;">THEN</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990099; font-weight: bold;">SET</span> newStr <span style="color: #CC0099;">=</span> <span style="color: #000099;">REPLACE</span><span style="color: #FF00FF;">&#40;</span>newStr<span style="color: #000033;">,</span> cutf8<span style="color: #000033;">,</span> cascii<span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">END</span> <span style="color: #009900;">IF</span><span style="color: #000033;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">END</span> <span style="color: #990099; font-weight: bold;">LOOP</span><span style="color: #000033;">;</span><br />
&nbsp; &nbsp; RETURN newStr<span style="color: #000033;">;</span><br />
<span style="color: #009900;">END</span></div></td></tr></tbody></table></div>
]]></content:encoded>
			<wfw:commentRss>http://florin-chis.scream.ro/convert-utf8-string-to-ascii-in-mysql-for-use-in-website-links/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Generate table with random text from dictionary</title>
		<link>http://florin-chis.scream.ro/generate-table-with-random-text-from-dictionary/</link>
		<comments>http://florin-chis.scream.ro/generate-table-with-random-text-from-dictionary/#comments</comments>
		<pubDate>Tue, 27 Dec 2011 14:43:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MySQL small projects]]></category>
		<category><![CDATA[article]]></category>
		<category><![CDATA[dictionary]]></category>
		<category><![CDATA[generate]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[procedure]]></category>
		<category><![CDATA[random]]></category>
		<category><![CDATA[text]]></category>
		<category><![CDATA[word]]></category>

		<guid isPermaLink="false">http://florin-chis.scream.ro/?p=32</guid>
		<description><![CDATA[For testing purposes, it is very useful sometimes to generate some random content in a mysql table. Such table simulates a real table with content generated in long time. For instance, suppose you have a mysql table with comments from users. Each day, users post a number of comments. Thus, i a year or so, [...]]]></description>
			<content:encoded><![CDATA[<p>For testing purposes, it is very useful sometimes to generate some random content in a mysql table. Such table simulates a real table with content generated in long time. For instance, suppose you have a mysql table with comments from users. Each day, users post a number of comments. Thus, i a year or so, there have been accumulated many comments (let&#8217;s say, about 100.000 comments). But you would like to test some database queries in a real environment before users can post their comments. So, this post will explain how to generate a big table with comments (automatically generated) using mysql stored routines.</p>
<p>First, I&#8217;ve got an English dictionary with words, which I&#8217;ve imported into a simple MySQL table with structure described below:</p>
<div class="codecolorer-container mysql mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br /></div></td><td><div class="mysql codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #990099; font-weight: bold;">CREATE</span> <span style="color: #990099; font-weight: bold;">TABLE</span> <span style="color: #008000;">`dict<span style="color: #008080; font-weight: bold;">_</span>en`</span> <span style="color: #FF00FF;">&#40;</span><br />
&nbsp; &nbsp; <span style="color: #008000;">`id`</span> <span style="color: #999900; font-weight: bold;">INT</span><span style="color: #FF00FF;">&#40;</span><span style="color: #FF6666;">10</span><span style="color: #FF00FF;">&#41;</span> <span style="color: #FF9900; font-weight: bold;">UNSIGNED</span> <span style="color: #CC0099; font-weight: bold;">NOT</span> <span style="color: #990000; font-weight: bold;">NULL</span> <span style="color: #FF9900; font-weight: bold;">AUTO_INCREMENT</span><span style="color: #000033;">,</span><br />
&nbsp; &nbsp; <span style="color: #008000;">`word`</span> <span style="color: #999900; font-weight: bold;">VARCHAR</span><span style="color: #FF00FF;">&#40;</span><span style="color: #FF6666;">50</span><span style="color: #FF00FF;">&#41;</span> <span style="color: #CC0099; font-weight: bold;">NOT</span> <span style="color: #990000; font-weight: bold;">NULL</span> <span style="color: #990099; font-weight: bold;">DEFAULT</span> <span style="color: #008000;">''</span><span style="color: #000033;">,</span><br />
&nbsp; &nbsp; <span style="color: #990099; font-weight: bold;">PRIMARY KEY</span> <span style="color: #FF00FF;">&#40;</span><span style="color: #008000;">`id`</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">,</span><br />
&nbsp; &nbsp; <span style="color: #990099; font-weight: bold;">INDEX</span> <span style="color: #008000;">`word`</span> <span style="color: #FF00FF;">&#40;</span><span style="color: #008000;">`word`</span><span style="color: #FF00FF;">&#41;</span><br />
<span style="color: #FF00FF;">&#41;</span><br />
<span style="color: #990099; font-weight: bold;">COMMENT</span><span style="color: #CC0099;">=</span><span style="color: #008000;">'English dictionary'</span><br />
<span style="color: #CC0099; font-weight: bold;">COLLATE</span><span style="color: #CC0099;">=</span><span style="color: #008000;">'utf8<span style="color: #008080; font-weight: bold;">_</span>general<span style="color: #008080; font-weight: bold;">_</span>ci'</span><br />
<span style="color: #990099; font-weight: bold;">ENGINE</span><span style="color: #CC0099;">=</span>MyISAM<br />
<span style="color: #FF9900; font-weight: bold;">ROW_FORMAT</span><span style="color: #CC0099;">=</span><span style="color: #990099; font-weight: bold;">DEFAULT</span><span style="color: #000033;">;</span></div></td></tr></tbody></table></div>
<p>Second, I&#8217;ve created a simple table that will host so-called articles (randomly created):</p>
<div class="codecolorer-container mysql mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br /></div></td><td><div class="mysql codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #990099; font-weight: bold;">CREATE</span> <span style="color: #990099; font-weight: bold;">TABLE</span> <span style="color: #008000;">`articles`</span> <span style="color: #FF00FF;">&#40;</span><br />
&nbsp; &nbsp; <span style="color: #008000;">`id`</span> <span style="color: #999900; font-weight: bold;">BIGINT</span><span style="color: #FF00FF;">&#40;</span><span style="color: #FF6666;">20</span><span style="color: #FF00FF;">&#41;</span> <span style="color: #CC0099; font-weight: bold;">NOT</span> <span style="color: #990000; font-weight: bold;">NULL</span> <span style="color: #FF9900; font-weight: bold;">AUTO_INCREMENT</span><span style="color: #000033;">,</span><br />
&nbsp; &nbsp; <span style="color: #008000;">`content`</span> <span style="color: #999900; font-weight: bold;">MEDIUMTEXT</span> <span style="color: #990000; font-weight: bold;">NULL</span><span style="color: #000033;">,</span><br />
&nbsp; &nbsp; <span style="color: #990099; font-weight: bold;">PRIMARY KEY</span> <span style="color: #FF00FF;">&#40;</span><span style="color: #008000;">`id`</span><span style="color: #FF00FF;">&#41;</span><br />
<span style="color: #FF00FF;">&#41;</span><br />
<span style="color: #990099; font-weight: bold;">COMMENT</span><span style="color: #CC0099;">=</span><span style="color: #008000;">'articole'</span><br />
<span style="color: #CC0099; font-weight: bold;">COLLATE</span><span style="color: #CC0099;">=</span><span style="color: #008000;">'utf8<span style="color: #008080; font-weight: bold;">_</span>general<span style="color: #008080; font-weight: bold;">_</span>ci'</span><br />
<span style="color: #990099; font-weight: bold;">ENGINE</span><span style="color: #CC0099;">=</span>MyISAM<br />
<span style="color: #FF9900; font-weight: bold;">ROW_FORMAT</span><span style="color: #CC0099;">=</span><span style="color: #990099; font-weight: bold;">DEFAULT</span><span style="color: #000033;">;</span></div></td></tr></tbody></table></div>
<p>Now, you should import a simple text file with dictionary data, each word on a single line. This could be done with <code class="codecolorer sql mac-classic"><span class="sql"><span style="color: #993333; font-weight: bold;">LOAD</span> <span style="color: #993333; font-weight: bold;">DATA</span> <span style="color: #993333; font-weight: bold;">INFILE</span></span></code> command like this:</p>
<div class="codecolorer-container mysql mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br /></div></td><td><div class="mysql codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #990099; font-weight: bold;">LOAD</span> <span style="color: #990099; font-weight: bold;">DATA</span> <span style="color: #990099; font-weight: bold;">INFILE</span> <span style="color: #008000;">'my<span style="color: #008080; font-weight: bold;">_</span>dictionary<span style="color: #008080; font-weight: bold;">_</span>file.txt'</span> <span style="color: #990099; font-weight: bold;">INTO</span> <span style="color: #990099; font-weight: bold;">TABLE</span> dict_en<br />
&nbsp; &nbsp; <span style="color: #990099; font-weight: bold;">FIELDS</span> <span style="color: #990099; font-weight: bold;">TERMINATED BY</span> <span style="color: #008000;">&quot;<span style="color: #004000; font-weight: bold;">\t</span>&quot;</span><br />
&nbsp; &nbsp; <span style="color: #990099; font-weight: bold;">LINES</span> <span style="color: #990099; font-weight: bold;">TERMINATED BY</span> <span style="color: #008000;">&quot;<span style="color: #004000; font-weight: bold;">\n</span>&quot;</span><br />
&nbsp; &nbsp; <span style="color: #FF00FF;">&#40;</span><span style="color: #008000;">`word`</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">;</span></div></td></tr></tbody></table></div>
<p>At this moment, we use the dictionary table to generate some variable-width random generated text that simulated a comment. For this example, let&#8217;s generate a comment with a random number of words between 1 and 1000, words separated by SPACE. This can be accomplished with MySQL function described below:</p>
<div class="codecolorer-container mysql mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br /></div></td><td><div class="mysql codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #990099; font-weight: bold;">CREATE</span> <span style="color: #990099; font-weight: bold;">FUNCTION</span> <span style="color: #008000;">`create<span style="color: #008080; font-weight: bold;">_</span>content<span style="color: #008080; font-weight: bold;">_</span>by<span style="color: #008080; font-weight: bold;">_</span>wordlist`</span><span style="color: #FF00FF;">&#40;</span><span style="color: #FF00FF;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #990099; font-weight: bold;">RETURNS</span> <span style="color: #999900; font-weight: bold;">mediumtext</span><br />
&nbsp; &nbsp; <span style="color: #990099; font-weight: bold;">LANGUAGE SQL</span><br />
&nbsp; &nbsp; <span style="color: #990099; font-weight: bold;">DETERMINISTIC</span><br />
&nbsp; &nbsp; <span style="color: #990099; font-weight: bold;">COMMENT</span> <span style="color: #008000;">'Creates a text with random words from dictionary table'</span><br />
<span style="color: #990099; font-weight: bold;">BEGIN</span><br />
&nbsp; &nbsp; <span style="color: #990099; font-weight: bold;">DECLARE</span> retVal <span style="color: #999900; font-weight: bold;">MEDIUMTEXT</span> <span style="color: #990099; font-weight: bold;">DEFAULT</span> <span style="color: #008000;">''</span><span style="color: #000033;">;</span><br />
&nbsp; &nbsp; <span style="color: #990099; font-weight: bold;">DECLARE</span> iter <span style="color: #999900; font-weight: bold;">INT</span><span style="color: #FF00FF;">&#40;</span><span style="color: #FF6666;">10</span><span style="color: #FF00FF;">&#41;</span> <span style="color: #990099; font-weight: bold;">DEFAULT</span> <span style="color: #FF6666;">0</span><span style="color: #000033;">;</span><br />
&nbsp; &nbsp; <span style="color: #990099; font-weight: bold;">DECLARE</span> randLength <span style="color: #999900; font-weight: bold;">INT</span><span style="color: #FF00FF;">&#40;</span><span style="color: #FF6666;">10</span><span style="color: #FF00FF;">&#41;</span> <span style="color: #990099; font-weight: bold;">DEFAULT</span> <span style="color: #FF6666;">0</span><span style="color: #000033;">;</span><br />
&nbsp; &nbsp; <span style="color: #990099; font-weight: bold;">SET</span> randLength <span style="color: #CC0099;">=</span> <span style="color: #000099;">FLOOR</span><span style="color: #FF00FF;">&#40;</span><span style="color: #FF6666;">1000</span> <span style="color: #CC0099;">*</span> <span style="color: #000099;">rand</span><span style="color: #FF00FF;">&#40;</span><span style="color: #FF00FF;">&#41;</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">;</span><br />
&nbsp; &nbsp; <span style="color: #990099; font-weight: bold;">SET</span> iter<span style="color: #CC0099;">=</span><span style="color: #FF6666;">0</span><span style="color: #000033;">;</span><br />
&nbsp; &nbsp; <span style="color: #990099; font-weight: bold;">SET</span> retVal <span style="color: #CC0099;">=</span> <span style="color: #008000;">''</span><span style="color: #000033;">;</span><br />
&nbsp; &nbsp; <span style="color: #990099; font-weight: bold;">SELECT</span> <span style="color: #000099;">COUNT</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008000;">`id`</span><span style="color: #FF00FF;">&#41;</span> <span style="color: #990099; font-weight: bold;">INTO</span> @cntWL <span style="color: #990099; font-weight: bold;">FROM</span> dict_en<span style="color: #000033;">;</span><br />
&nbsp; &nbsp; <span style="color: #990099; font-weight: bold;">WHILE</span> <span style="color: #FF00FF;">&#40;</span>iter<span style="color: #CC0099;">&lt;</span>randLength<span style="color: #FF00FF;">&#41;</span> <span style="color: #990099; font-weight: bold;">DO</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990099; font-weight: bold;">SET</span> @curId <span style="color: #CC0099;">=</span> <span style="color: #000099;">FLOOR</span><span style="color: #FF00FF;">&#40;</span>@cntWL <span style="color: #CC0099;">*</span> <span style="color: #000099;">RAND</span><span style="color: #FF00FF;">&#40;</span><span style="color: #FF00FF;">&#41;</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990099; font-weight: bold;">SELECT</span> word <span style="color: #990099; font-weight: bold;">INTO</span> @wrd <span style="color: #990099; font-weight: bold;">FROM</span> dict_en <span style="color: #990099; font-weight: bold;">WHERE</span> <span style="color: #008000;">`id`</span><span style="color: #CC0099;">=</span>@curId <span style="color: #990099; font-weight: bold;">LIMIT</span> <span style="color: #FF6666;">1</span><span style="color: #000033;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990099; font-weight: bold;">SET</span> retVal <span style="color: #CC0099;">=</span> <span style="color: #000099;">CONCAT</span><span style="color: #FF00FF;">&#40;</span>retVal<span style="color: #000033;">,</span><span style="color: #008000;">' '</span><span style="color: #000033;">,</span> @wrd<span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990099; font-weight: bold;">SET</span> iter <span style="color: #CC0099;">=</span> iter<span style="color: #CC0099;">+</span><span style="color: #FF6666;">1</span><span style="color: #000033;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">END</span> <span style="color: #990099; font-weight: bold;">WHILE</span><span style="color: #000033;">;</span><br />
&nbsp; &nbsp; RETURN retVal<span style="color: #000033;">;</span><br />
<span style="color: #009900;">END</span></div></td></tr></tbody></table></div>
<p>Now it&#8217;s time to fill the comments table, which is named &#8220;articles&#8221; for simplicity. Next stored routine starts filling that table with content. It accepts a single parameter: number of comments (or articles):</p>
<div class="codecolorer-container mysql mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br /></div></td><td><div class="mysql codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #990099; font-weight: bold;">CREATE</span> <span style="color: #990099; font-weight: bold;">PROCEDURE</span> <span style="color: #008000;">`create<span style="color: #008080; font-weight: bold;">_</span>articles`</span><span style="color: #FF00FF;">&#40;</span><span style="color: #990099; font-weight: bold;">IN</span> <span style="color: #008000;">`<span style="color: #008080; font-weight: bold;">_</span>records`</span> <span style="color: #999900; font-weight: bold;">INT</span><span style="color: #FF00FF;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #990099; font-weight: bold;">LANGUAGE SQL</span><br />
&nbsp; &nbsp; <span style="color: #CC0099; font-weight: bold;">NOT</span> <span style="color: #990099; font-weight: bold;">DETERMINISTIC</span><br />
&nbsp; &nbsp; <span style="color: #990099; font-weight: bold;">COMMENT</span> <span style="color: #008000;">'Fill articles table'</span><br />
<span style="color: #990099; font-weight: bold;">BEGIN</span><br />
&nbsp; &nbsp; <span style="color: #990099; font-weight: bold;">DECLARE</span> contor <span style="color: #999900; font-weight: bold;">INT</span><span style="color: #FF00FF;">&#40;</span><span style="color: #FF6666;">10</span><span style="color: #FF00FF;">&#41;</span> <span style="color: #990099; font-weight: bold;">DEFAULT</span> <span style="color: #FF6666;">0</span><span style="color: #000033;">;</span><br />
&nbsp; &nbsp; <span style="color: #990099; font-weight: bold;">SET</span> contor <span style="color: #CC0099;">=</span> <span style="color: #FF6666;">0</span><span style="color: #000033;">;</span><br />
<span style="color: #808080; font-style: italic;"># &nbsp; &nbsp;TRUNCATE TABLE articles;</span><br />
&nbsp; &nbsp; <span style="color: #990099; font-weight: bold;">WHILE</span> <span style="color: #FF00FF;">&#40;</span>contor<span style="color: #CC0099;">&lt;</span>_records<span style="color: #FF00FF;">&#41;</span> <span style="color: #990099; font-weight: bold;">DO</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990099; font-weight: bold;">INSERT</span> <span style="color: #990099; font-weight: bold;">INTO</span> articles <span style="color: #990099; font-weight: bold;">SET</span> <span style="color: #008000;">`content`</span><span style="color: #CC0099;">=</span>create_content_by_wordlist<span style="color: #FF00FF;">&#40;</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990099; font-weight: bold;">SET</span> contor <span style="color: #CC0099;">=</span> contor<span style="color: #CC0099;">+</span><span style="color: #FF6666;">1</span><span style="color: #000033;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">END</span> <span style="color: #990099; font-weight: bold;">WHILE</span><span style="color: #000033;">;</span><br />
<span style="color: #009900;">END</span></div></td></tr></tbody></table></div>
<p>All prepared now! So, let&#8217;s put those stored routines to work. All you have to do is just create table for dictionary, fill it with data (I&#8217;ve used a text file with 350k english words). Finally, put mysql to hard work: run <code class="codecolorer mysql mac-classic"><span class="mysql">create_articles<span style="color: #FF00FF;">&#40;</span><span style="color: #FF00FF;">&#41;</span></span></code> procedure:</p>
<div class="codecolorer-container mysql mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="mysql codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #990099; font-weight: bold;">CALL</span> create_articles<span style="color: #FF00FF;">&#40;</span><span style="color: #FF6666;">10000</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">;</span></div></td></tr></tbody></table></div>
<p>Be aware, a greater number of articles make articles table bigger. In my situation, for 250k articles randomly generated, the articles table has about 5G in size. It is a good situation for testing large MySQL tables. You could use indexes, partitions or other engines to test different study cases.</p>
]]></content:encoded>
			<wfw:commentRss>http://florin-chis.scream.ro/generate-table-with-random-text-from-dictionary/feed/</wfw:commentRss>
		<slash:comments>43</slash:comments>
		</item>
		<item>
		<title>Test</title>
		<link>http://florin-chis.scream.ro/test/</link>
		<comments>http://florin-chis.scream.ro/test/#comments</comments>
		<pubDate>Sat, 24 Dec 2011 21:21:24 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://florin-chis.scream.ro/?p=65</guid>
		<description><![CDATA[WBVCBXUJM4R6]]></description>
			<content:encoded><![CDATA[<p>WBVCBXUJM4R6</p>
]]></content:encoded>
			<wfw:commentRss>http://florin-chis.scream.ro/test/feed/</wfw:commentRss>
		<slash:comments>36</slash:comments>
		</item>
		<item>
		<title>Repair (or optimize) all tables from a database</title>
		<link>http://florin-chis.scream.ro/repair-or-optimize-all-tables-from-a-database/</link>
		<comments>http://florin-chis.scream.ro/repair-or-optimize-all-tables-from-a-database/#comments</comments>
		<pubDate>Fri, 23 Dec 2011 22:02:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Mysql stored routines]]></category>
		<category><![CDATA[automatic]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[repair]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[tables]]></category>

		<guid isPermaLink="false">http://florin-chis.scream.ro/?p=19</guid>
		<description><![CDATA[This stored routime fetches all tables from database, then executes an operation of REPAIR (you could also use OPTIMIZE command also) for each one. It operates on tables in database in which procedure has been defined. 123456789101112131415161718CREATE PROCEDURE `tools_repair_all_tables`&#40;&#41; &#160; &#160; LANGUAGE SQL &#160; &#160; SQL SECURITY INVOKER BEGIN &#160; &#160; DECLARE endloop INT DEFAULT [...]]]></description>
			<content:encoded><![CDATA[<p>This stored routime fetches all tables from database, then executes an operation of REPAIR (you could also use OPTIMIZE command also) for each one. It operates on tables in database in which procedure has been defined.</p>
<div class="codecolorer-container mysql mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br /></div></td><td><div class="mysql codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #990099; font-weight: bold;">CREATE</span> <span style="color: #990099; font-weight: bold;">PROCEDURE</span> <span style="color: #008000;">`tools<span style="color: #008080; font-weight: bold;">_</span>repair<span style="color: #008080; font-weight: bold;">_</span>all<span style="color: #008080; font-weight: bold;">_</span>tables`</span><span style="color: #FF00FF;">&#40;</span><span style="color: #FF00FF;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #990099; font-weight: bold;">LANGUAGE SQL</span><br />
&nbsp; &nbsp; <span style="color: #990099; font-weight: bold;">SQL SECURITY</span> <span style="color: #990099; font-weight: bold;">INVOKER</span><br />
<span style="color: #990099; font-weight: bold;">BEGIN</span><br />
&nbsp; &nbsp; <span style="color: #990099; font-weight: bold;">DECLARE</span> endloop <span style="color: #999900; font-weight: bold;">INT</span> <span style="color: #990099; font-weight: bold;">DEFAULT</span> <span style="color: #FF6666;">0</span><span style="color: #000033;">;</span><br />
&nbsp; &nbsp; <span style="color: #990099; font-weight: bold;">DECLARE</span> tableName <span style="color: #000099;">char</span><span style="color: #FF00FF;">&#40;</span><span style="color: #FF6666;">100</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">;</span><br />
&nbsp; &nbsp; <span style="color: #990099; font-weight: bold;">DECLARE</span> rCursor CURSOR FOR <span style="color: #990099; font-weight: bold;">SELECT</span> <span style="color: #008000;">`TABLE<span style="color: #008080; font-weight: bold;">_</span>NAME`</span> <span style="color: #990099; font-weight: bold;">FROM</span> <span style="color: #008000;">`information<span style="color: #008080; font-weight: bold;">_</span>schema`</span>.<span style="color: #008000;">`TABLES`</span> <span style="color: #990099; font-weight: bold;">WHERE</span> <span style="color: #008000;">`TABLE<span style="color: #008080; font-weight: bold;">_</span>SCHEMA`</span><span style="color: #CC0099;">=</span><span style="color: #000099;">DATABASE</span><span style="color: #FF00FF;">&#40;</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">;</span><br />
&nbsp; &nbsp; <span style="color: #990099; font-weight: bold;">DECLARE</span> CONTINUE <span style="color: #990099; font-weight: bold;">HANDLER</span> FOR SQLSTATE <span style="color: #008000;">'02000'</span> <span style="color: #990099; font-weight: bold;">SET</span> endloop<span style="color: #CC0099;">=</span><span style="color: #FF6666;">1</span><span style="color: #000033;">;</span><br />
&nbsp; &nbsp; OPEN rCursor<span style="color: #000033;">;</span><br />
&nbsp; &nbsp; FETCH rCursor <span style="color: #990099; font-weight: bold;">INTO</span> tableName<span style="color: #000033;">;</span><br />
&nbsp; &nbsp; <span style="color: #990099; font-weight: bold;">WHILE</span> endloop <span style="color: #CC0099;">=</span> <span style="color: #FF6666;">0</span> <span style="color: #990099; font-weight: bold;">DO</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990099; font-weight: bold;">SET</span> @sql <span style="color: #CC0099;">=</span> <span style="color: #000099;">CONCAT</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008000;">'REPAIR TABLE `'</span><span style="color: #000033;">,</span> tableName<span style="color: #000033;">,</span> <span style="color: #008000;">'` QUICK;'</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; PREPARE statement <span style="color: #990099; font-weight: bold;">FROM</span> @sql<span style="color: #000033;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; EXECUTE statement<span style="color: #000033;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; FETCH rCursor <span style="color: #990099; font-weight: bold;">INTO</span> tableName<span style="color: #000033;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">END</span> <span style="color: #990099; font-weight: bold;">WHILE</span><span style="color: #000033;">;</span><br />
&nbsp; &nbsp; CLOSE rCursor<span style="color: #000033;">;</span><br />
<span style="color: #009900;">END</span></div></td></tr></tbody></table></div>
]]></content:encoded>
			<wfw:commentRss>http://florin-chis.scream.ro/repair-or-optimize-all-tables-from-a-database/feed/</wfw:commentRss>
		<slash:comments>26</slash:comments>
		</item>
		<item>
		<title>Padding a string with a char to complete fixed length width</title>
		<link>http://florin-chis.scream.ro/padding-a-string-with-a-char-to-complete-fixed-length-width/</link>
		<comments>http://florin-chis.scream.ro/padding-a-string-with-a-char-to-complete-fixed-length-width/#comments</comments>
		<pubDate>Thu, 22 Dec 2011 21:10:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Mysql stored routines]]></category>
		<category><![CDATA[char]]></category>
		<category><![CDATA[fixed]]></category>
		<category><![CDATA[length]]></category>
		<category><![CDATA[padding]]></category>

		<guid isPermaLink="false">http://florin-chis.scream.ro/?p=1</guid>
		<description><![CDATA[Sometimes it is useful to add fill a string with a character to fit a specific width. Below is shown a mysql stored routine that accomplishes this. For instance, if you have number &#8220;946&#8243; and you need to fill with zeroes before so it fits 5 chars, then function should return &#8220;00946&#8243;. It&#8217;s parameters are: [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes it is useful to add fill a string with a character to fit a specific width. Below is shown a mysql stored routine that accomplishes this. For instance, if you have number &#8220;946&#8243; and you need to fill with zeroes before so it fits 5 chars, then function should return &#8220;00946&#8243;.<br />
It&#8217;s parameters are:<br />
<code class="codecolorer sql mac-classic"><span class="sql">_val</span></code>: input string<br />
<code class="codecolorer sql mac-classic"><span class="sql">_paddchar</span></code>: char used for padding<br />
<code class="codecolorer sql mac-classic"><span class="sql">_fullLength</span></code>: specify full length of output string.<br />
Here is the listing:</p>
<div class="codecolorer-container sql mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br /></div></td><td><div class="sql codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">FUNCTION</span> <span style="color: #ff0000;">`tools_padd_char`</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`_val`</span> <span style="color: #993333; font-weight: bold;">VARCHAR</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">255</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">`_paddchar`</span> <span style="color: #993333; font-weight: bold;">VARCHAR</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">255</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">`_fullLength`</span> <span style="color: #993333; font-weight: bold;">INT</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">10</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><br />
<span style="color: #993333; font-weight: bold;">RETURNS</span> <span style="color: #993333; font-weight: bold;">VARCHAR</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">255</span><span style="color: #66cc66;">&#41;</span><br />
<span style="color: #993333; font-weight: bold;">LANGUAGE</span> <span style="color: #993333; font-weight: bold;">SQL</span><br />
<span style="color: #993333; font-weight: bold;">SQL</span> SECURITY INVOKER<br />
<span style="color: #993333; font-weight: bold;">BEGIN</span><br />
&nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">DECLARE</span> retVal <span style="color: #993333; font-weight: bold;">VARCHAR</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">255</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #ff0000;">''</span>;<br />
&nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">DECLARE</span> repetitions <span style="color: #993333; font-weight: bold;">INT</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">10</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #cc66cc;">0</span>;<br />
&nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">SET</span> retVal <span style="color: #66cc66;">=</span> _val;<br />
&nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">SET</span> repetitions <span style="color: #66cc66;">=</span> _fullLength <span style="color: #66cc66;">-</span> <span style="color: #993333; font-weight: bold;">LENGTH</span><span style="color: #66cc66;">&#40;</span>_val<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">IF</span> <span style="color: #66cc66;">&#40;</span>repetitions <span style="color: #66cc66;">&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">THEN</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; WHILE <span style="color: #66cc66;">&#40;</span>repetitions <span style="color: #66cc66;">&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span> DO<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">SET</span> retVal <span style="color: #66cc66;">=</span> CONCAT<span style="color: #66cc66;">&#40;</span>_paddchar<span style="color: #66cc66;">,</span> retVal<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">SET</span> repetitions <span style="color: #66cc66;">=</span> repetitions <span style="color: #66cc66;">-</span> <span style="color: #cc66cc;">1</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">END</span> WHILE;<br />
&nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">END</span> <span style="color: #993333; font-weight: bold;">IF</span>;<br />
&nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">RETURN</span> retVal;<br />
<span style="color: #993333; font-weight: bold;">END</span></div></td></tr></tbody></table></div>
]]></content:encoded>
			<wfw:commentRss>http://florin-chis.scream.ro/padding-a-string-with-a-char-to-complete-fixed-length-width/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
	</channel>
</rss>

