Example #1
0
        private void btnScanOpen_Click(object sender, EventArgs e)
        {
            try
            {
                List <string> checkedcolumns = new List <string>();
                foreach (TreeNode cnode in this.tvScanColumns.Nodes[0].Nodes)
                {
                    if (cnode.Checked)
                    {
                        checkedcolumns.Add(cnode.Text.Substring(0, cnode.Text.Length - 1));
                    }
                    else
                    {
                        foreach (TreeNode qnode in cnode.Nodes)
                        {
                            if (qnode.Checked)
                            {
                                checkedcolumns.Add(string.Concat(cnode.Text, qnode.Text));
                            }
                        }
                    }
                }

                if (checkedcolumns.Count != 0)
                {
                    if (this.cboScanMode.SelectedIndex == 0)
                    {
                        _scanID = SetThriftServerForm.GetHBaseThriftClient().GetScan(this.TableName, new byte[0], checkedcolumns);
                    }
                    else if (this.cboScanMode.SelectedIndex == 1)
                    {
                        _scanID = SetThriftServerForm.GetHBaseThriftClient().GetScanWithPrefix(this.TableName, this.txtScanValue1.Text.Trim().GetUTF8Bytes(), checkedcolumns);
                    }
                    else if (this.cboScanMode.SelectedIndex == 2)
                    {
                        _scanID = SetThriftServerForm.GetHBaseThriftClient().GetScanWithStop(this.TableName, this.txtScanValue1.Text.Trim().GetUTF8Bytes(), this.txtScanValue2.Text.Trim().GetUTF8Bytes(), checkedcolumns);
                    }
                    ChangeScanStatus(true);
                }
                else
                {
                    MessageBoxOperator.ShowInfo("Please Check one Column at least");
                }
            }
            catch (Exception ex)
            {
                MessageBoxOperator.ShowError(ex.Message);
                LogOperator.Get().Error(ex.ToString());
            }
        }
Example #2
0
 private void tsmiEnableTable_Click(object sender, EventArgs e)
 {
     try
     {
         HBaseThriftClient client = SetThriftServerForm.GetHBaseThriftClient();
         client.EnableTable(this.tvMain.SelectedNode.Text);
         this.btnRefresh_Click(null, null);
     }
     catch (Exception ex)
     {
         LogOperator.Get().Error(ex.ToString());
         MessageBoxOperator.ShowError(ex.Message);
     }
 }
Example #3
0
        private void btnRefresh_Click(object sender, EventArgs e)
        {
            this.Enabled = false;
            try
            {
                HBaseThriftClient client = SetThriftServerForm.GetHBaseThriftClient();
                var tables = client.GetAllTableDefinition();
                this.tvMain.Nodes[0].Nodes[0].Nodes.Clear();
                foreach (var table in tables)
                {
                    var tn = this.tvMain.Nodes[0].Nodes[0].Nodes.Add(table.Key);
                    tn.SetImageIndex(table.Value.Item2 ? 2 : 3);
                    tn.Tag = table.Value.Item1;

                    var schema = TableSchemaManager.GetInstance().Get(table.Key);
                    if (schema != null)
                    {
                        var ktn = tn.Nodes.Add("Row", string.Concat("Row", "(", schema.RowKeyType, ")"));
                        ktn.SetImageIndex(6);
                    }

                    foreach (var column in table.Value.Item1)
                    {
                        var stn = tn.Nodes.Add(column.StringName, string.Concat(column.StringName, "(", column.Compression, ")", "[", column.MaxVersions, "]"));
                        stn.SetImageIndex(4);
                        stn.Tag = column;
                        if (schema != null && schema.ColumnQualifierTypeAndFormats.ContainsKey(column.StringName))
                        {
                            foreach (var qualifier in schema.ColumnQualifierTypeAndFormats[column.StringName])
                            {
                                var qtn = stn.Nodes.Add(qualifier.Key, string.Concat(qualifier.Key, "(", qualifier.Value, ")"));
                                qtn.SetImageIndex(5);
                            }
                        }
                    }
                }
                this.tvMain.ExpandAll();
            }
            catch (Exception ex)
            {
                LogOperator.Get().Error(ex.ToString());
                MessageBoxOperator.ShowError(ex.Message);
            }
            finally
            {
                this.Enabled = true;
            }
        }
