Skip to content

Commit

Permalink
iOS Sample correction
Browse files Browse the repository at this point in the history
  • Loading branch information
mcorega committed Jan 9, 2016
1 parent 81abe73 commit 7803806
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions MySQLSampleiOS/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ class ViewController: UIViewController {

do{
// open a new connection
try con.open("192.168.1.131", user: "cipi", passwd: "")
try con.open("localhost", user: "test", passwd: "test")

// create a new database for tests, use exec since we don't expect any results
try con.exec("DROP DATABASE IF EXISTS " + db_name)
try con.exec("CREATE DATABASE IF NOT EXISTS " + db_name)

// select the database
try con.select(db_name)
try con.use(db_name)

// create a table for our tests
try con.exec("CREATE TABLE test (id INT NOT NULL AUTO_INCREMENT, age INT, cash FLOAT, name VARCHAR(30), PRIMARY KEY (id))")
Expand All @@ -41,14 +41,14 @@ class ViewController: UIViewController {
// insert 300 rows
for i in 1...300 {
// use a int, float and a string
try ins_stmt.exec(10-i, Float(i)/3.0, "name for \(i)")
try ins_stmt.exec([10-i, Float(i)/3.0, "name for \(i)"])
}

// read rows 30 to 60
for i in 30...60 {
do {
// send query
let res = try select_stmt.query(i)
let res = try select_stmt.query([i])

//read all rows from the resultset
let rows = try res.readAllRows()
Expand Down

0 comments on commit 7803806

Please sign in to comment.