Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Interchange: users

001234 eq 1234 in [data] tag

 

 

Interchange users RSS feed   Index | Next | Previous | View Threaded


emailgrant at gmail

May 12, 2012, 2:56 AM

Post #1 of 13 (550 views)
Permalink
001234 eq 1234 in [data] tag

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

_______________________________________________
interchange-users mailing list
interchange-users [at] icdevgroup
http://www.icdevgroup.org/mailman/listinfo/interchange-users


peter at pajamian

May 12, 2012, 3:20 AM

Post #2 of 13 (534 views)
Permalink
Re: 001234 eq 1234 in [data] tag [In reply to]

On 12/05/12 21:56, Grant wrote:
> 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

_______________________________________________
interchange-users mailing list
interchange-users [at] icdevgroup
http://www.icdevgroup.org/mailman/listinfo/interchange-users


emailgrant at gmail

May 12, 2012, 3:24 AM

Post #3 of 13 (538 views)
Permalink
Re: 001234 eq 1234 in [data] tag [In reply to]

> 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

_______________________________________________
interchange-users mailing list
interchange-users [at] icdevgroup
http://www.icdevgroup.org/mailman/listinfo/interchange-users


emailgrant at gmail

May 12, 2012, 9:09 AM

Post #4 of 13 (539 views)
Permalink
Re: 001234 eq 1234 in [data] tag [In reply to]

>> 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

_______________________________________________
interchange-users mailing list
interchange-users [at] icdevgroup
http://www.icdevgroup.org/mailman/listinfo/interchange-users


gert at 3edge

May 12, 2012, 1:37 PM

Post #5 of 13 (525 views)
Permalink
Re: 001234 eq 1234 in [data] tag [In reply to]

> >> 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



























_______________________________________________
interchange-users mailing list
interchange-users [at] icdevgroup
http://www.icdevgroup.org/mailman/listinfo/interchange-users


emailgrant at gmail

May 13, 2012, 12:00 AM

Post #6 of 13 (532 views)
Permalink
Re: 001234 eq 1234 in [data] tag [In reply to]

>> >> 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

_______________________________________________
interchange-users mailing list
interchange-users [at] icdevgroup
http://www.icdevgroup.org/mailman/listinfo/interchange-users


gert at 3edge

May 13, 2012, 12:19 AM

Post #7 of 13 (523 views)
Permalink
Re: 001234 eq 1234 in [data] tag [In reply to]

> -----Original Message-----
> From: interchange-users-bounces [at] icdevgroup [mailto:interchange-users-
> bounces [at] icdevgroup] On Behalf Of Grant
> Sent: zondag 13 mei 2012 10:00
> To: interchange-users [at] icdevgroup
> 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
> http://www.icdevgroup.org/mailman/listinfo/interchange-users


_______________________________________________
interchange-users mailing list
interchange-users [at] icdevgroup
http://www.icdevgroup.org/mailman/listinfo/interchange-users


racke at linuxia

May 13, 2012, 11:56 PM

Post #8 of 13 (533 views)
Permalink
Re: 001234 eq 1234 in [data] tag [In reply to]

On 05/12/2012 12:24 PM, Grant wrote:
>> 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

--
LinuXia Systems => http://www.linuxia.de/
Expert Interchange Consulting and System Administration
ICDEVGROUP => http://www.icdevgroup.org/
Interchange Development Team


_______________________________________________
interchange-users mailing list
interchange-users [at] icdevgroup
http://www.icdevgroup.org/mailman/listinfo/interchange-users


emailgrant at gmail

May 14, 2012, 4:55 AM

Post #9 of 13 (523 views)
Permalink
Re: 001234 eq 1234 in [data] tag [In reply to]

>>> 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?

- Grant

_______________________________________________
interchange-users mailing list
interchange-users [at] icdevgroup
http://www.icdevgroup.org/mailman/listinfo/interchange-users


gert at 3edge

May 14, 2012, 5:01 AM

Post #10 of 13 (538 views)
Permalink
Re: 001234 eq 1234 in [data] tag [In reply to]

> -----Original Message-----
> From: interchange-users-bounces [at] icdevgroup [mailto:interchange-users-
> bounces [at] icdevgroup] On Behalf Of Grant
> Sent: maandag 14 mei 2012 14:55
> To: interchange-users [at] icdevgroup
> 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]
> >>>
> >>> 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?
>
> - Grant
>

But you have a key that actually has '001234' in that row? I do not see
how mysql would have prefixed zeros ... And 001234 and 01234 and 1234 would
be the same and saving any more than one of those would result in a unique
key constraint.

CU,

Gert




_______________________________________________
interchange-users mailing list
interchange-users [at] icdevgroup
http://www.icdevgroup.org/mailman/listinfo/interchange-users


racke at linuxia

May 14, 2012, 5:27 AM

Post #11 of 13 (524 views)
Permalink
Re: 001234 eq 1234 in [data] tag [In reply to]

On 05/14/2012 01:55 PM, Grant wrote:
>>>> 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.

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

Regards
Racke

--
LinuXia Systems => http://www.linuxia.de/
Expert Interchange Consulting and System Administration
ICDEVGROUP => http://www.icdevgroup.org/
Interchange Development Team


_______________________________________________
interchange-users mailing list
interchange-users [at] icdevgroup
http://www.icdevgroup.org/mailman/listinfo/interchange-users


peter at pajamian

May 14, 2012, 6:29 PM

Post #12 of 13 (525 views)
Permalink
Re: 001234 eq 1234 in [data] tag [In reply to]

On 15/05/12 00:27, Stefan Hornburg (Racke) wrote:
> On 05/14/2012 01:55 PM, Grant wrote:
>> 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.

It is possible with postgresql sequences, but not in mysql. I don't
know how IC would react to it, though.


Peter


_______________________________________________
interchange-users mailing list
interchange-users [at] icdevgroup
http://www.icdevgroup.org/mailman/listinfo/interchange-users


emailgrant at gmail

May 18, 2012, 3:41 AM

Post #13 of 13 (501 views)
Permalink
Re: 001234 eq 1234 in [data] tag [In reply to]

>>>>> 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

_______________________________________________
interchange-users mailing list
interchange-users [at] icdevgroup
http://www.icdevgroup.org/mailman/listinfo/interchange-users

Interchange users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.