当前位置: 首页>>代码示例>>C#>>正文


C# Npgsql.NpgsqlConnector类代码示例

本文整理汇总了C#中Npgsql.NpgsqlConnector的典型用法代码示例。如果您正苦于以下问题:C# NpgsqlConnector类的具体用法?C# NpgsqlConnector怎么用?C# NpgsqlConnector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


NpgsqlConnector类属于Npgsql命名空间,在下文中一共展示了NpgsqlConnector类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Parse

 public override void Parse(NpgsqlConnector context, NpgsqlParse parse)
 {
     NpgsqlEventLog.LogMethodEnter(LogLevel.Debug, CLASSNAME, "Parse");
     BufferedStream stream = new BufferedStream(context.Stream);
     parse.WriteToStream(stream, context.Encoding);
     stream.Flush();
 }
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:7,代码来源:NpgsqlReadyState.cs

示例2: Authenticate

        public override void Authenticate(NpgsqlConnector context, byte[] password)
        {
            NpgsqlEventLog.LogMethodEnter(LogLevel.Debug, CLASSNAME, "Authenticate");
            NpgsqlPasswordPacket pwpck = new NpgsqlPasswordPacket(password);

            pwpck.WriteToStream(context.Stream);
        }
开发者ID:baondp,项目名称:Npgsql,代码行数:7,代码来源:NpgsqlStartupState.cs

示例3: CancelRequest

        public override void CancelRequest(NpgsqlConnector context)
        {
            NpgsqlCancelRequest CancelRequestMessage = new NpgsqlCancelRequest(context.BackEndKeyData);

            CancelRequestMessage.WriteToStream(context.Stream);
            context.Stream.Flush();
        }
开发者ID:NoeGarcia,项目名称:Npgsql,代码行数:7,代码来源:NpgsqlConnectedState.cs

示例4: Open

        public override void Open(NpgsqlConnector context)
        {
            NpgsqlEventLog.LogMethodEnter(LogLevel.Debug, CLASSNAME, "Open");

            TcpClient tcpc = new TcpClient();
            tcpc.Connect(new IPEndPoint(ResolveIPHost(context.Host), context.Port));
            Stream stream = tcpc.GetStream();

            // If the PostgreSQL server has SSL connectors enabled Open SslClientStream if (response == 'S') {
            if (context.SSL)
            {
                PGUtil.WriteInt32(stream, 8);
                PGUtil.WriteInt32(stream,80877103);
                // Receive response
                Char response = (Char)stream.ReadByte();
                if (response == 'S')
                {
                    stream = new SslClientStream(
                                 tcpc.GetStream(),
                                 context.Host,
                                 true,
                                 Mono.Security.Protocol.Tls.SecurityProtocolType.Default
                             );

                    ((SslClientStream)stream).ClientCertSelectionDelegate = new CertificateSelectionCallback(context.DefaultCertificateSelectionCallback);
                    ((SslClientStream)stream).ServerCertValidationDelegate = new CertificateValidationCallback(context.DefaultCertificateValidationCallback);
                    ((SslClientStream)stream).PrivateKeyCertSelectionDelegate = new PrivateKeySelectionCallback(context.DefaultPrivateKeySelectionCallback);
                }
            }

            context.Stream = stream;

            NpgsqlEventLog.LogMsg(resman, "Log_ConnectedTo", LogLevel.Normal, context.Host, context.Port);
            ChangeState(context, NpgsqlConnectedState.Instance);
        }
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:35,代码来源:NpgsqlClosedState.cs

示例5: SyncEnum

		public override IEnumerable<IServerResponseObject> SyncEnum(NpgsqlConnector context)
		{
			NpgsqlEventLog.LogMethodEnter(LogLevel.Debug, CLASSNAME, "Sync");
			_syncMessage.WriteToStream(context.Stream);
			context.Stream.Flush();
			return ProcessBackendResponsesEnum(context);
		}
开发者ID:Orvid,项目名称:SQLInterfaceCollection,代码行数:7,代码来源:NpgsqlReadyState.cs

示例6: Close

        public override void Close(NpgsqlConnector context)
        {
            NpgsqlEventLog.LogMethodEnter(LogLevel.Debug, CLASSNAME, "Close");
            Stream stream = context.Stream;
            try
            {
                stream.WriteByte((byte) FrontEndMessageCode.Termination);
                if (context.BackendProtocolVersion >= ProtocolVersion.Version3)
                {
                    PGUtil.WriteInt32(stream, 4);
                }
                stream.Flush();
            }
            catch
            {
                //Error writting termination message to stream, nothing we can do.
            }

            try
            {
                stream.Close();
            }
            catch
            {
            }

            context.Stream = null;
            ChangeState(context, NpgsqlClosedState.Instance);
        }
开发者ID:jasonabi,项目名称:Npgsql2,代码行数:29,代码来源:NpgsqlReadyState.cs

示例7: SendCopyData

 /// <summary>
 /// Sends given packet to server as a CopyData message.
 /// Does not check for notifications! Use another thread for that.
 /// </summary>
 public override void SendCopyData(NpgsqlConnector context, byte[] buf, int off, int len)
 {
     Stream toServer = context.Stream;
     toServer.WriteByte((byte) FrontEndMessageCode.CopyData);
     PGUtil.WriteInt32(toServer, len + 4);
     toServer.Write(buf, off, len);
 }
