[OpenSIPS-Users] MySQL Type: FIELD_TYPE_NEWDECIMAL (246) uses DB_INT result type but should use float

Liviu Chircu liviu at opensips.org
Tue Mar 10 15:55:10 EST 2020


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!

git apply <(base64 -d <<EOF
ZGlmZiAtLWdpdCBhL21vZHVsZXMvYXZwb3BzL2F2cG9wc19kYi5jIGIvbW9kdWxlcy9hdnBvcHMv
YXZwb3BzX2RiLmMKaW5kZXggNGZjNzQ3ZmI2Li40Yjk1M2U0ZWQgMTAwNjQ0Ci0tLSBhL21vZHVs
ZXMvYXZwb3BzL2F2cG9wc19kYi5jCisrKyBiL21vZHVsZXMvYXZwb3BzL2F2cG9wc19kYi5jCkBA
IC01NDQsNiArNTQ0LDEyIEBAIGludCBkYl9xdWVyeV9hdnBfcHJpbnRfcmVzdWx0cyhzdHJ1Y3Qg
c2lwX21zZyAqbXNnLCBjb25zdCBkYl9yZXNfdCAqZGJfcmVzLAogCQkJCQlhdnBfdmFsLm4gPQog
CQkJCQkJKGludClSRVNfUk9XUyhkYl9yZXMpW2ldLnZhbHVlc1tqXS52YWwuYmlnaW50X3ZhbDsK
IAkJCQlicmVhazsKKwkJCQljYXNlIERCX0RPVUJMRToKKwkJCQkJYXZwX3R5cGUgfD0gQVZQX1ZB
TF9TVFI7CisJCQkJCWF2cF92YWwucy5zID0gZG91YmxlMnN0cigKKwkJCQkJ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liviu Chircu
www.twitter.com/liviuchircu | www.opensips-solutions.com

OpenSIPS Summit, Amsterdam, May 2020
   www.opensips.org/events
OpenSIPS Bootcamp, Miami, March 2020
   www.opensips.org/training




More information about the Users mailing list