• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Common.Charset类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: MarshalManagedToNative

		public static IntPtr MarshalManagedToNative(Charset charset, Descriptor descriptor)
		{
			// Set up XSQLDA structure
			var xsqlda = new XSQLDA
			{
				version = descriptor.Version,
				sqln = descriptor.Count,
				sqld = descriptor.ActualCount
			};

			var xsqlvar = new XSQLVAR[descriptor.Count];

			for (var i = 0; i < xsqlvar.Length; i++)
			{
				// Create a	new	XSQLVAR	structure and fill it
				xsqlvar[i] = new XSQLVAR
				{
					sqltype = descriptor[i].DataType,
					sqlscale = descriptor[i].NumericScale,
					sqlsubtype = descriptor[i].SubType,
					sqllen = descriptor[i].Length
				};


				// Create a	new	pointer	for	the	xsqlvar	data
				if (descriptor[i].HasDataType() && descriptor[i].DbDataType != DbDataType.Null)
				{
					var buffer = descriptor[i].DbValue.GetBytes();
					xsqlvar[i].sqldata = Marshal.AllocHGlobal(buffer.Length);
					Marshal.Copy(buffer, 0, xsqlvar[i].sqldata, buffer.Length);
				}
				else
				{
					xsqlvar[i].sqldata = Marshal.AllocHGlobal(0);
				}

				// Create a	new	pointer	for	the	sqlind value
				xsqlvar[i].sqlind = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(short)));
				Marshal.WriteInt16(xsqlvar[i].sqlind, descriptor[i].NullFlag);

				// Name
				xsqlvar[i].sqlname = GetStringBuffer(charset, descriptor[i].Name);
				xsqlvar[i].sqlname_length = (short)descriptor[i].Name.Length;

				// Relation	Name
				xsqlvar[i].relname = GetStringBuffer(charset, descriptor[i].Relation);
				xsqlvar[i].relname_length = (short)descriptor[i].Relation.Length;

				// Owner name
				xsqlvar[i].ownername = GetStringBuffer(charset, descriptor[i].Owner);
				xsqlvar[i].ownername_length = (short)descriptor[i].Owner.Length;

				// Alias name
				xsqlvar[i].aliasname = GetStringBuffer(charset, descriptor[i].Alias);
				xsqlvar[i].aliasname_length = (short)descriptor[i].Alias.Length;
			}

			return MarshalManagedToNative(xsqlda, xsqlvar);
		}
开发者ID:mrgleba,项目名称:FirebirdSql.Data.FirebirdClient,代码行数:59,代码来源:XsqldaMarshaler.cs


示例2: GdsConnection

        public GdsConnection(string dataSource, int portNumber, int packetSize, Charset characterSet)
        {
            this.dataSource = dataSource;
            this.portNumber = portNumber;
            this.packetSize = packetSize;
            this.characterSet = characterSet;

            GC.SuppressFinalize(this);
        }
开发者ID:antgraf,项目名称:Embedded-DB-.Net-Performance-Test,代码行数:9,代码来源:GdsConnection.cs


示例3: ExtDatabase

        public ExtDatabase()
        {
            this.charset = Charset.DefaultCharset;
            this.dialect = 3;
            this.packetSize = 8192;
            this.statusVector = new int[IscCodes.ISC_STATUS_LENGTH];

            GC.SuppressFinalize(this);
        }
开发者ID:kingpong,项目名称:NETProvider,代码行数:9,代码来源:ExtDatabase.cs


示例4: XdrStream

        public XdrStream(Stream innerStream, Charset charset)
            : base()
        {
            this.innerStream = innerStream;
            this.charset = charset;
            this.ResetOperation();

            GC.SuppressFinalize(innerStream);
        }
开发者ID:kingpong,项目名称:NETProvider,代码行数:9,代码来源:XdrStream.cs


示例5: FesDatabase

        public FesDatabase(string dllName, Charset charset)
        {
            this.fbClient = FbClientFactory.GetFbClient(dllName);
            this.charset = (charset != null ? charset : Charset.DefaultCharset);
            this.dialect = 3;
            this.packetSize = 8192;
            this.statusVector = new IntPtr[IscCodes.ISC_STATUS_LENGTH];

            GC.SuppressFinalize(this);
        }
