/// <summary>
 ///     获取Excel客户端
 /// </summary>
 /// <returns>Excel客户端</returns>
 public unsafe TmphClient GetClient()
 {
     var provider = TmphEnum<EProviderType, THProvider>.Array(Provider);
     var TmphBuffer = Sql.TmphClient.SqlBuffers.Get();
     try
     {
         using (var connectionStream = new TmphCharStream(TmphBuffer.Char, Sql.TmphClient.SqlBufferSize))
         {
             connectionStream.WriteNotNull("Provider=");
             connectionStream.Write(provider.Name);
             connectionStream.WriteNotNull(";Data Source=");
             connectionStream.Write(DataSource);
             if (Password != null)
             {
                 connectionStream.WriteNotNull(";Database Password="******";Extended Properties='");
             connectionStream.Write(provider.Excel);
             connectionStream.WriteNotNull(IsTitleColumn ? ";HDR=YES;IMEX=" : ";HDR=NO;IMEX=");
             connectionStream.WriteNotNull(((byte)Intermixed).toString());
             connectionStream.Write('\'');
             return
                 (TmphClient)
                     new Sql.TmphConnection { Type = TmphType.Excel, Connection = connectionStream.ToString() }.Client;
         }
     }
     finally
     {
         Sql.TmphClient.SqlBuffers.Push(ref TmphBuffer);
     }
 }
 public static void ToString(bool value, TmphCharStream jsonStream)
 {
     jsonStream.Write(value ? '1' : '0');
 }
 /// <summary>
 ///     字节流转换成JSON字符串
 /// </summary>
 /// <param name="jsonStream">JSON输出流,不能为null</param>
 /// <param name="start">起始位置,不能为null</param>
 /// <param name="end">结束位置,长度必须大于0</param>
 public static unsafe void ToJson(TmphCharStream jsonStream, byte* start, byte* end)
 {
     jsonStream.Write('[');
     for (TmphAjax.ToString(*start, jsonStream); ++start != end; TmphAjax.ToString(*start, jsonStream))
         jsonStream.Write(',');
     jsonStream.Write(']');
 }
 public static unsafe void ToString(sbyte value, TmphCharStream jsonStream)
 {
     if (value == 0) jsonStream.Write('0');
     else
     {
         char* chars = stackalloc char[6];
         if (value < 0)
         {
             if (value == -128)
             {
                 jsonStream.PrepLength(4);
                 var unsafeStream = jsonStream.Unsafer;
                 unsafeStream.Write('-');
                 unsafeStream.Write('1');
                 unsafeStream.Write('2');
                 unsafeStream.Write('8');
             }
             else
             {
                 toString((sbyte)-value, chars);
                 jsonStream.Write(chars + 1, 5);
             }
         }
         else
         {
             toString(value, chars);
             jsonStream.Write(chars + 2, 4);
         }
     }
 }
 public static unsafe void ToString(byte value, TmphCharStream jsonStream)
 {
     if (value == 0) jsonStream.Write('0');
     else
     {
         jsonStream.PrepLength(4);
         var data = (byte*)jsonStream.CurrentChar;
         var nextValue = value >> 4;
         *(char*)data = '0';
         *(char*)(data + sizeof(char)) = 'x';
         *(char*)(data + sizeof(char) * 2) =
             (char)(nextValue < 10 ? nextValue + '0' : (nextValue + ('0' + 'A' - '9' - 1)));
         *(char*)(data + sizeof(char) * 3) =
             (char)((value &= 15) < 10 ? value + '0' : (value + ('0' + 'A' - '9' - 1)));
         jsonStream.Unsafer.AddLength(4);
     }
 }
 public static unsafe void ToString(ushort value, TmphCharStream jsonStream)
 {
     char* chars = stackalloc char[8];
     var index = toString(value, chars);
     jsonStream.Write(chars + index.Key, index.Value);
 }
 public static unsafe void ToString(ulong value, TmphCharStream jsonStream, bool isMaxToString = true)
 {
     if (value <= maxValue || !isMaxToString)
     {
         char* chars = stackalloc char[20];
         var index = toString(value, chars);
         jsonStream.Write(chars + index.Key, index.Value);
     }
     else
     {
         var unsafeStraem = jsonStream.Unsafer;
         jsonStream.PrepLength(22);
         unsafeStraem.Write(Quote);
         TmphNumber.ToString(value, jsonStream);
         unsafeStraem.Write(Quote);
     }
 }
 public static void ToString(TmphSubString value, TmphCharStream jsonStream)
 {
     if (value.value == null) WriteNull(jsonStream);
     else
     {
         jsonStream.PrepLength(value.Length + 2);
         jsonStream.Unsafer.Write(Quote);
         jsonStream.Write(value);
         jsonStream.Unsafer.Write(Quote);
     }
 }
 public static void ToString(string value, TmphCharStream jsonStream)
 {
     jsonStream.PrepLength(value.Length() + 2);
     jsonStream.Unsafer.Write(Quote);
     jsonStream.Write(value);
     jsonStream.Unsafer.Write(Quote);
 }
 /// <summary>
 ///     数值转字符串
 /// </summary>
 /// <param name="value">数值</param>
 /// <param name="charStream">字符流</param>
 internal static void ToString(int value, TmphCharStream charStream)
 {
     char* chars = stackalloc char[12];
     var index = toString(value, chars);
     charStream.Write(chars + index.Key, index.Value);
 }