Hi!
When I load AVPs during authentication - what type is the content of the AVP? string? integer? Is it automatically derived from the column type (like avp_db_query)?
My problem is: I want to load an integer value and compare it against an integer:
modparam("auth_db", "load_credentials", "s:maxcalls=maxcalls") ... if(avp_check("$avp(i:40)", "ge/$avp(s:maxcalls)/g") {
Does this work? What happens if I compare an integer with a string - will there be a conversion?
thanks klaus
Hi Klaus,
Klaus Darilion wrote:
Hi!
When I load AVPs during authentication - what type is the content of the AVP? string? integer? Is it automatically derived from the column type (like avp_db_query)?
yes. recognized types are DB_STR , DB_STRING and DB_INT.
My problem is: I want to load an integer value and compare it against an integer:
modparam("auth_db", "load_credentials", "s:maxcalls=maxcalls") ... if(avp_check("$avp(i:40)", "ge/$avp(s:maxcalls)/g") {
Does this work? What happens if I compare an integer with a string - will there be a conversion?
no conversion - it will return false with error.
regards, bogdan
thanks klaus
Bogdan-Andrei Iancu wrote:
Hi Klaus,
Klaus Darilion wrote:
Hi!
When I load AVPs during authentication - what type is the content of the AVP? string? integer? Is it automatically derived from the column type (like avp_db_query)?
yes. recognized types are DB_STR , DB_STRING and DB_INT.
I have the query: SELECT count(*) FROM ....
does someone knows the return value type of count?
My problem is: I want to load an integer value and compare it against an integer:
modparam("auth_db", "load_credentials", "s:maxcalls=maxcalls") ... if(avp_check("$avp(i:40)", "ge/$avp(s:maxcalls)/g") {
Does this work? What happens if I compare an integer with a string - will there be a conversion?
no conversion - it will return false with error.
can I manually convert a int AVP into a string AVP in 1.1?
regards klaus
regards, bogdan
thanks klaus
Hi Klaus,
Klaus Darilion wrote:
I have the query: SELECT count(*) FROM ....
does someone knows the return value type of count?
I guess it will be INT.
can I manually convert a int AVP into a string AVP in 1.1?
see avp_copy() - it has some flags for str<->int conversion
regards, bogdan