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


C# MySqlStream.WriteStringNoNull方法代码示例

本文整理汇总了C#中MySql.Data.MySqlClient.MySqlStream.WriteStringNoNull方法的典型用法代码示例。如果您正苦于以下问题:C# MySqlStream.WriteStringNoNull方法的具体用法?C# MySqlStream.WriteStringNoNull怎么用?C# MySqlStream.WriteStringNoNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MySql.Data.MySqlClient.MySqlStream的用法示例。


在下文中一共展示了MySqlStream.WriteStringNoNull方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: WriteValue

		public void WriteValue(MySqlStream stream, bool binary, object value, int length)
		{
			ulong v = Convert.ToUInt64(value);
			if (binary)
				stream.Write(BitConverter.GetBytes(v));
			else
				stream.WriteStringNoNull(v.ToString());
		}
开发者ID:maanshancss,项目名称:ClassLibrary,代码行数:8,代码来源:MySqlBit.cs

示例2:

		void IMySqlValue.WriteValue(MySqlStream stream, bool binary, object val, int length)
		{
			int v = Convert.ToInt32(val);
			if (binary)
				stream.Write(BitConverter.GetBytes(v));
			else
				stream.WriteStringNoNull(v.ToString());
		}
开发者ID:tdhieu,项目名称:openvss,代码行数:8,代码来源:MySqlInt16.cs

示例3:

 void IMySqlValue.WriteValue(MySqlStream stream, bool binary, object val, int length)
 {
     Single v = Convert.ToSingle(val);
     if (binary)
         stream.Write(BitConverter.GetBytes(v));
     else
         stream.WriteStringNoNull(v.ToString("R",
              CultureInfo.InvariantCulture));
 }
开发者ID:rykr,项目名称:connector-net,代码行数:9,代码来源:MySqlSingle.cs

示例4: Serialize

        internal void Serialize(MySqlStream stream, bool binary)
        {
            IMySqlValue v = MySqlField.GetIMySqlValue(mySqlDbType);

            if (!binary && (paramValue == null || paramValue == DBNull.Value))
                stream.WriteStringNoNull("NULL");
            else
                v.WriteValue(stream, binary, paramValue, size);
        }
开发者ID:tdhieu,项目名称:openvss,代码行数:9,代码来源:parameter.cs

示例5: MySqlException

		void IMySqlValue.WriteValue(MySqlStream stream, bool binary, object val, int length)
		{
			if (!(val is TimeSpan))
				throw new MySqlException("Only TimeSpan objects can be serialized by MySqlTimeSpan");

			TimeSpan ts = (TimeSpan)val;
			if (binary)
			{
				stream.WriteByte(8);
				stream.WriteByte((byte)(ts.TotalSeconds < 0 ? 1 : 0));
				stream.WriteInteger(ts.Days, 4);
				stream.WriteByte((byte)ts.Hours);
				stream.WriteByte((byte)ts.Minutes);
				stream.WriteByte((byte)ts.Seconds);
			}
			else
			{
				stream.WriteStringNoNull(String.Format("'{0} {1:00}:{2:00}:{3:00}.{4}'",
			  ts.Days, ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds));
			}
		}
开发者ID:maanshancss,项目名称:ClassLibrary,代码行数:21,代码来源:MySqlTime.cs

示例6: EscapeString

		void IMySqlValue.WriteValue(MySqlStream stream, bool binary, object val, int length)
		{
			string v = val.ToString();
            if (length > 0)
            {
                length = Math.Min(length, v.Length);
                v = v.Substring(0, length);
            }

			if (binary)
				stream.WriteLenString(v);
			else
				stream.WriteStringNoNull("'" + EscapeString(v) + "'");
		}
开发者ID:maanshancss,项目名称:ClassLibrary,代码行数:14,代码来源:MySqlString.cs

示例7:

		void IMySqlValue.WriteValue(MySqlStream stream, bool binary, object val, int length)
		{
			sbyte v = ((IConvertible)val).ToSByte(null);
            if (binary)
                stream.WriteByte((byte)v);
            else
                stream.WriteStringNoNull(v.ToString());
        }
开发者ID:tdhieu,项目名称:openvss,代码行数:8,代码来源:MySqlByte.cs

示例8:

		void IMySqlValue.WriteValue(MySqlStream stream, bool binary, object val, int length)
		{
			decimal v = Convert.ToDecimal(val);
			string valStr = v.ToString(CultureInfo.InvariantCulture);
			if (binary)
				stream.WriteLenString(valStr);
			else
				stream.WriteStringNoNull(valStr);
		}
开发者ID:maanshancss,项目名称:ClassLibrary,代码行数:9,代码来源:MySqlDecimal.cs

示例9: SerializeText

		private void SerializeText(MySqlStream stream, MySqlDateTime value)
		{
			string val = String.Empty;

			if (type == MySqlDbType.Timestamp && !stream.Version.isAtLeast(4, 1, 0))
				val = String.Format("{0:0000}{1:00}{2:00}{3:00}{4:00}{5:00}",
					value.Year, value.Month, value.Day, value.Hour, value.Minute, value.Second);
			else
			{
				val = String.Format("{0:0000}-{1:00}-{2:00}",
                    value.Year, value.Month, value.Day);
                if (type != MySqlDbType.Date)
                    val = String.Format("{0}  {1:00}:{2:00}:{3:00}", val,
                        value.Hour, value.Minute, value.Second);
			}
			stream.WriteStringNoNull("'" + val + "'");
		}
开发者ID:maanshancss,项目名称:ClassLibrary,代码行数:17,代码来源:MySqlDateTime.cs

示例10: if

        void IMySqlValue.WriteValue(MySqlStream stream, bool binary, object val, int length)
        {
            byte[] buffToWrite = null;

            if (val is System.Byte[])
                buffToWrite = (byte[])val;
            else if (val is Char[])
                buffToWrite = stream.Encoding.GetBytes(val as char[]);
            else
            {
                string s = val.ToString();
                if (length == 0)
                    length = s.Length;
                else
                    s = s.Substring(0, length);
                buffToWrite = stream.Encoding.GetBytes(s);
            }

            // we assume zero length means write all of the value
            if (length == 0)
                length = buffToWrite.Length;

            if (buffToWrite == null)
                throw new MySqlException("Only byte arrays and strings can be serialized by MySqlBinary");

            if (binary)
            {
                stream.WriteLength(length);
                stream.Write(buffToWrite, 0, length);
            }
            else
            {
                if (stream.Version.isAtLeast(4, 1, 0))
                    stream.WriteStringNoNull("_binary ");

                stream.WriteByte((byte)'\'');
                EscapeByteArray(buffToWrite, length, stream);
                stream.WriteByte((byte)'\'');
            }
        }
开发者ID:rykr,项目名称:connector-net,代码行数:40,代码来源:MySqlBinary.cs


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