kazu2012 / persevere-framework

Automatically exported from code.google.com/p/persevere-framework
0 stars 0 forks source link

Array slicing [0:2] is not working right on 1.0 latest source #259

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I usually get an empty result set when using the array indexing operator
(like [:3] or [0:1]), even though I should have results.  I see this from
console as well as web.  Here is a console example:

js>b = load("resfull6")
[object Array of 4 elements]
js>b = load("resfull6/[?blah='Austin']")
[object Array of 3 elements]
js>b = load("resfull6/[?blah='Austin'][:2]")
[object Array of 0 elements]    <<<<---- problem
js>b = load("resfull6/[0:2]")
[object Array of 0 elements]   <<<<---- problem
js>b = load("resfull6/[1:1]")
[object Array of 0 elements]   <<<<---- problem

js>serialize(a)
[
{"id":"resfull6/1",
        "blah":"Austin"
},
{"id":"resfull6/2",
        "blah":"Austin"
},
{"id":"resfull6/3",
        "blah":"Junk"
},
{"id":"resfull6/4",
        "blah":"Austin"
}

What version of the product are you using? On what operating system?
I'm on version 1.0 (actually, r661 is the revision)
I've duplicated this on windows & linux

Please provide any additional information below.
I see the same issue from the HTTP interface as from the command line. 
Strangely, on my own (much larger) database, the slicing operator DOES work
on some fields (or perhaps randomly), but it's rare.

Original issue reported on code.google.com by dty...@gmail.com on 25 Nov 2009 at 8:31

GoogleCodeExporter commented 8 years ago
Just fyi ... I dropped back to r615 and had the same problem, I then backed up 
to
r586 which does not have the problem, so somewhere in between those two it 
appeared.
 I also tested against the built-in Transaction class (on the current version), just
to be sure it wasn't somehow related to my data, and the problem was visible 
there
too regardless of adding any specific data.

Original comment by dty...@gmail.com on 11 Dec 2009 at 11:10

GoogleCodeExporter commented 8 years ago
Ok, I think I tracked down the line of code that broke the array slice/range 
stuff. 
It's in server.js, in the slice() function, and was added in r605.  It's just a
"return results;" line that was added.  I commented that out, rebuilt, and the 
array
slice/range works again.

Original comment by dty...@gmail.com on 12 Dec 2009 at 7:08

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago

Original comment by kris...@gmail.com on 22 Dec 2009 at 8:13