[ic] 001234 eq 1234 in [data] tag
Gert van der Spoel
gert at 3edge.com
Sat May 12 20:37:10 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.
> >
> >
> > Peter
>
> Hi Peter,
>
> The behavior is the same. Should this be considered a bug?
>
> Talk to you soon,
> Grant
I've tried to reproduce it but seems I cannot ... Test with:
mysql> describe custserv;
+----------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+--------------+------+-----+---------+-------+
| csid | varchar(64) | NO | PRI | | |
| category | varchar(64) | YES | | NULL | |
| title | text | YES | | NULL | |
+----------+--------------+------+-----+---------+-------+
mysql> select title from custserv where csid='00003';
+------------------------+
| title |
+------------------------+
| lost username/password |
+------------------------+
mysql> select title from custserv where csid='3';
+-----------+
| title |
+-----------+
| testtitle |
+-----------+
1 row in set (0.00 sec)
mysql> select title from custserv where csid=3;
+------------------------+
| title |
+------------------------+
| lost username/password |
| testtitle |
+------------------------+
2 rows in set (0.00 sec)
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?
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