public void SetPrimaryKeys(params object[][] rows) { var table = new DataTable("PRIMARY_KEYS"); table.AddColumns("TABLE_SCHEMA", "TABLE_NAME", "COLUMN_NAME"); table.Columns.Add("ORDINAL_POSITION", typeof (int)); table.AddRows(rows); _tables.Add("PRIMARY_KEYS", table); }
public void SetColumns(params object[][] rows) { _tables.Remove("COLUMNS"); var table = new DataTable("COLUMNS"); table.AddColumns("TABLE_SCHEMA", "TABLE_NAME", "COLUMN_NAME", "IS_IDENTITY", "DATA_TYPE", "CHARACTER_MAXIMUM_LENGTH"); table.AddRows(AddIdentityDefault(rows)); _tables.Add("COLUMNS", table); }
public void SetParameters(params object[][] rows) { _tables.Remove("PARAMETERS"); var table = new DataTable("PARAMETERS"); table.AddColumns("PROCEDURE_SCHEMA", "PROCEDURE_NAME", "PARAMETER_NAME"); table.AddRows(rows); _tables.Add("PARAMETERS", table); }
public void SetTables(params object[][] rows) { _tables.Remove("TABLES"); var table = new DataTable("TABLES"); table.AddColumns("TABLE_SCHEMA", "TABLE_NAME", "TABLE_TYPE"); table.AddRows(rows); _tables.Add("TABLES", table); }
public void SetForeignKeys(params object[][] rows) { var table = new DataTable("FOREIGN_KEYS"); table.AddColumns("CONSTRAINT_NAME", "TABLE_SCHEMA", "TABLE_NAME", "COLUMN_NAME", "UNIQUE_TABLE_SCHEMA", "UNIQUE_TABLE_NAME", "UNIQUE_COLUMN_NAME"); table.Columns.Add("ORDINAL_POSITION", typeof(int)); table.AddRows(rows); _tables.Add("FOREIGN_KEYS", table); }
public static DataTable MainTable() { var table = new DataTable("QOAMcorners"); table.AddColumns("Test Corner", "Another Corner"); table.AddRow(new[] { "123-123", "777-888" }); table.AddRow(new[] { "456-456", "" }); return table; }
public static DataTable AuthorsTable() { var table = new DataTable("Links"); table.AddColumns("eissn", "url"); table.AddRow(new[] { "1687-8140", "http://ade.sagepub.com/submission" }); table.AddRow(new[] { "2073-4395", "http://www.mdpi.com/journal/agronomy/submission" }); table.AddRow(new[] { "2372-0484", "http://www.aimspress.com/journal/Materials/submission" }); table.AddRow(new[] { "1687-7675", "http://www.hindawi.com/journals/aess/submission" }); return table; }
public static DataTable LicenseTable(string licenseName) { var table = new DataTable(licenseName); table.AddColumns("eISSN", "text"); table.AddRow(new[] { "0219-3094", "Discount of 100% on publication fee. Please contact your library for more information." }); table.AddRow(new[] { "0219-3116", "Some random text" }); table.AddRow(new[] { "0814-6039", "I'm Batman" }); table.AddRow(new[] { "0942-0940", "No, really." }); return table; }
public static DataTable AuthorsTable() { var table = new DataTable("Authors"); table.AddColumns("eissn", "Author email address", "Author name"); table.AddRow(new[] { "1687-8140", "*****@*****.**", "A. Caenen" }); table.AddRow(new[] { "2073-4395", "*****@*****.**", "Jeroen De Waele"}); table.AddRow(new[] { "2372-0484", "*****@*****.**", "Dolores Esquivel"}); table.AddRow(new[] { "1687-7675", "*****@*****.**", "E. Van Ranst"}); table.AddRow(new[] { "1234-7675", "[email protected],[email protected];[email protected]", "K. Test"}); return table; }
private static System.Data.DataSet GetDataSource(string name) { var ds = new System.Data.DataSet(name); var table = new System.Data.DataTable("TestTable"); table.AddColumns(new DataColumn("TaxType", typeof(string)), new DataColumn("TaxPercent", typeof(double))); table.AddRow("Lorem", 0.137); table.AddRow("Ipsum", 0.144); table.AddRow("Dolor", 0.004); table.AddRow("Sit", 0.025); table.AddRow("Amet", 0.074); table.AddRow("Consectetur", 0.616); ds.Tables.Add(table); return(ds); }
public static DataTable UniversitiesTable() { var table = new DataTable("Universities"); table.AddColumns("Domains", "Tabs"); table.AddRow(new[] { "ru.nl", "Sage" }); table.AddRow(new[] { "uu.nl", "Springer" }); table.AddRow(new[] { "uva.nl", "Springer, Sage" }); table.AddRow(new[] { "rug.nl", "Springer,Sage" }); table.AddRow(new[] { "ugent.be", "Springer; Sage" }); table.AddRow(new[] { "upc.cat", "Springer;Sage" }); return table; }
private DataTable CreateTable(int columnId, List<NormalDistributionValueItem> items) { string[] targetValues = StaticStorage.DataSet.AsEnumerable().Select(m => m[StaticStorage.TargetColum].ToString().Format()).Where(m => m != "").ToArray(); string[] targetDistinctValues = targetValues.Distinct().ToArray(); string predictorColumn = StaticStorage.DataSet.Columns[columnId].ColumnName; string[] predictorValues = StaticStorage.DataSet.AsEnumerable().Select(m => m[predictorColumn].ToString().Format()).Where(m => m != "").ToArray(); string[] predictorDistinctValues = predictorValues.Distinct().ToArray(); DataTable result = new DataTable($"{StaticStorage.DataSet.Columns[columnId].ColumnName} - {StaticStorage.TargetColum}"); result.Columns.Add(predictorColumn.Format()); result.AddColumns(targetDistinctValues); foreach (string predictorDistinctValue in predictorDistinctValues) { DataRow row = result.NewRow(); foreach (string targetDistinctValue in targetDistinctValues) { row[predictorColumn.Format()] = predictorDistinctValue; NormalDistributionValueItem item = items.First(m => m.TargetValue.Equals(targetDistinctValue)); /* double exponent = Math.Exp(-(Math.Pow(double.Parse(predictorDistinctValue) - item.Mean, 2)/(2*Math.Pow(item.Std, 2)))); double probability = (1/(Math.Sqrt(2*Math.PI)*item.Std))*exponent;*/ double zscore = (double.Parse(predictorDistinctValue) - item.Mean) / item.Std; double exponent = -(zscore * zscore) / 2; double probability = (1 / Math.Sqrt(2 * Math.PI)) * Math.Exp(exponent); row[targetDistinctValue] = Math.Round(probability, 6); } result.Rows.Add(row); } return result; }
private DataTable CreateTable(string predictorColumn) { DataTable result = new DataTable($"{StaticStorage.TargetColum} - {predictorColumn}"); string[] targetValues = StaticStorage.DataSet.AsEnumerable().Select(m => m[StaticStorage.TargetColum].ToString().Format()).Where(m => m != "").ToArray(); string[] predictorValues = StaticStorage.DataSet.AsEnumerable().Select(m => m[predictorColumn].ToString().Format()).Where(m => m != "").ToArray(); string[] targetDistinctValues = targetValues.Distinct().ToArray(); string[] predictorDistinctValues = predictorValues.Distinct().ToArray(); result.Columns.Add(predictorColumn.Format()); result.AddColumns(targetDistinctValues); result.Columns.Add("probability"); foreach (string predictorDistinctValue in predictorDistinctValues) { if (StaticStorage.TargetColum == predictorColumn) continue; DataRow row = result.NewRow(); foreach (string targetDistinctValue in targetDistinctValues) { string query = $"{StaticStorage.TargetColum} = '{targetDistinctValue}' AND {predictorColumn} = '{predictorDistinctValue}'"; string totalQuery = $"{StaticStorage.TargetColum}='{targetDistinctValue}'"; row[targetDistinctValue] = StaticStorage.DataSet.Select(query).Length + "/" + StaticStorage.DataSet.Select(totalQuery).Length; } row["probability"] = targetDistinctValues.Sum(m => int.Parse(row[m].ToString().Split('/')[0])); row[predictorColumn] = predictorDistinctValue; result.Rows.Add(row); } return result; }