void
DatabaseCommand_DirMtimes::exec( DatabaseImpl* dbi )
{
    if( m_update )
        execUpdate( dbi );
    else
        execSelect( dbi );
}
예제 #2
0
int database::dbPrivate::baseRecord::selectFromId()
{    
    clearNewValue();
    clearError();
    QString queryS=selectStr();
    queryS.append(" WHERE id=?");
#ifdef QUERY_DEBUG
    qDebug()<<"SELECT "<<queryS;
#endif
    QSqlQuery q(databs);
    q.prepare(queryS);
    q.addBindValue(_id);
    int ret= execSelect(q);
//     saveValue();
    return ret;
}
예제 #3
0
int database::dbPrivate::baseRecord::selectFromUnique()
{
    clearError();
    
//     saveDataLocaly();
    QString queryS=selectStr();
    queryS.append(" WHERE ");
    
    entryIter i=nextUnique(entries.begin() );
    if(i==entries.end() )
    {
        setError("No unigue entries");
        return Basic::DBERR;
    }
    
    for(entryIter i=entries.begin();i!=entries.end();i++)
    {        
        entry *e=i.value();
        if(e->isUnique() )
        {
            queryS.append(e->name()+"=? AND ");
        }
    }
    //remove last AND
    queryS.resize(queryS.size()-5);
    
#ifdef QUERY_DEBUG
    qDebug()<<"SELECT "<<queryS;
#endif    
    QSqlQuery q(databs);
    q.prepare(queryS);
    
    for(constEntryIter i=entries.constBegin();i!=entries.constEnd();i++)
    {
        const entry *e=i.value();
        if(e->isUnique() )
        {
            q.addBindValue(e->chosenValue() );
        }
    }
    
    return execSelect(q);
}