Npgsql.NpgsqlCommand.ExecuteBlind C# (CSharp) Method

ExecuteBlind() private static method

private static ExecuteBlind ( NpgsqlConnector connector, NpgsqlQuery query, int timeout ) : void
connector NpgsqlConnector
query NpgsqlQuery
timeout int
return void
        private static void ExecuteBlind(NpgsqlConnector connector, NpgsqlQuery query, int timeout)
        {
            // Block the notification thread before writing anything to the wire.
            using (var blocker = connector.BlockNotificationThread())
            {
                // Set statement timeout as needed.
                connector.SetBackendCommandTimeout(timeout);

                // Write the Query message to the wire.
                connector.Query(query);

                // Flush, and wait for and discard all responses.
                connector.ProcessAndDiscardBackendResponses();
            }
        }

Same methods

NpgsqlCommand::ExecuteBlind ( NpgsqlConnector connector, byte command, int timeout = 20 ) : void
NpgsqlCommand::ExecuteBlind ( NpgsqlConnector connector, string command, int timeout = 20 ) : void

Usage Example

Beispiel #1
0
        /// <summary>
        /// This method is responsible to release all portals used by this Connector.
        /// </summary>
        internal void ReleasePlansPortals()
        {
            Int32 i = 0;

            if (_planIndex > 0)
            {
                for (i = 1; i <= _planIndex; i++)
                {
                    try
                    {
                        //Query(new NpgsqlCommand(String.Format("deallocate \"{0}\";", _planNamePrefix + i), this));
                        using (NpgsqlCommand cmd = new NpgsqlCommand(String.Format("deallocate \"{0}\";", _planNamePrefix + i.ToString()), this))
                        {
                            cmd.ExecuteBlind();
                        }
                    }

                    // Ignore any error which may occur when releasing portals as this portal name may not be valid anymore. i.e.: the portal name was used on a prepared query which had errors.
                    catch (Exception) {}
                }
            }

            _portalIndex = 0;
            _planIndex   = 0;
        }
All Usage Examples Of Npgsql.NpgsqlCommand::ExecuteBlind