void IDBDatabaseBackend::runIntVersionChangeTransaction(PassRefPtr<IDBCallbacks> prpCallbacks, PassRefPtr<IDBDatabaseCallbacks> prpDatabaseCallbacks, int64_t transactionId, int64_t requestedVersion) { RefPtr<IDBCallbacks> callbacks = prpCallbacks; RefPtr<IDBDatabaseCallbacks> databaseCallbacks = prpDatabaseCallbacks; ASSERT(callbacks); for (DatabaseCallbacksSet::const_iterator it = m_databaseCallbacksSet.begin(); it != m_databaseCallbacksSet.end(); ++it) { // Front end ensures the event is not fired at connections that have closePending set. if (*it != databaseCallbacks) (*it)->onVersionChange(m_metadata.version, requestedVersion, IndexedDB::NullVersion); } // The spec dictates we wait until all the version change events are // delivered and then check m_databaseCallbacks.empty() before proceeding // or firing a blocked event, but instead we should be consistent with how // the old setVersion (incorrectly) did it. // FIXME: Remove the call to onBlocked and instead wait until the frontend // tells us that all the blocked events have been delivered. See // https://bugs.webkit.org/show_bug.cgi?id=71130 if (connectionCount()) callbacks->onBlocked(m_metadata.version); // FIXME: Add test for m_runningVersionChangeTransaction. if (m_runningVersionChangeTransaction || connectionCount()) { m_pendingOpenCalls.append(IDBPendingOpenCall::create(*callbacks, *databaseCallbacks, transactionId, requestedVersion)); return; } Vector<int64_t> objectStoreIds; createTransaction(transactionId, databaseCallbacks, objectStoreIds, IndexedDB::TransactionVersionChange); RefPtr<IDBTransactionBackend> transaction = m_transactions.get(transactionId); transaction->scheduleVersionChangeOperation(transactionId, requestedVersion, callbacks, databaseCallbacks, m_metadata); ASSERT(!m_pendingSecondHalfOpen); m_databaseCallbacksSet.add(databaseCallbacks); }
// --- void QGAMES::Screen::openTransaction () { if (_transaction == NULL) _transaction = createTransaction (); assert (_transaction); // The create transaction is an user's method... _transaction -> open (); }
void TCPClient::sendConnectRequest(const net::Address& peerAddress) { // 4.3. Initiating a Connection // // To initiate a TCP connection to a peer, a client MUST send a Connect // request over the control connection for the desired allocation. The // Connect request MUST include an XOR-PEER-ADDRESS attribute containing // the transport address of the peer to which a connection is desired. TraceL << "Send Connect request" << endl; auto transaction = createTransaction(); //transaction->request().setType(stun::Message::Connect); //stun::Message request(stun::Message::Request, stun::Message::Allocate); transaction->request().setClass(stun::Message::Request); transaction->request().setMethod(stun::Message::Connect); auto peerAttr = new stun::XorPeerAddress; peerAttr->setAddress(peerAddress); //peerAttr->setFamily(1); //peerAttr->setPort(peerAddress.port()); //peerAttr->setIP(peerAddress.host()); transaction->request().add(peerAttr); sendAuthenticatedTransaction(transaction); }
HTTPTransaction* HTTPUpstreamSession::newTransaction(HTTPTransaction::Handler* handler, int8_t priority) { CHECK_NOTNULL(handler); if (!supportsMoreTransactions() || draining_) { // This session doesn't support any more parallel transactions return nullptr; } if (!started_) { startNow(); } auto txn = createTransaction(codec_->createStream(), 0, priority); if (txn) { DestructorGuard dg(this); auto txnID = txn->getID(); txn->setHandler(handler); setNewTransactionPauseState(txnID); } return txn; }
//qDebug() << "transaction list" << transactionList; foreach(QString transName, transactionList) { if (!m_transactions.contains(transName)) { //qDebug() << "Unknown transaction" << transName; createTransaction(transName, false); } else { //qDebug() << "Known transaction" << transName; } }
QgsTransaction* QgsTransaction::create( const QString& connString, const QString& providerKey ) { std::unique_ptr< QLibrary > lib( QgsProviderRegistry::instance()->providerLibrary( providerKey ) ); if ( !lib ) return nullptr; createTransaction_t* createTransaction = reinterpret_cast< createTransaction_t* >( cast_to_fptr( lib->resolve( "createTransaction" ) ) ); if ( !createTransaction ) return nullptr; QgsTransaction* ts = createTransaction( connString ); return ts; }
void RDFGraphBasic::removeResources(RDFVariable const &variable) { QLinkedList<RDFVariable> removes; removes << variable; RDFTransactionPtr tx = createTransaction(); while(1) { RDFStatementList removed_statements; executeQuery (RDFUpdate(service_context_data_->update()) .addDeletion(*recurseRemoveResources (&removed_statements, removes.front(), &removes))); removes.pop_front(); tx->commit(); if(!removes.size()) return; if(!(tx = createTransaction(RDFTransaction::Exclusive))) { warning() << "using recursive sharing removes requires that " "no transaction is active on the service"; return; } } }
QgsTransaction* QgsTransaction::create( const QString& connString, const QString& providerKey ) { QLibrary* lib = QgsProviderRegistry::instance()->providerLibrary( providerKey ); if ( !lib ) { return 0; } createTransaction_t* createTransaction = ( createTransaction_t* ) cast_to_fptr( lib->resolve( "createTransaction" ) ); if ( !createTransaction ) { return 0; } QgsTransaction* ts = createTransaction( connString ); delete lib; return ts; }
void TCPClient::onRelayConnectionConnect(void* sender) { TraceL << "onRelayConnectionConnect" << endl; auto conn =reinterpret_cast<net::Socket*>(sender); conn->Connect -= sdelegate(this, &TCPClient::onRelayConnectionConnect); auto req = reinterpret_cast<RelayConnectionBinding*>(conn->opaque); assert(connections().has(req->peerAddress)); // TODO: How to get peerAddress here? //net::TCPSocket& socket = _connections.get(peerAddress, conn); auto transaction = createTransaction(connections().get(req->peerAddress)); transaction->request().setClass(stun::Message::Request); transaction->request().setMethod(stun::Message::ConnectionBind); auto connAttr = new stun::ConnectionID; connAttr->setValue(req->connectionID); transaction->request().add(connAttr); //assert(transaction->socket() == &conn); sendAuthenticatedTransaction(transaction); }
QString PackageKitProxy::removePackage(QString packageid) { TransactionProxy *transaction = createTransaction(); transaction->removePackage(packageid, false, false); return transaction->name(); }
QString PackageKitProxy::updatePackage(QString packageid) { TransactionProxy *transaction = createTransaction(); transaction->updatePackage(packageid); return transaction->name(); }
QString PackageKitProxy::installFile(QString filename) { TransactionProxy *transaction = createTransaction(); transaction->installFile(filename); return transaction->name(); }
QString PackageKitProxy::packageDetails(QString packageid) { TransactionProxy *transaction = createTransaction(); transaction->getDetails(packageid); return transaction->name(); }
QString PackageKitProxy::getInstalledApps() { TransactionProxy *transaction = createTransaction(); transaction->getPackages(TransactionProxy::FilterInstalled); return transaction->name(); }
QString PackageKitProxy::searchName(QString packagename) { TransactionProxy *transaction = createTransaction(); transaction->searchNames(packagename, TransactionProxy::FilterBasename); return transaction->name(); }
QString PackageKitProxy::refreshRepositoryInfo() { TransactionProxy *transaction = createTransaction(); transaction->refreshCache(false); return transaction->name(); }
void parseInputToList(FILE* fp,My402List *list) { char buffer[1026]; // FILE *fpNew = fopen("f1", "r"); while(fgets(buffer, sizeof(buffer)/sizeof(char), fp) != NULL) { if (strlen(buffer) > 1024) { fprintf(stderr, "Line longer than 1024 characters \n"); exit(1); } transaction *newObject = createTransaction(); if (newObject) { // parsing code const char s[2] = "\t"; char *token; // type of transaction token = strtok(buffer, s); if((strcmp(token,"+") != 0) && (strcmp(token,"-") != 0)) { fprintf(stderr, "Malformed file \n"); exit(1); } strcpy(newObject->type,token); // timestamp token = strtok(NULL, s); if (strlen(token) >= 11 || atol(token) > time(0)) { fprintf(stderr, "Bad timestamp \n"); exit(1); } time_t raw_time = atol(token); newObject->timeStamp = (unsigned int)atol(token); struct tm* timeinfo = localtime (&raw_time); strftime (newObject->timeStampDesc,16,"%a %b %e %Y",timeinfo); // amount token = strtok(NULL, s); long length = atol(token); if (length <1 || length >= 10000000) { fprintf(stderr, "Length of amount greater than desired range or less than 1 \n"); exit(1); } char *dec = strchr(token,'.'); int decPosition = (int)(dec -token); if ((strlen(token) - decPosition) > 3) { fprintf(stderr, "Decimal places more than 2 \n"); exit(1); } strcpy(newObject->amount,token); // transaction description token = strtok(NULL, s); char *exceedField = strtok(NULL, s); if (exceedField && strlen(exceedField) > 0) { fprintf(stderr, "Too many fields \n"); exit(1); } token = strtok(token,"\n"); if (strlen(token) < 1) { fprintf(stderr, "Description not empty \n"); exit(1); } if (strlen(token) > 24) { strncpy(newObject->desc,token,24); }else { strncpy(newObject->desc,token,strlen(token)); } newObject->desc[strlen(token)] = '\0'; My402ListAppend(list, newObject); } } }
// FIXME: Remove this as part of https://bugs.webkit.org/show_bug.cgi?id=102733. PassRefPtr<IDBTransactionBackendInterface> IDBDatabaseBackendImpl::transaction(const Vector<int64_t>& objectStoreIds, unsigned short mode) { return createTransaction(0, objectStoreIds, mode); }
int main (int argc, char **argv){ char *fileName; char *client_id; if(argc != 3){ fprintf(stderr, "Wrong number of parameters. Expected 2, found %d\n", (argc - 1)); return EXIT_FAILURE; } fileName = argv[1]; client_id = argv[2]; for(int i = 0; i < strlen(client_id); i++){ if(!isdigit(*(client_id + i))){ fprintf(stderr, "Account number %s must be integer\n", client_id); return EXIT_FAILURE; } } FILE *transactionFile = fopen(fileName, "r"); if(transactionFile == NULL){ perror("fopen()"); fprintf(stderr, "failed in file %s at line# %d\n", __FILE__, __LINE__-4); return EXIT_FAILURE; } char *line = malloc((LINE_SIZE + 1) * sizeof (char)); if(line == NULL){ fprintf(stderr, "Insufficient memory at line #%d\n", __LINE__); fclose(transactionFile); return EXIT_FAILURE; } size_t lineNumber = 0; Transaction *transactions; if(fgets(line, (LINE_SIZE + 1), transactionFile) != NULL){ lineNumber++; trim(line); transactions = createTransaction(line); if(transactions == NULL){ fprintf(stderr, "Transaction in line %zu could not be created\n", lineNumber); free(line); fclose(transactionFile); return EXIT_FAILURE; } while(fgets(line, (LINE_SIZE + 1), transactionFile) != NULL){ lineNumber++; trim(line); Transaction *transaction = createTransaction(line); if(transaction == NULL){ fprintf(stderr, "Transaction in line %zu could not be created\n", lineNumber); freeTransactions(transactions); free(line); fclose(transactionFile); return EXIT_FAILURE; } addTransaction(transactions, transaction); } } if(ferror(transactionFile)){ fprintf(stderr, "fgets() failed in file %s at line # %d\n", __FILE__, __LINE__); freeTransactions(transactions); free(line); return EXIT_FAILURE; } saveTransactions(transactions, client_id); printTransactionError(transactions); freeTransactions(transactions); fclose(transactionFile); return EXIT_SUCCESS; }
v8::Handle<v8::Value> V8Database::transactionCallback(const v8::Arguments& args) { INC_STATS("DOM.Database.transaction()"); return createTransaction(args, false); }
v8::Handle<v8::Value> V8DatabaseSync::readTransactionCallback(const v8::Arguments& args) { INC_STATS("DOM.DatabaseSync.readTransaction()"); return createTransaction(args, true); }
QString PackageKitProxy::getUpdatesList() { TransactionProxy *transaction = createTransaction(); transaction->getUpdates(); return transaction->name(); }
void KEndingBalanceDlg::accept() { if ((!field("interestEditValid").toBool() || createTransaction(d->m_tInterest, -1, field("interestEdit").value<MyMoneyMoney>(), field("interestCategoryEdit").toString(), field("interestDateEdit").toDate())) && (!field("chargesEditValid").toBool() || createTransaction(d->m_tCharges, 1, field("chargesEdit").value<MyMoneyMoney>(), field("chargesCategoryEdit").toString(), field("chargesDateEdit").toDate()))) KEndingBalanceDlgDecl::accept(); }