[ic] 001234 eq 1234 in [data] tag

Grant emailgrant at gmail.com
Sun May 13 07:00:00 UTC 2012


>> >> I just noticed that this returns the title of SKU 1234:
>> >>
>> >> [data table=products key=|001234| field=title]
>> >
>> > What happens if you do:
>> > [data table=products key=`'001234'` field=title]
>> >
>> >> Is this inherited from mysql or is it IC behavior?
>> >
>> > I'm guessing it's an IC thing, but I haven't looked at that particular
>> code.
[snip]
> When I do the following test in a page, the results are:
> [data table=custserv key=|03| field=title]       -> no result
> [data table=custserv key=|3| field=title]        -> testtitle
> [data table=custserv key=|00003| field=title]    -> lost username/password
>
>
> What version are you using of Mysql and Interchange?
> Does your lib/Vend/Table/DBI.pm  have the following sub?

I'm using mysql-5.1.62-r1 and IC 5.6.3 and I do have the below sub
which is identical on my system.  Why would we get different results?

- Grant


> sub field {
>    my ($s, $key, $column) = @_;
>        $s = $s->import_db() if ! defined $s->[$DBI];
>        $key = $s->[$DBI]->quote($key)
>                unless exists $s->[$CONFIG]{NUMERIC}{$s->[$KEY]};
>        my $idx;
>        if( $s->[$TYPE] and $idx = $s->column_index($column) )  {
>                $column = $s->[$NAME][$idx];
>        }
>        my $query = "select $column from $s->[$TABLE] where $s->[$KEY] =
> $key";
> #::logDebug("DBI field: key=$key column=$column query=$query");
>    my $sth;
>        eval {
>                $sth = $s->[$DBI]->prepare($query);
>                $sth->execute();
>        };
>        return '' if $@;
>        my $data = ($sth->fetchrow_array())[0];
>        return '' unless $data =~ /\S/;
>        $data;
> }
>
>
> CU,
>
> Gert



More information about the interchange-users mailing list