# .require. MySql.Data.dll
# .args. -ref:System.Data -ref:MySql.Data
"""
See also:
	docs/mysql on the Cobra web site
	http://www.mono-project.com/MySQL
	http://www.mono-project.com/Category:ADO.NET
	http://www.mono-project.com/Using_Databases

	"Installing Connector/NET on Unix with Mono"
	http://dev.mysql.com/doc/refman/5.0/en/connector-net-installation-unix.html

To run:
	cobra -ref:System.Data -ref:MySql.Data AccessMySQL.cobra

Or just compile:
	cobra -c -ref:System.Data -ref:MySql.Data AccessMySQL.cobra
and then run:
	mono mysql.exe

You can probably leave out the "-ref:<library>" and rely of `use` to locate these.

Mac OS X:
	For installation, MySQL docs say "Copy the MySql.Data.dll file to your Mono project installation folder."
	$ cp bin/MySql.Data.dll /Library/Frameworks/Mono.framework/Libraries/
"""

use System.Data
use MySql.Data.MySqlClient

class Program

	def main is shared
		connectionString = 'Server=localhost;Database=mysql;User ID=root;Password=;Pooling=false'
		using conn = MySqlConnection(connectionString) # IDbConnection
			conn.open
			using cmd = conn.createCommand # IDbCommand
				sql = 'select * from user;'
				cmd.commandText = sql
				using reader = cmd.executeReader # IDataReader
					while reader.read
						userName = reader['User']
						host = reader['Host']
						print 'userName=[userName], host=[host]'
