Ejemplo n.º 1
0
        /// <summary>
        /// 呼出元を検索する
        /// </summary>
        private void btnSrchCaller_Click(object sender, EventArgs e)
        {
            DictionaryEntry     Item     = (DictionaryEntry)ListBox1.SelectedItem;
            SymfowareDataReader sfReader = null;

            try
            {
                using (SymfowareConnection conn = DbUtil.GetConnection())
                {
                    sfReader = GetProcedureCaller(conn, Item.Value.ToString());
                    List <string> calls = new List <string>();
                    while (sfReader.Read())
                    {
                        calls.Add(DbUtil.GetValue(sfReader, "PROCEDURE_NAME"));
                    }
                    sfReader.Close();

                    MessageBox.Show(string.Join("; ", calls));
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                if (sfReader != null)
                {
                    sfReader.Close();
                }
            }
        }
Ejemplo n.º 2
0
        private void ListBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            DictionaryEntry     Item     = (DictionaryEntry)ListBox1.SelectedItem;
            SymfowareDataReader myReader = null;

            try
            {
                using (SymfowareConnection conn = DbUtil.GetConnection())
                {
                    myReader = GetProcedureDefinition(conn, Item.Key.ToString());
                    myReader.Read();

                    string strText = DbUtil.GetValue(myReader, "DESC_VALUE");

                    richTxtStoredDef.Text           = strText.Replace("\r", "\r\n");
                    richTxtStoredDef.SelectionStart = 0;
                    richTxtStoredDef.ScrollToCaret();

                    myReader.Close();

                    ShowStoredInfo(Item.Key.ToString());
                }
            }
            catch (Exception)
            {
                if (myReader != null)
                {
                    myReader.Close();
                }
            }
        }
Ejemplo n.º 3
0
        private void ShowTableList()
        {
            using (SymfowareConnection conn = DbUtil.GetConnection())
            {
                SymfowareDataReader sfReader = GetTableNameList(conn);

                while (sfReader.Read())
                {
                    string tabName    = DbUtil.GetValue(sfReader, "TABLE_NAME");
                    string tabCode    = DbUtil.GetValue(sfReader, "TABLE_CODE");
                    string dbCode     = DbUtil.GetValue(sfReader, "DB_CODE");
                    string schemaCode = DbUtil.GetValue(sfReader, "SCHEMA_CODE");
                    string tableOwner = DbUtil.GetValue(sfReader, "TABLE_OWNER");

                    string[] item = { tabName, tabCode, dbCode, schemaCode, tableOwner };
                    listViewTable.Items.Add(new ListViewItem(item));
                }

                sfReader.Close();
            }
            foreach (ListViewItem item in listViewTable.Items)
            {
                item.BackColor = item.Index % 2 == 0 ? Color.AntiqueWhite : Color.White;
            }
        }
Ejemplo n.º 4
0
        private void ShowProcedureList()
        {
            ListBox1.DisplayMember = "Value";
            ListBox1.ValueMember   = "Key";

            using (SymfowareConnection conn = DbUtil.GetConnection())
            {
                SymfowareDataReader myReader = GetProcedureNameList(conn);

                while (myReader.Read())
                {
                    string key   = DbUtil.GetValue(myReader, "PROCEDURE_NAME");
                    string value = DbUtil.GetValue(myReader, "PROCEDURE_CODE");
                    ListBox1.Items.Add(new DictionaryEntry(value, key));
                }

                myReader.Close();
            }
        }
Ejemplo n.º 5
0
        private void listViewTable_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (this.listViewTable.SelectedItems.Count == 0)
            {
                return;
            }
            string tableCode  = listViewTable.SelectedItems[0].SubItems[1].Text;
            string dbCode     = listViewTable.SelectedItems[0].SubItems[2].Text;
            string schemaCode = listViewTable.SelectedItems[0].SubItems[3].Text;

            string tableOwner = listViewTable.SelectedItems[0].SubItems[4].Text;

            txtInfo.Text = "Owner: {Owner}".Replace("{Owner}", tableOwner);

            listViewCol.Items.Clear();
            using (SymfowareConnection conn = DbUtil.GetConnection())
            {
                SymfowareDataReader sfReader = GetColumnList(conn, dbCode, schemaCode, tableCode);

                while (sfReader.Read())
                {
                    string colName  = DbUtil.GetValue(sfReader, "COLUMN_NAME");
                    string dataType = DbUtil.GetValue(sfReader, "DATA_TYPE");
                    string length   = DbUtil.GetValue(sfReader, "NUMERIC_PRECISION");
                    if (String.IsNullOrEmpty(length))
                    {
                        length = DbUtil.GetValue(sfReader, "CHAR_MAX_LENGTH");
                    }

                    string[] item = { colName, DbUtil.ReplaceColumnName(dataType), length };
                    listViewCol.Items.Add(new ListViewItem(item));
                }

                sfReader.Close();
            }
            foreach (ListViewItem item in listViewCol.Items)
            {
                item.BackColor = item.Index % 2 == 0 ? Color.PaleGreen : Color.White;
            }
        }
Ejemplo n.º 6
0
        private void btnExeProc_Click(object sender, EventArgs e)
        {
            List <ProcedureParameter> paramInfos = new List <ProcedureParameter>();
            DictionaryEntry           Item       = (DictionaryEntry)ListBox1.SelectedItem;

            using (SymfowareConnection conn = DbUtil.GetConnection())
            {
                SymfowareDataReader sfReader = GetProcedureParameterInfo(conn, Item.Key.ToString());
                while (sfReader.Read())
                {
                    ProcedureParameter paramInfo = new ProcedureParameter();
                    paramInfo.colType  = int.Parse(DbUtil.GetValue(sfReader, "COLUMN_TYPE"));
                    paramInfo.dataType = int.Parse(DbUtil.GetValue(sfReader, "DATA_TYPE"));
                    paramInfo.max      = int.Parse(DbUtil.GetValue(sfReader, "CHAR_MAX_LENGTH"));
                    paramInfo.colName  = DbUtil.GetValue(sfReader, "COLUMN_NAME");
                    paramInfos.Add(paramInfo);
                }
                sfReader.Close();
            }

            string strCommand = "CALL CRMSC." + Item.Value + "(";

            foreach (ProcedureParameter paramInfo in paramInfos)
            {
                strCommand += "?,";
            }
            strCommand = strCommand.TrimEnd(new Char[] { ',' }) + ")";

            using (SymfowareConnection conn = DbUtil.GetConnection())
            {
                SymfowareCommand command = new SymfowareCommand(strCommand, conn);
                command = DbUtil.CallProcedure(command, paramInfos);

                string text1 = "result:  " + command.Parameters["oERRMSG"].Value;
                command.Dispose();
            }
        }