public DbScriptGenerator(DbInterpreter dbInterpreter) { this.dbInterpreter = dbInterpreter; this.option = dbInterpreter.Option; this.databaseType = dbInterpreter.DatabaseType; this.scriptsDelimiter = dbInterpreter.ScriptsDelimiter; }
public static DataTypeInfo GetDataTypeInfo(DbInterpreter dbInterpreter, string dataType) { DataTypeInfo dataTypeInfo = new DataTypeInfo(); if (dbInterpreter != null) { dataType = dataType.Trim(dbInterpreter.QuotationLeftChar, dbInterpreter.QuotationRightChar); } int index = dataType.IndexOf("("); if (index > 0) { if (dataType.Substring(index + 1).IndexOf('(') > 0 || !dataType.Trim().EndsWith(")")) { dataTypeInfo.DataType = dataType; } else { dataTypeInfo.DataType = dataType.Substring(0, index); dataTypeInfo.Args = dataType.Substring(index).Trim('(', ')').Trim(); } } else { dataTypeInfo.DataType = dataType; } return(dataTypeInfo); }
public static string GetOwnerName(DbInterpreter dbInterpreter) { if (dbInterpreter.DatabaseType == DatabaseType.Oracle) { return(dbInterpreter.ConnectionInfo.UserId); } else { if (dbInterpreter.DatabaseType == DatabaseType.SqlServer) { return("dbo"); } return(dbInterpreter.ConnectionInfo.Database); } }
public static DbInterpreter GetDbInterpreter(DatabaseType dbType, ConnectionInfo connectionInfo, DbInterpreterOption option) { DbInterpreter dbInterpreter = null; if(dbType == DatabaseType.SqlServer) { dbInterpreter = new SqlServerInterpreter(connectionInfo, option); } else if(dbType == DatabaseType.MySql) { dbInterpreter = new MySqlInterpreter(connectionInfo, option); } else if(dbType == DatabaseType.Oracle) { dbInterpreter = new OracleInterpreter(connectionInfo, option); } return dbInterpreter; }
public static DbScriptGenerator GetDbScriptGenerator(DbInterpreter dbInterpreter) { DbScriptGenerator dbScriptGenerator = null; switch (dbInterpreter.DatabaseType) { case DatabaseType.SqlServer: dbScriptGenerator = new SqlServerScriptGenerator(dbInterpreter); break; case DatabaseType.MySql: dbScriptGenerator = new MySqlScriptGenerator(dbInterpreter); break; case DatabaseType.Oracle: dbScriptGenerator = new OracleScriptGenerator(dbInterpreter); break; } return(dbScriptGenerator); }
public static DbInterpreter GetDbInterpreter(DatabaseType dbType, ConnectionInfo connectionInfo, DbInterpreterOption option) { DbInterpreter dbInterpreter = null; var assembly = Assembly.GetExecutingAssembly(); var typeArray = assembly.ExportedTypes; var types = (from type in typeArray where type.IsSubclassOf(typeof(DbInterpreter)) select type).ToList(); foreach (var type in types) { dbInterpreter = (DbInterpreter)Activator.CreateInstance(type, connectionInfo, option); if (dbInterpreter.DatabaseType == dbType) { return(dbInterpreter); } } return(dbInterpreter); }
public OracleScriptGenerator(DbInterpreter dbInterpreter) : base(dbInterpreter) { }
public MySqlScriptGenerator(DbInterpreter dbInterpreter) : base(dbInterpreter) { }
public SqlServerScriptGenerator(DbInterpreter dbInterpreter) : base(dbInterpreter) { }