[ic] 001234 eq 1234 in [data] tag

Grant emailgrant at gmail.com
Fri May 18 10:41:58 UTC 2012


>>>>> I just noticed that this returns the title of SKU 1234:
>>>>>
>>>>> [data table=products key=|001234| field=title]
>>>>>
>>>>> Is this inherited from mysql or is it IC behavior?
>>>>>
>>>>> - Grant
>>>>
>>>>
>>>>
>>>> This is especially problematic because the following produces nothing,
>>>> which is inconsistent with the above:
>>>>
>>>> [loop
>>>> search="fi=products/ml=1/st=db/sf=sku/se=001234/op=eq/nu=0"][loop-data
>>>> products title][/loop]
>>>>
>>>> - Grant
>>>
>>>
>>>
>>> Which type is your sku column in products? varchar or int?
>>>
>>> Regards
>>>        Racke
>>
>>
>> I have this:
>>
>> Database products COLUMN_DEF "sku=INT(6) AUTO_INCREMENT PRIMARY KEY"
>>
>> Am I seeing this behavior because of INT?  Is VARCHAR ok to use with
>> AUTO_INCREMENT?
>>
>
> Yes, as the number 001234 is equal to the number 1234. The string
> 001234 is different to 1234. I don't think you can use VARCHAR as
> AUTO_INCREMENT column.

Hmmm, I use mysql and I want AUTO_INCREMENT behavior but I also want
to do exact string matching on the table key.  How would you guys
accomplish this?

> I would just make sure that requests to 001234 is either rejected (404)
> or redirected to 1234 (301).

I suppose there is a never-ending list of numbers which would need to
be rejected (0001234, 1234.000, etc).

- Grant



More information about the interchange-users mailing list