Exemple #1
0
 /// <summary>
 /// 创建表
 /// </summary>
 /// <param name="db"></param>
 /// <param name="ifNotExists"></param>
 public static void CreateTable(SqLiteHelper db)
 {
     Helper = db;
     string[] colNames =
     {
         "ID", "Seq", "Content", "IsSend", "FileName", "CreateTime", "MsgType", "FileSize"
     };
     string[] colTypes =
     {
         "INTEGER PRIMARY KEY", "TEXT", "TEXT", "Boolean", "TEXT", "TEXT", "INTEGER", "TEXT"
     };
     db.CreateTable(TABLE_NAME, colNames, colTypes);
 }
Exemple #2
0
        public static void UpdateTable(SqLiteHelper db)
        {
            int result = db.ExecuteScalar("SELECT count(*) from sqlite_master where type='table' and name='" + TABLE_NAME + "'");

            if (result != 0)
            {
                //db.ExecuteScalar(" DROP TABLE " + TABLE_NAME);
                string        Template = "ALTER TABLE {0} ADD {1} {2}";
                StringBuilder sb       = new StringBuilder();
                sb.AppendFormat(Template, TABLE_NAME, "MsgId", "TEXT");

                db.ExecuteSql(sb.ToString());
            }
            //CreateTable(db);
        }
Exemple #3
0
 public DaoSession(string connectionString, int version)
 {
     db = new SqLiteHelper(connectionString);
     InitDataBase(version);
     messageDao = new MessageDao();
 }