catchup commit

This commit is contained in:
Jonathan Guthrie 2016-09-30 15:45:55 -04:00
parent 7bdc9635b2
commit 8ede7a64b8
4 changed files with 31 additions and 17 deletions

View File

@ -19,24 +19,33 @@ protocol CRUDProtocol {
open class Connect { open class Connect {
open var datasource = DataSource() open var datasource = DataSource()
open var credentials = DataSourceCredentials() open var credentials = DataSourceCredentials()
open var database: String = "" open var database: String = ""
open var table: String = ""
/// Manually set table
// Convenience shortcut var
open var table: String = ""
/// Last executed statement
public var statement: String = ""
/// Last executed statement
public var resultCode: PerfectCRUDError = .noError
public init() {} public init() {}
public init(_ ds: DataSource, public init(_ ds: DataSource,
host: String, host: String,
username: String = "", username: String = "",
password: String = "", password: String = "",
port: Int = 0) { port: Int = 0) {
self.datasource = ds self.datasource = ds
self.credentials = DataSourceCredentials(host: host, port: port, user: username, pass: password) self.credentials = DataSourceCredentials(host: host, port: port, user: username, pass: password)
} }
// //
// public func select() -> String { // public func select() -> String {
// return "selected" // return "selected"

View File

@ -14,9 +14,8 @@ public struct DataSourceCredentials {
public var username: String = "" public var username: String = ""
public var password: String = "" public var password: String = ""
public init() { public init() {}
// empty
}
public init(host: String, port: Int = 0, user: String = "", pass: String = "") { public init(host: String, port: Int = 0, user: String = "", pass: String = "") {
self.host = host self.host = host
self.port = port self.port = port

View File

@ -9,6 +9,8 @@
import Foundation import Foundation
open class PerfectResultSet { open class PerfectResultSet {
var rows: [PerfectRow] = [PerfectRow]() public var rows: [PerfectRow] = [PerfectRow]()
var cursorData: PerfectCRUDCursor = PerfectCRUDCursor() public var cursorData: PerfectCRUDCursor = PerfectCRUDCursor()
public init() {}
} }

View File

@ -22,6 +22,10 @@ open class PerfectRow {
var idString = "" var idString = ""
fileprivate var idType: idTypeList = .Int fileprivate var idType: idTypeList = .Int
public var data = Dictionary<String, Any>()
public init() {}
public func id(_ val: Int) { public func id(_ val: Int) {
idType = .Int idType = .Int
idInt = val idInt = val
@ -46,7 +50,7 @@ open class PerfectRow {
} }
} }
public func parse(_ rows: [[String: Any]]) { // public func parse(_ rows: [[String: Any]]) {
// parse rows // // parse rows
} // }
} }