예제 #1
0
        /// <summary>
        ///  Prepares current <see cref="MsSqlDataCommand"/> to execute.
        /// </summary>
        /// <param name="connection"><see cref="MsSqlDataConnection"/> to use.</param>
        internal void Prepare(ref MsSqlDataConnection connection)
        {
            m_Connection      = connection;
            m_Connection.Idle = false;

            m_Command             = new SqlCommand(m_CommandText, connection.SqlServerConnection);
            m_Command.CommandType = m_CommandType;

            if (m_Parameters != null)
            {
                m_Command.Parameters.AddRange(m_Parameters);
            }

            m_Command.Prepare();
        }
예제 #2
0
        /// <summary>
        /// Start lazy cache dump <see cref="Thread"/>.
        /// </summary>
        /// <param name="q"><see cref="MsSqlDataCommand"/> objects array.</param>
        private void LazyQueue_DumpHandlerThread( object q )
        {
            MsSqlDataConnection connection = new MsSqlDataConnection(this, byte.MaxValue, true);

            MsSqlDataCommand[] queue = ( MsSqlDataCommand[] )q;

            for ( int i = 0; i < queue.Length; i++ )
            {
                MsSqlDataCommand msdc = queue[i];

                SetConnection(ref msdc, connection);

                msdc.ExecuteNonQuery();

                ReleaseCommand(msdc);
            }

            queue = null;

            connection.Close(false);
            connection.Dispose();
            connection = null;
        }
예제 #3
0
 /// <summary>
 /// Sets <see cref="MsSqlDataConnection"/> reference to provided <see cref="MsSqlDataCommand"/> object and prepares it.
 /// </summary>
 /// <param name="msdc"><see cref="MsSqlDataCommand"/> object.</param>
 /// <param name="connection"><see cref="MsSqlDataConnection"/> to reference.</param>
 private static void SetConnection( ref MsSqlDataCommand msdc, MsSqlDataConnection connection )
 {
     msdc.Prepare(ref connection);
 }