Exemple #1
0
        /// <summary>
        /// 获取DB选择器
        /// </summary>
        /// <param name="type">数据库类型</param>
        /// <returns>选择器</returns>
        public static IDbSelector GetDbSelector(MyDbType type)
        {
            IDbSelector selector = null;

            switch (type)
            {
            case MyDbType.None:
                break;

            case MyDbType.Oracle:
                selector = new OracleDbSelector();
                break;

            case MyDbType.MySql:
                selector = new MySqlDbSelector();
                break;

            case MyDbType.SqlServer:
                selector = new SqlServerDbSelector();
                break;

            default:
                break;
            }
            return(selector);
        }
Exemple #2
0
 public TableDataRow(MyDbType dbType, string tableName, string[] tableColumnNames, Type[] tableColumnTypes, object[] tableColumnDbTypes, object[] tableValues = null)
 {
     this.dbType             = dbType;
     this.tableName          = tableName;
     this.tableColumnNames   = tableColumnNames;
     this.tableColumnTypes   = tableColumnTypes;
     this.tableColumnDbTypes = tableColumnDbTypes;
     this.tableValues        = tableValues;
     DoConvertToBase64();
 }
Exemple #3
0
 public static CreateDataSqlDelegate GetCreateSqlFunction(ICreateDataSql obj, MyDbType type)
 {
     CreateDataSqlDelegate del = null;
     IDbSelector selector = GetDbSelector(type);
     if (selector != null)
     {
         del = selector.GetCreateSqlFunction(obj);
     }
     return del;
 }
Exemple #4
0
        public static CreateDataSqlDelegate GetCreateSqlFunction(ICreateDataSql obj, MyDbType type)
        {
            CreateDataSqlDelegate del      = null;
            IDbSelector           selector = GetDbSelector(type);

            if (selector != null)
            {
                del = selector.GetCreateSqlFunction(obj);
            }
            return(del);
        }
Exemple #5
0
        public static object GetDbDataType(string strDataType, MyDbType inType, MyDbType outType)
        {
            object      dbdataType = null;
            IDbSelector selector   = GetDbSelector(inType);

            if (selector != null)
            {
                dbdataType = selector.GetDbDataType(strDataType, outType);
            }
            return(dbdataType);
        }
Exemple #6
0
        public static Type GetDbObjectType(Type interfaceType, MyDbType type)
        {
            Type        objtype  = null;
            IDbSelector selector = GetDbSelector(type);

            if (selector != null)
            {
                objtype = selector.GetDbObjectType(interfaceType);
            }
            return(objtype);
        }
Exemple #7
0
        public static IDbClass GetDbClass(string connectstring, MyDbType type)
        {
            IDbClass    dbClass  = null;
            IDbSelector selector = GetDbSelector(type);

            if (selector != null)
            {
                dbClass = selector.GetDbClass(connectstring);
            }
            return(dbClass);
        }
Exemple #8
0
        public string GetConnectString(out MyDbType dbtype)
        {
            dbtype = (MyDbType)Enum.Parse(typeof(MyDbType), cbDbType.Text);
            string temp = "";

            if (cbUseConnectStr.Checked)
            {
                temp = tbConnectString.Text.Trim();
            }
            else
            {
            }
            return(temp);
        }
Exemple #9
0
        public static IDbConnection GetConnection(MyDbType type, string connStr)
        {
            IDbConnection dbConnection = null;

            if (type == MyDbType.Oracle)
            {
                dbConnection = new OracleConnection(connStr);
            }
            else if (type == MyDbType.SqlServer)
            {
                dbConnection = new SqlConnection(connStr);
            }
            return(dbConnection);
        }
Exemple #10
0
 public object GetDbDataType(string strDataType, MyDbType outType)
 {
     try
     {
         OracleDbType dbtype = OracleDbTypeDics[strDataType.ToUpper()];
         if (outType == MyDbType.Oracle)
         {
             return(dbtype);
         }
         object      obj      = null;
         IDbSelector selector = MyDbHelper.GetDbSelector(outType);
         if (selector != null)
         {
             obj = selector.GetDbDataType(dbtype);
         }
         return(obj);
     }
     catch (Exception ex)
     {
         return(null);
     }
 }
Exemple #11
0
 public DbData(MyDbType dbType, string tableName, string[] tableColumnNames, Type[] tableColumnTypes, object[] tableColumnDbTypes, object[] tableValues = null)
 {
     _tableDataRow = new TableDataRow(dbType, tableName, tableColumnNames, tableColumnTypes, tableColumnDbTypes, tableValues);
 }
