<?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>PCR&#039;s notepad &#187; MySQL</title>
	<atom:link href="http://notepad.patheticcockroach.com/category/software/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://notepad.patheticcockroach.com</link>
	<description>The area in patheticcockroach.com where the EEG isn&#039;t isoelectric</description>
	<lastBuildDate>Sun, 05 Feb 2012 12:11:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Enriching Notepad++&#8217;s lang.xml to add better MySQL support</title>
		<link>http://notepad.patheticcockroach.com/2704/enriching-notepads-lang-xml-to-add-better-mysql-support/</link>
		<comments>http://notepad.patheticcockroach.com/2704/enriching-notepads-lang-xml-to-add-better-mysql-support/#comments</comments>
		<pubDate>Sun, 29 Jan 2012 16:17:55 +0000</pubDate>
		<dc:creator>David Dernoncourt</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://notepad.patheticcockroach.com/?p=2704</guid>
		<description><![CDATA[For the moment, Notepad++ is my editor of choice to edit MySQL stuff. Its syntax highlighting works nice, however for some reason it lacks quite a few keywords, such as DATETIME and UNSIGNED. I don&#8217;t know the reason for this, maybe those types are MySQL-specific and not generic SQL types, but anyway I don&#8217;t really [...]]]></description>
			<content:encoded><![CDATA[<p>For the moment, <a href="http://notepad-plus-plus.org/">Notepad++</a> is my editor of choice to edit MySQL stuff. Its syntax highlighting works nice, however for some reason it lacks quite a few keywords, such as DATETIME and UNSIGNED. I don&#8217;t know the reason for this, maybe those types are MySQL-specific and not generic SQL types, but anyway I don&#8217;t really care about generic SQL, I just want a more comprehensive highlighting for the SQL I use &#8211; MySQL.<br />
Fortunately, it&#8217;s very easy to add language elements: you just need to edit langs.xml (+/- langs.model.xml, I&#8217;m not really sure if you need to edit both, but that&#8217;s what I did), find the SQL section (starts with something like <code>&lt;Language name="sql" ext="sql" commentStart="/*" commentEnd="*/"&gt;</code>), and add the tags. Without further ado, here&#8217;s my edited SQL section. Note that for the moment I didn&#8217;t really add many tags (just the *cough* 5 at the very bottom&#8230;), but more <del>will</del> should come as I stumble upon them&#8230;</p>
<p><code>&lt;Language name="sql" ext="sql" commentStart="/*" commentEnd="*/"&gt;<br />
	&lt;Keywords name="instre1"&gt;abs absolute access acos add add_months adddate admin after aggregate all allocate alter and any app_name are array as asc ascii asin assertion at atan atn2 audit authid authorization autonomous_transaction avg before begin benchmark between bfilename bin binary binary_checksum binary_integer bit bit_count bit_and bit_or blob body boolean both breadth bulk by call cascade cascaded case cast catalog ceil ceiling char char_base character charindex chartorowid check checksum checksum_agg chr class clob close cluster coalesce col_length col_name collate collation collect column comment commit completion compress concat concat_ws connect connection constant constraint constraints constructorcreate contains containsable continue conv convert corr corresponding cos cot count count_big covar_pop covar_samp create cross cube cume_dist current current_date current_path current_role current_time current_timestamp current_user currval cursor cycle data datalength databasepropertyex date date_add date_format date_sub dateadd datediff datename datepart day db_id db_name deallocate dec declare decimal decode default deferrable deferred degrees delete dense_rank depth deref desc describe descriptor destroy destructor deterministic diagnostics dictionary disconnect difference distinct do domain double drop dump dynamic each else elsif empth encode encrypt end end-exec equals escape every except exception exclusive exec execute exists exit exp export_set extends external extract false fetch first first_value file float floor file_id file_name filegroup_id filegroup_name filegroupproperty fileproperty for forall foreign format formatmessage found freetexttable from from_days fulltextcatalog fulltextservice function general get get_lock getdate getansinull getutcdate global go goto grant greatest group grouping having heap hex hextoraw host host_id host_name hour ident_incr ident_seed ident_current identified identity if ifnull ignore immediate in increment index index_col indexproperty indicator initcap initial initialize initially inner inout input insert instr instrb int integer interface intersect interval into is is_member is_srvrolemember is_null is_numeric isdate isnull isolation iterate java join key lag language large last last_day last_value lateral lcase lead leading least left len length lengthb less level like limit limited ln lpad local localtime localtimestamp locator lock log log10 long loop lower ltrim make_ref map match max maxextents mid min minus minute mlslabel mod mode modifies modify module month months_between names national natural naturaln nchar nclob new new_time newid next next_day nextval no noaudit nocompress nocopy none not nowait null nullif number number_base numeric nvl nvl2 object object_id object_name object_property ocirowid oct of off offline old on online only opaque open operator operation option or ord order ordinalityorganization others out outer output package pad parameter parameters partial partition path pctfree percent_rank pi pls_integer positive positiven postfix pow power pragma precision prefix preorder prepare preserve primary prior private privileges procedure public radians raise rand range rank ratio_to_export raw rawtohex read reads real record recursive ref references referencing reftohex relative release release_lock rename repeat replace resource restrict result return returns reverse revoke right rollback rollup round routine row row_number rowid rowidtochar rowlabel rownum rows rowtype rpad rtrim savepoint schema scroll scope search second section seddev_samp select separate sequence session session_user set sets share sign sin sinh size smallint some soundex space specific specifictype sql sqlcode sqlerrm sqlexception sqlstate sqlwarning sqrt start state statement static std stddev stdev_pop strcmp structure subdate substr substrb substring substring_index subtype successful sum synonym sys_context sys_guid sysdate system_user table tan tanh temporary terminate than then time timestamp timezone_abbr timezone_minute timezone_hour timezone_region to to_char to_date to_days to_number to_single_byte trailing transaction translate translation treat trigger trim true trunc truncate type ucase uid under union unique unknown unnest update upper usage use user userenv using validate value values var_pop var_samp varchar varchar2 variable variance varying view vsize when whenever where with without while with work write year zone<br />
	mediumint datetime tinyint text unsigned&lt;/Keywords&gt;<br />
&lt;/Language&gt;</code></p>
]]></content:encoded>
			<wfw:commentRss>http://notepad.patheticcockroach.com/2704/enriching-notepads-lang-xml-to-add-better-mysql-support/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL stored procedures: #1172 &#8211; Result consisted of more than one row</title>
		<link>http://notepad.patheticcockroach.com/2460/mysql-stored-procedures-1172-result-consisted-of-more-than-one-row/</link>
		<comments>http://notepad.patheticcockroach.com/2460/mysql-stored-procedures-1172-result-consisted-of-more-than-one-row/#comments</comments>
		<pubDate>Sun, 11 Dec 2011 19:21:12 +0000</pubDate>
		<dc:creator>David Dernoncourt</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://notepad.patheticcockroach.com/?p=2460</guid>
		<description><![CDATA[I&#8217;ve been playing with MySQL&#8217;s stored procedures for a few months now. I like how they let me reduce the traffic between the web server and the database server, and how they help make the PHP code more readable. I&#8217;m not a big fan of OOP (I do use it when it&#8217;s really helpful, though, [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been playing with MySQL&#8217;s stored procedures for a few months now. I like how they let me reduce the traffic between the web server and the database server, and how they help make the PHP code more readable. I&#8217;m not a big fan of OOP (I do use it when it&#8217;s really helpful, though, but I try to limit it) so it&#8217;s always good to have other neat ways to clean the code. However, stored procedures still have a few shortcomings. Notably the fact that unlike some urban myth says, it seems that MySQL doesn&#8217;t precompile its procedures (I don&#8217;t remember where I read that, sorry), for the moment at least (I guess it&#8217;s somewhere in the to-do list for far-far-away future development). But also the fact that you can&#8217;t replace everything with them.</p>
<p>For instance, say you want to use a query like SELECT * FROM some_table WHERE some_filed IN(&#8220;a value&#8221;,&#8221;another value&#8221;,&#8230;,&#8221;and another value&#8221;). Well, unless you know from the beginning how many values you&#8217;ll have in the IN(&#8230;), and create one input variable for each of them (dirty, dirty!), you can&#8217;t feed them to your procedure: it doesn&#8217;t take arrays. I forgot all the things I found, as what I retained for my use is that I&#8217;ll keep building the queries in PHP when such cases arise, but for the bravest here are <a href="http://stackoverflow.com/questions/7194658/sending-a-list-of-values-of-the-same-field-to-mysql-stored-procedure">some dirty hacks</a> you can do to bypass this limitation.</p>
<p>Another problem is that it can&#8217;t deal with queries returning more than one row (except for the case when that query is actually the end of the procedure). So if you want to do something like this:<br />
<code>SELECT id_thread <strong>INTO tmpDiscID</strong> FROM pm_threads WHERE id_member_started=id_auteurIn AND id_thread>minimalDiscID AND date_heure_creation=date_heureIn AND titre=titreIn AND member_count=member_countIN;</code>, you&#8217;d better be damn sure it will return only one row, or add LIMIT 1 (but the latest only works if you know you want the first resulting row). About this, you can check out <a href="http://stackoverflow.com/questions/7194658/sending-a-list-of-values-of-the-same-field-to-mysql-stored-procedure">Stackoverflow &#8211; Sending a list of values of the same field to MySQL stored procedure</a>, <a href="http://stackoverflow.com/questions/8307939/how-to-retreive-multiple-rows-from-stored-procedure-in-mysql">Stackoverflow &#8211; How to retreive multiple rows from stored procedure in mysql?</a> and <a href="http://forums.mysql.com/read.php?98,57399,57457">MySQL forums &#8211; Re: New to sp, ERROR 1172 (42000): Result consisted of more than one row</a>.</p>
<p>Well, that&#8217;s it for this post. Sorry only issues no real solution, apart from: just don&#8217;t make it a point to do everything in stored procedures. Some things just can&#8217;t be done this way, or at least not in an efficient (so, not in a worthy) way.</p>
]]></content:encoded>
			<wfw:commentRss>http://notepad.patheticcockroach.com/2460/mysql-stored-procedures-1172-result-consisted-of-more-than-one-row/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL maintenance &#8211; making and restoring backups</title>
		<link>http://notepad.patheticcockroach.com/199/mysql-maintenance-making-and-restoring-backups/</link>
		<comments>http://notepad.patheticcockroach.com/199/mysql-maintenance-making-and-restoring-backups/#comments</comments>
		<pubDate>Wed, 07 May 2008 21:32:00 +0000</pubDate>
		<dc:creator>David Dernoncourt</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://notepad.patheticcockroach.com/?p=199</guid>
		<description><![CDATA[I use this to back up a MediaWiki and a phpBB database. This is just a generic way to back up and restore databases with MySQL. You may want to compress this too, but we&#8217;ll cover only the very basics here, eg just do a backup and restore it. To make the backup: mysqldump &#8211;user=[the [...]]]></description>
			<content:encoded><![CDATA[<p>I use this to back up a MediaWiki and a phpBB database. This is just a generic way to back up and restore databases with MySQL. You may want to compress this too, but we&#8217;ll cover only the very basics here, eg just do a backup and restore it.</p>
<p>To make the backup:<br />
<blockquote>mysqldump &#8211;user=[the user] &#8211;password=[the password] [database name] > [target path/target file.sql]</p></blockquote>
<p>To restore the backup:<br />
<blockquote>mysql &#8211;verbose &#8211;user=[the user] &#8211;password=[the password] [database name] < [backup path/backup file.sql]</p></blockquote>
<p>NB: &#8211;verbose is <span style="font-weight:bold;">optional and slower</span>, but I like using it <img src='http://notepad.patheticcockroach.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://notepad.patheticcockroach.com/199/mysql-maintenance-making-and-restoring-backups/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

