[ic] 001234 eq 1234 in [data] tag
Gert van der Spoel
gert at 3edge.com
Sun May 13 07:19:36 UTC 2012
> -----Original Message-----
> From: interchange-users-bounces at icdevgroup.org [mailto:interchange-users-
> bounces at icdevgroup.org] On Behalf Of Grant
> Sent: zondag 13 mei 2012 10:00
> To: interchange-users at icdevgroup.org
> Subject: Re: [ic] 001234 eq 1234 in [data] tag
>
> >> >> 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");
What happens when you uncomment the above line?
::logDebug("DBI field: key=$key column=$column query=$query");
What is the value of the key in your test scenario?
> > 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
>
> _______________________________________________
> interchange-users mailing list
> interchange-users at icdevgroup.org
> http://www.icdevgroup.org/mailman/listinfo/interchange-users
More information about the interchange-users
mailing list