Пример #1
0
    /// <summary>
    /// 要删除的item的ID
    /// </summary>
    /// <param name="ID"></param>
    public void DelKVListData(string ID)
    {
        //删本地数据
        KVDateDic.Remove(ID);

        int id = Convert.ToInt32(ID);

        //删sql数据
        GEditorDataMgr.DelKVSqlData(Name, id);

        Log.i("KVContainer", "DelKVItem", "删除KVItem id:" + id, BeShowLog);
    }
Пример #2
0
    void Update()
    {
//		if (Input.GetKeyUp (KeyCode.B)) {
//			sql.OpenConnection("data source= data/sqlite4unity.db");
//			sql.BeTableExist ("table1");
//			sql.CloseConnection();
//		}

        if (Input.GetKeyUp(KeyCode.S))
        {
            Debug.Log("Start");
            sql = SQLiteHelper.GetIns();
            sql.OpenConnection("data source= data/test.db");
        }

        if (Input.GetKeyUp(KeyCode.T))
        {
            //创建名为table1的数据表
            sql.CreateTable("table1", new string[] { "ID", "Name", "Email" }, new string[] { "INTEGER PRIMARY KEY", "TEXT", "TEXT" });
        }


        if (Input.GetKeyUp(KeyCode.N))
        {
            Debug.Log("End");
            sql.CloseConnection();
        }


        //测试新增一条数据
        if (Input.GetKeyUp(KeyCode.C))
        {
            Debug.Log("Create");

            string s = "name3333333";

            GEditorDataMgr.CreateKVSqlData("table1", new string[] { "null", s, "*****@*****.**" });
        }

        //测试查询
        if (Input.GetKeyUp(KeyCode.Q))
        {
            Debug.Log("Query");
            //GEditorDataMgr.QueryKVSqlData("table1",new string[]{"ID","Name","Email"},1);
        }

        //测试修改
        if (Input.GetKeyUp(KeyCode.M))
        {
            Debug.Log("Motify");
            GEditorDataMgr.ModifyKVSqlData("table1", new string[] { "Name" }, new string[] { "'f**k'" }, 1);
        }

        //测试删除
        if (Input.GetKeyUp(KeyCode.D))
        {
            Debug.Log("Del");
            GEditorDataMgr.DelKVSqlData("table1", 1);
        }

        //测试copy
//		if(Input.GetKeyUp(KeyCode.P))
//		{
//			Debug.Log ("Copy");
//			string s = "INSERT INTO table1 SELECT * FROM table1";
//			SQLiteHelper.GetIns ().ExecuteQuery (s);
//		}
    }