| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -416,14 +416,16 @@ namespace Apewer.Source | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                pool = new string[rows]; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                for (int i = 0; i < rows; i++) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    var cell = TextUtility.Trim(query.Text(i)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    var cell = TextUtility.Trim(query.Text(i, 0)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    if (string.IsNullOrEmpty(cell)) continue; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    pool[count] = cell; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    count++; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (count < 1) return new string[0]; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (count == rows) return pool; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            var array = new string[count]; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            Array.Copy(pool, 0, array, 0, count); | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -443,7 +445,7 @@ namespace Apewer.Source | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            using (var query = dbClient.Query(sql)) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                if (!query.Success) throw new SqlException(query, sql); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                var value = TextUtility.Trim(query.Text()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                var value = TextUtility.Trim(query.Text(0, 0)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                return value; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -484,6 +486,42 @@ namespace Apewer.Source | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        /// <summary>执行 SELECT 语句,获取查询结果。</summary>
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        /// <param name="connection">数据库连接。</param>
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        /// <param name="transaction">事务。</param>
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        /// <param name="sql">SQL 语句。</param>
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        /// <param name="parameters">参数。</param>
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        /// <param name="timeout">超时秒数。</param>
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        /// <returns>查询结果。</returns>
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        public static DataTable Query(this IDbConnection connection, IDbTransaction transaction, string sql, IEnumerable<IDbDataParameter> parameters = null, int timeout = 3600) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (connection == null) throw new ArgumentNullException(nameof(connection)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (string.IsNullOrEmpty(sql)) throw new ArgumentNullException(nameof(sql)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (connection.State != ConnectionState.Open) connection.Open(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            using (var command = connection.CreateCommand()) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                if (transaction != null) command.Transaction = transaction; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                if (timeout > 0) command.CommandTimeout = timeout; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                command.CommandText = sql; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                if (parameters != null) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    foreach (var parameter in parameters) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        if (parameter == null) continue; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        command.Parameters.Add(parameter); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                using (var reader = command.ExecuteReader()) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    var table = new DataTable(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    table.Load(reader); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    return table; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        #endregion
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        #region Execute
 | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -522,6 +560,38 @@ namespace Apewer.Source | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        /// <summary>执行 SQL 语句,获取影响的行数。</summary>
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        /// <param name="connection">数据库连接。</param>
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        /// <param name="transaction">事务。</param>
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        /// <param name="sql">SQL 语句。</param>
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        /// <param name="parameters">参数。</param>
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        /// <param name="timeout">超时秒数。</param>
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        /// <returns>行数。</returns>
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        public static int Execute(this IDbConnection connection, IDbTransaction transaction, string sql, IEnumerable<IDbDataParameter> parameters = null, int timeout = 3600) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (connection == null) throw new ArgumentNullException(nameof(connection)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (string.IsNullOrEmpty(sql)) throw new ArgumentNullException(nameof(sql)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (connection.State != ConnectionState.Open) connection.Open(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            using (var command = connection.CreateCommand()) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                if (transaction != null) command.Transaction = transaction; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                if (timeout > 0) command.CommandTimeout = timeout; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                command.CommandText = sql; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                if (parameters != null) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    foreach (var parameter in parameters) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        if (parameter == null) continue; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        command.Parameters.Add(parameter); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                var rows = command.ExecuteNonQuery(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                return rows; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        #endregion
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        #region Transaction
 | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -1024,37 +1094,37 @@ namespace Apewer.Source | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        /// <summary>获取默认表中指定单元格的内容。从第 0 行第 0 列开始。</summary>
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        public static Class<DateTime> DateTime(this DataTable table, int row = 0, int column = 0) => table == null ? null : ClockUtility.DateTime(table.Value(row, column)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        public static Class<DateTime> DateTime(this DataTable table, int row, int column) => table == null ? null : ClockUtility.DateTime(table.Value(row, column)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        /// <summary>获取默认表中指定单元格的内容。从第 0 行开始。</summary>
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        public static Class<DateTime> DateTime(this DataTable table, int row, string column) => table == null ? null : ClockUtility.DateTime(table.Value(row, column)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        /// <summary>获取默认表中指定单元格的内容。从第 0 行第 0 列开始。</summary>
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        public static Int32 Int32(this DataTable table, int row = 0, int column = 0) => table == null ? 0 : NumberUtility.Int32(table.Value(row, column)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        public static Int32 Int32(this DataTable table, int row, int column) => table == null ? 0 : NumberUtility.Int32(table.Value(row, column)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        /// <summary>获取默认表中指定单元格的内容。从第 0 行开始。</summary>
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        public static Int32 Int32(this DataTable table, int row, string column) => table == null ? 0 : NumberUtility.Int32(table.Value(row, column)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        /// <summary>获取默认表中指定单元格的内容。从第 0 行第 0 列开始。</summary>
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        public static Int64 Int64(this DataTable table, int row = 0, int column = 0) => table == null ? 0L : NumberUtility.Int64(table.Value(row, column)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        public static Int64 Int64(this DataTable table, int row, int column) => table == null ? 0L : NumberUtility.Int64(table.Value(row, column)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        /// <summary>获取默认表中指定单元格的内容。从第 0 行开始。</summary>
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        public static Int64 Int64(this DataTable table, int row, string column) => table == null ? 0L : NumberUtility.Int64(table.Value(row, column)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        /// <summary>获取默认表中指定单元格的内容。从第 0 行第 0 列开始。</summary>
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        public static Decimal Decimal(this DataTable table, int row = 0, int column = 0) => table == null ? 0M : NumberUtility.Decimal(table.Value(row, column)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        public static Decimal Decimal(this DataTable table, int row, int column) => table == null ? 0M : NumberUtility.Decimal(table.Value(row, column)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        /// <summary>获取默认表中指定单元格的内容。从第 0 行开始。</summary>
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        public static Decimal Decimal(this DataTable table, int row, string column) => table == null ? 0M : NumberUtility.Decimal(table.Value(row, column)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        /// <summary>获取默认表中指定单元格的内容。从第 0 行第 0 列开始。</summary>>
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        public static Double Double(this DataTable table, int row = 0, int column = 0) => table == null ? 0D : NumberUtility.Double(table.Value(row, column)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        public static Double Double(this DataTable table, int row, int column) => table == null ? 0D : NumberUtility.Double(table.Value(row, column)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        /// <summary>获取默认表中指定单元格的内容。从第 0 行开始。</summary>>
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        public static Double Double(this DataTable table, int row, string column) => table == null ? 0D : NumberUtility.Double(table.Value(row, column)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        /// <summary>获取默认表中指定单元格的内容。从第 0 行第 0 列开始。</summary>
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        public static string Text(this DataTable table, int row = 0, int column = 0) => table == null ? null : TextUtility.Text(table.Value(row, column)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        public static string Text(this DataTable table, int row, int column) => table == null ? null : TextUtility.Text(table.Value(row, column)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        /// <summary>获取默认表中指定单元格的内容。从第 0 行开始。</summary>
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        public static string Text(this DataTable table, int row, string column) => table == null ? null : TextUtility.Text(table.Value(row, column)); | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  |