]> jfr.im git - z_archive/kelsier.git/blob - Program.cs
b716ab091336b3641bb5ad0c52cc735360e05d79
[z_archive/kelsier.git] / Program.cs
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5 using MySql.Data.MySqlClient;
6
7 namespace Kelsier
8 {
9 class Program
10 {
11 static protected MySqlConnection _dbh = null;
12 static public MySqlConnection dbh
13 {
14 get { return _dbh; }
15 }
16
17 static protected Logger _log;
18 static public Logger log
19 {
20 get { return _log; }
21 }
22
23 static void Main(string[] args)
24 {
25 System.IO.StreamWriter fileout = new System.IO.StreamWriter("kelsier.log", false);
26 fileout.AutoFlush = true;
27 System.IO.TextWriter[] outputs = {Console.Out, fileout};
28 _log = new Logger(outputs, outputs, outputs);
29
30 _dbh = new MySqlConnection(Properties.Settings.Default.dbstr);
31
32 try
33 {
34 dbh.Open();
35 }
36 catch (MySqlException e)
37 {
38 log.error("Error: {0}", e.ToString());
39 }
40
41 MySqlCommand query = new MySqlCommand("SELECT 1+3", dbh);
42 log.debug("1 + 3 = {0}", query.ExecuteScalar().ToString());
43
44 _log = null;
45 Console.Write("Key to quit...");
46 Console.ReadKey();
47 }
48 }
49
50
51 }