 				
 				let execRes = stmt1.execute()
 				XCTAssert(execRes, "\(stmt1.errorCode()) \(stmt1.errorMessage()) - \(mysql.errorCode()) \(mysql.errorMessage())")
-				
-				stmt1.close()
 			}
 		}
 		
 		do {
 			let stmt1 = MySQLStmt(mysql)
+            defer { stmt1.close() }
 			
 			let prepRes = stmt1.prepare("SELECT * FROM all_data_types")
 			XCTAssert(prepRes, stmt1.errorMessage())

	}
	
	func testQueryStmt1() {
		let mysql = MySQL()
		defer {
			mysql.close()
		}
		
		let res = mysql.connect(HOST, user: USER, password: PASSWORD)
		XCTAssert(res)
		
		if !res {
			print(mysql.errorMessage())
		}
		
		let sres = mysql.selectDatabase(SCHEMA)
		XCTAssert(sres == true)
		
		mysql.query("DROP TABLE IF EXISTS all_data_types")
		
		let qres = mysql.query("CREATE TABLE `all_data_types` (`varchar` VARCHAR( 20 ),\n`tinyint` TINYINT,\n`text` TEXT,\n`date` DATE,\n`smallint` SMALLINT,\n`mediumint` MEDIUMINT,\n`int` INT,\n`bigint` BIGINT,\n`float` FLOAT( 10, 2 ),\n`double` DOUBLE,\n`decimal` DECIMAL( 10, 2 ),\n`datetime` DATETIME,\n`timestamp` TIMESTAMP,\n`time` TIME,\n`year` YEAR,\n`char` CHAR( 10 ),\n`tinyblob` TINYBLOB,\n`tinytext` TINYTEXT,\n`blob` BLOB,\n`mediumblob` MEDIUMBLOB,\n`mediumtext` MEDIUMTEXT,\n`longblob` LONGBLOB,\n`longtext` LONGTEXT,\n`enum` ENUM( '1', '2', '3' ),\n`set` SET( '1', '2', '3' ),\n`bool` BOOL,\n`binary` BINARY( 20 ),\n`varbinary` VARBINARY( 20 ) ) ENGINE = MYISAM")
		XCTAssert(qres == true, mysql.errorMessage())
		
		let stmt1 = MySQLStmt(mysql)
		defer {
			stmt1.close()
		}
		let prepRes = stmt1.prepare("INSERT INTO all_data_types VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)")
		XCTAssert(prepRes, stmt1.errorMessage())
		XCTAssert(stmt1.paramCount() == 28)

            XCTAssertEqual(row[5] as? String, "-3.3")
        }
    }
}
