<?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>Data Access Notes &#187; MySQL</title>
	<atom:link href="http://www.accessdataservices.com/blog/category/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.accessdataservices.com/blog</link>
	<description>Miscellaneous Computer Technology Notes</description>
	<lastBuildDate>Tue, 27 Jul 2010 01:37:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>joomla iframes how</title>
		<link>http://www.accessdataservices.com/blog/joomla-iframes-how/</link>
		<comments>http://www.accessdataservices.com/blog/joomla-iframes-how/#comments</comments>
		<pubDate>Mon, 02 Jun 2008 02:17:41 +0000</pubDate>
		<dc:creator>gare</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[WebTechnology]]></category>

		<guid isPermaLink="false">http://www.accessdataservices.com/blog/joomla-iframes-how/</guid>
		<description><![CDATA[To use iframes in joomla 1.5, check out the wrapper module (which may not be enabled on your install, depending..). It allows iframe to be displayed. Select Position: User2 to show the wrapper iframe in the content area of rhuk_milkyway. Extensions > Modules > Wrapper HTH!]]></description>
			<content:encoded><![CDATA[<p>To use iframes in joomla 1.5, check out the wrapper module (which may not be enabled on your install, depending..).   It allows iframe to be displayed.   Select Position: User2 to show the wrapper iframe in the content area of  rhuk_milkyway.</p>
<p>Extensions > Modules > Wrapper </p>
<p>HTH! </p>
<div style="float:left;margin:0px 0px 0px 0px;"><a title="Post on Google Buzz" class="google-buzz-button" href="http://www.google.com/buzz/post" data-button-style="small-count" data-url="http://www.accessdataservices.com/blog/joomla-iframes-how/"></a><script type="text/javascript" src="http://www.google.com/buzz/api/button.js"></script></div>]]></content:encoded>
			<wfw:commentRss>http://www.accessdataservices.com/blog/joomla-iframes-how/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Migrating from PHP4 to PHP5</title>
		<link>http://www.accessdataservices.com/blog/migrating-from-php4-to-php5/</link>
		<comments>http://www.accessdataservices.com/blog/migrating-from-php4-to-php5/#comments</comments>
		<pubDate>Wed, 30 Jan 2008 14:42:47 +0000</pubDate>
		<dc:creator>gare</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[WebTechnology]]></category>

		<guid isPermaLink="false">http://www.accessdataservices.com/blog/migrating-from-php4-to-php5/</guid>
		<description><![CDATA[PHP 5 Gotchas &#8211; Some Common Error Messages Call-time pass-by-reference has been deprecated calling a variable by reference during the function call instead of in the function definition: $conn =&#038;getConnection(); OCIBindByName($stmt,"EMPLID",&#038;$eeid, strlen($eeid) ) script declaration required (may be php.ini or apache setting) variable declaration initialize variables // set variables to null or blank Some Other [...]]]></description>
			<content:encoded><![CDATA[<h3>PHP 5 Gotchas &#8211; Some Common Error Messages</h3>
<p>Call-time pass-by-reference has been deprecated<br />
calling a variable by reference during the function call instead of in the function definition:</p>
<p><code>$conn =&#038;getConnection();<br />
OCIBindByName($stmt,"EMPLID",&#038;$eeid, strlen($eeid) )<br />
</code></p>
<p>script declaration required (may be php.ini  or apache setting)</p>
<p>variable declaration<br />
initialize variables //  set variables to null or blank</p>
<h3>Some Other Gotchas</h3>
<p>MYSQL separated from base PHP5<br />
have to compile MySQL support into PHP now just like other db&#8217;s</p>
<h3>Guides and Documentation</h3>
<p>PHP.NET &#8211; Migrating from PHP 4 to PHP 5</p>
<p>http://us3.php.net/migration5/</p>
<p>Chapter 60. Migrating from PHP 4 to PHP 5</p>
<p>http://www.phpbuilder.com/manual/en/faq.migration5.php</p>
<p>A PHP V5 migration guide</p>
<p>http://www.ibm.com/developerworks/library/os-php-v5migr/index.html</p>
<div style="float:left;margin:0px 0px 0px 0px;"><a title="Post on Google Buzz" class="google-buzz-button" href="http://www.google.com/buzz/post" data-button-style="small-count" data-url="http://www.accessdataservices.com/blog/migrating-from-php4-to-php5/"></a><script type="text/javascript" src="http://www.google.com/buzz/api/button.js"></script></div>]]></content:encoded>
			<wfw:commentRss>http://www.accessdataservices.com/blog/migrating-from-php4-to-php5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Open source software is an idea whose time has finally come.</title>
		<link>http://www.accessdataservices.com/blog/open-source-software-is-an-idea-whose-time-has-finally-come/</link>
		<comments>http://www.accessdataservices.com/blog/open-source-software-is-an-idea-whose-time-has-finally-come/#comments</comments>
		<pubDate>Sun, 21 Oct 2007 19:14:38 +0000</pubDate>
		<dc:creator>Gare</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Other Tech]]></category>

		<guid isPermaLink="false">http://www.accessdataservices.com/blog/open-source-software-is-an-idea-whose-time-has-finally-come/</guid>
		<description><![CDATA[Open source software is an idea whose time has finally come. For twenty years it has been building momentum in the technical cultures that built the Internet and the World Wide Web. Now it's breaking out into the commercial world, and that's changing all the rules. Are you ready? www.opensource.org and of course many others [...]]]></description>
			<content:encoded><![CDATA[<p><code> Open source software is an idea whose time has finally come. For twenty years it has been building momentum in the technical cultures that built the Internet and the World Wide Web. Now it's breaking out into the commercial world, and that's changing all the rules. Are you ready?</code></p>
<p></p>
<p><a href="http://www.opensource.org">www.opensource.org</a></p>
<p> and of course many others &#8230;.</p>
<div style="float:left;margin:0px 0px 0px 0px;"><a title="Post on Google Buzz" class="google-buzz-button" href="http://www.google.com/buzz/post" data-button-style="small-count" data-url="http://www.accessdataservices.com/blog/open-source-software-is-an-idea-whose-time-has-finally-come/"></a><script type="text/javascript" src="http://www.google.com/buzz/api/button.js"></script></div>]]></content:encoded>
			<wfw:commentRss>http://www.accessdataservices.com/blog/open-source-software-is-an-idea-whose-time-has-finally-come/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Working with Fixed Length Outfiles using MySQL and PHP</title>
		<link>http://www.accessdataservices.com/blog/how-to-create-fixed-length-outfiles-in-mysql/</link>
		<comments>http://www.accessdataservices.com/blog/how-to-create-fixed-length-outfiles-in-mysql/#comments</comments>
		<pubDate>Mon, 21 Aug 2006 14:50:47 +0000</pubDate>
		<dc:creator>Gare</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Other Tech]]></category>
		<category><![CDATA[WebTechnology]]></category>

		<guid isPermaLink="false">http://www.accessdataservices.com/blog/how-to-create-fixed-length-outfiles-in-mysql/</guid>
		<description><![CDATA[Creating ASCII Fixed Length Outfiles using MySQL Step 1. Create a FileSpecification Mysql table. Step 2. Export your MySQL data using the FileSpecification Table as a map Details: Step 1. Create a FileSpecification Mysql table. Create a File Specification Table: CREATE TABLE `filespecification` ( `id` int(11) NOT NULL auto_increment, `speccode` varchar(50) NOT NULL default '', [...]]]></description>
			<content:encoded><![CDATA[<h2>Creating ASCII Fixed Length Outfiles using MySQL</h2>
<ol>
<li>Step 1. Create a FileSpecification Mysql table. </li>
<li>Step 2. Export your MySQL data using the FileSpecification Table as a map</li>
</ol>
<p>Details:</p>
<h3>Step 1. Create a FileSpecification Mysql table. </h3>
<p>Create a File Specification Table:</p>
<p><code>CREATE TABLE `filespecification` (<br />
  `id` int(11) NOT NULL auto_increment,<br />
  `speccode` varchar(50) NOT NULL default '',<br />
  `fieldname` varchar(100) NOT NULL default '',<br />
  `startpos` varchar(10) NOT NULL default '',<br />
  `endpos` varchar(10) NOT NULL default '',<br />
  `length` varchar(10) NOT NULL default '',<br />
  PRIMARY KEY  (`id`)<br />
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=85 ;</p>
<p></code>Manually populate it using PHPMYAdmin or your favorite gui MySQL client.</p>
<h3>Step 2. Export your MySQL data using the FileSpecification Table as a map</h3>
<p>** Details forthcoming ***</p>
<h2>Load a FLat File Into an Array</h2>
<p>** Details forthcoming ***<br />
check out unpack() function in php</p>
<h3>Other Notes</h3>
<p>Though CHAR() (as opposed to VARCHAR()) data is stored fixed-length, it is retrieved from the database without the padding. So data type definitions themselves do not seem to help.</p>
<p>And metadata definitions of tables are not easily retrievable until MySQL 5.x, which have information schema&#8217;s.</p>
<p>From the forum below, the winning answer seems to be the RPAD() function. Use it when retrieving data from database in the SQL query thus:</p>
<p><span class="syntax"><span class="syntax_alpha syntax_alpha_reservedWord">SELECT</span> <span class="syntax_alpha syntax_alpha_functionName">rpad</span><span class="syntax_punct syntax_punct_bracket_open_round">(</span> <span class="syntax_alpha syntax_alpha_identifier">test</span><span class="syntax_punct syntax_punct_listsep">,</span> <span class="syntax_digit syntax_digit_integer">10</span><span class="syntax_punct syntax_punct_listsep">,</span>  <span class="syntax_quote syntax_quote_single">&#8216; &#8216;</span>  <span class="syntax_punct syntax_punct_bracket_close_round">)</span><br />
<span class="syntax_alpha syntax_alpha_reservedWord">FROM</span>  <span class="syntax_quote syntax_quote_backtick">`test`</span><br />
<span class="syntax_alpha syntax_alpha_reservedWord">WHERE</span> <span class="syntax_digit syntax_digit_integer">1</span></span></p>
<p>Full solution forthcoming&#8230;<br />
mysql_query(&#8220;SELECT RPAD( FName, 11 ,&#8217; &#8216; ) , RPAD( LName, 18 ,&#8217; &#8216; ) &#8220;) ; //etc<br />
<span id="more-33"></span></p>
<blockquote><h4>some discussion on topic  </h4>
<p>source: http://www.codingforums.com/archive/index.php?t-32333.html</p>
<div class="post">
<div class="posttop">
<div class="username">ecroskey</div>
<div class="date">01-28-2004, 09:12 PM</div>
</div>
<div class="posttext">can anyone help me with creating <span class="hilite2">fixed</span>-<span class="hilite3">length</span> files using php? I have been looking everywhere to find some example and can&#8217;t. I have to <span class="hilite1">create</span> order files that are readable by our VAX and need to put all the order info into flf&#8217;s.Any ideas or examples for creating?Regards,<br />
Eric</div>
</div>
<hr />
<div class="post">
<div class="posttop">
<div class="username">SDP2006</div>
<div class="date">01-28-2004, 09:40 PM</div>
</div>
<div class="posttext">Do you mean like a random <span class="hilite4">file</span> name/value and have the name/value a certain lenght?</div>
</div>
<hr />
<div class="post">
<div class="posttop">
<div class="username">ecroskey</div>
<div class="date">01-29-2004, 02:28 PM</div>
</div>
<div class="posttext">It&#8217;s going to be a <span class="hilite2">fixed</span> number of bits (characters) per field pulled from the database.Say the records are as follows:FName<br />
LName<br />
EMail<br />
Address1and so on&#8230;My <span class="hilite4">file</span> has to be setup like:</p>
<p>FName(up to 11 bits-characters)LName(up to 18 bits-characters) and so on&#8230;</p>
<p>The <span class="hilite4">file</span> will be the first eleven characters-bits will contain the first name and however many blank spaces up to eleven, followed by the last name field containing the characters-bits and blank spaces up to another 18 spaces and so on throughout the order.</p>
<p>I can easily pull the info I need because I am already doing it, what is stumping me it limiting the fields to a certain <span class="hilite3">length</span> and the making sure the appropriate number of blank spaces are added (appended) to the end of each field to fill up the remaining bit <span class="hilite3">length</span> before the next field should start.</p>
<p>I hope I am making myself clear, but I am not sure I am.</p>
<p>Regards,<br />
Eric</p></div>
</div>
<hr />
<div class="post">
<div class="posttop">
<div class="username">raf</div>
<div class="date">01-29-2004, 03:30 PM</div>
</div>
<div class="posttext">You mean to <span class="hilite1">create</span> a textfile with <span class="hilite2">fixed</span> width columns (where each startingposition of a value is <span class="hilite2">fixed</span>).What DB are you using? Most db&#8217;s have an exportfunction for <span class="hilite2">fixed</span> width or delimited files.If you want to do this in PHP then you will need to check the values <span class="hilite3">length</span> and fill the rest of the column up till one position before the start of the next value.<br />
so it would be something like$endpost=array(&#8220;20&#8243;,&#8221;40&#8243;,&#8221;50&#8243;,&#8221;70&#8243;); //an array with each last position of the values<br />
while ($row=mysql_fetch_rows($result)){<br />
for($i=0; $i<=mysql_num_fields($result;$i++){<br />
$<span class="hilite4">file</span> .= $row[{i}] . str_repeat(&#8221; &#8220;, $endpos[{i}]-strlen($row[{$i}])<br />
}<br />
$<span class="hilite4">file</span> .= &#8216;xxxx&#8217; // xxxx needs to be replaced with your end of line seperator<br />
}You see, it&#8217;s rather simple. You just need to fill in the array (one position for each field !!) and end of line symbol, and then everything should run automatically.</p>
<p>Can&#8217;t your VAX (whatever that is) take in delimited files?</p></div>
</div>
<hr />
<div class="post">
<div class="posttop">
<div class="username">firepages</div>
<div class="date">01-29-2004, 11:59 PM</div>
</div>
<div class="posttext">Your database can ( &#038;should where possible ) do most of the work for you , e.g. in <span class="hilite5">MySQL</span> you could &#8230;mysql_query(&#8220;SELECT RPAD( FName, 11 ,&#8217; &#8216; ) , RPAD( LName, 18 ,&#8217; &#8216; ) &#8220;) ; //etcwhich would give you <span class="hilite2">fixed</span> <span class="hilite3">length</span>, space padded results , note if the returned data is bigger than the chars allotted it will be shortened to suit.If you need to do further munging of the data before you save it then you can use PHP as raf shows above.</div>
</div>
<p>Note: Data type used was CHAR. Other data types include:      * CHAR(M) : Fixed length string. Always stores M characters whether it is holding 2 or 20 characters. Where M can range 1 to 255 characters.     * VARCHAR(M) : Variable length. Stores only the string. If M is defined to be 200 but the string is 20 characters long, only 20 characters are stored. Slower than CHAR.     * INT : Ranging from -2147483648 to 2147483647 or unsigned 0 to 4294967295     * FLOAT(M,N) : FLOAT(4,2) &#8211; Four digits total of which 2 are after the decimal. i.e. 12.34 Values are rounded to fit format if they are too large.     * DATE, TEXT, BLOB, SET, ENUM</p></blockquote>
<div style="float:left;margin:0px 0px 0px 0px;"><a title="Post on Google Buzz" class="google-buzz-button" href="http://www.google.com/buzz/post" data-button-style="small-count" data-url="http://www.accessdataservices.com/blog/how-to-create-fixed-length-outfiles-in-mysql/"></a><script type="text/javascript" src="http://www.google.com/buzz/api/button.js"></script></div>]]></content:encoded>
			<wfw:commentRss>http://www.accessdataservices.com/blog/how-to-create-fixed-length-outfiles-in-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A.4.2 How to Reset Root Password in MySQL</title>
		<link>http://www.accessdataservices.com/blog/a42-how-to-reset-root-password-in-mysql/</link>
		<comments>http://www.accessdataservices.com/blog/a42-how-to-reset-root-password-in-mysql/#comments</comments>
		<pubDate>Sat, 22 Jul 2006 10:03:22 +0000</pubDate>
		<dc:creator>Gare</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[WebTechnology]]></category>

		<guid isPermaLink="false">http://www.accessdataservices.com/blog/a42-how-to-reset-root-password-in-mysql/</guid>
		<description><![CDATA[If you have forgotten the root user password for MySQL, you can restore it with the following procedure: 1. Take down the mysqld server &#8211; kill `cat /mysql-data-directory/hostname.pid` 2. Restart mysld with the &#8211;skip-grant-tables option. 3. Connect to the mysqld server mysql -h hostname mysql 4. FLUSH PRIVILEGES to enable grant tables 5. Change the [...]]]></description>
			<content:encoded><![CDATA[<p>If you have forgotten the root user password for MySQL, you can restore it with the following procedure:</p>
<p>1. Take down the mysqld server  &#8211; kill `cat /mysql-data-directory/hostname.pid`</p>
<p>2. Restart mysld with the &#8211;skip-grant-tables option.</p>
<p>3. Connect to the mysqld server mysql -h hostname mysql</p>
<p>4. FLUSH PRIVILEGES to enable grant tables</p>
<p>5. Change the root password.</p>
<p>Details/Notes of Steps</p>
<p>1. Take down the mysqld server  -</p>
<p>Do not kill -9 The server&#8217;s process file runs in .pid format, and is usually in the MySQL database directory, so:kill `cat /mysql-data-directory/hostname.pid`<br />
This procedure requires root access to your Unix server.<br />
2. Restart mysld with the &#8211;skip-grant-tables option.</p>
<p>3. Connect to the mysqld server with</p>
<p>mysql -h hostname mysql</p>
<p>and change the password with a GRANT command.<br />
4. FLUSH PRIVILEGES to enable grant tables</p>
<p>5. Change the root password.</p>
<p>source: paraphrased from p. 723 of MySQL Reference Manual, printed in 2002 for MySQL v. 4</p>
<p><strong>Key notes</strong></p>
<p>The book/docs mention at the bottom of instructions that you will get an error until you execute FLUSH PRIVILEGES. But they did not include this as a step <em>Before</em> using the GRANT command.<br />
<em>Important:</em> Use the cli mysql client to do this.  I tried to use phpmyadmin and it kicked me out after flush privileges and prompted for login &#8211; a reasonable security feature of phpmyadmin.   But what you want to do is to be able to get access to your mysql server, then enable privileges, then change privileges so you can get in later.<br />
Hope these instructions save someone else the headache.</p>
<div style="float:left;margin:0px 0px 0px 0px;"><a title="Post on Google Buzz" class="google-buzz-button" href="http://www.google.com/buzz/post" data-button-style="small-count" data-url="http://www.accessdataservices.com/blog/a42-how-to-reset-root-password-in-mysql/"></a><script type="text/javascript" src="http://www.google.com/buzz/api/button.js"></script></div>]]></content:encoded>
			<wfw:commentRss>http://www.accessdataservices.com/blog/a42-how-to-reset-root-password-in-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
