public static SqlBase NewDB(string name) { SqlBase sb = String.IsNullOrEmpty(name) ? DefaultDB.NewOne() : DB[name].NewOne(); sb.DSS = MyDss; return(sb); }
private static void InitDB() { if (_DB == null) { _DB = new Dictionary <String, SqlBase>(); } if (_DB.Count > 0) { return; } foreach (ConnectionStringSettings css in MyDbSetting.GetAllConnections()) { SqlBase sb = null; switch (MyDbSetting.GetProviderType(css.ProviderName)) { case ProviderType.MsSql: sb = new MsSql(MyDbSetting, css.Name); break; case ProviderType.OleDb: sb = new OleDb(MyDbSetting, css.Name); break; case ProviderType.Odbc: sb = new Odbc(MyDbSetting, css.Name); break; case ProviderType.Oracle: sb = new Oracle(MyDbSetting, css.Name); break; case ProviderType.MySql: sb = new MySql(MyDbSetting, css.Name); break; } sb.DSS = MyDss; if (sb != null) { if (!_DB.ContainsKey(css.Name)) { _DB.Add(css.Name, sb); } } } }
public DbResult(SqlBase sql) { this.IsConnected = sql.IsConnected; this.ConnectionString = sql.ConnectionString; this.ExecError = sql.ExecError; this.ConnError = sql.ConnectError; this.CmdText = sql.CmdText; this.ReturnValue = sql.ReturnValue; }
public static System.Xml.XmlReader GetXmlReader(String cnName, string sSql) { SqlBase db = NewDB(cnName); db.Connect(); if (!db.IsConnected) { return(null); } System.Xml.XmlReader xr = db.GetXmlReader(sSql); db.Close(); return(xr); }
public static DbResult GetXDataTable_R(String cnName, string sSql) { SqlBase db = NewDB(cnName); db.Connect(); if (!db.IsConnected) { return(new DbResult(db)); } DbResult dr = db.GetXDataTable_R(sSql); db.Close(); return(dr); }
public static XDataTable GetXDataTable(String cnName, string sSql) { SqlBase db = NewDB(cnName); db.Connect(); if (!db.IsConnected) { return(null); } XDataTable xdt = db.GetXDataTable(sSql); db.Close(); return(xdt); }
public static DataSet GetDataSet(String cnName, string sSql) { SqlBase db = NewDB(cnName); db.Connect(); if (!db.IsConnected) { return(null); } DataSet ds = db.GetDataSet(sSql); db.Close(); return(ds); }
public static DbValues GetDatas(String cnName, string sSql) { SqlBase db = NewDB(cnName); db.Connect(); if (!db.IsConnected) { return(null); } DbValues dvs = db.GetDatas(sSql); db.Close(); return(dvs); }
public static object GetDataReader(String cnName, string sSql) { SqlBase db = NewDB(cnName); db.Connect(); if (!db.IsConnected) { return(-1); } object oR = db.GetDataReader(sSql); db.Close(); return(oR); }
public static bool IsHasRow(String cnName, string sSql) { SqlBase db = NewDB(cnName); db.Connect(); if (!db.IsConnected) { return(false); } bool blnR = db.IsHasRow(sSql); db.Close(); return(blnR); }
public static object ExecuteGeneral(String cnName, CommandType cmdType, string sSql, object cmdParameters, CommandMode cmdMode) { SqlBase db = NewDB(cnName); db.Connect(); if (!db.IsConnected) { return(null); } object oR = db.ExecuteGeneral(cmdType, sSql, cmdParameters, cmdMode); db.Close(); return(oR); }
public static int Execute(String cnName, string sSql) { SqlBase db = NewDB(cnName); db.Connect(); if (!db.IsConnected) { return(-1); } int iR = db.Execute(sSql); db.Close(); return(iR); }
public static DbResult ExecuteGeneral_R(String cnName, CommandType cmdType, string sSql, object cmdParameters, CommandMode cmdMode) { SqlBase db = NewDB(cnName); db.Connect(); object oR = null; if (db.IsConnected) { oR = db.ExecuteGeneral(cmdType, sSql, cmdParameters, cmdMode); } DbResult dr = new DbResult(db); db.Close(); return(dr); }
public int DeleteFiles(String cnName, string sSql) { SqlBase db = NewDB(cnName); db.Connect(); if (!db.IsConnected) { return(-1); } if (ULCode.QDA.Debug.IS_FORM_CLIENT) { return(-1); } int iR = db.DeleteFiles(sSql); db.Close(); return(iR); }
public static SqlBase NewDB(ProviderType providerType, String connectionString) { SqlBase sb = null; switch (providerType) { case ProviderType.MsSql: sb = new MsSql(connectionString); break; case ProviderType.OleDb: sb = new OleDb(connectionString); break; case ProviderType.Odbc: sb = new Odbc(connectionString); break; case ProviderType.Oracle: sb = new Oracle(connectionString); break; case ProviderType.MySql: sb = new MySql(connectionString); break; } sb.DSS = MyDss; return(sb); }
public static DbResult Execute_R(String cnName, string sSql) { SqlBase db = NewDB(cnName); db.Connect(); int iR = 0; if (!db.IsConnected) { iR = -1; } else { iR = db.Execute(sSql); } DbResult dr = new DbResult(db); dr.ReturnValue = iR; db.Close(); return(dr); }