Example #1
0
        public static void T_SimpleInsert_Update()
        {
            var connStr = GetMySqlConnString();
            var conn    = new MySqlConnection(connStr);

            conn.Open();

            {
                string sql = "drop table if exists test001";
                var    cmd = new MySqlCommand(sql, conn);
                cmd.ExecuteNonQuery();
            }

            {
                string sql = "create table test001(first_name varchar(100),last_name varchar(100))";
                var    cmd = new MySqlCommand(sql, conn);
                cmd.ExecuteNonQuery();
            }
            //---------------------------------------------------
            {
                var insert = new SimpleInsert("test001");
                insert.AddWithValue("?first_name", "test1_firstname");
                insert.AddWithValue("?last_name", "test1_last_name");
                insert.ExecuteNonQuery(conn);
            }

            //---------------------------------------------------
            {
                //prepare
                var insert = new SimpleInsert("test001");
                insert.AddWithValue("?first_name", "");
                insert.AddWithValue("?last_name", "");
                insert.Prepare(conn);
                for (int i = 0; i < 10; ++i)
                {
                    insert.ClearValues();
                    insert.AddWithValue("?first_name", "first" + i);
                    insert.AddWithValue("?last_name", "last" + i);
                    insert.ExecuteNonQuery();
                }
            }
            //---------------------------------------------------



            //test update
            //---------------------------------------------------
            {
                var update = new SimpleUpdate("test001");
                update.AddWithValue("?first_name", "update_name");
                update.Where("first_name = 'first0'");
                update.Connection = conn;

                update.ExecuteNonQuery();
            }

            //---------------------------------------------------

            conn.Close();
        }
 private void Update()
 {
     SimpleUpdate?.Invoke();
 }
Example #3
0
    static public void RemoveSimpleUpdatePermanent(SimpleUpdate simpleUpdate)
    {
        timerSystem.permaSimpleUpdates.Remove(simpleUpdate);

    }
Example #4
0
 static public void AddSimpleUpdate(SimpleUpdate simpleUpdate)
 {
     timerSystem.pendingSimple.Add(simpleUpdate);
 }
Example #5
0
 static public void AddSimpleUpdatePermanent(SimpleUpdate simpleUpdate)
 {
     timerSystem.permaSimpleUpdates.Add(simpleUpdate);
 }