當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。