示例#1
0
 private void bCreate_Click(object sender, EventArgs e)
 {
     if (this.tbMessage.Text.Contains("'"))
     {
         MessageBox.Show("설명에는 '문자가 없어야합니다!", "Swiss Tournament", MessageBoxButtons.OK, MessageBoxIcon.Hand);
     }
     else if (this.tbMessage.Text.Length >= 0xff)
     {
         MessageBox.Show("설명이 너무 깁니다!", "Swiss Tournament", MessageBoxButtons.OK, MessageBoxIcon.Hand);
     }
     else
     {
         if (!Directory.Exists("db"))
         {
             Directory.CreateDirectory("db");
         }
         string path = "db/" + this.tbFileName.Text + ".db";
         if (File.Exists(path))
         {
             MessageBox.Show("같은 이름의 파일이 이미 존재합니다!", "Swiss Tournament", MessageBoxButtons.OK, MessageBoxIcon.Hand);
         }
         else
         {
             SqliteWrapper.CreateNew(path);
             SqliteWrapper wrapper = SqliteWrapper.Open(path);
             wrapper.EvalNqSql("create table created (time integer, msg varchar(255))");
             wrapper.EvalNqSql($"insert into created (time, msg) values ({DateTime.Now.Ticks}, '{this.tbMessage.Text}')");
             wrapper.EvalNqSql("create table members (ix int, name varchar(60), id int)");
             wrapper.EvalNqSql("create table history (ix int, p1 int, p2 int, status int, round int, desc varchar(255))");
             base.Close();
         }
     }
 }