SQLite.swift
SQLite.swift copied to clipboard
Chaining of Statement#bind
I want to chaining of Statement bellow:
try stmt.bind([":oreoid" : airCommand.oreoid])
.bind([":model_name" : airCommand.model_name])
.bind([":mode" : airCommand.mode])
.bind([":swing" : airCommand.swing])
.bind([":fan_speed":airCommand.fan_speed]).run()
but after set last parameter, it will reset all parameter before.
===From the Statement Source ==========
public func bind(values: [String: Binding?]) -> Statement {
reset() <---------- why do this? if use for chaining
for (name, value) in values {
let idx = sqlite3_bind_parameter_index(handle, name)
guard idx > 0 else {
fatalError("parameter not found: \(name)")
}
bind(value, atIndex: Int(idx))
}
return self
}
XCode 7 have indexing hang issue for mapping all data split by "," like
try stmt.bind([":oreoid" : airCommand.oreoid,
":model_name" : airCommand.model_name,
":mode" : airCommand.mode,
":swing" : airCommand.swing,
":fan_speed":airCommand.fan_speed,
":temperature":airCommand.temperature,
":temperature_unit":airCommand.temperature_unit,
":temperature_index":airCommand.temperature_index,
":temperature_unit_index":airCommand.temperature_unit_index,
":timer_date":airCommand.timer_date,
":timer_hour":airCommand.timer_hour,
":timer_hours":airCommand.timer_hours,
":timer_onoff":airCommand.timer_onoff]).run()