zhangjingl02 / activejdbc

Automatically exported from code.google.com/p/activejdbc
0 stars 0 forks source link

find("ID > ? AND ID < ?", 10, 20) which seems cause endless query ? #165

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. The result s OK when the following statement is executed
LazyList<aModal> aRecs = aModal.find("ID >= ? AND ID < ?", 10, 20); 

2. The result is OK when the following statement is executed
LazyList<aModal> aRecs = aModal.find("ID > ? AND ID <= ?", 10, 20); 

3. That is an endless query when the following statement is executed
LazyList<aModal> aRecs = aModal.find("ID > ? AND ID < ?", 10, 20); 

What version of the product are you using? On what operating system?
activejdbc=1.4.1 
OS=Windows

Original issue reported on code.google.com by nelsonc...@gmail.com on 16 Jul 2012 at 3:42

GoogleCodeExporter commented 9 years ago
this is odd, I was unable to reproduce this problem. OS: Ubuntu 12.04 LTS, 
ActiveJDBC version: 1.4.1, code to reproduce the problem:

public class Defect165Test extends ActiveJDBCTest {

    @Test
    public void shouldNotRunEndlessQuery(){
        this.deleteAndPopulateTable("people");
        for(int i = 0;   i < 100; i++){
            Person p = new Person();
            p.set("name", "first name " + i);
            p.set("last_name", "last name " + i);
            p.saveIt();
        }
        LazyList<Person> people = Person.find("id > ? AND id < ?", 10, 20);
        people.dump();
    }
}

Output:

Model: org.javalite.activejdbc.test_models.Person, table: 'people', attributes: 
{id=11, updated_at=2012-07-15 23:13:52.935, graduation_date=null, name=first 
name 6, dob=null, last_name=last name 6, created_at=2012-07-15 23:13:52.935}
Model: org.javalite.activejdbc.test_models.Person, table: 'people', attributes: 
{id=12, updated_at=2012-07-15 23:13:52.938, graduation_date=null, name=first 
name 7, dob=null, last_name=last name 7, created_at=2012-07-15 23:13:52.938}
Model: org.javalite.activejdbc.test_models.Person, table: 'people', attributes: 
{id=13, updated_at=2012-07-15 23:13:52.941, graduation_date=null, name=first 
name 8, dob=null, last_name=last name 8, created_at=2012-07-15 23:13:52.941}
Model: org.javalite.activejdbc.test_models.Person, table: 'people', attributes: 
{id=14, updated_at=2012-07-15 23:13:52.945, graduation_date=null, name=first 
name 9, dob=null, last_name=last name 9, created_at=2012-07-15 23:13:52.945}
Model: org.javalite.activejdbc.test_models.Person, table: 'people', attributes: 
{id=15, updated_at=2012-07-15 23:13:52.949, graduation_date=null, name=first 
name 10, dob=null, last_name=last name 10, created_at=2012-07-15 23:13:52.949}
Model: org.javalite.activejdbc.test_models.Person, table: 'people', attributes: 
{id=16, updated_at=2012-07-15 23:13:52.952, graduation_date=null, name=first 
name 11, dob=null, last_name=last name 11, created_at=2012-07-15 23:13:52.952}
Model: org.javalite.activejdbc.test_models.Person, table: 'people', attributes: 
{id=17, updated_at=2012-07-15 23:13:52.956, graduation_date=null, name=first 
name 12, dob=null, last_name=last name 12, created_at=2012-07-15 23:13:52.956}
Model: org.javalite.activejdbc.test_models.Person, table: 'people', attributes: 
{id=18, updated_at=2012-07-15 23:13:52.959, graduation_date=null, name=first 
name 13, dob=null, last_name=last name 13, created_at=2012-07-15 23:13:52.959}
Model: org.javalite.activejdbc.test_models.Person, table: 'people', attributes: 
{id=19, updated_at=2012-07-15 23:13:52.963, graduation_date=null, name=first 
name 14, dob=null, last_name=last name 14, created_at=2012-07-15 23:13:52.963}

Original comment by i...@polevoy.org on 16 Jul 2012 at 4:17

GoogleCodeExporter commented 9 years ago

Original comment by ipolevoy@gmail.com on 9 Aug 2012 at 7:16