Exemple #12
0
 public object GetDbDataType(string strDataType, MyDbType outType)
 {
     try
     {
         OracleDbType dbtype = OracleDbTypeDics[strDataType.ToUpper()];
         if (outType == MyDbType.Oracle)
         {
             return dbtype;
         }
         object obj = null;
         IDbSelector selector = MyDbHelper.GetDbSelector(outType);
         if (selector != null)
         {
             obj = selector.GetDbDataType(dbtype);
         }
         return obj;
     }
     catch (Exception ex)
     {
         return null;
     }
 }
Exemple #13
0
 public object GetDbDataType(string strDataType, MyDbType outType)
 {
     throw new NotImplementedException();
 }
Exemple #14
0
        public string GetConnectString(out MyDbType dbtype)
        {
            dbtype = (MyDbType)Enum.Parse(typeof(MyDbType), cbDbType.Text);
            string temp = "";
            if (cbUseConnectStr.Checked)
            {
                temp = tbConnectString.Text.Trim();
            }
            else
            {

            }
            return temp;
        }
Exemple #15
0
 public void SetDbType(MyDbType type, bool readOnly)
 {
     cbDbType.Text = Enum.GetName(typeof(DbTool.DbClasses.MyDbType), type);
     cbDbType.Refresh();
     cbDbType.Enabled = readOnly;
 }
Exemple #16
0
 /// <summary>
 /// 获取DB选择器
 /// </summary>
 /// <param name="type">数据库类型</param>
 /// <returns>选择器</returns>
 public static IDbSelector GetDbSelector(MyDbType type)
 {
     IDbSelector selector = null;
     switch (type)
     {
         case MyDbType.None:
             break;
         case MyDbType.Oracle:
             selector = new OracleDbSelector();
             break;
         case MyDbType.MySql:
             selector = new MySqlDbSelector();
             break;
         case MyDbType.SqlServer:
             selector = new SqlServerDbSelector();
             break;
         default:
             break;
     }
     return selector;
 }
Exemple #17
0
 public object GetDbDataType(string strDataType, MyDbType outType)
 {
     throw new NotImplementedException();
 }
Exemple #18
0
 public static object GetDbDataType(string strDataType, MyDbType inType, MyDbType outType)
 {
     object dbdataType = null;
     IDbSelector selector = GetDbSelector(inType);
     if (selector != null)
     {
         dbdataType = selector.GetDbDataType(strDataType, outType);
     }
     return dbdataType;
 }
Exemple #19
0
 public static IDbClass GetDbClass(string connectstring, MyDbType type)
 {
     IDbClass dbClass = null;
     IDbSelector selector = GetDbSelector(type);
     if (selector != null)
     {
         dbClass = selector.GetDbClass(connectstring);
     }
     return dbClass;
 }
Exemple #20
0
 public TableDataRow(MyDbType dbType, string tableName, string[] tableColumnNames, Type[] tableColumnTypes, object[] tableColumnDbTypes, object[] tableValues = null)
 {
     this.dbType = dbType;
     this.tableName = tableName;
     this.tableColumnNames = tableColumnNames;
     this.tableColumnTypes = tableColumnTypes;
     this.tableColumnDbTypes = tableColumnDbTypes;
     this.tableValues = tableValues;
     DoConvertToBase64();
 }
Exemple #21
0
 public DbData(MyDbType dbType, string tableName, string[] tableColumnNames, Type[] tableColumnTypes, object[] tableColumnDbTypes, object[] tableValues=null)
 {
     _tableDataRow = new TableDataRow(dbType, tableName, tableColumnNames, tableColumnTypes, tableColumnDbTypes, tableValues);
 }
Exemple #22
0
 public void SetDbType(MyDbType type, bool readOnly)
 {
     cbDbType.Text = Enum.GetName(typeof(DbTool.DbClasses.MyDbType), type);
     cbDbType.Refresh();
     cbDbType.Enabled = readOnly;
 }
Exemple #23
0
 public static Type GetDbObjectType(Type interfaceType, MyDbType type)
 {
     Type objtype = null;
     IDbSelector selector = GetDbSelector(type);
     if (selector != null)
     {
         objtype = selector.GetDbObjectType(interfaceType);
     }
     return objtype;
 }