zoukankan      html  css  js  c++  java
  • coradata 分页查找

    分页读取数据库

     

        class func DBGoodsInfoReadWithCondtions(limitData:Int,fetchSet:Int) -> [AnyObject]{

            let app = DBAppdalegateObject()

            let request = NSFetchRequest()

            let entity = NSEntityDescription.entityForName("GoodsInfo", inManagedObjectContext: app.managedObjectContext!)

            request.entity = entity

     //       request.fetchBatchSize = 10    尚未搞清楚 这个属性与fetchLimit 有什么区别 似乎是一个读到内存 ?

            request.fetchLimit = limitData //一次性至少从数据库中读取多少条

            request.fetchOffset = limitData*fetchSet  // 从数据库中第几个索引开始读取

            var error: NSError? = nil

            let idArray = app.managedObjectContext!.executeFetchRequest(request, error: &error)! as Array

            return app.managedObjectContext!.executeFetchRequest(request, error: &error)!

        }

     

     

  • 相关阅读:
    python-04
    python-03
    python-02
    python-01
    day4-RHCS
    python 之元组(tuple)
    11.21
    python之猜数小游戏
    python之简陋的数据库
    11.20
  • 原文地址:https://www.cnblogs.com/madaha/p/4206281.html
Copyright © 2011-2022 走看看