|
|
ice power Thursday, February 4 2010
Today I continued work on the project of moving a friend's site from a derelict Cold-Fusion-Microsoft-SQL server to a fresh new server (with a view to eventual migration to PHP/MySQL). I kept building tools to help with synchronizing data between a MS SQL database and a MySQL database. Ideally the synchronization would take place behind the scenes and not require any changes to the front end of the application, and some synchronization tasks can definitely be handled this way. The easiest of these is the addition of rows to the destination table when new rows are added to a source table having an autoincrement primary key. The synchronizer just looks at the source table and compares its highest primary key to that of the destination table, and if there is a difference, copy over all the rows with the missing IDs. This runs into trouble when copying over mapping tables, which are usually comprised of nothing more than compound primary keys (for example, a "USERID" matched with a "SALESPERSONID" in a table mapping users to salespeople). To handle this problem, I wrote some code to copy all the data in "related tables" for every table row having a singular primary key. As always, I wrote this code extremely generically. I have code that does similar things in my database visualization system, but it relies on a "relation" table keeping track of the relationships between tables. In the quick and dirty system I was building today, the relationships were stored in one of my double-delimited configuration strings, which act as string-based functional equivalents of database tables. I have my own suite of custom functions for querying such strings.
The friend whose site this was all for came over late this afternoon and we each had a beer and chatted. He's always got a new business idea he wants to float past me, and the state of the economy has him coming up with ideas at an accelerated pace. Hopefully he'll think of something good and when he needs my help, I won't be swamped with work the way I am now.
I just can't spend all my time in front of the computer, you see. I go crazy after awhile and start making stupid errors with difficult-to-diagnose results, and so end up being less productive than if I'd just gone and taken a nap instead. I find it's good at such times to go outside and do something completely different. Today I went into the nearby forest (less than 200 feet from the house) and cut down a number of small dead trees, carried them home, and cut them up into pieces small enough to fit into the stove.
For linking purposes this article's URL is: http://asecular.com/blog.php?100204 feedback previous | next |