void RowAggregator::reset() { while (!eof) { AggregateRowBuilder *n = nextResult(); if (n) n->Release(); } SuperHashTable::releaseAll(); eof = false; cursor = NULL; rowAllocator.clear(); totalSize = overhead = 0; }
Gui_AdminWindow::Gui_AdminWindow(QWidget* parent) : QWidget(parent) { _admin = new LinqAdmin; setWindowFlags(Qt::FramelessWindowHint); setWindowOpacity(0.95); setStyleSheet(QStringLiteral("QGroupBox{border:1px solid #000;border-radius:15px;} QGroupBox::title {subcontrol-origin: margin;subcontrol-position: top center;top:-6px;}")); QLabel* linkLabel = new QLabel("User list"); QLabel* groupLabel = new QLabel("Group list"); QPushButton* add = new QPushButton("Insert"); add->setIcon(QPixmap("img/add70.png")); linkLabel->setMaximumSize(120,20); groupLabel->setMaximumSize(120,20); _level = new QComboBox; _level->addItem("Basic", QVariant(0)); _level->addItem("Business", QVariant(1)); _level->addItem("Executive", QVariant(2)); tbar = new QToolBar; QToolButton* rm = new QToolButton(tbar); QToolButton* ok = new QToolButton(tbar); QToolButton* next = new QToolButton(tbar); QToolButton* delG = new QToolButton(tbar); rm->setIcon(QPixmap("img/cross108.png")); rm->setToolTip("Remove this user from Linqedin"); ok->setIcon(QPixmap("img/check67.png")); ok->setToolTip("Upgrade this user"); next->setIcon(QPixmap("img/right244.png")); next->setToolTip("Next result"); delG->setIcon(QPixmap("img/cross108.png")); delG->setToolTip("Delete group"); connect(rm, SIGNAL(clicked()), this, SLOT(removeUser())); connect(add, SIGNAL(clicked()), this, SLOT(addUser())); connect(ok, SIGNAL(clicked()), this, SLOT(upgradeUser())); connect(next, SIGNAL(clicked()), this, SLOT(nextResult())); connect(delG, SIGNAL(clicked()), this, SLOT(deleteGroup())); tbar->addWidget(rm); tbar->addWidget(ok); tbar->addWidget(next); tbar->addWidget(delG); tbar->actions().at(1)->setVisible(false); tbar->hide(); QGroupBox* _admbox = new QGroupBox; QGroupBox* _admins = new QGroupBox; for(int i = 0; i < 5; ++i) edt[i] = new QLineEdit; // search bar edt[3]->setEchoMode(QLineEdit::Password); edt[4]->setPlaceholderText("Search user"); createSearch(); connect(edt[4], SIGNAL(returnPressed()), this, SLOT(startSearch())); QVBoxLayout* _mainLayout = new QVBoxLayout; _mainLayout->setSpacing(20); QGridLayout* _layout = new QGridLayout; QGridLayout* _inslay = new QGridLayout; QFormLayout* frmsx = new QFormLayout; QFormLayout* frmdx = new QFormLayout; _userList = new QListWidget; _groupList = new QListWidget; _userInfo = new Gui_DisplayInfo; _userInfo->setReadOnly(true); QPushButton* quit = new QPushButton; quit->setIcon(QPixmap("img/prohibited1.png")); connect(quit, SIGNAL(clicked()), this, SLOT(close())); createUserList(); createGroupList(); _mainLayout->addWidget(quit, 0, Qt::AlignTop | Qt::AlignRight); _layout->addWidget(linkLabel, 0, 0, 1, 1); _layout->addWidget(_userInfo, 0, 1, 4, 1); _layout->addWidget(_userList, 1, 0, 1, 1); _layout->addWidget(groupLabel, 2, 0, 1, 1); _layout->addWidget(_groupList, 3, 0, 1, 1); _layout->addWidget(edt[4], 4, 0, 1, 1); _layout->addWidget(tbar, 4, 1, 1, 1, Qt::AlignCenter); _layout->setRowStretch(0,0); _layout->setRowStretch(1,1); _layout->setRowStretch(2,0); _layout->setColumnStretch(0,1); _layout->setColumnStretch(1,5); frmsx->addRow("Name:", edt[0]); frmdx->addRow("Surname:", edt[1]); frmsx->addRow("Username:"******"Password:"******"Privilege:", _level); _inslay->addLayout(frmsx, 0, 0, 1, 1); _inslay->addLayout(frmdx, 0, 1, 1, 1); _inslay->addWidget(add, 1, 1, 1, 1, Qt::AlignCenter); _admbox->setLayout(_layout); _admins->setLayout(_inslay); _mainLayout->addWidget(_admbox); _mainLayout->addWidget(_admins); setLayout(_mainLayout); connect(this, SIGNAL(modified()), this, SLOT(refreshLists())); move(100, 30); resize(1150, 720); }
Result PreparedStatement::execute() { PGconn *conn = m_conn.lock().get(); boost::shared_ptr<PGresult> result, next; int nParams = (int)m_params.size(); Oid *paramTypes = NULL; int *paramLengths = NULL, *paramFormats = NULL; const char **params = NULL; if (nParams) { if (m_name.empty()) paramTypes = &m_paramTypes[0]; params = &m_params[0]; paramLengths = &m_paramLengths[0]; paramFormats = &m_paramFormats[0]; } const char *api = NULL; #ifndef WINDOWS SchedulerSwitcher switcher(m_scheduler); #endif if (m_name.empty()) { #ifndef WINDOWS if (m_scheduler) { api = "PQsendQueryParams"; if (!PQsendQueryParams(conn, m_command.c_str(), nParams, paramTypes, params, paramLengths, paramFormats, m_resultFormat)) throwException(conn); flush(conn, m_scheduler); next.reset(nextResult(conn, m_scheduler), &PQclear); while (next) { result = next; next.reset(nextResult(conn, m_scheduler), &PQclear); if (next) { ExecStatusType status = PQresultStatus(next.get()); MORDOR_LOG_VERBOSE(g_log) << conn << "PQresultStatus(" << next.get() << "): " << PQresStatus(status); switch (status) { case PGRES_COMMAND_OK: case PGRES_TUPLES_OK: break; default: throwException(next.get()); MORDOR_NOTREACHED(); } } } } else #endif { api = "PQexecParams"; result.reset(PQexecParams(conn, m_command.c_str(), nParams, paramTypes, params, paramLengths, paramFormats, m_resultFormat), &PQclear); } } else { #ifndef WINDOWS if (m_scheduler) { api = "PQsendQueryPrepared"; if (!PQsendQueryPrepared(conn, m_name.c_str(), nParams, params, paramLengths, paramFormats, 1)) throwException(conn); flush(conn, m_scheduler); next.reset(nextResult(conn, m_scheduler), &PQclear); while (next) { result = next; next.reset(nextResult(conn, m_scheduler), &PQclear); if (next) { ExecStatusType status = PQresultStatus(next.get()); MORDOR_LOG_VERBOSE(g_log) << conn << "PQresultStatus(" << next.get() << "): " << PQresStatus(status); switch (status) { case PGRES_COMMAND_OK: case PGRES_TUPLES_OK: break; default: throwException(next.get()); MORDOR_NOTREACHED(); } } } } else #endif { api = "PQexecPrepared"; result.reset(PQexecPrepared(conn, m_name.c_str(), nParams, params, paramLengths, paramFormats, m_resultFormat), &PQclear); } } if (!result) throwException(conn); ExecStatusType status = PQresultStatus(result.get()); MORDOR_ASSERT(api); MORDOR_LOG_VERBOSE(g_log) << conn << " " << api << "(\"" << m_command << m_name << "\", " << nParams << "), PQresultStatus(" << result.get() << "): " << PQresStatus(status); switch (status) { case PGRES_COMMAND_OK: case PGRES_TUPLES_OK: return Result(result); default: throwException(result.get()); MORDOR_NOTREACHED(); } }