Allow custom column types in your Rails migrations

posted: April 7th, 2007 · by: Sven

in: Programming · tagged as: , , , , , , ·  6 comments »

We’ll all admit it. Rails’ migrations rock. Totally.

But when you try to change a database column to some vendor specific type (like varbinary for MySQL) that Rails doesn’t implement you notice that Rails doesn’t hand over control that easily here like it does elsewhere in ActiveRecord. You’re just not supposed to use any custom types.

This article explains how to easily change that behaviour.

Read the rest of this entry

Getting MySQL compare Unicode Greek Extended characters correctly

posted: February 8th, 2007 · by: Sven

in: Programming, Globalization · tagged as: , , , , , ·  2 comments »

Lately I ran into an interesting issue with MySQL’s string comparsion that I haven’t seen before.

I’ve been setting up a simple vocabulary and grammar learning program for my spouse who’s started learning ancient greek a while ago. After she’s entered some testdata containing several funny looking ancient greek characters we saw that MySQL 4.1 seems to treat the following characters as equal when compared as VARCHAR:

Char. Unicode
Codepos.
UTF-8 Name
eta U+03B7 206 183 eta
eta with oxia U+1F75 225 189 181 eta w/ oxia
eta with persispomeni and ypogegrammenti U+1FC4 225 191 135 eta w/ persispomeni and ypogegrammenti

These characters are stored and retrieved correctly (which was a nice thing to watch, by the way). But when it comes to compare them to each other they are wrongly regarded the same character.

Read the rest of this entry

Using a self join to select the rows with the maxium values per group

posted: June 1st, 2006 · by: Sven

in: Programming · tagged as: , , , , ·  0 comments »

Phew. This really baffled me. I use SQL for *years* now … but I haven’t been able to come up with a working statement for a query that I’ve thought to be a really trivial thing at first.

Like this:

I have a table articles which can belong to blogs. But blogs are subclasses of an abstract type called location. Thus, each article holds a key to the table locations where there is a column type, which will have the value ‘blog’ for each concrete blog.

Read the rest of this entry

artweb design
Sven Fuchs
Grünberger Str. 65
10245 Berlin, Germany


http://www.artweb-design.de

Fon +49 (30) 47 98 69 96
Fax +49 (30) 47 98 69 97