Giter VIP home page Giter VIP logo

Comments (8)

Fidetro avatar Fidetro commented on August 22, 2024
    Select
    .begin(@"*")
    .from([ClassRoom class])
    .limit(@"?")
    .offset(@"?")
    .endQuery(@[@(5),@(5)],[ClassRoom class],nil,^(NSArray *result){
        NSLog(@"%@",result);
    });

这样应该能先临时解决你的问题?后续会加上

from ffdb.

ounione avatar ounione commented on August 22, 2024
    Select
    .begin(@"*")
    .from([ClassRoom class])
    .limit(@"?")
    .offset(@"?")
    .endQuery(@[@(5),@(5)],[ClassRoom class],nil,^(NSArray *result){
        NSLog(@"%@",result);
    });

这样应该能先临时解决你的问题?后续会加上

我先试试,感谢万分

from ffdb.

ounione avatar ounione commented on August 22, 2024
    Select
    .begin(@"*")
    .from([ClassRoom class])
    .limit(@"?")
    .offset(@"?")
    .endQuery(@[@(5),@(5)],[ClassRoom class],nil,^(NSArray *result){
        NSLog(@"%@",result);
    });

这样应该能先临时解决你的问题?后续会加上

    Select
    .begin(@"*")
    .from([ClassRoom class])
    .limit(@"?")
    .offset(@"?")
    .endQuery(@[@(5),@(5)],[ClassRoom class],nil,^(NSArray *result){
        NSLog(@"%@",result);
    });

这样应该能先临时解决你的问题?后续会加上

大佬你好,我看你写了不少功能但没有注释,比较难懂。可以问下方便给联系方式么,有几个问题想咨询

from ffdb.

Fidetro avatar Fidetro commented on August 22, 2024

这里问吧

from ffdb.

ounione avatar ounione commented on August 22, 2024

这里问吧

app想模拟网页,需要一个分页查询功能,比如页面可以上拉加载更多数据,数据为倒序返回(按创建时间最新或者按主键id倒序)。这个limit和offset能看懂,endQuery第一个参数数组怎么理解,按主键id倒序该怎么写

from ffdb.

Fidetro avatar Fidetro commented on August 22, 2024

倒序可以用orderby,

    Select
    .begin(@"*")
    .from([ClassRoom class])
    .orderBy(@"primaryKeyColumn DESC")
    .limit(@"?")
    .offset(@"?")
    .endQuery(@[@(5),@(10)],[ClassRoom class],nil,^(NSArray *result){
        NSLog(@"%@",result);
    });

不过我发现这里之前写错了,少了个空格,晚些我处理下这个问题
https://github.com/Fidetro/FFDB/blob/022062466846d46e68c967f1c60a13c9482faba1/FFDB/OrderBy.m#L18C4-L18C4

// 错误
self.stmt = [NSString stringWithFormat:@"%@orderby %@ ",stmt,format];
// 预期
self.stmt = [NSString stringWithFormat:@"%@order by %@ ",stmt,format];

endQuery的参数是fmdb的用法,可以看下这里,5代表limit 5,10代表offset10,当然你也可以不这么用,这样写也可以

    Select
    .begin(@"*")
    .from([ClassRoom class])
    .orderBy(@"primaryKeyColumn DESC")
    .limit(@"5")
    .offset(@"10")
    .endQuery(nil,[ClassRoom class],nil,^(NSArray *result){
        NSLog(@"%@",result);
    });

from ffdb.

ounione avatar ounione commented on August 22, 2024

https://github.com/Fidetro/FFDB/blob/022062466846d46e68c967f1c60a13c9482faba1/FFDB/OrderBy.m#L18C4-L18C4

倒序可以用orderby,

    Select
    .begin(@"*")
    .from([ClassRoom class])
    .orderBy(@"primaryKeyColumn DESC")
    .limit(@"?")
    .offset(@"?")
    .endQuery(@[@(5),@(10)],[ClassRoom class],nil,^(NSArray *result){
        NSLog(@"%@",result);
    });

不过我发现这里之前写错了,少了个空格,晚些我处理下这个问题 https://github.com/Fidetro/FFDB/blob/022062466846d46e68c967f1c60a13c9482faba1/FFDB/OrderBy.m#L18C4-L18C4

// 错误
self.stmt = [NSString stringWithFormat:@"%@orderby %@ ",stmt,format];
// 预期
self.stmt = [NSString stringWithFormat:@"%@order by %@ ",stmt,format];

endQuery的参数是fmdb的用法,可以看下这里,5代表limit 5,10代表offset10,当然你也可以不这么用,这样写也可以

    Select
    .begin(@"*")
    .from([ClassRoom class])
    .orderBy(@"primaryKeyColumn DESC")
    .limit(@"5")
    .offset(@"10")
    .endQuery(nil,[ClassRoom class],nil,^(NSArray *result){
        NSLog(@"%@",result);
    });

理解了,试了下有用,感谢

from ffdb.

Fidetro avatar Fidetro commented on August 22, 2024

Fixed 4.1.5

from ffdb.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.