Beispiel #1
0
    public static void OpenLocalDB()
    {
        if (!File.Exists(DBLocalPath))
        {
            FileStream fs = File.Create(DBLocalPath);
            fs.Close();
            fs.Dispose();
            mLocalDBInstance = CDataBaseManager.GetDBInstance(DBLocalPath);
            if (mLocalDBInstance.BeginTransaction())
            {
                mLocalDBInstance.CreateTable("unforceTable",
                                             new string[] {
                    "path",
                    "md5",
                    "romote",
                    "size"
                },

                                             new string[] {
                    "TEXT NOT NULL",
                    "INTEGER NOT NULL UNIQUE",
                    "INTEGER NOT NULL",
                    "INTEGER NOT NULL"
                });
                mLocalDBInstance.EndTransaction();
            }
        }
        else
        {
            mLocalDBInstance = CDataBaseManager.GetDBInstance(DBLocalPath);
        }
    }
Beispiel #2
0
 /// <summary>
 /// 写入信息
 /// </summary>
 /// <param name="tableName"></param>
 /// <param name="valueArray"></param>
 public static void InsertInfo(CDBInstance db, string tableName, string[] valueArray)
 {
     if (db.BeginTransaction())
     {
         db.InsertInto(tableName, valueArray);
         db.EndTransaction();
     }
 }