Number Crunching : Database vs OOP

For the last few months I've been working on a project that is part website and part data processing.

In theory the website is the bulk of the project, but in practice processing the data has taken a disproportionate amount of resources.

Data exchange with another organisation is always tricky - and in this case we have incoming data that doesn't conform to specification, business rules that change, and a daily data import to run.

The code I've been working on has been through a couple of versions, and now I have in mind a third

Read more

Drupal multisite with shared tables

Drupal allows you to create multiple sites sharing some or all of the same code and optionally sharing some database tables.

The documentation for the Drupal settings file
http://api.drupal.org/api/file/sites/default/settings.php/5/source

includes the following

<?php
/*
* To have all database names prefixed, set $db_prefix as a string:
*
* $db_prefix = 'main_';
*
* To provide prefixes for specific tables, set $db_prefix as an array.
* The array's keys are the table names and the values are the prefixes.

Read more

SQL for Smarties

cover of SQL for Smarties Joe Celko's SQL for Smarties: Advanced SQL Programming (The Morgan Kaufmann Series in Data Management Systems)
Joe Celko
* *
£31.34

buy from amazon

 

I was really looking forward to reading this book, it had been on my wish list for years....

But it's hard to know how to tackle it.

This is a heavyweight book and it's mostly organised by SQL keyword with some chapters on subjects like temporal queries and statistics.

It seems to me that the best way to read this book is cover to cover - but for me it's just to big to do that.

The book also suffers from being too oriented towards 'pure' SQL, spending pages on features that aren't yet available.

Read more

Adding comments to the database

Comments in code are widely used and generally (but not universally) accepted as a good thing.

Databases can also accommodate comments - but these seem to be very rarely used.

I'm of the opinion that database comments are very useful.

It's often hard to determine the exact meaning of a column - maybe it would be ideal to rename the column but you don't want to risk breaking code.

Read more