예제 #1
0
        public string GetDataSet(DBInfo dbinfo, string cmdText)
        {
            var ds    = CreateDB(dbinfo).GetDataSet(cmdText);
            var newds = new Data.DataSet(ds);

            return(newds.ToString());
        }
예제 #2
0
        public string GetDataSetWithParam(DBInfo dbinfo, string cmdText, string[] paraNames, object[] paraValues)
        {
            var ds    = CreateDB(dbinfo).GetDataSet(cmdText, paraNames, paraValues);
            var newds = new Data.DataSet(ds);

            return(newds.ToString());
        }
예제 #3
0
        /// <summary>
        /// 生成本地访问实例
        /// </summary>
        /// <param name="db"></param>
        /// <returns></returns>
        private DbUtility.DbORM CreateDB(DBInfo db)
        {
            DoNet.Common.IO.Logger.Debug(db);

            var dbHelper = DbFactory.CreateDbORM(db.DBType.ToString(), db.ConnectionString);

            return(dbHelper);
        }
예제 #4
0
        public object ExecuteScalar(DBInfo dbinfo, string cmdText)
        {
            var r = Request("ExecuteScalar", dbinfo, new List <string>()
            {
                cmdText
            });

            return(r);
        }
예제 #5
0
        public int ExecuteNonQuery(DBInfo dbinfo, string cmdText)
        {
            var r = Request("ExecuteNonQuery", dbinfo, new List <string>()
            {
                cmdText
            });

            return(int.Parse(r));
        }
예제 #6
0
        public string GetDataSet(DBInfo dbinfo, string cmdText)
        {
            var r = Request("GetDataSet", dbinfo, new List <string>()
            {
                cmdText
            });

            var newds = Data.DataSet.FromString(r);

            return(newds.ToString());
        }
예제 #7
0
        public object ExecuteScalarWithParam(DBInfo dbinfo, string cmdText, string[] paraNames, object[] paraValues)
        {
            var r = Request("ExecuteScalarWithParam", dbinfo, new List <string>()
            {
                cmdText
            }, new List <string[]>()
            {
                paraNames
            }, new List <object[]>()
            {
                paraValues
            });

            return(r);
        }
예제 #8
0
        public int ExecuteNonQueryWithParam(DBInfo dbinfo, string cmdText, string[] paraNames, object[] paraValues)
        {
            var r = Request("ExecuteNonQueryWithParam", dbinfo, new List <string>()
            {
                cmdText
            }, new List <string[]>()
            {
                paraNames
            }, new List <object[]>()
            {
                paraValues
            });

            return(int.Parse(r));
        }
예제 #9
0
        public string GetDataSetWithParam(DBInfo dbinfo, string cmdText, string[] paraNames, object[] paraValues)
        {
            var r = Request("GetDataSetWithParam", dbinfo, new List <string>()
            {
                cmdText
            }, new List <string[]>()
            {
                paraNames
            }, new List <object[]>()
            {
                paraValues
            });

            var newds = Data.DataSet.FromString(r);

            return(newds.ToString());
        }
예제 #10
0
        public int ExecuteNonQueryWithParams(DBInfo dbinfo, string cmdText, IDictionary <string, object> dbparams)
        {
            var parnames  = dbparams.Keys.ToArray <string>();
            var parvalues = dbparams.Values.ToArray <object>();

            var r = Request("ExecuteNonQueryWithParams", dbinfo, new List <string>()
            {
                cmdText
            }, new List <string[]>()
            {
                parnames
            }, new List <object[]>()
            {
                parvalues
            });

            return(int.Parse(r));
        }
예제 #11
0
        private string Request(string methodname, DBInfo dbinfo, List <string> sqls, List <string[]> paraNames = null, List <object[]> paraValues = null)
        {
            DoNet.Common.IO.Logger.Debug("Request :", methodname, dbinfo);

            var url     = dbinfo.ProxyUrl ?? System.Configuration.ConfigurationManager.AppSettings["DBProxyUrl"];
            var request = DoNet.Common.Net.JMRequest.CreateHttp(url);

            request.Request.Method = "post";
            //request.Request.TransferEncoding = System.Text.Encoding.UTF8;

            var db = new ExecuteInfo()
            {
                DB         = dbinfo,
                MethodName = methodname,
                ParaNames  = paraNames,
                ParaValues = paraValues,
                Sqls       = sqls
            };
            var data = System.Text.Encoding.UTF8.GetBytes(db.ToString());

            request.Write(data);

            var result = "";

            using (var response = request.GetResponse())
            {
                response.ResponseEncoding = System.Text.Encoding.UTF8;
                result = response.ReadToEnd();
            }

            if (!string.IsNullOrWhiteSpace(result))
            {
                DoNet.Common.IO.Logger.Debug(result);
            }
            return(result);
        }
예제 #12
0
 public int ExecuteNonQueryWithParam(DBInfo dbinfo, string cmdText, string[] paraNames, object[] paraValues)
 {
     return(CreateDB(dbinfo).ExecuteNonQuery(cmdText, paraNames, paraValues));
 }
예제 #13
0
        public int ExecuteSqlWithParam(DBInfo dbinfo, List <string> sqls, List <string[]> paraNames, List <object[]> paraValues)
        {
            var r = Request("ExecuteSqlWithParam", dbinfo, sqls, paraNames, paraValues);

            return(int.Parse(r));
        }
예제 #14
0
        public int ExecuteSql(DBInfo dbinfo, ICollection <string> sqls)
        {
            var r = Request("ExecuteSql", dbinfo, new List <string>(sqls));

            return(int.Parse(r));
        }
예제 #15
0
 public int ExecuteNonQueryWithParams(DBInfo dbinfo, string cmdText, IDictionary <string, object> dbparams)
 {
     return(CreateDB(dbinfo).ExecuteNonQuery(cmdText, dbparams));
 }
예제 #16
0
 public int ExecuteNonQuery(DBInfo dbinfo, string cmdText)
 {
     return(CreateDB(dbinfo).ExecuteNonQuery(cmdText));
 }
예제 #17
0
 public int ExecuteSqlWithParam(DBInfo dbinfo, List <string> sqls, List <string[]> paraNames, List <object[]> paraValues)
 {
     return(CreateDB(dbinfo).ExecuteSql(sqls, paraNames, paraValues));
 }
예제 #18
0
 public int ExecuteSql(DBInfo dbinfo, ICollection <string> sqls)
 {
     return(CreateDB(dbinfo).ExecuteSql(sqls));
 }
예제 #19
0
 public object ExecuteScalarWithParam(DBInfo dbinfo, string cmdText, string[] paraNames, object[] paraValues)
 {
     return(CreateDB(dbinfo).ExecuteScalar(cmdText, paraNames, paraValues));
 }
예제 #20
0
 public object ExecuteScalar(DBInfo dbinfo, string cmdText)
 {
     return(CreateDB(dbinfo).ExecuteScalar(cmdText));
 }