开发者ID:kingpong,项目名称:NETProvider,代码行数:10,代码来源:FesDatabase.cs


示例6: Connect

		public void Connect(string dataSource, int port, int packetSize, Charset charset)
		{
			try
			{
				IPAddress hostadd = Dns.Resolve(dataSource).AddressList[0];
				IPEndPoint EPhost = new IPEndPoint(hostadd, port);

				this.socket = new Socket(
					AddressFamily.InterNetwork,
					SocketType.Stream,
					ProtocolType.Tcp);

#if (!NETCF)

				// Set Receive Buffer size.
				this.socket.SetSocketOption(
					SocketOptionLevel.Socket,
					SocketOptionName.ReceiveBuffer,
					packetSize);

				// Set Send	Buffer size.
				this.socket.SetSocketOption(
					SocketOptionLevel.Socket,
					SocketOptionName.SendBuffer,
					packetSize);
#endif

				// Disables	the	Nagle algorithm	for	send coalescing.
				this.socket.SetSocketOption(
					SocketOptionLevel.Tcp,
					SocketOptionName.NoDelay,
					1);

				// Make	the	socket to connect to the Server
				this.socket.Connect(EPhost);
				this.networkStream = new NetworkStream(this.socket, true);

#if	(NETCF)
				this.send	 = new XdrStream(this.networkStream, charset);
				this.receive = new XdrStream(this.networkStream, charset);
#else
				this.send = new XdrStream(new BufferedStream(this.networkStream), charset);
				this.receive = new XdrStream(new BufferedStream(this.networkStream), charset);
#endif

				GC.SuppressFinalize(this.socket);
				GC.SuppressFinalize(this.networkStream);
				GC.SuppressFinalize(this.send);
				GC.SuppressFinalize(this.receive);
			}
			catch (SocketException)
			{
				throw new IscException(IscCodes.isc_arg_gds, IscCodes.isc_network_error, dataSource);
			}
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:55,代码来源:GdsConnection.cs


示例7: GdsDatabase

        public GdsDatabase(GdsConnection connection)
        {
            this.connection = connection;
            this.charset = Charset.DefaultCharset;
            this.dialect = 3;
            this.packetSize = 8192;
            this.inputStream = this.connection.CreateXdrStream();
            this.outputStream = this.connection.CreateXdrStream();

            GC.SuppressFinalize(this);
        }
开发者ID:kingpong,项目名称:NETProvider,代码行数:11,代码来源:GdsDatabase.cs


示例8: Add

		internal Charset Add(
			int		id,
			string	charset,
			int		bytesPerCharacter,
			string	systemCharset)
		{
			Charset charSet = new Charset(
				id, charset, bytesPerCharacter, systemCharset);

			return this.Add(charSet);
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:11,代码来源:CharsetCollection.cs


示例9: MarshalManagedToNative

        public IntPtr MarshalManagedToNative(Charset charset, object value)
        {
            DbField field = new DbField();
            ParamDsc descriptor = this.BuildDescriptor(charset, value);
            DbDataType type = TypeHelper.GetTypeFromDsc(descriptor.Type, descriptor.Scale, descriptor.SubType);

            field.DataType          = (short)TypeHelper.GetFbType(type, true);
            field.SubType           = descriptor.SubType;
            field.DbValue.Value     = value;
            field.Length            = descriptor.Length;

            byte[] buffer = field.DbValue.GetBytes();

            descriptor.Data = Marshal.AllocHGlobal(buffer.Length);
            Marshal.Copy(buffer, 0, descriptor.Data, buffer.Length);

            return this.MarshalManagedToNative(descriptor);
        }
开发者ID:antgraf,项目名称:Embedded-DB-.Net-Performance-Test,代码行数:18,代码来源:ParamDscMarshaler.cs


示例10: FesDatabase

		public FesDatabase(string dllName, Charset charset)
		{
			_fbClient = FbClientFactory.GetFbClient(dllName);
			_charset = (charset != null ? charset : Charset.DefaultCharset);
			_dialect = 3;
			_packetSize = 8192;
			_statusVector = new IntPtr[IscCodes.ISC_STATUS_LENGTH];
		}
开发者ID:mrgleba,项目名称:FirebirdSql.Data.FirebirdClient,代码行数:8,代码来源:FesDatabase.cs


示例11: MarshalManagedToNative

		public IntPtr MarshalManagedToNative(Charset charset, Descriptor descriptor)
		{
			// Set up XSQLDA structure
			XSQLDA xsqlda = new XSQLDA();

			xsqlda.version  = descriptor.Version;
			xsqlda.sqln     = descriptor.Count;
			xsqlda.sqld     = descriptor.ActualCount;

			XSQLVAR[] xsqlvar = new XSQLVAR[descriptor.Count];

			for (int i = 0; i < xsqlvar.Length; i++)
			{
				// Create a	new	XSQLVAR	structure and fill it
				xsqlvar[i] = new XSQLVAR();

				xsqlvar[i].sqltype      = descriptor[i].DataType;
				xsqlvar[i].sqlscale     = descriptor[i].NumericScale;
				xsqlvar[i].sqlsubtype   = descriptor[i].SubType;
				xsqlvar[i].sqllen       = descriptor[i].Length;

				// Create a	new	pointer	for	the	xsqlvar	data
				byte[] buffer = descriptor[i].DbValue.GetBytes();
				xsqlvar[i].sqldata = Marshal.AllocHGlobal(buffer.Length);
				Marshal.Copy(buffer, 0, xsqlvar[i].sqldata, buffer.Length);

				// Create a	new	pointer	for	the	sqlind value
				xsqlvar[i].sqlind = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(Int16)));
				Marshal.WriteInt16(xsqlvar[i].sqlind, descriptor[i].NullFlag);

				// Name
				xsqlvar[i].sqlname = this.GetStringBuffer(charset, descriptor[i].Name);
				xsqlvar[i].sqlname_length = (short)descriptor[i].Name.Length;

				// Relation	Name
				xsqlvar[i].relname = this.GetStringBuffer(charset, descriptor[i].Relation);
				xsqlvar[i].relname_length = (short)descriptor[i].Relation.Length;

				// Owner name
				xsqlvar[i].ownername = this.GetStringBuffer(charset, descriptor[i].Owner);
				xsqlvar[i].ownername_length = (short)descriptor[i].Owner.Length;

				// Alias name
				xsqlvar[i].aliasname = this.GetStringBuffer(charset, descriptor[i].Alias);
				xsqlvar[i].aliasname_length = (short)descriptor[i].Alias.Length;
			}

			return this.MarshalManagedToNative(xsqlda, xsqlvar);
		}
