This afternoon I posted my PHP database library on Google code. It’s designed to be very lightweight, and uses the PHP4 MySQL functions as well as the PostgreSQL functions, but is built for PHP5. It uses sprintf formatting, and works must like the Python database cursor’s, to help alleviate injection concerns while you are writing […]
One of the developers at Curse was setting up a new database server today, and was trying to set all the defaults to UTF-8 for table creation/etc. While I knew about setting those, I always knew you still had to send the set names argument on your connection initialization. Well, it turns out, you don’t:
collation_server=utf8_unicode_ci
character_set_server=utf8
default-character-set=utf8
init-connect=’SET […]
We ran across a fun gotcha today while performance testing some code. The issue was originally discovered when we noticed a 300ms query taking 20 seconds. After about an hour of debugging we found the issue to be with aliases in table locks.
Here’s what our original SQL looked like:
LOCK TABLES files_versiondownloadcount WRITE;
UPDATE files_version AS version, […]
As many people probably have, I ran across the problem of installing MySQLdb (Python) on Leopard today.
The error:
In file included from /usr/local/mysql/include/mysql.h:43,
from _mysql.c:40:
/usr/include/sys/types.h:92: error: duplicate ‘unsigned’
/usr/include/sys/types.h:92: error: two or more data types
in declaration specifiers
error: Setup script exited with error: command ‘gcc’ failed
with exit status 1
Luckily, there are people out there who know a lot more […]