void hsclient::close_stream() { // 关闭流连接,但并不释放流对象 stream_.close(); // 必须清除与该流对象相关的已经打开的表对象 clear_tables(); }
bool hsclient::open_tbl(const char* dbn, const char* tbl, const char* idx, const char* flds, const char* key) { if (!stream_.opened()) { clear_tables(); if (stream_.open(addr_, 60, 60) == false) { error_ = HS_ERR_CONN; tbl_curr_ = NULL; logger_error("open %s error(%s)", addr_, acl_last_serror()); return (false); } } tbl_curr_ = NEW hstable(id_max_++, dbn, tbl, idx, flds); cond_def_[0] = '='; cond_def_[1] = 0; buf_.clear(); buf_ << "P\t" << tbl_curr_->id_ << '\t' << dbn << '\t' << tbl << '\t' << idx << '\t' << flds << '\n'; if (stream_.write(buf_) == false) { error_ = HS_ERR_WRITE; close_stream(); delete tbl_curr_; tbl_curr_ = NULL; logger_error("send(%s) to %s error", buf_.c_str(), addr_); return (false); } buf_.clear(); if (stream_.gets(buf_) == false) { error_ = HS_ERR_READ; close_stream(); delete tbl_curr_; tbl_curr_ = NULL; logger_error("open error for read from %s", addr_); return (false); } bool ret = proto_.parse_respond(tbl_curr_->nfld_, buf_, error_, serror_); if (ret) tables_[key] = tbl_curr_; else { delete tbl_curr_; tbl_curr_ = NULL; } return (ret); }
QsForm_Main::QsForm_Main(QWidget* parent) : QDialog(parent), ui(new Ui::QsForm_Main) { ui->setupUi(this); ui->btStart->setIcon(QIcon("play.png")); ui->btBreak->setIcon(QIcon("stop.png")); ui->btNext->setIcon(QIcon("next.png")); ui->btSettings->setIcon(QIcon("set.png")); ui->hframe_step_all->hide(); ui->tbAuto1->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); ui->tbAuto2->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); ui->tbStepEvCal->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); clear_tables(); }
void QsForm_Main::on_btSettings_clicked() { connect(set_win, SIGNAL(settings_changed_signal()),this, SLOT(clear_tables()) ); set_win->show(); }