开发者ID:robsoft,项目名称:FirebirdMonoDroidProvider,代码行数:49,代码来源:XsqldaMarshaler.cs


示例12: ReadString

		public string ReadString(Charset charset)
		{
			return this.ReadString(charset, this.ReadInt32());
		}
开发者ID:antgraf,项目名称:Embedded-DB-.Net-Performance-Test,代码行数:4,代码来源:XdrStream.cs


示例13: MarshalNativeToManaged

		public static Descriptor MarshalNativeToManaged(Charset charset, IntPtr pNativeData, bool fetching)
		{
			// Obtain XSQLDA information
			var xsqlda = (XSQLDA)Marshal.PtrToStructure(pNativeData, typeof(XSQLDA));

			// Create a	new	Descriptor
			var descriptor = new Descriptor(xsqlda.sqln) { ActualCount = xsqlda.sqld };

			// Obtain XSQLVAR members information
			var xsqlvar = new XSQLVAR();
			for (var i = 0; i < xsqlda.sqln; i++)
			{
				var ptr = GetIntPtr(pNativeData, ComputeLength(i));
				MarshalXSQLVARNativeToManaged(ptr, xsqlvar);

				// Map XSQLVAR information to Descriptor
				descriptor[i].DataType = xsqlvar.sqltype;
				descriptor[i].NumericScale = xsqlvar.sqlscale;
				descriptor[i].SubType = xsqlvar.sqlsubtype;
				descriptor[i].Length = xsqlvar.sqllen;

				// Decode sqlind value
				descriptor[i].NullFlag = xsqlvar.sqlind == IntPtr.Zero
					? (short)0
					: Marshal.ReadInt16(xsqlvar.sqlind);

				// Set value
				if (fetching)
				{
					if (descriptor[i].NullFlag != -1)
					{
						descriptor[i].SetValue(GetBytes(xsqlvar));
					}
				}

				descriptor[i].Name = GetString(charset, xsqlvar.sqlname, xsqlvar.sqlname_length);
				descriptor[i].Relation = GetString(charset, xsqlvar.relname, xsqlvar.relname_length);
				descriptor[i].Owner = GetString(charset, xsqlvar.ownername, xsqlvar.ownername_length);
				descriptor[i].Alias = GetString(charset, xsqlvar.aliasname, xsqlvar.aliasname_length);
			}

			return descriptor;
		}
