[Users] AVPOPS: question about avp_db_query

Klaus Darilion klaus.mailinglists at pernau.at
Fri Mar 16 13:45:03 CET 2007


Klaus Darilion wrote:
> Daniel-Constantin Mierla wrote:
>> Hello,
>>
>> On 03/06/07 09:59, Papadopoulos Georgios wrote:
>>> Hello,
>>>  
>>> Is there a way to load an integer value into an integer avp using 
>>> avp_db_query? For example if in table usr_preferences I have 
>>> value='15' and type=1, then using avp_db_load I get an avp with an 
>>> int value of 15. Then I can use this int avp to check whether it is 
>>> greater or less than some value. I am trying to do the same thing 
>>> with avp_db_query but the avp that I get is a string.
>> that's because in usr_preferences the values are stored in a string 
>> column. If you make another table and store the value in an integer 
>> column, then it will be stored as integer in AVP.
>>
>> avp_db_query() takes the type of value from type of column.
> 
> Also with 1.1? I just tried avp_db_query() and load an integer column 
> type from mysql into an AVP, but the AVP is always defined as string.

Uups - I have to correct myself. If I explecitely load an int column it 
works, but it does not work if I load a count() or sum() value - these 
are always string AVPs. Even when I try CAST(count(*) AS SIGNED INTEGER) 
it does not work.  :-(

Any hints?



thanks
klaus


-- 
Klaus Darilion
nic.at





More information about the Users mailing list