How To Access MySQL
Print Hello World
Write Basic Syntax
Use Properties
Make An If Else Ladder
Make A Branch Statement
Declare Inits
Use Lists
Use Arrays
Make A Class Hierarchy
Use Nil And Nilable Types
Use Dynamic Typing
Declare Variable Number Of Args
Read And Write Files
Check Inheritance And Implementation
Customize Object Equality
Pass References To Methods
Translate Pseudo Code To Cobra 1
Translate Pseudo Code To Cobra 2
Implement IEnumerable 1
Implement IEnumerable 2
Iterate Through Recursive Data With Yield
Make A Collection Class
Declare Contracts
Threads
Win Forms
WPF
GTK
Qyoto
Access MySQL
XNA
Open TK
 
"""
To setup MySQL client access, see:
    http://cobra-language.com/trac/cobra/wiki/SetUpMySqlOnUnixLike
    http://dev.mysql.com/usingmysql/dotnet/

To run:
    cobra AccessMySQL.cobra

Or just compile:
    cobra -c AccessMySQL.cobra
and then run:
    mono mysql.exe
"""

@ref 'System.Data'
@ref 'MySql.Data'

use System.Data
use MySql.Data
use MySql.Data.MySqlClient

class Program

    def main
        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]'