コード例 #1
0
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);
}
コード例 #2
0
ファイル: screen.cpp プロジェクト: Commnets/QGAMES
// ---
void QGAMES::Screen::openTransaction ()
{
	if (_transaction == NULL)
		_transaction = createTransaction ();
	assert (_transaction); // The create transaction is an user's method...
	_transaction -> open ();
}
コード例 #3
0
ファイル: tcpclient.cpp プロジェクト: AsamQi/libsourcey
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);
}
コード例 #4
0
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;
}
コード例 #5
0
 //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;
     }
 }
コード例 #6
0
ファイル: qgstransaction.cpp プロジェクト: wongjimsan/QGIS
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;
}
コード例 #7
0
	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;
			}
		}
	}
コード例 #8
0
ファイル: qgstransaction.cpp プロジェクト: stevenmizuno/QGIS
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;
}
コード例 #9
0
ファイル: tcpclient.cpp プロジェクト: AsamQi/libsourcey
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);
}
コード例 #10
0
QString PackageKitProxy::removePackage(QString packageid)
{
    TransactionProxy *transaction = createTransaction();
    transaction->removePackage(packageid, false, false);
    return transaction->name();
}
コード例 #11
0
QString PackageKitProxy::updatePackage(QString packageid)
{
    TransactionProxy *transaction = createTransaction();
    transaction->updatePackage(packageid);
    return transaction->name();
}
コード例 #12
0
QString PackageKitProxy::installFile(QString filename)
{
    TransactionProxy *transaction = createTransaction();
    transaction->installFile(filename);
    return transaction->name();
}
コード例 #13
0
QString PackageKitProxy::packageDetails(QString packageid)
{
    TransactionProxy *transaction = createTransaction();
    transaction->getDetails(packageid);
    return transaction->name();
}
コード例 #14
0
QString PackageKitProxy::getInstalledApps()
{
    TransactionProxy *transaction = createTransaction();
    transaction->getPackages(TransactionProxy::FilterInstalled);
    return transaction->name();
}
コード例 #15
0
QString PackageKitProxy::searchName(QString packagename)
{
    TransactionProxy *transaction = createTransaction();
    transaction->searchNames(packagename, TransactionProxy::FilterBasename);
    return transaction->name();
}
コード例 #16
0
QString PackageKitProxy::refreshRepositoryInfo()
{
    TransactionProxy *transaction = createTransaction();
    transaction->refreshCache(false);
    return transaction->name();
}
コード例 #17
0
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);
            
	
        }
    }
}
コード例 #18
0
// 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);
}
コード例 #19
0
ファイル: parser.c プロジェクト: sosaavedra/securecoding
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;
}
コード例 #20
0
v8::Handle<v8::Value> V8Database::transactionCallback(const v8::Arguments& args)
{
    INC_STATS("DOM.Database.transaction()");
    return createTransaction(args, false);
}
コード例 #21
0
v8::Handle<v8::Value> V8DatabaseSync::readTransactionCallback(const v8::Arguments& args)
{
    INC_STATS("DOM.DatabaseSync.readTransaction()");
    return createTransaction(args, true);
}
コード例 #22
0
QString PackageKitProxy::getUpdatesList()
{
    TransactionProxy *transaction = createTransaction();
    transaction->getUpdates();
    return transaction->name();
}
コード例 #23
0
ファイル: kendingbalancedlg.cpp プロジェクト: KDE/kmymoney
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();
}