iOS 数据库 canDB.swift

码农软件 · 软件分类 · iOS 数据库 · 2019-05-22 08:57:34

软件介绍

canDB.swift 是一个框架,作用类似 nonSQL 的数据库,但运作在 sqlite(FMDB) 。

    // loading the json
    let filePath = NSBundle.mainBundle().pathForResource("data", ofType:"json")    let data = NSData(contentsOfFile:filePath!, options:NSDataReadingOptions.DataReadingUncached, error:nil)    let dataArray:Array = NSJSONSerialization.JSONObjectWithData(data!, options: NSJSONReadingOptions.allZeros, error: nil) as! Array<Dictionary<String, String>>

    // singleton instance
    let storeInstance = canDB.sharedInstance    // saving the data, the can is automatically created if not exists
    storeInstance.saveData("Person", data: dataArray, idString: kCanDBDefaultIdString, error: nil)    // adding the index for future queries and reindexing the table
    storeInstance.addIndex("Person", indexes: ["Name"], error: nil)
    storeInstance.reIndex("Person", idString: kCanDBDefaultIdString)    let result = storeInstance.loadData("Person")    for item in result {        for (key, value) in (item as! NSDictionary) {
            println("\(key): \(value)")
        }
    }    // custom query using the previous created index "Name"
    let resultWithQuery = storeInstance.loadDataWithQuery("SELECT * FROM Person WHERE Name='John'")    for item in resultWithQuery {        for (key, value) in (item as! NSDictionary) {
            println("\(key): \(value)")
        }
    }

    storeInstance.removeDataForId("Person", idString: kCanDBDefaultIdString, idsToDelete: ["17", "19"], error: nil)

本文地址:https://www.codercto.com/soft/d/6280.html

精通Spring 4.x

精通Spring 4.x

陈雄华、林开雄、文建国 / 电子工业出版社 / 2017-1-1 / CNY 128.00

Spring 4.0是Spring在积蓄4年后,隆重推出的一个重大升级版本,进一步加强了Spring作为Java领域第一开源平台的翘楚地位。Spring 4.0引入了众多Java开发者翘首以盼的基于Groovy Bean的配置、HTML 5/WebSocket支持等新功能,全面支持Java 8.0,最低要求是Java 6.0。这些新功能实用性强、易用性高,可大幅降低Java应用,特别是Java W......一起来看看 《精通Spring 4.x》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具