开发者ID:mrgleba,项目名称:FirebirdSql.Data.FirebirdClient,代码行数:43,代码来源:XsqldaMarshaler.cs


示例14: GetStringBuffer

		private byte[] GetStringBuffer(Charset charset, string value)
		{
			byte[] buffer = new byte[32];

			charset.GetBytes(value, 0, value.Length, buffer, 0);

			return buffer;
		}
开发者ID:robsoft,项目名称:FirebirdMonoDroidProvider,代码行数:8,代码来源:XsqldaMarshaler.cs


示例15: BuildDescriptor

        private ParamDsc BuildDescriptor(Charset charset, object value)
        {
            ParamDsc descriptor = new ParamDsc();

            if (value == null || value == DBNull.Value)
            {
                descriptor.Flags |= IscCodes.DSC_null;
            }
            else
            {
                this.SetDscType(ref descriptor, value);
            }

            if (descriptor.Type == IscCodes.dtype_cstring || descriptor.Type == IscCodes.dtype_varying)
            {
                descriptor.SubType = (short)charset.Identifier;
            }

            return descriptor;
        }
开发者ID:antgraf,项目名称:Embedded-DB-.Net-Performance-Test,代码行数:20,代码来源:ParamDscMarshaler.cs


示例16: XdrStream

		public XdrStream(byte[] buffer, Charset charset)
			: this(new MemoryStream(buffer), charset)
		{ }
开发者ID:antgraf,项目名称:Embedded-DB-.Net-Performance-Test,代码行数:3,代码来源:XdrStream.cs


示例17: GetValue

        private object GetValue(ParamDsc descriptor, Charset charset)
        {
            DbField field = new DbField();

            if (descriptor.Type == dtype_null)
            {
                return null;
            }
            if (descriptor.Type == IscCodes.dtype_byte)
            {
                return null;
            }

            DbDataType dbType = TypeHelper.GetTypeFromDsc(descriptor.Type, descriptor.Scale, descriptor.SubType);

            field.DataType      = (short)TypeHelper.GetFbType(dbType, true);
            field.NumericScale  = descriptor.Scale;
            field.SubType       = descriptor.SubType;

            byte[] data = this.GetBytes(descriptor, field.DataType);

            field.SetValue(data);

            return field.Value;
        }
开发者ID:antgraf,项目名称:Embedded-DB-.Net-Performance-Test,代码行数:25,代码来源:ParamDscMarshaler.cs


示例18: MarshalNativeToManaged

        public object MarshalNativeToManaged(Charset charset, IntPtr pNativeData)
        {
            // Obtain ParamDsc information
            ParamDsc descriptor = (ParamDsc)Marshal.PtrToStructure(pNativeData, typeof(ParamDsc));

            return this.GetValue(descriptor, charset);
        }
开发者ID:antgraf,项目名称:Embedded-DB-.Net-Performance-Test,代码行数:7,代码来源:ParamDscMarshaler.cs


示例19: MarshalNativeToManaged

		public Descriptor MarshalNativeToManaged(Charset charset, IntPtr pNativeData)
		{
			return this.MarshalNativeToManaged(charset, pNativeData, false);
		}
开发者ID:robsoft,项目名称:FirebirdMonoDroidProvider,代码行数:4,代码来源:XsqldaMarshaler.cs


示例20: GetString

		private static string GetString(Charset charset, byte[] buffer, short bufferLength)
		{
			return charset.GetString(buffer, 0, bufferLength);
		}
开发者ID:mrgleba,项目名称:FirebirdSql.Data.FirebirdClient,代码行数:4,代码来源:XsqldaMarshaler.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Common.Descriptor类代码示例发布时间:2022-05-24
下一篇:
C# FireSpider.ConvertSetting类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap