[sr-dev] sql column type check

Jasmin Schnatterbeck js at data-cmr.net
Wed Sep 21 09:53:24 CEST 2011


Am Montag, den 19.09.2011, 22:15 +0300 schrieb Juha Heinanen:
> Klaus Darilion writes:
> 
> > we discussed this recently, IMO it would be nice to have to options to
> 
> > > So I thought about a module-specific or server-wide setting to
> > > skip/ignore the column-type check...
> 
> jasmin,
> 
> what do you mean by column-type checks?  i took a quick look at lcr
> module and didn't find any checks on column types.  there are checks
> that values of columns in query results are of correct type, which
> should not cause any trouble.
> 

hello juha,

in lcr_mod.c, line 980-1050 there are the checks I've had problems
with... they seem to depend on the column itself. e.g.:

IF(`fallback`='N',`callrouting_prefixes`.`fakeint1`,`callrouting_prefixes`.`fakeint0`) AS `stopper`,
`callrouting_prefixes`.`fakeint1` AS `enabled`

works (fakeint0, fakeint1 are int columns filled with 0 or 1), but:

IF(`fallback`='N',1,0) AS `stopper`,
1 AS `enabled`

OR

IF(`fallback`='N','1','0') AS `stopper`,
'1' AS `enabled`

OR (with CONVERT(...) function)

does not work ("stopper is NULL or not int"  "lcr rule <%u> enabled is
NULL or not int)

but:
'1' AS `lcr_id`,

works... 

A similar problem with auth_db and the load_credentials parameter - e.g.
a view with a column created through GROUP_CONCAT(....) is not accepted
(error: int or string supported only) - even if CONVERT(...) is being
used.
 
I think VAL_TYPE does not work as expected...

jasmin


> -- juha
> 
> _______________________________________________
> sr-dev mailing list
> sr-dev at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev





More information about the sr-dev mailing list