Skip Menu |

This queue is for tickets about the AnyEvent-CouchDB CPAN distribution.

Report information
The Basics
Id: 75602
Status: new
Priority: 0/
Queue: AnyEvent-CouchDB

People
Owner: Nobody in particular
Requestors: daniel.westerberg [...] diino.net
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Bug in AnyEvent-CouchDB-1.28: Cannot use plain integer keys when querying views
Date: Wed, 7 Mar 2012 16:04:02 +0100
To: bug-AnyEvent-CouchDB [...] rt.cpan.org
From: Daniel Westerberg <daniel.westerberg [...] diino.net>
Distribution: AnyEvent-CouchDB-1.28 Perl version: v5.8.8 built for x86_64-linux-thread-multi OS: Linux 2.6.24-12-pve #1 SMP PREEMPT Mon Sep 20 13:02:41 CEST 2010 x86_64 x86_64 x86_64 GNU/Linux Hello! First of all thanks for a great library! I am experiencing some problems when trying to query a view that uses plain integers as keys. These are my example documents and their corresponding keys: Show quoted text
> *curl '
http://localhost:5984/laplace_stats_development/_design/RecentUserQuota/_view/by_uid '* {"total_rows":8,"offset":1,"rows":[ {"id":"24f21fb5595c4ab3ab1e8c382f778fc3","key":172,"value":null}, {"id":"24f21fb5595c4ab3ab1e8c382f77a028","key":171,"value":null}, {"id":"24f21fb5595c4ab3ab1e8c382fb4eaa2","key":173,"value":null}, {"id":"24f21fb5595c4ab3ab1e8c382fb507f4","key":173,"value":null}, {"id":"506953a41dc3ee5b893a5e061c7bdf63","key":171,"value":null}, {"id":"506953a41dc3ee5b893a5e061cf94563","key":172,"value":null}, {"id":"506953a41dc3ee5b893a5e061cf96171","key":171,"value":null} ]} I cam query the view manually without any problems using an integer as a key: Show quoted text
> *curl '
http://localhost:5984/laplace_stats_development/_design/RecentUserQuota/_view/by_uid ?key=171'* {"total_rows":8,"offset":1,"rows":[ {"id":"24f21fb5595c4ab3ab1e8c382f77a028","key":171,"value":null}, {"id":"506953a41dc3ee5b893a5e061c7bdf63","key":171,"value":null}, {"id":"506953a41dc3ee5b893a5e061cf96171","key":171,"value":null} ]} However when I try to do this in perl using AnyEvent::CouchDB I am unable to query the view with an integer key without it being converted to a string. I guess this is due to the following code on lines 30-34 in AnyEvent::CouchDB::Database: if ($name eq 'key' || $name eq 'startkey' || $name eq 'endkey') { $value = ref($value) ? uri_escape($json->encode($value)) : (defined $value) ? uri_escape_utf8(qq{"$value"}) : 'null'; This clearly shows that if the value used for the key is not a complex one ( ref($value)) it is converted to a string (qq{"$value"}). If it however is a complex value it is converted to json using a json encoder. This makes my call instead equivalent to: Show quoted text
> *curl '
http://localhost:5984/laplace_stats_development/_design/RecentUserQuota/_view/by_uid ?key="171"'* {"total_rows":8,"offset":1,"rows":[]} This is not correct and needs to be fixed as this is not an expected behaviour. Once again, thank you for a very nice library! Besides this everything seems to work beautifully :) Best regards, Daniel Westerberg
Subject: Re: [rt.cpan.org #75602] AutoReply: Bug in AnyEvent-CouchDB-1.28: Cannot use plain integer keys when querying views
Date: Wed, 7 Mar 2012 16:20:51 +0100
To: bug-AnyEvent-CouchDB [...] rt.cpan.org
From: Daniel Westerberg <daniel.westerberg [...] diino.net>
Oops, please ignore all the "*"-signs you see in the output. There has obviously been some formatting issues in my email. E.g. "*curl ' http://localhost:5984/laplace_ stats_development/_design/Rece ntUserQuota/_view/by_uid<http://localhost:5984/laplace_stats_development/_design/RecentUserQuota/_view/by_uid>'*" should actually be curl 'http://localhost:5984/laplace_ stats_development/_design/Rece ntUserQuota/_view/by_uid<http://localhost:5984/laplace_stats_development/_design/RecentUserQuota/_view/by_uid> ' And so on... On Wed, Mar 7, 2012 at 4:04 PM, Bugs in AnyEvent-CouchDB via RT < bug-AnyEvent-CouchDB@rt.cpan.org> wrote: Show quoted text
> > Greetings, > > This message has been automatically generated in response to the > creation of a trouble ticket regarding: > "Bug in AnyEvent-CouchDB-1.28: Cannot use plain integer keys when > querying views", > a summary of which appears below. > > There is no need to reply to this message right now. Your ticket has been > assigned an ID of [rt.cpan.org #75602]. Your ticket is accessible > on the web at: > > https://rt.cpan.org/Ticket/Display.html?id=75602 > > Please include the string: > > [rt.cpan.org #75602] > > in the subject line of all future correspondence about this issue. To do > so, > you may reply to this message. > > Thank you, > bug-AnyEvent-CouchDB@rt.cpan.org > > ------------------------------------------------------------------------- > Distribution: AnyEvent-CouchDB-1.28 > Perl version: v5.8.8 built for x86_64-linux-thread-multi > OS: Linux 2.6.24-12-pve #1 SMP PREEMPT Mon Sep 20 13:02:41 CEST 2010 x86_64 > x86_64 x86_64 GNU/Linux > > Hello! > > First of all thanks for a great library! > > I am experiencing some problems when trying to query a view that uses plain > integers as keys. > > These are my example documents and their corresponding keys:
> > *curl '
> > http://localhost:5984/laplace_stats_development/_design/RecentUserQuota/_view/by_uid > '* > {"total_rows":8,"offset":1,"rows":[ > {"id":"24f21fb5595c4ab3ab1e8c382f778fc3","key":172,"value":null}, > {"id":"24f21fb5595c4ab3ab1e8c382f77a028","key":171,"value":null}, > {"id":"24f21fb5595c4ab3ab1e8c382fb4eaa2","key":173,"value":null}, > {"id":"24f21fb5595c4ab3ab1e8c382fb507f4","key":173,"value":null}, > {"id":"506953a41dc3ee5b893a5e061c7bdf63","key":171,"value":null}, > {"id":"506953a41dc3ee5b893a5e061cf94563","key":172,"value":null}, > {"id":"506953a41dc3ee5b893a5e061cf96171","key":171,"value":null} > ]} > > > I cam query the view manually without any problems using an integer as a > key:
> > *curl '
> > http://localhost:5984/laplace_stats_development/_design/RecentUserQuota/_view/by_uid > ?key=171'* > {"total_rows":8,"offset":1,"rows":[ > {"id":"24f21fb5595c4ab3ab1e8c382f77a028","key":171,"value":null}, > {"id":"506953a41dc3ee5b893a5e061c7bdf63","key":171,"value":null}, > {"id":"506953a41dc3ee5b893a5e061cf96171","key":171,"value":null} > ]} > > However when I try to do this in perl using AnyEvent::CouchDB I am unable > to query the view with an integer key without it being converted to a > string. I guess this is due to the following code on lines 30-34 in > AnyEvent::CouchDB::Database: > > if ($name eq 'key' || $name eq 'startkey' || $name eq 'endkey') { > $value = ref($value) > ? uri_escape($json->encode($value)) > : (defined $value) > ? uri_escape_utf8(qq{"$value"}) > : 'null'; > > This clearly shows that if the value used for the key is not a complex one > ( > ref($value)) it is converted to a string (qq{"$value"}). If it however is a > complex value it is converted to json using a json encoder. This makes my > call instead equivalent to:
> > *curl '
> > http://localhost:5984/laplace_stats_development/_design/RecentUserQuota/_view/by_uid > ?key="171"'* > {"total_rows":8,"offset":1,"rows":[]} > > This is not correct and needs to be fixed as this is not an expected > behaviour. > > Once again, thank you for a very nice library! Besides this everything > seems to work beautifully :) > > Best regards, > Daniel Westerberg > >
Subject: Re: [rt.cpan.org #75602] AutoReply: Bug in AnyEvent-CouchDB-1.28: Cannot use plain integer keys when querying views
Date: Wed, 7 Mar 2012 16:22:23 +0100
To: bug-AnyEvent-CouchDB [...] rt.cpan.org
From: Daniel Westerberg <daniel.westerberg [...] diino.net>
And there we go once again with the formatting. Please excuse my lack of knowledge when it comes to emailing bug reports but I hope you get the idea of what I was trying to report. Thanks!