Example #4
0
 private void btnScanClose_Click(object sender, EventArgs e)
 {
     try
     {
         HBaseThriftClient.CloseScan(_scanID);
     }
     catch (Exception ex)
     {
         MessageBoxOperator.ShowError(ex.Message);
         LogOperator.Get().Error(ex.ToString());
     }
     finally
     {
         ChangeScanStatus(false);
     }
 }
Example #5
0
 private void btnScanNext_Click(object sender, EventArgs e)
 {
     try
     {
         this.ClearScanQuery();
         var result = HBaseThriftClient.DoScan(_scanID, (int)_maxScanCount.Value);
         if (result != null)
         {
             this.txtScanResult.Text   = TableSchemaManager.GetInstance().ProcessTRowResultToString(this.TableName, result);
             this.txtScanRowCount.Text = result.Count.ToString();
         }
     }
     catch (Exception ex)
     {
         MessageBoxOperator.ShowError(ex.Message);
         LogOperator.Get().Error(ex.ToString());
     }
 }
Example #6
0
        private void btnCreateTable_Click(object sender, EventArgs e)
        {
            NewTableForm form = new NewTableForm();

            if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                try
                {
                    HBaseThriftClient client = SetThriftServerForm.GetHBaseThriftClient();
                    client.CreateTable(form.TableName, null, form.Columns);
                    this.btnRefresh_Click(null, null);
                }
                catch (Exception ex)
                {
                    LogOperator.Get().Error(ex.ToString());
                    MessageBoxOperator.ShowError(ex.Message);
                }
            }
        }
Example #7
0
        private void btnSingleQuery_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrWhiteSpace(this.txtSingleQueryRowKey.Text))
            {
                this.Enabled = false;
                try
                {
                    this.ClearSingleQuery();
                    var    schema = TableSchemaManager.GetInstance().Get(this.TableName);
                    Type   t      = TableSchemaManager.ColumnDataTypes[schema.RowKeyType];
                    object v      = Convert.ChangeType(this.txtSingleQueryRowKey.Text, t);

                    byte[] rowkey = Extension.GetBytes(v, schema.RowKeyType, schema.RowKeyFormat);

                    List <string> checkedcolumns = new List <string>();
                    foreach (TreeNode cnode in this.tvQueryColumn.Nodes[0].Nodes)
                    {
                        if (cnode.Checked)
                        {
                            checkedcolumns.Add(cnode.Text.Substring(0, cnode.Text.Length - 1));
                        }
                        else
                        {
                            foreach (TreeNode qnode in cnode.Nodes)
                            {
                                if (qnode.Checked)
                                {
                                    checkedcolumns.Add(string.Concat(cnode.Text, qnode.Text));
                                }
                            }
                        }
                    }

                    if (checkedcolumns.Count != 0)
                    {
                        List <TRowResult> result = null;
                        long timestamp           = 0;
                        if (_enableSingleQueryTS.Checked)
                        {
                            timestamp = _singleQueryTS.Value.GetHBaseTimestamp();
                        }
                        result = SetThriftServerForm.GetHBaseThriftClient().SingleQuery(this.TableName, rowkey, checkedcolumns, timestamp);
                        if (result != null)
                        {
                            this.txtSingleQueryResult.Text   = TableSchemaManager.GetInstance().ProcessTRowResultToString(this.TableName, result);
                            this.txtSingleQueryRowCount.Text = result.Count.ToString();
                        }
                    }
                    else
                    {
                        MessageBoxOperator.ShowInfo("Please Check one Column at least");
                    }
                }
                catch (Exception ex)
                {
                    MessageBoxOperator.ShowError(ex.Message);
                    LogOperator.Get().Error(ex.ToString());
                }
                finally
                {
                    this.Enabled = true;
                }
            }
        }