/// <summary> /// 指定各分区表空间按钮的点击事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAssignTablespace_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { //如果分区信息集合已经初始化 if (this._partitionInfoSet.Count != 0) { if (this._frmAssignTablespace == null || this._frmAssignTablespace.IsDisposed) { this._frmAssignTablespace = new FormAssignTablespace(this._partitionInfoSet, QueryUnityInfo.QueryTablespace(this._dbHelper)); } this._frmAssignTablespace.ShowDialog(); for (int i = 0; i < this._partitionInfoSet.Count; i++) { this._partitionInfoSet[i].Tablespace = this._frmAssignTablespace.PartitionInfoSet.Rows[i]["Tablespace"].ToString(); if (!RegexCheck.IsEmpty(this._partitionInfoSet[i].Tablespace)) { this.btnAssignTablespace.Text += this._partitionInfoSet[i].Tablespace + " | "; } } this._frmAssignTablespace = null; } }
/// <summary> /// 检查Dbtune配置流程涉及参数 /// </summary> /// <returns></returns> internal static bool CheckDbtuneConfigParam(MemoEdit txbBlog, DbtuneConfigParam dbtuneConfigParam) { if (dbtuneConfigParam.DBHelper == null) { WriteBlog(txbBlog, "--- 数据库连接异常, 请查看错误日志"); return(false); } else if (dbtuneConfigParam.FeatureClass == null) { WriteBlog(txbBlog, "--- 未指定要素类"); return(false); } else if (RegexCheck.IsEmpty(dbtuneConfigParam.BasicField)) { WriteBlog(txbBlog, "--- 未指定分区列"); return(false); } else if (dbtuneConfigParam.PartitionWay == EnumPartitionWay.Unknow) { WriteBlog(txbBlog, "--- 未指定分区方式"); return(false); } else if (!RegexCheck.IsFull(dbtuneConfigParam.TablespaceSet)) { WriteBlog(txbBlog, "--- 存在没有指定表空间的分区"); return(false); } else if (DbtuneXMLOperate.CheckKeyWordExist(dbtuneConfigParam.DbtuneKeyWord)) { WriteBlog(txbBlog, "--- 关键字为 " + dbtuneConfigParam.DbtuneKeyWord + "的配置项已经存在,请更改关键字"); return(false); } else { if (dbtuneConfigParam.PartitionWay == EnumPartitionWay.Range) { if (dbtuneConfigParam.PartitionCount == -1) { WriteBlog(txbBlog, "--- 未指定范围分区数"); return(false); } else { return(true); } } else { return(true); } } }
/// <summary> /// 检查分区流程涉及参数 /// </summary> /// <returns></returns> internal static bool CheckPartitionParam(MemoEdit txbBlog, PartitionParam partitionParam) { if (partitionParam.DBHelper == null) { WriteBlog(txbBlog, "--- 数据库连接异常, 请查看错误日志"); return(false); } else if (RegexCheck.IsEmpty(partitionParam.TablespaceName)) { WriteBlog(txbBlog, "--- 未指定表空间"); return(false); } else if (RegexCheck.IsEmpty(partitionParam.OriginTableName)) { WriteBlog(txbBlog, "--- 未指定初始表"); return(false); } else if (RegexCheck.IsEmpty(partitionParam.BasicField)) { WriteBlog(txbBlog, "--- 未指定分区列"); return(false); } else if (partitionParam.PartitionWay == EnumPartitionWay.Unknow) { WriteBlog(txbBlog, "--- 未指定分区方式"); return(false); } else if (!RegexCheck.IsFull(partitionParam.TablespaceSet)) { WriteBlog(txbBlog, "--- 存在没有指定表空间的分区"); return(false); } else if (RegexCheck.IsExist(QueryUnityInfo.QueryTotalTable(partitionParam.DBHelper, partitionParam.TablespaceName), partitionParam.PartitionedTableName)) { WriteBlog(txbBlog, "--- 名字为 " + partitionParam.PartitionedTableName + "的表已经存在,请更改导出名"); return(false); } else { if (partitionParam.PartitionWay == EnumPartitionWay.Range && partitionParam.PartitionCount == -1) { WriteBlog(txbBlog, "---未指定范围分区数"); return(false); } else { return(true); } } }
/// <summary> /// 检查所有分区是否都已指定表空间 /// </summary> /// <returns></returns> private bool CheckInfoComplete() { bool isInfoComplete = true; for (int i = 0; i < PartitionInfoSet.Rows.Count; i++) { if (RegexCheck.IsEmpty(PartitionInfoSet.Rows[i]["Tablespace"].ToString())) { isInfoComplete = false; break; } } return(isInfoComplete); }
/// <summary> /// 设置分区工作流程参数 /// </summary> private void SetPartitionParam() { if (this._dbHelper != null) { this._partitionParam.DBHelper = this._dbHelper; } if (this.cmbTablespace.SelectedIndex != -1) { this._partitionParam.TablespaceName = this.cmbTablespace.SelectedItem.ToString(); } if (this.cmbOriginTable.SelectedIndex != -1) { this._partitionParam.OriginTableName = this.cmbOriginTable.SelectedItem.ToString(); } if (this.cmbColumnIdentity.SelectedIndex != -1) { this._partitionParam.BasicField = this.cmbColumnIdentity.SelectedItem.ToString(); } if (this.cmbPartitionWay.SelectedIndex != -1) { if (this.cmbPartitionWay.SelectedIndex == (int)EnumPartitionWay.List) { this._partitionParam.PartitionWay = EnumPartitionWay.List; } else if (this.cmbPartitionWay.SelectedIndex == (int)EnumPartitionWay.Range) { this._partitionParam.PartitionWay = EnumPartitionWay.Range; } } if (this._partitionCount != -1 && this.cmbPartitionWay.SelectedIndex == (int)EnumPartitionWay.Range) { this._partitionParam.PartitionCount = this._partitionCount; } if (this._partitionInfoSet != null) { List <string> tablespaceSet = new List <string>(); for (int i = 0; i < this._partitionInfoSet.Count; i++) { tablespaceSet.Add(this._partitionInfoSet[i].Tablespace); } this._partitionParam.TablespaceSet = tablespaceSet; } if (!RegexCheck.IsEmpty(this.txbTargetName.Text)) { this._partitionParam.PartitionedTableName = this.txbTargetName.Text; } }
/// <summary> /// 检查数据库连接参数 /// </summary> /// <returns></returns> internal static bool CheckConnectParam(MemoEdit txbBlog, DbConnectParam dbConnectParam) { if (RegexCheck.IsEmpty(dbConnectParam.DBServer)) { WriteBlog(txbBlog, "--- 未指定IP地址"); return(false); } else if (!RegexCheck.IsIPv4(dbConnectParam.DBServer)) { WriteBlog(txbBlog, "--- 指定的IP地址格式不正确"); return(false); } else if (RegexCheck.IsEmpty(dbConnectParam.DbPort)) { WriteBlog(txbBlog, "--- 未指定端口号"); return(false); } else if (!RegexCheck.IsUint(dbConnectParam.DbPort)) { WriteBlog(txbBlog, "--- 指定的端口号格式不正确"); return(false); } else if (RegexCheck.IsEmpty(dbConnectParam.DbSid)) { WriteBlog(txbBlog, "--- 未指定实例名"); return(false); } else if (RegexCheck.IsEmpty(dbConnectParam.DbUser)) { WriteBlog(txbBlog, "--- 未指定登陆名"); return(false); } else if (RegexCheck.IsEmpty(dbConnectParam.DbPwd)) { WriteBlog(txbBlog, "--- 未指定口令"); return(false); } else { return(true); } }
/// <summary> /// 设置数据库连接参数 /// </summary> private void SetDbConnectParam() { if (!RegexCheck.IsEmpty(this.txbDBServer.Text)) { this._dbConnectParam.DBServer = this.txbDBServer.Text; } if (!RegexCheck.IsEmpty(this.txbDbPort.Text)) { this._dbConnectParam.DbPort = this.txbDbPort.Text; } if (!RegexCheck.IsEmpty(this.txbDbSid.Text)) { this._dbConnectParam.DbSid = this.txbDbSid.Text; } if (!RegexCheck.IsEmpty(this.txbDbUser.Text)) { this._dbConnectParam.DbUser = this.txbDbUser.Text; } if (!RegexCheck.IsEmpty(this.txbDbPwd.Text)) { this._dbConnectParam.DbPwd = this.txbDbPwd.Text; } }