# Io Reference

Databases / MySQL / MySQL

MySQL is a fast, multi-threaded, multi-user SQL database server. IoMySQL is a MySQL binding for Io, by Min-hee Hong.

    my := MySQL establish("localhost", "user", "password", "database")

    # Get rows by Map
    my queryThenMap("SELECT * FROM rel") foreach(at("col") println)
    # Get rows by List
    my query("SELECT * FROM rel") foreach(at(0) println)

    my close

close

Closes a previously opened connection.
connect(host, user, password, database, port, unixSocket, useSSL)

Connect to a MySQL database.
connected

Returns true if connected to the database, false otherwise.
establish

Establish a connection to a MySQL database.
lastInsertRowId

Returns the value generated for an AUTO_INCREMENT column by the previous INSERT or UPDATE statement.
query(aQueryString)

Perform a SQL query and return a list of results.

    	db query("SELECT * FROM accounts") foreach(println)