Example #1
0
        private void AddParam(InserterParam iparam)
        {
            var textParams = iparam as TextParams;

            if (textParams != null)
            {
                _textParams.Add(textParams);

                _currentCmdText += _currentAmount == 0 ? _cmdText : ",";
                _currentCmdText += $" (?, ?, ?, ?, {_clientDatId})";

                _currentAmount++;
                return;
            }

            var binParams = iparam as BinParams;

            if (binParams != null)
            {
                _binParams.Add(binParams);

                _currentCmdText += _currentAmount == 0 ? _cmdText : ",";
                _currentCmdText += $" (@id_{_currentAmount}, @data_{_currentAmount}, {_clientDatId})";

                _currentAmount++;
            }
        }
Example #2
0
        public void Push(InserterParam iparam)
        {
            lock (PushObj)
            {
                var incomingSize = iparam.TotalSize;
                var expectedSize = _currentSize + incomingSize;

                if (expectedSize > Size)
                {
                    Flush();
                }

                _currentSize = expectedSize;

                AddParam(iparam);

                if (_currentAmount == Amount)
                {
                    Flush();
                }
            }
        }