/// <summary> /// 创建SQL /// </summary> /// <param name="expression">委托关联表达式</param> /// <returns>SQL表达式</returns> internal unsafe string Create(TmphLambdaExpression expression) { var TmphBuffer = TmphClient.SqlBuffers.Get(); try { using (stream = new TmphCharStream(TmphBuffer.Char, TmphClient.SqlBufferSize)) { create(expression, stream); return stream.ToString(); } } finally { TmphClient.SqlBuffers.Push(ref TmphBuffer); } }
/// <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); } }