There was a brilliant idea thrown at me the other day by my oh so wonderful parents to create a webpage for the videoshop (or should I say dvdshop? The only films in here are old ex-rental ones being sold off at £1 each, or 2 for £5 on the more recent stuff, though I use the word 'recent' loosely). Not just a webpage, but an online catalogue of the videos to go with it. With over 4300 dvds on the computer system it's obvious that no one in their right mind would want to add them all manually, not to mention the fact that it's quite a wasted effort adding new films twice to have them on both Video Vision (the software used here) and the website, so I was given the task of finding out how to export the data from the software.
According to my mum it would be really easy, not at all hard work to do, just slap a blue page together with a "Flickers" logo at the top and low and behold we'll magically have a fully functional webpage from which a button can be pushed to have the new films grabbed from VV (yes, I'm a lazy typer) and shoved onto the online catalogue (as she often thinks of tasks such as these.) Dad, however, being as technologically minded as he is, realised that we need a professional looking site with a well designed catalogue layout for people to be able to use it easilly, not to mention realising that there's a big possibility of not being able to extract the data from VV.
I've checked VV over and it runs on an MSAccess database, which can be exported using the backup tool. A single file full of films, customers, reservations, everything there is. I opened a recent back up up (up up up... yes, I'm mature, honest) and it seems reasonably well organised... but it's Microsoft Fucking Access. A quick search on the net and, due to practicaly no linux user ever touching Access with hundred foot bargepole while wearing anti-rad suits with a full decontamination crew standing by, the general concesus is: you can't read MDB's in PHP on Linux. However, I did find
a website of a guy who was in a similar situation, he had an Access database which he wanted to upload to his linux webserver and have PHP extract data from it and into a MySql database. It's a good explaination on what to do, the only issue is you have to install three packages onto the server, which I'm fairly sure I can't do on the hosting package which will be used. That, ofcourse, does not matter due to limitations in the tools used to read the MDB file: you can't read tables which have underscores in field names. Oh joy, guess what's in the a handful of the field names of the table required? Fucking underscores.
*sigh* Why can't things be easy? Ofcourse, Access can export the data to generically readable format (e.g. flat file text format), though this comes with a few more issues. First off, it requires a little more interaction on Gary's part, rather than just exporting the database from VV and uploading it using a backend system on the website, he'd have to export it from VV, open it in MS Access, export it while making sure the field deliminations, text qualifiers and so on are all in the correct format to avoid unexpect errors and then upload it using the back end system on the site. That takes about ten times the amount of time, which, to be fair isn't much but leaves chance for errors in the exporting. Second of all it means having the site's scripts recurse through over 4300 entries (and increasing) of 34 columns of a text file just to import two to six new films. Can you say "wasteful"? Not only would it have to run through every film but it would have to check each film in the text file against entries in the MySql database to try and find out if film's already there and if it needs updating. 4300+ MySql queries. Can you say "kill the server"?
Ofcourse, there's a number of other ways I could do this, such as having the script grab everything from the database in one query and use arrays and such to find out if they're already there and so on, but that's an aweful lot of work. So, in the end, what it would come down to would be a single lump of inserts to start off with and then Gary having to update the site 'manually' along side VV. Hardly that much more work for him.
Yes, I'm bored, I've had next to no customers (1 film rented, 2 pieces of photocopying and about a dozen people come in, look at the new relases and say "Oh no, it's out! It's already gone out today! It won't be in until tomorrow! I won't even ask the person at the counter when it's back or see if there's anything else, I'll just bugger off and come in tomorrow!" and bugger off.) and so I'm ranting on LJ about this shit. Hmmm... I guess this entry should really be in AlexDev. Then again, I guess I should really set up blog software on alsdesigns. Then again, I should really write my own blog software for alsdesigns. Meh, maybe at somepoint.