示例#1
0
        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);
        }
示例#2
0
        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;
                    }
                }
            }
        }
示例#3
0
        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;
                    }
                }
            }
        }
示例#4
0
        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;
                    }
                }
            }
        }
示例#5
0
        public void ConnectionTablesDataTable()
        {
            using (PhoenixConnection c = new PhoenixConnection())
            {
                c.ConnectionString = this.ConnectionString();
                c.Open();

                DataTable tables = c.GetTables();
                Assert.IsTrue(tables.Rows.Count > 0);
            }
        }