예제 #1
0
    public void AddThreadNodule(AThreadNodule p_threadNodule)
    {
        if (_listThreadNodules == null)
        {
            _listThreadNodules = new List <AThreadNodule>();
        }

        _listThreadNodules.Add(p_threadNodule);
    }
예제 #2
0
    protected void UpdateListOfDataAsync(List <Dictionary <string, string> > p_listDictData, string p_tableName, string[] p_arrayWhereKeys, Action p_callbackFinish)
    {
        AThreadNodule __threadNodule = null;

        __threadNodule = AThread.StartNewThread(delegate
        {
            OpenDatabaseConnection();
            using (_dbTransaction = _dbConnection.BeginTransaction())
            {
                using (_dbCommand = _dbConnection.CreateCommand())
                {
                    _dbCommand.Connection  = _dbConnection;
                    _dbCommand.Transaction = _dbTransaction;
                    try
                    {
                        for (int i = 0; i < p_listDictData.Count; i++)
                        {
                            Dictionary <string, string> __dictRowEntries = new Dictionary <string, string>();
                            foreach (var k_key in p_listDictData[i].Keys)
                            {
                                __dictRowEntries.Add(k_key, p_listDictData[i][k_key]);
                            }
                            UpdateDataOnTable(__dictRowEntries, p_tableName, p_arrayWhereKeys);
                        }
                        _dbTransaction.Commit();
                    }
                    catch (Exception __sqliteException)
                    {
                        Debug.LogError("Sqlite Exception: " + __sqliteException);
                        _dbTransaction.Rollback();
                    }
                }
            }
            _dbConnection.Close();
            if (_cancelDataRequest == true)
            {
                _dbConnection.Close();
                __threadNodule.CancelThread(delegate
                {
                    if (_callbackCancelDataRequest != null)
                    {
                        _callbackCancelDataRequest();
                    }
                });
            }
        }, p_callbackFinish);
    }