Example #1
0
void sqlimport::processKeyIndexes(QString tablename,QString sqlStatement,int startPos)
{
    int posStart;
    int posEnd;
    QString indexStr;

    posStart = sqlStatement.indexOf(", KEY",startPos); //
    if (posStart >= 0)
    {
        posEnd = sqlStatement.indexOf(")",posStart+1);
        if (posEnd >= 0)
        {
            indexStr = sqlStatement.mid(posStart+1,posEnd-posStart);
            //Store the index
            storeIndex(tablename,indexStr.simplified());
            //Maybe there are more indexes so
            processKeyIndexes(tablename,sqlStatement,posEnd);
        }
        else
        {
            posEnd = sqlStatement.lastIndexOf(")",-1);
            indexStr = sqlStatement.mid(posStart+1,posEnd-posStart);
            //Store the index
            storeIndex(tablename,indexStr.simplified());
        }
    }
}
Example #2
0
ModifyPropertyCommand::ModifyPropertyCommand(ResourceView *view, const QModelIndex &nodeIndex,
        ResourceView::NodeProperty property, const int mergeId, const QString &before,
        const QString &after)
        : ModelIndexViewCommand(view), m_property(property), m_before(before), m_after(after),
        m_mergeId(mergeId)
{
    storeIndex(nodeIndex);
}
int GFastaIndex::storeIndex(const char* finame) { //write the hash to a file
    if (records.Count()==0)
       GError("Error at GFastaIndex:storeIndex(): no records found!\n");
    FILE* fai=fopen(finame, "w");
    if (fai==NULL) GError("Error creating fasta index file: %s\n",finame);
    int rcount=storeIndex(fai);
    GFREE(fai_name);
    fai_name=Gstrdup(finame);
    return rcount;
    }
void Foam::equationReader::internalEvaluateScalarField
(
    scalarField& result,
    const label& equationIndex,
    label storageOffset
) const
{
#   ifdef FULLDEBUG
    // Bounds checking
    if ((equationIndex < 0) || (equationIndex >= size()))
    {
        FatalErrorIn("equationReader::internalEvaluateScalarField")
            << "equationIndex " << equationIndex << " out of bounds (0, "
            << size() - 1 << ")"
            << abort(FatalError);
    }
#   endif

    tempSrcField_.setSize(result.size());

    const equation& eqn(operator[](equationIndex));

    // Launch the reportScalarEvalStartFunction, which does this:
    //  if ((debug == 1) || (debug == 2) || (debug == 5) || (debug == 6))
    //  {
    //      reportScalarEvalStartEnabled(equationIndex);
    //      // reports details to the console that evaluation has commenced
    //  }
    //  else
    //  {
    //      reportScalarEvalStartDisabled(equationIndex);
    //      // does nothing
    //  }
    (*this.*reportScalarEvalStartFunction_)(equationIndex);

    if (eqn.size() == 0)
    {
        parse(equationIndex);
    }

    label storeIndex(-1);

    result = 0.0;

    for (label i(0); i < eqn.size(); i++)
    {
#       ifdef FULLDEBUG
        if
        (
            (
                (i == 0)
             || (eqn[i - 1].operation() == equationOperation::otstore)
            )
         && (
                eqn[i].operation()
             != equationOperation::otretrieve
            )
        )
        {
            FatalErrorIn("equationReader::internalEvaluateScalarField")
                << "Bad operation list.  Operation at " << i << " either "
                << "follows a 'store', or is the first operation.  Therefore "
                << "it should be retrieve, but it is " << eqn[i].operation()
                << "."
                << abort(FatalError);
        }
#       endif

        // Execute getSource function to which this operation points
        const scalarField& source
        (
            eqn[i].getSourceScalarFieldFunction
            (
                this,
                equationIndex,
                i,
                storeIndex + storageOffset,
                storageOffset
            )
        );

        // Launch the reportScalarOperationFunction, which does this:
        //  if ((debug == 2) || (debug == 6))
        //  {
        //      reportScalarOperationEnabled(equationIndex, i);
        //      // posts operation-by-operation information to the console
        //  }
        //  else
        //  {
        //      reportScalarOperationDisabled(equationIndex, i);
        //      // does nothing
        //  }
        (*this.*reportScalarOperationFunction_)(equationIndex, i);

        // Execute the eval function to which this operation points
        eqn[i].opScalarFieldFunction
        (
            this,
            equationIndex,
            i,
            storageOffset,
            storeIndex,
            result,
            source
        );

        // Launch the reportScalarResultFunction, which does this:
        //  if ((debug == 2) || (debug == 6))
        //  {
        //      reportScalarResultEnabled(x);
        //      // posts result to the console
        //  }
        //  else
        //  {
        //      reportScalarResultDisabled(x);
        //      // does nothing
        //  }
        (*this.*reportScalarResultFunction_)(result[0]);
    }

    //Move one level back up on the dependents_ list
    if (dependents_.size())
    {
        dependents_.setSize(dependents_.size() - 1);
    }

    storageScalarFields_.setSize(storageOffset);

    // Launch the reportScalarEvalEndFunction, which does this:
    //  if ((debug == 1) || (debug == 2) || (debug == 5) || (debug == 6))
    //  {
    //      reportScalarEvalEndEnabled(equationIndex);
    //      // reports details to the console that evaluation has completed
    //  }
    //  else
    //  {
    //      reportScalarEvalEndDisabled(equationIndex);
    //      // does nothing
    //  }
    (*this.*reportScalarEvalEndFunction_)(result[0]);

    eqn.setLastResult(result[result.size() - 1]);
    tempSrcField_.setSize(0);
}
Example #5
0
RemoveEntryCommand::RemoveEntryCommand(ResourceView *view, const QModelIndex &index)
        : ModelIndexViewCommand(view), m_entry(0), m_isExpanded(true)
{
    storeIndex(index);
}