Doctrine - difference between bindValue() and setParameter() on prepared statements


Doctrine project logo.

This pissed me off and I couldn't figure out what I was doing wrong. So I'm blogging about my ignorance. Imagine you're using Symfony and Doctrine to access a database. You are using prepared statements to prevent any SQL injection problems. There are two main ways of doing this - and they disagree about how positional variables should be specified. Data Retrieval And Manipulation Here's a fairly trivial SQL statement with a couple of variables: $sql = "SELECT `userID` FROM `users` WHERE…

Continue reading →

Some thoughts on "Hacking the Cis-tem"


Black and white photo of the Queen Mother pressing a button on a 1960's era computer.

I recently read a wonderful paper by Mar Hicks called "Hacking the Cis-tem" which is about database design in the 1960s and the nascent digital state's approach to transgender individuals. It's a short and readable paper with some jaw-dropping anecdotes. Like the man who immediately got a pay rise after his transition, despite working in exactly the same job as before; women were on a lower pay scale... At a basic level you can see why, when computer memory was measured in tens of kilobytes,…

Continue reading →

How do you store numbers with leading zeros?


Binary code displayed on a screen.

I am very interested in your opinion on this. Imagine that you work at a company which sells widgets. Each widget has a unique serial number. The number is a fixed length, and can contain leading zeros. That is, the following are all valid identifiers: 00001 01010 12345 What data type would you use to store these data in a database? This is one of those strong opinions, weakly held. I'm not sure there's a right answer to it. A quick survey on Twitter was inconclusive: Terence Eden is…

Continue reading →

Civic Hygiene


Trans pride flag.

Imagine, just for a moment, that the Government wanted to keep a record of everyone's sexuality. They need to know this detailed demographic data because it will be highly useful in civic planning. It will help them work out what provision needs to be made for sexual health services, how many children are likely to be born, how many schools to build, etc. You trust the Government, you voted for them, you and your friends have nothing to hide with regards to your sexuality. But! Shock…

Continue reading →

Open Source Shakespeare (in MySQL)


My good friend Richard Brent has often complained that my blog has very little Shakespeare content. Despite the domain name, I don't think I've ever blogged about The Big S. For shame! Fear not, my Brentish-Boy, this post is all about Shakespeare. And MySQL.... Ahem... When I first started shkspr.mobi it was intended to be an easy way to get Shakespeare on your phone. At that time, there were no mobile formatted texts of his plays and sonnets, so I had to create them. Finding…

Continue reading →