Ejemplo n.º 1
0
    /// <summary>
    /// Test CUBRIDSchemaProvider GetTables() method
    /// </summary>
    private static void Test_GetTables()
    {
      using (CUBRIDConnection conn = new CUBRIDConnection())
      {
        conn.ConnectionString = TestCases.connString;
        conn.Open();

        CUBRIDSchemaProvider schema = new CUBRIDSchemaProvider(conn);
        DataTable dt = schema.GetTables(new string[] { "%" });

        Debug.Assert(dt.Columns.Count == 3);
        Debug.Assert(dt.Rows.Count == 10);

        Debug.Assert(dt.Rows[0][0].ToString() == "demodb");
        Debug.Assert(dt.Rows[0][1].ToString() == "demodb");
        Debug.Assert(dt.Rows[0][2].ToString() == "stadium");
      }
    }
Ejemplo n.º 2
0
        public List<Table> GetTables(string owner)
        {
            var tables = new List<Table>();
            var conn = new CUBRIDConnection(connectionStr);
            conn.Open();

            try
            {
                using (conn)
                {
                    var schema = new CUBRIDSchemaProvider(conn);
                    DataTable dt = schema.GetTables(new[] { "%" });
                    for (var i = 0; i < dt.Rows.Count; i++)
                    {
                        tables.Add(new Table { Name = dt.Rows[i][2].ToString() });
                    }
                }
            }
            finally
            {
                conn.Close();
            }

            tables.Sort((x, y) => String.Compare(x.Name, y.Name, StringComparison.Ordinal));

            return tables;
        }
 public void GetTablesTest()
 {
     CUBRIDConnection connection = new CUBRIDConnection(); // TODO: Initialize to an appropriate value
     connection.ConnectionString = DBHelper.connString;
     connection.Open();
     CUBRIDSchemaProvider target = new CUBRIDSchemaProvider(connection); // TODO: Initialize to an appropriate value
     string[] filters = new string[]{"%co%"}; // TODO: Initialize to an appropriate value
     DataTable actual;
     
         actual = target.GetTables(filters);
     
     Assert.AreEqual(2,actual.Rows.Count);
     connection.Close();
 }
 public void GetTablesNoFilterTest()
 {
     CUBRIDConnection connection = new CUBRIDConnection(); // TODO: Initialize to an appropriate value
     connection.ConnectionString = DBHelper.connString;
     CUBRIDSchemaProvider target = new CUBRIDSchemaProvider(connection); // TODO: Initialize to an appropriate value
     string[] filters =null; // TODO: Initialize to an appropriate value
     DataTable actual;
     string ss=null;
     try
     {
         actual = target.GetTables(filters);
     }
     catch (Exception e) {
         ss = e.Message;
     }
     Assert.IsNotNull(ss.Length);
     connection.Close();
 }