Taming Vortex
Be careful about meaning of LENGTH in SQL
07:46

One nice fall day my brother when playing with beta of Vortex 1.1 noticed that the code for uploading design objects is broken. I tried it, and everything seemed to be ok. But Pepa complained again. Ok, I make it shorter, after a while I have found that the problem is in different implementation of LENGTH command accross database vendors. Ok, so where was the problem? I was trying to get the size of the design object from the database. So I was using LENGTH function for this. The problem is that Mysql treats LENGTH for BLOB columns as number of bytes, but HSQLDB which was Pepa using as backing database returns number of bytes, but doubled. I don't know if this is bug in HSQLDB, or they are just misinterpreting the meaning, or I do. They write in documentation:

LENGTH(s)
returns the number of characters in s

they also have function

 

 

Comments

Your comment

Protected from spambots!


HTML is allowed
Formatting: Basic formatting can be included like so:
[b]bold[/b] and [i]italic[/i]

About me...
Hello, I'm Martin Novák, and I talk here about Puakma Technology, Java, Eclipse, and Mac OS X.

I work on Puakma Vortex at webWise Network Consultants Pty Ltd based in Sydney in Australia, but I live now in Madrid in Spain.

Contact: Martin Novák

I'm talking about

Recommended reads

Calendar
01020304050607
08091011121314
15161718192021
22232425262728

(c) 2006, Martin Novák, contact me at my email