示例#1
0
    public static void Main(string[] args)
    {
      DependencyInjection di = DependencyInjection.GetInstance();
      di.SetConfig("config.xml");
      Console.WriteLine("test begins");

      ClientAPI m_TestObject = new ClientAPI();
      m_TestObject.SetRootServer("http://localhost:8080/root");
      m_TestObject.SetAuthHostAddress("http://localhost:8080/IComm");
      m_TestObject.ConfigClient();

      m_TestObject.ExecuteQuery("SELECT * FROM first_db.test_table", "mocktoken");
      if (m_TestObject.CheckIfRowsReturned())
      {
        List<string> string1 = m_TestObject.IterateDataSet();

        List<string> ColNames = m_TestObject.GetAllColumnNames();

        List<System.Type> ColTypes = m_TestObject.GetAllColumnTypes();
        if (string1 == null) Console.WriteLine("the end");
        Console.WriteLine(string1[1]);
        string1 = m_TestObject.IterateDataSet();

        if (string1 == null) Console.WriteLine("the end");
        Console.WriteLine(string1[1]);
        string1 = m_TestObject.IterateDataSet();

        if (string1 == null) Console.WriteLine("the end");
        Console.WriteLine(string1[1]);
        string1 = m_TestObject.IterateDataSet();

        if (string1 == null) Console.WriteLine("the end");
        Console.WriteLine(string1[1]);
        string1 = m_TestObject.IterateDataSet();

        if (string1 == null) Console.WriteLine("the end");
        Console.WriteLine(string1[1]);
        string1 = m_TestObject.IterateDataSet();

        if (string1 == null) Console.WriteLine("the end");
        Console.WriteLine(string1[1]);
        string1 = m_TestObject.IterateDataSet();

        if (string1 == null) Console.WriteLine("the end");
        Console.WriteLine(string1[1]);
        string1 = m_TestObject.IterateDataSet();

        if (string1 == null) Console.WriteLine("the end");
        Console.WriteLine(string1[1]);
        string1 = m_TestObject.IterateDataSet();

        if (string1 == null) Console.WriteLine("the end");
        Console.WriteLine(string1[1]);
        string1 = m_TestObject.IterateDataSet();

        if (string1 == null) Console.WriteLine("the end");
        Console.WriteLine(string1[1]);
        string1 = m_TestObject.IterateDataSet();

        if (string1 == null) Console.WriteLine("the end");

      }
      else
      {
        Console.WriteLine(" no row returned");

      }

    }
示例#2
0
    /// <summary>
    /// To execute the select statements , when the table name is selected in the tree view 
    /// </summary>
    /// <param name="m_TableName"></param>
    private void ExecuteSelectQuery(string m_TableName)
    {
      try
      {
        m_clientapi = new ClientAPI();
        m_clientapi.SetRootServer(RootServerUrl);
        m_clientapi.SetAuthHostAddress(AuthServerUrl);
        m_clientapi.ConfigClient();

        m_DgContentOfTables.ItemsSource = null;

        string m_Query = "SELECT * FROM " + this.GetKeyForValue(m_DBTableInfos, m_TableName) + "." + m_TableName;

        m_clientapi.ExecuteQuery(m_Query, LoginToken);

        if (m_clientapi.CheckIfRowsReturned())
        {
          DataTable DataGridDataTable = this.GenerateColumnNameAndTypes(m_clientapi);

          m_DgContentOfTables.ItemsSource = DataGridDataTable.DefaultView;
        }
        else
        {
          MessageBox.Show("No rows of Data Returned");
        }

      }
      catch (Exception ex)
      {

        MessageBox.Show(ex.Message);
      }
    }