[OpenSIPS-Users] MySQL Type: FIELD_TYPE_NEWDECIMAL (246) uses DB_INT result type but should use float
Brett Nemeroff
brett at nemeroff.com
Tue Mar 10 16:39:14 EST 2020
Liviu,
Thanks for the quick fix! I can’t believe this hasn’t been more of an
issue. But then again, it may be a weird thing to want a double in the
script context since you can’t or at least shouldn’t be doing a lot of high
level stuff there.
Calvin / Liviu,
I haven’t tested this fix yet, but I reviewed it. I just wanted to point
out for the group that this converts a DOUBLE as received form the Database
into a STRING for the script context in an AVP. This isn’t really a problem
unless you are going to math it or push it into something else without
casting it. If you, for example, wanted to pull a rate per minute and push
it to a SIP header, this would work great for that.
-Brett
On Tue, Mar 10, 2020 at 10:57 AM Liviu Chircu <liviu at opensips.org> wrote:
> On 10.03.2020 00:25, Calvin Ellison wrote:
> > I also noticed DB_DOUBLE is missing from /avpops/avpops_db.c but I
> > don't know C well enough to do the needful. Do you know what should be
> > done to make it a string?
> >
> > Here's my updated /db_mysql/res.c. I did as you suggested and
> > moved MYSQL_TYPE_NEWDECIMAL along with its #if condition to just after
> > MYSQL_TYPE_FLOAT so it is DB_DOUBLE not DB_INT. It looks like the same
> > change is needed for MYSQL_TYPE_DECIMAL since this can also be
> > non-integer, but I didn't touch that.
>
> Hello, Calvin/Brett!
>
> You guys are absolutely right, that definitely looks like a bug.
> Calvin, can you
> please apply the below patch on a clean OpenSIPS tree and let me know if it
> fixes your problem? Thanks!
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20200310/0cca08fc/attachment-0001.html>
More information about the Users
mailing list