[ic] IC does not see 0.00 is as 0 for DECIMAL(6,2) fields in MySQL
John1
list_subscriber at yahoo.co.uk
Tue Jul 6 17:09:53 EDT 2004
I am using MySQL with interchange and would like to format my sale_price
column as DECIMAL(6,2), rather than the current CHAR(8).
However, I have noticed that if I do this, then [if-sql-param sale_price]
always returns true, even if sale_price is nil.
I am guessing that this is because Interchange stores 0 as "0.00" for
DECIMAL(6.2) and that consequently [if-sql-param] sees 0.00 as a string of 4
characters, rather than a numeric zero.
Is there an efficient way around this problem? I say, "efficient", because
I use this [if-sql-param sale_price] within loops, so the tag may get called
100s of times, so I really don't want to hurt performace at all by adding
extra overhead to the loop. e.g. I have thought of setting a scratch
variable inside the loop as follows:
[tmp][calc][scratch sale_price][sql-param]+0[/calc][/tmp] or using
[if-sql-param sale_price > 0] but I feel this may be a lot slower than just
plain [if-sql-param]
Any suggestions would be appreciated. Thanks.
More information about the interchange-users
mailing list