package jdbc;

import java.sql.Connection;
import java.sql.SQLException;

public class Test {
	public static void main(String[] args) {

		Connection co=SQLConnection.getConnection();
		String[] fields={"Cours","Code","Enseignant","Nbe Heures CM","Nbe Heures TD"};
		SQLType[] types={SQLType.VARCHAR,SQLType.CHAR,SQLType.VARCHAR,SQLType.INTEGER,SQLType.INTEGER};
		String[] constraints={"(30)","(8)","(20)","",""};
		Table t=new Table(co,"cours",fields,types,constraints, new String[0]);
		t.init();
		System.out.println(t);

		Query query=new Query();
		query.select("enseignant.Name");
		query.select("enseignant.Address");
		query.select("cours.Code");
		query.whereEqual("enseignant.Id","cours.Enseignant");
		String sql=query.toSQL();
		System.out.println(sql);
		try {
			co.close();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

}
