QVariant RDGetSqlValue(const QString &table, const QString &name1,const QString &test1, const QString &name2,const QString &test2, const QString &name3,const QString &test3, const QString ¶m,QSqlDatabase *db,bool *valid) { RDSqlQuery *q; QString sql; QVariant v; sql="select `"+param+"` from `"+table+"` where "+ "(`"+name1+"`=\""+RDEscapeString(test1)+"\")&&"+ "(`"+name2+"`=\""+RDEscapeString(test1)+"\")&&"+ "(`"+name3+"`=\""+RDEscapeString(test1)+"\")"; q=new RDSqlQuery(sql,db); if(q->isActive()) { q->first(); v=q->value(0); if(valid!=NULL) { *valid=!q->isNull(0); } delete q; return v; } delete q; return QVariant(); }
QVariant RDGetSqlValue(const QString &table,const QString &name,unsigned test, const QString ¶m,QSqlDatabase *db,bool *valid) { RDSqlQuery *q; QString sql; QVariant v; sql="select `"+param+"` from `"+table+"` where `"+name+"`="+ QString().sprintf("%u",test); q=new RDSqlQuery(sql,db); if(q->first()) { v=q->value(0); if(valid!=NULL) { *valid=!q->isNull(0); } delete q; return v; } delete q; return QVariant(); }
bool RDIsSqlNull(const QString &table,const QString &name,unsigned test, const QString ¶m,QSqlDatabase *db) { RDSqlQuery *q; QString sql; sql="select `"+param+"` from `"+table+"` where `"+name+"`="+ QString().sprintf("%d",test); q=new RDSqlQuery(sql,db); if(q->isActive()) { q->first(); if(q->isNull(0)) { delete q; return true; } else { delete q; return false; } } delete q; return true; }
bool RDIsSqlNull(const QString &table,const QString &name,const QString &test, const QString ¶m,QSqlDatabase *db) { RDSqlQuery *q; QString sql; sql="select `"+param+"` from `"+table+"` where `"+name+"`="+ "\""+RDEscapeString(test)+"\""; q=new RDSqlQuery(sql,db); if(q->isActive()) { q->first(); if(q->isNull(0)) { delete q; return true; } else { delete q; return false; } } delete q; return true; }