开发者ID:zapov,项目名称:Npgsql2,代码行数:11,代码来源:NpgsqlCopyInState.cs

示例8: Authenticate

		public override void Authenticate(NpgsqlConnector context, string password)
		{
			NpgsqlEventLog.LogMethodEnter(LogLevel.Debug, CLASSNAME, "Authenticate");
			NpgsqlPasswordPacket pwpck = new NpgsqlPasswordPacket(password, context.BackendProtocolVersion);
			BufferedStream stream = new BufferedStream(context.Stream);
			pwpck.WriteToStream(stream);
			stream.Flush();
		}
开发者ID:Orvid,项目名称:SQLInterfaceCollection,代码行数:8,代码来源:NpgsqlStartupState.cs

示例9: Parse

		public override void Parse(NpgsqlConnector context, NpgsqlParse parse)
		{
			NpgsqlEventLog.LogMethodEnter(LogLevel.Debug, CLASSNAME, "Parse");

			Stream stream = context.Stream;
			parse.WriteToStream(stream);
			//stream.Flush();
		}
开发者ID:Orvid,项目名称:SQLInterfaceCollection,代码行数:8,代码来源:NpgsqlReadyState.cs

示例10: Startup

        public override void Startup(NpgsqlConnector context,NpgsqlConnectionStringBuilder settings)
        {
            NpgsqlStartupPacket startupPacket = new NpgsqlStartupPacket(context.Database, context.UserName, settings);

            startupPacket.WriteToStream(context.Stream);
            context.RequireReadyForQuery = false;

            ProcessAndDiscardBackendResponses(context);
        }
开发者ID:baondp,项目名称:Npgsql,代码行数:9,代码来源:NpgsqlConnectedState.cs

示例11: Bind

        public override void Bind(NpgsqlConnector context, NpgsqlBind bind)
        {
            NpgsqlEventLog.LogMethodEnter(LogLevel.Debug, CLASSNAME, "Bind");

            Stream stream = context.Stream;

            bind.WriteToStream(stream);
            //stream.Flush();
        }
开发者ID:jasonabi,项目名称:Npgsql2,代码行数:9,代码来源:NpgsqlReadyState.cs

示例12: GetCopyData

 /// <summary>
 /// Called from NpgsqlOutStream.Read to read copy data from server.
 /// </summary>
 public override byte[] GetCopyData(NpgsqlConnector context)
 {
     // polling in COPY would take seconds on Windows
     foreach (IServerResponseObject obj in ProcessBackendResponses_Ver_3(context))
     {
         if (obj is IDisposable)
         {
             (obj as IDisposable).Dispose();
         }
     }
     return context.Mediator.ReceivedCopyData;
 }
开发者ID:NoeGarcia,项目名称:Npgsql,代码行数:15,代码来源:NpgsqlCopyOutState.cs

示例13: ExecuteBlindSuppressTimeout

        internal static void ExecuteBlindSuppressTimeout(NpgsqlConnector connector, NpgsqlQuery query)
        {
            // Block the notification thread before writing anything to the wire.
            using (var blocker = connector.BlockNotificationThread())
            {
                // Write the Query message to the wire.
                connector.Query(query);

                // Flush, and wait for and discard all responses.
                connector.ProcessAndDiscardBackendResponses();
            }
        }
开发者ID:baondp,项目名称:Npgsql,代码行数:12,代码来源:NpgsqlCommand.PrepareExecute.cs

示例14: Startup

        public override void Startup(NpgsqlConnector context,NpgsqlConnectionStringBuilder settings)
        {
            NpgsqlStartupPacket startupPacket = NpgsqlStartupPacket.BuildStartupPacket(context.BackendProtocolVersion,
                                                                                       context.Database, context.UserName, settings);

            startupPacket.WriteToStream(context.Stream);
            context.RequireReadyForQuery = false;
            // This still makes part of the connection stablishment handling.
            // So we use the connectiontimeout here too.
            context.Mediator.CommandTimeout = context.ConnectionTimeout;
            ProcessAndDiscardBackendResponses(context);
        }
开发者ID:NoeGarcia,项目名称:Npgsql,代码行数:12,代码来源:NpgsqlConnectedState.cs

示例15: Startup

        public override void Startup(NpgsqlConnector context)
        {
            NpgsqlStartupPacket startupPacket = new NpgsqlStartupPacket(296, //Not used.
                                                                        context.BackendProtocolVersion, context.Database,
                                                                        context.UserName, "", "", "");

            startupPacket.WriteToStream(new BufferedStream(context.Stream));
            context.RequireReadyForQuery = false;
            // This still makes part of the connection stablishment handling.
            // So we use the connectiontimeout here too.
            context.Mediator.CommandTimeout = context.ConnectionTimeout;
            context.Stream.Flush();
            ProcessBackendResponses(context);
        }
开发者ID:Qorpent,项目名称:Npgsql2,代码行数:14,代码来源:NpgsqlConnectedState.cs


注:本文中的Npgsql.NpgsqlConnector类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。