Wednesday, June 24, 2009

PHP SQLite 3 exec not working

I've spent at least a week wondering why my db->query statements work on my PHP files whereas the db->exec randomly seems to work or ceases working. This is mostly with the PDO opening of SQLite 3 onwards, where it behaves almost read-only.

Turns out, not only do you need to allow write access to the database file itself, but also to the folder containing it. Some google searches also seem to suggest that the full path needs to be given. But trust me - simply enabling write on the directory worked. This seems like a potential security issue, though :(

P.S. - For my facebook friends being forced to read this note - sorry, I'm still trying to figure out how to decouple the RSS I had once linked. :(

Thursday, June 4, 2009

Migrate or roll back an entire svn repository

If you have suddenly been stuck doing a stupid commit to svn and don't know how to just get back, here is a quick hack which I found at

svnadmin create --fs-type fsfs /svnroot/<repo>.fixed
svnadmin dump -r 1:24 /svnroot/<repo> --incremental > dump.svn 
svnadmin load /svnroot/<repo>.fixed < dump.svn
The next step, as you might have guessed, is to move the repo.fixed to . This way, you can also copy a repository as it is to someplace else by just doing the load into some other server somewhere.