protected void LoadSequence(DataRow row, SpecificObjectStructure obj) { obj.ObjectName = NewNameWithSchema(row["USERNAME"].SafeToString(), row["SEQUENCE_NAME"].SafeToString()); var sb = new StringBuilder(); sb.AppendFormat("CREATE SEQUENCE \"{0}\".\"{1}\"\n", obj.ObjectName.Schema, obj.ObjectName.Name); sb.AppendFormat(" MINVALUE {0} MAXVALUE {1}\n", row["MIN_VALUE"], row["MAX_VALUE"]); sb.AppendFormat(" INCREMENT BY {0} START WITH {1}\n", row["INCREMENT_BY"], row["LAST_NUMBER"]); sb.AppendFormat(" "); if (row["CACHE_SIZE"].SafeToString() == "0") { sb.Append("NOCACHE "); } else { sb.AppendFormat("CACHE {0} ", row["CACHE_SIZE"]); } if (row["ORDER_FLAG"].SafeToString() == "Y") { sb.Append("ORDER "); } else { sb.Append("NOORDER "); } if (row["CYCLE_FLAG"].SafeToString() == "Y") { sb.Append("CYCLE"); } else { sb.Append("NOCYCLE"); } obj.CreateSql = sb.ToString(); }
private string LoadSource(SpecificObjectStructure obj) { var sb = new StringBuilder(); foreach (DataRow dr in CachedLoadSource(obj.ObjectName).Rows) { sb.Append(dr[0]); } return(sb.ToString()); }
protected void LoadProgrammable(SpecificObjectStructure obj) { var tbl = CachedLoadProgrammable(obj.ObjectName); var sb = new StringBuilder(); foreach (DataRow row in tbl.Rows) { sb.Append(row["CODE_TEXT"].SafeToString()); } obj.CreateSql = sb.ToString(); }
protected void LoadSequence(SpecificObjectStructure obj) { var tbl = GetDbConn().LoadTableFromQuery(String.Format("SELECT * FROM {0}", m_dialect.QuoteFullName(obj.ObjectName))); var row = tbl.Rows[0]; obj.CreateSql = String.Format( @"CREATE SEQUENCE {0} INCREMENT BY {1} MINVALUE {2} MAXVALUE {3} START {4} CACHE {5} {6}", m_dialect.QuoteFullName(obj.ObjectName), row["increment_by"], row["min_value"], row["max_value"], row["last_value"], row["cache_value"], (bool)row["is_cycled"] ? "CYCLE": "NO CYCLE"); }
protected void LoadTrigger(DataRow row, SpecificObjectStructure obj) { StringBuilder sb = new StringBuilder(); sb.Append("CREATE TRIGGER "); sb.Append("`" + row["Trigger"].SafeToString() + "`"); sb.Append(" " + row["Timing"].ToString()); sb.Append(" " + row["Event"].ToString()); sb.Append(" ON " + m_dialect.QuoteIdentifier(row["Table"].ToString())); sb.Append("\nFOR EACH ROW "); sb.Append(row["Statement"].ToString()); obj.CreateSql = sb.ToString(); }
protected void LoadTrigger(SpecificObjectStructure obj) { LoadProgrammable(obj); var tbl = CachedQueryTable(ReplaceMsSqlPlaceholders(StdScripts.loadtrigger)); foreach (DataRow row in tbl.Rows) { if (obj.ObjectName.Schema != null && String.Compare(row.SafeString("SchemaName"), obj.ObjectName.Schema, true) != 0) { continue; } if (obj.ObjectName.Name != null && String.Compare(row.SafeString("Name"), obj.ObjectName.Name, true) != 0) { continue; } obj.RelatedTable = new NameWithSchema(row["TableSchema"].ToString(), row["TableName"].ToString()); } }
protected override void LoadDependencies() { if (!m_members.LoadDependencies) { return; } MsSqlSettings cfg = GlobalSettings.Pages.PageByName("mssql_client") as MsSqlSettings; if (!cfg.UseNativeDependencies) { return; } foreach (SpecificObjectStructure obj in m_db.GetAllSpecificObjects()) { obj.DependsOn = new List <DependencyItem>(); } foreach (var row in CachedQueryRows(ReplaceMsSqlPlaceholders(StdScripts.getdepends))) { string mainspec = SysObjectsCategoryToSpecType(row.SafeString("MainType")); NameWithSchema main = new NameWithSchema(row.SafeString("MainSchema"), row.SafeString("MainName")); string refspec = SysObjectsCategoryToSpecType(row.SafeString("RefType")); NameWithSchema refn = new NameWithSchema(row.SafeString("RefSchema"), row.SafeString("RefName")); if (mainspec != null && refspec != null) { if (m_db.SpecificObjects.ContainsKey(mainspec) && m_db.SpecificObjects[mainspec].GetIndex(main) >= 0) { SpecificObjectStructure obj = (SpecificObjectStructure)m_db.SpecificObjects[mainspec][main]; var newdep = new DependencyItem { Name = refn, ObjectType = refspec }; if (!obj.DependsOn.Contains(newdep)) { obj.DependsOn.Add(newdep); } } } } }
protected void LoadView(DataRow row, SpecificObjectStructure obj) { obj.CreateSql = "CREATE VIEW \"" + obj.ObjectName.Name + "\"\nAS\n" + row.SafeString("VIEW_DEFINITION"); }
protected void LoadTrigger(DataRow row, SpecificObjectStructure obj) { obj.ObjectName = NewNameWithSchema(row["TABLE_OWNER"].SafeToString(), row["TRIGGER_NAME"].SafeToString()); obj.RelatedTable = NewNameWithSchema(row["TABLE_OWNER"].SafeToString(), row["TABLE_NAME"].SafeToString()); obj.CreateSql = "CREATE OR REPLACE " + LoadSource(obj); }
protected void LoadRoutine(DataRow row, SpecificObjectStructure obj) { obj.ObjectName = NewNameWithSchema(row["USERNAME"].SafeToString(), row["OBJECT_NAME"].SafeToString()); obj.CreateSql = "CREATE OR REPLACE " + LoadSource(obj); }
protected void LoadEngine(DataRow row, SpecificObjectStructure obj) { obj.Comment = row.SafeString("Comment"); obj.SpecificData["supported"] = (row.SafeString("Supported") == "YES") ? "1" : "0"; }
protected void LoadViewDetail(SpecificObjectStructure obj) { var tbl = CachedQueryTable(String.Format("SHOW CREATE VIEW `{0}`", obj.ObjectName.Name)); obj.CreateSql = tbl.Rows[0][1].SafeToString(); }
protected void LoadEvent(SpecificObjectStructure obj) { var tbl = CachedQueryTable(String.Format("SHOW CREATE EVENT `{0}`", obj.ObjectName.Name)); obj.CreateSql = tbl.Rows[0][3].SafeToString(); }
private void LoadView(DataRow row, SpecificObjectStructure obj) { obj.ObjectName = NewNameWithSchema(row["USERNAME"].ToString(), row["VIEW_NAME"].ToString()); obj.CreateSql = String.Format("CREATE OR REPLACE VIEW \"{0}\".\"{1}\" AS\n{2}", obj.ObjectName.Schema, obj.ObjectName.Name, row["TEXT"].ToString()); }
protected void LoadFunction(SpecificObjectStructure obj) { var tbl = CachedQueryTable(String.Format("SHOW CREATE FUNCTION `{0}`", obj.ObjectName.Name)); obj.CreateSql = tbl.Rows[0][2].SafeToString(); }
//protected override void LoadTableRowDetails(DataRow row, TableStructure tbl) //{ // tbl.SpecificData["mysql.engine"] = row.SafeString("ENGINE"); // tbl.Comment = row.SafeString("TABLE_COMMENT"); // if (row.SafeString("AUTO_INCREMENT") != null) tbl.SpecificData["mysql.auto_increment"] = row.SafeString("AUTO_INCREMENT"); // if (row.SafeString("TABLE_COLLATION") != null) tbl.SpecificData["mysql.collation"] = row.SafeString("TABLE_COLLATION"); //} protected void LoadProcedure(SpecificObjectStructure obj) { var tbl = CachedQueryTable(String.Format("SHOW CREATE PROCEDURE `{0}`", obj.ObjectName.Name)); obj.CreateSql = tbl.Rows[0][2].SafeToString(); }
private void LoadTrigger(DataRow row, SpecificObjectStructure obj) { obj.ObjectName = new NameWithSchema(row["TRIGGER_SCHEMA"].ToString(), row["TRIGGER_NAME"].ToString()); obj.RelatedTable = new NameWithSchema(row["EVENT_OBJECT_SCHEMA"].ToString(), row["EVENT_OBJECT_TABLE"].ToString()); obj.CreateSql = row["DEFINITION"].ToString(); }
protected void LoadTrigger(DataRow row, SpecificObjectStructure obj) { obj.RelatedTable = new NameWithSchema(row.SafeString("TABLE_NAME")); obj.CreateSql = row.SafeString("TRIGGER_DEFINITION"); }
private void LoadRoutine(DataRow row, SpecificObjectStructure obj) { obj.ObjectName = new NameWithSchema(row["ROUTINE_SCHEMA"].ToString(), row["ROUTINE_NAME"].ToString()); obj.CreateSql = row["ROUTINE_DEFINITION"].ToString(); }