本文整理汇总了C++中commit函数的典型用法代码示例。如果您正苦于以下问题:C++ commit函数的具体用法?C++ commit怎么用?C++ commit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了commit函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sqlCreateTable
//.........这里部分代码省略.........
for (int j = 0; j < planlist.size(); ++j) {
FieldCreationPlan& plan = planlist[j];
const Field* intended_field = plan.intended_field;
if (!intended_field) {
// This shouldn't happen!
continue;
}
if (!plan.exists_in_db && intended_field->name() == info.name) {
plan.exists_in_db = true;
plan.add = false;
plan.change = (
info.type != intended_field->sqlColumnType() ||
info.notnull != intended_field->allowsNull() ||
info.pk != intended_field->isPk()
);
plan.existing_type = info.type;
plan.existing_not_null = info.notnull;
existing_is_superfluous = false;
}
}
if (existing_is_superfluous) {
FieldCreationPlan plan;
plan.name = info.name;
plan.exists_in_db = true;
plan.existing_type = info.type;
plan.drop = true;
planlist.append(plan);
}
}
// 3. For any fields that require adding: add them.
// For any that require dropping or altering, make a note for the
// complex step.
bool drop_or_change_mods_required = false;
for (int i = 0; i < planlist.size(); ++i) {
const FieldCreationPlan& plan = planlist.at(i);
if (plan.add && plan.intended_field) {
if (plan.intended_field->isPk()) {
UiFunc::stopApp(QString(
"DbFunc::createTable: Cannot add a PRIMARY KEY column "
"(%s.%s)").arg(tablename, plan.name));
}
exec(db, QString("ALTER TABLE %1 ADD COLUMN %2 %3").arg(
tablename,
delimit(plan.name),
plan.intended_field->sqlColumnDef()));
}
if (plan.drop || plan.change) {
drop_or_change_mods_required = true;
}
}
/*
qDebug() << Q_FUNC_INFO
<< "tablename:" << tablename
<< "goodfieldlist:" << goodfieldlist
<< "infolist:" << infolist
<< "modifications_required:" << drop_or_change_mods_required
<< "plan:" << planlist;
*/
if (!drop_or_change_mods_required) {
qDebug() << "Table" << tablename
<< "OK; no drop/change alteration required";
return;
}
// 4. Implement drop/change modifications (via a temporary table).
qDebug().nospace() << "Amendment plan for " << tablename
<< ": " << planlist;
// Deleting columns: http://www.sqlite.org/faq.html#q11
// ... also http://stackoverflow.com/questions/8442147/
// Basically, requires (a) copy data to temporary table; (b) drop original;
// (c) create new; (d) copy back.
// Or, another method: (a) rename table; (b) create new; (c) copy data
// across; (d) drop temporary.
// We deal with fields of incorrect type similarly (in this case, any
// conversion occurs as we SELECT back the values into the new, proper
// fields). Not sure it really is important, though:
// http://sqlite.org/datatype3.html
QString dummytable = tablename + tempsuffix;
if (tableExists(db, dummytable)) {
UiFunc::stopApp("DbFunc::createTable: temporary table exists: " +
dummytable);
}
QString delimited_tablename = delimit(tablename);
QString delimited_dummytable = delimit(dummytable);
QString goodfieldstring = goodfieldlist.join(",");
exec(db, "BEGIN TRANSACTION");
exec(db, QString("ALTER TABLE %1 RENAME TO %2").arg(delimited_tablename,
delimited_dummytable));
exec(db, creation_sql); // make a new clean table
exec(db, QString("INSERT INTO %1 (%2) SELECT %3 FROM %4").arg(
delimited_tablename,
goodfieldstring,
goodfieldstring,
delimited_dummytable));
exec(db, QString("DROP TABLE %1").arg(delimited_dummytable));
commit(db);
}
示例2: KviWindowToolWidget
KviModeEditor::KviModeEditor(QWidget * par, KviWindowToolPageButton * button, const char * name, KviChannelWindow * pChan)
: KviWindowToolWidget(par, button)
{
setObjectName(name);
m_pChannel = pChan;
QGridLayout * pMasterLayout = new QGridLayout(this);
setFocusPolicy(Qt::ClickFocus);
QScrollArea * pScrollArea = new QScrollArea(this);
pScrollArea->viewport()->setBackgroundRole(QPalette::Background);
pMasterLayout->addWidget(pScrollArea, 0, 0);
pMasterLayout->setRowStretch(1, 1);
m_pButton = new QPushButton("", this);
pMasterLayout->addWidget(m_pButton, 1, 0);
connect(m_pButton, SIGNAL(clicked()), this, SLOT(commit()));
if(!m_pChannel || !m_pChannel->connection())
m_pButton->setText(__tr2qs("Close"));
QWidget * pBackground = new QWidget(pScrollArea->viewport());
QGridLayout * g = new QGridLayout(pBackground);
QLabel * l = new QLabel("", pBackground);
l->setPixmap(*(g_pIconManager->getSmallIcon(KviIconManager::Mode)));
g->addWidget(l, 0, 0);
l = new QLabel(__tr2qs("Channel modes"), pBackground);
g->addWidget(l, 0, 1, 1, 1);
QFrame * f = new QFrame(pBackground);
f->setFrameStyle(QFrame::HLine | QFrame::Sunken);
g->addWidget(f, 1, 0, 1, 3);
QCheckBox * pCheckBox = nullptr;
QLineEdit * pLineEdit = nullptr;
int iRow = 1;
QString szTmp;
QString cDesc;
char cMode = 0;
//NOTE: this is a fallback is for some reason we don't have a serverInfo() struct available fot this connection
// The connection is dead and the context was destroyed, don't guess on what was there
if(!m_pChannel || !m_pChannel->connection())
return;
// first, the basic checkable modes pstnmi
QString szModes = "pstnmi";
while(!szModes.isEmpty())
{
cMode = szModes[0].unicode();
szModes.remove(0, 1);
szTmp = QString("%1: %2").arg(cMode).arg(*(getModeDescription(cMode)));
pCheckBox = new QCheckBox(szTmp, pBackground);
m_pCheckBoxes.insert(cMode, pCheckBox);
if(pChan)
pCheckBox->setChecked(pChan->plainChannelMode().contains(cMode));
iRow++;
g->addWidget(pCheckBox, iRow, 0, 1, 3);
}
// second, che basic modes with parameter lk
szModes = "lk";
while(!szModes.isEmpty())
{
cMode = szModes[0].unicode();
szModes.remove(0, 1);
szTmp = QString("%1: %2").arg(cMode).arg(*(getModeDescription(cMode)));
pCheckBox = new QCheckBox(szTmp, pBackground);
m_pCheckBoxes.insert(cMode, pCheckBox);
iRow++;
g->addWidget(pCheckBox, iRow, 0, 1, 3);
connect(pCheckBox, SIGNAL(toggled(bool)), this, SLOT(checkBoxToggled(bool)));
pLineEdit = new QLineEdit(pBackground);
m_pLineEdits.insert(cMode, pLineEdit);
iRow++;
g->addWidget(pLineEdit, iRow, 1, 1, 2);
if(pChan)
{
if(pChan->hasChannelMode(cMode))
{
pCheckBox->setChecked(true);
pLineEdit->setText(pChan->channelModeParam(cMode));
}
else
{
pLineEdit->setEnabled(false);
}
//.........这里部分代码省略.........
示例3: commit
void c2040_fdc_t::stop_writing(const attotime &tm)
{
commit(tm);
cur_live.write_start_time = attotime::never;
}
示例4: while
void blizzard::http::process()
{
bool quit = false;
int res = 0;
while (!quit)
{
switch (state_)
{
case sUndefined:
want_read = true;
want_write = false;
state_ = sReadingHead;
break;
case sReadingHead:
res = parse_title();
if (res > 0)
{
state_ = sDone;
quit = true;
}
else if (res < 0)
{
quit = true;
}
break;
case sReadingHeaders:
res = parse_header_line();
if (res > 0)
{
state_ = sDone;
quit = true;
}
else if (res < 0)
{
quit = true;
}
if (state_ == sReadyToHandle)
{
quit = true;
}
break;
case sReadingPost:
res = parse_post();
if (res < 0)
{
quit = true;
}
break;
case sReadyToHandle:
commit();
state_ = sWriting;
break;
case sWriting:
want_write = true;
res = write_data();
if (res < 0)
{
quit = true;
}
break;
case sDone:
quit = true;
break;
default:
break;
}
}
}
示例5: printf
QQuickShaderEffectNode* QQuickCustomParticle::buildCustomNodes()
{
if (QOpenGLContext::currentContext()->isOpenGLES() && m_count * 4 > 0xffff) {
printf("CustomParticle: Too many particles... \n");
return 0;
}
if (m_count <= 0) {
printf("CustomParticle: Too few particles... \n");
return 0;
}
if (m_groups.isEmpty())
return 0;
QQuickShaderEffectNode *rootNode = 0;
QQuickShaderEffectMaterial *material = new QQuickShaderEffectMaterial;
m_dirtyProgram = true;
foreach (const QString &str, m_groups){
int gIdx = m_system->groupIds[str];
int count = m_system->groupData[gIdx]->size();
QQuickShaderEffectNode* node = new QQuickShaderEffectNode();
m_nodes.insert(gIdx, node);
node->setMaterial(material);
//Create Particle Geometry
int vCount = count * 4;
int iCount = count * 6;
QSGGeometry *g = new QSGGeometry(PlainParticle_AttributeSet, vCount, iCount);
g->setDrawingMode(GL_TRIANGLES);
node->setGeometry(g);
node->setFlag(QSGNode::OwnsGeometry, true);
PlainVertex *vertices = (PlainVertex *) g->vertexData();
for (int p=0; p < count; ++p) {
commit(gIdx, p);
vertices[0].tx = 0;
vertices[0].ty = 0;
vertices[1].tx = 1;
vertices[1].ty = 0;
vertices[2].tx = 0;
vertices[2].ty = 1;
vertices[3].tx = 1;
vertices[3].ty = 1;
vertices += 4;
}
quint16 *indices = g->indexDataAsUShort();
for (int i=0; i < count; ++i) {
int o = i * 4;
indices[0] = o;
indices[1] = o + 1;
indices[2] = o + 2;
indices[3] = o + 1;
indices[4] = o + 3;
indices[5] = o + 2;
indices += 6;
}
}
示例6: commit
void PerforcePart::slotCommit()
{
commit( popupfile );
}
示例7: switch
void c64h156_device::live_run(const attotime &limit)
{
if(cur_live.state == IDLE || cur_live.next_state != -1)
return;
for(;;) {
switch(cur_live.state) {
case RUNNING: {
bool syncpoint = false;
if (cur_live.tm > limit)
return;
int bit = get_next_bit(cur_live.tm, limit);
if(bit < 0)
return;
int cell_counter = cur_live.cell_counter;
if (bit) {
cur_live.cycle_counter = cur_live.ds;
cur_live.cell_counter = 0;
} else {
cur_live.cycle_counter++;
}
if (cur_live.cycle_counter == 16) {
cur_live.cycle_counter = cur_live.ds;
cur_live.cell_counter++;
cur_live.cell_counter &= 0xf;
}
if (!BIT(cell_counter, 1) && BIT(cur_live.cell_counter, 1)) {
// read bit
cur_live.shift_reg <<= 1;
cur_live.shift_reg |= !(BIT(cur_live.cell_counter, 3) || BIT(cur_live.cell_counter, 2));
cur_live.shift_reg &= 0x3ff;
if (LOG) logerror("%s read bit %u (%u) >> %03x, oe=%u soe=%u sync=%u byte=%u\n", cur_live.tm.as_string(), cur_live.bit_counter,
!(BIT(cur_live.cell_counter, 3) || BIT(cur_live.cell_counter, 2)), cur_live.shift_reg, cur_live.oe, cur_live.soe, cur_live.sync, cur_live.byte);
syncpoint = true;
}
if (BIT(cell_counter, 1) && !BIT(cur_live.cell_counter, 1) && !cur_live.oe) {
write_next_bit(BIT(cur_live.shift_reg_write, 7), limit);
}
int sync = !((cur_live.shift_reg == 0x3ff) && cur_live.oe);
if (!sync) {
cur_live.bit_counter = 8;
} else if (!BIT(cell_counter, 1) && BIT(cur_live.cell_counter, 1) && cur_live.sync) {
cur_live.bit_counter++;
cur_live.bit_counter &= 0xf;
}
int byte = !(((cur_live.bit_counter & 7) == 7) && cur_live.soe && !(cur_live.cell_counter & 2));
int load = !(((cur_live.bit_counter & 7) == 7) && ((cur_live.cell_counter & 3) == 3));
if (!load) {
if (cur_live.oe) {
cur_live.shift_reg_write = cur_live.shift_reg;
if (LOG) logerror("%s load write shift register from read shift register %02x\n",cur_live.tm.as_string(),cur_live.shift_reg_write);
} else {
cur_live.shift_reg_write = cur_live.yb;
if (LOG) logerror("%s load write shift register from YB %02x\n",cur_live.tm.as_string(),cur_live.shift_reg_write);
}
} else if (!BIT(cell_counter, 1) && BIT(cur_live.cell_counter, 1)) {
cur_live.shift_reg_write <<= 1;
cur_live.shift_reg_write &= 0xff;
if (LOG) logerror("%s shift write register << %02x\n", cur_live.tm.as_string(), cur_live.shift_reg_write);
}
// update signals
if (byte != cur_live.byte) {
if (!byte || !cur_live.accl) {
if (LOG) logerror("%s BYTE %u\n", cur_live.tm.as_string(),byte);
cur_live.byte = byte;
syncpoint = true;
}
if (!byte) {
cur_live.accl_yb = cur_live.shift_reg & 0xff;
}
}
if (sync != cur_live.sync) {
if (LOG) logerror("%s SYNC %u\n", cur_live.tm.as_string(),sync);
cur_live.sync = sync;
syncpoint = true;
}
if (syncpoint) {
commit(cur_live.tm);
cur_live.tm += m_period;
live_delay(RUNNING_SYNCPOINT);
return;
}
//.........这里部分代码省略.........
示例8: WHERE
//.........这里部分代码省略.........
int cntctResult = _contact->save();
if (cntctResult < 0)
{
rollback.exec();
ErrorReporter::error(QtCriticalMsg, this, tr("Error Saving Contact"),
storedProcErrorLookup("saveContact", cntctResult));
return false;
}
XSqlQuery upsq;
if (_mode == cNew)
upsq.prepare("INSERT INTO emp ("
" emp_code, emp_number, emp_active, emp_cntct_id,"
" emp_warehous_id, emp_mgr_emp_id,"
" emp_wage_type, emp_wage, emp_wage_curr_id, emp_wage_period,"
" emp_dept_id, emp_shift_id, emp_notes, emp_image_id,"
" emp_extrate, emp_extrate_period, emp_startdate, emp_name"
") VALUES ("
" :code, :number, :active, :cntct_id,"
" :warehous_id, :mgr_emp_id,"
" :wage_type, :wage, :wage_curr_id, :wage_period,"
" :dept_id, :shift_id, :notes, :image_id,"
" :extrate, :extrate_period, :startdate, :name"
") RETURNING emp_id;");
else if (_mode == cEdit)
{
upsq.prepare("UPDATE emp SET"
" emp_code=:code,"
" emp_number=:number,"
" emp_active=:active,"
" emp_cntct_id=:cntct_id,"
" emp_warehous_id=:warehous_id,"
" emp_mgr_emp_id=:mgr_emp_id,"
" emp_wage_type=:wage_type,"
" emp_wage=:wage,"
" emp_wage_curr_id=:wage_curr_id,"
" emp_wage_period=:wage_period,"
" emp_dept_id=:dept_id,"
" emp_shift_id=:shift_id,"
" emp_notes=:notes,"
" emp_image_id=:image_id,"
" emp_extrate=:extrate,"
" emp_extrate_period=:extrate_period,"
" emp_startdate=:startdate,"
" emp_name=:name"
" WHERE (emp_id=:emp_id)"
" RETURNING emp_id;" );
upsq.bindValue(":emp_id", _empid);
}
upsq.bindValue(":code", _code->text());
upsq.bindValue(":number", _number->text());
upsq.bindValue(":active", _active->isChecked());
if (_contact->isValid())
upsq.bindValue(":cntct_id", _contact->id());
if (_site->isValid())
upsq.bindValue(":warehous_id", _site->id());
if (_mgr->isValid())
upsq.bindValue(":mgr_emp_id", _mgr->id());
upsq.bindValue(":wage_type", _wagetype->code());
upsq.bindValue(":wage", _rate->localValue());
if (_rate->id() > 0)
upsq.bindValue(":wage_curr_id", _rate->id());
upsq.bindValue(":wage_period", _per->code());
if (_dept->isValid())
upsq.bindValue(":dept_id", _dept->id());
if (_shift->isValid())
upsq.bindValue(":shift_id", _shift->id());
upsq.bindValue(":notes", _notes->toPlainText());
if (_image->isValid())
upsq.bindValue(":image_id", _image->id());
upsq.bindValue(":extrate", _externalRate->localValue());
upsq.bindValue(":extrate_period", _perExt->code());
upsq.bindValue(":startdate", _startDate->date());
upsq.bindValue(":name", _name->text());
upsq.exec();
if (upsq.first())
_empid = upsq.value("emp_id").toInt();
else if (upsq.lastError().type() != QSqlError::NoError)
{
rollback.exec();
ErrorReporter::error(QtCriticalMsg, this, tr("Error saving Employee"),
upsq, __FILE__, __LINE__);
return false;
}
XSqlQuery commit("COMMIT;");
emit saved();
omfgThis->sEmployeeUpdated(_empid);
if (pClose)
done(_empid);
else
sPopulate();
return true;
}
示例9: setMethodBodyByAssignment
void setMethodBodyByAssignment(std::function<R(const typename fakeit::test_arg<arglist>::type...)> method) {
appendAction(new RepeatForever<R, arglist...>(method));
commit();
}
示例10: append_entry
void append_entry(PGconn *conn,struct entry *newentry,
unsigned int batch_number,unsigned int paper_index,
unsigned int paper_version)
/*
Insert the entry into the database.
*/
{
char *table_name,*oi;
int electorate_code;
int paper_id,entry_index=1,i;
/* get electorate code */
electorate_code = SQL_singleton_int(conn,
"SELECT electorate_code "
"FROM batch "
"WHERE number = %u;",
batch_number);
if (electorate_code < 0)
bailout("append_entry could not find batch number %u.\n",
batch_number);
/* get electorate name in order to access that Electorates
preference table */
table_name = resolve_electorate_name(conn,electorate_code);
/* Start the transaction */
begin(conn);
/* Check paper exists */
paper_id = SQL_singleton_int(conn,
"SELECT id FROM paper WHERE index = %u "
"AND batch_number = %u;",
paper_index,batch_number);
/* Insert new paper if necessary */
if (paper_id < 0) {
SQL_command(conn,
"INSERT INTO "
"paper(batch_number,index) "
"VALUES(%u,%u);",batch_number,paper_index);
entry_index = 1;
paper_id = get_seq_currval(conn,"paper_id_seq");
}
else {
/* Get last entry index for this paper */
entry_index = SQL_singleton_int(conn,
"SELECT MAX(index) FROM entry "
"WHERE paper_id = %d;",
paper_id);
if (entry_index < 0)
entry_index = 1; /* It must be the first one */
else
entry_index++;
}
/* Insert new entry */
SQL_command(conn,
"INSERT INTO entry(index,operator_id,"
"paper_id,num_preferences,paper_version) "
"VALUES(%u,'%s',%u,%u,%u);",
entry_index,oi=eq_malloc(newentry->e.operator_id),
paper_id,newentry->e.num_preferences,paper_version);
free(oi);
/* Insert the preferences */
for (i=0; i<newentry->e.num_preferences; i++) {
SQL_command(conn,
"INSERT INTO %s "
"VALUES(CURRVAL('entry_id_seq'),%u,%u,%u);",
table_name,
newentry->preferences[i].group_index,
newentry->preferences[i].db_candidate_index,
newentry->preferences[i].prefnum);
}
/* Complete the transaction */
commit(conn);
}
示例11: disconnect
void ElementManager::reset()
{
// We disconnect from Interpreter
disconnect(Interpreter::getInstance(), SIGNAL(workDone()), this, SLOT(commit()));
}
示例12: get_node_properties
bool database::_push_block(const signed_block& new_block)
{ try {
uint32_t skip = get_node_properties().skip_flags;
if( !(skip&skip_fork_db) )
{
/// TODO: if the block is greater than the head block and before the next maitenance interval
// verify that the block signer is in the current set of active witnesses.
shared_ptr<fork_item> new_head = _fork_db.push_block(new_block);
//If the head block from the longest chain does not build off of the current head, we need to switch forks.
if( new_head->data.previous != head_block_id() )
{
//If the newly pushed block is the same height as head, we get head back in new_head
//Only switch forks if new_head is actually higher than head
if( new_head->data.block_num() > head_block_num() )
{
wlog( "Switching to fork: ${id}", ("id",new_head->data.id()) );
auto branches = _fork_db.fetch_branch_from(new_head->data.id(), head_block_id());
// pop blocks until we hit the forked block
while( head_block_id() != branches.second.back()->data.previous )
pop_block();
// push all blocks on the new fork
for( auto ritr = branches.first.rbegin(); ritr != branches.first.rend(); ++ritr )
{
ilog( "pushing blocks from fork ${n} ${id}", ("n",(*ritr)->data.block_num())("id",(*ritr)->data.id()) );
optional<fc::exception> except;
try {
undo_database::session session = _undo_db.start_undo_session();
apply_block( (*ritr)->data, skip );
_block_id_to_block.store( (*ritr)->id, (*ritr)->data );
session.commit();
}
catch ( const fc::exception& e ) { except = e; }
if( except )
{
wlog( "exception thrown while switching forks ${e}", ("e",except->to_detail_string() ) );
// remove the rest of branches.first from the fork_db, those blocks are invalid
while( ritr != branches.first.rend() )
{
_fork_db.remove( (*ritr)->data.id() );
++ritr;
}
_fork_db.set_head( branches.second.front() );
// pop all blocks from the bad fork
while( head_block_id() != branches.second.back()->data.previous )
pop_block();
// restore all blocks from the good fork
for( auto ritr = branches.second.rbegin(); ritr != branches.second.rend(); ++ritr )
{
auto session = _undo_db.start_undo_session();
apply_block( (*ritr)->data, skip );
_block_id_to_block.store( new_block.id(), (*ritr)->data );
session.commit();
}
throw *except;
}
}
return true;
}
else return false;
}
}
try {
auto session = _undo_db.start_undo_session();
apply_block(new_block, skip);
_block_id_to_block.store(new_block.id(), new_block);
session.commit();
} catch ( const fc::exception& e ) {
elog("Failed to push new block:\n${e}", ("e", e.to_detail_string()));
_fork_db.remove(new_block.id());
throw;
}
return false;
} FC_CAPTURE_AND_RETHROW( (new_block) ) }
示例13: g_return_if_fail
/* Commit_edit handler - find the correct backend handler for this object
* type and call its commit handler
*/
void
GncSqlBackend::commit_edit (QofInstance* inst)
{
sql_backend be_data;
gboolean is_dirty;
gboolean is_destroying;
gboolean is_infant;
g_return_if_fail (inst != NULL);
if (qof_book_is_readonly(m_book))
{
qof_backend_set_error (&qof_be, ERR_BACKEND_READONLY);
(void)m_conn->rollback_transaction ();
return;
}
/* During initial load where objects are being created, don't commit
anything, but do mark the object as clean. */
if (m_loading)
{
qof_instance_mark_clean (inst);
return;
}
// The engine has a PriceDB object but it isn't in the database
if (strcmp (inst->e_type, "PriceDB") == 0)
{
qof_instance_mark_clean (inst);
qof_book_mark_session_saved (m_book);
return;
}
ENTER (" ");
is_dirty = qof_instance_get_dirty_flag (inst);
is_destroying = qof_instance_get_destroying (inst);
is_infant = qof_instance_get_infant (inst);
DEBUG ("%s dirty = %d, do_free = %d, infant = %d\n",
(inst->e_type ? inst->e_type : "(null)"),
is_dirty, is_destroying, is_infant);
if (!is_dirty && !is_destroying)
{
LEAVE ("!dirty OR !destroying");
return;
}
if (!m_conn->begin_transaction ())
{
PERR ("begin_transaction failed\n");
LEAVE ("Rolled back - database transaction begin error");
return;
}
bool is_ok = true;
auto obe = m_backend_registry.get_object_backend(std::string{inst->e_type});
if (obe != nullptr)
is_ok = obe->commit(this, inst);
else
{
PERR ("Unknown object type '%s'\n", inst->e_type);
(void)m_conn->rollback_transaction ();
// Don't let unknown items still mark the book as being dirty
qof_book_mark_session_saved(m_book);
qof_instance_mark_clean (inst);
LEAVE ("Rolled back - unknown object type");
return;
}
if (!is_ok)
{
// Error - roll it back
(void)m_conn->rollback_transaction();
// This *should* leave things marked dirty
LEAVE ("Rolled back - database error");
return;
}
(void)m_conn->commit_transaction ();
qof_book_mark_session_saved(m_book);
qof_instance_mark_clean (inst);
LEAVE ("");
}
示例14: SIGNAL
void Controller::connectMainWindow(){
QObject::connect(window->getWidget()->calendarWidget, SIGNAL(clicked(QDate)), this, SLOT(changeDate(QDate)));
QObject::connect(window->getWidget()->addTimeSlotButton, SIGNAL(clicked()), this, SLOT(openEditTimeSlot()));
QObject::connect(window->getWidget()->commitButton, SIGNAL(clicked()), this, SLOT(commit()));
QObject::connect(window->getWidget()->tabWidget, SIGNAL(currentChanged(int)), this, SLOT(tabIndexChanged()));
QObject::connect(window->getWidget()->comboBoxClassroom, SIGNAL(currentIndexChanged(int)), this, SLOT(tabIndexChanged()));
QObject::connect(window->getWidget()->comboBoxGroup, SIGNAL(currentIndexChanged(int)), this, SLOT(tabIndexChanged()));
QObject::connect(window->getWidget()->comboBoxStudent, SIGNAL(currentIndexChanged(int)), this, SLOT(tabIndexChanged()));
QObject::connect(window->getWidget()->actionAdministrator, SIGNAL(triggered()), this, SLOT(openAdministrator()));
QObject::connect(window->getWidget()->checkBoxMagistral, SIGNAL(stateChanged(int)), this, SLOT(tabIndexChanged()));
QObject::connect(window->getWidget()->checkBoxTutorial, SIGNAL(stateChanged(int)), this, SLOT(tabIndexChanged()));
QObject::connect(window->getWidget()->checkBoxPractical, SIGNAL(stateChanged(int)), this, SLOT(tabIndexChanged()));
QObject::connect(window, SIGNAL(signal_addTimeSlot(QTimeSlot*)), this, SLOT(addQTimeSlot(QTimeSlot*)));
}
示例15: commit
void PredType::commit(H5Location& loc, const H5std_string& name)
{
commit(loc, name.c_str());
}