示例#1
0
        /// <summary>
        /// 执行
        /// </summary>
        /// <param name="source"></param>
        /// <param name="Sql"></param>
        /// <param name="valuePairs"></param>
        /// <returns></returns>
        public static object ExecuteScalar(this ManagerPool manager, string Sql, string name = null, Dictionary <string, object> valuePairs = null)
        {
            if (string.IsNullOrEmpty(Sql))
            {
                return(null);
            }
            var source = manager.GetHikariDataSource(name);

            return(source.ExecuteScalar(Sql, valuePairs));
        }
示例#2
0
        /// <summary>
        /// 批量导入
        /// </summary>
        /// <param name="manager"></param>
        /// <param name="name"></param>
        /// <param name="dt"></param>
        public static void BluckCopy(this ManagerPool manager, string name = null, DataTable dt = null)
        {
            if (dt == null || dt.Rows.Count == 0)
            {
                return;
            }
            var source = manager.GetHikariDataSource(name);

            source.BulkCopy(dt);
        }
示例#3
0
        /// <summary>
        /// 查询数据
        /// 例如:select * from Person where id=@ID
        ///  valuePairs["ID"]=1;
        /// </summary>
        /// <param name="source"></param>
        /// <param name="querySql"></param>
        /// <param name="valuePairs"></param>
        /// <returns></returns>
        public static IDataReader ExecuteQueryReader(this ManagerPool manager, string querySql, string name = null, Dictionary <string, object> valuePairs = null)
        {
            if (string.IsNullOrEmpty(querySql))
            {
                return(null);
            }
            var source = manager.GetHikariDataSource(name);

            return(source.ExecuteQueryReader(querySql, valuePairs));
        }