January 29, 2005

Movable Type + PostgreSQL

I've been searching for a reason Movable Type didn't seem to want to play nice with PostgreSQL. (I prefer PostgreSQL to MySQL for databases where things are going to be changing somewhat often. Some will argue PostgreSQL is a real database while MySQL is a flat file.) Found an entry that describes exactly what is happening.

Here's a breakdown of what was changed:

sub data {
    my $data = shift;

    # Convert the data to hexadecimal.
    $data->column('data', unpack("H*", freeze(shift))) if @_;

    # Try to get the data.
    my $r;
    eval { $r = thaw($data->column('data')); };

    # Decode the hexadecimal if thaw failed.
    $r = thaw(pack("H*", $data->column('data'))) if ($@);
    $r;
}

Posted by josuah at January 29, 2005 9:19 PM UTC+00:00

Trackback Pings

TrackBack URL for this entry:
http://www.wesman.net/cgi-bin/mt/mt-tb.cgi/108

Comments

Post a comment

July 2013
Sun Mon Tue Wed Thu Fri Sat
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      

Search