[ic] Tag->data for mulitple keys

Barry Treahy, Jr. interchange-users@icdevgroup.org
Wed Aug 28 11:59:00 2002


mike@perusion.com wrote:

>Quoting Barry Treahy, Jr. (Treahy@MMaz.com):
>  
>
>>Barry Treahy, Jr. wrote:
>>
>>    
>>
>>>Kevin Walsh wrote:
>>>
>>>      
>>>
>>>>>Is there a method to use Tag->data for finding a row based on 
>>>>>multiple keys with the GDBM database?  I've seen nice solutions for 
>>>>>SQL...  If not the tag, any other suggestions?
>>>>>
>>>>>  
>>>>>          
>>>>>
>>>>I suggest the [query] tag with SQL.  The SQL::Statement module will
>>>>handle queries such as "SELECT foo FROM bar WHERE a = 1 AND b = 2"
>>>>against GDBM tables.
>>>>
>>>>Do yourself a favour and move your GDBM data into MySQL or PostgreSQL.
>>>> 
>>>>
>>>>        
>>>>
>>>Advise well appreciated and heeded next time...
>>>
>>>Ok, here is the code snippet:
>>>
>>> my $sql = "select discount from tiers where tier ='" . $tier ."' and 
>>>quantity<=" . $quantity ." order by quantity desc"; 
>>>      
>>>
>>Ok, this is what I've identified, the query is not handling the quantity 
>>test as if it numeric, but rather the ASCII collating sequence which 
>>doesn't work because 100 is less than 25 in that situation!
>>
>>What can I do to resolve this???
>>
>>    
>>
>
>catalog.cfg:
>
>    Database tiers NUMERIC quantity
>
>  
>
Thanks, I'll give that a try.  I did getting it working with a very ugly 
hack, but if I can revert back to the query and get that to work, more 
the better.

Was I simply being blind because I looked and looked and saw nothing in 
the query tag or the SQL examples that referred to that Database 
declaration?  

I presume that this is a compatibility requirement for the SQL emulation 
so that it knows that it must handle the data element as a numeric 
rather than a character, but it sure would have been sweet to have that 
notation in the tag declaration and in the examples...

Your help is greatly appreciated...

Barry