private void RefreshTreeTables() { if (_connection.State != ConnectionState.Open) { _connection.Open(); } TreeNode root = _treeView.Nodes[0]; root.Nodes.Clear(); // Get list of tables and show in tree DataTable tables = _connection.GetTables(); foreach (DataRow row in tables.Rows) { GarudaPhoenixTable table = new GarudaPhoenixTable(row); TreeNode nSchema = GetSchemaTreeNode(table.Schema); TreeNode t = nSchema.Nodes.Add(table.FullName); t.Tag = table; t.ImageIndex = TreeImgNdx.Table; t.SelectedImageIndex = t.ImageIndex; t.ContextMenuStrip = _cmsTreeTableMenu; } root.Expand(); // Show tables in grid view for now. //UpdateDataGrid(tables); }
public void MetaDataGarudaPhoenixTableGenerateUpsertStatement() { string expectedTable = "BIGTABLE"; using (PhoenixConnection c = new PhoenixConnection()) { c.ConnectionString = this.ConnectionString(); c.Open(); DataTable dt = c.GetTables(); foreach (DataRow row in dt.Rows) { if (row["TABLE_NAME"].ToString() == expectedTable) { var tbl = new Garuda.Data.MetaData.GarudaPhoenixTable(row); Task <string> tUpsert = tbl.GenerateUpsertStatementAsync(c); tUpsert.Wait(); Assert.IsNotNull(tUpsert.Result); Assert.IsTrue(tUpsert.Result.StartsWith("UPSERT INTO")); TestContext.WriteLine(tUpsert.Result); break; } } } }
public void MetaDataGarudaPhoenixTableConstructor() { string expectedTable = "BIGTABLE"; using (PhoenixConnection c = new PhoenixConnection()) { c.ConnectionString = this.ConnectionString(); c.Open(); DataTable dt = c.GetTables(); foreach (DataRow row in dt.Rows) { var tbl = new Garuda.Data.MetaData.GarudaPhoenixTable(row); if (row["TABLE_NAME"].ToString() == expectedTable) { Assert.IsNotNull(tbl.Row); Assert.IsInstanceOfType(tbl.Row, typeof(DataRow)); Assert.IsNotNull(tbl.Name); Assert.AreEqual(expectedTable, tbl.Name); Assert.IsNotNull(tbl.FullName); Assert.AreEqual(expectedTable, tbl.FullName); Assert.IsNotNull(tbl.Schema); Assert.AreEqual(string.Empty, tbl.Schema); break; } } } }
public void MetaDataGarudaPhoenixTableGetIndexes() { string expectedTable = "BIGTABLE"; using (PhoenixConnection c = new PhoenixConnection()) { c.ConnectionString = this.ConnectionString(); c.Open(); DataTable dt = c.GetTables(); foreach (DataRow row in dt.Rows) { if (row["TABLE_NAME"].ToString() == expectedTable) { var tbl = new Garuda.Data.MetaData.GarudaPhoenixTable(row); DataTable dtCols = tbl.GetIndexes(c); Assert.IsNotNull(dtCols); Assert.IsNotNull(dtCols.Rows); Assert.IsTrue(dtCols.Rows.Count > 0); Assert.IsNotNull(dtCols.Columns); break; } } } }
public void ConnectionTablesDataTable() { using (PhoenixConnection c = new PhoenixConnection()) { c.ConnectionString = this.ConnectionString(); c.Open(); DataTable tables = c.GetTables(); Assert.IsTrue(tables.Rows.Count > 0); } }