Shaun Mccran

My digital playground

14
J
A
N
2009

Using LIMIT in mySql Update script

I've recently switched to MySql, as my present employer uses it.

Its taken a bit of getting used to, but I'm coming around to it.

One piece of functionality we have is a 'queue-ing' system. There is an image queue that users have to go through to 'vet' photos. In this instance of work I needed to update a collection of records. It didn't matter which ones, just enough to fill the queue.

view plain print about
1UPDATE tableName
2SET active = 0
3LIMIT 500;

So rather than using a where clause it seems that you can use a mySql LIMIT value, to just return a set number of records.

Simple but effective.

19
D
E
C
2008

Trade marking Emoticons? ;-)

Rather bizarrely it seems that a Russian entrepreneur is trying to trade mark the 'emoticon' and all its guises.

You'd have to be crazy to try it....

Full article here:

19
D
E
C
2008

Adobe brings AIR to Linux

Adobe delivers AIR to Linux platforms!

Adobe finally brings the AIR SDK to a variety of linux platforms. Handy if your home development network is Ubuntu based.

Full article here:

05
D
E
C
2008

MySQL does not support conditional if/else scripts unless its compiled

I've recently changed companies, and as a consequence changed some toolsets. One of these is a switch from MS SQL to MY SQL. Its an interesting learning curve, and I'm trying to stay open minded, but I really did quite like MS SQL....

I have a series of scripts that I have built over the years, they perform standard functions like creating tables, alters creating stored procs etc... (will post soon!). They are all self checking, and output nice processing messages to tell the user whats going on.

So I embarked on a mission to convert these to MY SQL. My first stumbling block was not referencing the master table form MS SQL, as it doesn't exist in MY SQL, but handily there is something similar.

view plain print about
1SELECT count(*)
2FROM information_schema.tables
3WHERE table_schema = DBName
4AND table_name = tableName

The problem then comes with evaluating this result into an IF statement. It turns out that MY SQL cannot process IF-ELSE conditionals unless it is within a compiled script, like a stored proceedure.

Bit of a show stopper there! So now I am trying to find another way to check for the existence of database objects.

_UNKNOWNTRANSLATION_ /